1/******/ (function() { // webpackBootstrap 2/******/ "use strict"; 3/******/ // The require scope 4/******/ var __webpack_require__ = {}; 5/******/ 6/************************************************************************/ 7/******/ /* webpack/runtime/compat get default export */ 8/******/ !function() { 9/******/ // getDefaultExport function for compatibility with non-harmony modules 10/******/ __webpack_require__.n = function(module) { 11/******/ var getter = module && module.__esModule ? 12/******/ function() { return module['default']; } : 13/******/ function() { return module; }; 14/******/ __webpack_require__.d(getter, { a: getter }); 15/******/ return getter; 16/******/ }; 17/******/ }(); 18/******/ 19/******/ /* webpack/runtime/define property getters */ 20/******/ !function() { 21/******/ // define getter functions for harmony exports 22/******/ __webpack_require__.d = function(exports, definition) { 23/******/ for(var key in definition) { 24/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { 25/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); 26/******/ } 27/******/ } 28/******/ }; 29/******/ }(); 30/******/ 31/******/ /* webpack/runtime/hasOwnProperty shorthand */ 32/******/ !function() { 33/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } 34/******/ }(); 35/******/ 36/************************************************************************/ 37var __webpack_exports__ = {}; 38 39;// external "global" 40var external_global_namespaceObject = Object(window.WPD)["global"]; 41;// external "utils" 42var external_utils_namespaceObject = Object(window.WPD)["utils"]; 43;// ./src/client/plugin/core/actions/filters.ts 44/* unused harmony import specifier */ var AslPlugin; 45 46 47 48"use strict"; 49external_global_namespaceObject.AslPlugin.prototype.setFilterStateInput = function(timeout) { 50 let $this = this; 51 if (typeof timeout == "undefined") { 52 timeout = 65; 53 } 54 let process = function() { 55 if (JSON.stringify($this.originalFormData) != JSON.stringify((0,external_utils_namespaceObject.formData)($this.n("searchsettings").find("form")))) 56 $this.n("searchsettings").find("input[name=filters_initial]").val(0); 57 else 58 $this.n("searchsettings").find("input[name=filters_initial]").val(1); 59 }; 60 if (timeout == 0) { 61 process(); 62 } else { 63 setTimeout(function() { 64 process(); 65 }, timeout); 66 } 67}; 68/* harmony default export */ var filters = ((/* unused pure expression or super */ null && (AslPlugin))); 69 70;// ./src/client/plugin/core/actions/ga_events.ts 71/* unused harmony import specifier */ var ga_events_AslPlugin; 72 73 74"use strict"; 75const ASL = window.ASL; 76external_global_namespaceObject.AslPlugin.prototype.gaEvent = function(which, d) { 77 let $this = this; 78 if (typeof ASL.analytics == "undefined" || !ASL.analytics.method) 79 return; 80 let _gtag = typeof window.gtag == "function" ? window.gtag : false; 81 if (_gtag === false && typeof window.dataLayer == "undefined") 82 return; 83 let tracking_id = $this.gaGetTrackingID(); 84 let def_data = { 85 "search_id": $this.o.id, 86 "search_name": $this.o.name, 87 "phrase": $this.n("text").val(), 88 "option_label": "", 89 "option_value": "", 90 "result_title": "", 91 "result_url": "", 92 "results_count": "" 93 }; 94 const mergedData = { ...def_data, ...d }; 95 const items = ASL.analytics.event[which]?.items ?? []; 96 for (const ev of items) { 97 if (!ev.active) continue; 98 const eventParams = { "send_to": "" }; 99 for (const p of ev.params ?? []) { 100 if (!p.key) continue; 101 let val = p.value; 102 Object.keys(mergedData).forEach(function(k) { 103 const v = String(mergedData[k]).replace(/[\s\n\r]+/g, " ").trim(); 104 val = val.replace(new RegExp("\\{" + k + "\\}", "gmi"), v); 105 }); 106 eventParams[p.key] = val; 107 } 108 if (_gtag !== false) { 109 if (tracking_id !== false) { 110 tracking_id.forEach(function(id) { 111 eventParams.send_to = id; 112 _gtag("event", ev.action, eventParams); 113 }); 114 } else {
115 delete eventParams.send_to; 116 _gtag("event", ev.action, eventParams); 117 } 118 } else if (window?.dataLayer?.push !== void 0) { 119 window.dataLayer.push({ 120 "event": "gaEvent", 121 "eventAction": ev.action, 122 ...eventParams 123 }); 124 } 125 } 126}; 127external_global_namespaceObject.AslPlugin.prototype.gaGetTrackingID = function() { 128 if (typeof ASL.analytics == "undefined") { 129 return false; 130 } 131 if (ASL.analytics.tracking_id) { 132 return [ASL.analytics.tracking_id]; 133 } 134 return false; 135}; 136/* harmony default export */ var ga_events = ((/* unused pure expression or super */ null && (ga_events_AslPlugin))); 137 138;// external "DoMini" 139var external_DoMini_namespaceObject = Object(window.WPD)["DoMini"]; 140var external_DoMini_default = /*#__PURE__*/__webpack_require__.n(external_DoMini_namespaceObject); 141;// ./src/client/plugin/core/actions/live.ts 142/* unused harmony import specifier */ var live_AslPlugin; 143 144 145 146 147 148 149 150const live_ASL = window.ASL; 151external_global_namespaceObject.AslPlugin.prototype.getLiveLoadAltSelectors = function() { 152 return [ 153 ".search-content", 154 "#content #posts-container", 155 "#content", 156 "#Content", 157 "div[role=main]", 158 "main[role=main]", 159 "div.theme-content", 160 "div.td-ss-main-content", 161 "main#page-content", 162 "main.l-content", 163 "#primary", 164 "#main-content", 165 ".main-content", 166 ".search section .bde-post-loop", 167 // breakdance posts loop section search archive 168 ".archive section .bde-post-loop", 169 // breakdance posts loop section general archive 170 ".search section .bde-post-list", 171 // breakdance posts list section search archive 172 ".archive section .bde-post-list", 173 // breakdance posts list section general archive 174 "main .wp-block-query", 175 // block themes 176 "main" 177 // fallback 178 ]; 179}; 180external_global_namespaceObject.AslPlugin.prototype.usingLiveLoader = function() { 181 const $this = this; 182 if ($this._usingLiveLoader !== void 0) return $this._usingLiveLoader; 183 const o = $this.o; 184 const idClass = "asp_es_" + o.id; 185 const altSelectors = this.getLiveLoadAltSelectors().join(","); 186 if (document.getElementsByClassName(idClass).length) { 187 return $this._usingLiveLoader = true; 188 } 189 const options = ["resPage"]; 190 $this._usingLiveLoader = options.some((key) => { 191 const opt = o[key]; 192 return opt.useAjax && (document.querySelector(opt.selector) || altSelectors && document.querySelector(altSelectors)); 193 }); 194 return $this._usingLiveLoader; 195}; 196external_global_namespaceObject.AslPlugin.prototype.liveLoad = function(selector, url, updateLocation, forceAjax) { 197 if (selector == "body" || selector == "html") { 198 console.log("Ajax Search Pro: Do not use html or body as the live loader selector."); 199 return false; 200 } 201 if (live_ASL.pageHTML == "") { 202 if (!live_ASL._ajax_page_html) { 203 live_ASL._ajax_page_html = true; 204 external_DoMini_default().fn.ajax({ 205 url: location.href, 206 method: "GET", 207 success: function(data) { 208 live_ASL.pageHTML = data; 209 }, 210 // @ts-ignore 211 dataType: "html" 212 }); 213 } 214 } 215 function process(data) { 216 data = external_utils_namespaceObject.Hooks.applyFilters("asl/live_load/raw_data", data, $this); 217 let parser = new DOMParser(); 218 let dataNode = parser.parseFromString(data, "text/html"); 219 let $dataNode = external_DoMini_default()(dataNode); 220 if (data != "" && $dataNode.length > 0 && $dataNode.find(selector).length > 0) { 221 data = data.replace(/&asl_force_reset_pagination=1/gmi, ""); 222 data = data.replace(/%26asl_force_reset_pagination%3D1/gmi, ""); 223 data = data.replace(/&asl_force_reset_pagination=1/gmi, ""); 224 if ((0,external_utils_namespaceObject.isSafari)()) { 225 data = data.replace(/srcset/gmi, "nosrcset"); 226 } 227 data = external_utils_namespaceObject.Hooks.applyFilters("asl/live_load/html", data, $this.o.id, $this.o.iid); 228 $dataNode = external_DoMini_default()(parser.parseFromString(data, "text/html")); 229 let replacementNode = $dataNode.find(selector).get(0); 230 replacementNode = external_utils_namespaceObject.Hooks.applyFilters("asl/live_load/replacement_node", replacementNode, $this, $el.get(0), data); 231 if (replacementNode != null) { 232 const node = $el.get(0); 233 if (node !== void 0) { 234 $el.get(0)?.parentNode?.replaceChild(replacementNode, node); 235 } 236 } 237 $el = external_DoMini_default()(selector).first(); 238 if (updateLocation) { 239 document.title = dataNode.title; 240 history.pushState({}, "", url); 241 } 242 external_DoMini_default()(selector).first().find(".woocommerce-ordering").on("change", "select.orderby", function() { 243 external_DoMini_default()(this).closest("form").trigger("submit"); 244 }); 245 $this.addHighlightString(external_DoMini_default()(selector).find("a")); 246 external_utils_namespaceObject.Hooks.applyFilters("asl/live_load/finished", url, $this, selector, $el.get(0)); 247 live_ASL.initialize(); 248 $this.lastSuccesfulSearch = $this.n("searchsettings").find("form").serialize() + $this.n("text").val().trim(); 249 $this.lastSearchData = data; 250 } 251 $this.n("s").trigger("asl_search_end", [$this.o.id, $this.o.iid, $this.n("text").val(), data], true, true); 252 $this.gaEvent?.("search_end", { "results_count": "unknown" }); 253 $this.hideLoader(); 254 $el.css("opacity", 1); 255 $this.searching = false;
256 if ($this.n("text").val() != "") { 257 $this.n("proclose").css({ 258 display: "block" 259 }); 260 } 261 } 262 updateLocation = typeof updateLocation == "undefined" ? this.o.trigger.update_href : updateLocation; 263 forceAjax = typeof forceAjax == "undefined" ? false : forceAjax; 264 let altSel = this.getLiveLoadAltSelectors(); 265 if (selector != "#main") 266 altSel.unshift("#main"); 267 if (external_DoMini_default()(selector).length < 1) { 268 altSel.forEach(function(s) { 269 if (external_DoMini_default()(s).length > 0) { 270 selector = s; 271 return false; 272 } 273 }); 274 if (external_DoMini_default()(selector).length < 1) { 275 console.log("Ajax Search Lite: The live search selector does not exist on the page."); 276 return false; 277 } 278 } 279 selector = external_utils_namespaceObject.Hooks.applyFilters("asl/live_load/selector", selector, this); 280 let $el = external_DoMini_default()(selector).first(), $this = this; 281 $this.searchAbort(); 282 $el.css("opacity", 0.4); 283 external_utils_namespaceObject.Hooks.applyFilters("asl/live_load/start", url, $this, selector, $el.get(0)); 284 if (!forceAjax && $this.n("searchsettings").find("input[name=filters_initial]").val() == 1 && $this.n("text").val() == "") { 285 (0,external_utils_namespaceObject.intervalUntilExecute)(function() { 286 process(live_ASL.pageHTML); 287 }, function() { 288 return live_ASL.pageHTML != ""; 289 }); 290 } else { 291 $this.searching = true; 292 $this.post = external_DoMini_default().fn.ajax({ 293 url, 294 method: "GET", 295 success: function(data) { 296 process(data); 297 }, 298 // @ts-ignore 299 dataType: "html", 300 fail: function(jqXHR) { 301 $el.css("opacity", 1); 302 if (jqXHR.status === 0 && jqXHR.readyState === jqXHR.UNSENT) { 303 return; 304 } 305 $el.html("This request has failed. Please check your connection."); 306 $this.hideLoader(); 307 $this.searching = false; 308 $this.n("proclose").css({ 309 display: "block" 310 }); 311 } 312 }); 313 } 314}; 315external_global_namespaceObject.AslPlugin.prototype.getCurrentLiveURL = function() { 316 let $this = this; 317 let url = "asl_ls=" + (0,external_utils_namespaceObject.nicePhrase)($this.n("text").val()), start = "&", location2 = window.location.href; 318 location2 = location2.indexOf("asl_ls=") > -1 ? location2.slice(0, location2.indexOf("asl_ls=")) : location2; 319 location2 = location2.indexOf("asl_ls&") > -1 ? location2.slice(0, location2.indexOf("asl_ls&")) : location2; 320 location2 = location2.indexOf("p_asid=") > -1 ? location2.slice(0, location2.indexOf("p_asid=")) : location2; 321 location2 = location2.indexOf("asl_") > -1 ? location2.slice(0, location2.indexOf("asl_")) : location2; 322 if (location2.indexOf("?") === -1) { 323 start = "?"; 324 } 325 let final = location2 + start + url + "&asl_active=1&asl_force_reset_pagination=1&p_asid=" + $this.o.id + "&p_asl_data=1&" + $this.n("searchsettings").find("form").serialize(); 326 final = final.replace("?&", "?"); 327 return final; 328}; 329/* harmony default export */ var live = ((/* unused pure expression or super */ null && (live_AslPlugin))); 330 331;// ./src/client/plugin/core/actions/loader.ts 332/* unused harmony import specifier */ var loader_AslPlugin; 333 334 335"use strict"; 336external_global_namespaceObject.AslPlugin.prototype.showLoader = function() { 337 this.n("proloading").css({ 338 display: "block" 339 }); 340}; 341external_global_namespaceObject.AslPlugin.prototype.hideLoader = function() { 342 let $this = this; 343 $this.n("proloading").css({ 344 display: "none" 345 }); 346 $this.n("results").css("display", ""); 347}; 348/* harmony default export */ var loader = ((/* unused pure expression or super */ null && (loader_AslPlugin))); 349 350;// ./src/client/plugin/core/actions/other.ts 351/* unused harmony import specifier */ var other_AslPlugin; 352 353 354 355"use strict"; 356const other_ASL = window.ASL; 357external_global_namespaceObject.AslPlugin.prototype.loadASLFonts = function() { 358 if (other_ASL.font_url !== false) { 359 let font = new FontFace( 360 "aslsicons2", 361 "url(" + other_ASL.font_url + ")", 362 { style: "normal", weight: "normal", display: "swap" } 363 ); 364 font.load().then(function(loaded_face) { 365 document.fonts.add(loaded_face); 366 }).catch(function(er) { 367 }); 368 other_ASL.font_url = false;
369 } 370}; 371external_global_namespaceObject.AslPlugin.prototype.updateHref = function() { 372 if (this.o.trigger.update_href && !this.usingLiveLoader()) { 373 let url = this.getStateURL() + (this.resultsOpened ? "&asl_s=" : "&asl_ls=") + this.n("text").val(); 374 history.replaceState("", "", url.replace(location.origin, "")); 375 } 376}; 377external_global_namespaceObject.AslPlugin.prototype.fixClonedSelf = function() { 378 let $this = this, oldInstanceId = $this.o.iid, oldRID = $this.o.rid; 379 while (!other_ASL.instances.set($this)) { 380 ++$this.o.iid; 381 if ($this.o.iid > 50) { 382 break; 383 } 384 } 385 if (oldInstanceId != $this.o.iid) { 386 $this.o.rid = $this.o.id + "_" + $this.o.iid; 387 const search = $this.n("search").get(0); 388 if (search !== void 0) { 389 search.id = "ajaxsearchlite" + $this.o.rid; 390 $this.n("search").removeClass("asl_m_" + oldRID).addClass("asl_m_" + $this.o.rid).data("instance", $this.o.iid); 391 } 392 const searchsettings = $this.n("searchsettings").get(0); 393 if (searchsettings !== void 0) { 394 searchsettings.id = searchsettings.id.replace("settings" + oldRID, "settings" + $this.o.rid); 395 } 396 if ($this.n("searchsettings").hasClass("asl_s_" + oldRID)) { 397 $this.n("searchsettings").removeClass("asl_s_" + oldRID).addClass("asl_s_" + $this.o.rid).data("instance", $this.o.iid); 398 } else { 399 $this.n("searchsettings").removeClass("asl_sb_" + oldRID).addClass("asl_sb_" + $this.o.rid).data("instance", $this.o.iid); 400 } 401 const resultsDiv = $this.n("resultsDiv").get(0); 402 if (resultsDiv !== void 0) { 403 resultsDiv.id = resultsDiv.id.replace("prores" + oldRID, "prores" + $this.o.rid); 404 $this.n("resultsDiv").removeClass("asl_r_" + oldRID).addClass("asl_r_" + $this.o.rid).data("instance", $this.o.iid); 405 } 406 const asl_init_data = $this.n("container").find(".asl_init_data").get(0); 407 if (asl_init_data !== void 0) { 408 $this.n("container").find(".asl_init_data").data("instance", $this.o.iid); 409 asl_init_data.id = asl_init_data.id.replace("asl_init_id_" + oldRID, "asl_init_id_" + $this.o.rid); 410 } 411 $this.n("prosettings").data("opened", 0); 412 } 413}; 414external_global_namespaceObject.AslPlugin.prototype.destroy = function() { 415 let $this = this; 416 Object.keys($this.nodes).forEach(function(k) { 417 $this.nodes[k].off?.(); 418 }); 419 $this.n("searchsettings").remove?.(); 420 $this.n("resultsDiv").remove?.(); 421 $this.n("search").remove?.(); 422 $this.n("container").remove?.(); 423 $this.documentEventHandlers.forEach(function(h) { 424 external_DoMini_default()(h.node).off(h.event, h.handler); 425 }); 426}; 427/* harmony default export */ var other = ((/* unused pure expression or super */ null && (other_AslPlugin))); 428 429;// ./src/client/plugin/core/actions/redirect.ts 430/* unused harmony import specifier */ var redirect_AslPlugin; 431 432 433 434 435 436 437external_global_namespaceObject.AslPlugin.prototype.isRedirectToFirstResult = function() { 438 return Boolean((this.n("resultsDiv").find(".asl_res_url").length > 0 || external_DoMini_default()(".asl_es_" + this.o.id + " a").length > 0 || this.o.resPage.useAjax && external_DoMini_default()(this.o.resPage.selector + "a").length > 0) && (this.o.redirectOnClick && this.ktype == "click" && this.o.trigger.click == "first_result" || this.o.redirectOnEnter && (this.ktype == "input" || this.ktype == "keyup") && this.keycode == 13 && this.o.trigger.return == "first_result")); 439}; 440external_global_namespaceObject.AslPlugin.prototype.doRedirectToFirstResult = function() { 441 let _loc, url = ""; 442 if (this.ktype == "click") { 443 _loc = this.o.trigger.click_location; 444 } else { 445 _loc = this.o.trigger.return_location; 446 } 447 if (this.n("resultsDiv").find(".asl_res_url").length > 0) { 448 url = external_DoMini_default()(this.n("resultsDiv").find(".asl_res_url").get(0)).attr("href"); 449 } else if (external_DoMini_default()(".asl_es_" + this.o.id + " a").length > 0) { 450 url = external_DoMini_default()(external_DoMini_default()(".asl_es_" + this.o.id + " a").get(0)).attr("href"); 451 } else if (this.o.resPage.useAjax && external_DoMini_default()(this.o.resPage.selector + "a").length > 0) { 452 url = external_DoMini_default()(external_DoMini_default()(this.o.resPage.selector + "a").get(0)).attr("href"); 453 } 454 if (url !== "") { 455 if (_loc == "same") { 456 window.location.href = url; 457 } else { 458 (0,external_utils_namespaceObject.openInNewTab)(url); 459 } 460 this.hideLoader(); 461 this.hideResults(); 462 } 463 return false;
464}; 465external_global_namespaceObject.AslPlugin.prototype.doRedirectToResults = function(ktype) { 466 let _loc; 467 if (ktype == "click") { 468 _loc = this.o.trigger.click_location; 469 } else { 470 _loc = this.o.trigger.return_location; 471 } 472 let url = this.getRedirectURL(ktype); 473 if (this.o.overridewpdefault) { 474 if (this.o.resPage.useAjax) { 475 this.hideResults(); 476 this.liveLoad(this.o.resPage.selector, url); 477 this.showLoader(); 478 return false; 479 } 480 if (this.o.override_method == "post") { 481 (0,external_utils_namespaceObject.submitToUrl)(url, "post", { 482 asl_active: 1, 483 p_asl_data: this.n("searchsettings").find("form").serialize() 484 }, _loc); 485 } else { 486 if (_loc == "same") { 487 location.href = url; 488 } else { 489 (0,external_utils_namespaceObject.openInNewTab)(url); 490 } 491 } 492 } else { 493 (0,external_utils_namespaceObject.submitToUrl)(url, "post", { 494 np_asl_data: this.n("searchsettings").find("form").serialize() 495 }, _loc); 496 } 497 this.n("proloading").css("display", "none"); 498 this.hideLoader(); 499 this.hideResults(); 500 this.searchAbort(); 501}; 502external_global_namespaceObject.AslPlugin.prototype.getRedirectURL = function(ktype = "enter") { 503 let url, source, final, base_url; 504 if (ktype == "click") { 505 source = this.o.trigger.click; 506 } else { 507 source = this.o.trigger.return; 508 } 509 if (source == "results_page" || source == "ajax_search") { 510 url = "?s=" + (0,external_utils_namespaceObject.nicePhrase)(this.n("text").val()); 511 } else if (source == "woo_results_page") { 512 url = "?post_type=product&s=" + (0,external_utils_namespaceObject.nicePhrase)(this.n("text").val()); 513 } else { 514 base_url = this.o.trigger.redirect_url; 515 url = base_url.replace(/{phrase}/g, (0,external_utils_namespaceObject.nicePhrase)(this.n("text").val())); 516 } 517 if (this.o.homeurl.indexOf("?") > 1 && url.indexOf("?") === 0) { 518 url = url.replace("?", "&"); 519 } 520 if (this.o.overridewpdefault && this.o.override_method != "post") { 521 let start = "&"; 522 if (this.o.homeurl.indexOf("?") === -1 && url.indexOf("?") === -1) { 523 start = "?"; 524 } 525 let addUrl = url + start + "asl_active=1&p_asl_data=1&" + this.n("searchsettings").find("form").serialize(); 526 final = this.o.homeurl + addUrl; 527 } else { 528 final = this.o.homeurl + url; 529 } 530 final = final.replace("https://", "https:///"); 531 final = final.replace("http://", "http:///"); 532 final = final.replace(/\/\//g, "/"); 533 final = external_utils_namespaceObject.Hooks.applyFilters("asl/redirect/url", final, this.o.id, this.o.iid); 534 return final; 535}; 536/* harmony default export */ var redirect = ((/* unused pure expression or super */ null && (redirect_AslPlugin))); 537 538;// ./src/client/plugin/core/actions/results.ts 539/* unused harmony import specifier */ var results_AslPlugin; 540 541 542 543 544external_global_namespaceObject.AslPlugin.prototype.showResults = function() { 545 let $this = this; 546 $this.initResults(); 547 $this.showVerticalResults(); 548 $this.hideLoader(); 549 $this.n("proclose").css({ 550 display: "block" 551 }); 552 if ($this.n("showmore") != null) { 553 if ($this.n("items").length > 0) { 554 $this.n("showmore").css({ 555 "display": "block" 556 }); 557 } else { 558 $this.n("showmore").css({ 559 "display": "none" 560 }); 561 } 562 } 563 $this.resultsOpened = true; 564}; 565external_global_namespaceObject.AslPlugin.prototype.hideResults = function(blur = true) { 566 let $this = this; 567 if (!$this.resultsOpened) return false; 568 $this.n("resultsDiv").removeClass($this.resAnim.showClass).addClass($this.resAnim.hideClass); 569 setTimeout(function() { 570 $this.n("resultsDiv").css($this.resAnim.hideCSS); 571 }, $this.resAnim.duration); 572 $this.n("proclose").css({ 573 display: "none" 574 }); 575 if ((0,external_utils_namespaceObject.isMobile)() && blur) { 576 document.activeElement?.blur(); 577 } 578 $this.resultsOpened = false; 579 $this.n("s").trigger("asl_results_hide", [$this.o.id, $this.o.iid], true, true); 580}; 581external_global_namespaceObject.AslPlugin.prototype.showResultsBox = function() { 582 let $this = this; 583 $this.n("s").trigger("asl_results_show", [$this.o.id, $this.o.iid], true, true); 584 $this.n("resultsDiv").css({ 585 display: "block", 586 height: "auto" 587 }); 588 $this.n("resultsDiv").css($this.resAnim.showCSS); 589 $this.n("resultsDiv").removeClass($this.resAnim.hideClass).addClass($this.resAnim.showClass); 590 $this.fixResultsPosition(true); 591}; 592external_global_namespaceObject.AslPlugin.prototype.addHighlightString = function($items) {
593 let $this = this, phrase = $this.n("text").val().replace(/["']/g, ""); 594 $items = typeof $items == "undefined" ? $this.n("items").find("a.asl_res_url") : $items; 595 if ($this.o.singleHighlight && phrase != "" && $items.length > 0) { 596 $items.forEach(function(el) { 597 try { 598 const url = new URL(external_DoMini_default()(el).attr("href")); 599 url.searchParams.set("asl_highlight", phrase); 600 url.searchParams.set("p_asid", String($this.o.id)); 601 external_DoMini_default()(el).attr("href", url.href); 602 } catch (e) { 603 } 604 }); 605 } 606}; 607external_global_namespaceObject.AslPlugin.prototype.scrollToResults = function() { 608 let $this = this, tolerance = Math.floor(window.innerHeight * 0.1), stop; 609 if (!$this.resultsOpened || !$this.o.scrollToResults.enabled || $this.n("resultsDiv").inViewPort(tolerance)) return; 610 if ($this.o.resultsposition == "hover") { 611 stop = $this.n("probox").offset().top - 20; 612 } else { 613 stop = $this.n("resultsDiv").offset().top - 20; 614 } 615 stop = stop + $this.o.scrollToResults.offset; 616 let $adminbar = external_DoMini_default()("#wpadminbar"); 617 if ($adminbar.length > 0) 618 stop -= $adminbar.height(); 619 stop = stop < 0 ? 0 : stop; 620 window.scrollTo({ top: stop, behavior: "smooth" }); 621}; 622/* harmony default export */ var results = ((/* unused pure expression or super */ null && (results_AslPlugin))); 623 624;// ./src/client/plugin/core/actions/statistics.ts 625 626 627const statistics_ASL = window.ASL; 628let _timer; 629const _queue = []; 630function registerLiveSearchStatistics(phrase, aspId, deviceType, foundResults, userId = 0, cached = 0) { 631 if (!statistics_ASL.statistics?.enabled || !statistics_ASL.rest_url) return; 632 _queue.push({ 633 phrase, 634 page: 1, 635 asp_id: aspId, 636 device_type: deviceType, 637 found_results: foundResults, 638 user_id: userId, 639 suggested: 0, 640 cached 641 }); 642 clearTimeout(_timer); 643 _timer = setTimeout(() => { 644 const items = [..._queue]; 645 _queue.length = 0; 646 fetch((0,external_utils_namespaceObject.buildRestUrl)(statistics_ASL.rest_url, "ajax-search-lite/statistics/searches/add"), { 647 headers: { "Content-Type": "application/json" }, 648 method: "POST", 649 credentials: "same-origin", 650 body: JSON.stringify(items) 651 }).catch(() => { 652 }); 653 }, 1e3); 654} 655 656;// ./src/client/plugin/core/actions/search.ts 657/* unused harmony import specifier */ var search_AslPlugin; 658 659 660 661 662 663 664 665const search_ASL = window.ASL; 666external_global_namespaceObject.AslPlugin.prototype.searchAbort = function() { 667 let $this = this; 668 if ($this.post != null) { 669 $this.post.abort(); 670 } 671}; 672external_global_namespaceObject.AslPlugin.prototype.searchWithCheck = function(timeout = 50) { 673 let $this = this; 674 if ($this.n("text").val().length < $this.o.charcount) return; 675 $this.searchAbort(); 676 clearTimeout($this.timeouts.searchWithCheck); 677 $this.timeouts.searchWithCheck = setTimeout(function() { 678 $this.search(); 679 }, timeout); 680}; 681external_global_namespaceObject.AslPlugin.prototype.search = function() { 682 let $this = this; 683 if ($this.searching && 0) // removed by dead control flow 684{} 685 if ($this.n("text").val().length < $this.o.charcount) return; 686 $this.searching = true; 687 $this.n("proloading").css({ 688 display: "block" 689 }); 690 $this.n("proclose").css({ 691 display: "none" 692 }); 693 let data = { 694 action: "ajaxsearchlite_search", 695 aslp: $this.n("text").val(), 696 asid: $this.o.id, 697 options: $this.n("searchsettings").find("form").serialize(), 698 asl_req_json: 1 699 }; 700 data = external_utils_namespaceObject.Hooks.applyFilters("asl/search/data", data); 701 if (JSON.stringify(data) === JSON.stringify($this.lastSearchData)) { 702 if (!$this.resultsOpened) 703 $this.showResults(); 704 $this.hideLoader(); 705 if ($this.isRedirectToFirstResult()) { 706 $this.doRedirectToFirstResult(); 707 return false; 708 } 709 return false; 710 } 711 $this.gaEvent?.("search_start"); 712 if (external_DoMini_default()(".asl_es_" + $this.o.id).length > 0) { 713 $this.liveLoad(".asl_es_" + $this.o.id, $this.getCurrentLiveURL(), false); 714 } else if ($this.o.resPage.useAjax) { 715 $this.liveLoad($this.o.resPage.selector, $this.getRedirectURL()); 716 } else { 717 const doAjaxSearch = () => { 718 $this.post = external_DoMini_default().fn.ajax({ 719 "url": search_ASL.ajaxurl, 720 "method": "POST", 721 "data": data, 722 "success": function(r) { 723 let htmlContent; 724 try { 725 const jsonResp = JSON.parse(r); 726 htmlContent = jsonResp.html ?? ""; 727 } catch (_e) { 728 const cleanResponse = r.replace(/^\s*[\r\n]/gm, "").match(/___ASLSTART___(.*[\s\S]*)___ASLEND___/); 729 if (cleanResponse === null) { 730 $this.hideLoader(); 731 console.warn("The response inner data is missing!"); 732 return; 733 } 734 htmlContent = cleanResponse[1]; 735 } 736 htmlContent = external_utils_namespaceObject.Hooks.applyFilters("asl/search/html", htmlContent); 737 $this.n("resdrg").html(""); 738 $this.n("resdrg").html(htmlContent); 739 $this.n("resdrg").find(".asl_keyword").on("click", function() { 740 $this.n("text").val(external_DoMini_default()(this).html()); 741 $this.n("container").find("input.orig").val(external_DoMini_default()(this).html()).trigger("keydown"); 742 $this.n("container").find("form").trigger("submit", ["ajax"]); 743 $this.search(); 744 }); 745 $this.nodes.items = $this.n("resultsDiv").find(".item"); 746 $this.addHighlightString(); 747 $this.gaEvent?.("search_end", { "results_count": $this.n("items").length }); 748 if ($this.isRedirectToFirstResult()) { 749 $this.doRedirectToFirstResult(); 750 return false;
751 } 752 $this.hideLoader(); 753 $this.showResults(); 754 $this.scrollToResults(); 755 $this.lastSuccesfulSearch = $this.n("searchsettings").find("form").serialize() + $this.n("text").val().trim(); 756 $this.lastSearchData = data; 757 $this.updateHref(); 758 if ($this.n("items").length == 0) { 759 if ($this.n("showmore") != null) { 760 $this.n("showmore").css("display", "none"); 761 } 762 } else { 763 if ($this.n("showmore") != null) { 764 $this.n("showmore").css("display", "block"); 765 $this.n("showmore").find("span").off(); 766 $this.n("showmore").find("span").on("click", function() { 767 let source = $this.o.trigger.click, url; 768 if (source == "results_page") { 769 url = "?s=" + (0,external_utils_namespaceObject.nicePhrase)($this.n("text").val()); 770 } else if (source == "woo_results_page") { 771 url = "?post_type=product&s=" + (0,external_utils_namespaceObject.nicePhrase)($this.n("text").val()); 772 } else { 773 url = $this.o.trigger.redirect_url.replace("{phrase}", (0,external_utils_namespaceObject.nicePhrase)($this.n("text").val())); 774 } 775 if ($this.o.overridewpdefault) { 776 if ($this.o.override_method == "post") { 777 (0,external_utils_namespaceObject.submitToUrl)($this.o.homeurl + url, "post", { 778 asl_active: 1, 779 p_asl_data: $this.n("searchsettings").find("form").serialize() 780 }); 781 } else { 782 location.href = $this.o.homeurl + url + "&asl_active=1&p_asid=" + $this.o.id + "&p_asl_data=1&" + $this.n("searchsettings").find("form").serialize(); 783 } 784 } else { 785 (0,external_utils_namespaceObject.submitToUrl)($this.o.homeurl + url, "post", { 786 np_asl_data: $this.n("searchsettings").find("form").serialize() 787 }); 788 } 789 }); 790 } 791 } 792 external_utils_namespaceObject.Hooks.applyFilters("asl/search/end", $this, data); 793 }, 794 "fail": function(jqXHR) { 795 $this.n("resdrg").html(""); 796 $this.n("resdrg").html('<div class="asl_nores">The request failed. Please check your connection! Status: ' + jqXHR.status + "</div>"); 797 $this.nodes.items = $this.n("resultsDiv").find(".item"); 798 $this.hideLoader(); 799 $this.showResults(); 800 $this.scrollToResults(); 801 } 802 }); 803 }; 804 if (window.ASL.cache.enabled && window.ASL.cache.type === "super_file") { 805 const _opts = (0,external_utils_namespaceObject.parse_str)(data.options); 806 const _hash = (0,external_utils_namespaceObject.md5)(0 + $this.n("text").val() + JSON.stringify(_opts) + "0").slice(0, 14); 807 if (window.ASL.cache.list.has(_hash)) { 808 fetch(window.ASL.cache.url + _hash + ".json?t=" + search_ASL.cache.timestamp).then((response) => { 809 if (!response.ok) throw new Error("Cache response not ok"); 810 return response.json(); 811 }).then((resp) => { 812 const htmlContent = external_utils_namespaceObject.Hooks.applyFilters("asl/search/html", resp.html ?? ""); 813 $this.n("resdrg").html(""); 814 $this.n("resdrg").html(htmlContent); 815 $this.nodes.items = $this.n("resultsDiv").find(".item"); 816 $this.addHighlightString(); 817 $this.gaEvent?.("search_end", { "results_count": $this.n("items").length }); 818 registerLiveSearchStatistics( 819 $this.n("text").val(), 820 $this.o.id, 821 $this.n("searchsettings").find("input[name=device]").val() || "desktop", 822 resp.full_results_count ?? 0, 823 search_ASL.statistics?.uid ?? 0, 824 1 825 ); 826 if ($this.isRedirectToFirstResult()) { 827 $this.doRedirectToFirstResult(); 828 return; 829 } 830 $this.hideLoader(); 831 $this.showResults(); 832 $this.scrollToResults(); 833 $this.lastSuccesfulSearch = $this.n("searchsettings").find("form").serialize() + $this.n("text").val().trim(); 834 $this.lastSearchData = data; 835 $this.updateHref(); 836 }).catch(() => { 837 window.ASL.initCache(true); 838 doAjaxSearch(); 839 }); 840 return; 841 } 842 } 843 doAjaxSearch(); 844 } 845}; 846/* harmony default export */ var search = ((/* unused pure expression or super */ null && (search_AslPlugin))); 847 848;// ./src/client/plugin/core/etc/api.ts 849/* unused harmony import specifier */ var api_AslPlugin; 850 851 852external_global_namespaceObject.AslPlugin.prototype.searchFor = function(phrase) { 853 if (typeof phrase != "undefined") { 854 this.n("text").val(phrase); 855 } 856 this.n("textAutocomplete").val(""); 857 this.search(); 858}; 859external_global_namespaceObject.AslPlugin.prototype.toggleSettings = function(state) { 860 if (typeof state != "undefined") { 861 if (state == "show") { 862 this.showSettings(); 863 } else { 864 this.hideSettings(); 865 } 866 } else { 867 if (parseInt(this.n("prosettings").data("opened")) === 1) { 868 this.hideSettings(); 869 } else { 870 this.showSettings(); 871 } 872 } 873}; 874external_global_namespaceObject.AslPlugin.prototype.closeResults = function(clear) { 875 if (typeof clear != "undefined" && clear) { 876 this.n("text").val(""); 877 this.n("textAutocomplete").val(""); 878 } 879 this.hideResults(); 880 this.n("proloading").css("display", "none"); 881 this.hideLoader(); 882 this.searchAbort(); 883}; 884external_global_namespaceObject.AslPlugin.prototype.getStateURL = function() { 885 let url, sep; 886 const urlParts = location.href.split("p_asid"); 887 url = urlParts[0]; 888 url = url.replace("&asl_active=1", ""); 889 url = url.replace("?asl_active=1", ""); 890 url = url.slice(-1) == "?" ? url.slice(0, -1) : url; 891 url = url.slice(-1) == "&" ? url.slice(0, -1) : url; 892 sep = url.indexOf("?") > 1 ? "&" : "?"; 893 return url + sep + "p_asid=" + this.o.id + "&p_asl_data=1&" + this.n("searchsettings").find("form").serialize(); 894}; 895external_global_namespaceObject.AslPlugin.prototype.filtersInitial = function() { 896 return this.n("searchsettings").find("input[name=filters_initial]").val() == 1; 897}; 898external_global_namespaceObject.AslPlugin.prototype.filtersChanged = function() { 899 return this.n("searchsettings").find("input[name=filters_changed]").val() == 1; 900}; 901/* harmony default export */ var api = ((/* unused pure expression or super */ null && (api_AslPlugin))); 902 903;// ./src/client/plugin/core/etc/position.ts 904/* unused harmony import specifier */ var position_AslPlugin; 905 906 907 908 909 910external_global_namespaceObject.AslPlugin.prototype.detectAndFixFixedPositioning = function() {
911 let $this = this, fixedp = false, n = $this.n("search").get(0); 912 while (n) { 913 n = n.parentElement; 914 if (n != null && window.getComputedStyle(n).position === "fixed") { 915 fixedp = true; 916 break; 917 } 918 } 919 if (fixedp || $this.n("search").css("position") == "fixed") { 920 if ($this.n("resultsDiv").css("position") == "absolute") { 921 $this.n("resultsDiv").css({ 922 "position": "fixed", 923 "z-index": 2147483647 924 }); 925 } 926 if (!$this.o.blocking) { 927 $this.n("searchsettings").css({ 928 "position": "fixed", 929 "z-index": 2147483647 930 }); 931 } 932 } else { 933 if ($this.n("resultsDiv").css("position") == "fixed") { 934 $this.n("resultsDiv").css("position", "absolute"); 935 } 936 if (!$this.o.blocking) { 937 $this.n("searchsettings").css("position", "absolute"); 938 } 939 } 940}; 941external_global_namespaceObject.AslPlugin.prototype.fixResultsPosition = function(ignoreVisibility = false) { 942 let $this = this, $body = external_DoMini_default()("body"), bodyTop = 0, rpos = $this.n("resultsDiv").css("position"); 943 if (external_DoMini_default()._fn.bodyTransformY() != 0 || $body.css("position") != "static") { 944 bodyTop = $body.offset().top; 945 } 946 if (external_DoMini_default()._fn.bodyTransformY() != 0 && rpos == "fixed") { 947 rpos = "absolute"; 948 $this.n("resultsDiv").css("position", "absolute"); 949 } 950 if (rpos == "fixed") { 951 bodyTop = 0; 952 } 953 if (rpos != "fixed" && rpos != "absolute") { 954 return; 955 } 956 if (ignoreVisibility || $this.n("resultsDiv").css("visibility") == "visible") { 957 let _rposition = $this.n("search").offset(), bodyLeft = 0; 958 if (external_DoMini_default()._fn.bodyTransformX() != 0 || $body.css("position") != "static") { 959 bodyLeft = $body.offset().left; 960 } 961 if (typeof _rposition != "undefined") { 962 let vwidth, adjust = 0; 963 if ((0,external_utils_namespaceObject.deviceType)() === "phone") { 964 vwidth = $this.o.results.width_phone; 965 } else if ((0,external_utils_namespaceObject.deviceType)() == "tablet") { 966 vwidth = $this.o.results.width_tablet; 967 } else { 968 vwidth = $this.o.results.width; 969 } 970 if (vwidth == "auto") { 971 vwidth = $this.n("search").outerWidth() < 240 ? 240 : $this.n("search").outerWidth(); 972 } 973 $this.n("resultsDiv").css("width", (0,external_utils_namespaceObject.isNumeric)(vwidth) ? vwidth + "px" : vwidth); 974 if ($this.o.resultsSnapTo == "right") { 975 adjust = $this.n("resultsDiv").outerWidth() - $this.n("search").outerWidth(); 976 } else if ($this.o.resultsSnapTo == "center") { 977 adjust = Math.floor(($this.n("resultsDiv").outerWidth() - parseInt(String($this.n("search").outerWidth()))) / 2); 978 } 979 $this.n("resultsDiv").css({ 980 top: _rposition.top + $this.n("search").outerHeight(true) - bodyTop + "px", 981 left: _rposition.left - adjust - bodyLeft + "px" 982 }); 983 } 984 } 985}; 986external_global_namespaceObject.AslPlugin.prototype.fixSettingsPosition = function(ignoreVisibility = false) { 987 let $this = this, $body = external_DoMini_default()("body"), bodyTop = 0, settPos = $this.n("searchsettings").css("position"); 988 if (external_DoMini_default()._fn.bodyTransformY() != 0 || $body.css("position") != "static") { 989 bodyTop = $body.offset().top; 990 } 991 if (external_DoMini_default()._fn.bodyTransformY() != 0 && settPos == "fixed") { 992 settPos = "absolute"; 993 $this.n("searchsettings").css("position", "absolute"); 994 } 995 if (settPos == "fixed") { 996 bodyTop = 0; 997 } 998 if (ignoreVisibility || $this.n("prosettings").data("opened") !== "0") { 999 let $n, sPosition, top, left, bodyLeft = 0; 1000 if (external_DoMini_default()._fn.bodyTransformX() != 0 || $body.css("position") != "static") { 1001 bodyLeft = $body.offset().left; 1002 } 1003 $this.fixSettingsWidth(); 1004 if ($this.n("prosettings").css("display") != "none") { 1005 $n = $this.n("prosettings"); 1006 } else { 1007 $n = $this.n("promagnifier"); 1008 } 1009 sPosition = $n.offset(); 1010 top = sPosition.top + $n.height() - 2 - bodyTop + "px"; 1011 left = $this.o.settingsimagepos == "left" ? sPosition.left : sPosition.left + $n.width() - $this.n("searchsettings").width(); 1012 left = left - bodyLeft + "px"; 1013 $this.n("searchsettings").css({ 1014 display: "block", 1015 top, 1016 left 1017 }); 1018 } 1019}; 1020external_global_namespaceObject.AslPlugin.prototype.fixSettingsWidth = function() { 1021}; 1022external_global_namespaceObject.AslPlugin.prototype.hideOnInvisibleBox = function() {
1023 let $this = this; 1024 if ($this.o.detectVisibility && !$this.n("search").hasClass("hiddend") && ($this.n("search").is(":hidden") || !$this.n("search").is(":visible"))) { 1025 $this.hideSettings?.(); 1026 $this.hideResults(); 1027 } 1028}; 1029/* harmony default export */ var position = ((/* unused pure expression or super */ null && (position_AslPlugin))); 1030 1031;// ./src/client/plugin/core/events/button.ts 1032/* unused harmony import specifier */ var button_AslPlugin; 1033 1034 1035external_global_namespaceObject.AslPlugin.prototype.initMagnifierEvents = function() { 1036 let $this = this, t; 1037 $this.n("promagnifier").on("click", function(e) { 1038 $this.keycode = e.keyCode || e.which; 1039 $this.ktype = e.type; 1040 $this.gaEvent?.("magnifier"); 1041 if ($this.n("text").val().length >= $this.o.charcount && $this.o.redirectOnClick && $this.o.trigger.click !== "first_result") { 1042 $this.doRedirectToResults("click"); 1043 clearTimeout(t); 1044 return false; 1045 } 1046 if (!($this.o.trigger.click == "ajax_search" || $this.o.trigger.click == "first_result")) { 1047 return false; 1048 } 1049 $this.searchAbort(); 1050 clearTimeout($this.timeouts.search); 1051 $this.n("proloading").css("display", "none"); 1052 $this.timeouts.search = setTimeout(function() { 1053 if ($this.n("searchsettings").find("form").serialize() + $this.n("text").val().trim() != $this.lastSuccesfulSearch || !$this.resultsOpened && !$this.usingLiveLoader()) { 1054 $this.search(); 1055 } else { 1056 if ($this.isRedirectToFirstResult()) 1057 $this.doRedirectToFirstResult(); 1058 else 1059 $this.n("proclose").css("display", "block"); 1060 } 1061 }, $this.o.trigger.delay); 1062 }); 1063}; 1064/* harmony default export */ var events_button = ((/* unused pure expression or super */ null && (button_AslPlugin))); 1065 1066;// ./src/client/plugin/core/events/input.ts 1067 1068 1069 1070 1071external_global_namespaceObject.AslPlugin.prototype.initInputEvents = function() { 1072 let $this = this, initialized = false; 1073 let initTriggers = function() { 1074 $this.n("text").off("mousedown touchstart keydown", initTriggers); 1075 if (!initialized) { 1076 $this._initFocusInput(); 1077 if ($this.o.trigger.type) { 1078 $this._initSearchInput(); 1079 } 1080 $this._initEnterEvent(); 1081 $this._initFormEvent(); 1082 $this.initAutocompleteEvent?.(); 1083 initialized = true; 1084 } 1085 }; 1086 $this.n("text").on("mousedown touchstart keydown", initTriggers, { passive: true }); 1087}; 1088external_global_namespaceObject.AslPlugin.prototype._initFocusInput = function() { 1089 let $this = this; 1090 $this.n("text").on("click", function(e) { 1091 e.stopPropagation(); 1092 e.stopImmediatePropagation(); 1093 external_DoMini_default()(this).trigger("focus", []); 1094 $this.gaEvent?.("focus"); 1095 if ($this.n("searchsettings").find("form").serialize() + $this.n("text").val().trim() == $this.lastSuccesfulSearch) { 1096 if (!$this.resultsOpened && !$this.usingLiveLoader()) { 1097 $this.showResults(); 1098 } 1099 return false; 1100 } 1101 }); 1102 $this.n("text").on("focus input", function(e) { 1103 if ($this.searching) { 1104 return; 1105 } 1106 if (external_DoMini_default()(this).val() != "") { 1107 $this.n("proclose").css("display", "block"); 1108 } else { 1109 $this.n("proclose").css({ 1110 display: "none" 1111 }); 1112 } 1113 }); 1114}; 1115external_global_namespaceObject.AslPlugin.prototype._initSearchInput = function() { 1116 let $this = this; 1117 $this.n("text").on("input", function(e) { 1118 $this.keycode = e.keyCode || e.which; 1119 $this.ktype = e.type; 1120 $this.updateHref(); 1121 if ($this.n("text").val().length < $this.o.charcount) { 1122 $this.n("proloading").css("display", "none"); 1123 $this.hideResults(false); 1124 $this.searchAbort(); 1125 clearTimeout($this.timeouts.search); 1126 return false; 1127 } 1128 $this.searchAbort(); 1129 clearTimeout($this.timeouts.search); 1130 $this.n("proloading").css("display", "none"); 1131 $this.timeouts.search = setTimeout(function() { 1132 if ($this.n("searchsettings").find("form").serialize() + $this.n("text").val().trim() != $this.lastSuccesfulSearch || !$this.resultsOpened && !$this.usingLiveLoader()) { 1133 $this.search(); 1134 } else { 1135 if ($this.isRedirectToFirstResult()) 1136 $this.doRedirectToFirstResult(); 1137 else 1138 $this.n("proclose").css("display", "block"); 1139 } 1140 }, $this.o.trigger.delay); 1141 }); 1142}; 1143external_global_namespaceObject.AslPlugin.prototype._initEnterEvent = function() {
1144 let $this = this, rt, enterRecentlyPressed = false; 1145 $this.n("text").on("keyup", function(e) { 1146 $this.keycode = e.keyCode || e.which; 1147 $this.ktype = e.type; 1148 if ($this.keycode == 13) { 1149 clearTimeout(rt); 1150 rt = setTimeout(function() { 1151 enterRecentlyPressed = false; 1152 }, 300); 1153 if (enterRecentlyPressed) { 1154 return false; 1155 } else { 1156 enterRecentlyPressed = true; 1157 } 1158 } 1159 let isInput = external_DoMini_default()(this).hasClass("orig"); 1160 if ($this.n("text").val().length >= $this.o.charcount && isInput && $this.keycode == 13) { 1161 $this.gaEvent?.("return"); 1162 if ($this.o.redirectOnEnter) { 1163 if ($this.o.trigger.return != "first_result") { 1164 $this.doRedirectToResults($this.ktype); 1165 } else { 1166 $this.search(); 1167 } 1168 } else if ($this.o.trigger.return == "ajax_search") { 1169 if ($this.n("searchsettings").find("form").serialize() + $this.n("text").val().trim() != $this.lastSuccesfulSearch || !$this.resultsOpened && !$this.usingLiveLoader()) { 1170 $this.search(); 1171 } 1172 } 1173 clearTimeout($this.timeouts.search); 1174 } 1175 }); 1176}; 1177external_global_namespaceObject.AslPlugin.prototype._initFormEvent = function() { 1178 let $this = this; 1179 external_DoMini_default()($this.n("text").closest("form").get(0)).on("submit", function(e, args) { 1180 e.preventDefault(); 1181 if ((0,external_utils_namespaceObject.isMobile)()) { 1182 if ($this.o.redirectOnEnter) { 1183 let event = new Event("keyup"); 1184 event.keyCode = event.which = 13; 1185 $this.n("text").get(0).dispatchEvent(event); 1186 } else { 1187 $this.search(); 1188 document?.activeElement?.blur(); 1189 } 1190 } else if (typeof args != "undefined" && args == "ajax") { 1191 $this.search(); 1192 } 1193 }); 1194}; 1195 1196;// ./src/client/plugin/core/events/navigation.ts 1197 1198 1199 1200external_global_namespaceObject.AslPlugin.prototype.initNavigationEvents = function() { 1201 let $this = this; 1202 let handler = function(e) { 1203 let keycode = e.keyCode || e.which; 1204 if ( 1205 // @ts-ignore 1206 external_DoMini_default()(".item", $this.n("resultsDiv")).length > 0 && $this.n("resultsDiv").css("display") != "none" && $this.o.resultstype == "vertical" 1207 ) { 1208 if (keycode == 40 || keycode == 38) { 1209 let $hovered = $this.n("resultsDiv").find(".item.hovered"); 1210 $this.n("text").trigger("blur", []); 1211 if ($hovered.length == 0) { 1212 $this.n("resultsDiv").find(".item").first().addClass("hovered"); 1213 } else { 1214 if (keycode == 40) { 1215 if ($hovered.next(".item").length == 0) { 1216 $this.n("resultsDiv").find(".item").removeClass("hovered").first().addClass("hovered"); 1217 } else { 1218 $hovered.removeClass("hovered").next(".item").addClass("hovered"); 1219 } 1220 } 1221 if (keycode == 38) { 1222 if ($hovered.prev(".item").length == 0) { 1223 $this.n("resultsDiv").find(".item").removeClass("hovered").last().addClass("hovered"); 1224 } else { 1225 $hovered.removeClass("hovered").prev(".item").addClass("hovered"); 1226 } 1227 } 1228 } 1229 e.stopPropagation(); 1230 e.preventDefault(); 1231 if (!$this.n("resultsDiv").find(".resdrg .item.hovered").inViewPort(50, $this.n("resultsDiv").get(0))) { 1232 let n = $this.n("resultsDiv").find(".resdrg .item.hovered").get(0); 1233 if (n != null && typeof n.scrollIntoView != "undefined") { 1234 n.scrollIntoView({ behavior: "smooth", block: "start", inline: "nearest" }); 1235 } 1236 } 1237 } 1238 if (keycode == 13 && $this.n("resultsDiv").find(".item.hovered").length > 0) { 1239 e.stopPropagation(); 1240 e.preventDefault(); 1241 $this.n("resultsDiv").find(".item.hovered a.asl_res_url").get(0).click(); 1242 } 1243 } 1244 }; 1245 $this.documentEventHandlers.push({ 1246 "node": document, 1247 "event": "keydown", 1248 "handler": handler 1249 }); 1250 external_DoMini_default()(document).on("keydown", handler); 1251}; 1252 1253;// ./src/client/plugin/core/events/other.ts 1254 1255 1256 1257 1258external_global_namespaceObject.AslPlugin.prototype.initOtherEvents = function() {
1259 let $this = this, handler, handler2; 1260 if ((0,external_utils_namespaceObject.isMobile)() && (0,external_utils_namespaceObject.detectIOS)()) { 1261 $this.n("text").on("touchstart", function() { 1262 $this.savedScrollTop = window.scrollY; 1263 $this.savedContainerTop = $this.n("search").offset().top; 1264 }); 1265 } 1266 $this.n("proclose").on($this.clickTouchend, function(e) { 1267 e.preventDefault(); 1268 e.stopImmediatePropagation(); 1269 $this.n("text").val(""); 1270 $this.n("textAutocomplete").val(""); 1271 $this.hideResults(); 1272 $this.n("text").trigger("focus", []); 1273 $this.n("proloading").css("display", "none"); 1274 $this.hideLoader(); 1275 $this.searchAbort(); 1276 if (external_DoMini_default()(".asl_es_" + $this.o.id).length > 0) { 1277 $this.showLoader(); 1278 $this.liveLoad(".asl_es_" + $this.o.id, $this.getCurrentLiveURL(), false); 1279 } else if ($this.o.resPage.useAjax) { 1280 $this.showLoader(); 1281 $this.liveLoad($this.o.resPage.selector, $this.getRedirectURL()); 1282 } 1283 $this.n("text").get(0).focus(); 1284 }); 1285 if ((0,external_utils_namespaceObject.isMobile)()) { 1286 handler = function() { 1287 $this.orientationChange(); 1288 setTimeout(function() { 1289 $this.orientationChange(); 1290 }, 600); 1291 }; 1292 $this.documentEventHandlers.push({ 1293 "node": window, 1294 "event": "orientationchange", 1295 "handler": handler 1296 }); 1297 external_DoMini_default()(window).on("orientationchange", handler); 1298 } else { 1299 handler = function() { 1300 $this.resize(); 1301 }; 1302 $this.documentEventHandlers.push({ 1303 "node": window, 1304 "event": "resize", 1305 "handler": handler 1306 }); 1307 external_DoMini_default()(window).on("resize", handler, { passive: true }); 1308 } 1309 handler2 = function() { 1310 $this.scrolling(false); 1311 }; 1312 $this.documentEventHandlers.push({ 1313 "node": window, 1314 "event": "scroll", 1315 "handler": handler2 1316 }); 1317 external_DoMini_default()(window).on("scroll", handler2, { passive: true }); 1318 if ((0,external_utils_namespaceObject.isMobile)() && $this.o.mobile.menu_selector != "") { 1319 external_DoMini_default()($this.o.mobile.menu_selector).on("touchend", function() { 1320 let _this = this; 1321 setTimeout(function() { 1322 let $input = external_DoMini_default()(_this).find("input.orig"); 1323 $input = $input.length == 0 ? external_DoMini_default()(_this).next().find("input.orig") : $input; 1324 $input = $input.length == 0 ? external_DoMini_default()(_this).parent().find("input.orig") : $input; 1325 $input = $input.length == 0 ? $this.n("text") : $input; 1326 if ($this.n("search").inViewPort()) { 1327 $input.get(0).focus(); 1328 } 1329 }, 300); 1330 }); 1331 } 1332 if ((0,external_utils_namespaceObject.detectIOS)() && (0,external_utils_namespaceObject.isMobile)() && (0,external_utils_namespaceObject.isTouchDevice)()) { 1333 if (parseInt($this.n("text").css("font-size")) < 16) { 1334 $this.n("text").data("fontSize", $this.n("text").css("font-size")).css("font-size", "16px"); 1335 $this.n("textAutocomplete").css("font-size", "16px"); 1336 external_DoMini_default()("body").append("<style>#ajaxsearchlite" + $this.o.rid + " input.orig::-webkit-input-placeholder{font-size: 16px !important;}</style>"); 1337 } 1338 } 1339}; 1340external_global_namespaceObject.AslPlugin.prototype.orientationChange = function() { 1341 let $this = this; 1342 $this.detectAndFixFixedPositioning(); 1343 $this.fixSettingsPosition(); 1344 $this.fixResultsPosition(); 1345}; 1346external_global_namespaceObject.AslPlugin.prototype.resize = function() { 1347 let $this = this; 1348 $this.detectAndFixFixedPositioning(); 1349 $this.fixSettingsPosition(); 1350 $this.fixResultsPosition(); 1351}; 1352external_global_namespaceObject.AslPlugin.prototype.scrolling = function(ignoreVisibility) { 1353 let $this = this; 1354 $this.detectAndFixFixedPositioning(); 1355 $this.hideOnInvisibleBox(); 1356 $this.fixSettingsPosition(ignoreVisibility); 1357 $this.fixResultsPosition(ignoreVisibility); 1358}; 1359 1360;// ./src/client/plugin/core/events/results.ts 1361/* unused harmony import specifier */ var events_results_AslPlugin; 1362 1363 1364 1365external_global_namespaceObject.AslPlugin.prototype.initResultsEvents = function() {
1366 let $this = this; 1367 $this.n("resultsDiv").css({ 1368 opacity: "0" 1369 }); 1370 let handler = function(e) { 1371 let keycode = e.keyCode || e.which, ktype = e.type; 1372 if (external_DoMini_default()(e.target).closest(".asl_w").length == 0) { 1373 $this.hideOnInvisibleBox(); 1374 if (ktype != "click" || ktype != "touchend" || keycode != 3) { 1375 if (!$this.resultsOpened || !$this.o.closeOnDocClick) return; 1376 if (!$this.dragging) { 1377 $this.hideLoader(); 1378 $this.searchAbort(); 1379 $this.hideResults(); 1380 } 1381 } 1382 } 1383 }; 1384 $this.documentEventHandlers.push({ 1385 "node": document, 1386 "event": $this.clickTouchend, 1387 "handler": handler 1388 }); 1389 external_DoMini_default()(document).on($this.clickTouchend, handler); 1390 $this.n("resultsDiv").on("click", ".results .item", function() { 1391 $this.gaEvent?.("result_click", { 1392 "result_title": external_DoMini_default()(this).find("a.asl_res_url").text(), 1393 "result_url": external_DoMini_default()(this).find("a.asl_res_url").attr("href") 1394 }); 1395 }); 1396}; 1397/* harmony default export */ var events_results = ((/* unused pure expression or super */ null && (events_results_AslPlugin))); 1398 1399;// ./src/client/plugin/core/events/touch.ts 1400/* unused harmony import specifier */ var touch_AslPlugin; 1401 1402 1403 1404external_global_namespaceObject.AslPlugin.prototype.monitorTouchMove = function() { 1405 let $this = this; 1406 $this.dragging = false; 1407 external_DoMini_default()("body").on("touchmove", function() { 1408 $this.dragging = true; 1409 }).on("touchstart", function() { 1410 $this.dragging = false; 1411 }); 1412}; 1413/* harmony default export */ var touch = ((/* unused pure expression or super */ null && (touch_AslPlugin))); 1414 1415;// ./src/client/plugin/core/init/init.ts 1416/* unused harmony import specifier */ var init_AslPlugin; 1417 1418 1419 1420external_global_namespaceObject.AslPlugin.prototype.init = function(options, elem) { 1421 this.o = { ...this.o, ...options }; 1422 this.nodes = {}; 1423 this.nodes.search = external_DoMini_default()(elem); 1424 this.initNodeVariables(); 1425 this.o.redirectOnClick = this.o.trigger.click != "ajax_search" && this.o.trigger.click != "nothing"; 1426 this.o.redirectOnEnter = this.o.trigger.return != "ajax_search" && this.o.trigger.return != "nothing"; 1427 if (this.usingLiveLoader()) { 1428 this.o.trigger.type = this.o.resPage.trigger_type; 1429 this.o.trigger.facet = this.o.resPage.trigger_facet; 1430 if (this.o.resPage.trigger_magnifier) { 1431 this.o.redirectOnClick = false; 1432 this.o.trigger.click = "ajax_search"; 1433 } 1434 if (this.o.resPage.trigger_return) { 1435 this.o.redirectOnEnter = false; 1436 this.o.trigger.return = "ajax_search"; 1437 } 1438 } 1439 this.monitorTouchMove(); 1440 this.initEvents(); 1441 this.n("s").trigger("asl_init_search_bar", [this.o.id, this.o.iid], true, true); 1442 return this; 1443}; 1444external_global_namespaceObject.AslPlugin.prototype.n = function(k) { 1445 if (typeof this.nodes[k] !== "undefined") { 1446 return this.nodes[k]; 1447 } else { 1448 switch (k) { 1449 case "s": 1450 this.nodes[k] = this.nodes.search; 1451 break; 1452 case "container": 1453 this.nodes[k] = this.nodes.search.closest(".asl_w_container"); 1454 break; 1455 case "searchsettings": 1456 this.nodes[k] = this.n("container").find(".asl_s"); 1457 break; 1458 case "resultsDiv": 1459 this.nodes[k] = this.n("container").find(".asl_r"); 1460 break; 1461 case "probox": 1462 this.nodes[k] = this.nodes.search.find(".probox"); 1463 break; 1464 case "proinput": 1465 this.nodes[k] = this.nodes.search.find(".proinput"); 1466 break; 1467 case "text": 1468 this.nodes[k] = this.nodes.search.find(".proinput input.orig"); 1469 break; 1470 case "textAutocomplete": 1471 this.nodes[k] = this.nodes.search.find(".proinput input.autocomplete"); 1472 break; 1473 case "proloading": 1474 this.nodes[k] = this.nodes.search.find(".proloading"); 1475 break; 1476 case "proclose": 1477 this.nodes[k] = this.nodes.search.find(".proclose"); 1478 break; 1479 case "promagnifier": 1480 this.nodes[k] = this.nodes.search.find(".promagnifier"); 1481 break; 1482 case "prosettings": 1483 this.nodes[k] = this.nodes.search.find(".prosettings"); 1484 break; 1485 case "settingsAppend": 1486 this.nodes[k] = external_DoMini_default()("#wpdreams_asl_settings_" + this.o.id); 1487 break; 1488 case "resultsAppend": 1489 this.nodes[k] = external_DoMini_default()("#wpdreams_asl_results_" + this.o.id); 1490 break; 1491 case "trythis": 1492 this.nodes[k] = external_DoMini_default()("#asp-try-" + this.o.rid); 1493 break; 1494 case "hiddenContainer": 1495 this.nodes[k] = this.n("container").find(".asl_hidden_data"); 1496 break; 1497 case "aspItemOverlay": 1498 this.nodes[k] = this.n("hiddenContainer").find(".asl_item_overlay"); 1499 break; 1500 case "showmore": 1501 this.nodes[k] = this.n("resultsDiv").find(".showmore"); 1502 break; 1503 case "items": 1504 this.nodes[k] = this.n("resultsDiv").find(".item").length > 0 ? this.n("resultsDiv").find(".item") : this.n("resultsDiv").find(".photostack-flip"); 1505 break; 1506 case "results": 1507 this.nodes[k] = this.n("resultsDiv").find(".results"); 1508 break; 1509 case "resdrg": 1510 this.nodes[k] = this.n("resultsDiv").find(".resdrg"); 1511 break; 1512 } 1513 return this.nodes[k]; 1514 } 1515}; 1516external_global_namespaceObject.AslPlugin.prototype.initNodeVariables = function() {
1517 let $this = this; 1518 $this.o.id = parseInt($this.nodes.search.data("id")); 1519 $this.o.iid = parseInt($this.nodes.search.data("instance")); 1520 $this.o.rid = $this.o.id + "_" + $this.o.iid; 1521 $this.fixClonedSelf(); 1522}; 1523external_global_namespaceObject.AslPlugin.prototype.initEvents = function() { 1524 this.initSettingsSwitchEvents?.(); 1525 this.initOtherEvents(); 1526 this.initMagnifierEvents(); 1527 this.initInputEvents(); 1528}; 1529/* harmony default export */ var init = ((/* unused pure expression or super */ null && (init_AslPlugin))); 1530 1531;// ./src/client/plugin/core/init/results.ts 1532/* unused harmony import specifier */ var init_results_AslPlugin; 1533 1534 1535 1536 1537external_global_namespaceObject.AslPlugin.prototype.initResults = function() { 1538 if (!this.resultsInitialized) { 1539 this.initResultsBox(); 1540 this.initResultsEvents(); 1541 this.initNavigationEvents?.(); 1542 } 1543}; 1544external_global_namespaceObject.AslPlugin.prototype.initResultsBox = function() { 1545 let $this = this; 1546 $this.initResultsAnimations(); 1547 if ((0,external_utils_namespaceObject.isMobile)() && $this.o.mobile.force_res_hover == 1) { 1548 $this.o.resultsposition = "hover"; 1549 $this.nodes.resultsDiv = $this.n("resultsDiv").clone(); 1550 external_DoMini_default()("body").append($this.nodes.resultsDiv); 1551 $this.nodes.resultsDiv.css({ 1552 "position": "absolute" 1553 }); 1554 $this.detectAndFixFixedPositioning(); 1555 } else { 1556 if ($this.o.resultsposition == "hover" && $this.n("resultsAppend").length <= 0) { 1557 $this.nodes.resultsDiv = $this.n("resultsDiv").clone(); 1558 external_DoMini_default()("body").append($this.n("resultsDiv")); 1559 } else { 1560 $this.o.resultsposition = "block"; 1561 $this.n("resultsDiv").css({ 1562 "position": "static" 1563 }); 1564 if ($this.n("resultsAppend").length > 0) { 1565 if ($this.n("resultsAppend").find(".asl_w").length > 0) { 1566 $this.nodes.resultsDiv = $this.n("resultsAppend").find(".asl_w"); 1567 } else { 1568 $this.nodes.resultsDiv = $this.n("resultsDiv").clone(); 1569 $this.nodes.resultsAppend.append($this.n("resultsDiv")); 1570 } 1571 } 1572 } 1573 } 1574 $this.nodes.showmore = $this.n("resultsDiv").find(".showmore"); 1575 $this.nodes.items = $this.n("resultsDiv").find(".item").length > 0 ? $this.n("resultsDiv").find(".item") : $this.n("resultsDiv").find(".photostack-flip"); 1576 $this.nodes.results = $this.n("resultsDiv").find(".results"); 1577 $this.nodes.resdrg = $this.n("resultsDiv").find(".resdrg"); 1578 $this.n("resultsDiv").get(0).id = $this.n("resultsDiv").get(0).id.replace("__original__", ""); 1579 $this.detectAndFixFixedPositioning(); 1580 $this.resultsInitialized = true; 1581}; 1582external_global_namespaceObject.AslPlugin.prototype.initResultsAnimations = function() { 1583 this.n("resultsDiv").css({ 1584 "-webkit-animation-duration": this.resAnim.duration + "ms", 1585 "animation-duration": this.resAnim.duration + "ms" 1586 }); 1587}; 1588/* harmony default export */ var init_results = ((/* unused pure expression or super */ null && (init_results_AslPlugin))); 1589 1590;// ./src/client/bundle/optimized/core.ts 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611Object(window.WPD).AjaxSearchLite = __webpack_exports__["default"]; 1612/******/ })() 1613;
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.