Ubuntu

­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­ woodmartThemeModule.beforeSearchcontent=function(){function e(e){var o=e.target.closest("form.searchform");document.querySelectorAll(".wd-dropdown-results.wd-opened").forEach(function(e){var t=e.closest(".wd-search-form, .wd-search-dropdown");t&&(t=t.querySelector("form.searchform"),o&&t===o||d(t,e))})}function n(e){var t=this.closest("form"),o=t.parentNode.querySelector(".wd-dropdown-results");d(t,o)}function c(e){var t=this,n=t.closest("form"),c=n.parentNode.querySelector(".wd-dropdown-results"),e=e.keyCode||e.charCode;0!==t.value.length||8!==e&&46!==e?(t.dispatchEvent(new Event("wdOpenBeforeSearchContent")),setTimeout(function(){var e=!0,t=c.querySelector(".wd-search-history"),o=c.querySelector(".wd-search-requests"),r=c.querySelector(".wd-search-area");(e=t&&0!==t.childElementCount||o&&0!==o.childElementCount||r&&(0!==r.childElementCount||0!==r.textContent.length)?e:!1)&&(c.classList.add("wd-opened"),s(n,"open"))},100)):d(n,c)}var d=function(e,t){t.classList.remove("wd-opened"),s(e,"close"),setTimeout(function(){e.parentNode.classList.remove("wd-searched")},400)},s=function(e,t){e.closest(".wd-search-form.wd-display-form.wd-with-overlay")&&jQuery(".wd-close-side").trigger("wdCloseSideAction",["open"===t?"show":"hide","click"])};document.querySelectorAll("form.searchform").forEach(function(t){var e,o,r=t.parentNode.querySelector(".wd-dropdown-results");r&&(e=t.querySelector('[type="text"]'),o=t.querySelector(".wd-search-cat-btn"),e.addEventListener("focus",c),e.addEventListener("keydown",c),o&&o.addEventListener("click",n),[t,r].forEach(function(e){e.addEventListener("focusout",function(){setTimeout(function(){t.contains(document.activeElement)||r.contains(document.activeElement)||d(t,r)},10)})}))}),document.addEventListener("click",e,{passive:!0})},window.addEventListener("load",function(){woodmartThemeModule.beforeSearchcontent()});