ExtSearch/src/out/src/js/d3extsearch.min.js

14 regels
8.1 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(){$.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",sActiveElementStyleDisplay:"block",sActiveElementStyleTop:null,sActiveElementStyleLeft:null,blAutomatedActiveElementStyleWidth:!1,sActiveElementStyleWidth:null,iScrollTopOffset:29,blEnableLeftRightNavigation:!0,blToggleLeftRightDirection:!1},_create:function(){var a=this,b=this.element,c=this.options;this.addResponseElement(),b.keyup(function(b){a.keyHandler(b)}),$("#"+c.sSearchFormId).submit(function(b){a.keyHandler(b)})},addResponseElement:function(){var a=this.options,b=$("#"+a.sResponseElementId);0===b.length?a.oAjaxResponseElement=$("<div>",{id:a.sResponseElementId,class:a.sResponseElementClass+" xajax_resp_"+a.sParentThemeId}).appendTo("body"):a.oAjaxResponseElement=b},mouseHandler:function(a,b){var c=this.options;c.oldColoredId=c.coloredId,c.coloredId=a,c.iActLine=b,c.blNavigate=!0,this.changeResultItemColor(c.coloredId,c.oldColoredId)},keyHandler:function(a){a.preventDefault();var b=this.options;b.currentEvent=a;var c="submit"===a.type.toLowerCase(),d=c?"Enter":a.key;c||b.oAjaxResponseElement.is(":visible")?"arrowup"===d.toLowerCase()?this.handleArrowUpKey():"arrowleft"!==d.toLowerCase()&&"pageup"!==d.toLowerCase()||!b.blEnableLeftRightNavigation?"arrowright"!==d.toLowerCase()&&"pagedown"!==d.toLowerCase()||!b.blEnableLeftRightNavigation?"arrowdown"===d.toLowerCase()?this.handleArrowDownKey():"enter"===d.toLowerCase()?b.blNavigate?this.handleEnterKeyOnSelectedItem():this.handleEnterKeyWithoutSelectedItem():"escape"===d.toLowerCase()?this.handleEscapeKey():this.handleOtherKeys():this.handleArrowRightKey():this.handleArrowLeftKey():this.showSuggestWindow()},handleArrowUpKey:function(){var a=this.options;a.iActLine>0&&a.iActLine--,a.coloredId&&(a.oldColoredId=a.coloredId),a.blNavigate=!0,a.coloredId=this.getResultItemIdByLine(a.iActLine),this.changeResultItemColor(a.coloredId,a.oldColoredId)},handleArrowDownKey:function(){var a=this.options,b=this.getResultItemCount();a.iActLine<b-1&&a.iActLine++,a.coloredId&&(a.oldColoredId=a.coloredId),a.blNavigate=!0,a.coloredId=this.getResultItemIdByLine(a.iActLine),this.changeResultItemColor(a.coloredId,a.oldColoredId)},handleArrowLeftKey:function(){var a=this.options,b=null,c=null,d=this.getTypesList();if(a.iActLine<0)b=0,c=0;else{var e=$("#"+this.getResultItemIdByLine(a.iActLine)).attr("data-object-type");null!==e?e&&e.length&&d.length>1&&(b=$.inArray(e,d),c=a.blToggleLeftRightDirection?1:-1):console.error("selected item has no data-object-type attribute, can not switch to next group")}if(null!==b){var f=d[b+c],g=this.findFirstElementIdByObjectType(f);null!==g&&(a.coloredId&&(a.oldColoredId=a.coloredId),a.coloredId=g,this.changeResultItemColor(a.coloredId,a.oldColoredId),a.oldColoredId=a.coloredId)}},handleArrowRightKey:function(){var a=this.options,b=null,c=null,d=this.getTypesList();if(a.iActLine<0)b=0,c=0;else{var e=$("#"+this.getResultItemIdByLine(a.iActLine)).attr("data-object-type");e?e&&e.length&&d.length>1&&(b=$.inArray(e,d),c=a.blToggleLeftRightDirection?-1:1):console.error("selected item has no data-object-type attribute, can not switch to next group")}if(null!==b){var f=d[b+c],g=this.findFirstElementIdByObjectType(f);g&&(a.coloredId&&(a.oldColoredId=a.coloredId),a.coloredId=g,this.changeResultItemColor(a.coloredId,a.oldColoredId),a.oldColoredId=a.coloredId)}},getTypesList:function(){var a=[];return this.getResultItemListElement