www.afca.link
Open in
urlscan Pro
149.28.183.98
Public Scan
Submitted URL: http://www.afca.link/wp-content/themes/porto/inc/lib/live-search/live-search.min.js?ver=7.1.10
Effective URL: https://www.afca.link/wp-content/themes/porto/inc/lib/live-search/live-search.min.js?ver=7.1.10
Submission: On July 22 via api from US — Scanned from AU
Effective URL: https://www.afca.link/wp-content/themes/porto/inc/lib/live-search/live-search.min.js?ver=7.1.10
Submission: On July 22 via api from US — Scanned from AU
Form analysis
0 forms found in the DOMText Content
!function(e){"use strict";"function"==typeof define&&define.amd?define(["jquery"],e):e("object"==typeof exports&&"function"==typeof require?require("jquery"):jQuery)}((function(e){"use strict";function t(n,o){var s=this;s.element=n,s.el=e(n),s.suggestions=[],s.badQueries=[],s.selectedIndex=-1,s.currentValue=s.element.value,s.timeoutId=null,s.cachedResponse={},s.onChangeTimeout=null,s.onChange=null,s.isLocal=!1,s.suggestionsContainer=null,s.noSuggestionsContainer=null,s.options=e.extend(!0,{},t.defaults,o),s.classes={selected:"autocomplete-selected",suggestion:"autocomplete-suggestion"},s.hint=null,s.hintValue="",s.selection=null,s.initialize(),s.setOptions(o)}var n={escapeRegExChars:function(e){return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&")},createNode:function(e){var t=document.createElement("div");return t.className=e,t.style.position="absolute",t.style.display="none",t}},o=27,s=9,i=13,a=38,r=39,u=40,l=e.noop;t.utils=n,e.Autocomplete=t,t.defaults={ajaxSettings:{},autoSelectFirst:!1,appendTo:"body",serviceUrl:null,lookup:null,onSelect:null,width:"auto",minChars:1,maxHeight:300,deferRequestBy:0,params:{},formatResult:function(e,t){if(!t)return e.value;var o="("+n.escapeRegExChars(t)+")";return e.value.replace(new RegExp(o,"gi"),"<strong>$1</strong>").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/<(\/?strong)>/g,"<$1>")},formatGroup:function(e,t){return'<div class="autocomplete-group">'+t+"</div>"},delimiter:null,zIndex:9999,type:"GET",noCache:!1,onSearchStart:l,onSearchComplete:l,onSearchError:l,preserveInput:!1,containerClass:"autocomplete-suggestions",tabDisabled:!1,dataType:"text",currentRequest:null,triggerSelectOnValidInput:!0,preventBadQueries:!0,lookupFilter:function(e,t,n){return-1!==e.value.toLowerCase().indexOf(n)},paramName:"query",transformResult:function(e){return"string"==typeof e?JSON.parse(e):e},showNoSuggestionNotice:!1,noSuggestionNotice:"No results",orientation:"bottom",forceFixPosition:!1},t.prototype={initialize:function(){var n,o=this,s="."+o.classes.suggestion,i=o.classes.selected,a=o.options;o.element.setAttribute("autocomplete","off"),o.noSuggestionsContainer=e('<div class="autocomplete-no-suggestion"></div>').html(this.options.noSuggestionNotice).get(0),o.suggestionsContainer=t.utils.createNode(a.containerClass),(n=e(o.suggestionsContainer)).appendTo(a.appendTo||"body"),"auto"!==a.width&&n.css("width",a.width),n.on("mouseover.autocomplete",s,(function(){o.activate(e(this).data("index"))})),n.on("mouseout.autocomplete",(function(){o.selectedIndex=-1,n.children("."+i).removeClass(i)})),n.on("click.autocomplete",s,(function(){o.select(e(this).data("index"))})),n.on("click.autocomplete",(function(){clearTimeout(o.blurTimeoutId)})),o.fixPositionCapture=function(){o.visible&&o.fixPosition()},e(window).on("resize.autocomplete",o.fixPositionCapture),o.el.on("keydown.autocomplete",(function(e){o.onKeyPress(e)})),o.el.on("keyup.autocomplete",(function(e){o.onKeyUp(e)})),o.el.on("blur.autocomplete",(function(){o.onBlur()})),o.el.on("focus.autocomplete",(function(){o.onFocus()})),o.el.on("change.autocomplete",(function(e){o.onKeyUp(e)})),o.el.on("input.autocomplete",(function(e){o.onKeyUp(e)}))},onFocus:function(){var e=this;e.fixPosition(),e.el.val().length>=e.options.minChars&&e.onValueChange()},onBlur:function(){var e=this;e.blurTimeoutId=setTimeout((function(){e.hide()}),200)},abortAjax:function(){var e=this;e.currentRequest&&(e.currentRequest.abort(),e.currentRequest=null)},setOptions:function(t){var n=this,o=e.extend({},n.options,t);n.isLocal=Array.isArray(o.lookup),n.isLocal&&(o.lookup=n.verifySuggestionsFormat(o.lookup)),o.orientation=n.validateOrientation(o.orientation,"bottom"),e(n.suggestionsContainer).css({"max-height":o.maxHeight+"px",width:o.width+"px","z-index":o.zIndex}),this.options=o},clearCache:function(){this.cachedResponse={},this.badQueries=[]},clear:function(){this.clearCache(),this.currentValue="",this.suggestions=[]},disable:function(){var e=this;e.disabled=!0,clearTimeout(e.onChangeTimeout),e.abortAjax()},enable:function(){this.disabled=!1},fixPosition:function(){var t=this,n=e(t.suggestionsContainer),o=n.parent().get(0);if(o===document.body||t.options.forceFixPosition){var s=t.options.orientation,i=n.outerHeight(),a=t.el.outerHeight(),r=t.el.offset(),u={top:r.top,left:r.left};if("auto"===s){var l=e(window).height(),c=e(window).scrollTop(),g=-c+r.top-i,d=c+l-(r.top+a+i);s=Math.max(g,d)===g?"top":"bottom"}if(u.top+="top"===s?-i:a,o!==document.body){var p,h=n.css("opacity");t.visible||n.css("opacity",0).show(),p=n.offsetParent().offset(),u.top-=p.top,u.top+=o.scrollTop,u.left-=p.left,t.visible||n.css("opacity",h).hide()}"auto"===t.options.width&&(u.width=t.el.outerWidth()+"px"),n.css(u)}},isCursorAtEnd:function(){var e,t=this.el.val().length,n=this.element.selectionStart;return"number"==typeof n?n===t:!document.selection||((e=document.selection.createRange()).moveStart("character",-t),t===e.text.length)},onKeyPress:function(e){var t=this;if(t.disabled||t.visible||e.which!==u||!t.currentValue){if(!t.disabled&&t.visible){switch(e.which){case o:t.el.val(t.currentValue),t.hide();break;case r:if(t.hint&&t.options.onHint&&t.isCursorAtEnd()){t.selectHint();break}return;case s:if(t.hint&&t.options.onHint)return void t.selectHint();if(-1===t.selectedIndex)return void t.hide();if(t.select(t.selectedIndex),!1===t.options.tabDisabled)return;break;case i:if(-1===t.selectedIndex)return void t.hide();t.select(t.selectedIndex);break;case a:t.moveUp();break;case u:t.moveDown();break;default:return}e.stopImmediatePropagation(),e.preventDefault()}}else t.suggest()},onKeyUp:function(e){var t=this;if(!t.disabled){switch(e.which){case a:case u:return}clearTimeout(t.onChangeTimeout),t.currentValue!==t.el.val()&&(t.findBestHint(),t.options.deferRequestBy>0?t.onChangeTimeout=setTimeout((function(){t.onValueChange()}),t.options.deferRequestBy):t.onValueChange())}},onValueChange:function(){if(!this.ignoreValueChange){var t=this,n=t.options,o=t.el.val(),s=t.getQuery(o);return t.selection&&t.currentValue!==s&&(t.selection=null,(n.onInvalidateSelection||e.noop).call(t.element)),clearTimeout(t.onChangeTimeout),t.currentValue=o,t.selectedIndex=-1,n.triggerSelectOnValidInput&&t.isExactMatch(s)?void t.select(0):void(s.length<n.minChars?t.hide():t.getSuggestions(s))}this.ignoreValueChange=!1},isExactMatch:function(e){var t=this.suggestions;return 1===t.length&&t[0].value.toLowerCase()===e.toLowerCase()},getQuery:function(e){var t,n=this.options.delimiter;return n?(t=e.split(n))[t.length-1].trim():e},getSuggestionsLocal:function(t){var n,o=this.options,s=t.toLowerCase(),i=o.lookupFilter,a=parseInt(o.lookupLimit,10);return n={suggestions:e.grep(o.lookup,(function(e){return i(e,t,s)}))},a&&n.suggestions.length>a&&(n.suggestions=n.suggestions.slice(0,a)),n},getSuggestions:function(t){var n,o,s,i,a=this,r=a.options,u=r.serviceUrl;if(r.params[r.paramName]=t,!1!==r.onSearchStart.call(a.element,r.params)){if(o=r.ignoreParams?null:r.params,"function"==typeof r.lookup)return void r.lookup(t,(function(e){a.suggestions=e.suggestions,a.suggest(),r.onSearchComplete.call(a.element,t,e.suggestions)}));a.isLocal?n=a.getSuggestionsLocal(t):("function"==typeof u&&(u=u.call(a.element,t)),s=u+"?"+e.param(o||{}),n=a.cachedResponse[s]),n&&Array.isArray(n.suggestions)?(a.suggestions=n.suggestions,a.suggest(),r.onSearchComplete.call(a.element,t,n.suggestions)):a.isBadQuery(t)?r.onSearchComplete.call(a.element,t,[]):(a.abortAjax(),i={url:u,data:o,type:r.type,dataType:r.dataType},e.extend(i,r.ajaxSettings),a.currentRequest=e.ajax(i).done((function(e){var n;a.currentRequest=null,n=r.transformResult(e,t),a.processResponse(n,t,s),r.onSearchComplete.call(a.element,t,n.suggestions)})).fail((function(e,n,o){r.onSearchError.call(a.element,t,e,n,o)})))}},isBadQuery:function(e){if(!this.options.preventBadQueries)return!1;for(var t=this.badQueries,n=t.length;n--;)if(0===e.indexOf(t[n]))return!0;return!1},hide:function(){var t=this,n=e(t.suggestionsContainer);"function"==typeof t.options.onHide&&t.visible&&t.options.onHide.call(t.element,n),t.visible=!1,t.selectedIndex=-1,clearTimeout(t.onChangeTimeout),e(t.suggestionsContainer).hide(),t.signalHint(null)},suggest:function(){if(this.suggestions.length){var t,n=this,o=n.options,s=o.groupBy,i=o.formatResult,a=n.getQuery(n.currentValue),r=n.classes.suggestion,u=n.classes.selected,l=e(n.suggestionsContainer),c=e(n.noSuggestionsContainer),g=o.beforeRender,d="",p=function(e,n){var i=e.data[s];return t===i?"":(t=i,o.formatGroup(e,t))};return o.triggerSelectOnValidInput&&n.isExactMatch(a)?void n.select(0):(e.each(n.suggestions,(function(e,t){s&&(d+=p(t,0)),d+='<div class="'+r+'" data-index="'+e+'">'+i(t,a,e)+"</div>"})),this.adjustContainerWidth(),c.detach(),l.html(d),"function"==typeof g&&g.call(n.element,l,n.suggestions),n.fixPosition(),l.show(),o.autoSelectFirst&&(n.selectedIndex=0,l.scrollTop(0),l.children("."+r).first().addClass(u)),n.visible=!0,void n.findBestHint())}this.options.showNoSuggestionNotice?this.noSuggestions():this.hide()},noSuggestions:function(){var t=this,n=t.options.beforeRender,o=e(t.suggestionsContainer),s=e(t.noSuggestionsContainer);this.adjustContainerWidth(),s.detach(),o.empty(),o.append(s),"function"==typeof n&&n.call(t.element,o,t.suggestions),t.fixPosition(),o.show(),t.visible=!0},adjustContainerWidth:function(){var t,n=this,o=n.options,s=e(n.suggestionsContainer);"auto"===o.width?(t=n.el.outerWidth(),s.css("width",t>0?t:300)):"flex"===o.width&&s.css("width","")},findBestHint:function(){var t=this,n=t.el.val().toLowerCase(),o=null;n&&(e.each(t.suggestions,(function(e,t){var s=0===t.value.toLowerCase().indexOf(n);return s&&(o=t),!s})),t.signalHint(o))},signalHint:function(t){var n="",o=this;t&&(n=o.currentValue+t.value.substr(o.currentValue.length)),o.hintValue!==n&&(o.hintValue=n,o.hint=t,(this.options.onHint||e.noop)(n))},verifySuggestionsFormat:function(t){return t.length&&"string"==typeof t[0]?e.map(t,(function(e){return{value:e,data:null}})):t},validateOrientation:function(t,n){return t=(t||"").trim().toLowerCase(),-1===e.inArray(t,["auto","bottom","top"])&&(t=n),t},processResponse:function(e,t,n){var o=this,s=o.options;e.suggestions=o.verifySuggestionsFormat(e.suggestions),s.noCache||(o.cachedResponse[n]=e,s.preventBadQueries&&!e.suggestions.length&&o.badQueries.push(t)),t===o.getQuery(o.currentValue)&&(o.suggestions=e.suggestions,o.suggest())},activate:function(t){var n,o=this,s=o.classes.selected,i=e(o.suggestionsContainer),a=i.find("."+o.classes.suggestion);return i.find("."+s).removeClass(s),o.selectedIndex=t,-1!==o.selectedIndex&&a.length>o.selectedIndex?(n=a.get(o.selectedIndex),e(n).addClass(s),n):null},selectHint:function(){var t=this,n=e.inArray(t.hint,t.suggestions);t.select(n)},select:function(e){this.hide(),this.onSelect(e)},moveUp:function(){var t=this;if(-1!==t.selectedIndex)return 0===t.selectedIndex?(e(t.suggestionsContainer).children("."+t.classes.suggestion).first().removeClass(t.classes.selected),t.selectedIndex=-1,t.ignoreValueChange=!1,t.el.val(t.currentValue),void t.findBestHint()):void t.adjustScroll(t.selectedIndex-1)},moveDown:function(){var e=this;e.selectedIndex!==e.suggestions.length-1&&e.adjustScroll(e.selectedIndex+1)},adjustScroll:function(t){var n=this,o=n.activate(t);if(o){var s,i,a,r=e(o).outerHeight();s=o.offsetTop,a=(i=e(n.suggestionsContainer).scrollTop())+n.options.maxHeight-r,s<i?e(n.suggestionsContainer).scrollTop(s):s>a&&e(n.suggestionsContainer).scrollTop(s-n.options.maxHeight+r),n.options.preserveInput||(n.ignoreValueChange=!0,n.el.val(n.getValue(n.suggestions[t].value))),n.signalHint(null)}},onSelect:function(e){var t=this,n=t.options.onSelect,o=t.suggestions[e];t.currentValue=t.getValue(o.value),t.currentValue===t.el.val()||t.options.preserveInput||t.el.val(t.currentValue),t.signalHint(null),t.suggestions=[],t.selection=o,"function"==typeof n&&n.call(t.element,o)},getValue:function(e){var t,n,o=this.options.delimiter;return o?1===(n=(t=this.currentValue).split(o)).length?e:t.substr(0,t.length-n[n.length-1].length)+e:e},dispose:function(){var t=this;t.el.off(".autocomplete").removeData("autocomplete"),e(window).off("resize.autocomplete",t.fixPositionCapture),e(t.suggestionsContainer).remove()}},e.fn.devbridgeAutocomplete=function(n,o){var s="autocomplete";return arguments.length?this.each((function(){var i=e(this),a=i.data(s);"string"==typeof n?a&&"function"==typeof a[n]&&a[n](o):(a&&a.dispose&&a.dispose(),a=new t(this,n),i.data(s,a))})):this.first().data(s)},e.fn.autocomplete||(e.fn.autocomplete=e.fn.devbridgeAutocomplete)})),jQuery(document).ready((function(e){"use strict";e(".searchform").each((function(){var t=e(this),n=t.find(".live-search-list"),o=t.find("#cat"),s="undefined"!=typeof theme&&theme.ajax_url?theme.ajax_url:"undefined"!=typeof js_porto_vars&&js_porto_vars.ajax_url?js_porto_vars.ajax_url:ajaxurl,i=s+"?action=porto_ajax_search_posts&nonce="+porto_live_search.nonce;o.length&&o.val()&&"0"!=o.val()&&(i+="&cat="+o.val()),t.find('input[name="post_type"]').length&&t.find('input[name="post_type"]').val()&&(i+="&post_type="+t.find('input[name="post_type"]').val()),t.find('input[type="text"]').on("focus keyup",(function(){var a=e(this);if(!a.hasClass("porto-search-init")){if(a.devbridgeAutocomplete({minChars:3,appendTo:n,triggerSelectOnValidInput:!1,serviceUrl:i,deferRequestBy:300,onSearchStart:function(){t.find("button").addClass("loading")},onSelect:function(e){-1!=e.id&&"undefined"!=typeof theme&&(window.location.href=e.url)},onHide:function(){n.removeClass("porto-opened")},onSearchComplete:function(){t.find("button").removeClass("loading")},beforeRender:function(t){e(t).removeAttr("style")},formatResult:function(t,o){var s="("+e.Autocomplete.utils.escapeRegExChars(o)+")",i="";return t.img&&"undefined"!=typeof theme&&(i+='<img class="search-image" src="'+t.img+'">'),i+='<div class="search-name">'+t.value.replace(new RegExp(s,"gi"),"<strong>$1</strong>")+"</div>",t.price&&"undefined"!=typeof theme&&(i+='<span class="search-price">'+t.price+"<span>"),n.addClass("porto-opened"),i}}),o.length){var r=a.devbridgeAutocomplete();o.on("change",(function(e){o.val()&&"0"!=o.val()?r.setOptions({serviceUrl:s+"?action=porto_ajax_search_posts&cat="+o.val()}):r.setOptions({serviceUrl:s+"?action=porto_ajax_search_posts"}),r.hide(),r.onValueChange()}))}a.addClass("porto-search-init")}}))}))}));