ExtSearch/assets/out/src/js/apex/d3extsearch_ias.min.js

14 lines
1.7 KiB
JavaScript

/**
* This Software is the property of Data Development and is protected
* by copyright law - it is NOT Freeware.
* Any unauthorized use of this software without a valid license
* is a violation of the license agreement and will be prosecuted by
* civil and criminal law.
* https://www.d3data.de
*
* @license
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
* @author D3 Data Development - Daniel Seifert <support@shopmodule.com>
* @link https://www.oxidmodule.com
*/
let d3ExtsearchIAS=function(){"use strict";return function(e){let t={sElementId:"IAS_box",sInputElementId:"IAS_input",sCloseElementId:"IAS_closebtn",iPosOffset:10,sLastSelection:"",iDelay:600,oClearWnd:null},n=function(){let e;return window.getSelection?e=window.getSelection():document.getSelection?e=document.getSelection():document.selection&&(e=document.selection.createRange().text),e.toString()},o=function(){console.debug("clear IAS window"),document.querySelector("#"+t.sElementId).style.display="none",t.sLastSelection=""},l=function(e){console.debug("check IAS window"),n()?function(e){console.debug("show IAS window");let o=document.querySelector("#"+t.sElementId),l=document.querySelector("#"+t.sInputElementId);if(o){let c=n();c!==t.sLastSelection&&c.length>0&&(o.style.display="block",o.style.top=e.pageY+t.iPosOffset+"px",o.style.left=e.pageX+t.iPosOffset+"px",l.value=c,t.sLastSelection=c)}}(e):o()};!function(e){console.debug("IAS initialized"),t={...t,...e},console.debug("IAS: set mouse events"),document.querySelector("#"+t.sElementId).addEventListener("mouseup",function(e){e.stopPropagation()}),document.querySelector("body").addEventListener("mouseup",function(e){l(e)}),document.querySelector("#"+t.sCloseElementId).addEventListener("click",function(){o()})}(e)}}();