/*! Ajax Search Lite 4.6 js */ (function ($) { var prevState; var firstIteration = true; var methods = { init: function (options, elem) { var $this = this; this.elem = elem; this.$elem = $(elem); $this.searching = false; $this.o = $.extend({ 'blocking': false }, options); $this.n = new Object(); $this.n.container = $(this.elem); $this.o.rid = $this.n.container.attr('id').match(/^ajaxsearchlite(.*)/)[1]; $this.o.id = $this.n.container.attr('id').match(/^ajaxsearchlite(.*)/)[1]; $this.n.probox = $('.probox', $this.n.container); $this.n.proinput = $('.proinput', $this.n.container); $this.n.text = $('.proinput input.orig', $this.n.container); $this.n.textAutocomplete = $('.proinput input.autocomplete', $this.n.container); $this.n.loading = $('.proinput .loading', $this.n.container); $this.n.proloading = $('.proloading', $this.n.container); $this.n.proclose = $('.proclose', $this.n.container); $this.n.promagnifier = $('.promagnifier', $this.n.container); $this.n.prosettings = $('.prosettings', $this.n.container); $this.n.searchsettings = $('#ajaxsearchlitesettings' + $this.o.rid); $this.n.resultsDiv = $('#ajaxsearchliteres' + $this.o.rid); $this.n.hiddenContainer = $('#asl_hidden_data'); $this.n.aslItemOverlay = $('.asl_item_overlay', $this.n.hiddenContainer); $this.resizeTimeout = null; $this.n.showmore = $('.showmore', $this.n.resultsDiv); $this.n.items = $('.item', $this.n.resultsDiv); $this.n.results = $('.results', $this.n.resultsDiv); $this.n.resdrg = $('.resdrg', $this.n.resultsDiv); // Isotopic Layout variables $this.il = { columns: 3, itemsPerPage: 6 }; $this.firstClick = true; $this.post = null; $this.postAuto = null; $this.cleanUp(); $this.n.textAutocomplete.val(''); $this.o.resultitemheight = parseInt($this.o.resultitemheight); $this.scroll = new Object(); $this.savedScrollTop = 0; // Save the window scroll on IOS devices $this.savedContainerTop = 0; $this.is_scroll = typeof $.fn.mCustScr != "undefined"; // Force noscroll on minified version if ( typeof ASL.scrollbar != "undefined" && ASL.scrollbar == 0 ) $this.is_scroll = false; $this.settScroll = null; $this.n.resultsAppend = $('#wpdreams_asl_results_' + $this.o.id); $this.currentPage = 1; $this.isotopic = null; $this.lastSuccesfulSearch = ''; // Holding the last phrase that returned results $this.lastSearchData = {}; // Store the last search information $this.triggerPrevState = false; $this.animation = "bounceIn"; switch ($this.o.resultstype) { case "vertical": $this.animation = $this.o.vresultanimation; break; default: $this.animation = $this.o.hresultanimation; } $this.filterFns = { number: function () { var $parent = $(this).parent(); while (!$parent.hasClass('isotopic')) { $parent = $parent.parent(); } var number = $(this).attr('data-itemnum'); //var currentPage = parseInt($('nav>ul li.asl_active span', $parent).html(), 10); var currentPage = $this.currentPage; //var itemsPerPage = parseInt($parent.data("itemsperpage")); var itemsPerPage = $this.il.itemsPerPage; return ( (parseInt(number, 10) < itemsPerPage * currentPage) && (parseInt(number, 10) >= itemsPerPage * (currentPage - 1)) ); } }; $this.disableMobileScroll = false; $this.n.searchsettings.detach().appendTo("body"); if ($this.o.resultsposition == 'hover') { $this.n.resultsDiv.detach().appendTo("body"); } else if ($this.n.resultsAppend.length > 0) { $this.n.resultsDiv.detach().appendTo($this.n.resultsAppend); } $('fieldset' ,$this.n.searchsettings).each(function(){ $('.asl_option:not(.hiddend)', this).last().addClass("asl-o-last"); }); // Browser back button detection and if ( ASL.js_retain_popstate == 1 ) $this.initPrevState(); $this.createVerticalScroll(); if (detectOldIE()) $this.n.container.addClass('asl_msie'); // Calculates the settings animation attributes $this.initSettingsAnimations(); // Calculates the results animation attributes $this.initResultsAnimations(); $this.initEvents(); // Auto populate init $this.initAutop(); $this.initEtc(); return this; }, initPrevState: function() { var $this = this; // Browser back button check first, only on first init iteration if ( firstIteration && prevState == null ) { prevState = localStorage.getItem('asl-' + Base64.encode(location.href)); if ( prevState != null ) { prevState = JSON.parse(prevState); prevState.settings = Base64.decode(prevState.settings); } } if ( prevState != null && typeof prevState.id != 'undefined' ) { if ( prevState.id == $this.o.id ) { if (prevState.phrase != '') { $this.triggerPrevState = true; $this.n.text.val(prevState.phrase); } if ( formData($('form', $this.n.searchsettings)) != prevState.settings ) { $this.triggerPrevState = true; formData( $('form', $this.n.searchsettings), prevState.settings ); } } } // Reset storage localStorage.removeItem('asl-' + Base64.encode(location.href)); // Set the event $this.n.resultsDiv.on('click', '.results .item', function(e) { var phrase = $this.n.text.val(); if ( phrase != '' || $this.settingsChanged ) { var stateObj = { 'id': $this.o.id, 'phrase': phrase, 'settings': Base64.encode( formData($('form', $this.n.searchsettings)) ) }; localStorage.setItem('asl-' + Base64.encode(location.href), JSON.stringify(stateObj)); } }); }, duplicateCheck: function() { var $this = this; var duplicateChk = {}; $('div[id*=ajaxsearchlite]').each (function () { if (duplicateChk.hasOwnProperty(this.id)) { $(this).remove(); } else { duplicateChk[this.id] = 'true'; } }); }, analytics: function(term) { var $this = this; // YOAST uses __gaTracker, if not defined check for ga, if nothing go null, FUN EH?? var fun = typeof __gaTracker == "function" ? __gaTracker : (typeof ga == "function" ? ga : null); if (!window.location.origin) { window.location.origin = window.location.protocol + "//" + window.location.hostname + (window.location.port ? ':' + window.location.port: ''); } // Multisite Subdirectory (if exists) var url = $this.o.homeurl.replace(window.location.origin, ''); if (fun != null && $this.o.analytics && $this.o.analyticsString != '') { var string = $this.o.analyticsString.replace("{asl_term}", term).replace("{asp_term}", term); fun('send', 'pageview', { 'page': url + string, 'title': 'Ajax Search' }); } }, createVerticalScroll: function () { var $this = this; if ( $this.is_scroll ) { $this.scroll = $this.n.results.mCustScr({ contentTouchScroll: true, scrollButtons: { enable: true }, callbacks: { onScroll: function () { if (isMobile()) return; var top = parseInt($('.mCSBap_container', $this.n.results).position().top); var children = $('.mCSBap_container .resdrg').children(); var overall = 0; var prev = 3000; var diff = 4000; var s_diff = 10000; var s_overall = 10000; var $last = null; children.each(function () { diff = Math.abs((Math.abs(top) - overall)); if (diff < prev) { s_diff = diff; s_overall = overall; $last = $(this); } overall += $(this).outerHeight(true); prev = diff; }); if ($last.hasClass('group')) s_overall = s_overall + ($last.outerHeight(true) - $last.outerHeight(false)); $this.scroll.mCustScr("scrollTo", $last, { scrollInertia: 200, callbacks: false }); } } }); // Accessibility for scroll buttons $('a.mCSBap_buttonUp').text('Scroll up the results'); $('a.mCSBap_buttonDown').text('Scroll down the results'); } }, initEvents: function () { var $this = this; if ( isMobile() && detectIOS() ) { /** * Memorize the scroll top when the input is focused on IOS * as fixed elements scroll freely, resulting in incorrect scroll value */ $this.n.text.on('touchstart', function () { $this.savedScrollTop = $(window).scrollTop(); $this.savedContainerTop = $this.n.container.offset().top; }); } // Some kind of crazy rev-slider fix $this.n.text.click(function(e){ $(this).focus(); }); $this.n.text.on('focus input', function(e){ if ( $this.searching ) return; if ( $(this).val() != '' ) { $this.n.proclose.css('display', 'block'); } else { $this.n.proclose.css({ display: "none" }); } }); $($this.n.text.parent()).submit(function (e) { e.preventDefault(); if ( isMobile() ) { if ( $this.o.redirect_on_enter ) { var _e = jQuery.Event("keyup"); _e.keyCode = _e.which = 13; $this.n.text.trigger(_e); } else if ( $this.o.redirectEnterTo == 'ajax_search' ) { $this.search(); document.activeElement.blur(); } } else { if ( $this.o.redirectEnterTo == 'ajax_search' ) $this.search(); } }); $this.n.text.click(function () { if ($this.firstClick) { $(this).val(''); $this.firstClick = false; } }); $this.n.resultsDiv.css({ opacity: 0 }); $(document).bind("click touchend", function () { $this.hideSettings(); if ($this.opened == false || $this.o.closeOnDocClick != 1) return; $this.hideResults(); }); $this.n.proclose.on("click touchend", function () { $this.n.text.val(""); $this.n.textAutocomplete.val(""); $this.hideResults(); $this.n.text.focus(); }); $($this.elem).bind("click touchend", function (e) { e.stopImmediatePropagation(); }); $this.n.resultsDiv.bind("click touchend", function (e) { e.stopImmediatePropagation(); }); $this.n.searchsettings.bind("click touchend", function (e) { e.stopImmediatePropagation(); }); $this.n.prosettings.on("click", function () { if ($this.n.prosettings.data('opened') == 0) { $this.showSettings(); } else { $this.hideSettings(); } }); var fixedp = $this.n.container.parents().filter( function() { return $(this).css('position') == 'fixed'; } ); if ( fixedp.length > 0 || $this.n.container.css('position') == 'fixed' ) { if ( $this.n.resultsDiv.css('position') == 'absolute' ) $this.n.resultsDiv.css('position', 'fixed'); $this.n.resultsDiv.css('z-index',99999999999); if ( !$this.o.blocking ) $this.n.searchsettings.css('position', 'fixed'); } if ( isMobile() ) { $(window).on("orientationchange", function () { $this.orientationChange(); // Fire once more a bit delayed, some mobile browsers need to re-zoom etc.. setTimeout(function(){ $this.orientationChange(); }, 800); }); } else { var resizeTimer; $(window).on("resize", function () { clearTimeout(resizeTimer); resizeTimer = setTimeout(function () { $this.resize(); }, 100); }); } var scrollTimer; $(window).on("scroll", function () { clearTimeout(scrollTimer); scrollTimer = setTimeout(function() { $this.scrolling(false); }, 400); }); // Prevent zoom on IOS if ( detectIOS() && isMobile() && is_touch_device() ) { if ( parseInt($this.n.text.css('font-size')) < 16 ) { $this.n.text.data('fontSize', $this.n.text.css('font-size')).css('font-size', '16px'); $this.n.textAutocomplete.css('font-size', '16px'); $('').appendTo('head'); } } $this.initNavigationEvent(); $this.initMagnifierEvent(); $this.initAutocompleteEvent(); $this.initFacetEvents(); }, initAutop: function () { var $this = this; // Trigger the prevState here, as it is kind of auto-populate if ( prevState != null && $this.triggerPrevState ) { $this.search(); prevState = null; return false; // Terminate at this point, to prevent auto-populate } }, initEtc: function() { var $this = this; var t = null; // Emulate click on checkbox on the whole option $('div.asl_option', $this.n.searchsettings).on('mouseup touchend', function(e){ e.preventDefault(); // Stop firing twice on mouseup and touchend on mobile devices e.stopImmediatePropagation(); if ( $this.dragging ) { return false; } $('input[type="checkbox"]', this).prop("checked", !$('input[type="checkbox"]', this).prop("checked")); // Trigger a custom change event, for max compatibility // .. the original change is buggy for some installations. clearTimeout(t); var _this = this; t = setTimeout(function() { $('input[type="checkbox"]', _this).trigger('asl_chbx_change'); }, 50); }); $('div.asl_option label', $this.n.searchsettings).click(function(e){ e.preventDefault(); // Let the previous handler handle the events, disable this }); }, initNavigationEvent: function () { var $this = this; $($this.n.resultsDiv).on('mouseenter', '.item', function () { $('.item', $this.n.resultsDiv).removeClass('hovered'); $(this).addClass('hovered'); } ); $($this.n.resultsDiv).on('mouseleave', '.item', function () { $('.item', $this.n.resultsDiv).removeClass('hovered'); } ); $(document).keydown(function (e) { if (window.event) { var keycode = window.event.keyCode; var ktype = window.event.type; } else if (e) { var keycode = e.which; var ktype = e.type; } if ($('.item', $this.n.resultsDiv).length > 0 && $this.n.resultsDiv.css('display') != 'none') { if (keycode == 40) { e.stopPropagation(); e.preventDefault(); $this.n.text.blur(); if ($this.post != null) $this.post.abort(); if ($('.item.hovered', $this.n.resultsDiv).length == 0) { $('.item', $this.n.resultsDiv).first().addClass('hovered'); } else { $('.item.hovered', $this.n.resultsDiv).removeClass('hovered').next().next('.item').addClass('hovered'); } if ($this.is_scroll) { $this.scroll.mCustScr("scrollTo", ".resdrg .item.hovered", { scrollInertia: 200, callbacks: false }); } } if (keycode == 38) { e.stopPropagation(); e.preventDefault(); $this.n.text.blur(); if ($this.post != null) $this.post.abort(); if ($('.item.hovered', $this.n.resultsDiv).length == 0) { $('.item', $this.n.resultsDiv).last().addClass('hovered'); } else { $('.item.hovered', $this.n.resultsDiv).removeClass('hovered').prev().prev('.item').addClass('hovered'); } if ($this.is_scroll) { $this.scroll.mCustScr("scrollTo", ".resdrg .item.hovered", { scrollInertia: 200, callbacks: false }); } } // Trigger click on return key if ( keycode == 13 && $('.item.hovered', $this.n.resultsDiv).length > 0 ) { e.stopPropagation(); e.preventDefault(); $('.item.hovered a.asl_res_url', $this.n.resultsDiv).get(0).click(); } } }); }, initMagnifierEvent: function () { var $this = this; var t; var rt, enterRecentlyPressed = false; // The return event has to be dealt with on a keyup event, as it does not trigger the input event $this.n.text.on('keyup', function(e) { if (window.event) { $this.keycode = window.event.keyCode; $this.ktype = window.event.type; } else if (e) { $this.keycode = e.which; $this.ktype = e.type; } // Prevent rapid enter key pressing if ( $this.keycode == 13 ) { clearTimeout(rt); rt = setTimeout(function(){ enterRecentlyPressed = false; }, 300); if ( enterRecentlyPressed ) { return false; } else { enterRecentlyPressed = true; } } var isInput = $(this).hasClass("orig"); if ( $this.n.text.val().length >= $this.o.charcount && isInput && $this.ktype == 'keyup' && $this.keycode == 13 ) { if ( $this.o.redirect_on_enter == 1 ) { if ($this.o.redirectEnterTo != 'first_result') { $this.doRedirectToResults($this.ktype); } else { $this.search(); } } else { if ( $this.o.redirectEnterTo == 'nothing' ) return false; if ( ($('form', $this.n.searchsettings).serialize() + $this.n.text.val().trim()) != $this.lastSuccesfulSearch || !$this.resultsOpened ) { $this.search(); } } clearTimeout(t); } }); $this.n.promagnifier.add($this.n.text).bind('click input', function (e) { if (window.event) { $this.keycode = window.event.keyCode; $this.ktype = window.event.type; } else if (e) { $this.keycode = e.which; $this.ktype = e.type; } var isInput = $(this).hasClass("orig"); if ($this.n.text.val().length < $this.o.charcount) { $this.n.proloading.css('display', 'none'); $this.hideResults(); if ($this.post != null) $this.post.abort(); clearTimeout(t); return; } // If redirection is set to the results page, or custom URL if ( $this.n.text.val().length >= $this.o.charcount && (!isInput && $this.o.redirectonclick == 1 && $this.ktype == 'click' && $this.o.redirectClickTo != 'first_result' ) ) { $this.doRedirectToResults($this.ktype); clearTimeout(t); return; } // Ignore arrows, F1-F12 if ( ($this.keycode >= 37 && $this.keycode <= 40) || ($this.keycode >= 112 && $this.keycode <= 123) ) return; if ((isInput && $this.ktype == 'click') || $this.keycode == 32) { if ( ($('form', $this.n.searchsettings).serialize() + $this.n.text.val().trim()) == $this.lastSuccesfulSearch ) { $this.n.proclose.css('display', 'block'); if ( !$this.resultsOpened ) $this.showResults(); } return; } if ($(this).hasClass('orig') && $this.ktype == 'click') return; if ($this.o.trigger_on_click == 0 && $this.ktype == 'click') return; if ($this.o.triggerontype == 0 && $this.ktype == 'input') return; // Is the nothing is choosen if ( (isInput && $this.ktype == 'input' && $this.o.redirectEnterTo == 'nothing') || (!isInput && $this.ktype == 'click' && $this.o.redirectClickTo == 'nothing') ) return; if ($this.post != null) $this.post.abort(); clearTimeout(t); $this.hideLoader(); t = setTimeout(function () { // If the user types and deletes, while the last results are open if ( ($('form', $this.n.searchsettings).serialize() + $this.n.text.val().trim()) != $this.lastSuccesfulSearch ) { $this.search(); } else { $this.n.proclose.css('display', 'block'); if ( $this.isRedirectToFirstResult() ) { $this.doRedirectToFirstResult(); return false; } else { if ( !$this.resultsOpened ) $this.showResults(); } } }, 250); }); }, initFacetEvents: function() { var $this = this; var t = null; if ($this.o.trigger_on_facet_change == 1) { $('input[type!=checkbox], select', $this.n.searchsettings).on('change slidechange', function(){ if ($this.n.text.val().length < $this.o.charcount) return; if ($this.post != null) $this.post.abort(); clearTimeout(t); t = setTimeout(function() { $this.search(); }, 50); }); $('input[type=checkbox]', $this.n.searchsettings).on('asl_chbx_change', function(){ if ($this.n.text.val().length < $this.o.charcount) return; if ($this.post != null) $this.post.abort(); clearTimeout(t); t = setTimeout(function() { $this.search(); }, 50); }); } }, isRedirectToFirstResult: function() { var $this = this; if ( $('.asl_res_url', $this.n.resultsDiv).length > 0 && ( ($this.o.redirectonclick == 1 && $this.ktype == 'click' && $this.o.redirectClickTo == 'first_result' ) || ($this.o.redirect_on_enter == 1 && ($this.ktype == 'input' || $this.ktype == 'keyup') && $this.keycode == 13 && $this.o.redirectEnterTo == 'first_result' ) ) ) { return true; } return false; }, doRedirectToFirstResult: function() { var $this = this; var _loc; if ( $this.ktype == 'click' ) { _loc = $this.o.redirectClickLoc; } else { _loc = $this.o.redirectEnterLoc; } if ( _loc == 'same' ) location.href = $( $('.asl_res_url', $this.n.resultsDiv).get(0)).attr('href'); else open_in_new_tab( $( $('.asl_res_url', $this.n.resultsDiv).get(0)).attr('href') ); $this.hideLoader(); $this.hideResults(); return false; }, doRedirectToResults: function( ktype ) { var $this = this; var source = $this.ktype == 'click' ? $this.o.redirectClickTo : $this.o.redirectEnterTo; var _loc = ktype == 'click' ? $this.o.redirectClickLoc : $this.o.redirectEnterLoc; if ( source == 'results_page' ) { var url = '?s=' + asl_nice_phrase($this.n.text.val()); } else if ( source == 'woo_results_page' ) { var url = '?post_type=product&s=' + asl_nice_phrase($this.n.text.val()); } else { var url = $this.o.redirect_url.replace('{phrase}', asl_nice_phrase($this.n.text.val())); } if ( $this.o.overridewpdefault ) { if ( $this.o.override_method == "post") { asp_submit_to_url($this.o.homeurl + url, 'post', { asl_active: 1, p_asl_data: $('form', $this.n.searchsettings).serialize() }, _loc); } else { var _url = $this.o.homeurl + url + "&asl_active=1&p_asid=" + $this.o.id + "&p_asl_data=" + Base64.encode($('form', $this.n.searchsettings).serialize()); if ( _loc == 'same' ) location.href = _url; else open_in_new_tab(_url) } } else { asp_submit_to_url($this.o.homeurl + url, 'post', { np_asl_data: $('form', $this.n.searchsettings).serialize() }, _loc); } $this.n.proloading.css('display', 'none'); $this.hideLoader(); $this.hideResults(); if ($this.post != null) $this.post.abort(); }, destroy: function () { return this.each(function () { var $this = $.extend({}, this, methods); $(window).unbind($this); }) }, searchfor: function (phrase) { $(".proinput input", this).val(phrase).trigger("keyup"); }, initAutocompleteEvent: function () { var $this = this; var tt; if ($this.o.autocomplete.enabled == 1 && !isMobile()) { $this.n.text.keyup(function (e) { if (window.event) { $this.keycode = window.event.keyCode; $this.ktype = window.event.type; } else if (e) { $this.keycode = e.which; $this.ktype = e.type; } var thekey = 39; // Lets change the keykode if the direction is rtl if ($('body').hasClass('rtl')) thekey = 37; if ($this.keycode == thekey && $this.n.textAutocomplete.val() != "") { e.preventDefault(); $this.n.text.val($this.n.textAutocomplete.val()); if ($this.post != null) $this.post.abort(); $this.search(); } else { if ($this.postAuto != null) $this.postAuto.abort(); $this.autocompleteGoogleOnly(); } }); } }, // If only google source is used, this is much faster.. autocompleteGoogleOnly: function () { var $this = this; var val = $this.n.text.val(); if ($this.n.text.val() == '') { $this.n.textAutocomplete.val(''); return; } var autocompleteVal = $this.n.textAutocomplete.val(); if (autocompleteVal != '' && autocompleteVal.indexOf(val) == 0) { return; } else { $this.n.textAutocomplete.val(''); } $.ajax({ url: 'https://clients1.google.com/complete/search', dataType: 'jsonp', data: { q: val, hl: $this.o.autocomplete.lang, nolabels: 't', client: 'hp', ds: '' }, success: function(data) { if (data[1].length > 0) { response = data[1][0][0].replace(/(<([^>]+)>)/ig,""); response = $('').html(response).text(); response = response.substr(val.length); $this.n.textAutocomplete.val(val + response); } } }); }, search: function () { var $this = this; if ($this.searching && 0) return; if ($this.n.text.val().length < $this.o.charcount) return; $this.searching = true; $this.n.proloading.css({ display: "block" }); $this.n.proclose.css({ display: "none" }); var data = { action: 'ajaxsearchlite_search', aslp: $this.n.text.val(), asid: $this.o.id, options: $('form', $this.n.searchsettings).serialize() }; if ( JSON.stringify(data) === JSON.stringify($this.lastSearchData) ) { if ( !$this.resultsOpened ) $this.showResults(); $this.hideLoader(); if ( $this.isRedirectToFirstResult() ) { $this.doRedirectToFirstResult(); return false; } return false; } $this.analytics($this.n.text.val()); // New method without JSON $this.post = $.post(ASL.ajaxurl, data, function (response) { response = response.replace(/^\s*[\r\n]/gm, ""); response = response.match(/!!ASLSTART!!(.*[\s\S]*)!!ASLEND!!/)[1]; // bye bye JSON $this.n.resdrg.html(""); $this.n.resdrg.html(response); $(".asl_keyword", $this.n.resdrg).bind('click', function () { $this.n.text.val($(this).html()); $('input.orig', $this.n.container).val($(this).html()).keydown(); $('form', $this.n.container).trigger('submit', 'ajax'); $this.search(); }); $this.n.items = $('.item', $this.n.resultsDiv); if ( $this.isRedirectToFirstResult() ) { $this.doRedirectToFirstResult(); return false; } $this.hideLoader(); $this.showResults(); $this.scrollToResults(); $this.lastSuccesfulSearch = $('form', $this.n.searchsettings).serialize() + $this.n.text.val().trim(); $this.lastSearchData = data; if ($this.n.items.length == 0) { if ($this.n.showmore != null) { $this.n.showmore.css('display', 'none'); } } else { if ($this.n.showmore != null) { $this.n.showmore.css('display', 'block'); $('a', $this.n.showmore).off(); $('a', $this.n.showmore).on('click', function(e){ var source = $this.o.redirectClickTo; var url = '?s=' + asl_nice_phrase($this.n.text.val()); if ( source == 'results_page' ) { url = '?s=' + asl_nice_phrase($this.n.text.val()); } else if ( source == 'woo_results_page' ) { url = '?post_type=product&s=' + asl_nice_phrase($this.n.text.val()); } else { url = $this.o.redirect_url.replace('{phrase}', asl_nice_phrase($this.n.text.val())); } if ( $this.o.overridewpdefault ) { if ( $this.o.override_method == "post") { asp_submit_to_url($this.o.homeurl + url, 'post', { asl_active: 1, p_asl_data: $('form', $this.n.searchsettings).serialize() }); } else { location.href = $this.o.homeurl + url + "&asl_active=1&p_asid=" + $this.o.id + "&p_asl_data=" + Base64.encode($('form', $this.n.searchsettings).serialize()); } } else { asp_submit_to_url($this.o.homeurl + url, 'post', { np_asl_data: $('form', $this.n.searchsettings).serialize() }); } }); } } }, "text").fail(function(jqXHR, textStatus, errorThrown){ if ( jqXHR.aborted || textStatus == 'abort' ) return; $this.n.resdrg.html(""); $this.n.resdrg.html('