PageSourceSearch

https://businesschannel.com.tr/wp-content/themes/kanews/assets/js/ajax-search.min.js?ver=9.3.1

js businesschannel.com.tr collected 2026-10-07 18:32:39 UTC 15,134 bytes, 2 lines download raw bytes

1(t=>{"function"==typeof define&&define.amd?define(["jquery"],t):"object"==typeof exports&&"function"==typeof require?t(require("jquery")):t(jQuery)})(function(c){var s={escapeRegExChars:function(t){return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&")},createNode:function(t){var e=document.createElement("div");return e.className=t,e.style.position="absolute",e.style.display="none",e}},t=c.noop;function o(t,e){this.element=t,this.el=c(t),this.suggestions=[],this.badQueries=[],this.selectedIndex=-1,this.currentValue=this.element.value,this.timeoutId=null,this.cachedResponse={},this.onChangeTimeout=null,this.onChange=null,this.isLocal=!1,this.suggestionsContainer=null,this.noSuggestionsContainer=null,this.options=c.extend(!0,{},o.defaults,e),this.classes={selected:"autocomplete-selected",suggestion:"autocomplete-suggestion"},this.hint=null,this.hintValue="",this.selection=null,this.initialize(),this.setOptions(e)}o.utils=s,(c.Autocomplete=o).defaults={ajaxSettings:{},autoSelectFirst:!1,appendTo:"body",serviceUrl:null,lookup:null,onSelect:null,onHint:null,width:"auto",minChars:1,maxHeight:300,deferRequestBy:0,params:{},formatResult:function(t,e){return e?(e="("+s.escapeRegExChars(e)+")",t.value.replace(new RegExp(e,"gi"),"<strong>$1</strong>").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/&lt;(\/?strong)&gt;/g,"<$1>")):t.value},formatGroup:function(t,e){return'<div class="autocomplete-group">'+e+"</div>"},delimiter:null,zIndex:9999,type:"GET",noCache:!1,onSearchStart:t,onSearchComplete:t,onSearchError:t,preserveInput:!1,containerClass:"autocomplete-suggestions",tabDisabled:!1,dataType:"text",currentRequest:null,triggerSelectOnValidInput:!0,preventBadQueries:!0,lookupFilter:function(t,e,s){return-1!==t.value.toLowerCase().indexOf(s)},paramName:"query",transformResult:function(t){return"string"==typeof t?c.parseJSON(t):t},showNoSuggestionNotice:!1,noSuggestionNotice:"No results",orientation:"bottom",forceFixPosition:!1},o.prototype={initialize:function(){var t,e=this,s="."+e.classes.suggestion,i=e.classes.selected,n=e.options;e.element.setAttribute("autocomplete","off"),e.noSuggestionsContainer=c('<div class="autocomplete-no-suggestion"></div>').html(this.options.noSuggestionNotice).get(0),e.suggestionsContainer=o.utils.createNode(n.containerClass),(t=c(e.suggestionsContainer)).appendTo(n.appendTo||"body"),"auto"!==n.width&&t.css("width",n.width),t.on("mouseover.autocomplete",s,function(){e.activate(c(this).data("index"))}),t.on("mouseout.autocomplete",function(){e.selectedIndex=-1,t.children("."+i).removeClass(i)}),t.on("click.autocomplete",s,function(){e.select(c(this).data("index"))}),t.on("click.autocomplete",function(){clearTimeout(e.blurTimeoutId)}),e.fixPositionCapture=function(){e.visible&&e.fixPosition()},c(window).on("resize.autocomplete",e.fixPositionCapture),e.el.on("keydown.autocomplete",function(t){e.onKeyPress(t)}),e.el.on("keyup.autocomplete",function(t){e.onKeyUp(t)}),e.el.on("blur.autocomplete",function(){e.onBlur()}),e.el.on("focus.autocomplete",function(){e.onFocus()}),e.el.on("change.autocomplete",function(t){e.onKeyUp(t)}),e.el.on("input.autocomplete",function(t){e.onKeyUp(t)})},onFocus:function(){this.disabled||(this.fixPosition(),this.el.val().length>=this.options.minChars&&this.onValueChange())},onBlur:function(){var t=this,e=t.options,s=t.el.val(),i=t.getQuery(s);t.blurTimeoutId=setTimeout(function(){t.hide(),t.selection&&t.currentValue!==i&&(e.onInvalidateSelection||c.noop).call(t.element)},200)},abortAjax:function(){this.currentRequest&&(this.currentRequest.abort(),this.currentRequest=null)},setOptions:function(t){t=c.extend({},this.options,t);this.isLocal=Array.isArray(t.lookup),this.isLocal&&(t.lookup=this.verifySuggestionsFormat(t.lookup)),t.orientation=this.validateOrientation(t.orientation,"bottom"),c(this.suggestionsContainer).css({"max-height":t.maxHeight+"px",width:t.width+"px","z-index":t.zIndex}),this.options=t},clearCache:function(){this.cachedResponse={},this.badQueries=[]},clear:function(){this.clearCache(),this.currentValue="",this.suggestions=[]},disable:function(){this.disabled=!0,clearTimeout(this.onChangeTimeout),this.abortAjax()},enable:function(){this.disabled=!1},fixPosition:function(){var t,e,s,i,n,o,a,u,l=c(this.suggestionsContainer),r=l.parent().get(0);r!==document.body&&!this.options.forceFixPosition||(o=this.options.orientation,t=l.outerHeight(),e=this.el.outerHeight(),s={top:(a=this.el.offset()).top,left
1:a.left},"auto"===o&&(u=c(window).height(),i=-(n=c(window).scrollTop())+a.top-t,n=n+u-(a.top+e+t),o=Math.max(i,n)===i?"top":"bottom"),s.top+="top"===o?-t:e,r!==document.body&&(u=l.css("opacity"),this.visible||l.css("opacity",0).show(),a=l.offsetParent().offset(),s.top-=a.top,s.top+=r.scrollTop,s.left-=a.left,this.visible||l.css("opacity",u).hide()),"auto"===this.options.width&&(s.width=this.el.outerWidth()+"px"),l.css(s))},isCursorAtEnd:function(){var t=this.el.val().length,e=this.element.selectionStart;return"number"==typeof e?e===t:!document.selection||((e=document.selection.createRange()).moveStart("character",-t),t===e.text.length)},onKeyPress:function(t){if(this.disabled||this.visible||40!==t.which||!this.currentValue){if(!this.disabled&&this.visible){switch(t.which){case 27:this.el.val(this.currentValue),this.hide();break;case 39:if(this.hint&&this.options.onHint&&this.isCursorAtEnd()){this.selectHint();break}return;case 9:if(this.hint&&this.options.onHint)return void this.selectHint();if(-1===this.selectedIndex)return void this.hide();if(this.select(this.selectedIndex),!1===this.options.tabDisabled)return;break;case 13:if(-1===this.selectedIndex)return void this.hide();this.select(this.selectedIndex);break;case 38:this.moveUp();break;case 40:this.moveDown();break;default:return}t.stopImmediatePropagation(),t.preventDefault()}}else this.suggest()},onKeyUp:function(t){var e=this;if(!e.disabled){switch(t.which){case 38:case 40:return}clearTimeout(e.onChangeTimeout),e.currentValue!==e.el.val()&&(e.findBestHint(),0<e.options.deferRequestBy?e.onChangeTimeout=setTimeout(function(){e.onValueChange()},e.options.deferRequestBy):e.onValueChange())}},onValueChange:function(){var t,e,s;this.ignoreValueChange?this.ignoreValueChange=!1:(t=this.options,e=this.el.val(),s=this.getQuery(e),this.selection&&this.currentValue!==s&&(this.selection=null,(t.onInvalidateSelection||c.noop).call(this.element)),clearTimeout(this.onChangeTimeout),this.currentValue=e,this.selectedIndex=-1,t.triggerSelectOnValidInput&&this.isExactMatch(s)?this.select(0):s.length<t.minChars?this.hide():this.getSuggestions(s))},isExactMatch:function(t){var e=this.suggestions;return 1===e.length&&e[0].value.toLowerCase()===t.toLowerCase()},getQuery:function(t){var e=this.options.delimiter;return e?(e=t.split(e),c.trim(e[e.length-1])):t},getSuggestionsLocal:function(e){var t=this.options,s=e.toLowerCase(),i=t.lookupFilter,n=parseInt(t.lookupLimit,10),t={suggestions:c.grep(t.lookup,function(t){return i(t,e,s)})};return n&&t.suggestions.length>n&&(t.suggestions=t.suggestions.slice(0,n)),t},getSuggestions:function(i){var t,e,s,n=this,o=n.options,a=o.serviceUrl;o.params[o.paramName]=i,!1!==o.onSearchStart.call(n.element,o.params)&&(t=o.ignoreParams?null:o.params,c.isFunction(o.lookup)?o.lookup(i,function(t){n.suggestions=t.suggestions,n.suggest(),o.onSearchComplete.call(n.element,i,t.suggestions)}):(s=n.isLocal?n.getSuggestionsLocal(i):(c.isFunction(a)&&(a=a.call(n.element,i)),e=a+"?"+c.param(t||{}),n.cachedResponse[e]))&&Array.isArray(s.suggestions)?(n.suggestions=s.suggestions,n.suggest(),o.onSearchComplete.call(n.element,i,s.suggestions)):n.isBadQuery(i)?o.onSearchComplete.call(n.element,i,[]):(n.abortAjax(),s={url:a,data:t,type:o.type,dataType:o.dataType},c.extend(s,o.ajaxSettings),n.currentRequest=c.ajax(s).done(function(t){n.currentRequest=null,t=o.transformResult(t,i),n.processResponse(t,i,e),o.onSearchComplete.call(n.element,i,t.suggestions)}).fail(function(t,e,s){o.onSearchError.call(n.element,i,t,e,s)})))},isBadQuery:function(t){if(this.options.preventBadQueries)for(var e=this.badQueries,s=e.length;s--;)if(0===t.indexOf(e[s]))return!0;return!1},hide:function(){var t=c(this.suggestionsContainer);c.isFunction(this.options.onHide)&&this.visible&&this.options.onHide.call(this.element,t),this.visible=!1,this.selectedIndex=-1,clearTimeout(this.onChangeTimeout),c(this.suggestionsContainer).hide(),this.onHint(null)},suggest:function(){var i,n,o,a,u,l,t,e,s,r,h;this.suggestions.length?(n=this.options,o=n.groupBy,a=n.formatResult,u=this.getQuery(this.currentValue),l=this.classes.suggestion,t=this.classes.selected,e=c(this.suggestionsContainer),s=c(this.noSuggestionsContainer),r=n.beforeRender,h="",n.triggerSelectOnValidInput&&this.isExactMatch(u)?this.select(0):(c.each(this.suggestions,function(t,e){var s;o&&(h+=(s=e.data[o],i===s?"":(i=s,n.formatGroup(e,i)))),h+='<div class="'+l+'" data-index="'+t+'">'+a(e,u,t)+"</div>"}),this.adjustContainerWidth(),s.detach(),e.html(h),c.isFunction(r)&&r.call(this.element,e,this.suggestions),this.fixPosition(),e.show(),n.autoSelectFirst&&(this.selectedIndex=0,e.scrollTop(0),e.children("."+l).first().addClass(t)),this.visible=!0,this.findBestHint())):this.options.showNoSuggestionNotice?this.noSuggestions():this.hide()},noSuggestions:function(){var t=this.options.beforeRender,e=c(this.suggestionsContainer),s=c(this.noSuggestionsContainer);this.adjustContainerWidth(),s.detach(),e.empty(),e.append(s),c.isFunction(t)&&t.call(this.element,e,this.suggestions),this.fixPosition(),e.show(),this.visible=!0},adjustContainerWidth:function(){var t,e=this.options,s=c(this.suggestionsContainer);"auto"===e.width?(t=this.el.outerWidth(),s.css("width",0<t?t:300)):"flex"===e.width&&s.css("width","")},findBestHint:function(){var i=this.el.val().toLowerCase(),n=null;i&&(c.each(this.suggestions,function(t,e){var s=0===e.value.toLowerCase().indexOf(i);return s&&(n=e),!s}),this.onHint(n))},onHint:function(t){var e=this.options.onHint,s="";t&&(s=this.currentValue+t.value.substr(this.currentValue.length)),this.hintValue!==s&&(this.hintValue=s,this.hint=t,c.isFunction(e))&&e.call(this.element,s)},verifySuggestionsFormat:function(t){return t.length&&"string"==typeof t[0]?c.map(t,function(t){return{value:t,data:null}}):t},validateOrientation:function(t,e){return t=c.trim(t||"").toLowerCase(),t=-1===c.inArray(t,["auto","bottom","top"])?e:t},processResponse:function(t,e,s){var i=this.options;t.suggestions=this.verifySuggestionsFormat(t.suggestions),i.noCache||(this.cachedResponse[s]=t,i.preventBadQueries&&!t.suggestions.length&&this.badQueries.push(e)),e===this.getQuery(this.currentValue)&&(this.suggestions=t.suggestions,this.suggest())},activate:function(t){var e=this.classes.selected,s=c(this.suggestionsContainer),i=s.find("."+this.classes.suggestion);return s.find("."+e).removeClass(e),this.selectedIndex=t,-1!==this.selectedIndex&&i.length>this.selectedIndex?(s=i.get(this.selectedIndex),c(s).addClass(e),s):null},selectHint:function(){var t=c.inArray(this.hint,this.suggestions);this.select(t)},select:function(t){this.hide(),this.onSelect(t)},moveUp:function(){if(-1!==this.selectedIndex)return 0===this.selectedIndex?(c(this.suggestionsContainer).children("."+this.classes.suggestion).first().removeClass(this.classes.selected),this.selectedIndex=-1,this.ignoreValueChange=!1,this.el.val(this.currentValue),void this.findBestHint()):void this.adjustScroll(this.selectedIndex-1)},moveDown:function(){this.selectedIndex!==this.suggestions.length-1&&this.adjustScroll(this.selectedIndex+1)},adjustScroll:function(t){var e,s,i,n=this.activate(t);n&&(s=c(n).outerHeight(),n=n.offsetTop,i=(e=c(this.suggestionsContainer).scrollTop())+this.options.maxHeight-s,n<e?c(this.suggestionsContainer).scrollTop(n):i<n&&c(this.suggestionsContainer).scrollTop(n-this.options.maxHeight+s),this.options.preserveInput||(this.ignoreValueChange=!0,this.el.val(this.getValue(this.suggestions[t].value))),this.onHint(null))},onSelect:function(t){var e=this.options.onSelect,t=this.suggestions[t];this.currentValue=this.getValue(t.value),this.currentValue===this.el.val()||this.options.preserveInput||this.el.val(this.currentValue),this.onHint(null),this.suggestions=[],this.selection=t,c.isFunction(e)&&e.call(this.element,t)},getValue:function(t){var e,s=this.options.delimiter;return!s||1===(s=(e=this.currentValue).split(s)).length?t:e.substr(0,e.length-s[s.length-1].length)+t},dispose:function(){this.el.off(".autocomplete").removeData("autocomplete"),c(window).off("resize.autocomplete",this.fixPositionCapture),c(this.suggestionsContainer).remove()}},c.fn.devbridgeAutocomplete=function(s,i){return arguments.length?this.each(function(){var t=c(this),e=t.data("autocomplete");"string"==typeof s?e&&"function"==typeof e[s]&&e[s](i):(e&&e.dispose&&e.dispose(),e=new o(this,s),t.data("autocomplete",e))}):this.first().data("autocomplete")},c.fn.autocomplete||(c.fn.autocomplete=c.fn.devbridgeAutocomplete)});
2jQuery(document).ready(function(s){var r={serviceUrl:kan_vars.ajax,params:{action:"kanews_ajax_search",nonce:""},type:"post",minChars:3,deferRequestBy:300,width:"auto",maxHeight:400,noSuggestionNotice:kan_vars.noresult,showNoSuggestionNotice:!0,formatResult:function(e){return e.layout},onSelect:function(e){e.url&&(window.location=e.url)}};function o(e){return e.closest("form").find(".kanews-loader-slot, #kanews-loader").first()}function i(e,a){e.length&&a&&a.suggestionsContainer&&(e=e.find(".site-header-search-results-mount"),a=s(a.suggestionsContainer),e.length)&&!a.parent().is(e)&&e.a
2ppend(a)}window.kanewsEnsureSearchAutocompleteMount=function(e){var e=e&&e.length?e:s("#site-header-search-wrapper"),a=e.find(".kanews-ajax-search").data("autocomplete");i(e,a),a&&a.suggestionsContainer&&s(a.suggestionsContainer).css("display","")},s(".kanews-ajax-search").each(function(){var e,a=s(this),n=a.closest("#site-header-search-wrapper"),t=s.extend(!0,{},r);t.onSearchStart=function(){var e=a.data("autocomplete");e&&e.options&&e.options.params&&(e.options.params.nonce=kanewsNonce("search")),o(a).html('<div class="kanews-loader kanews-loader-sm">Loading...</div>'),n.length&&(i(n,a.data("autocomplete")),n.find(".site-header-search-results").prop("hidden",!1).attr("aria-busy","true"))},t.onSearchComplete=function(){o(a).empty(),n.length&&n.find(".site-header-search-results").attr("aria-busy","false")},n.length&&(e=n.find(".site-header-search-results-mount"),t.appendTo=e.length?e:n.find(".site-header-search-results"),t.containerClass="site-header-search-results-panel autocomplete-suggestions",t.width="flex",t.maxHeight=360,t.orientation="bottom",t.beforeRender=function(e,a){var t,s;n.find(".site-header-search-results").prop("hidden",!1),a&&a.length&&(t=a.length,(s=a[a.length-1])&&s.layout&&-1!==s.layout.indexOf("kanews-search-result-all")&&(t=Math.max(0,a.length-1)),e.prepend('<div class="site-header-search-results-header"><span class="site-header-search-results-title">'+(kan_vars.search_results_heading||"Sonuçlar")+'</span><span class="site-header-search-results-count">'+t+"</span></div>"))}),a.devbridgeAutocomplete(t),n.length&&i(n,a.data("autocomplete"))})});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.