File: /disk001/machen/www/support/wp-content/themes/wp-moose/dist/js/app.js
(() => {
var __webpack_modules__ = {
16: (module, exports, __webpack_require__) => {
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
(function(factory) {
if (true) {
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [ __webpack_require__(17) ], __WEBPACK_AMD_DEFINE_FACTORY__ = factory,
__WEBPACK_AMD_DEFINE_RESULT__ = typeof __WEBPACK_AMD_DEFINE_FACTORY__ === "function" ? __WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__) : __WEBPACK_AMD_DEFINE_FACTORY__,
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
} else {}
})((function($) {
var slice = Array.prototype.slice;
var splice = Array.prototype.splice;
var defaults = {
topSpacing: 0,
bottomSpacing: 0,
className: "is-sticky",
wrapperClassName: "sticky-wrapper",
center: false,
getWidthFrom: "",
widthFromWrapper: true,
responsiveWidth: false,
zIndex: "auto"
}, $window = $(window), $document = $(document), sticked = [], windowHeight = $window.height(), scroller = function() {
var scrollTop = $window.scrollTop(), documentHeight = $document.height(), dwh = documentHeight - windowHeight, extra = scrollTop > dwh ? dwh - scrollTop : 0;
for (var i = 0, l = sticked.length; i < l; i++) {
var s = sticked[i], elementTop = s.stickyWrapper.offset().top, etse = elementTop - s.topSpacing - extra;
s.stickyWrapper.css("height", s.stickyElement.outerHeight());
if (scrollTop <= etse) {
if (s.currentTop !== null) {
s.stickyElement.css({
width: "",
position: "",
top: "",
"z-index": ""
});
s.stickyElement.parent().removeClass(s.className);
s.stickyElement.trigger("sticky-end", [ s ]);
s.currentTop = null;
}
} else {
var newTop = documentHeight - s.stickyElement.outerHeight() - s.topSpacing - s.bottomSpacing - scrollTop - extra;
if (newTop < 0) {
newTop = newTop + s.topSpacing;
} else {
newTop = s.topSpacing;
}
if (s.currentTop !== newTop) {
var newWidth;
if (s.getWidthFrom) {
newWidth = $(s.getWidthFrom).width() || null;
} else if (s.widthFromWrapper) {
newWidth = s.stickyWrapper.width();
}
if (newWidth == null) {
newWidth = s.stickyElement.width();
}
s.stickyElement.css("width", newWidth).css("position", "fixed").css("top", newTop).css("z-index", s.zIndex);
s.stickyElement.parent().addClass(s.className);
if (s.currentTop === null) {
s.stickyElement.trigger("sticky-start", [ s ]);
} else {
s.stickyElement.trigger("sticky-update", [ s ]);
}
if (s.currentTop === s.topSpacing && s.currentTop > newTop || s.currentTop === null && newTop < s.topSpacing) {
s.stickyElement.trigger("sticky-bottom-reached", [ s ]);
} else if (s.currentTop !== null && newTop === s.topSpacing && s.currentTop < newTop) {
s.stickyElement.trigger("sticky-bottom-unreached", [ s ]);
}
s.currentTop = newTop;
}
var stickyWrapperContainer = s.stickyWrapper.parent();
var unstick = s.stickyElement.offset().top + s.stickyElement.outerHeight() >= stickyWrapperContainer.offset().top + stickyWrapperContainer.outerHeight() && s.stickyElement.offset().top <= s.topSpacing;
if (unstick) {
s.stickyElement.css("position", "absolute").css("top", "").css("bottom", 0).css("z-index", "");
} else {
s.stickyElement.css("position", "fixed").css("top", newTop).css("bottom", "").css("z-index", s.zIndex);
}
}
}
}, resizer = function() {
windowHeight = $window.height();
for (var i = 0, l = sticked.length; i < l; i++) {
var s = sticked[i];
var newWidth = null;
if (s.getWidthFrom) {
if (s.responsiveWidth) {
newWidth = $(s.getWidthFrom).width();
}
} else if (s.widthFromWrapper) {
newWidth = s.stickyWrapper.width();
}
if (newWidth != null) {
s.stickyElement.css("width", newWidth);
}
}
}, methods = {
init: function(options) {
var o = $.extend({}, defaults, options);
return this.each((function() {
var stickyElement = $(this);
var stickyId = stickyElement.attr("id");
var wrapperId = stickyId ? stickyId + "-" + defaults.wrapperClassName : defaults.wrapperClassName;
var wrapper = $("<div></div>").attr("id", wrapperId).addClass(o.wrapperClassName);
stickyElement.wrapAll(wrapper);
var stickyWrapper = stickyElement.parent();
if (o.center) {
stickyWrapper.css({
width: stickyElement.outerWidth(),
marginLeft: "auto",
marginRight: "auto"
});
}
if (stickyElement.css("float") === "right") {
stickyElement.css({
float: "none"
}).parent().css({
float: "right"
});
}
o.stickyElement = stickyElement;
o.stickyWrapper = stickyWrapper;
o.currentTop = null;
sticked.push(o);
methods.setWrapperHeight(this);
methods.setupChangeListeners(this);
}));
},
setWrapperHeight: function(stickyElement) {
var element = $(stickyElement);
var stickyWrapper = element.parent();
if (stickyWrapper) {
stickyWrapper.css("height", element.outerHeight());
}
},
setupChangeListeners: function(stickyElement) {
if (window.MutationObserver) {
var mutationObserver = new window.MutationObserver((function(mutations) {
if (mutations[0].addedNodes.length || mutations[0].removedNodes.length) {
methods.setWrapperHeight(stickyElement);
}
}));
mutationObserver.observe(stickyElement, {
subtree: true,
childList: true
});
} else {
stickyElement.addEventListener("DOMNodeInserted", (function() {
methods.setWrapperHeight(stickyElement);
}), false);
stickyElement.addEventListener("DOMNodeRemoved", (function() {
methods.setWrapperHeight(stickyElement);
}), false);
}
},
update: scroller,
unstick: function(options) {
return this.each((function() {
var that = this;
var unstickyElement = $(that);
var removeIdx = -1;
var i = sticked.length;
while (i-- > 0) {
if (sticked[i].stickyElement.get(0) === that) {
splice.call(sticked, i, 1);
removeIdx = i;
}
}
if (removeIdx !== -1) {
unstickyElement.unwrap();
unstickyElement.css({
width: "",
position: "",
top: "",
float: "",
"z-index": ""
});
}
}));
}
};
if (window.addEventListener) {
window.addEventListener("scroll", scroller, false);
window.addEventListener("resize", resizer, false);
} else if (window.attachEvent) {
window.attachEvent("onscroll", scroller);
window.attachEvent("onresize", resizer);
}
$.fn.sticky = function(method) {
if (methods[method]) {
return methods[method].apply(this, slice.call(arguments, 1));
} else if (typeof method === "object" || !method) {
return methods.init.apply(this, arguments);
} else {
$.error("Method " + method + " does not exist on jQuery.sticky");
}
};
$.fn.unstick = function(method) {
if (methods[method]) {
return methods[method].apply(this, slice.call(arguments, 1));
} else if (typeof method === "object" || !method) {
return methods.unstick.apply(this, arguments);
} else {
$.error("Method " + method + " does not exist on jQuery.sticky");
}
};
$((function() {
setTimeout(scroller, 0);
}));
}));
},
17: module => {
"use strict";
module.exports = jQuery;
}
};
var __webpack_module_cache__ = {};
function __webpack_require__(moduleId) {
var cachedModule = __webpack_module_cache__[moduleId];
if (cachedModule !== undefined) {
return cachedModule.exports;
}
var module = __webpack_module_cache__[moduleId] = {
exports: {}
};
__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
return module.exports;
}
var __webpack_exports__ = {};
(() => {
__webpack_require__(16);
jQuery.extend(jQuery.expr[":"], {
focusable: function focusable(el) {
return jQuery(el).is("a, button, :input, [tabindex]");
}
});
jQuery((function($) {
"use strict";
var Preloader = {
init: function init() {
if ($(".wp-moose-preloader-wrap").length) {
$(document).ready(this.hidePreloader);
if ($("body").hasClass("elementor-editor-active")) {
setTimeout(this.hidePreloader, 300);
}
}
},
hidePreloader: function hidePreloader() {
$(".wp-moose-preloader-wrap > div").fadeOut(600);
$(".wp-moose-preloader-wrap").fadeOut(1500);
}
};
var Toggle = {
init: function init() {
var _this = this;
$('[data-toggle="collapse"]').each((function() {
$(this).on("click", (function() {
_this.collapse($(this));
}));
}));
$('[data-toggle="toggle"]').each((function() {
$(this).on("click", (function() {
_this.toggle($(this));
}));
}));
},
toggle: function toggle(el) {
var $target = $(el.data("toggle-target"));
var $showFocus = $(el.data("toggle-show-focus"));
var $hiddenFocus = $(el.data("toggle-hidden-focus"));
$target.fadeToggle(300).toggleClass("hidden");
if ($target.hasClass("hidden")) {
if ($hiddenFocus && $hiddenFocus.eq(0)) {
$hiddenFocus.eq(0).focus();
}
} else {
if ($showFocus && $showFocus.eq(0)) {
$showFocus.eq(0).focus();
}
}
},
collapse: function collapse(el) {
var _expanded = el.attr("aria-expanded");
var _target = $(el.data("toggle-target"));
_expanded = _expanded !== "false" ? "false" : "true";
_target.attr("aria-expanded", _expanded);
el.attr("aria-expanded", _expanded);
_target.toggle(300, (function() {
$("[data-sticky]").each((function() {
$(this).sticky("update");
}));
}));
}
};
var Sticky = {
init: function init() {
$("[data-sticky]").each((function() {
var spacing = Number($(this).data("sticky"));
var zIndex = Number($(this).data("sticky-z-index"));
var className = $(this).data("sticky-class");
$(this).sticky({
topSpacing: spacing,
className,
zIndex
});
}));
}
};
var ToTop = {
init: function init() {
var $scrollTop = $("#scroll-top");
$(window).on("scroll", (function() {
if ($(this).scrollTop() > 100) {
$scrollTop.fadeIn();
} else {
$scrollTop.fadeOut();
}
}));
$scrollTop.on("click", (function() {
$("html, body").scrollTop(0);
return false;
}));
}
};
var FocusRedirect = {
init: function init() {
$("[data-redirect-focus]").each((function() {
var $this = $(this);
var $focusable = $this.find(":focusable");
var $last = $focusable.last();
var $first = $focusable.first();
var $target = $($this.data("redirect-focus"));
$target.on("keydown", (function(ev) {
if ($this.is(":visible")) {
if (ev.which === 9 && !ev.shiftKey) {
ev.preventDefault();
$first.focus();
}
if (ev.which === 9 && ev.shiftKey) {
ev.preventDefault();
$last.focus();
}
}
}));
$last.on("keydown", (function(ev) {
if (ev.which === 9 && !ev.shiftKey && $target.is(":visible")) {
if ($target.is(":visible")) {
ev.preventDefault();
$target.focus();
}
}
}));
$first.on("keydown", (function(ev) {
if (ev.which === 9 && ev.shiftKey && $target.is(":visible")) {
ev.preventDefault();
$target.focus();
}
}));
}));
}
};
var NoticeDismiss = {
init: function init() {
$(".wp-moose-theme-notice").on("click", ".wp-moose-notice-dismiss", (function() {
var $notice = $(this).parents(".notice.is-dismissible");
var dismiss_url = $notice.attr("data-dismiss-url");
if (dismiss_url) {
$.ajax({
url: dismiss_url,
complete: function complete() {
$notice.hide();
}
});
}
}));
}
};
Preloader.init();
Toggle.init();
Sticky.init();
ToTop.init();
FocusRedirect.init();
NoticeDismiss.init();
}));
})();
})();