").addClass("strp-close-icon")))
+ ))
);
Pages.initialize(this._pages);
// support classes
- if (Support.mobileTouch) this.element.addClass('strp-mobile-touch');
- if (!Support.svg) this.element.addClass('strp-no-svg');
-
+ if (Support.mobileTouch) this.element.addClass("strp-mobile-touch");
+ if (!Support.svg) this.element.addClass("strp-no-svg");
// events
- this._close.on('click', $.proxy(function(event) {
- event.preventDefault();
- this.hide();
- }, this));
+ this._close.on(
+ "click",
+ function (event) {
+ event.preventDefault();
+ this.hide();
+ }.bind(this)
+ );
- this._previous.on('click', $.proxy(function(event) {
- this.previous();
- this._onMouseMove(event); // update cursor
- }, this));
+ this._previous.on(
+ "click",
+ function (event) {
+ this.previous();
+ this._onMouseMove(event); // update cursor
+ }.bind(this)
+ );
- this._next.on('click', $.proxy(function(event) {
- this.next();
- this._onMouseMove(event); // update cursor
- }, this));
+ this._next.on(
+ "click",
+ function (event) {
+ this.next();
+ this._onMouseMove(event); // update cursor
+ }.bind(this)
+ );
this.hideUI(null, 0); // start with hidden <>
},
- setSkin: function(skin) {
+ setSkin: function (skin) {
if (this._skin) {
- this.element.removeClass('strp-window-skin-' + this._skin);
+ this.element.removeClass("strp-window-skin-" + this._skin);
}
- this.element.addClass('strp-window-skin-' + skin);
+ this.element.addClass("strp-window-skin-" + skin);
this._skin = skin;
},
- setSpinnerSkin: function(skin) {
+ setSpinnerSkin: function (skin) {
if (!this.spinnerMove) return;
if (this._spinnerSkin) {
- this.spinnerMove.removeClass('strp-spinner-move-skin-' + this._spinnerSkin);
+ this.spinnerMove.removeClass(
+ "strp-spinner-move-skin-" + this._spinnerSkin
+ );
}
- this.spinnerMove.addClass('strp-spinner-move-skin-' + skin);
+ this.spinnerMove.addClass("strp-spinner-move-skin-" + skin);
// refresh in case of styling updates
this._spinner.refresh();
this._spinnerSkin = skin;
},
-
// Resize
- startObservingResize: function() {
+ startObservingResize: function () {
if (this._isObservingResize) return;
- this._onWindowResizeHandler = $.proxy(this._onWindowResize, this);
- $(window).on('resize orientationchange', this._onWindowResizeHandler);
+ this._onWindowResizeHandler = this._onWindowResize.bind(this);
+ $(window).on("resize orientationchange", this._onWindowResizeHandler);
this._isObservingResize = true;
},
- stopObservingResize: function() {
+ stopObservingResize: function () {
if (this._onWindowResizeHandler) {
- $(window).off('resize orientationchange', this._onWindowResizeHandler);
+ $(window).off("resize orientationchange", this._onWindowResizeHandler);
this._onWindowResizeHandler = null;
}
this._isObservingResize = false;
},
- _onWindowResize: function() {
+ _onWindowResize: function () {
var page;
if (!(page = Pages.page)) return;
@@ -1953,56 +2184,53 @@ var Window = {
}
},
- resize: function(wh, callback, alternateDuration) {
+ resize: function (wh, callback, alternateDuration) {
var orientation = this.getOrientation(),
- Z = orientation == 'vertical' ? 'Height' : 'Width',
- z = Z.toLowerCase();
+ Z = orientation === "vertical" ? "Height" : "Width",
+ z = Z.toLowerCase();
if (wh > 0) {
this.visible = true;
this.startObservingResize();
}
- var fromZ = Window.element['outer' + Z](),
- duration;
+ var fromZ = Window.element["outer" + Z](),
+ duration;
// if we're opening use the show duration
- if (fromZ == 0) {
+ if (fromZ === 0) {
duration = this.view.options.effects.window.show;
// add opening class
- this.element.addClass('strp-opening');
+ this.element.addClass("strp-opening");
this.opening = true;
- } else if ($.type(alternateDuration) == 'number') {
+ } else if (typeof alternateDuration === "number") {
// alternate when set
- duration = alternateDuration;
+ duration = alternateDuration;
} else {
// otherwise decide on a duration for the transition
// based on distance
var transition = this.view.options.effects.transition,
- min = transition.min,
- max = transition.max,
- tdiff = max - min,
-
- viewport = Bounds.viewport(),
-
- distance = Math.abs(fromZ - wh),
- percentage = Math.min(1, distance / viewport[z]);
+ min = transition.min,
+ max = transition.max,
+ tdiff = max - min,
+ viewport = Bounds.viewport(),
+ distance = Math.abs(fromZ - wh),
+ percentage = Math.min(1, distance / viewport[z]);
- duration = Math.round(min + (percentage * tdiff));
+ duration = Math.round(min + percentage * tdiff);
}
-
- if (wh == 0) {
+ if (wh === 0) {
this.closing = true;
// we only add the closing class if we're not currently animating the window
- if (!this.element.is(':animated')) {
- this.element.addClass('strp-closing');
+ if (!this.element.is(":animated")) {
+ this.element.addClass("strp-closing");
}
}
// the animations
- var css = { overflow: 'visible' };
+ var css = { overflow: "visible" };
css[z] = wh;
var fx = 1;
@@ -2014,37 +2242,49 @@ var Window = {
this._offsetLeft = null;
var onResize = this.view.options.onResize,
- hasOnResize = $.type(onResize) == 'function';
-
- this.element.stop(true).animate(css, $.extend({
- duration: duration,
- complete: $.proxy(function() {
- if (--fx < 1) this._afterResize(callback);
- }, this)
- }, !hasOnResize ? {} : {
- // we only add step if there's an onResize callback
- step: $.proxy(function(now, fx) {
- if (fx.prop == z) {
- onResize.call(Strip, fx.prop, now, this.side);
- }
- }, this)
- }));
+ hasOnResize = typeof onResize === "function";
+
+ this.element.stop(true).animate(
+ css,
+ $.extend(
+ {
+ duration: duration,
+ complete: function () {
+ if (--fx < 1) this._afterResize(callback);
+ }.bind(this),
+ },
+ !hasOnResize
+ ? {}
+ : {
+ // we only add step if there's an onResize callback
+ step: function (now, fx) {
+ if (fx.prop === z) {
+ onResize.call(Strip, fx.prop, now, this.side);
+ }
+ }.bind(this),
+ }
+ )
+ );
if (this.spinnerMove) {
fx++; // sync this effect
- this.spinnerMove.stop(true).animate(css, duration, $.proxy(function() {
- if (--fx < 1) this._afterResize(callback);
- }, this));
+ this.spinnerMove.stop(true).animate(
+ css,
+ duration,
+ function () {
+ if (--fx < 1) this._afterResize(callback);
+ }.bind(this)
+ );
}
// return the duration for later use in synced animations
return duration;
},
- _afterResize: function(callback) {
+ _afterResize: function (callback) {
this.opening = false;
this.closing = false;
- this.element.removeClass('strp-opening strp-closing');
+ this.element.removeClass("strp-opening strp-closing");
// cache outerWidth and offsetLeft for _getEventSide on mousemove
this._outerWidth = this.element.outerWidth();
@@ -2053,19 +2293,18 @@ var Window = {
if (callback) callback();
},
-
- adjustPrevNext: function(callback, alternateDuration) {
+ adjustPrevNext: function (callback, alternateDuration) {
if (!this.view || !Pages.page) return;
var page = Pages.page;
// offset <>
- var windowVisible = this.element.is(':visible');
+ var windowVisible = this.element.is(":visible");
if (!windowVisible) this.element.show();
- var pRestoreStyle = this._previous.attr('style');
+ var pRestoreStyle = this._previous.attr("style");
//this._previous.attr({ style: '' });
- this._previous.removeAttr('style');
- var pnMarginTop = parseInt(this._previous.css('margin-top')); // the original margin top
+ this._previous.removeAttr("style");
+ var pnMarginTop = parseInt(this._previous.css("margin-top")); // the original margin top
this._previous.attr({ style: pRestoreStyle });
if (!windowVisible) this.element.hide();
@@ -2073,28 +2312,27 @@ var Window = {
var iH = page.info ? page.info.outerHeight() : 0;
var buttons = this._previous.add(this._next),
- css = { 'margin-top': pnMarginTop - iH * .5 };
+ css = { "margin-top": pnMarginTop - iH * 0.5 };
var duration = this.view.options.effects.transition.min;
- if ($.type(alternateDuration) == 'number') duration = alternateDuration;
+ if (typeof alternateDuration === "number") duration = alternateDuration;
// adjust <> instantly when opening
if (this.opening) duration = 0;
buttons.stop(true).animate(css, duration, callback);
- this._previous[this.mayPrevious() ? 'show' : 'hide']();
- this._next[this.mayNext() ? 'show' : 'hide']();
+ this._previous[this.mayPrevious() ? "show" : "hide"]();
+ this._next[this.mayNext() ? "show" : "hide"]();
},
- resetPrevNext: function() {
+ resetPrevNext: function () {
var buttons = this._previous.add(this._next);
- buttons.stop(true).removeAttr('style');
+ buttons.stop(true).removeAttr("style");
},
-
// Load
- load: function(views, position) {
+ load: function (views, position) {
this.views = views;
Pages.add(views);
@@ -2106,8 +2344,8 @@ var Window = {
// adjust the size based on the current view
// this might require closing the window first
- setSide: function(side, callback) {
- if (this.side == side) {
+ setSide: function (side, callback) {
+ if (this.side === side) {
if (callback) callback();
return;
}
@@ -2125,16 +2363,18 @@ var Window = {
this.unbindUI();
// hide
- this.resize(0, $.proxy(function() {
-
- // some of the things we'd normally do in hide
- this._safeResetsAfterSwitchSide();
+ this.resize(
+ 0,
+ function () {
+ // some of the things we'd normally do in hide
+ this._safeResetsAfterSwitchSide();
- // we instantly hide the other views here
- Pages.hideVisibleInactive(0);
+ // we instantly hide the other views here
+ Pages.hideVisibleInactive(0);
- this._setSide(side, callback);
- }, this));
+ this._setSide(side, callback);
+ }.bind(this)
+ );
// show the UI on the next resize
this._showUIOnResize = true;
@@ -2143,7 +2383,7 @@ var Window = {
}
},
- _setSide: function(side, callback) {
+ _setSide: function (side, callback) {
this.side = side;
var orientation = this.getOrientation();
@@ -2151,42 +2391,48 @@ var Window = {
var elements = this.element;
if (this.spinnerMove) elements = elements.add(this.spinnerMove);
- elements.removeClass('strp-horizontal strp-vertical')
- .addClass('strp-' + orientation);
+ elements
+ .removeClass("strp-horizontal strp-vertical")
+ .addClass("strp-" + orientation);
- var ss = 'strp-side-';
- elements.removeClass(ss + 'top ' + ss + 'right ' + ss + 'bottom ' + ss + 'left')
- .addClass(ss + side);
+ var ss = "strp-side-";
+ elements
+ .removeClass(ss + "top " + ss + "right " + ss + "bottom " + ss + "left")
+ .addClass(ss + side);
if (callback) callback();
},
- getOrientation: function(side) {
- return (this.side == 'left' || this.side == 'right') ? 'horizontal' : 'vertical';
+ getOrientation: function (side) {
+ return this.side === "left" || this.side === "right"
+ ? "horizontal"
+ : "vertical";
},
// loading indicator
- startLoading: function() {
+ startLoading: function () {
if (!this._spinner) return;
this.spinnerMove.show();
this._spinner.show();
},
- stopLoading: function() {
+ stopLoading: function () {
if (!this._spinner) return;
// we only stop loading if there are no loading pages anymore
var loadingCount = Pages.getLoadingCount();
if (loadingCount < 1) {
- this._spinner.hide($.proxy(function() {
- this.spinnerMove.hide();
- }, this));
+ this._spinner.hide(
+ function () {
+ this.spinnerMove.hide();
+ }.bind(this)
+ );
}
},
- setPosition: function(position, callback) {
+ setPosition: function (position, callback) {
this._position = position;
// store the current view
@@ -2198,102 +2444,115 @@ var Window = {
this.stopHideQueue();
// store the page and show it
- this.page = Pages.show(position, $.proxy(function() {
- var afterPosition = this.view.options.afterPosition;
- if ($.type(afterPosition) == 'function') {
- afterPosition.call(Strip, position);
- }
- if (callback) callback();
- }, this));
+ this.page = Pages.show(
+ position,
+ function () {
+ var afterPosition = this.view.options.afterPosition;
+ if (typeof afterPosition === "function") {
+ afterPosition.call(Strip, position);
+ }
+ if (callback) callback();
+ }.bind(this)
+ );
},
- hide: function(callback) {
+ hide: function (callback) {
if (!this.view) return;
var hideQueue = this.queues.hide;
hideQueue.queue([]); // clear queue
- hideQueue.queue($.proxy(function(next_stop) {
- Pages.stop();
- next_stop();
- }, this));
+ hideQueue.queue(
+ function (next_stop) {
+ Pages.stop();
+ next_stop();
+ }.bind(this)
+ );
- hideQueue.queue($.proxy(function(next_unbinds) {
- // ui
- var duration = this.view ? this.view.options.effects.window.hide : 0;
- this.unbindUI();
- this.hideUI(null, duration);
+ hideQueue.queue(
+ function (next_unbinds) {
+ // ui
+ var duration = this.view ? this.view.options.effects.window.hide : 0;
+ this.unbindUI();
+ this.hideUI(null, duration);
- // close on click outside
- this.unbindHideOnClickOutside();
+ // close on click outside
+ this.unbindHideOnClickOutside();
- // keyboard
- Keyboard.disable();
+ // keyboard
+ Keyboard.disable();
- next_unbinds();
- }, this));
+ next_unbinds();
+ }.bind(this)
+ );
- hideQueue.queue($.proxy(function(next_zero) {
- // active classes should removed right as the closing effect starts
- // because clicking an element as it closes will re-open it,
- // that needs to be reflected in the class
- Pages.removeActiveClasses();
+ hideQueue.queue(
+ function (next_zero) {
+ // active classes should removed right as the closing effect starts
+ // because clicking an element as it closes will re-open it,
+ // that needs to be reflected in the class
+ Pages.removeActiveClasses();
- this.resize(0, next_zero, this.view.options.effects.window.hide);
+ this.resize(0, next_zero, this.view.options.effects.window.hide);
- // after we initiate the hide resize, the next resize should bring up the UI again
- this._showUIOnResize = true;
- }, this));
+ // after we initiate the hide resize, the next resize should bring up the UI again
+ this._showUIOnResize = true;
+ }.bind(this)
+ );
// callbacks after resize in a separate queue
// so we can stop the hideQueue without stopping the resize
- hideQueue.queue($.proxy(function(next_after_resize) {
- this._safeResetsAfterSwitchSide();
+ hideQueue.queue(
+ function (next_after_resize) {
+ this._safeResetsAfterSwitchSide();
- this.stopObservingResize();
+ this.stopObservingResize();
- Pages.removeAll();
+ Pages.removeAll();
- this.timers.clear();
+ this.timers.clear();
- this._position = -1;
+ this._position = -1;
- // afterHide callback
- var afterHide = this.view && this.view.options.afterHide;
- if ($.type(afterHide) == 'function') {
- afterHide.call(Strip);
- }
+ // afterHide callback
+ var afterHide = this.view && this.view.options.afterHide;
+ if (typeof afterHide === "function") {
+ afterHide.call(Strip);
+ }
- this.view = null;
+ this.view = null;
- next_after_resize();
- }, this));
+ next_after_resize();
+ }.bind(this)
+ );
- if ($.type(callback) == 'function') {
- hideQueue.queue($.proxy(function(next_callback) {
- callback();
- next_callback();
- }, this));
+ if (typeof callback === "function") {
+ hideQueue.queue(
+ function (next_callback) {
+ callback();
+ next_callback();
+ }.bind(this)
+ );
}
},
// stop all callbacks possibly queued up into a hide animation
// this allows the hide animation to finish as we start showing/loading
// a new page, a callback could otherwise interrupt this
- stopHideQueue: function() {
+ stopHideQueue: function () {
this.queues.hide.queue([]);
},
// these are things we can safely call when switching side as well
- _safeResetsAfterSwitchSide: function() {
+ _safeResetsAfterSwitchSide: function () {
// remove styling from window, so no width: 100%; height: 0 issues
- this.element.removeAttr('style');
- if (this.spinnerMove) this.spinnerMove.removeAttr('style');
+ this.element.removeAttr("style");
+ if (this.spinnerMove) this.spinnerMove.removeAttr("style");
//Pages.removeExpired();
this.visible = false;
this.hideUI(null, 0);
- this.timers.clear('ui');
+ this.timers.clear("ui");
this.resetPrevNext();
// clear cached mousemove
@@ -2302,11 +2561,17 @@ var Window = {
},
// Previous / Next
- mayPrevious: function() {
- return (this.view && this.view.options.loop && this.views && this.views.length > 1) || this._position != 1;
+ mayPrevious: function () {
+ return (
+ (this.view &&
+ this.view.options.loop &&
+ this.views &&
+ this.views.length > 1) ||
+ this._position !== 1
+ );
},
- previous: function(force) {
+ previous: function (force) {
var mayPrevious = this.mayPrevious();
if (force || mayPrevious) {
@@ -2314,13 +2579,16 @@ var Window = {
}
},
- mayNext: function() {
+ mayNext: function () {
var hasViews = this.views && this.views.length > 1;
- return (this.view && this.view.options.loop && hasViews) || (hasViews && this.getSurroundingIndexes().next != 1);
+ return (
+ (this.view && this.view.options.loop && hasViews) ||
+ (hasViews && this.getSurroundingIndexes().next !== 1)
+ );
},
- next: function(force) {
+ next: function (force) {
var mayNext = this.mayNext();
if (force || mayNext) {
@@ -2329,142 +2597,189 @@ var Window = {
},
// surrounding
- getSurroundingIndexes: function() {
+ getSurroundingIndexes: function () {
if (!this.views) return {};
var pos = this._position,
- length = this.views.length;
+ length = this.views.length;
- var previous = (pos <= 1) ? length : pos - 1,
- next = (pos >= length) ? 1 : pos + 1;
+ var previous = pos <= 1 ? length : pos - 1,
+ next = pos >= length ? 1 : pos + 1;
return {
previous: previous,
- next: next
+ next: next,
};
},
-
// close when clicking outside of strip or an element opening strip
- bindHideOnClickOutside: function() {
+ bindHideOnClickOutside: function () {
this.unbindHideOnClickOutside();
- $(document.documentElement).on('click', this._delegateHideOutsideHandler = $.proxy(this._delegateHideOutside, this));
+ $(document.documentElement).on(
+ "click",
+ (this._delegateHideOutsideHandler = this._delegateHideOutside.bind(this))
+ );
},
- unbindHideOnClickOutside: function() {
+ unbindHideOnClickOutside: function () {
if (this._delegateHideOutsideHandler) {
- $(document.documentElement).off('click', this._delegateHideOutsideHandler);
+ $(document.documentElement).off(
+ "click",
+ this._delegateHideOutsideHandler
+ );
this._delegateHideOutsideHandler = null;
}
},
- _delegateHideOutside: function(event) {
+ _delegateHideOutside: function (event) {
var page = Pages.page;
- if (!this.visible || !(page && page.view.options.hideOnClickOutside)) return;
+ if (!this.visible || !(page && page.view.options.hideOnClickOutside))
+ return;
var element = event.target;
- if (!$(element).closest('.strip, .strp-window')[0]) {
+ if (!$(element).closest(".strip, .strp-window")[0]) {
this.hide();
}
},
-
// UI
- bindUI: function() {
+ bindUI: function () {
this.unbindUI();
if (!Support.mobileTouch) {
- this.element.on('mouseenter', this._showUIHandler = $.proxy(this.showUI, this))
- .on('mouseleave', this._hideUIHandler = $.proxy(this.hideUI, this));
-
- this.element.on('mousemove', this._mousemoveUIHandler = $.proxy(function(event) {
- // Chrome has a bug that triggers mousemove events incorrectly
- // we have to work around this by comparing cursor positions
- // so only true mousemove events pass through:
- // https://code.google.com/p/chromium/issues/detail?id=420032
- var x = event.pageX,
+ this.element
+ .on("mouseenter", (this._showUIHandler = this.showUI.bind(this)))
+ .on("mouseleave", (this._hideUIHandler = this.hideUI.bind(this)));
+
+ this.element.on(
+ "mousemove",
+ (this._mousemoveUIHandler = function (event) {
+ // Chrome has a bug that triggers mousemove events incorrectly
+ // we have to work around this by comparing cursor positions
+ // so only true mousemove events pass through:
+ // https://code.google.com/p/chromium/issues/detail?id=420032
+ var x = event.pageX,
y = event.pageY;
- if (this._hoveringNav || (y == this._y && x == this._x)) {
- return;
- }
+ if (this._hoveringNav || (y === this._y && x === this._x)) {
+ return;
+ }
- // cache x/y
- this._x = x;
- this._y = y;
+ // cache x/y
+ this._x = x;
+ this._y = y;
- this.showUI();
- this.startUITimer();
- }, this));
+ this.showUI();
+ this.startUITimer();
+ }.bind(this))
+ );
// delegate <> mousemove/click states
- this._pages.on('mousemove', '.strp-container', this._onMouseMoveHandler = $.proxy(this._onMouseMove, this))
- .on('mouseleave', '.strp-container', this._onMouseLeaveHandler = $.proxy(this._onMouseLeave, this))
- .on('mouseenter', '.strp-container', this._onMouseEnterHandler = $.proxy(this._onMouseEnter, this));
+ this._pages
+ .on(
+ "mousemove",
+ ".strp-container",
+ (this._onMouseMoveHandler = this._onMouseMove.bind(this))
+ )
+ .on(
+ "mouseleave",
+ ".strp-container",
+ (this._onMouseLeaveHandler = this._onMouseLeave.bind(this))
+ )
+ .on(
+ "mouseenter",
+ ".strp-container",
+ (this._onMouseEnterHandler = this._onMouseEnter.bind(this))
+ );
// delegate moving onto the <> buttons
// keeping the mouse on them should keep the buttons visible
- this.element.on('mouseenter', '.strp-nav', this._onNavMouseEnterHandler = $.proxy(this._onNavMouseEnter, this))
- .on('mouseleave', '.strp-nav', this._onNavMouseLeaveHandler = $.proxy(this._onNavMouseLeave, this));
+ this.element
+ .on(
+ "mouseenter",
+ ".strp-nav",
+ (this._onNavMouseEnterHandler = this._onNavMouseEnter.bind(this))
+ )
+ .on(
+ "mouseleave",
+ ".strp-nav",
+ (this._onNavMouseLeaveHandler = this._onNavMouseLeave.bind(this))
+ );
- $(window).on('scroll', this._onScrollHandler = $.proxy(this._onScroll, this));
+ $(window).on(
+ "scroll",
+ (this._onScrollHandler = this._onScroll.bind(this))
+ );
}
- this._pages.on('click', '.strp-container', this._onClickHandler = $.proxy(this._onClick, this));
+ this._pages.on(
+ "click",
+ ".strp-container",
+ (this._onClickHandler = this._onClick.bind(this))
+ );
},
- // TODO: switch to jQuery.on/off
- unbindUI: function() {
+ unbindUI: function () {
if (this._showUIHandler) {
- this.element.off('mouseenter', this._showUIHandler)
- .off('mouseleave', this._hideUIHandler)
- .off('mousemove', this._mousemoveUIHandler);
+ this.element
+ .off("mouseenter", this._showUIHandler)
+ .off("mouseleave", this._hideUIHandler)
+ .off("mousemove", this._mousemoveUIHandler);
- this._pages.off('mousemove', '.strp-container', this._onMouseMoveHandler)
- .off('mouseleave', '.strp-container', this._onMouseLeaveHandler)
- .off('mouseenter', '.strp-container', this._onMouseEnterHandler);
+ this._pages
+ .off("mousemove", ".strp-container", this._onMouseMoveHandler)
+ .off("mouseleave", ".strp-container", this._onMouseLeaveHandler)
+ .off("mouseenter", ".strp-container", this._onMouseEnterHandler);
- this.element.off('mouseenter', '.strp-nav', this._onNavMouseEnterHandler)
- .off('mouseleave', '.strp-nav', this._onNavMouseLeaveHandler);
+ this.element
+ .off("mouseenter", ".strp-nav", this._onNavMouseEnterHandler)
+ .off("mouseleave", ".strp-nav", this._onNavMouseLeaveHandler);
- $(window).off('scroll', this._onScrollHandler);
+ $(window).off("scroll", this._onScrollHandler);
this._showUIHandler = null;
}
if (this._onClickHandler) {
- this._pages.off('click', '.strp-container', this._onClickHandler);
+ this._pages.off("click", ".strp-container", this._onClickHandler);
this._onClickHandler = null;
}
},
// reset cached offsetLeft and outerWidth so they are recalculated after scrolling,
// the cached values might be incorrect after scrolling left/right
- _onScroll: function() {
+ _onScroll: function () {
this._offsetLeft = this._outerWidth = null;
},
// events bounds by bindUI
- _onMouseMove: function(event) {
+ _onMouseMove: function (event) {
var Side = this._getEventSide(event),
- side = Side.toLowerCase();
+ side = Side.toLowerCase();
- this.element[(this['may' + Side]() ? 'add' : 'remove') + 'Class']('strp-hovering-clickable');
- this._previous[(side != 'next' ? 'add' : 'remove') + 'Class']('strp-nav-previous-hover strp-nav-hover');
- this._next[(side == 'next' ? 'add' : 'remove') + 'Class']('strp-nav-next-hover strp-nav-hover');
+ this.element[(this["may" + Side]() ? "add" : "remove") + "Class"](
+ "strp-hovering-clickable"
+ );
+ this._previous[(side !== "next" ? "add" : "remove") + "Class"](
+ "strp-nav-previous-hover strp-nav-hover"
+ );
+ this._next[(side === "next" ? "add" : "remove") + "Class"](
+ "strp-nav-next-hover strp-nav-hover"
+ );
},
- _onMouseLeave: function(event) {
- this.element.removeClass('strp-hovering-clickable');
- this._previous.removeClass('strp-nav-previous-hover')
- .add(this._next.removeClass('strp-nav-next-hover'))
- .removeClass('strp-nav-hover');
+ _onMouseLeave: function () {
+ this.element.removeClass("strp-hovering-clickable");
+ this._previous
+ .removeClass("strp-nav-previous-hover")
+ .add(this._next.removeClass("strp-nav-next-hover"))
+ .removeClass("strp-nav-hover");
},
- _onClick: function(event) {
+ _onClick: function (event) {
var Side = this._getEventSide(event),
- side = Side.toLowerCase();
+ side = Side.toLowerCase();
this[side]();
@@ -2473,7 +2788,7 @@ var Window = {
this._onMouseMove(event);
},
- _onMouseEnter: function(event) {
+ _onMouseEnter: function (event) {
// this solves clicking an area and not having an updating cursor
// when not moving cursor after click. When an overlapping page comes into view
// it'll trigger a mouseenter after the mouseout on the disappearing page
@@ -2481,69 +2796,78 @@ var Window = {
this._onMouseMove(event);
},
- _getEventSide: function(event) {
+ _getEventSide: function (event) {
var offsetLeft = this._offsetLeft || this.element.offset().left,
- left = event.pageX - offsetLeft,
- width = this._outerWidth || this.element.outerWidth();
+ left = event.pageX - offsetLeft,
+ width = this._outerWidth || this.element.outerWidth();
- return left < .5 * width ? 'Previous' : 'Next';
+ return left < 0.5 * width ? "Previous" : "Next";
},
- _onNavMouseEnter: function(event) {
+ _onNavMouseEnter: function (event) {
this._hoveringNav = true;
this.clearUITimer();
},
- _onNavMouseLeave: function(event) {
+ _onNavMouseLeave: function (event) {
this._hoveringNav = false;
this.startUITimer();
},
// Actual UI actions
- showUI: function(callback, alternateDuration) {
+ showUI: function (callback, alternateDuration) {
// clear the timer everytime so we can keep clicking elements and fading
// in the ui while not having the timer interupt that with a hide
this.clearUITimer();
// we're only fading the inner button icons since the margin on their wrapper divs might change
- var elements = this.element.find('.strp-nav-button');
+ var elements = this.element.find(".strp-nav-button");
var duration = this.view ? this.view.options.effects.ui.show : 0;
- if ($.type(alternateDuration) == 'number') duration = alternateDuration;
+ if (typeof alternateDuration === "number") duration = alternateDuration;
- elements.stop(true).fadeTo(duration, 1, 'stripEaseInSine', $.proxy(function() {
- this.startUITimer();
- if ($.type(callback) == 'function') callback();
- }, this));
+ elements.stop(true).fadeTo(
+ duration,
+ 1,
+ "stripEaseInSine",
+ function () {
+ this.startUITimer();
+ if (typeof callback === "function") callback();
+ }.bind(this)
+ );
},
- hideUI: function(callback, alternateDuration) {
- var elements = this.element.find('.strp-nav-button');
+ hideUI: function (callback, alternateDuration) {
+ var elements = this.element.find(".strp-nav-button");
var duration = this.view ? this.view.options.effects.ui.hide : 0;
- if ($.type(alternateDuration) == 'number') duration = alternateDuration;
+ if (typeof alternateDuration === "number") duration = alternateDuration;
- elements.stop(true).fadeOut(duration, 'stripEaseOutSine', function() {
- if ($.type(callback) == 'function') callback();
+ elements.stop(true).fadeOut(duration, "stripEaseOutSine", function () {
+ if (typeof callback === "function") callback();
});
},
// UI Timer
// not used on mobile-touch based devices
- clearUITimer: function() {
+ clearUITimer: function () {
if (Support.mobileTouch) return;
- this.timers.clear('ui');
+ this.timers.clear("ui");
},
- startUITimer: function() {
+ startUITimer: function () {
if (Support.mobileTouch) return;
this.clearUITimer();
- this.timers.set('ui', $.proxy(function(){
- this.hideUI();
- }, this), this.view ? this.view.options.uiDelay : 0);
- }
+ this.timers.set(
+ "ui",
+ function () {
+ this.hideUI();
+ }.bind(this),
+ this.view ? this.view.options.uiDelay : 0
+ );
+ },
};
// Keyboard
@@ -2552,35 +2876,37 @@ var Keyboard = {
enabled: false,
keyCode: {
- 'left': 37,
- 'right': 39,
- 'esc': 27
+ left: 37,
+ right: 39,
+ esc: 27,
},
// enable is passed the keyboard option of a page, which can be false
// or contains multiple buttons to toggle
- enable: function(enabled) {
+ enable: function (enabled) {
this.disable();
if (!enabled) return;
- $(document).on('keydown', this._onKeyDownHandler = $.proxy(this.onKeyDown, this))
- .on('keyup', this._onKeyUpHandler = $.proxy(this.onKeyUp, this));
+ $(document)
+ .on("keydown", (this._onKeyDownHandler = this.onKeyDown.bind(this)))
+ .on("keyup", (this._onKeyUpHandler = this.onKeyUp.bind(this)));
this.enabled = enabled;
},
- disable: function() {
+ disable: function () {
this.enabled = false;
if (this._onKeyUpHandler) {
- $(document).off('keyup', this._onKeyUpHandler)
- .off('keydown', this._onKeyDownHandler);
+ $(document)
+ .off("keyup", this._onKeyUpHandler)
+ .off("keydown", this._onKeyDownHandler);
this._onKeyUpHandler = this._onKeyDownHandler = null;
}
},
- onKeyDown: function(event) {
+ onKeyDown: function (event) {
if (!this.enabled || !Window.visible) return;
var key = this.getKeyByKeyCode(event.keyCode);
@@ -2591,16 +2917,16 @@ var Keyboard = {
event.stopPropagation();
switch (key) {
- case 'left':
+ case "left":
Window.previous();
break;
- case 'right':
+ case "right":
Window.next();
break;
}
},
- onKeyUp: function(event) {
+ onKeyUp: function (event) {
if (!this.enabled || !Window.visible) return;
var key = this.getKeyByKeyCode(event.keyCode);
@@ -2608,18 +2934,18 @@ var Keyboard = {
if (!key || (key && this.enabled && !this.enabled[key])) return;
switch (key) {
- case 'esc':
+ case "esc":
Window.hide();
break;
}
},
- getKeyByKeyCode: function(keyCode) {
- for(var key in this.keyCode) {
- if (this.keyCode[key] == keyCode) return key;
+ getKeyByKeyCode: function (keyCode) {
+ for (var key in this.keyCode) {
+ if (this.keyCode[key] === keyCode) return key;
}
return null;
- }
+ },
};
// API
@@ -2629,25 +2955,33 @@ var _Strip = {
_disabled: false,
_fallback: true,
- initialize: function() {
+ initialize: function () {
Window.initialize();
if (!this._disabled) this.startDelegating();
},
// click delegation
- startDelegating: function() {
+ startDelegating: function () {
this.stopDelegating();
- $(document.documentElement).on('click', '.strip[href]', this._delegateHandler = $.proxy(this.delegate, this));
+ $(document.documentElement).on(
+ "click",
+ ".strip[href]",
+ (this._delegateHandler = this.delegate.bind(this))
+ );
},
- stopDelegating: function() {
+ stopDelegating: function () {
if (this._delegateHandler) {
- $(document.documentElement).off('click', '.strip[href]', this._delegateHandler);
+ $(document.documentElement).off(
+ "click",
+ ".strip[href]",
+ this._delegateHandler
+ );
this._delegateHandler = null;
}
},
- delegate: function(event) {
+ delegate: function (event) {
if (this._disabled) return;
event.stopPropagation();
@@ -2658,53 +2992,66 @@ var _Strip = {
_Strip.show(element);
},
- show: function(object) {
+ show: function (object) {
if (this._disabled) {
this.showFallback.apply(_Strip, _slice.call(arguments));
return;
}
var options = arguments[1] || {},
- position = arguments[2];
+ position = arguments[2];
- if (arguments[1] && $.type(arguments[1]) == 'number') {
+ if (arguments[1] && typeof arguments[1] === "number") {
position = arguments[1];
options = {};
}
- var views = [], object_type,
- isElement = object && object.nodeType == 1;
+ var views = [],
+ object_type,
+ isElement = object && object.nodeType === 1;
- switch ((object_type = $.type(object))) {
- case 'string':
- case 'object':
+ switch ((object_type = typeof object)) {
+ case "string":
+ case "object":
var view = new View(object, options),
- _dgo = "data-strip-group-options";
+ _dgo = "data-strip-group-options";
if (view.group) {
// extend the entire group
// if we have an element, look for other elements
if (isElement) {
- var elements = $('.strip[data-strip-group="' + $(object).data('strip-group') + '"]');
+ var elements = $(
+ '.strip[data-strip-group="' +
+ $(object).attr("data-strip-group") +
+ '"]'
+ );
// find possible group options
var groupOptions = {};
- elements.filter('[' + _dgo + ']').each(function(i, element) {
- $.extend(groupOptions, eval('({' + ($(element).attr(_dgo) || '') + '})'));
+ elements.filter("[" + _dgo + "]").each(function (i, element) {
+ $.extend(
+ groupOptions,
+ eval("({" + ($(element).attr(_dgo) || "") + "})")
+ );
});
- elements.each(function(i, element) {
+ elements.each(function (i, element) {
// adjust the position if we find the given object position
- if (!position && element == object) position = i + 1;
- views.push(new View(element, $.extend({}, groupOptions, options)));
+ if (!position && element === object) position = i + 1;
+ views.push(
+ new View(element, $.extend({}, groupOptions, options))
+ );
});
}
} else {
var groupOptions = {};
- if (isElement && $(object).is('[' + _dgo + ']')) {
- $.extend(groupOptions, eval('({' + ($(object).attr(_dgo) || '') + '})'));
+ if (isElement && $(object).is("[" + _dgo + "]")) {
+ $.extend(
+ groupOptions,
+ eval("({" + ($(object).attr(_dgo) || "") + "})")
+ );
// reset the view with group options applied
view = new View(object, $.extend({}, groupOptions, options));
}
@@ -2713,9 +3060,8 @@ var _Strip = {
}
break;
-
- case 'array':
- $.each(object, function(i, item) {
+ case "array":
+ $.each(object, function (i, item) {
var view = new View(item, options);
views.push(view);
});
@@ -2738,11 +3084,14 @@ var _Strip = {
// if we've clicked an element, search for it in the currently open pagegroup
var positionInAPG;
- if (isElement && (positionInAPG = Pages.getPositionInActivePageGroup(object))) {
+ if (
+ isElement &&
+ (positionInAPG = Pages.getPositionInActivePageGroup(object))
+ ) {
// if we've clicked the exact same element it'll never re-enable
// hideOnClickOutside delegation because Pages.show() won't let it
// through, we re-enable it here in that case
- if (positionInAPG == Window._position) {
+ if (positionInAPG === Window._position) {
Window.bindHideOnClickOutside();
}
@@ -2751,19 +3100,19 @@ var _Strip = {
// otherwise start loading and open
Window.load(views, position);
}
-
},
- showFallback: (function() {
+ showFallback: (function () {
function getUrl(object) {
- var url, type = $.type(object);
+ var url,
+ type = typeof object;
- if (type == 'string') {
+ if (type === "string") {
url = object;
- } else if (type == 'array' && object[0]) {
+ } else if (type === "array" && object[0]) {
url = getUrl(object[0]);
- } else if (_.isElement(object) && $(object).attr('href')) {
- var url = $(object).attr('href');
+ } else if (_.isElement(object) && $(object).attr("href")) {
+ url = $(object).attr("href");
} else if (object.url) {
url = object.url;
} else {
@@ -2773,69 +3122,75 @@ var _Strip = {
return url;
}
- return function(object) {
+ return function (object) {
if (!_Strip._fallback) return;
var url = getUrl(object);
if (url) window.location.href = url;
};
- })()
+ })(),
};
$.extend(Strip, {
- show: function(object) {
+ show: function (object) {
_Strip.show.apply(_Strip, _slice.call(arguments));
return this;
},
- hide: function() {
+ hide: function () {
Window.hide();
return this;
},
- disable: function() {
+ disable: function () {
_Strip.stopDelegating();
_Strip._disabled = true;
return this;
},
- enable: function() {
+ enable: function () {
_Strip._disabled = false;
_Strip.startDelegating();
return this;
},
- fallback: function(fallback) {
+ fallback: function (fallback) {
_Strip._fallback = fallback;
return this;
},
- setDefaultSkin: function(skin) {
+ setDefaultSkin: function (skin) {
Options.defaults.skin = skin;
return this;
- }
+ },
});
-
// fallback for old browsers without full position:fixed support
if (
- // IE6
- (Browser.IE && Browser.IE < 7)
- // old Android
- // added a version check because Firefox on Android doesn't have a
- // version number above 4.2 anymore
- || ($.type(Browser.Android) == 'number' && Browser.Android < 3)
- // old WebKit
- || (Browser.MobileSafari && ($.type(Browser.WebKit) == 'number' && Browser.WebKit < 533.18))
- ) {
+ // IE6
+ (Browser.IE && Browser.IE < 7) ||
+ // old Android
+ // added a version check because Firefox on Android doesn't have a
+ // version number above 4.2 anymore
+ (typeof Browser.Android === "number" && Browser.Android < 3) ||
+ // old WebKit
+ (Browser.MobileSafari &&
+ typeof Browser.WebKit === "number" &&
+ Browser.WebKit < 533.18)
+) {
// we'll reset the show function
_Strip.show = _Strip.showFallback;
// disable some functions we don't want to run
- $.each('startDelegating stopDelegating initialize'.split(' '), function(i, fn) {
- _Strip[fn] = function() { };
- });
+ $.each(
+ "startDelegating stopDelegating initialize".split(" "),
+ function (i, fn) {
+ _Strip[fn] = function () {};
+ }
+ );
- Strip.hide = function() { return this; };
+ Strip.hide = function () {
+ return this;
+ };
}
// start
diff --git a/dist/js/strip.pkgd.min.js b/dist/js/strip.pkgd.min.js
index 6b2e58c..9ac31dd 100644
--- a/dist/js/strip.pkgd.min.js
+++ b/dist/js/strip.pkgd.min.js
@@ -1,13 +1,9 @@
/*!
- * Strip - An Unobtrusive Responsive Lightbox - v1.6.4
- * (c) 2014-2016 Nick Stakenburg
+ * Strip - An Unobtrusive Responsive Lightbox - v1.8.0
+ * (c) 2014-2021 Nick Stakenburg
*
- * http://www.stripjs.com
- *
- * Licensing:
- * - Commercial: http://www.stripjs.com/license
- * - Non-commercial: http://creativecommons.org/licenses/by-nc-nd/3.0
+ * https://github.com/staaky/strip
*
+ * @license: https://creativecommons.org/licenses/by/4.0
*/
-!function(a,b){"function"==typeof define&&define.amd?define(["jquery"],b):"object"==typeof module&&module.exports?module.exports=b(require("jquery")):a.Strip=b(jQuery)}(this,function($){function Spinner(){return this.initialize.apply(this,_slice.call(arguments))}function Timers(){return this.initialize.apply(this,_slice.call(arguments))}function getURIData(a){var b={type:"image"};return $.each(Types,function(c,d){var e=d.data(a);e&&(b=e,b.type=c,b.url=a)}),b}function detectExtension(a){var b=(a||"").replace(/\?.*/g,"").match(/\.([^.]{3,4})$/);return b?b[1].toLowerCase():null}function View(){this.initialize.apply(this,_slice.call(arguments))}var Strip={version:"1.6.4"};Strip.Skins={strip:{}};var Browser=function(a){function b(b){var c=new RegExp(b+"([\\d.]+)").exec(a);return c?parseFloat(c[1]):!0}return{IE:!(!window.attachEvent||-1!==a.indexOf("Opera"))&&b("MSIE "),Opera:a.indexOf("Opera")>-1&&(!!window.opera&&opera.version&&parseFloat(opera.version())||7.55),WebKit:a.indexOf("AppleWebKit/")>-1&&b("AppleWebKit/"),Gecko:a.indexOf("Gecko")>-1&&-1===a.indexOf("KHTML")&&b("rv:"),MobileSafari:!!a.match(/Apple.*Mobile.*Safari/),Chrome:a.indexOf("Chrome")>-1&&b("Chrome/"),ChromeMobile:a.indexOf("CrMo")>-1&&b("CrMo/"),Android:a.indexOf("Android")>-1&&b("Android "),IEMobile:a.indexOf("IEMobile")>-1&&b("IEMobile/")}}(navigator.userAgent),_slice=Array.prototype.slice,Fit={within:function(a,b){for(var c=$.extend({height:!0,width:!0},arguments[2]||{}),d=$.extend({},b),e=1,f=5,g={width:c.width,height:c.height};f>0&&(g.width&&d.width>a.width||g.height&&d.height>a.height);){var h=1,i=1;g.width&&d.width>a.width&&(h=a.width/d.width),g.height&&d.height>a.height&&(i=a.height/d.height);var e=Math.min(h,i);d={width:Math.round(b.width*e),height:Math.round(b.height*e)},f--}return d.width=Math.max(d.width,0),d.height=Math.max(d.height,0),d}};$.extend($.easing,{stripEaseInCubic:function(a,b,c,d,e){return d*(b/=e)*b*b+c},stripEaseInSine:function(a,b,c,d,e){return-d*Math.cos(b/e*(Math.PI/2))+d+c},stripEaseOutSine:function(a,b,c,d,e){return d*Math.sin(b/e*(Math.PI/2))+c}});var Support=function(){function a(a){return c(a,"prefix")}function b(a,b){for(var c in a)if(void 0!==d.style[a[c]])return"prefix"==b?a[c]:!0;return!1}function c(a,c){var d=a.charAt(0).toUpperCase()+a.substr(1),f=(a+" "+e.join(d+" ")+d).split(" ");return b(f,c)}var d=document.createElement("div"),e="Webkit Moz O ms Khtml".split(" ");return{css:{animation:c("animation"),transform:c("transform"),prefixed:a},svg:!!document.createElementNS&&!!document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGRect,touch:function(){try{return!!("ontouchstart"in window||window.DocumentTouch&&document instanceof DocumentTouch)}catch(a){return!1}}()}}();Support.mobileTouch=Support.touch&&(Browser.MobileSafari||Browser.Android||Browser.IEMobile||Browser.ChromeMobile||!/^(Win|Mac|Linux)/.test(navigator.platform));var Bounds={viewport:function(){var a={width:$(window).width()};if(Browser.MobileSafari||Browser.Android&&Browser.Gecko){var b=document.documentElement.clientWidth/window.innerWidth;a.height=window.innerHeight*b}else a.height=$(window).height();return a}},ImageReady=function(a){var b=function(){return this.initialize.apply(this,Array.prototype.slice.call(arguments))};a.extend(b.prototype,{initialize:function(){this.options=a.extend({test:function(){},success:function(){},timeout:function(){},callAt:!1,intervals:[[0,0],[1e3,10],[2e3,50],[4e3,100],[2e4,500]]},arguments[0]||{}),this._test=this.options.test,this._success=this.options.success,this._timeout=this.options.timeout,this._ipos=0,this._time=0,this._delay=this.options.intervals[this._ipos][1],this._callTimeouts=[],this.poll(),this._createCallsAt()},poll:function(){this._polling=setTimeout(a.proxy(function(){if(this._test())return void this.success();if(this._time+=this._delay,this._time>=this.options.intervals[this._ipos][0]){if(!this.options.intervals[this._ipos+1])return void("function"==a.type(this._timeout)&&this._timeout());this._ipos++,this._delay=this.options.intervals[this._ipos][1]}this.poll()},this),this._delay)},success:function(){this.abort(),this._success()},_createCallsAt:function(){this.options.callAt&&a.each(this.options.callAt,a.proxy(function(b,c){var d=c[0],e=c[1],f=setTimeout(a.proxy(function(){e()},this),d);this._callTimeouts.push(f)},this))},_stopCallTimeouts:function(){a.each(this._callTimeouts,function(a,b){clearTimeout(b)}),this._callTimeouts=[]},abort:function(){this._stopCallTimeouts(),this._polling&&(clearTimeout(this._polling),this._polling=null)}});var c=function(){return this.initialize.apply(this,Array.prototype.slice.call(arguments))};return a.extend(c.prototype,{supports:{naturalWidth:function(){return"naturalWidth"in new Image}()},initialize:function(b,c,d){return this.img=a(b)[0],this.successCallback=c,this.errorCallback=d,this.isLoaded=!1,this.options=a.extend({method:"onload",pollFallbackAfter:1e3},arguments[3]||{}),"onload"!=this.options.method&&this.supports.naturalWidth?void this.poll():void this.load()},poll:function(){this._poll=new b({test:a.proxy(function(){return this.img.naturalWidth>0},this),success:a.proxy(function(){this.success()},this),timeout:a.proxy(function(){this.error()},this),callAt:[[this.options.pollFallbackAfter,a.proxy(function(){this.load()},this)]]})},load:function(){this._loading=setTimeout(a.proxy(function(){var b=new Image;this._onloadImage=b,b.onload=a.proxy(function(){b.onload=function(){},this.supports.naturalWidth||(this.img.naturalWidth=b.width,this.img.naturalHeight=b.height,b.naturalWidth=b.width,b.naturalHeight=b.height),this.success()},this),b.onerror=a.proxy(this.error,this),b.src=this.img.src},this))},success:function(){this._calledSuccess||(this._calledSuccess=!0,this.abort(),this.waitForRender(a.proxy(function(){this.isLoaded=!0,this.successCallback(this)},this)))},error:function(){this._calledError||(this._calledError=!0,this.abort(),this._errorRenderTimeout=setTimeout(a.proxy(function(){this.errorCallback&&this.errorCallback(this)},this)))},abort:function(){this.stopLoading(),this.stopPolling(),this.stopWaitingForRender()},stopPolling:function(){this._poll&&(this._poll.abort(),this._poll=null)},stopLoading:function(){this._loading&&(clearTimeout(this._loading),this._loading=null),this._onloadImage&&(this._onloadImage.onload=function(){},this._onloadImage.onerror=function(){})},waitForRender:function(a){this._renderTimeout=setTimeout(a)},stopWaitingForRender:function(){this._renderTimeout&&(clearTimeout(this._renderTimeout),this._renderTimeout=null),this._errorRenderTimeout&&(clearTimeout(this._errorRenderTimeout),this._errorRenderTimeout=null)}}),c}(jQuery);Spinner.supported=Support.css.transform&&Support.css.animation,$.extend(Spinner.prototype,{initialize:function(a){this.element=$(a),this.element[0]&&(this.classPrefix="strp-",this.setOptions(arguments[1]||{}),this.element.addClass(this.classPrefix+"spinner"),this.element.append(this._rotate=$("
").addClass(this.classPrefix+"spinner-rotate")),this.build(),this.start())},setOptions:function(a){this.options=$.extend({show:200,hide:200},a||{})},build:function(){if(!this._build){this._rotate.html("");var a=(2*(this.options.length+this.options.radius),this.element.is(":visible"));a||this.element.show();var b,c;this._rotate.append(b=$("
").addClass(this.classPrefix+"spinner-frame").append(c=$("
").addClass(this.classPrefix+"spinner-line")));var d=parseInt($(c).css("z-index"));this.lines=d,c.css({"z-index":"inherit"}),b.remove(),a||this.element.hide();for(var e,f=0;d>f;f++){var b,c;this._rotate.append(b=$("
").addClass(this.classPrefix+"spinner-frame").append(c=$("
").addClass(this.classPrefix+"spinner-line"))),e=e||c.css("color"),c.css({background:e}),b.css({opacity:(1/d*(f+1)).toFixed(2)});var g={};g[Support.css.prefixed("transform")]="rotate("+360/d*(f+1)+"deg)",b.css(g)}this._build=!0}},start:function(){var a={};a[Support.css.prefixed("animation")]=this.classPrefix+"spinner-spin 1s infinite steps("+this.lines+")",this._rotate.css(a)},stop:function(){var a={};a[Support.css.prefixed("animation")]="none",this._rotate.css(a)},show:function(a){this.build(),this.start(),this.element.stop(!0).fadeTo(this.options.show,1,a)},hide:function(a){this.element.stop(!0).fadeOut(this.options.hide,$.proxy(function(){this.stop(),a&&a()},this))},refresh:function(){this._build=!1,this.build()}}),$.extend(Timers.prototype,{initialize:function(){this._timers={}},set:function(a,b,c){this._timers[a]=setTimeout(b,c)},get:function(a){return this._timers[a]},clear:function(a){a?this._timers[a]&&(clearTimeout(this._timers[a]),delete this._timers[a]):this.clearAll()},clearAll:function(){$.each(this._timers,function(a,b){clearTimeout(b)}),this._timers={}}});var Types={image:{extensions:"bmp gif jpeg jpg png webp",detect:function(a){return $.inArray(detectExtension(a),this.extensions.split(" "))>-1},data:function(a){return this.detect()?{extension:detectExtension(a)}:!1}},youtube:{detect:function(a){var b=/(youtube\.com|youtu\.be)\/watch\?(?=.*vi?=([a-zA-Z0-9-_]+))(?:\S+)?$/.exec(a);return b&&b[2]?b[2]:(b=/(youtube\.com|youtu\.be)\/(vi?\/|u\/|embed\/)?([a-zA-Z0-9-_]+)(?:\S+)?$/i.exec(a),b&&b[3]?b[3]:!1)},data:function(a){var b=this.detect(a);return b?{id:b}:!1}},vimeo:{detect:function(a){var b=/(vimeo\.com)\/([a-zA-Z0-9-_]+)(?:\S+)?$/i.exec(a);return b&&b[2]?b[2]:!1},data:function(a){var b=this.detect(a);return b?{id:b}:!1}}},VimeoReady=function(){var a=function(){return this.initialize.apply(this,_slice.call(arguments))};$.extend(a.prototype,{initialize:function(a,b){this.url=a,this.callback=b,this.load()},load:function(){var a=b.get(this.url);if(a)return this.callback(a.data);var c="http"+(window.location&&"https:"==window.location.protocol?"s":"")+":",d=getURIData(this.url).id;this._xhr=$.getJSON(c+"//vimeo.com/api/oembed.json?url="+c+"//vimeo.com/"+d+"&maxwidth=9999999&maxheight=9999999&callback=?",$.proxy(function(a){var c={dimensions:{width:a.width,height:a.height}};b.set(this.url,c),this.callback&&this.callback(c)},this))},abort:function(){this._xhr&&(this._xhr.abort(),this._xhr=null)}});var b={cache:[],get:function(a){for(var b=null,c=0;c
").addClass("strp-page").append(this.container=$("").addClass("strp-container")).css({opacity:0}).hide());var a=this.view.options.position&&this._total>1;switch((this.view.caption||a)&&(this.element.append(this.info=$("
").addClass("strp-info").append(this.info_padder=$("
").addClass("strp-info-padder"))),a&&(this.element.addClass("strp-has-position"),this.info_padder.append($("
").addClass("strp-position").html(this._position+" / "+this._total))),this.view.caption&&this.info_padder.append(this.caption=$("
").addClass("strp-caption").html(this.view.caption))),this.view.type){case"image":this.container.append(this.content=$("
![]()
").attr({src:this.view.url}));break;case"vimeo":case"youtube":this.container.append(this.content=$("
"))}this.element.addClass("strp"+(this.view.options.overlap?"":"-no")+"-overlap"),this._total<2&&this.element.addClass("strp-no-sides"),this.content.addClass("strp-content-element"),this._created=!0}},_getSurroundingPages:function(){var a;if(!(a=this.view.options.preload))return[];for(var b=[],c=Math.max(1,this._position-a[0]),d=Math.min(this._position+a[1],this._total),e=this._position,f=e;d>=f;f++){var g=Pages.pages[Pages.uid][f-1];g._position!=e&&b.push(g)}for(var f=e;f>=c;f--){var g=Pages.pages[Pages.uid][f-1];g._position!=e&&b.push(g)}return b},preloadSurroundingImages:function(){var a=this._getSurroundingPages();$.each(a,$.proxy(function(a,b){b.preload()},this))},preload:function(){this.preloading||this.preloaded||"image"!=this.view.type||!this.view.options.preload||this.loaded||(this.create(),this.preloading=!0,new ImageReady(this.content[0],$.proxy(function(a){this.loaded=!0,this.preloading=!1,this.preloaded=!0,this.dimensions={width:a.img.naturalWidth,height:a.img.naturalHeight}},this),null,{method:"naturalWidth"}))},load:function(a){if(this.create(),this.loaded)return void(a&&a());switch(this.abort(),this.loading=!0,this.view.options.spinner&&!c[this.view.url]&&Window.startLoading(),this.view.type){case"image":if(this.error)return void(a&&a());this.imageReady=new ImageReady(this.content[0],$.proxy(function(b){this._markAsLoaded(),this.dimensions={width:b.img.naturalWidth,height:b.img.naturalHeight},a&&a()},this),$.proxy(function(){this._markAsLoaded(),this.content.hide(),this.container.append(this.error=$("
").addClass("strp-error")),this.element.addClass("strp-has-error"),this.dimensions={width:this.error.outerWidth(),height:this.error.outerHeight()},a&&a()},this),{method:"naturalWidth"});break;case"vimeo":this.vimeoReady=new VimeoReady(this.view.url,$.proxy(function(b){this._markAsLoaded(),this.dimensions={width:b.dimensions.width,height:b.dimensions.height},a&&a()},this));break;case"youtube":this._markAsLoaded(),this.dimensions={width:this.view.options.width,height:this.view.options.height},a&&a()}},_markAsLoaded:function(){this.loading=!1,this.loaded=!0,c[this.view.url]=!0,Window.stopLoading()},isVideo:function(){return/^(youtube|vimeo)$/.test(this.view.type)},insertVideo:function(a){if(this.playerIframe||!this.isVideo())return void(a&&a());var b="http"+(window.location&&"https:"==window.location.protocol?"s":"")+":",c=$.extend({},this.view.options[this.view.type]||{}),d=$.param(c),e={vimeo:b+"//player.vimeo.com/video/{id}?{queryString}",youtube:b+"//www.youtube.com/embed/{id}?{queryString}"},f=e[this.view.type].replace("{id}",this.view._data.id).replace("{queryString}",d);this.content.append(this.playerIframe=$("