OwlCyberSecurity - MANAGER
Edit File: plugins.js
/*! WPZOOM * inspiro-lite - v1.8.5 * Author website: https://wpzoom.com/ * This file is automatically created! Do not edit this file directly! */ /*! * classie v1.0.1 * class helper functions * from bonzo https://github.com/ded/bonzo * MIT license * * classie.has( elem, 'my-class' ) -> true/false * classie.add( elem, 'my-new-class' ) * classie.remove( elem, 'my-unwanted-class' ) * classie.toggle( elem, 'my-class' ) */ /*jshint browser: true, strict: true, undef: true, unused: true */ /*global define: false, module: false */ ( function( window ) { 'use strict'; // class helper functions from bonzo https://github.com/ded/bonzo function classReg( className ) { return new RegExp("(^|\\s+)" + className + "(\\s+|$)"); } // classList support for class management // altho to be fair, the api sucks because it won't accept multiple classes at once var hasClass, addClass, removeClass; if ( 'classList' in document.documentElement ) { hasClass = function( elem, c ) { return elem.classList.contains( c ); }; addClass = function( elem, c ) { elem.classList.add( c ); }; removeClass = function( elem, c ) { elem.classList.remove( c ); }; } else { hasClass = function( elem, c ) { return classReg( c ).test( elem.className ); }; addClass = function( elem, c ) { if ( !hasClass( elem, c ) ) { elem.className = elem.className + ' ' + c; } }; removeClass = function( elem, c ) { elem.className = elem.className.replace( classReg( c ), ' ' ); }; } function toggleClass( elem, c ) { var fn = hasClass( elem, c ) ? removeClass : addClass; fn( elem, c ); } var classie = { // full names hasClass: hasClass, addClass: addClass, removeClass: removeClass, toggleClass: toggleClass, // short names has: hasClass, add: addClass, remove: removeClass, toggle: toggleClass }; // transport if ( typeof define === 'function' && define.amd ) { // AMD define( classie ); } else if ( typeof exports === 'object' ) { // CommonJS module.exports = classie; } else { // browser global window.classie = classie; } })( window ); /*! * headroom.js v0.12.0 - Give your page some headroom. Hide your header until you need it * Copyright (c) 2020 Nick Williams - http://wicky.nillia.ms/headroom.js * License: MIT */ (function(global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : typeof define === 'function' && define.amd ? define(factory) : (global = global || self, global.Headroom = factory()); }(this, function() { 'use strict'; function isBrowser() { return typeof window !== "undefined"; } /** * Used to detect browser support for adding an event listener with options * Credit: https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener */ function passiveEventsSupported() { var supported = false; try { var options = { // eslint-disable-next-line getter-return get passive() { supported = true; } }; window.addEventListener("test", options, options); window.removeEventListener("test", options, options); } catch (err) { supported = false; } return supported; } function isSupported() { return !!( isBrowser() && function() { }.bind && "classList" in document.documentElement && Object.assign && Object.keys && requestAnimationFrame ); } function isDocument(obj) { return obj.nodeType === 9; // Node.DOCUMENT_NODE === 9 } function isWindow(obj) { // `obj === window` or `obj instanceof Window` is not sufficient, // as the obj may be the window of an iframe. return obj && obj.document && isDocument(obj.document); } function windowScroller(win) { var doc = win.document; var body = doc.body; var html = doc.documentElement; return { /** * @see http://james.padolsey.com/javascript/get-document-height-cross-browser/ * @return {Number} the scroll height of the document in pixels */ scrollHeight: function() { return Math.max( body.scrollHeight, html.scrollHeight, body.offsetHeight, html.offsetHeight, body.clientHeight, html.clientHeight ); }, /** * @see http://andylangton.co.uk/blog/development/get-viewport-size-width-and-height-javascript * @return {Number} the height of the viewport in pixels */ height: function() { return win.innerHeight || html.clientHeight || body.clientHeight; }, /** * Gets the Y scroll position * @return {Number} pixels the page has scrolled along the Y-axis */ scrollY: function() { if (win.pageYOffset !== undefined) { return win.pageYOffset; } return (html || body.parentNode || body).scrollTop; } }; } function elementScroller(element) { return { /** * @return {Number} the scroll height of the element in pixels */ scrollHeight: function() { return Math.max( element.scrollHeight, element.offsetHeight, element.clientHeight ); }, /** * @return {Number} the height of the element in pixels */ height: function() { return Math.max(element.offsetHeight, element.clientHeight); }, /** * Gets the Y scroll position * @return {Number} pixels the element has scrolled along the Y-axis */ scrollY: function() { return element.scrollTop; } }; } function createScroller(element) { return isWindow(element) ? windowScroller(element) : elementScroller(element); } /** * @param element EventTarget */ function trackScroll(element, options, callback) { var isPassiveSupported = passiveEventsSupported(); var rafId; var scrolled = false; var scroller = createScroller(element); var lastScrollY = scroller.scrollY(); var details = {}; function update() { var scrollY = Math.round(scroller.scrollY()); var height = scroller.height(); var scrollHeight = scroller.scrollHeight(); // reuse object for less memory churn details.scrollY = scrollY; details.lastScrollY = lastScrollY; details.direction = scrollY > lastScrollY ? "down" : "up"; details.distance = Math.abs(scrollY - lastScrollY); details.isOutOfBounds = scrollY < 0 || scrollY + height > scrollHeight; details.top = scrollY <= options.offset[details.direction]; details.bottom = scrollY + height >= scrollHeight; details.toleranceExceeded = details.distance > options.tolerance[details.direction]; callback(details); lastScrollY = scrollY; scrolled = false; } function handleScroll() { if (!scrolled) { scrolled = true; rafId = requestAnimationFrame(update); } } var eventOptions = isPassiveSupported ? { passive: true, capture: false } : false; element.addEventListener("scroll", handleScroll, eventOptions); update(); return { destroy: function() { cancelAnimationFrame(rafId); element.removeEventListener("scroll", handleScroll, eventOptions); } }; } function normalizeUpDown(t) { return t === Object(t) ? t : { down: t, up: t }; } /** * UI enhancement for fixed headers. * Hides header when scrolling down * Shows header when scrolling up * @constructor * @param {DOMElement} elem the header element * @param {Object} options options for the widget */ function Headroom(elem, options) { options = options || {}; Object.assign(this, Headroom.options, options); this.classes = Object.assign({}, Headroom.options.classes, options.classes); this.elem = elem; this.tolerance = normalizeUpDown(this.tolerance); this.offset = normalizeUpDown(this.offset); this.initialised = false; this.frozen = false; } Headroom.prototype = { constructor: Headroom, /** * Start listening to scrolling * @public */ init: function() { if (Headroom.cutsTheMustard && !this.initialised) { this.addClass("initial"); this.initialised = true; // defer event registration to handle browser // potentially restoring previous scroll position setTimeout( function(self) { self.scrollTracker = trackScroll( self.scroller, { offset: self.offset, tolerance: self.tolerance }, self.update.bind(self) ); }, 100, this ); } return this; }, /** * Destroy the widget, clearing up after itself * @public */ destroy: function() { this.initialised = false; Object.keys(this.classes).forEach(this.removeClass, this); this.scrollTracker.destroy(); }, /** * Unpin the element * @public */ unpin: function() { if (this.hasClass("pinned") || !this.hasClass("unpinned")) { this.addClass("unpinned"); this.removeClass("pinned"); if (this.onUnpin) { this.onUnpin.call(this); } } }, /** * Pin the element * @public */ pin: function() { if (this.hasClass("unpinned")) { this.addClass("pinned"); this.removeClass("unpinned"); if (this.onPin) { this.onPin.call(this); } } }, /** * Freezes the current state of the widget * @public */ freeze: function() { this.frozen = true; this.addClass("frozen"); }, /** * Re-enables the default behaviour of the widget * @public */ unfreeze: function() { this.frozen = false; this.removeClass("frozen"); }, top: function() { if (!this.hasClass("top")) { this.addClass("top"); this.removeClass("notTop"); if (this.onTop) { this.onTop.call(this); } } }, notTop: function() { if (!this.hasClass("notTop")) { this.addClass("notTop"); this.removeClass("top"); if (this.onNotTop) { this.onNotTop.call(this); } } }, bottom: function() { if (!this.hasClass("bottom")) { this.addClass("bottom"); this.removeClass("notBottom"); if (this.onBottom) { this.onBottom.call(this); } } }, notBottom: function() { if (!this.hasClass("notBottom")) { this.addClass("notBottom"); this.removeClass("bottom"); if (this.onNotBottom) { this.onNotBottom.call(this); } } }, shouldUnpin: function(details) { var scrollingDown = details.direction === "down"; return scrollingDown && !details.top && details.toleranceExceeded; }, shouldPin: function(details) { var scrollingUp = details.direction === "up"; return (scrollingUp && details.toleranceExceeded) || details.top; }, addClass: function(className) { this.elem.classList.add.apply( this.elem.classList, this.classes[className].split(" ") ); }, removeClass: function(className) { this.elem.classList.remove.apply( this.elem.classList, this.classes[className].split(" ") ); }, hasClass: function(className) { return this.classes[className].split(" ").every(function(cls) { return this.classList.contains(cls); }, this.elem); }, update: function(details) { if (details.isOutOfBounds) { // Ignore bouncy scrolling in OSX return; } if (this.frozen === true) { return; } if (details.top) { this.top(); } else { this.notTop(); } if (details.bottom) { this.bottom(); } else { this.notBottom(); } if (this.shouldUnpin(details)) { this.unpin(); } else if (this.shouldPin(details)) { this.pin(); } } }; /** * Default options * @type {Object} */ Headroom.options = { tolerance: { up: 0, down: 0 }, offset: 0, scroller: isBrowser() ? window : null, classes: { frozen: "headroom--frozen", pinned: "headroom--pinned", unpinned: "headroom--unpinned", top: "headroom--top", notTop: "headroom--not-top", bottom: "headroom--bottom", notBottom: "headroom--not-bottom", initial: "headroom" } }; Headroom.cutsTheMustard = isSupported(); return Headroom; })); (function($) { if(!$) { return; } //////////// // Plugin // //////////// $.fn.headroom = function(option) { return this.each(function() { var $this = $(this), data = $this.data('headroom'), options = typeof option === 'object' && option; options = $.extend(true, {}, Headroom.options, options); if (!data) { data = new Headroom(this, options); data.init(); $this.data('headroom', data); } if (typeof option === 'string') { data[option](); if(option === 'destroy'){ $this.removeData('headroom'); } } }); }; ////////////// // Data API // ////////////// $('[data-headroom]').each(function() { var $this = $(this); $this.headroom($this.data()); }); }(window.Zepto || window.jQuery)); /*! * jQuery.scrollTo * Copyright (c) 2007 Ariel Flesler - aflesler ○ gmail • com | https://github.com/flesler * Licensed under MIT * https://github.com/flesler/jquery.scrollTo * @projectDescription Lightweight, cross-browser and highly customizable animated scrolling with jQuery * @author Ariel Flesler * @version 2.1.3 */ ; (function(factory) { 'use strict'; if (typeof define === 'function' && define.amd) { // AMD define(['jquery'], factory); } else if (typeof module !== 'undefined' && module.exports) { // CommonJS module.exports = factory(require('jquery')); } else { // Global factory(jQuery); } })(function($) { 'use strict'; var $scrollTo = $.scrollTo = function(target, duration, settings) { return $(window).scrollTo(target, duration, settings); }; $scrollTo.defaults = { axis: 'xy', duration: 0, limit: true }; function isWin(elem) { return !elem.nodeName || $.inArray(elem.nodeName.toLowerCase(), ['iframe', '#document', 'html', 'body']) !== -1; } function isFunction(obj) { // Brought from jQuery since it's deprecated return typeof obj === 'function' } $.fn.scrollTo = function(target, duration, settings) { if (typeof duration === 'object') { settings = duration; duration = 0; } if (typeof settings === 'function') { settings = { onAfter: settings }; } if (target === 'max') { target = 9e9; } settings = $.extend({}, $scrollTo.defaults, settings); // Speed is still recognized for backwards compatibility duration = duration || settings.duration; // Make sure the settings are given right var queue = settings.queue && settings.axis.length > 1; if (queue) { // Let's keep the overall duration duration /= 2; } settings.offset = both(settings.offset); settings.over = both(settings.over); return this.each(function() { // Null target yields nothing, just like jQuery does if (target === null) return; var win = isWin(this), elem = win ? this.contentWindow || window : this, $elem = $(elem), targ = target, attr = {}, toff; switch (typeof targ) { // A number will pass the regex case 'number': case 'string': if (/^([+-]=?)?\d+(\.\d+)?(px|%)?$/.test(targ)) { targ = both(targ); // We are done break; } // Relative/Absolute selector targ = win ? $(targ) : $(targ, elem); /* falls through */ case 'object': if (targ.length === 0) return; // DOMElement / jQuery if (targ.is || targ.style) { // Get the real position of the target toff = (targ = $(targ)).offset(); } } var offset = isFunction(settings.offset) && settings.offset(elem, targ) || settings.offset; $.each(settings.axis.split(''), function(i, axis) { var Pos = axis === 'x' ? 'Left' : 'Top', pos = Pos.toLowerCase(), key = 'scroll' + Pos, prev = $elem[key](), max = $scrollTo.max(elem, axis); if (toff) {// jQuery / DOMElement attr[key] = toff[pos] + (win ? 0 : prev - $elem.offset()[pos]); // If it's a dom element, reduce the margin if (settings.margin) { attr[key] -= parseInt(targ.css('margin' + Pos), 10) || 0; attr[key] -= parseInt(targ.css('border' + Pos + 'Width'), 10) || 0; } attr[key] += offset[pos] || 0; if (settings.over[pos]) { // Scroll to a fraction of its width/height attr[key] += targ[axis === 'x' ? 'width' : 'height']() * settings.over[pos]; } } else { var val = targ[pos]; // Handle percentage values attr[key] = val.slice && val.slice(-1) === '%' ? parseFloat(val) / 100 * max : val; } // Number or 'number' if (settings.limit && /^\d+$/.test(attr[key])) { // Check the limits attr[key] = attr[key] <= 0 ? 0 : Math.min(attr[key], max); } // Don't waste time animating, if there's no need. if (!i && settings.axis.length > 1) { if (prev === attr[key]) { // No animation needed attr = {}; } else if (queue) { // Intermediate animation animate(settings.onAfterFirst); // Don't animate this axis again in the next iteration. attr = {}; } } }); animate(settings.onAfter); function animate(callback) { var opts = $.extend({}, settings, { // The queue setting conflicts with animate() // Force it to always be true queue: true, duration: duration, complete: callback && function() { callback.call(elem, targ, settings); } }); $elem.animate(attr, opts); } }); }; // Max scrolling position, works on quirks mode // It only fails (not too badly) on IE, quirks mode. $scrollTo.max = function(elem, axis) { var Dim = axis === 'x' ? 'Width' : 'Height', scroll = 'scroll' + Dim; if (!isWin(elem)) return elem[scroll] - $(elem)[Dim.toLowerCase()](); var size = 'client' + Dim, doc = elem.ownerDocument || elem.document, html = doc.documentElement, body = doc.body; return Math.max(html[scroll], body[scroll]) - Math.min(html[size], body[size]); }; function both(val) { return isFunction(val) || $.isPlainObject(val) ? val : { top: val, left: val }; } // Add special hooks so that window scroll properties can be animated $.Tween.propHooks.scrollLeft = $.Tween.propHooks.scrollTop = { get: function(t) { return $(t.elem)[t.prop](); }, set: function(t) { var curr = this.get(t); // If interrupt is true and user scrolled, stop animating if (t.options.interrupt && t._last && t._last !== curr) { return $(t.elem).stop(); } var next = Math.round(t.now); // Don't waste CPU // Browsers don't render floating point scroll if (curr !== next) { $(t.elem)[t.prop](next); t._last = this.get(t); } } }; // AMD requirement return $scrollTo; }); /* * jQuery Superfish Menu Plugin * Copyright (c) 2013 Joel Birch * * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html */ (function ($, w) { "use strict"; var methods = (function () { // private properties and methods go here var c = { bcClass: 'sf-breadcrumb', menuClass: 'sf-js-enabled', anchorClass: 'sf-with-ul', menuArrowClass: 'sf-arrows' }, ios = (function () { var ios = /^(?![\w\W]*Windows Phone)[\w\W]*(iPhone|iPad|iPod)/i.test(navigator.userAgent); if (ios) { // tap anywhere on iOS to unfocus a submenu $('html').css('cursor', 'pointer').on('click', $.noop); } return ios; })(), wp7 = (function () { var style = document.documentElement.style; return ('behavior' in style && 'fill' in style && /iemobile/i.test(navigator.userAgent)); })(), unprefixedPointerEvents = (function () { return (!!w.PointerEvent); })(), toggleMenuClasses = function ($menu, o, add) { var classes = c.menuClass, method; if (o.cssArrows) { classes += ' ' + c.menuArrowClass; } method = (add) ? 'addClass' : 'removeClass'; $menu[method](classes); }, setPathToCurrent = function ($menu, o) { return $menu.find('li.' + o.pathClass).slice(0, o.pathLevels) .addClass(o.hoverClass + ' ' + c.bcClass) .filter(function () { return ($(this).children(o.popUpSelector).hide().show().length); }).removeClass(o.pathClass); }, toggleAnchorClass = function ($li, add) { var method = (add) ? 'addClass' : 'removeClass'; $li.children('a')[method](c.anchorClass); }, toggleTouchAction = function ($menu) { var msTouchAction = $menu.css('ms-touch-action'); var touchAction = $menu.css('touch-action'); touchAction = touchAction || msTouchAction; touchAction = (touchAction === 'pan-y') ? 'auto' : 'pan-y'; $menu.css({ 'ms-touch-action': touchAction, 'touch-action': touchAction }); }, getMenu = function ($el) { return $el.closest('.' + c.menuClass); }, getOptions = function ($el) { return getMenu($el).data('sfOptions'); }, over = function () { var $this = $(this), o = getOptions($this); clearTimeout(o.sfTimer); $this.siblings().superfish('hide').end().superfish('show'); }, close = function (o) { o.retainPath = ($.inArray(this[0], o.$path) > -1); this.superfish('hide'); if (!this.parents('.' + o.hoverClass).length) { o.onIdle.call(getMenu(this)); if (o.$path.length) { $.proxy(over, o.$path)(); } } }, out = function () { var $this = $(this), o = getOptions($this); if (ios) { $.proxy(close, $this, o)(); } else { clearTimeout(o.sfTimer); o.sfTimer = setTimeout($.proxy(close, $this, o), o.delay); } }, touchHandler = function (e) { var $this = $(this), o = getOptions($this), $ul = $this.siblings(e.data.popUpSelector); if (o.onHandleTouch.call($ul) === false) { return this; } if ($ul.length > 0 && $ul.is(':hidden')) { $this.one('click.superfish', false); if (e.type === 'MSPointerDown' || e.type === 'pointerdown') { $this.trigger('focus'); } else { $.proxy(over, $this.parent('li'))(); } } }, applyHandlers = function ($menu, o) { var targets = 'li:has(' + o.popUpSelector + ')'; if ($.fn.hoverIntent && !o.disableHI) { $menu.hoverIntent(over, out, targets); } else { $menu .on('mouseenter.superfish', targets, over) .on('mouseleave.superfish', targets, out); } var touchevent = 'MSPointerDown.superfish'; if (unprefixedPointerEvents) { touchevent = 'pointerdown.superfish'; } if (!ios) { touchevent += ' touchend.superfish'; } if (wp7) { touchevent += ' mousedown.superfish'; } $menu .on('focusin.superfish', 'li', over) .on('focusout.superfish', 'li', out) .on(touchevent, 'a', o, touchHandler); }; return { // public methods hide: function (instant) { if (this.length) { var $this = this, o = getOptions($this); if (!o) { return this; } var not = (o.retainPath === true) ? o.$path : '', $ul = $this.find('li.' + o.hoverClass).add(this).not(not).removeClass(o.hoverClass).children(o.popUpSelector), speed = o.speedOut; if (instant) { $ul.show(); speed = 0; } o.retainPath = false; if (o.onBeforeHide.call($ul) === false) { return this; } $ul.stop(true, true).animate(o.animationOut, speed, function () { var $this = $(this); o.onHide.call($this); }); } return this; }, show: function () { var o = getOptions(this); if (!o) { return this; } var $this = this.addClass(o.hoverClass), $ul = $this.children(o.popUpSelector); if (o.onBeforeShow.call($ul) === false) { return this; } $ul.stop(true, true).animate(o.animation, o.speed, function () { o.onShow.call($ul); }); return this; }, destroy: function () { return this.each(function () { var $this = $(this), o = $this.data('sfOptions'), $hasPopUp; if (!o) { return false; } $hasPopUp = $this.find(o.popUpSelector).parent('li'); clearTimeout(o.sfTimer); toggleMenuClasses($this, o); toggleAnchorClass($hasPopUp); toggleTouchAction($this); // remove event handlers $this.off('.superfish').off('.hoverIntent'); // clear animation's inline display style $hasPopUp.children(o.popUpSelector).attr('style', function (i, style) { if (typeof style !== 'undefined') { return style.replace(/display[^;]+;?/g, ''); } }); // reset 'current' path classes o.$path.removeClass(o.hoverClass + ' ' + c.bcClass).addClass(o.pathClass); $this.find('.' + o.hoverClass).removeClass(o.hoverClass); o.onDestroy.call($this); $this.removeData('sfOptions'); }); }, init: function (op) { return this.each(function () { var $this = $(this); if ($this.data('sfOptions')) { return false; } var o = $.extend({}, $.fn.superfish.defaults, op), $hasPopUp = $this.find(o.popUpSelector).parent('li'); o.$path = setPathToCurrent($this, o); $this.data('sfOptions', o); toggleMenuClasses($this, o, true); toggleAnchorClass($hasPopUp, true); toggleTouchAction($this); applyHandlers($this, o); $hasPopUp.not('.' + c.bcClass).superfish('hide', true); o.onInit.call(this); }); } }; })(); $.fn.superfish = function (method, args) { if (methods[method]) { return methods[method].apply(this, Array.prototype.slice.call(arguments, 1)); } else if (typeof method === 'object' || ! method) { return methods.init.apply(this, arguments); } else { return $.error('Method ' + method + ' does not exist on jQuery.fn.superfish'); } }; $.fn.superfish.defaults = { popUpSelector: 'ul,.sf-mega', // within menu context hoverClass: 'sfHover', pathClass: 'overrideThisToUse', pathLevels: 1, delay: 800, animation: {opacity: 'show'}, animationOut: {opacity: 'hide'}, speed: 'normal', speedOut: 'fast', cssArrows: true, disableHI: false, onInit: $.noop, onBeforeShow: $.noop, onShow: $.noop, onBeforeHide: $.noop, onHide: $.noop, onIdle: $.noop, onDestroy: $.noop, onHandleTouch: $.noop }; })(jQuery, window); /** * uisearch.js v1.0.0 * http://www.codrops.com * * Licensed under the MIT license. * http://www.opensource.org/licenses/mit-license.php * * Copyright 2013, Codrops * http://www.codrops.com */ ;( function( window ) { 'use strict'; // EventListener | @jon_neal | //github.com/jonathantneal/EventListener !window.addEventListener && window.Element && (function () { function addToPrototype(name, method) { Window.prototype[name] = HTMLDocument.prototype[name] = Element.prototype[name] = method; } var registry = []; addToPrototype("addEventListener", function (type, listener) { var target = this; registry.unshift({ __listener: function (event) { event.currentTarget = target; event.pageX = event.clientX + document.documentElement.scrollLeft; event.pageY = event.clientY + document.documentElement.scrollTop; event.preventDefault = function () { event.returnValue = false }; event.relatedTarget = event.fromElement || null; event.stopPropagation = function () { event.cancelBubble = true }; event.relatedTarget = event.fromElement || null; event.target = event.srcElement || target; event.timeStamp = +new Date; listener.call(target, event); }, listener: listener, target: target, type: type }); this.attachEvent("on" + type, registry[0].__listener); }); addToPrototype("removeEventListener", function (type, listener) { for (var index = 0, length = registry.length; index < length; ++index) { if (registry[index].target == this && registry[index].type == type && registry[index].listener == listener) { return this.detachEvent("on" + type, registry.splice(index, 1)[0].__listener); } } }); addToPrototype("dispatchEvent", function (eventObject) { try { return this.fireEvent("on" + eventObject.type, eventObject); } catch (error) { for (var index = 0, length = registry.length; index < length; ++index) { if (registry[index].target == this && registry[index].type == eventObject.type) { registry[index].call(this, eventObject); } } } }); })(); // http://stackoverflow.com/a/11381730/989439 function mobilecheck() { var check = false; (function(a){if(/(android|ipad|playbook|silk|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0,4)))check = true})(navigator.userAgent||navigator.vendor||window.opera); return check; } // http://www.jonathantneal.com/blog/polyfills-and-prototypes/ !String.prototype.trim && (String.prototype.trim = function() { return this.replace(/^\s+|\s+$/g, ''); }); function UISearch( el, options ) { this.el = el; this.inputEl = el.querySelector( 'form input.sb-search-input' ); this.inputSubmit = el.querySelector('form > input.sb-search-submit'); this._initEvents(); } UISearch.prototype = { _initEvents : function() { var self = this, onEnterStop = false, initSearchFn = function( ev ) { ev.stopPropagation(); // trim its value self.inputEl.value = self.inputEl.value.trim(); if( !classie.has( self.el, 'sb-search-open' ) ) { // open it ev.preventDefault(); self.open(); } else if( classie.has( self.el, 'sb-search-open' ) ) { // close it ev.preventDefault(); self.close(); } }, initSearchFnPassive = function (ev) { self.inputEl.value = self.inputEl.value.trim(); if (!classie.has(self.el, 'sb-search-open')) { // open it self.open(); } else if (classie.has(self.el, 'sb-search-open' ) ) { // close it self.close(); } } this.el.addEventListener( 'click', initSearchFn ); this.el.addEventListener( 'touchstart', initSearchFnPassive, {passive: true} ); this.inputEl.addEventListener( 'click', function( ev ) { ev.stopPropagation(); }); this.inputEl.addEventListener('keypress' , function(e) { if(e.which == 13) { var form = self.el.querySelector('form'); onEnterStop = true; form.submit(); } }); if (this.inputSubmit) { this.inputSubmit.addEventListener('click', function (ev) { ev.preventDefault(); ev.stopPropagation(); if (!onEnterStop) { self.close(); } }); } this.inputEl.addEventListener( 'touchstart', function( ev ) { ev.stopPropagation(); }, {passive: true} ); }, open : function() { var self = this; classie.add( this.el, 'sb-search-open' ); // focus the input this.inputEl.focus(); // close the search input if body is clicked var bodyFn = function( ev ) { if (classie.has(self.el, 'sb-search-open')) { // close it ev.preventDefault(); self.close(); } else if (classie.has(self.el, 'sb-search-open')) { ev.preventDefault(); self.close(); } this.removeEventListener( 'click', bodyFn ); this.removeEventListener( 'touchstart', bodyFn ); }; document.addEventListener( 'click', bodyFn ); document.addEventListener( 'touchstart', bodyFn ); }, close : function() { this.inputEl.blur(); classie.remove( this.el, 'sb-search-open' ); classie.add(this.el, 'sb-search-closed'); } } // add to global namespace window.UISearch = UISearch; } )( window );