8
0
Fork 0
ExtSearch/src/out/src/js/d3extsearch.min.js

14 Zeilen
8.9 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.d3extsearchsuggest",{options:{currentEvent:null,oAjaxResponseElement:null,isSend:0,coloredId:null,oldColoredId:null,iActLine:null,iCode:null,blNavigate:null,iRet:null,sSelection:null,oSelection:null,iDelay:600,sD3SearchBoxDefault:"",sWaitMessage:"",sParentThemeId:"flow",sRequestUrl:null,sSearchFormId:"search",sCloseBtnId:"d3extsearch_suggest_closebtn",sResultListId:"#searchItemList",sResultItemClass:".d3QSItem",sStartSearchButtonId:"d3extsearch_suggest_startsearch",sResponseElementId:"xajax_resp",sResponseElementClass:"xajax_resp_cl",sWaitMsgIdentificator:"#d3_extsearch_quicksearch.searchWaitMsg",sRequestFncName:"getSuggestContent",sSearchParamName:"searchParam",sActClassName:"item_act",sInactClassName:"item_inact",sActiveElementClassName:null,blSetActiveElementDimensions:!0,sActiveElementStyleTop:null,sActiveElementStyleTopImportant:"",sActiveElementStyleLeft:null,sActiveElementStyleLeftImportant:"",blAutomatedActiveElementStyleWidth:!1,sActiveElementStyleWidth:null,sActiveElementStyleWidthImportant:"",iScrollTopOffset:29,blEnableLeftRightNavigation:!0,blToggleLeftRightDirection:!1},_create:function(){let e=this,t=this.element;this.addResponseElement(),t.keyup(function(t){e.keyHandler(t)})},addResponseElement:function(){let e=this.options,t=$("#"+e.sResponseElementId);0===t.length?e.oAjaxResponseElement=$("<div>",{id:e.sResponseElementId,class:e.sResponseElementClass+" xajax_resp_"+e.sParentThemeId}).appendTo("body"):e.oAjaxResponseElement=t},mouseHandler:function(e,t){let s=this.options;s.oldColoredId=s.coloredId,s.coloredId=e,s.iActLine=t,s.blNavigate=!0,this.changeResultItemColor(s.coloredId,s.oldColoredId)},keyHandler:function(e){e.preventDefault();let t=this.options;t.currentEvent=e;let s="submit"===e.type.toLowerCase(),o=s?"Enter":e.originalEvent.key;s||"enter"===o.toLowerCase()||t.oAjaxResponseElement.is(":visible")?"arrowup"===o.toLowerCase()?this.handleArrowUpKey():"arrowleft"!==o.toLowerCase()&&"pageup"!==o.toLowerCase()||!t.blEnableLeftRightNavigation?"arrowright"!==o.toLowerCase()&&"pagedown"!==o.toLowerCase()||!t.blEnableLeftRightNavigation?"arrowdown"===o.toLowerCase()?this.handleArrowDownKey():"enter"===o.toLowerCase()?t.blNavigate?this.handleEnterKeyOnSelectedItem():this.handleEnterKeyWithoutSelectedItem():"escape"===o.toLowerCase()?this.handleEscapeKey():this.handleOtherKeys():this.handleArrowRightKey():this.handleArrowLeftKey():this.showSuggestWindow()},handleArrowUpKey:function(){let e=this.options;e.iActLine>0&&e.iActLine--,e.coloredId&&(e.oldColoredId=e.coloredId),e.blNavigate=!0,e.coloredId=this.getResultItemIdByLine(e.iActLine),this.changeResultItemColor(e.coloredId,e.oldColoredId)},handleArrowDownKey:function(){let e=this.options,t=this.getResultItemCount();e.iActLine<t-1&&e.iActLine++,e.coloredId&&(e.oldColoredId=e.coloredId),e.blNavigate=!0,e.coloredId=this.getResultItemIdByLine(e.iActLine),this.changeResultItemColor(e.coloredId,e.oldColoredId)},handleArrowLeftKey:function(){let e=this.options,t=null,s=null,o=this.getTypesList();if(e.iActLine<0)t=0,s=0;else{let n=$("#"+this.getResultItemIdByLine(e.iActLine)).attr("data-object-type");null!==n?n&&n.length&&o.length>1&&(t=$.inArray(n,o),s=e.blToggleLeftRightDirection?1:-1):console.error("selected item has no data-object-type attribute, can not switch to next group")}if(null!==t){let n=o[t+s],l=this.findFirstElementIdByObjectType(n);null!==l&&(e.coloredId&&(e.oldColoredId=e.coloredId),e.coloredId=l,this.changeResultItemColor(e.coloredId,e.oldColoredId),e.oldColoredId=e.coloredId)}},handleArrowRightKey:function(){let e=this.options,t=null,s=null,o=this.getTypesList();if(e.iActLine<0)t=0,s=0;else{let n=$("#"+this.getResultItemIdByLine(e.iActLine)).attr("data-object-type");n?n&&n.length&&o.length>1&&(t=$.inArray(n,o),s=e.blToggleLeftRightDirection?-1:1):console.error("selected item has no data-object-type attribute, can not switch to next group")}if(null!==t){let n=o[t+s],l=this.findFirstElementIdByObjectType(n);l&&(e.coloredId&&(e.oldColoredId=e.coloredId),e.coloredId=l,this.changeResultItemColor(e.coloredId,e.