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

14 lines
1.6 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.
* http://www.shopmodule.com
*
* @license
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
* @author D3 Data Development - Daniel Seifert <support@shopmodule.com>
* @link http://www.oxidmodule.com
*/
$(function(){"use strict";$.widget("ui.d3extsearchias",{options:{sElementId:"IAS_box",sInputElementId:"IAS_input",sCloseElementId:"IAS_closebtn",iPosOffset:10,sLastSelection:"",iDelay:600,oClearWnd:null},_create:function(){let e=this,t=this.options;$("#"+t.sElementId).mouseup(function(e){e.stopPropagation()}),$("body").mouseup(function(t){e.checkIasWindow(t)}),$("#"+t.sCloseElementId).click(function(){e.clearIasWindow()})},showIasWindow:function(e){let t=this.options,n=$("#"+t.sElementId),o=$("#"+t.sInputElementId);if(n.length){let s=this.getSelection();s!==t.sLastSelection&&s.length>0&&(n.show().css({top:e.pageY+t.iPosOffset+"px",left:e.pageX+t.iPosOffset+"px"}),o.val(s),t.sLastSelection=s)}},checkIasWindow:function(e){this.getSelection()?this.showIasWindow(e):this.clearIasWindow()},clearIasWindow:function(){let e=this.options;$("#"+e.sElementId).hide(),e.sLastSelection=""},getSelection:function(){let e;return window.getSelection?e=window.getSelection():document.getSelection?e=document.getSelection():document.selection&&(e=document.selection.createRange().text),e.toString()}})}(jQuery));