');
if (timeout === undefined) timeout = 3000;
// Added by konapun: Set timeout to 30 seconds if this growl is moused over, like normal toast notifications
var callBlock = function(opts) {
opts = opts || {};
$.blockUI({
message: $m,
fadeIn : typeof opts.fadeIn !== 'undefined' ? opts.fadeIn : 700,
fadeOut: typeof opts.fadeOut !== 'undefined' ? opts.fadeOut : 1000,
timeout: typeof opts.timeout !== 'undefined' ? opts.timeout : timeout,
centerY: false,
showOverlay: false,
onUnblock: onClose,
css: $.blockUI.defaults.growlCSS
});
};
callBlock();
var nonmousedOpacity = $m.css('opacity');
$m.mouseover(function() {
callBlock({
fadeIn: 0,
timeout: 30000
});
var displayBlock = $('.blockMsg');
displayBlock.stop(); // cancel fadeout if it has started
displayBlock.fadeTo(300, 1); // make it easier to read the message by removing transparency
}).mouseout(function() {
$('.blockMsg').fadeOut(1000);
});
// End konapun additions
};
// plugin method for blocking element content
$.fn.block = function(opts) {
if ( this[0] === window ) {
$.blockUI( opts );
return this;
}
var fullOpts = $.extend({}, $.blockUI.defaults, opts || {});
this.each(function() {
var $el = $(this);
if (fullOpts.ignoreIfBlocked && $el.data('blockUI.isBlocked'))
return;
$el.unblock({ fadeOut: 0 });
});
return this.each(function() {
if ($.css(this,'position') == 'static') {
this.style.position = 'relative';
$(this).data('blockUI.static', true);
}
this.style.zoom = 1; // force 'hasLayout' in ie
install(this, opts);
});
};
// plugin method for unblocking element content
$.fn.unblock = function(opts) {
if ( this[0] === window ) {
$.unblockUI( opts );
return this;
}
return this.each(function() {
remove(this, opts);
});
};
$.blockUI.version = 2.60; // 2nd generation blocking at no extra cost!
// override these in your code to change the default behavior and style
$.blockUI.defaults = {
// message displayed when blocking (use null for no message)
message: '
Please wait...
',
title: null, // title string; only used when theme == true
draggable: true, // only used when theme == true (requires jquery-ui.js to be loaded)
theme: false, // set to true to use with jQuery UI themes
// styles for the message when blocking; if you wish to disable
// these and use an external stylesheet then do this in your code:
// $.blockUI.defaults.css = {};
css: {
padding: 0,
margin: 0,
width: '30%',
top: '40%',
left: '35%',
textAlign: 'center',
color: '#000',
border: '3px solid #aaa',
backgroundColor:'#fff',
cursor: 'wait'
},
// minimal style set used when themes are used
themedCSS: {
width: '30%',
top: '40%',
left: '35%'
},
// styles for the overlay
overlayCSS: {
backgroundColor: '#000',
opacity: 0.6,
cursor: 'wait'
},
// style to replace wait cursor before unblocking to correct issue
// of lingering wait cursor
cursorReset: 'default',
// styles applied when using $.growlUI
growlCSS: {
width: '350px',
top: '10px',
left: '',
right: '10px',
border: 'none',
padding: '5px',
opacity: 0.6,
cursor: 'default',
color: '#fff',
backgroundColor: '#000',
'-webkit-border-radius':'10px',
'-moz-border-radius': '10px',
'border-radius': '10px'
},
// IE issues: 'about:blank' fails on HTTPS and javascript:false is s-l-o-w
// (hat tip to Jorge H. N. de Vasconcelos)
/*jshint scripturl:true */
iframeSrc: /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank',
// force usage of iframe in non-IE browsers (handy for blocking applets)
forceIframe: false,
// z-index for the blocking overlay
baseZ: 1000,
// set these to true to have the message automatically centered
centerX: true, // <-- only effects element blocking (page block controlled via css above)
centerY: true,
// allow body element to be stetched in ie6; this makes blocking look better
// on "short" pages. disable if you wish to prevent changes to the body height
allowBodyStretch: true,
// enable if you want key and mouse events to be disabled for content that is blocked
bindEvents: true,
// be default blockUI will supress tab navigation from leaving blocking content
// (if bindEvents is true)
constrainTabKey: true,
// fadeIn time in millis; set to 0 to disable fadeIn on block
fadeIn: 200,
// fadeOut time in millis; set to 0 to disable fadeOut on unblock
fadeOut: 400,
// time in millis to wait before auto-unblocking; set to 0 to disable auto-unblock
timeout: 0,
// disable if you don't want to show the overlay
showOverlay: true,
// if true, focus will be placed in the first available input field when
// page blocking
focusInput: true,
// elements that can receive focus
focusableElements: ':input:enabled:visible',
// suppresses the use of overlay styles on FF/Linux (due to performance issues with opacity)
// no longer needed in 2012
// applyPlatformOpacityRules: true,
// callback method invoked when fadeIn has completed and blocking message is visible
onBlock: null,
// callback method invoked when unblocking has completed; the callback is
// passed the element that has been unblocked (which is the window object for page
// blocks) and the options that were passed to the unblock call:
// onUnblock(element, options)
onUnblock: null,
// callback method invoked when the overlay area is clicked.
// setting this will turn the cursor to a pointer, otherwise cursor defined in overlayCss will be used.
onOverlayClick: null,
// don't ask; if you really must know: http://groups.google.com/group/jquery-en/browse_thread/thread/36640a8730503595/2f6a79a77a78e493#2f6a79a77a78e493
quirksmodeOffsetHack: 4,
// class name of the message block
blockMsgClass: 'blockMsg',
// if it is already blocked, then ignore it (don't unblock and reblock)
ignoreIfBlocked: false
};
// private data and functions follow...
var pageBlock = null;
var pageBlockEls = [];
function install(el, opts) {
var css, themedCSS;
var full = (el == window);
var msg = (opts && opts.message !== undefined ? opts.message : undefined);
opts = $.extend({}, $.blockUI.defaults, opts || {});
if (opts.ignoreIfBlocked && $(el).data('blockUI.isBlocked'))
return;
opts.overlayCSS = $.extend({}, $.blockUI.defaults.overlayCSS, opts.overlayCSS || {});
css = $.extend({}, $.blockUI.defaults.css, opts.css || {});
if (opts.onOverlayClick)
opts.overlayCSS.cursor = 'pointer';
themedCSS = $.extend({}, $.blockUI.defaults.themedCSS, opts.themedCSS || {});
msg = msg === undefined ? opts.message : msg;
// remove the current block (if there is one)
if (full && pageBlock)
remove(window, {fadeOut:0});
// if an existing element is being used as the blocking content then we capture
// its current place in the DOM (and current display style) so we can restore
// it when we unblock
if (msg && typeof msg != 'string' && (msg.parentNode || msg.jquery)) {
var node = msg.jquery ? msg[0] : msg;
var data = {};
$(el).data('blockUI.history', data);
data.el = node;
data.parent = node.parentNode;
data.display = node.style.display;
data.position = node.style.position;
if (data.parent)
data.parent.removeChild(node);
}
$(el).data('blockUI.onUnblock', opts.onUnblock);
var z = opts.baseZ;
// blockUI uses 3 layers for blocking, for simplicity they are all used on every platform;
// layer1 is the iframe layer which is used to supress bleed through of underlying content
// layer2 is the overlay layer which has opacity and a wait cursor (by default)
// layer3 is the message content that is displayed while blocking
var lyr1, lyr2, lyr3, s;
if (msie || opts.forceIframe)
lyr1 = $('');
else
lyr1 = $('');
if (opts.theme)
lyr2 = $('');
else
lyr2 = $('');
if (opts.theme && full) {
s = '
';
if ( opts.title ) {
s += '
'+(opts.title || ' ')+'
';
}
s += '';
s += '
';
}
else if (opts.theme) {
s = '
';
if ( opts.title ) {
s += '
'+(opts.title || ' ')+'
';
}
s += '';
s += '
';
}
else if (full) {
s = '';
}
else {
s = '';
}
lyr3 = $(s);
// if we have a message, style it
if (msg) {
if (opts.theme) {
lyr3.css(themedCSS);
lyr3.addClass('ui-widget-content');
}
else
lyr3.css(css);
}
// style the overlay
if (!opts.theme /*&& (!opts.applyPlatformOpacityRules)*/)
lyr2.css(opts.overlayCSS);
lyr2.css('position', full ? 'fixed' : 'absolute');
// make iframe layer transparent in IE
if (msie || opts.forceIframe)
lyr1.css('opacity',0.0);
//$([lyr1[0],lyr2[0],lyr3[0]]).appendTo(full ? 'body' : el);
var layers = [lyr1,lyr2,lyr3], $par = full ? $('body') : $(el);
$.each(layers, function() {
this.appendTo($par);
});
if (opts.theme && opts.draggable && $.fn.draggable) {
lyr3.draggable({
handle: '.ui-dialog-titlebar',
cancel: 'li'
});
}
// ie7 must use absolute positioning in quirks mode and to account for activex issues (when scrolling)
var expr = setExpr && (!$.support.boxModel || $('object,embed', full ? null : el).length > 0);
if (ie6 || expr) {
// give body 100% height
if (full && opts.allowBodyStretch && $.support.boxModel)
$('html,body').css('height','100%');
// fix ie6 issue when blocked element has a border width
if ((ie6 || !$.support.boxModel) && !full) {
var t = sz(el,'borderTopWidth'), l = sz(el,'borderLeftWidth');
var fixT = t ? '(0 - '+t+')' : 0;
var fixL = l ? '(0 - '+l+')' : 0;
}
// simulate fixed position
$.each(layers, function(i,o) {
var s = o[0].style;
s.position = 'absolute';
if (i < 2) {
if (full)
s.setExpression('height','Math.max(document.body.scrollHeight, document.body.offsetHeight) - (jQuery.support.boxModel?0:'+opts.quirksmodeOffsetHack+') + "px"');
else
s.setExpression('height','this.parentNode.offsetHeight + "px"');
if (full)
s.setExpression('width','jQuery.support.boxModel && document.documentElement.clientWidth || document.body.clientWidth + "px"');
else
s.setExpression('width','this.parentNode.offsetWidth + "px"');
if (fixL) s.setExpression('left', fixL);
if (fixT) s.setExpression('top', fixT);
}
else if (opts.centerY) {
if (full) s.setExpression('top','(document.documentElement.clientHeight || document.body.clientHeight) / 2 - (this.offsetHeight / 2) + (blah = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"');
s.marginTop = 0;
}
else if (!opts.centerY && full) {
var top = (opts.css && opts.css.top) ? parseInt(opts.css.top, 10) : 0;
var expression = '((document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + '+top+') + "px"';
s.setExpression('top',expression);
}
});
}
// show the message
if (msg) {
if (opts.theme)
lyr3.find('.ui-widget-content').append(msg);
else
lyr3.append(msg);
if (msg.jquery || msg.nodeType)
$(msg).show();
}
if ((msie || opts.forceIframe) && opts.showOverlay)
lyr1.show(); // opacity is zero
if (opts.fadeIn) {
var cb = opts.onBlock ? opts.onBlock : noOp;
var cb1 = (opts.showOverlay && !msg) ? cb : noOp;
var cb2 = msg ? cb : noOp;
if (opts.showOverlay)
lyr2._fadeIn(opts.fadeIn, cb1);
if (msg)
lyr3._fadeIn(opts.fadeIn, cb2);
}
else {
if (opts.showOverlay)
lyr2.show();
if (msg)
lyr3.show();
if (opts.onBlock)
opts.onBlock();
}
// bind key and mouse events
bind(1, el, opts);
if (full) {
pageBlock = lyr3[0];
pageBlockEls = $(opts.focusableElements,pageBlock);
if (opts.focusInput)
setTimeout(focus, 20);
}
else
center(lyr3[0], opts.centerX, opts.centerY);
if (opts.timeout) {
// auto-unblock
var to = setTimeout(function() {
if (full)
$.unblockUI(opts);
else
$(el).unblock(opts);
}, opts.timeout);
$(el).data('blockUI.timeout', to);
}
}
// remove the block
function remove(el, opts) {
var count;
var full = (el == window);
var $el = $(el);
var data = $el.data('blockUI.history');
var to = $el.data('blockUI.timeout');
if (to) {
clearTimeout(to);
$el.removeData('blockUI.timeout');
}
opts = $.extend({}, $.blockUI.defaults, opts || {});
bind(0, el, opts); // unbind events
if (opts.onUnblock === null) {
opts.onUnblock = $el.data('blockUI.onUnblock');
$el.removeData('blockUI.onUnblock');
}
var els;
if (full) // crazy selector to handle odd field errors in ie6/7
els = $('body').children().filter('.blockUI').add('body > .blockUI');
else
els = $el.find('>.blockUI');
// fix cursor issue
if ( opts.cursorReset ) {
if ( els.length > 1 )
els[1].style.cursor = opts.cursorReset;
if ( els.length > 2 )
els[2].style.cursor = opts.cursorReset;
}
if (full)
pageBlock = pageBlockEls = null;
if (opts.fadeOut) {
count = els.length;
els.stop().fadeOut(opts.fadeOut, function() {
if ( --count === 0)
reset(els,data,opts,el);
});
}
else
reset(els, data, opts, el);
}
// move blocking element back into the DOM where it started
function reset(els,data,opts,el) {
var $el = $(el);
els.each(function(i,o) {
// remove via DOM calls so we don't lose event handlers
if (this.parentNode)
this.parentNode.removeChild(this);
});
if (data && data.el) {
data.el.style.display = data.display;
data.el.style.position = data.position;
if (data.parent)
data.parent.appendChild(data.el);
$el.removeData('blockUI.history');
}
if ($el.data('blockUI.static')) {
$el.css('position', 'static'); // #22
}
if (typeof opts.onUnblock == 'function')
opts.onUnblock(el,opts);
// fix issue in Safari 6 where block artifacts remain until reflow
var body = $(document.body), w = body.width(), cssW = body[0].style.width;
body.width(w-1).width(w);
body[0].style.width = cssW;
}
// bind/unbind the handler
function bind(b, el, opts) {
var full = el == window, $el = $(el);
// don't bother unbinding if there is nothing to unbind
if (!b && (full && !pageBlock || !full && !$el.data('blockUI.isBlocked')))
return;
$el.data('blockUI.isBlocked', b);
// don't bind events when overlay is not in use or if bindEvents is false
if (!full || !opts.bindEvents || (b && !opts.showOverlay))
return;
// bind anchors and inputs for mouse and key events
var events = 'mousedown mouseup keydown keypress keyup touchstart touchend touchmove';
if (b)
$(document).bind(events, opts, handler);
else
$(document).unbind(events, handler);
// former impl...
// var $e = $('a,:input');
// b ? $e.bind(events, opts, handler) : $e.unbind(events, handler);
}
// event handler to suppress keyboard/mouse events when blocking
function handler(e) {
// allow tab navigation (conditionally)
if (e.type === 'keydown' && e.keyCode && e.keyCode == 9) {
if (pageBlock && e.data.constrainTabKey) {
var els = pageBlockEls;
var fwd = !e.shiftKey && e.target === els[els.length-1];
var back = e.shiftKey && e.target === els[0];
if (fwd || back) {
setTimeout(function(){focus(back);},10);
return false;
}
}
}
var opts = e.data;
var target = $(e.target);
if (target.hasClass('blockOverlay') && opts.onOverlayClick)
opts.onOverlayClick();
// allow events within the message content
if (target.parents('div.' + opts.blockMsgClass).length > 0)
return true;
// allow events for content that is not being blocked
return target.parents().children().filter('div.blockUI').length === 0;
}
function focus(back) {
if (!pageBlockEls)
return;
var e = pageBlockEls[back===true ? pageBlockEls.length-1 : 0];
if (e)
e.focus();
}
function center(el, x, y) {
var p = el.parentNode, s = el.style;
var l = ((p.offsetWidth - el.offsetWidth)/2) - sz(p,'borderLeftWidth');
var t = ((p.offsetHeight - el.offsetHeight)/2) - sz(p,'borderTopWidth');
if (x) s.left = l > 0 ? (l+'px') : '0';
if (y) s.top = t > 0 ? (t+'px') : '0';
}
function sz(el, p) {
return parseInt($.css(el,p),10)||0;
}
}
/*global define:true */
if (typeof define === 'function' && define.amd && define.amd.jQuery) {
define(['jquery'], setup);
} else {
setup(jQuery);
}
})();
/** * jQuery Cookie plugin * */
jQuery.cookie = function (key, value, options) {
// key and value given, set cookie...
if (arguments.length > 1 && (value === null || typeof value !== "object")) {
options = jQuery.extend({}, options);
if (value === null) {
options.expires = -1;
}
if (typeof options.expires === 'number') {
var days = options.expires, t = options.expires = new Date();
t.setDate(t.getDate() + days);
}
return (document.cookie = [
encodeURIComponent(key), '=',
options.raw ? String(value) : encodeURIComponent(String(value)),
options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
options.path ? '; path=' + options.path : '',
options.domain ? '; domain=' + options.domain : '',
options.secure ? '; secure' : ''
].join(''));
}
// key and possibly options given, get cookie...
options = value || {};
var result, decode = options.raw ? function (s) { return s; } : decodeURIComponent;
return (result = new RegExp('(?:^|; )' + encodeURIComponent(key) + '=([^;]*)').exec(document.cookie)) ? decode(result[1]) : null;
};
/*
* Style File - jQuery plugin for styling file input elements
*
* Copyright (c) 2007-2008 Mika Tuupola
*
* Licensed under the MIT license:
* http://www.opensource.org/licenses/mit-license.php
*
* Based on work by Shaun Inman
* http://www.shauninman.com/archive/2007/09/10/styling_file_inputs_with_css_and_the_dom
*
* Revision: $Id: jquery.filestyle.js 303 2008-01-30 13:53:24Z tuupola $
*
*/
(function($) {
$.fn.filestyle = function(options) {
var settings = {
width : 200
};
if(options) {
$.extend(settings, options);
};
return this.each(function() {
var self = this;
var wrapper = $("
").css({
"width": settings.imagewidth + "px",
"height": settings.imageheight + "px",
"background": "url(" + settings.image + ") 0 0 no-repeat",
"background-position": "right",
"display": "inline",
"position": "absolute",
"overflow": "hidden",
"margin-left": settings.marginleft + "px"
});
var filename = $('').addClass($(self).attr("class")).css({
"display": "inline",
"margin-left": "20px",
"width": settings.width + "px"
});
$(self).before(filename);
$(self).wrap(wrapper);
$(self).css({
"position": "relative",
"height": settings.imageheight + "px",
"width": settings.width + "px",
"display": "inline",
"cursor": "pointer",
"opacity": "0.0"
});
if ($.browser.mozilla) {
if (/Win/.test(navigator.platform)) {
$(self).css("margin-left", "-142px");
} else {
$(self).css("margin-left", "-168px");
};
} else {
$(self).css("margin-left", settings.imagewidth - settings.width + "px");
};
$(self).bind("change", function() {
filename.val($(self).val());
});
});
};
})(jQuery);
/*!
* jQuery Cycle2; version: 2.1.6 build: 20141007
* http://jquery.malsup.com/cycle2/
* Copyright (c) 2014 M. Alsup; Dual licensed: MIT/GPL
*/
/* Cycle2 core engine */
;(function($) {
"use strict";
var version = '2.1.6';
$.fn.cycle = function( options ) {
// fix mistakes with the ready state
var o;
if ( this.length === 0 && !$.isReady ) {
o = { s: this.selector, c: this.context };
$.fn.cycle.log('requeuing slideshow (dom not ready)');
$(function() {
$( o.s, o.c ).cycle(options);
});
return this;
}
return this.each(function() {
var data, opts, shortName, val;
var container = $(this);
var log = $.fn.cycle.log;
if ( container.data('cycle.opts') )
return; // already initialized
if ( container.data('cycle-log') === false ||
( options && options.log === false ) ||
( opts && opts.log === false) ) {
log = $.noop;
}
log('--c2 init--');
data = container.data();
for (var p in data) {
// allow props to be accessed sans 'cycle' prefix and log the overrides
if (data.hasOwnProperty(p) && /^cycle[A-Z]+/.test(p) ) {
val = data[p];
shortName = p.match(/^cycle(.*)/)[1].replace(/^[A-Z]/, lowerCase);
log(shortName+':', val, '('+typeof val +')');
data[shortName] = val;
}
}
opts = $.extend( {}, $.fn.cycle.defaults, data, options || {});
opts.timeoutId = 0;
opts.paused = opts.paused || false; // #57
opts.container = container;
opts._maxZ = opts.maxZ;
opts.API = $.extend ( { _container: container }, $.fn.cycle.API );
opts.API.log = log;
opts.API.trigger = function( eventName, args ) {
opts.container.trigger( eventName, args );
return opts.API;
};
container.data( 'cycle.opts', opts );
container.data( 'cycle.API', opts.API );
// opportunity for plugins to modify opts and API
opts.API.trigger('cycle-bootstrap', [ opts, opts.API ]);
opts.API.addInitialSlides();
opts.API.preInitSlideshow();
if ( opts.slides.length )
opts.API.initSlideshow();
});
};
$.fn.cycle.API = {
opts: function() {
return this._container.data( 'cycle.opts' );
},
addInitialSlides: function() {
var opts = this.opts();
var slides = opts.slides;
opts.slideCount = 0;
opts.slides = $(); // empty set
// add slides that already exist
slides = slides.jquery ? slides : opts.container.find( slides );
if ( opts.random ) {
slides.sort(function() {return Math.random() - 0.5;});
}
opts.API.add( slides );
},
preInitSlideshow: function() {
var opts = this.opts();
opts.API.trigger('cycle-pre-initialize', [ opts ]);
var tx = $.fn.cycle.transitions[opts.fx];
if (tx && $.isFunction(tx.preInit))
tx.preInit( opts );
opts._preInitialized = true;
},
postInitSlideshow: function() {
var opts = this.opts();
opts.API.trigger('cycle-post-initialize', [ opts ]);
var tx = $.fn.cycle.transitions[opts.fx];
if (tx && $.isFunction(tx.postInit))
tx.postInit( opts );
},
initSlideshow: function() {
var opts = this.opts();
var pauseObj = opts.container;
var slideOpts;
opts.API.calcFirstSlide();
if ( opts.container.css('position') == 'static' )
opts.container.css('position', 'relative');
$(opts.slides[opts.currSlide]).css({
opacity: 1,
display: 'block',
visibility: 'visible'
});
opts.API.stackSlides( opts.slides[opts.currSlide], opts.slides[opts.nextSlide], !opts.reverse );
if ( opts.pauseOnHover ) {
// allow pauseOnHover to specify an element
if ( opts.pauseOnHover !== true )
pauseObj = $( opts.pauseOnHover );
pauseObj.hover(
function(){ opts.API.pause( true ); },
function(){ opts.API.resume( true ); }
);
}
// stage initial transition
if ( opts.timeout ) {
slideOpts = opts.API.getSlideOpts( opts.currSlide );
opts.API.queueTransition( slideOpts, slideOpts.timeout + opts.delay );
}
opts._initialized = true;
opts.API.updateView( true );
opts.API.trigger('cycle-initialized', [ opts ]);
opts.API.postInitSlideshow();
},
pause: function( hover ) {
var opts = this.opts(),
slideOpts = opts.API.getSlideOpts(),
alreadyPaused = opts.hoverPaused || opts.paused;
if ( hover )
opts.hoverPaused = true;
else
opts.paused = true;
if ( ! alreadyPaused ) {
opts.container.addClass('cycle-paused');
opts.API.trigger('cycle-paused', [ opts ]).log('cycle-paused');
if ( slideOpts.timeout ) {
clearTimeout( opts.timeoutId );
opts.timeoutId = 0;
// determine how much time is left for the current slide
opts._remainingTimeout -= ( $.now() - opts._lastQueue );
if ( opts._remainingTimeout < 0 || isNaN(opts._remainingTimeout) )
opts._remainingTimeout = undefined;
}
}
},
resume: function( hover ) {
var opts = this.opts(),
alreadyResumed = !opts.hoverPaused && !opts.paused,
remaining;
if ( hover )
opts.hoverPaused = false;
else
opts.paused = false;
if ( ! alreadyResumed ) {
opts.container.removeClass('cycle-paused');
// #gh-230; if an animation is in progress then don't queue a new transition; it will
// happen naturally
if ( opts.slides.filter(':animated').length === 0 )
opts.API.queueTransition( opts.API.getSlideOpts(), opts._remainingTimeout );
opts.API.trigger('cycle-resumed', [ opts, opts._remainingTimeout ] ).log('cycle-resumed');
}
},
add: function( slides, prepend ) {
var opts = this.opts();
var oldSlideCount = opts.slideCount;
var startSlideshow = false;
var len;
if ( $.type(slides) == 'string')
slides = $.trim( slides );
$( slides ).each(function(i) {
var slideOpts;
var slide = $(this);
if ( prepend )
opts.container.prepend( slide );
else
opts.container.append( slide );
opts.slideCount++;
slideOpts = opts.API.buildSlideOpts( slide );
if ( prepend )
opts.slides = $( slide ).add( opts.slides );
else
opts.slides = opts.slides.add( slide );
opts.API.initSlide( slideOpts, slide, --opts._maxZ );
slide.data('cycle.opts', slideOpts);
opts.API.trigger('cycle-slide-added', [ opts, slideOpts, slide ]);
});
opts.API.updateView( true );
startSlideshow = opts._preInitialized && (oldSlideCount < 2 && opts.slideCount >= 1);
if ( startSlideshow ) {
if ( !opts._initialized )
opts.API.initSlideshow();
else if ( opts.timeout ) {
len = opts.slides.length;
opts.nextSlide = opts.reverse ? len - 1 : 1;
if ( !opts.timeoutId ) {
opts.API.queueTransition( opts );
}
}
}
},
calcFirstSlide: function() {
var opts = this.opts();
var firstSlideIndex;
firstSlideIndex = parseInt( opts.startingSlide || 0, 10 );
if (firstSlideIndex >= opts.slides.length || firstSlideIndex < 0)
firstSlideIndex = 0;
opts.currSlide = firstSlideIndex;
if ( opts.reverse ) {
opts.nextSlide = firstSlideIndex - 1;
if (opts.nextSlide < 0)
opts.nextSlide = opts.slides.length - 1;
}
else {
opts.nextSlide = firstSlideIndex + 1;
if (opts.nextSlide == opts.slides.length)
opts.nextSlide = 0;
}
},
calcNextSlide: function() {
var opts = this.opts();
var roll;
if ( opts.reverse ) {
roll = (opts.nextSlide - 1) < 0;
opts.nextSlide = roll ? opts.slideCount - 1 : opts.nextSlide-1;
opts.currSlide = roll ? 0 : opts.nextSlide+1;
}
else {
roll = (opts.nextSlide + 1) == opts.slides.length;
opts.nextSlide = roll ? 0 : opts.nextSlide+1;
opts.currSlide = roll ? opts.slides.length-1 : opts.nextSlide-1;
}
},
calcTx: function( slideOpts, manual ) {
var opts = slideOpts;
var tx;
if ( opts._tempFx )
tx = $.fn.cycle.transitions[opts._tempFx];
else if ( manual && opts.manualFx )
tx = $.fn.cycle.transitions[opts.manualFx];
if ( !tx )
tx = $.fn.cycle.transitions[opts.fx];
opts._tempFx = null;
this.opts()._tempFx = null;
if (!tx) {
tx = $.fn.cycle.transitions.fade;
opts.API.log('Transition "' + opts.fx + '" not found. Using fade.');
}
return tx;
},
prepareTx: function( manual, fwd ) {
var opts = this.opts();
var after, curr, next, slideOpts, tx;
if ( opts.slideCount < 2 ) {
opts.timeoutId = 0;
return;
}
if ( manual && ( !opts.busy || opts.manualTrump ) ) {
opts.API.stopTransition();
opts.busy = false;
clearTimeout(opts.timeoutId);
opts.timeoutId = 0;
}
if ( opts.busy )
return;
if ( opts.timeoutId === 0 && !manual )
return;
curr = opts.slides[opts.currSlide];
next = opts.slides[opts.nextSlide];
slideOpts = opts.API.getSlideOpts( opts.nextSlide );
tx = opts.API.calcTx( slideOpts, manual );
opts._tx = tx;
if ( manual && slideOpts.manualSpeed !== undefined )
slideOpts.speed = slideOpts.manualSpeed;
// if ( opts.nextSlide === opts.currSlide )
// opts.API.calcNextSlide();
// ensure that:
// 1. advancing to a different slide
// 2. this is either a manual event (prev/next, pager, cmd) or
// a timer event and slideshow is not paused
if ( opts.nextSlide != opts.currSlide &&
(manual || (!opts.paused && !opts.hoverPaused && opts.timeout) )) { // #62
opts.API.trigger('cycle-before', [ slideOpts, curr, next, fwd ]);
if ( tx.before )
tx.before( slideOpts, curr, next, fwd );
after = function() {
opts.busy = false;
// #76; bail if slideshow has been destroyed
if (! opts.container.data( 'cycle.opts' ) )
return;
if (tx.after)
tx.after( slideOpts, curr, next, fwd );
opts.API.trigger('cycle-after', [ slideOpts, curr, next, fwd ]);
opts.API.queueTransition( slideOpts);
opts.API.updateView( true );
};
opts.busy = true;
if (tx.transition)
tx.transition(slideOpts, curr, next, fwd, after);
else
opts.API.doTransition( slideOpts, curr, next, fwd, after);
opts.API.calcNextSlide();
opts.API.updateView();
} else {
opts.API.queueTransition( slideOpts );
}
},
// perform the actual animation
doTransition: function( slideOpts, currEl, nextEl, fwd, callback) {
var opts = slideOpts;
var curr = $(currEl), next = $(nextEl);
var fn = function() {
// make sure animIn has something so that callback doesn't trigger immediately
next.animate(opts.animIn || { opacity: 1}, opts.speed, opts.easeIn || opts.easing, callback);
};
next.css(opts.cssBefore || {});
curr.animate(opts.animOut || {}, opts.speed, opts.easeOut || opts.easing, function() {
curr.css(opts.cssAfter || {});
if (!opts.sync) {
fn();
}
});
if (opts.sync) {
fn();
}
},
queueTransition: function( slideOpts, specificTimeout ) {
var opts = this.opts();
var timeout = specificTimeout !== undefined ? specificTimeout : slideOpts.timeout;
if (opts.nextSlide === 0 && --opts.loop === 0) {
opts.API.log('terminating; loop=0');
opts.timeout = 0;
if ( timeout ) {
setTimeout(function() {
opts.API.trigger('cycle-finished', [ opts ]);
}, timeout);
}
else {
opts.API.trigger('cycle-finished', [ opts ]);
}
// reset nextSlide
opts.nextSlide = opts.currSlide;
return;
}
if ( opts.continueAuto !== undefined ) {
if ( opts.continueAuto === false ||
($.isFunction(opts.continueAuto) && opts.continueAuto() === false )) {
opts.API.log('terminating automatic transitions');
opts.timeout = 0;
if ( opts.timeoutId )
clearTimeout(opts.timeoutId);
return;
}
}
if ( timeout ) {
opts._lastQueue = $.now();
if ( specificTimeout === undefined )
opts._remainingTimeout = slideOpts.timeout;
if ( !opts.paused && ! opts.hoverPaused ) {
opts.timeoutId = setTimeout(function() {
opts.API.prepareTx( false, !opts.reverse );
}, timeout );
}
}
},
stopTransition: function() {
var opts = this.opts();
if ( opts.slides.filter(':animated').length ) {
opts.slides.stop(false, true);
opts.API.trigger('cycle-transition-stopped', [ opts ]);
}
if ( opts._tx && opts._tx.stopTransition )
opts._tx.stopTransition( opts );
},
// advance slide forward or back
advanceSlide: function( val ) {
var opts = this.opts();
clearTimeout(opts.timeoutId);
opts.timeoutId = 0;
opts.nextSlide = opts.currSlide + val;
if (opts.nextSlide < 0)
opts.nextSlide = opts.slides.length - 1;
else if (opts.nextSlide >= opts.slides.length)
opts.nextSlide = 0;
opts.API.prepareTx( true, val >= 0 );
return false;
},
buildSlideOpts: function( slide ) {
var opts = this.opts();
var val, shortName;
var slideOpts = slide.data() || {};
for (var p in slideOpts) {
// allow props to be accessed sans 'cycle' prefix and log the overrides
if (slideOpts.hasOwnProperty(p) && /^cycle[A-Z]+/.test(p) ) {
val = slideOpts[p];
shortName = p.match(/^cycle(.*)/)[1].replace(/^[A-Z]/, lowerCase);
opts.API.log('['+(opts.slideCount-1)+']', shortName+':', val, '('+typeof val +')');
slideOpts[shortName] = val;
}
}
slideOpts = $.extend( {}, $.fn.cycle.defaults, opts, slideOpts );
slideOpts.slideNum = opts.slideCount;
try {
// these props should always be read from the master state object
delete slideOpts.API;
delete slideOpts.slideCount;
delete slideOpts.currSlide;
delete slideOpts.nextSlide;
delete slideOpts.slides;
} catch(e) {
// no op
}
return slideOpts;
},
getSlideOpts: function( index ) {
var opts = this.opts();
if ( index === undefined )
index = opts.currSlide;
var slide = opts.slides[index];
var slideOpts = $(slide).data('cycle.opts');
return $.extend( {}, opts, slideOpts );
},
initSlide: function( slideOpts, slide, suggestedZindex ) {
var opts = this.opts();
slide.css( slideOpts.slideCss || {} );
if ( suggestedZindex > 0 )
slide.css( 'zIndex', suggestedZindex );
// ensure that speed settings are sane
if ( isNaN( slideOpts.speed ) )
slideOpts.speed = $.fx.speeds[slideOpts.speed] || $.fx.speeds._default;
if ( !slideOpts.sync )
slideOpts.speed = slideOpts.speed / 2;
slide.addClass( opts.slideClass );
},
updateView: function( isAfter, isDuring, forceEvent ) {
var opts = this.opts();
if ( !opts._initialized )
return;
var slideOpts = opts.API.getSlideOpts();
var currSlide = opts.slides[ opts.currSlide ];
if ( ! isAfter && isDuring !== true ) {
opts.API.trigger('cycle-update-view-before', [ opts, slideOpts, currSlide ]);
if ( opts.updateView < 0 )
return;
}
if ( opts.slideActiveClass ) {
opts.slides.removeClass( opts.slideActiveClass )
.eq( opts.currSlide ).addClass( opts.slideActiveClass );
}
if ( isAfter && opts.hideNonActive )
opts.slides.filter( ':not(.' + opts.slideActiveClass + ')' ).css('visibility', 'hidden');
if ( opts.updateView === 0 ) {
setTimeout(function() {
opts.API.trigger('cycle-update-view', [ opts, slideOpts, currSlide, isAfter ]);
}, slideOpts.speed / (opts.sync ? 2 : 1) );
}
if ( opts.updateView !== 0 )
opts.API.trigger('cycle-update-view', [ opts, slideOpts, currSlide, isAfter ]);
if ( isAfter )
opts.API.trigger('cycle-update-view-after', [ opts, slideOpts, currSlide ]);
},
getComponent: function( name ) {
var opts = this.opts();
var selector = opts[name];
if (typeof selector === 'string') {
// if selector is a child, sibling combinator, adjancent selector then use find, otherwise query full dom
return (/^\s*[\>|\+|~]/).test( selector ) ? opts.container.find( selector ) : $( selector );
}
if (selector.jquery)
return selector;
return $(selector);
},
stackSlides: function( curr, next, fwd ) {
var opts = this.opts();
if ( !curr ) {
curr = opts.slides[opts.currSlide];
next = opts.slides[opts.nextSlide];
fwd = !opts.reverse;
}
// reset the zIndex for the common case:
// curr slide on top, next slide beneath, and the rest in order to be shown
$(curr).css('zIndex', opts.maxZ);
var i;
var z = opts.maxZ - 2;
var len = opts.slideCount;
if (fwd) {
for ( i = opts.currSlide + 1; i < len; i++ )
$( opts.slides[i] ).css( 'zIndex', z-- );
for ( i = 0; i < opts.currSlide; i++ )
$( opts.slides[i] ).css( 'zIndex', z-- );
}
else {
for ( i = opts.currSlide - 1; i >= 0; i-- )
$( opts.slides[i] ).css( 'zIndex', z-- );
for ( i = len - 1; i > opts.currSlide; i-- )
$( opts.slides[i] ).css( 'zIndex', z-- );
}
$(next).css('zIndex', opts.maxZ - 1);
},
getSlideIndex: function( el ) {
return this.opts().slides.index( el );
}
}; // API
// default logger
$.fn.cycle.log = function log() {
/*global console:true */
if (window.console && console.log)
console.log('[cycle2] ' + Array.prototype.join.call(arguments, ' ') );
};
$.fn.cycle.version = function() { return 'Cycle2: ' + version; };
// helper functions
function lowerCase(s) {
return (s || '').toLowerCase();
}
// expose transition object
$.fn.cycle.transitions = {
custom: {
},
none: {
before: function( opts, curr, next, fwd ) {
opts.API.stackSlides( next, curr, fwd );
opts.cssBefore = { opacity: 1, visibility: 'visible', display: 'block' };
}
},
fade: {
before: function( opts, curr, next, fwd ) {
var css = opts.API.getSlideOpts( opts.nextSlide ).slideCss || {};
opts.API.stackSlides( curr, next, fwd );
opts.cssBefore = $.extend(css, { opacity: 0, visibility: 'visible', display: 'block' });
opts.animIn = { opacity: 1 };
opts.animOut = { opacity: 0 };
}
},
fadeout: {
before: function( opts , curr, next, fwd ) {
var css = opts.API.getSlideOpts( opts.nextSlide ).slideCss || {};
opts.API.stackSlides( curr, next, fwd );
opts.cssBefore = $.extend(css, { opacity: 1, visibility: 'visible', display: 'block' });
opts.animOut = { opacity: 0 };
}
},
scrollHorz: {
before: function( opts, curr, next, fwd ) {
opts.API.stackSlides( curr, next, fwd );
var w = opts.container.css('overflow','hidden').width();
opts.cssBefore = { left: fwd ? w : - w, top: 0, opacity: 1, visibility: 'visible', display: 'block' };
opts.cssAfter = { zIndex: opts._maxZ - 2, left: 0 };
opts.animIn = { left: 0 };
opts.animOut = { left: fwd ? -w : w };
}
},
scrollHorzReverse: {
before: function( opts, curr, next, fwd ) {
opts.API.stackSlides( curr, next, fwd );
var w = opts.container.css('overflow','hidden').width();
opts.cssBefore = { left: fwd ? - w : w, top: 0, opacity: 1, visibility: 'visible', display: 'block' };
opts.cssAfter = { zIndex: opts._maxZ - 2, left: 0 };
opts.animIn = { left: 0 };
opts.animOut = { left: fwd ? w : -w };
}
}
};
// @see: http://jquery.malsup.com/cycle2/api
$.fn.cycle.defaults = {
allowWrap: true,
autoSelector: '.cycle-slideshow[data-cycle-auto-init!=false]',
delay: 0,
easing: null,
fx: 'fade',
hideNonActive: true,
loop: 0,
manualFx: undefined,
manualSpeed: undefined,
manualTrump: true,
maxZ: 100,
pauseOnHover: false,
reverse: false,
slideActiveClass: 'cycle-slide-active',
slideClass: 'cycle-slide',
slideCss: { position: 'absolute', top: 0, left: 0 },
slides: '> img',
speed: 500,
startingSlide: 0,
sync: true,
timeout: 4000,
updateView: 0
};
// automatically find and run slideshows
$(document).ready(function() {
$( $.fn.cycle.defaults.autoSelector ).cycle();
});
})(jQuery);
/*! Cycle2 autoheight plugin; Copyright (c) M.Alsup, 2012; version: 20130913 */
(function($) {
"use strict";
$.extend($.fn.cycle.defaults, {
autoHeight: 0, // setting this option to false disables autoHeight logic
autoHeightSpeed: 250,
autoHeightEasing: null
});
$(document).on( 'cycle-initialized', function( e, opts ) {
var autoHeight = opts.autoHeight;
var t = $.type( autoHeight );
var resizeThrottle = null;
var ratio;
if ( t !== 'string' && t !== 'number' )
return;
// bind events
opts.container.on( 'cycle-slide-added cycle-slide-removed', initAutoHeight );
opts.container.on( 'cycle-destroyed', onDestroy );
if ( autoHeight == 'container' ) {
opts.container.on( 'cycle-before', onBefore );
}
else if ( t === 'string' && /\d+\:\d+/.test( autoHeight ) ) {
// use ratio
ratio = autoHeight.match(/(\d+)\:(\d+)/);
ratio = ratio[1] / ratio[2];
opts._autoHeightRatio = ratio;
}
// if autoHeight is a number then we don't need to recalculate the sentinel
// index on resize
if ( t !== 'number' ) {
// bind unique resize handler per slideshow (so it can be 'off-ed' in onDestroy)
opts._autoHeightOnResize = function () {
clearTimeout( resizeThrottle );
resizeThrottle = setTimeout( onResize, 50 );
};
$(window).on( 'resize orientationchange', opts._autoHeightOnResize );
}
setTimeout( onResize, 30 );
function onResize() {
initAutoHeight( e, opts );
}
});
function initAutoHeight( e, opts ) {
var clone, height, sentinelIndex;
var autoHeight = opts.autoHeight;
if ( autoHeight == 'container' ) {
height = $( opts.slides[ opts.currSlide ] ).outerHeight();
opts.container.height( height );
}
else if ( opts._autoHeightRatio ) {
opts.container.height( opts.container.width() / opts._autoHeightRatio );
}
else if ( autoHeight === 'calc' || ( $.type( autoHeight ) == 'number' && autoHeight >= 0 ) ) {
if ( autoHeight === 'calc' )
sentinelIndex = calcSentinelIndex( e, opts );
else if ( autoHeight >= opts.slides.length )
sentinelIndex = 0;
else
sentinelIndex = autoHeight;
// only recreate sentinel if index is different
if ( sentinelIndex == opts._sentinelIndex )
return;
opts._sentinelIndex = sentinelIndex;
if ( opts._sentinel )
opts._sentinel.remove();
// clone existing slide as sentinel
clone = $( opts.slides[ sentinelIndex ].cloneNode(true) );
// #50; remove special attributes from cloned content
clone.removeAttr( 'id name rel' ).find( '[id],[name],[rel]' ).removeAttr( 'id name rel' );
clone.css({
position: 'static',
visibility: 'hidden',
display: 'block'
}).prependTo( opts.container ).addClass('cycle-sentinel cycle-slide').removeClass('cycle-slide-active');
clone.find( '*' ).css( 'visibility', 'hidden' );
opts._sentinel = clone;
}
}
function calcSentinelIndex( e, opts ) {
var index = 0, max = -1;
// calculate tallest slide index
opts.slides.each(function(i) {
var h = $(this).height();
if ( h > max ) {
max = h;
index = i;
}
});
return index;
}
function onBefore( e, opts, outgoing, incoming, forward ) {
var h = $(incoming).outerHeight();
opts.container.animate( { height: h }, opts.autoHeightSpeed, opts.autoHeightEasing );
}
function onDestroy( e, opts ) {
if ( opts._autoHeightOnResize ) {
$(window).off( 'resize orientationchange', opts._autoHeightOnResize );
opts._autoHeightOnResize = null;
}
opts.container.off( 'cycle-slide-added cycle-slide-removed', initAutoHeight );
opts.container.off( 'cycle-destroyed', onDestroy );
opts.container.off( 'cycle-before', onBefore );
if ( opts._sentinel ) {
opts._sentinel.remove();
opts._sentinel = null;
}
}
})(jQuery);
/*! caption plugin for Cycle2; version: 20130306 */
(function($) {
"use strict";
$.extend($.fn.cycle.defaults, {
caption: '> .cycle-caption',
captionTemplate: '{{slideNum}} / {{slideCount}}',
overlay: '> .cycle-overlay',
overlayTemplate: '
{{title}}
{{desc}}
',
captionModule: 'caption'
});
$(document).on( 'cycle-update-view', function( e, opts, slideOpts, currSlide ) {
if ( opts.captionModule !== 'caption' )
return;
var el;
$.each(['caption','overlay'], function() {
var name = this;
var template = slideOpts[name+'Template'];
var el = opts.API.getComponent( name );
if( el.length && template ) {
el.html( opts.API.tmpl( template, slideOpts, opts, currSlide ) );
el.show();
}
else {
el.hide();
}
});
});
$(document).on( 'cycle-destroyed', function( e, opts ) {
var el;
$.each(['caption','overlay'], function() {
var name = this, template = opts[name+'Template'];
if ( opts[name] && template ) {
el = opts.API.getComponent( 'caption' );
el.empty();
}
});
});
})(jQuery);
/*! command plugin for Cycle2; version: 20140415 */
(function($) {
"use strict";
var c2 = $.fn.cycle;
$.fn.cycle = function( options ) {
var cmd, cmdFn, opts;
var args = $.makeArray( arguments );
if ( $.type( options ) == 'number' ) {
return this.cycle( 'goto', options );
}
if ( $.type( options ) == 'string' ) {
return this.each(function() {
var cmdArgs;
cmd = options;
opts = $(this).data('cycle.opts');
if ( opts === undefined ) {
c2.log('slideshow must be initialized before sending commands; "' + cmd + '" ignored');
return;
}
else {
cmd = cmd == 'goto' ? 'jump' : cmd; // issue #3; change 'goto' to 'jump' internally
cmdFn = opts.API[ cmd ];
if ( $.isFunction( cmdFn )) {
cmdArgs = $.makeArray( args );
cmdArgs.shift();
return cmdFn.apply( opts.API, cmdArgs );
}
else {
c2.log( 'unknown command: ', cmd );
}
}
});
}
else {
return c2.apply( this, arguments );
}
};
// copy props
$.extend( $.fn.cycle, c2 );
$.extend( c2.API, {
next: function() {
var opts = this.opts();
if ( opts.busy && ! opts.manualTrump )
return;
var count = opts.reverse ? -1 : 1;
if ( opts.allowWrap === false && ( opts.currSlide + count ) >= opts.slideCount )
return;
opts.API.advanceSlide( count );
opts.API.trigger('cycle-next', [ opts ]).log('cycle-next');
},
prev: function() {
var opts = this.opts();
if ( opts.busy && ! opts.manualTrump )
return;
var count = opts.reverse ? 1 : -1;
if ( opts.allowWrap === false && ( opts.currSlide + count ) < 0 )
return;
opts.API.advanceSlide( count );
opts.API.trigger('cycle-prev', [ opts ]).log('cycle-prev');
},
destroy: function() {
this.stop(); //#204
var opts = this.opts();
var clean = $.isFunction( $._data ) ? $._data : $.noop; // hack for #184 and #201
clearTimeout(opts.timeoutId);
opts.timeoutId = 0;
opts.API.stop();
opts.API.trigger( 'cycle-destroyed', [ opts ] ).log('cycle-destroyed');
opts.container.removeData();
clean( opts.container[0], 'parsedAttrs', false );
// #75; remove inline styles
if ( ! opts.retainStylesOnDestroy ) {
opts.container.removeAttr( 'style' );
opts.slides.removeAttr( 'style' );
opts.slides.removeClass( opts.slideActiveClass );
}
opts.slides.each(function() {
var slide = $(this);
slide.removeData();
slide.removeClass( opts.slideClass );
clean( this, 'parsedAttrs', false );
});
},
jump: function( index, fx ) {
// go to the requested slide
var fwd;
var opts = this.opts();
if ( opts.busy && ! opts.manualTrump )
return;
var num = parseInt( index, 10 );
if (isNaN(num) || num < 0 || num >= opts.slides.length) {
opts.API.log('goto: invalid slide index: ' + num);
return;
}
if (num == opts.currSlide) {
opts.API.log('goto: skipping, already on slide', num);
return;
}
opts.nextSlide = num;
clearTimeout(opts.timeoutId);
opts.timeoutId = 0;
opts.API.log('goto: ', num, ' (zero-index)');
fwd = opts.currSlide < opts.nextSlide;
opts._tempFx = fx;
opts.API.prepareTx( true, fwd );
},
stop: function() {
var opts = this.opts();
var pauseObj = opts.container;
clearTimeout(opts.timeoutId);
opts.timeoutId = 0;
opts.API.stopTransition();
if ( opts.pauseOnHover ) {
if ( opts.pauseOnHover !== true )
pauseObj = $( opts.pauseOnHover );
pauseObj.off('mouseenter mouseleave');
}
opts.API.trigger('cycle-stopped', [ opts ]).log('cycle-stopped');
},
reinit: function() {
var opts = this.opts();
opts.API.destroy();
opts.container.cycle();
},
remove: function( index ) {
var opts = this.opts();
var slide, slideToRemove, slides = [], slideNum = 1;
for ( var i=0; i < opts.slides.length; i++ ) {
slide = opts.slides[i];
if ( i == index ) {
slideToRemove = slide;
}
else {
slides.push( slide );
$( slide ).data('cycle.opts').slideNum = slideNum;
slideNum++;
}
}
if ( slideToRemove ) {
opts.slides = $( slides );
opts.slideCount--;
$( slideToRemove ).remove();
if (index == opts.currSlide)
opts.API.advanceSlide( 1 );
else if ( index < opts.currSlide )
opts.currSlide--;
else
opts.currSlide++;
opts.API.trigger('cycle-slide-removed', [ opts, index, slideToRemove ]).log('cycle-slide-removed');
opts.API.updateView();
}
}
});
// listen for clicks on elements with data-cycle-cmd attribute
$(document).on('click.cycle', '[data-cycle-cmd]', function(e) {
// issue cycle command
e.preventDefault();
var el = $(this);
var command = el.data('cycle-cmd');
var context = el.data('cycle-context') || '.cycle-slideshow';
$(context).cycle(command, el.data('cycle-arg'));
});
})(jQuery);
/*! hash plugin for Cycle2; version: 20130905 */
(function($) {
"use strict";
$(document).on( 'cycle-pre-initialize', function( e, opts ) {
onHashChange( opts, true );
opts._onHashChange = function() {
onHashChange( opts, false );
};
$( window ).on( 'hashchange', opts._onHashChange);
});
$(document).on( 'cycle-update-view', function( e, opts, slideOpts ) {
if ( slideOpts.hash && ( '#' + slideOpts.hash ) != window.location.hash ) {
opts._hashFence = true;
window.location.hash = slideOpts.hash;
}
});
$(document).on( 'cycle-destroyed', function( e, opts) {
if ( opts._onHashChange ) {
$( window ).off( 'hashchange', opts._onHashChange );
}
});
function onHashChange( opts, setStartingSlide ) {
var hash;
if ( opts._hashFence ) {
opts._hashFence = false;
return;
}
hash = window.location.hash.substring(1);
opts.slides.each(function(i) {
if ( $(this).data( 'cycle-hash' ) == hash ) {
if ( setStartingSlide === true ) {
opts.startingSlide = i;
}
else {
var fwd = opts.currSlide < i;
opts.nextSlide = i;
opts.API.prepareTx( true, fwd );
}
return false;
}
});
}
})(jQuery);
/*! loader plugin for Cycle2; version: 20131121 */
(function($) {
"use strict";
$.extend($.fn.cycle.defaults, {
loader: false
});
$(document).on( 'cycle-bootstrap', function( e, opts ) {
var addFn;
if ( !opts.loader )
return;
// override API.add for this slideshow
addFn = opts.API.add;
opts.API.add = add;
function add( slides, prepend ) {
var slideArr = [];
if ( $.type( slides ) == 'string' )
slides = $.trim( slides );
else if ( $.type( slides) === 'array' ) {
for (var i=0; i < slides.length; i++ )
slides[i] = $(slides[i])[0];
}
slides = $( slides );
var slideCount = slides.length;
if ( ! slideCount )
return;
slides.css('visibility','hidden').appendTo('body').each(function(i) { // appendTo fixes #56
var count = 0;
var slide = $(this);
var images = slide.is('img') ? slide : slide.find('img');
slide.data('index', i);
// allow some images to be marked as unimportant (and filter out images w/o src value)
images = images.filter(':not(.cycle-loader-ignore)').filter(':not([src=""])');
if ( ! images.length ) {
--slideCount;
slideArr.push( slide );
return;
}
count = images.length;
images.each(function() {
// add images that are already loaded
if ( this.complete ) {
imageLoaded();
}
else {
$(this).load(function() {
imageLoaded();
}).on("error", function() {
if ( --count === 0 ) {
// ignore this slide
opts.API.log('slide skipped; img not loaded:', this.src);
if ( --slideCount === 0 && opts.loader == 'wait') {
addFn.apply( opts.API, [ slideArr, prepend ] );
}
}
});
}
});
function imageLoaded() {
if ( --count === 0 ) {
--slideCount;
addSlide( slide );
}
}
});
if ( slideCount )
opts.container.addClass('cycle-loading');
function addSlide( slide ) {
var curr;
if ( opts.loader == 'wait' ) {
slideArr.push( slide );
if ( slideCount === 0 ) {
// #59; sort slides into original markup order
slideArr.sort( sorter );
addFn.apply( opts.API, [ slideArr, prepend ] );
opts.container.removeClass('cycle-loading');
}
}
else {
curr = $(opts.slides[opts.currSlide]);
addFn.apply( opts.API, [ slide, prepend ] );
curr.show();
opts.container.removeClass('cycle-loading');
}
}
function sorter(a, b) {
return a.data('index') - b.data('index');
}
}
});
})(jQuery);
/*! pager plugin for Cycle2; version: 20140415 */
(function($) {
"use strict";
$.extend($.fn.cycle.defaults, {
pager: '> .cycle-pager',
pagerActiveClass: 'cycle-pager-active',
pagerEvent: 'click.cycle',
pagerEventBubble: undefined,
//pagerTemplate: '•'
pagerTemplate: '