").appendTo(e),s=e.uniqueId().attr("id");return this._addClass(i,"ui-tooltip-content"),this._addClass(e,"ui-tooltip","ui-widget ui-widget-content"),e.appendTo(this._appendTo(t)),this.tooltips[s]={element:t,tooltip:e}},_find:function(t){t=t.data("ui-tooltip-id");return t?this.tooltips[t]:null},_removeTooltip:function(t){clearInterval(this.delayedShow),t.remove(),delete this.tooltips[t.attr("id")]},_appendTo:function(t){t=t.closest(".ui-front, dialog");return t=!t.length?this.document[0].body:t},_destroy:function(){var s=this;V.each(this.tooltips,function(t,e){var i=V.Event("blur"),e=e.element;i.target=i.currentTarget=e[0],s.close(i,!0),V("#"+t).remove(),e.data("ui-tooltip-title")&&(e.attr("title")||e.attr("title",e.data("ui-tooltip-title")),e.removeData("ui-tooltip-title"))}),this.liveRegion.remove()}}),!1!==V.uiBackCompat&&V.widget("ui.tooltip",V.ui.tooltip,{options:{tooltipClass:null},_tooltip:function(){var t=this._superApply(arguments);return this.options.tooltipClass&&t.tooltip.addClass(this.options.tooltipClass),t}});V.ui.tooltip});
// jQuery UI END
/*
--------------------
Modules
--------------------
*/
/*! Magnific Popup - v0.9.9 - 2013-11-15
* http://dimsemenov.com/plugins/magnific-popup/
* Copyright (c) 2013 Dmitry Semenov; */
;(function($) {
/*>>core*/
/**
*
* Magnific Popup Core JS file
*
*/
/**
* Private static constants
*/
var CLOSE_EVENT = 'Close',
BEFORE_CLOSE_EVENT = 'BeforeClose',
AFTER_CLOSE_EVENT = 'AfterClose',
BEFORE_APPEND_EVENT = 'BeforeAppend',
MARKUP_PARSE_EVENT = 'MarkupParse',
OPEN_EVENT = 'Open',
CHANGE_EVENT = 'Change',
NS = 'mfp',
EVENT_NS = '.' + NS,
READY_CLASS = 'mfp-ready',
REMOVING_CLASS = 'mfp-removing',
PREVENT_CLOSE_CLASS = 'mfp-prevent-close';
/**
* Private vars
*/
var mfp, // As we have only one instance of MagnificPopup object, we define it locally to not to use 'this'
MagnificPopup = function(){},
_isJQ = !!(window.jQuery),
_prevStatus,
_window = $(window),
_body,
_document,
_prevContentType,
_wrapClasses,
_currPopupType;
/**
* Private functions
*/
var _mfpOn = function(name, f) {
mfp.ev.on(NS + name + EVENT_NS, f);
},
_getEl = function(className, appendTo, html, raw) {
var el = document.createElement('div');
el.className = 'mfp-'+className;
if(html) {
el.innerHTML = html;
}
if(!raw) {
el = $(el);
if(appendTo) {
el.appendTo(appendTo);
}
} else if(appendTo) {
appendTo.appendChild(el);
}
return el;
},
_mfpTrigger = function(e, data) {
mfp.ev.triggerHandler(NS + e, data);
if(mfp.st.callbacks) {
// converts "mfpEventName" to "eventName" callback and triggers it if it's present
e = e.charAt(0).toLowerCase() + e.slice(1);
if(mfp.st.callbacks[e]) {
mfp.st.callbacks[e].apply(mfp, $.isArray(data) ? data : [data]);
}
}
},
_getCloseBtn = function(type) {
if(type !== _currPopupType || !mfp.currTemplate.closeBtn) {
mfp.currTemplate.closeBtn = $( mfp.st.closeMarkup.replace('%title%', mfp.st.tClose ) );
_currPopupType = type;
}
return mfp.currTemplate.closeBtn;
},
// Initialize Magnific Popup only when called at least once
_checkInstance = function() {
if(!$.magnificPopup.instance) {
mfp = new MagnificPopup();
mfp.init();
$.magnificPopup.instance = mfp;
}
},
// CSS transition detection, http://stackoverflow.com/questions/7264899/detect-css-transitions-using-javascript-and-without-modernizr
supportsTransitions = function() {
var s = document.createElement('p').style, // 's' for style. better to create an element if body yet to exist
v = ['ms','O','Moz','Webkit']; // 'v' for vendor
if( s['transition'] !== undefined ) {
return true;
}
while( v.length ) {
if( v.pop() + 'Transition' in s ) {
return true;
}
}
return false;
};
/**
* Public functions
*/
MagnificPopup.prototype = {
constructor: MagnificPopup,
/**
* Initializes Magnific Popup plugin.
* This function is triggered only once when $.fn.magnificPopup or $.magnificPopup is executed
*/
init: function() {
var appVersion = navigator.appVersion;
mfp.isIE7 = appVersion.indexOf("MSIE 7.") !== -1;
mfp.isIE8 = appVersion.indexOf("MSIE 8.") !== -1;
mfp.isLowIE = mfp.isIE7 || mfp.isIE8;
mfp.isAndroid = (/android/gi).test(appVersion);
mfp.isIOS = (/iphone|ipad|ipod/gi).test(appVersion);
mfp.supportsTransition = supportsTransitions();
// We disable fixed positioned lightbox on devices that don't handle it nicely.
// If you know a better way of detecting this - let me know.
mfp.probablyMobile = (mfp.isAndroid || mfp.isIOS || /(Opera Mini)|Kindle|webOS|BlackBerry|(Opera Mobi)|(Windows Phone)|IEMobile/i.test(navigator.userAgent) );
_body = $(document.body);
_document = $(document);
mfp.popupsCache = {};
},
/**
* Opens popup
* @param data [description]
*/
open: function(data) {
var i;
if(data.isObj === false) {
// convert jQuery collection to array to avoid conflicts later
mfp.items = data.items.toArray();
mfp.index = 0;
var items = data.items,
item;
for(i = 0; i < items.length; i++) {
item = items[i];
if(item.parsed) {
item = item.el[0];
}
if(item === data.el[0]) {
mfp.index = i;
break;
}
}
} else {
mfp.items = $.isArray(data.items) ? data.items : [data.items];
mfp.index = data.index || 0;
}
// if popup is already opened - we just update the content
if(mfp.isOpen) {
mfp.updateItemHTML();
return;
}
mfp.types = [];
_wrapClasses = '';
if(data.mainEl && data.mainEl.length) {
mfp.ev = data.mainEl.eq(0);
} else {
mfp.ev = _document;
}
if(data.key) {
if(!mfp.popupsCache[data.key]) {
mfp.popupsCache[data.key] = {};
}
mfp.currTemplate = mfp.popupsCache[data.key];
} else {
mfp.currTemplate = {};
}
mfp.st = $.extend(true, {}, $.magnificPopup.defaults, data );
mfp.fixedContentPos = mfp.st.fixedContentPos === 'auto' ? !mfp.probablyMobile : mfp.st.fixedContentPos;
if(mfp.st.modal) {
mfp.st.closeOnContentClick = false;
mfp.st.closeOnBgClick = false;
mfp.st.showCloseBtn = false;
mfp.st.enableEscapeKey = false;
}
// Building markup
// main containers are created only once
if(!mfp.bgOverlay) {
// Dark overlay
mfp.bgOverlay = _getEl('bg').on('click'+EVENT_NS, function() {
mfp.close();
});
mfp.wrap = _getEl('wrap').attr('tabindex', -1).on('click'+EVENT_NS, function(e) {
if(mfp._checkIfClose(e.target)) {
mfp.close();
}
});
mfp.container = _getEl('container', mfp.wrap);
}
mfp.contentContainer = _getEl('content');
if(mfp.st.preloader) {
mfp.preloader = _getEl('preloader', mfp.container, mfp.st.tLoading);
}
// Initializing modules
var modules = $.magnificPopup.modules;
for(i = 0; i < modules.length; i++) {
var n = modules[i];
n = n.charAt(0).toUpperCase() + n.slice(1);
mfp['init'+n].call(mfp);
}
_mfpTrigger('BeforeOpen');
if(mfp.st.showCloseBtn) {
// Close button
if(!mfp.st.closeBtnInside) {
mfp.wrap.append( _getCloseBtn() );
} else {
_mfpOn(MARKUP_PARSE_EVENT, function(e, template, values, item) {
values.close_replaceWith = _getCloseBtn(item.type);
});
_wrapClasses += ' mfp-close-btn-in';
}
}
if(mfp.st.alignTop) {
_wrapClasses += ' mfp-align-top';
}
if(mfp.fixedContentPos) {
mfp.wrap.css({
overflow: mfp.st.overflowY,
overflowX: 'hidden',
overflowY: mfp.st.overflowY
});
} else {
mfp.wrap.css({
top: _window.scrollTop(),
position: 'absolute'
});
}
if( mfp.st.fixedBgPos === false || (mfp.st.fixedBgPos === 'auto' && !mfp.fixedContentPos) ) {
mfp.bgOverlay.css({
height: _document.height(),
position: 'absolute'
});
}
if(mfp.st.enableEscapeKey) {
// Close on ESC key
_document.on('keyup' + EVENT_NS, function(e) {
if(e.keyCode === 27) {
mfp.close();
}
});
}
_window.on('resize' + EVENT_NS, function() {
mfp.updateSize();
});
if(!mfp.st.closeOnContentClick) {
_wrapClasses += ' mfp-auto-cursor';
}
if(_wrapClasses)
mfp.wrap.addClass(_wrapClasses);
// this triggers recalculation of layout, so we get it once to not to trigger twice
var windowHeight = mfp.wH = _window.height();
var windowStyles = {};
if( mfp.fixedContentPos ) {
if(mfp._hasScrollBar(windowHeight)){
var s = mfp._getScrollbarSize();
if(s) {
windowStyles.marginRight = s;
}
}
}
if(mfp.fixedContentPos) {
if(!mfp.isIE7) {
windowStyles.overflow = 'hidden';
} else {
// ie7 double-scroll bug
$('body, html').css('overflow', 'hidden');
}
}
var classesToadd = mfp.st.mainClass;
if(mfp.isIE7) {
classesToadd += ' mfp-ie7';
}
if(classesToadd) {
mfp._addClassToMFP( classesToadd );
}
// add content
mfp.updateItemHTML();
_mfpTrigger('BuildControls');
// remove scrollbar, add margin e.t.c
$('html').css(windowStyles);
// add everything to DOM
mfp.bgOverlay.add(mfp.wrap).prependTo( document.body );
// Save last focused element
mfp._lastFocusedEl = document.activeElement;
// Wait for next cycle to allow CSS transition
setTimeout(function() {
if(mfp.content) {
mfp._addClassToMFP(READY_CLASS);
mfp._setFocus();
} else {
// if content is not defined (not loaded e.t.c) we add class only for BG
mfp.bgOverlay.addClass(READY_CLASS);
}
// Trap the focus in popup
_document.on('focusin' + EVENT_NS, mfp._onFocusIn);
}, 16);
mfp.isOpen = true;
mfp.updateSize(windowHeight);
_mfpTrigger(OPEN_EVENT);
return data;
},
/**
* Closes the popup
*/
close: function() {
if(!mfp.isOpen) return;
_mfpTrigger(BEFORE_CLOSE_EVENT);
mfp.isOpen = false;
// for CSS3 animation
if(mfp.st.removalDelay && !mfp.isLowIE && mfp.supportsTransition ) {
mfp._addClassToMFP(REMOVING_CLASS);
setTimeout(function() {
mfp._close();
}, mfp.st.removalDelay);
} else {
mfp._close();
}
},
/**
* Helper for close() function
*/
_close: function() {
_mfpTrigger(CLOSE_EVENT);
var classesToRemove = REMOVING_CLASS + ' ' + READY_CLASS + ' ';
mfp.bgOverlay.detach();
mfp.wrap.detach();
mfp.container.empty();
if(mfp.st.mainClass) {
classesToRemove += mfp.st.mainClass + ' ';
}
mfp._removeClassFromMFP(classesToRemove);
if(mfp.fixedContentPos) {
var windowStyles = {marginRight: ''};
if(mfp.isIE7) {
$('body, html').css('overflow', '');
} else {
windowStyles.overflow = '';
}
$('html').css(windowStyles);
}
_document.off('keyup' + EVENT_NS + ' focusin' + EVENT_NS);
mfp.ev.off(EVENT_NS);
// clean up DOM elements that aren't removed
mfp.wrap.attr('class', 'mfp-wrap').removeAttr('style');
mfp.bgOverlay.attr('class', 'mfp-bg');
mfp.container.attr('class', 'mfp-container');
// remove close button from target element
if(mfp.st.showCloseBtn &&
(!mfp.st.closeBtnInside || mfp.currTemplate[mfp.currItem.type] === true)) {
if(mfp.currTemplate.closeBtn)
mfp.currTemplate.closeBtn.detach();
}
if(mfp._lastFocusedEl) {
$(mfp._lastFocusedEl).focus(); // put tab focus back
}
mfp.currItem = null;
mfp.content = null;
mfp.currTemplate = null;
mfp.prevHeight = 0;
_mfpTrigger(AFTER_CLOSE_EVENT);
},
updateSize: function(winHeight) {
if(mfp.isIOS) {
// fixes iOS nav bars https://github.com/dimsemenov/Magnific-Popup/issues/2
var zoomLevel = document.documentElement.clientWidth / window.innerWidth;
var height = window.innerHeight * zoomLevel;
mfp.wrap.css('height', height);
mfp.wH = height;
} else {
mfp.wH = winHeight || _window.height();
}
// Fixes #84: popup incorrectly positioned with position:relative on body
if(!mfp.fixedContentPos) {
mfp.wrap.css('height', mfp.wH);
}
_mfpTrigger('Resize');
},
/**
* Set content of popup based on current index
*/
updateItemHTML: function() {
var item = mfp.items[mfp.index];
// Detach and perform modifications
mfp.contentContainer.detach();
if(mfp.content)
mfp.content.detach();
if(!item.parsed) {
item = mfp.parseEl( mfp.index );
}
var type = item.type;
_mfpTrigger('BeforeChange', [mfp.currItem ? mfp.currItem.type : '', type]);
// BeforeChange event works like so:
// _mfpOn('BeforeChange', function(e, prevType, newType) { });
mfp.currItem = item;
if(!mfp.currTemplate[type]) {
var markup = mfp.st[type] ? mfp.st[type].markup : false;
// allows to modify markup
_mfpTrigger('FirstMarkupParse', markup);
if(markup) {
mfp.currTemplate[type] = $(markup);
} else {
// if there is no markup found we just define that template is parsed
mfp.currTemplate[type] = true;
}
}
if(_prevContentType && _prevContentType !== item.type) {
mfp.container.removeClass('mfp-'+_prevContentType+'-holder');
}
var newContent = mfp['get' + type.charAt(0).toUpperCase() + type.slice(1)](item, mfp.currTemplate[type]);
mfp.appendContent(newContent, type);
item.preloaded = true;
_mfpTrigger(CHANGE_EVENT, item);
_prevContentType = item.type;
// Append container back after its content changed
mfp.container.prepend(mfp.contentContainer);
_mfpTrigger('AfterChange');
},
/**
* Set HTML content of popup
*/
appendContent: function(newContent, type) {
mfp.content = newContent;
if(newContent) {
if(mfp.st.showCloseBtn && mfp.st.closeBtnInside &&
mfp.currTemplate[type] === true) {
// if there is no markup, we just append close button element inside
if(!mfp.content.find('.mfp-close').length) {
mfp.content.append(_getCloseBtn());
}
} else {
mfp.content = newContent;
}
} else {
mfp.content = '';
}
_mfpTrigger(BEFORE_APPEND_EVENT);
mfp.container.addClass('mfp-'+type+'-holder');
mfp.contentContainer.append(mfp.content);
},
/**
* Creates Magnific Popup data object based on given data
* @param {int} index Index of item to parse
*/
parseEl: function(index) {
var item = mfp.items[index],
type = item.type;
if(item.tagName) {
item = { el: $(item) };
} else {
item = { data: item, src: item.src };
}
if(item.el) {
var types = mfp.types;
// check for 'mfp-TYPE' class
for(var i = 0; i < types.length; i++) {
if( item.el.hasClass('mfp-'+types[i]) ) {
type = types[i];
break;
}
}
item.src = item.el.attr('data-mfp-src');
if(!item.src) {
item.src = item.el.attr('href');
}
}
item.type = type || mfp.st.type || 'inline';
item.index = index;
item.parsed = true;
mfp.items[index] = item;
_mfpTrigger('ElementParse', item);
return mfp.items[index];
},
/**
* Initializes single popup or a group of popups
*/
addGroup: function(el, options) {
var eHandler = function(e) {
e.mfpEl = this;
mfp._openClick(e, el, options);
};
if(!options) {
options = {};
}
var eName = 'click.magnificPopup';
options.mainEl = el;
if(options.items) {
options.isObj = true;
el.off(eName).on(eName, eHandler);
} else {
options.isObj = false;
if(options.delegate) {
el.off(eName).on(eName, options.delegate , eHandler);
} else {
options.items = el;
el.off(eName).on(eName, eHandler);
}
}
},
_openClick: function(e, el, options) {
var midClick = options.midClick !== undefined ? options.midClick : $.magnificPopup.defaults.midClick;
if(!midClick && ( e.which === 2 || e.ctrlKey || e.metaKey ) ) {
return;
}
var disableOn = options.disableOn !== undefined ? options.disableOn : $.magnificPopup.defaults.disableOn;
if(disableOn) {
if($.isFunction(disableOn)) {
if( !disableOn.call(mfp) ) {
return true;
}
} else { // else it's number
if( _window.width() < disableOn ) {
return true;
}
}
}
if(e.type) {
e.preventDefault();
// This will prevent popup from closing if element is inside and popup is already opened
if(mfp.isOpen) {
e.stopPropagation();
}
}
options.el = $(e.mfpEl);
if(options.delegate) {
options.items = el.find(options.delegate);
}
mfp.open(options);
},
/**
* Updates text on preloader
*/
updateStatus: function(status, text) {
if(mfp.preloader) {
if(_prevStatus !== status) {
mfp.container.removeClass('mfp-s-'+_prevStatus);
}
if(!text && status === 'loading') {
text = mfp.st.tLoading;
}
var data = {
status: status,
text: text
};
// allows to modify status
_mfpTrigger('UpdateStatus', data);
status = data.status;
text = data.text;
mfp.preloader.html(text);
mfp.preloader.find('a').on('click', function(e) {
e.stopImmediatePropagation();
});
mfp.container.addClass('mfp-s-'+status);
_prevStatus = status;
}
},
/*
"Private" helpers that aren't private at all
*/
// Check to close popup or not
// "target" is an element that was clicked
_checkIfClose: function(target) {
if($(target).hasClass(PREVENT_CLOSE_CLASS)) {
return;
}
var closeOnContent = mfp.st.closeOnContentClick;
var closeOnBg = mfp.st.closeOnBgClick;
if(closeOnContent && closeOnBg) {
return true;
} else {
// We close the popup if click is on close button or on preloader. Or if there is no content.
if(!mfp.content || $(target).hasClass('mfp-close') || (mfp.preloader && target === mfp.preloader[0]) ) {
return true;
}
// if click is outside the content
if( (target !== mfp.content[0] && !$.contains(mfp.content[0], target)) ) {
if(closeOnBg) {
// last check, if the clicked element is in DOM, (in case it's removed onclick)
if( $.contains(document, target) ) {
return true;
}
}
} else if(closeOnContent) {
return true;
}
}
return false;
},
_addClassToMFP: function(cName) {
mfp.bgOverlay.addClass(cName);
mfp.wrap.addClass(cName);
},
_removeClassFromMFP: function(cName) {
this.bgOverlay.removeClass(cName);
mfp.wrap.removeClass(cName);
},
_hasScrollBar: function(winHeight) {
return ( (mfp.isIE7 ? _document.height() : document.body.scrollHeight) > (winHeight || _window.height()) );
},
_setFocus: function() {
(mfp.st.focus ? mfp.content.find(mfp.st.focus).eq(0) : mfp.wrap).focus();
},
_onFocusIn: function(e) {
if( e.target !== mfp.wrap[0] && !$.contains(mfp.wrap[0], e.target) ) {
mfp._setFocus();
return false;
}
},
_parseMarkup: function(template, values, item) {
var arr;
if(item.data) {
values = $.extend(item.data, values);
}
_mfpTrigger(MARKUP_PARSE_EVENT, [template, values, item] );
$.each(values, function(key, value) {
if(value === undefined || value === false) {
return true;
}
arr = key.split('_');
if(arr.length > 1) {
var el = template.find(EVENT_NS + '-'+arr[0]);
if(el.length > 0) {
var attr = arr[1];
if(attr === 'replaceWith') {
if(el[0] !== value[0]) {
el.replaceWith(value);
}
} else if(attr === 'img') {
if(el.is('img')) {
el.attr('src', value);
} else {
el.replaceWith( '
' );
}
} else {
el.attr(arr[1], value);
}
}
} else {
template.find(EVENT_NS + '-'+key).html(value);
}
});
},
_getScrollbarSize: function() {
// thx David
if(mfp.scrollbarSize === undefined) {
var scrollDiv = document.createElement("div");
scrollDiv.id = "mfp-sbm";
scrollDiv.style.cssText = 'width: 99px; height: 99px; overflow: scroll; position: absolute; top: -9999px;';
document.body.appendChild(scrollDiv);
mfp.scrollbarSize = scrollDiv.offsetWidth - scrollDiv.clientWidth;
document.body.removeChild(scrollDiv);
}
return mfp.scrollbarSize;
}
}; /* MagnificPopup core prototype end */
/**
* Public static functions
*/
$.magnificPopup = {
instance: null,
proto: MagnificPopup.prototype,
modules: [],
open: function(options, index) {
_checkInstance();
if(!options) {
options = {};
} else {
options = $.extend(true, {}, options);
}
options.isObj = true;
options.index = index || 0;
return this.instance.open(options);
},
close: function() {
return $.magnificPopup.instance && $.magnificPopup.instance.close();
},
registerModule: function(name, module) {
if(module.options) {
$.magnificPopup.defaults[name] = module.options;
}
$.extend(this.proto, module.proto);
this.modules.push(name);
},
defaults: {
// Info about options is in docs:
// http://dimsemenov.com/plugins/magnific-popup/documentation.html#options
disableOn: 0,
key: null,
midClick: false,
mainClass: '',
preloader: true,
focus: '', // CSS selector of input to focus after popup is opened
closeOnContentClick: false,
closeOnBgClick: true,
closeBtnInside: true,
showCloseBtn: true,
enableEscapeKey: true,
modal: false,
alignTop: false,
removalDelay: 0,
fixedContentPos: 'auto',
fixedBgPos: 'auto',
overflowY: 'auto',
closeMarkup: '
× ',
tClose: 'Close (Esc)',
tLoading: 'Loading...'
}
};
$.fn.magnificPopup = function(options) {
_checkInstance();
var jqEl = $(this);
// We call some API method of first param is a string
if (typeof options === "string" ) {
if(options === 'open') {
var items,
itemOpts = _isJQ ? jqEl.data('magnificPopup') : jqEl[0].magnificPopup,
index = parseInt(arguments[1], 10) || 0;
if(itemOpts.items) {
items = itemOpts.items[index];
} else {
items = jqEl;
if(itemOpts.delegate) {
items = items.find(itemOpts.delegate);
}
items = items.eq( index );
}
mfp._openClick({mfpEl:items}, jqEl, itemOpts);
} else {
if(mfp.isOpen)
mfp[options].apply(mfp, Array.prototype.slice.call(arguments, 1));
}
} else {
// clone options obj
options = $.extend(true, {}, options);
/*
* As Zepto doesn't support .data() method for objects
* and it works only in normal browsers
* we assign "options" object directly to the DOM element. FTW!
*/
if(_isJQ) {
jqEl.data('magnificPopup', options);
} else {
jqEl[0].magnificPopup = options;
}
mfp.addGroup(jqEl, options);
}
return jqEl;
};
//Quick benchmark
/*
var start = performance.now(),
i,
rounds = 1000;
for(i = 0; i < rounds; i++) {
}
console.log('Test #1:', performance.now() - start);
start = performance.now();
for(i = 0; i < rounds; i++) {
}
console.log('Test #2:', performance.now() - start);
*/
/*>>core*/
/*>>inline*/
var INLINE_NS = 'inline',
_hiddenClass,
_inlinePlaceholder,
_lastInlineElement,
_putInlineElementsBack = function() {
if(_lastInlineElement) {
_inlinePlaceholder.after( _lastInlineElement.addClass(_hiddenClass) ).detach();
_lastInlineElement = null;
}
};
$.magnificPopup.registerModule(INLINE_NS, {
options: {
hiddenClass: 'hide', // will be appended with `mfp-` prefix
markup: '',
tNotFound: 'Content not found'
},
proto: {
initInline: function() {
mfp.types.push(INLINE_NS);
_mfpOn(CLOSE_EVENT+'.'+INLINE_NS, function() {
_putInlineElementsBack();
});
},
getInline: function(item, template) {
_putInlineElementsBack();
if(item.src) {
var inlineSt = mfp.st.inline,
el = $(item.src);
if(el.length) {
// If target element has parent - we replace it with placeholder and put it back after popup is closed
var parent = el[0].parentNode;
if(parent && parent.tagName) {
if(!_inlinePlaceholder) {
_hiddenClass = inlineSt.hiddenClass;
_inlinePlaceholder = _getEl(_hiddenClass);
_hiddenClass = 'mfp-'+_hiddenClass;
}
// replace target inline element with placeholder
_lastInlineElement = el.after(_inlinePlaceholder).detach().removeClass(_hiddenClass);
}
mfp.updateStatus('ready');
} else {
mfp.updateStatus('error', inlineSt.tNotFound);
el = $('
');
}
item.inlineElement = el;
return el;
}
mfp.updateStatus('ready');
mfp._parseMarkup(template, {}, item);
return template;
}
}
});
/*>>inline*/
/*>>ajax*/
var AJAX_NS = 'ajax',
_ajaxCur,
_removeAjaxCursor = function() {
if(_ajaxCur) {
_body.removeClass(_ajaxCur);
}
},
_destroyAjaxRequest = function() {
_removeAjaxCursor();
if(mfp.req) {
mfp.req.abort();
}
};
$.magnificPopup.registerModule(AJAX_NS, {
options: {
settings: null,
cursor: 'mfp-ajax-cur',
tError: '
The content could not be loaded.'
},
proto: {
initAjax: function() {
mfp.types.push(AJAX_NS);
_ajaxCur = mfp.st.ajax.cursor;
_mfpOn(CLOSE_EVENT+'.'+AJAX_NS, _destroyAjaxRequest);
_mfpOn('BeforeChange.' + AJAX_NS, _destroyAjaxRequest);
},
getAjax: function(item) {
if(_ajaxCur)
_body.addClass(_ajaxCur);
mfp.updateStatus('loading');
var opts = $.extend({
url: item.src,
success: function(data, textStatus, jqXHR) {
var temp = {
data:data,
xhr:jqXHR
};
_mfpTrigger('ParseAjax', temp);
mfp.appendContent( $(temp.data), AJAX_NS );
item.finished = true;
_removeAjaxCursor();
mfp._setFocus();
setTimeout(function() {
mfp.wrap.addClass(READY_CLASS);
}, 16);
mfp.updateStatus('ready');
_mfpTrigger('AjaxContentAdded');
},
error: function() {
_removeAjaxCursor();
item.finished = item.loadError = true;
mfp.updateStatus('error', mfp.st.ajax.tError.replace('%url%', item.src));
}
}, mfp.st.ajax.settings);
mfp.req = $.ajax(opts);
return '';
}
}
});
/*>>ajax*/
/*>>image*/
var _imgInterval,
_getTitle = function(item) {
if(item.data && item.data.title !== undefined)
return item.data.title;
var src = mfp.st.image.titleSrc;
if(src) {
if($.isFunction(src)) {
return src.call(mfp, item);
} else if(item.el) {
return item.el.attr(src) || '';
}
}
return '';
};
$.magnificPopup.registerModule('image', {
options: {
markup: '
',
cursor: 'mfp-zoom-out-cur',
titleSrc: 'title',
verticalFit: true,
tError: '
The image could not be loaded.'
},
proto: {
initImage: function() {
var imgSt = mfp.st.image,
ns = '.image';
mfp.types.push('image');
_mfpOn(OPEN_EVENT+ns, function() {
if(mfp.currItem.type === 'image' && imgSt.cursor) {
_body.addClass(imgSt.cursor);
}
});
_mfpOn(CLOSE_EVENT+ns, function() {
if(imgSt.cursor) {
_body.removeClass(imgSt.cursor);
}
_window.off('resize' + EVENT_NS);
});
_mfpOn('Resize'+ns, mfp.resizeImage);
if(mfp.isLowIE) {
_mfpOn('AfterChange', mfp.resizeImage);
}
},
resizeImage: function() {
var item = mfp.currItem;
if(!item || !item.img) return;
if(mfp.st.image.verticalFit) {
var decr = 0;
// fix box-sizing in ie7/8
if(mfp.isLowIE) {
decr = parseInt(item.img.css('padding-top'), 10) + parseInt(item.img.css('padding-bottom'),10);
}
item.img.css('max-height', mfp.wH-decr);
}
},
_onImageHasSize: function(item) {
if(item.img) {
item.hasSize = true;
if(_imgInterval) {
clearInterval(_imgInterval);
}
item.isCheckingImgSize = false;
_mfpTrigger('ImageHasSize', item);
if(item.imgHidden) {
if(mfp.content)
mfp.content.removeClass('mfp-loading');
item.imgHidden = false;
}
}
},
/**
* Function that loops until the image has size to display elements that rely on it asap
*/
findImageSize: function(item) {
var counter = 0,
img = item.img[0],
mfpSetInterval = function(delay) {
if(_imgInterval) {
clearInterval(_imgInterval);
}
// decelerating interval that checks for size of an image
_imgInterval = setInterval(function() {
if(img.naturalWidth > 0) {
mfp._onImageHasSize(item);
return;
}
if(counter > 200) {
clearInterval(_imgInterval);
}
counter++;
if(counter === 3) {
mfpSetInterval(10);
} else if(counter === 40) {
mfpSetInterval(50);
} else if(counter === 100) {
mfpSetInterval(500);
}
}, delay);
};
mfpSetInterval(1);
},
getImage: function(item, template) {
var guard = 0,
// image load complete handler
onLoadComplete = function() {
if(item) {
if (item.img[0].complete) {
item.img.off('.mfploader');
if(item === mfp.currItem){
mfp._onImageHasSize(item);
mfp.updateStatus('ready');
}
item.hasSize = true;
item.loaded = true;
_mfpTrigger('ImageLoadComplete');
}
else {
// if image complete check fails 200 times (20 sec), we assume that there was an error.
guard++;
if(guard < 200) {
setTimeout(onLoadComplete,100);
} else {
onLoadError();
}
}
}
},
// image error handler
onLoadError = function() {
if(item) {
item.img.off('.mfploader');
if(item === mfp.currItem){
mfp._onImageHasSize(item);
mfp.updateStatus('error', imgSt.tError.replace('%url%', item.src) );
}
item.hasSize = true;
item.loaded = true;
item.loadError = true;
}
},
imgSt = mfp.st.image;
var el = template.find('.mfp-img');
if(el.length) {
var img = document.createElement('img');
img.className = 'mfp-img';
item.img = $(img).on('load.mfploader', onLoadComplete).on('error.mfploader', onLoadError);
img.src = item.src;
// without clone() "error" event is not firing when IMG is replaced by new IMG
// TODO: find a way to avoid such cloning
if(el.is('img')) {
item.img = item.img.clone();
}
if(item.img[0].naturalWidth > 0) {
item.hasSize = true;
}
}
mfp._parseMarkup(template, {
title: _getTitle(item),
img_replaceWith: item.img
}, item);
mfp.resizeImage();
if(item.hasSize) {
if(_imgInterval) clearInterval(_imgInterval);
if(item.loadError) {
template.addClass('mfp-loading');
mfp.updateStatus('error', imgSt.tError.replace('%url%', item.src) );
} else {
template.removeClass('mfp-loading');
mfp.updateStatus('ready');
}
return template;
}
mfp.updateStatus('loading');
item.loading = true;
if(!item.hasSize) {
item.imgHidden = true;
template.addClass('mfp-loading');
mfp.findImageSize(item);
}
return template;
}
}
});
/*>>image*/
/*>>zoom*/
var hasMozTransform,
getHasMozTransform = function() {
if(hasMozTransform === undefined) {
hasMozTransform = document.createElement('p').style.MozTransform !== undefined;
}
return hasMozTransform;
};
$.magnificPopup.registerModule('zoom', {
options: {
enabled: false,
easing: 'ease-in-out',
duration: 300,
opener: function(element) {
return element.is('img') ? element : element.find('img');
}
},
proto: {
initZoom: function() {
var zoomSt = mfp.st.zoom,
ns = '.zoom',
image;
if(!zoomSt.enabled || !mfp.supportsTransition) {
return;
}
var duration = zoomSt.duration,
getElToAnimate = function(image) {
var newImg = image.clone().removeAttr('style').removeAttr('class').addClass('mfp-animated-image'),
transition = 'all '+(zoomSt.duration/1000)+'s ' + zoomSt.easing,
cssObj = {
position: 'fixed',
zIndex: 9999,
left: 0,
top: 0,
'-webkit-backface-visibility': 'hidden'
},
t = 'transition';
cssObj['-webkit-'+t] = cssObj['-moz-'+t] = cssObj['-o-'+t] = cssObj[t] = transition;
newImg.css(cssObj);
return newImg;
},
showMainContent = function() {
mfp.content.css('visibility', 'visible');
},
openTimeout,
animatedImg;
_mfpOn('BuildControls'+ns, function() {
if(mfp._allowZoom()) {
clearTimeout(openTimeout);
mfp.content.css('visibility', 'hidden');
// Basically, all code below does is clones existing image, puts in on top of the current one and animated it
image = mfp._getItemToZoom();
if(!image) {
showMainContent();
return;
}
animatedImg = getElToAnimate(image);
animatedImg.css( mfp._getOffset() );
mfp.wrap.append(animatedImg);
openTimeout = setTimeout(function() {
animatedImg.css( mfp._getOffset( true ) );
openTimeout = setTimeout(function() {
showMainContent();
setTimeout(function() {
animatedImg.remove();
image = animatedImg = null;
_mfpTrigger('ZoomAnimationEnded');
}, 16); // avoid blink when switching images
}, duration); // this timeout equals animation duration
}, 16); // by adding this timeout we avoid short glitch at the beginning of animation
// Lots of timeouts...
}
});
_mfpOn(BEFORE_CLOSE_EVENT+ns, function() {
if(mfp._allowZoom()) {
clearTimeout(openTimeout);
mfp.st.removalDelay = duration;
if(!image) {
image = mfp._getItemToZoom();
if(!image) {
return;
}
animatedImg = getElToAnimate(image);
}
animatedImg.css( mfp._getOffset(true) );
mfp.wrap.append(animatedImg);
mfp.content.css('visibility', 'hidden');
setTimeout(function() {
animatedImg.css( mfp._getOffset() );
}, 16);
}
});
_mfpOn(CLOSE_EVENT+ns, function() {
if(mfp._allowZoom()) {
showMainContent();
if(animatedImg) {
animatedImg.remove();
}
image = null;
}
});
},
_allowZoom: function() {
return mfp.currItem.type === 'image';
},
_getItemToZoom: function() {
if(mfp.currItem.hasSize) {
return mfp.currItem.img;
} else {
return false;
}
},
// Get element postion relative to viewport
_getOffset: function(isLarge) {
var el;
if(isLarge) {
el = mfp.currItem.img;
} else {
el = mfp.st.zoom.opener(mfp.currItem.el || mfp.currItem);
}
var offset = el.offset();
var paddingTop = parseInt(el.css('padding-top'),10);
var paddingBottom = parseInt(el.css('padding-bottom'),10);
offset.top -= ( $(window).scrollTop() - paddingTop );
/*
Animating left + top + width/height looks glitchy in Firefox, but perfect in Chrome. And vice-versa.
*/
var obj = {
width: el.width(),
// fix Zepto height+padding issue
height: (_isJQ ? el.innerHeight() : el[0].offsetHeight) - paddingBottom - paddingTop
};
// I hate to do this, but there is no another option
if( getHasMozTransform() ) {
obj['-moz-transform'] = obj['transform'] = 'translate(' + offset.left + 'px,' + offset.top + 'px)';
} else {
obj.left = offset.left;
obj.top = offset.top;
}
return obj;
}
}
});
/*>>zoom*/
/*>>iframe*/
var IFRAME_NS = 'iframe',
_emptyPage = '//about:blank',
_fixIframeBugs = function(isShowing) {
if(mfp.currTemplate[IFRAME_NS]) {
var el = mfp.currTemplate[IFRAME_NS].find('iframe');
if(el.length) {
// reset src after the popup is closed to avoid "video keeps playing after popup is closed" bug
if(!isShowing) {
el[0].src = _emptyPage;
}
// IE8 black screen bug fix
if(mfp.isIE8) {
el.css('display', isShowing ? 'block' : 'none');
}
}
}
};
$.magnificPopup.registerModule(IFRAME_NS, {
options: {
markup: '
',
srcAction: 'iframe_src',
// we don't care and support only one default type of URL by default
patterns: {
youtube: {
index: 'youtube.com',
id: 'v=',
src: '//www.youtube.com/embed/%id%?autoplay=1'
},
vimeo: {
index: 'vimeo.com/',
id: '/',
src: '//player.vimeo.com/video/%id%?autoplay=1'
},
gmaps: {
index: '//maps.google.',
src: '%id%&output=embed'
}
}
},
proto: {
initIframe: function() {
mfp.types.push(IFRAME_NS);
_mfpOn('BeforeChange', function(e, prevType, newType) {
if(prevType !== newType) {
if(prevType === IFRAME_NS) {
_fixIframeBugs(); // iframe if removed
} else if(newType === IFRAME_NS) {
_fixIframeBugs(true); // iframe is showing
}
}// else {
// iframe source is switched, don't do anything
//}
});
_mfpOn(CLOSE_EVENT + '.' + IFRAME_NS, function() {
_fixIframeBugs();
});
},
getIframe: function(item, template) {
var embedSrc = item.src;
var iframeSt = mfp.st.iframe;
$.each(iframeSt.patterns, function() {
if(embedSrc.indexOf( this.index ) > -1) {
if(this.id) {
if(typeof this.id === 'string') {
embedSrc = embedSrc.substr(embedSrc.lastIndexOf(this.id)+this.id.length, embedSrc.length);
} else {
embedSrc = this.id.call( this, embedSrc );
}
}
embedSrc = this.src.replace('%id%', embedSrc );
return false; // break;
}
});
var dataObj = {};
if(iframeSt.srcAction) {
dataObj[iframeSt.srcAction] = embedSrc;
}
mfp._parseMarkup(template, dataObj, item);
mfp.updateStatus('ready');
return template;
}
}
});
/*>>iframe*/
/*>>gallery*/
/**
* Get looped index depending on number of slides
*/
var _getLoopedId = function(index) {
var numSlides = mfp.items.length;
if(index > numSlides - 1) {
return index - numSlides;
} else if(index < 0) {
return numSlides + index;
}
return index;
},
_replaceCurrTotal = function(text, curr, total) {
return text.replace(/%curr%/gi, curr + 1).replace(/%total%/gi, total);
};
$.magnificPopup.registerModule('gallery', {
options: {
enabled: false,
arrowMarkup: '
',
preload: [0,2],
navigateByImgClick: true,
arrows: true,
tPrev: 'Previous (Left arrow key)',
tNext: 'Next (Right arrow key)',
tCounter: '%curr% of %total%'
},
proto: {
initGallery: function() {
var gSt = mfp.st.gallery,
ns = '.mfp-gallery',
supportsFastClick = Boolean($.fn.mfpFastClick);
mfp.direction = true; // true - next, false - prev
if(!gSt || !gSt.enabled ) return false;
_wrapClasses += ' mfp-gallery';
_mfpOn(OPEN_EVENT+ns, function() {
if(gSt.navigateByImgClick) {
mfp.wrap.on('click'+ns, '.mfp-img', function() {
if(mfp.items.length > 1) {
mfp.next();
return false;
}
});
}
_document.on('keydown'+ns, function(e) {
if (e.keyCode === 37) {
mfp.prev();
} else if (e.keyCode === 39) {
mfp.next();
}
});
});
_mfpOn('UpdateStatus'+ns, function(e, data) {
if(data.text) {
data.text = _replaceCurrTotal(data.text, mfp.currItem.index, mfp.items.length);
}
});
_mfpOn(MARKUP_PARSE_EVENT+ns, function(e, element, values, item) {
var l = mfp.items.length;
values.counter = l > 1 ? _replaceCurrTotal(gSt.tCounter, item.index, l) : '';
});
_mfpOn('BuildControls' + ns, function() {
if(mfp.items.length > 1 && gSt.arrows && !mfp.arrowLeft) {
var markup = gSt.arrowMarkup,
arrowLeft = mfp.arrowLeft = $( markup.replace(/%title%/gi, gSt.tPrev).replace(/%dir%/gi, 'left') ).addClass(PREVENT_CLOSE_CLASS),
arrowRight = mfp.arrowRight = $( markup.replace(/%title%/gi, gSt.tNext).replace(/%dir%/gi, 'right') ).addClass(PREVENT_CLOSE_CLASS);
var eName = supportsFastClick ? 'mfpFastClick' : 'click';
arrowLeft[eName](function() {
mfp.prev();
});
arrowRight[eName](function() {
mfp.next();
});
// Polyfill for :before and :after (adds elements with classes mfp-a and mfp-b)
if(mfp.isIE7) {
_getEl('b', arrowLeft[0], false, true);
_getEl('a', arrowLeft[0], false, true);
_getEl('b', arrowRight[0], false, true);
_getEl('a', arrowRight[0], false, true);
}
mfp.container.append(arrowLeft.add(arrowRight));
}
});
_mfpOn(CHANGE_EVENT+ns, function() {
if(mfp._preloadTimeout) clearTimeout(mfp._preloadTimeout);
mfp._preloadTimeout = setTimeout(function() {
mfp.preloadNearbyImages();
mfp._preloadTimeout = null;
}, 16);
});
_mfpOn(CLOSE_EVENT+ns, function() {
_document.off(ns);
mfp.wrap.off('click'+ns);
if(mfp.arrowLeft && supportsFastClick) {
mfp.arrowLeft.add(mfp.arrowRight).destroyMfpFastClick();
}
mfp.arrowRight = mfp.arrowLeft = null;
});
},
next: function() {
mfp.direction = true;
mfp.index = _getLoopedId(mfp.index + 1);
mfp.updateItemHTML();
},
prev: function() {
mfp.direction = false;
mfp.index = _getLoopedId(mfp.index - 1);
mfp.updateItemHTML();
},
goTo: function(newIndex) {
mfp.direction = (newIndex >= mfp.index);
mfp.index = newIndex;
mfp.updateItemHTML();
},
preloadNearbyImages: function() {
var p = mfp.st.gallery.preload,
preloadBefore = Math.min(p[0], mfp.items.length),
preloadAfter = Math.min(p[1], mfp.items.length),
i;
for(i = 1; i <= (mfp.direction ? preloadAfter : preloadBefore); i++) {
mfp._preloadItem(mfp.index+i);
}
for(i = 1; i <= (mfp.direction ? preloadBefore : preloadAfter); i++) {
mfp._preloadItem(mfp.index-i);
}
},
_preloadItem: function(index) {
index = _getLoopedId(index);
if(mfp.items[index].preloaded) {
return;
}
var item = mfp.items[index];
if(!item.parsed) {
item = mfp.parseEl( index );
}
_mfpTrigger('LazyLoad', item);
if(item.type === 'image') {
item.img = $('
').on('load.mfploader', function() {
item.hasSize = true;
}).on('error.mfploader', function() {
item.hasSize = true;
item.loadError = true;
_mfpTrigger('LazyLoadError', item);
}).attr('src', item.src);
}
item.preloaded = true;
}
}
});
/*
Touch Support that might be implemented some day
addSwipeGesture: function() {
var startX,
moved,
multipleTouches;
return;
var namespace = '.mfp',
addEventNames = function(pref, down, move, up, cancel) {
mfp._tStart = pref + down + namespace;
mfp._tMove = pref + move + namespace;
mfp._tEnd = pref + up + namespace;
mfp._tCancel = pref + cancel + namespace;
};
if(window.navigator.msPointerEnabled) {
addEventNames('MSPointer', 'Down', 'Move', 'Up', 'Cancel');
} else if('ontouchstart' in window) {
addEventNames('touch', 'start', 'move', 'end', 'cancel');
} else {
return;
}
_window.on(mfp._tStart, function(e) {
var oE = e.originalEvent;
multipleTouches = moved = false;
startX = oE.pageX || oE.changedTouches[0].pageX;
}).on(mfp._tMove, function(e) {
if(e.originalEvent.touches.length > 1) {
multipleTouches = e.originalEvent.touches.length;
} else {
//e.preventDefault();
moved = true;
}
}).on(mfp._tEnd + ' ' + mfp._tCancel, function(e) {
if(moved && !multipleTouches) {
var oE = e.originalEvent,
diff = startX - (oE.pageX || oE.changedTouches[0].pageX);
if(diff > 20) {
mfp.next();
} else if(diff < -20) {
mfp.prev();
}
}
});
},
*/
/*>>gallery*/
/*>>retina*/
var RETINA_NS = 'retina';
$.magnificPopup.registerModule(RETINA_NS, {
options: {
replaceSrc: function(item) {
return item.src.replace(/\.\w+$/, function(m) { return '@2x' + m; });
},
ratio: 1 // Function or number. Set to 1 to disable.
},
proto: {
initRetina: function() {
if(window.devicePixelRatio > 1) {
var st = mfp.st.retina,
ratio = st.ratio;
ratio = !isNaN(ratio) ? ratio : ratio();
if(ratio > 1) {
_mfpOn('ImageHasSize' + '.' + RETINA_NS, function(e, item) {
item.img.css({
'max-width': item.img[0].naturalWidth / ratio,
'width': '100%'
});
});
_mfpOn('ElementParse' + '.' + RETINA_NS, function(e, item) {
item.src = st.replaceSrc(item, ratio);
});
}
}
}
}
});
/*>>retina*/
/*>>fastclick*/
/**
* FastClick event implementation. (removes 300ms delay on touch devices)
* Based on https://developers.google.com/mobile/articles/fast_buttons
*
* You may use it outside the Magnific Popup by calling just:
*
* $('.your-el').mfpFastClick(function() {
* console.log('Clicked!');
* });
*
* To unbind:
* $('.your-el').destroyMfpFastClick();
*
*
* Note that it's a very basic and simple implementation, it blocks ghost click on the same element where it was bound.
* If you need something more advanced, use plugin by FT Labs https://github.com/ftlabs/fastclick
*
*/
(function() {
var ghostClickDelay = 1000,
supportsTouch = 'ontouchstart' in window,
unbindTouchMove = function() {
_window.off('touchmove'+ns+' touchend'+ns);
},
eName = 'mfpFastClick',
ns = '.'+eName;
// As Zepto.js doesn't have an easy way to add custom events (like jQuery), so we implement it in this way
$.fn.mfpFastClick = function(callback) {
return $(this).each(function() {
var elem = $(this),
lock;
if( supportsTouch ) {
var timeout,
startX,
startY,
pointerMoved,
point,
numPointers;
elem.on('touchstart' + ns, function(e) {
pointerMoved = false;
numPointers = 1;
point = e.originalEvent ? e.originalEvent.touches[0] : e.touches[0];
startX = point.clientX;
startY = point.clientY;
_window.on('touchmove'+ns, function(e) {
point = e.originalEvent ? e.originalEvent.touches : e.touches;
numPointers = point.length;
point = point[0];
if (Math.abs(point.clientX - startX) > 10 ||
Math.abs(point.clientY - startY) > 10) {
pointerMoved = true;
unbindTouchMove();
}
}).on('touchend'+ns, function(e) {
unbindTouchMove();
if(pointerMoved || numPointers > 1) {
return;
}
lock = true;
e.preventDefault();
clearTimeout(timeout);
timeout = setTimeout(function() {
lock = false;
}, ghostClickDelay);
callback();
});
});
}
elem.on('click' + ns, function() {
if(!lock) {
callback();
}
});
});
};
$.fn.destroyMfpFastClick = function() {
$(this).off('touchstart' + ns + ' click' + ns);
if(supportsTouch) _window.off('touchmove'+ns+' touchend'+ns);
};
})();
/*>>fastclick*/
_checkInstance(); })(window.jQuery || window.Zepto);
/*
_ _ _ _
___| (_) ___| | __ (_)___
/ __| | |/ __| |/ / | / __|
\__ \ | | (__| < _ | \__ \
|___/_|_|\___|_|\_(_)/ |___/
|__/
Version: 1.5.8
Author: Ken Wheeler
Website: http://kenwheeler.github.io
Docs: http://kenwheeler.github.io/slick
Repo: http://github.com/kenwheeler/slick
Issues: http://github.com/kenwheeler/slick/issues
*/
/* global window, document, define, jQuery, setInterval, clearInterval */
(function(factory) {
'use strict';
if (typeof define === 'function' && define.amd) {
define(['jquery'], factory);
} else if (typeof exports !== 'undefined') {
module.exports = factory(require('jquery'));
} else {
factory(jQuery);
}
}(function($) {
'use strict';
var Slick = window.Slick || {};
Slick = (function() {
var instanceUid = 0;
function Slick(element, settings) {
var _ = this, dataSettings;
_.defaults = {
accessibility: true,
adaptiveHeight: false,
appendArrows: $(element),
appendDots: $(element),
arrows: true,
asNavFor: null,
prevArrow: '
Previous ',
nextArrow: '
Next ',
autoplay: false,
autoplaySpeed: 3000,
centerMode: false,
centerPadding: '50px',
cssEase: 'ease',
customPaging: function(slider, i) {
return '
' + (i + 1) + ' ';
},
dots: false,
dotsClass: 'slick-dots',
draggable: true,
easing: 'linear',
edgeFriction: 0.35,
fade: false,
focusOnSelect: false,
infinite: true,
initialSlide: 0,
lazyLoad: 'ondemand',
mobileFirst: false,
pauseOnHover: true,
pauseOnDotsHover: false,
respondTo: 'window',
responsive: null,
rows: 1,
rtl: false,
slide: '',
slidesPerRow: 1,
slidesToShow: 1,
slidesToScroll: 1,
speed: 500,
swipe: true,
swipeToSlide: false,
touchMove: true,
touchThreshold: 5,
useCSS: true,
variableWidth: false,
vertical: false,
verticalSwiping: false,
waitForAnimate: true,
zIndex: 1000
};
_.initials = {
animating: false,
dragging: false,
autoPlayTimer: null,
currentDirection: 0,
currentLeft: null,
currentSlide: 0,
direction: 1,
$dots: null,
listWidth: null,
listHeight: null,
loadIndex: 0,
$nextArrow: null,
$prevArrow: null,
slideCount: null,
slideWidth: null,
$slideTrack: null,
$slides: null,
sliding: false,
slideOffset: 0,
swipeLeft: null,
$list: null,
touchObject: {},
transformsEnabled: false,
unslicked: false
};
$.extend(_, _.initials);
_.activeBreakpoint = null;
_.animType = null;
_.animProp = null;
_.breakpoints = [];
_.breakpointSettings = [];
_.cssTransitions = false;
_.hidden = 'hidden';
_.paused = false;
_.positionProp = null;
_.respondTo = null;
_.rowCount = 1;
_.shouldClick = true;
_.$slider = $(element);
_.$slidesCache = null;
_.transformType = null;
_.transitionType = null;
_.visibilityChange = 'visibilitychange';
_.windowWidth = 0;
_.windowTimer = null;
dataSettings = $(element).data('slick') || {};
_.options = $.extend({}, _.defaults, dataSettings, settings);
_.currentSlide = _.options.initialSlide;
_.originalSettings = _.options;
if (typeof document.mozHidden !== 'undefined') {
_.hidden = 'mozHidden';
_.visibilityChange = 'mozvisibilitychange';
} else if (typeof document.webkitHidden !== 'undefined') {
_.hidden = 'webkitHidden';
_.visibilityChange = 'webkitvisibilitychange';
}
_.autoPlay = $.proxy(_.autoPlay, _);
_.autoPlayClear = $.proxy(_.autoPlayClear, _);
_.changeSlide = $.proxy(_.changeSlide, _);
_.clickHandler = $.proxy(_.clickHandler, _);
_.selectHandler = $.proxy(_.selectHandler, _);
_.setPosition = $.proxy(_.setPosition, _);
_.swipeHandler = $.proxy(_.swipeHandler, _);
_.dragHandler = $.proxy(_.dragHandler, _);
_.keyHandler = $.proxy(_.keyHandler, _);
_.autoPlayIterator = $.proxy(_.autoPlayIterator, _);
_.instanceUid = instanceUid++;
// A simple way to check for HTML strings
// Strict HTML recognition (must start with <)
// Extracted from jQuery v1.11 source
_.htmlExpr = /^(?:\s*(<[\w\W]+>)[^>]*)$/;
_.registerBreakpoints();
_.init(true);
_.checkResponsive(true);
}
return Slick;
}());
Slick.prototype.addSlide = Slick.prototype.slickAdd = function(markup, index, addBefore) {
var _ = this;
if (typeof(index) === 'boolean') {
addBefore = index;
index = null;
} else if (index < 0 || (index >= _.slideCount)) {
return false;
}
_.unload();
if (typeof(index) === 'number') {
if (index === 0 && _.$slides.length === 0) {
$(markup).appendTo(_.$slideTrack);
} else if (addBefore) {
$(markup).insertBefore(_.$slides.eq(index));
} else {
$(markup).insertAfter(_.$slides.eq(index));
}
} else {
if (addBefore === true) {
$(markup).prependTo(_.$slideTrack);
} else {
$(markup).appendTo(_.$slideTrack);
}
}
_.$slides = _.$slideTrack.children(this.options.slide);
_.$slideTrack.children(this.options.slide).detach();
_.$slideTrack.append(_.$slides);
_.$slides.each(function(index, element) {
$(element).attr('data-slick-index', index);
});
_.$slidesCache = _.$slides;
_.reinit();
};
Slick.prototype.animateHeight = function() {
var _ = this;
if (_.options.slidesToShow === 1 && _.options.adaptiveHeight === true && _.options.vertical === false) {
var targetHeight = _.$slides.eq(_.currentSlide).outerHeight(true);
_.$list.animate({
height: targetHeight
}, _.options.speed);
}
};
Slick.prototype.animateSlide = function(targetLeft, callback) {
var animProps = {},
_ = this;
_.animateHeight();
if (_.options.rtl === true && _.options.vertical === false) {
targetLeft = -targetLeft;
}
if (_.transformsEnabled === false) {
if (_.options.vertical === false) {
_.$slideTrack.animate({
left: targetLeft
}, _.options.speed, _.options.easing, callback);
} else {
_.$slideTrack.animate({
top: targetLeft
}, _.options.speed, _.options.easing, callback);
}
} else {
if (_.cssTransitions === false) {
if (_.options.rtl === true) {
_.currentLeft = -(_.currentLeft);
}
$({
animStart: _.currentLeft
}).animate({
animStart: targetLeft
}, {
duration: _.options.speed,
easing: _.options.easing,
step: function(now) {
now = Math.ceil(now);
if (_.options.vertical === false) {
animProps[_.animType] = 'translate(' +
now + 'px, 0px)';
_.$slideTrack.css(animProps);
} else {
animProps[_.animType] = 'translate(0px,' +
now + 'px)';
_.$slideTrack.css(animProps);
}
},
complete: function() {
if (callback) {
callback.call();
}
}
});
} else {
_.applyTransition();
targetLeft = Math.ceil(targetLeft);
if (_.options.vertical === false) {
animProps[_.animType] = 'translate3d(' + targetLeft + 'px, 0px, 0px)';
} else {
animProps[_.animType] = 'translate3d(0px,' + targetLeft + 'px, 0px)';
}
_.$slideTrack.css(animProps);
if (callback) {
setTimeout(function() {
_.disableTransition();
callback.call();
}, _.options.speed);
}
}
}
};
Slick.prototype.asNavFor = function(index) {
var _ = this,
asNavFor = _.options.asNavFor;
if ( asNavFor && asNavFor !== null ) {
asNavFor = $(asNavFor).not(_.$slider);
}
if ( asNavFor !== null && typeof asNavFor === 'object' ) {
asNavFor.each(function() {
var target = $(this).slick('getSlick');
if(!target.unslicked) {
target.slideHandler(index, true);
}
});
}
};
Slick.prototype.applyTransition = function(slide) {
var _ = this,
transition = {};
if (_.options.fade === false) {
transition[_.transitionType] = _.transformType + ' ' + _.options.speed + 'ms ' + _.options.cssEase;
} else {
transition[_.transitionType] = 'opacity ' + _.options.speed + 'ms ' + _.options.cssEase;
}
if (_.options.fade === false) {
_.$slideTrack.css(transition);
} else {
_.$slides.eq(slide).css(transition);
}
};
Slick.prototype.autoPlay = function() {
var _ = this;
if (_.autoPlayTimer) {
clearInterval(_.autoPlayTimer);
}
if (_.slideCount > _.options.slidesToShow && _.paused !== true) {
_.autoPlayTimer = setInterval(_.autoPlayIterator,
_.options.autoplaySpeed);
}
};
Slick.prototype.autoPlayClear = function() {
var _ = this;
if (_.autoPlayTimer) {
clearInterval(_.autoPlayTimer);
}
};
Slick.prototype.autoPlayIterator = function() {
var _ = this;
if (_.options.infinite === false) {
if (_.direction === 1) {
if ((_.currentSlide + 1) === _.slideCount -
1) {
_.direction = 0;
}
_.slideHandler(_.currentSlide + _.options.slidesToScroll);
} else {
if ((_.currentSlide - 1 === 0)) {
_.direction = 1;
}
_.slideHandler(_.currentSlide - _.options.slidesToScroll);
}
} else {
_.slideHandler(_.currentSlide + _.options.slidesToScroll);
}
};
Slick.prototype.buildArrows = function() {
var _ = this;
if (_.options.arrows === true ) {
_.$prevArrow = $(_.options.prevArrow).addClass('slick-arrow');
_.$nextArrow = $(_.options.nextArrow).addClass('slick-arrow');
if( _.slideCount > _.options.slidesToShow ) {
_.$prevArrow.removeClass('slick-hidden').removeAttr('aria-hidden tabindex');
_.$nextArrow.removeClass('slick-hidden').removeAttr('aria-hidden tabindex');
if (_.htmlExpr.test(_.options.prevArrow)) {
_.$prevArrow.prependTo(_.options.appendArrows);
}
if (_.htmlExpr.test(_.options.nextArrow)) {
_.$nextArrow.appendTo(_.options.appendArrows);
}
if (_.options.infinite !== true) {
_.$prevArrow
.addClass('slick-disabled')
.attr('aria-disabled', 'true');
}
} else {
_.$prevArrow.add( _.$nextArrow )
.addClass('slick-hidden')
.attr({
'aria-disabled': 'true',
'tabindex': '-1'
});
}
}
};
Slick.prototype.buildDots = function() {
var _ = this,
i, dotString;
if (_.options.dots === true && _.slideCount > _.options.slidesToShow) {
dotString = '
';
for (i = 0; i <= _.getDotCount(); i += 1) {
dotString += '' + _.options.customPaging.call(this, _, i) + ' ';
}
dotString += ' ';
_.$dots = $(dotString).appendTo(
_.options.appendDots);
_.$dots.find('li').first().addClass('slick-active').attr('aria-hidden', 'false');
}
};
Slick.prototype.buildOut = function() {
var _ = this;
_.$slides =
_.$slider
.children( _.options.slide + ':not(.slick-cloned)')
.addClass('slick-slide');
_.slideCount = _.$slides.length;
_.$slides.each(function(index, element) {
$(element)
.attr('data-slick-index', index)
.data('originalStyling', $(element).attr('style') || '');
});
_.$slidesCache = _.$slides;
_.$slider.addClass('slick-slider');
_.$slideTrack = (_.slideCount === 0) ?
$('
').appendTo(_.$slider) :
_.$slides.wrapAll('
').parent();
_.$list = _.$slideTrack.wrap(
'
').parent();
_.$slideTrack.css('opacity', 0);
if (_.options.centerMode === true || _.options.swipeToSlide === true) {
_.options.slidesToScroll = 1;
}
$('img[data-lazy]', _.$slider).not('[src]').addClass('slick-loading');
_.setupInfinite();
_.buildArrows();
_.buildDots();
_.updateDots();
_.setSlideClasses(typeof _.currentSlide === 'number' ? _.currentSlide : 0);
if (_.options.draggable === true) {
_.$list.addClass('draggable');
}
};
Slick.prototype.buildRows = function() {
var _ = this, a, b, c, newSlides, numOfSlides, originalSlides,slidesPerSection;
newSlides = document.createDocumentFragment();
originalSlides = _.$slider.children();
if(_.options.rows > 1) {
slidesPerSection = _.options.slidesPerRow * _.options.rows;
numOfSlides = Math.ceil(
originalSlides.length / slidesPerSection
);
for(a = 0; a < numOfSlides; a++){
var slide = document.createElement('div');
for(b = 0; b < _.options.rows; b++) {
var row = document.createElement('div');
for(c = 0; c < _.options.slidesPerRow; c++) {
var target = (a * slidesPerSection + ((b * _.options.slidesPerRow) + c));
if (originalSlides.get(target)) {
row.appendChild(originalSlides.get(target));
}
}
slide.appendChild(row);
}
newSlides.appendChild(slide);
}
_.$slider.html(newSlides);
_.$slider.children().children().children()
.css({
'width':(100 / _.options.slidesPerRow) + '%',
'display': 'inline-block'
});
}
};
Slick.prototype.checkResponsive = function(initial, forceUpdate) {
var _ = this,
breakpoint, targetBreakpoint, respondToWidth, triggerBreakpoint = false;
var sliderWidth = _.$slider.width();
var windowWidth = window.innerWidth || $(window).width();
if (_.respondTo === 'window') {
respondToWidth = windowWidth;
} else if (_.respondTo === 'slider') {
respondToWidth = sliderWidth;
} else if (_.respondTo === 'min') {
respondToWidth = Math.min(windowWidth, sliderWidth);
}
if ( _.options.responsive &&
_.options.responsive.length &&
_.options.responsive !== null) {
targetBreakpoint = null;
for (breakpoint in _.breakpoints) {
if (_.breakpoints.hasOwnProperty(breakpoint)) {
if (_.originalSettings.mobileFirst === false) {
if (respondToWidth < _.breakpoints[breakpoint]) {
targetBreakpoint = _.breakpoints[breakpoint];
}
} else {
if (respondToWidth > _.breakpoints[breakpoint]) {
targetBreakpoint = _.breakpoints[breakpoint];
}
}
}
}
if (targetBreakpoint !== null) {
if (_.activeBreakpoint !== null) {
if (targetBreakpoint !== _.activeBreakpoint || forceUpdate) {
_.activeBreakpoint =
targetBreakpoint;
if (_.breakpointSettings[targetBreakpoint] === 'unslick') {
_.unslick(targetBreakpoint);
} else {
_.options = $.extend({}, _.originalSettings,
_.breakpointSettings[
targetBreakpoint]);
if (initial === true) {
_.currentSlide = _.options.initialSlide;
}
_.refresh(initial);
}
triggerBreakpoint = targetBreakpoint;
}
} else {
_.activeBreakpoint = targetBreakpoint;
if (_.breakpointSettings[targetBreakpoint] === 'unslick') {
_.unslick(targetBreakpoint);
} else {
_.options = $.extend({}, _.originalSettings,
_.breakpointSettings[
targetBreakpoint]);
if (initial === true) {
_.currentSlide = _.options.initialSlide;
}
_.refresh(initial);
}
triggerBreakpoint = targetBreakpoint;
}
} else {
if (_.activeBreakpoint !== null) {
_.activeBreakpoint = null;
_.options = _.originalSettings;
if (initial === true) {
_.currentSlide = _.options.initialSlide;
}
_.refresh(initial);
triggerBreakpoint = targetBreakpoint;
}
}
// only trigger breakpoints during an actual break. not on initialize.
if( !initial && triggerBreakpoint !== false ) {
_.$slider.trigger('breakpoint', [_, triggerBreakpoint]);
}
}
};
Slick.prototype.changeSlide = function(event, dontAnimate) {
var _ = this,
$target = $(event.target),
indexOffset, slideOffset, unevenOffset;
// If target is a link, prevent default action.
if($target.is('a')) {
event.preventDefault();
}
// If target is not the
element (ie: a child), find the .
if(!$target.is('li')) {
$target = $target.closest('li');
}
unevenOffset = (_.slideCount % _.options.slidesToScroll !== 0);
indexOffset = unevenOffset ? 0 : (_.slideCount - _.currentSlide) % _.options.slidesToScroll;
switch (event.data.message) {
case 'previous':
slideOffset = indexOffset === 0 ? _.options.slidesToScroll : _.options.slidesToShow - indexOffset;
if (_.slideCount > _.options.slidesToShow) {
_.slideHandler(_.currentSlide - slideOffset, false, dontAnimate);
}
break;
case 'next':
slideOffset = indexOffset === 0 ? _.options.slidesToScroll : indexOffset;
if (_.slideCount > _.options.slidesToShow) {
_.slideHandler(_.currentSlide + slideOffset, false, dontAnimate);
}
break;
case 'index':
var index = event.data.index === 0 ? 0 :
event.data.index || $target.index() * _.options.slidesToScroll;
_.slideHandler(_.checkNavigable(index), false, dontAnimate);
$target.children().trigger('focus');
break;
default:
return;
}
};
Slick.prototype.checkNavigable = function(index) {
var _ = this,
navigables, prevNavigable;
navigables = _.getNavigableIndexes();
prevNavigable = 0;
if (index > navigables[navigables.length - 1]) {
index = navigables[navigables.length - 1];
} else {
for (var n in navigables) {
if (index < navigables[n]) {
index = prevNavigable;
break;
}
prevNavigable = navigables[n];
}
}
return index;
};
Slick.prototype.cleanUpEvents = function() {
var _ = this;
if (_.options.dots && _.$dots !== null) {
$('li', _.$dots).off('click.slick', _.changeSlide);
if (_.options.pauseOnDotsHover === true && _.options.autoplay === true) {
$('li', _.$dots)
.off('mouseenter.slick', $.proxy(_.setPaused, _, true))
.off('mouseleave.slick', $.proxy(_.setPaused, _, false));
}
}
if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) {
_.$prevArrow && _.$prevArrow.off('click.slick', _.changeSlide);
_.$nextArrow && _.$nextArrow.off('click.slick', _.changeSlide);
}
_.$list.off('touchstart.slick mousedown.slick', _.swipeHandler);
_.$list.off('touchmove.slick mousemove.slick', _.swipeHandler);
_.$list.off('touchend.slick mouseup.slick', _.swipeHandler);
_.$list.off('touchcancel.slick mouseleave.slick', _.swipeHandler);
_.$list.off('click.slick', _.clickHandler);
$(document).off(_.visibilityChange, _.visibility);
_.$list.off('mouseenter.slick', $.proxy(_.setPaused, _, true));
_.$list.off('mouseleave.slick', $.proxy(_.setPaused, _, false));
if (_.options.accessibility === true) {
_.$list.off('keydown.slick', _.keyHandler);
}
if (_.options.focusOnSelect === true) {
$(_.$slideTrack).children().off('click.slick', _.selectHandler);
}
$(window).off('orientationchange.slick.slick-' + _.instanceUid, _.orientationChange);
$(window).off('resize.slick.slick-' + _.instanceUid, _.resize);
$('[draggable!=true]', _.$slideTrack).off('dragstart', _.preventDefault);
$(window).off('load.slick.slick-' + _.instanceUid, _.setPosition);
$(document).off('ready.slick.slick-' + _.instanceUid, _.setPosition);
};
Slick.prototype.cleanUpRows = function() {
var _ = this, originalSlides;
if(_.options.rows > 1) {
originalSlides = _.$slides.children().children();
originalSlides.removeAttr('style');
_.$slider.html(originalSlides);
}
};
Slick.prototype.clickHandler = function(event) {
var _ = this;
if (_.shouldClick === false) {
event.stopImmediatePropagation();
event.stopPropagation();
event.preventDefault();
}
};
Slick.prototype.destroy = function(refresh) {
var _ = this;
_.autoPlayClear();
_.touchObject = {};
_.cleanUpEvents();
$('.slick-cloned', _.$slider).detach();
if (_.$dots) {
_.$dots.remove();
}
if ( _.$prevArrow && _.$prevArrow.length ) {
_.$prevArrow
.removeClass('slick-disabled slick-arrow slick-hidden')
.removeAttr('aria-hidden aria-disabled tabindex')
.css("display","");
if ( _.htmlExpr.test( _.options.prevArrow )) {
_.$prevArrow.remove();
}
}
if ( _.$nextArrow && _.$nextArrow.length ) {
_.$nextArrow
.removeClass('slick-disabled slick-arrow slick-hidden')
.removeAttr('aria-hidden aria-disabled tabindex')
.css("display","");
if ( _.htmlExpr.test( _.options.nextArrow )) {
_.$nextArrow.remove();
}
}
if (_.$slides) {
_.$slides
.removeClass('slick-slide slick-active slick-center slick-visible slick-current')
.removeAttr('aria-hidden')
.removeAttr('data-slick-index')
.each(function(){
$(this).attr('style', $(this).data('originalStyling'));
});
_.$slideTrack.children(this.options.slide).detach();
_.$slideTrack.detach();
_.$list.detach();
_.$slider.append(_.$slides);
}
_.cleanUpRows();
_.$slider.removeClass('slick-slider');
_.$slider.removeClass('slick-initialized');
_.unslicked = true;
if(!refresh) {
_.$slider.trigger('destroy', [_]);
}
};
Slick.prototype.disableTransition = function(slide) {
var _ = this,
transition = {};
transition[_.transitionType] = '';
if (_.options.fade === false) {
_.$slideTrack.css(transition);
} else {
_.$slides.eq(slide).css(transition);
}
};
Slick.prototype.fadeSlide = function(slideIndex, callback) {
var _ = this;
if (_.cssTransitions === false) {
_.$slides.eq(slideIndex).css({
zIndex: _.options.zIndex
});
_.$slides.eq(slideIndex).animate({
opacity: 1
}, _.options.speed, _.options.easing, callback);
} else {
_.applyTransition(slideIndex);
_.$slides.eq(slideIndex).css({
opacity: 1,
zIndex: _.options.zIndex
});
if (callback) {
setTimeout(function() {
_.disableTransition(slideIndex);
callback.call();
}, _.options.speed);
}
}
};
Slick.prototype.fadeSlideOut = function(slideIndex) {
var _ = this;
if (_.cssTransitions === false) {
_.$slides.eq(slideIndex).animate({
opacity: 0,
zIndex: _.options.zIndex - 2
}, _.options.speed, _.options.easing);
} else {
_.applyTransition(slideIndex);
_.$slides.eq(slideIndex).css({
opacity: 0,
zIndex: _.options.zIndex - 2
});
}
};
Slick.prototype.filterSlides = Slick.prototype.slickFilter = function(filter) {
var _ = this;
if (filter !== null) {
_.unload();
_.$slideTrack.children(this.options.slide).detach();
_.$slidesCache.filter(filter).appendTo(_.$slideTrack);
_.reinit();
}
};
Slick.prototype.getCurrent = Slick.prototype.slickCurrentSlide = function() {
var _ = this;
return _.currentSlide;
};
Slick.prototype.getDotCount = function() {
var _ = this;
var breakPoint = 0;
var counter = 0;
var pagerQty = 0;
if (_.options.infinite === true) {
while (breakPoint < _.slideCount) {
++pagerQty;
breakPoint = counter + _.options.slidesToShow;
counter += _.options.slidesToScroll <= _.options.slidesToShow ? _.options.slidesToScroll : _.options.slidesToShow;
}
} else if (_.options.centerMode === true) {
pagerQty = _.slideCount;
} else {
while (breakPoint < _.slideCount) {
++pagerQty;
breakPoint = counter + _.options.slidesToShow;
counter += _.options.slidesToScroll <= _.options.slidesToShow ? _.options.slidesToScroll : _.options.slidesToShow;
}
}
return pagerQty - 1;
};
Slick.prototype.getLeft = function(slideIndex) {
var _ = this,
targetLeft,
verticalHeight,
verticalOffset = 0,
targetSlide;
_.slideOffset = 0;
verticalHeight = _.$slides.first().outerHeight(true);
if (_.options.infinite === true) {
if (_.slideCount > _.options.slidesToShow) {
_.slideOffset = (_.slideWidth * _.options.slidesToShow) * -1;
verticalOffset = (verticalHeight * _.options.slidesToShow) * -1;
}
if (_.slideCount % _.options.slidesToScroll !== 0) {
if (slideIndex + _.options.slidesToScroll > _.slideCount && _.slideCount > _.options.slidesToShow) {
if (slideIndex > _.slideCount) {
_.slideOffset = ((_.options.slidesToShow - (slideIndex - _.slideCount)) * _.slideWidth) * -1;
verticalOffset = ((_.options.slidesToShow - (slideIndex - _.slideCount)) * verticalHeight) * -1;
} else {
_.slideOffset = ((_.slideCount % _.options.slidesToScroll) * _.slideWidth) * -1;
verticalOffset = ((_.slideCount % _.options.slidesToScroll) * verticalHeight) * -1;
}
}
}
} else {
if (slideIndex + _.options.slidesToShow > _.slideCount) {
_.slideOffset = ((slideIndex + _.options.slidesToShow) - _.slideCount) * _.slideWidth;
verticalOffset = ((slideIndex + _.options.slidesToShow) - _.slideCount) * verticalHeight;
}
}
if (_.slideCount <= _.options.slidesToShow) {
_.slideOffset = 0;
verticalOffset = 0;
}
if (_.options.centerMode === true && _.options.infinite === true) {
_.slideOffset += _.slideWidth * Math.floor(_.options.slidesToShow / 2) - _.slideWidth;
} else if (_.options.centerMode === true) {
_.slideOffset = 0;
_.slideOffset += _.slideWidth * Math.floor(_.options.slidesToShow / 2);
}
if (_.options.vertical === false) {
targetLeft = ((slideIndex * _.slideWidth) * -1) + _.slideOffset;
} else {
targetLeft = ((slideIndex * verticalHeight) * -1) + verticalOffset;
}
if (_.options.variableWidth === true) {
if (_.slideCount <= _.options.slidesToShow || _.options.infinite === false) {
targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex);
} else {
targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex + _.options.slidesToShow);
}
targetLeft = targetSlide[0] ? targetSlide[0].offsetLeft * -1 : 0;
if (_.options.centerMode === true) {
if (_.options.infinite === false) {
targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex);
} else {
targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex + _.options.slidesToShow + 1);
}
targetLeft = targetSlide[0] ? targetSlide[0].offsetLeft * -1 : 0;
targetLeft += (_.$list.width() - targetSlide.outerWidth()) / 2;
}
}
return targetLeft;
};
Slick.prototype.getOption = Slick.prototype.slickGetOption = function(option) {
var _ = this;
return _.options[option];
};
Slick.prototype.getNavigableIndexes = function() {
var _ = this,
breakPoint = 0,
counter = 0,
indexes = [],
max;
if (_.options.infinite === false) {
max = _.slideCount;
} else {
breakPoint = _.options.slidesToScroll * -1;
counter = _.options.slidesToScroll * -1;
max = _.slideCount * 2;
}
while (breakPoint < max) {
indexes.push(breakPoint);
breakPoint = counter + _.options.slidesToScroll;
counter += _.options.slidesToScroll <= _.options.slidesToShow ? _.options.slidesToScroll : _.options.slidesToShow;
}
return indexes;
};
Slick.prototype.getSlick = function() {
return this;
};
Slick.prototype.getSlideCount = function() {
var _ = this,
slidesTraversed, swipedSlide, centerOffset;
centerOffset = _.options.centerMode === true ? _.slideWidth * Math.floor(_.options.slidesToShow / 2) : 0;
if (_.options.swipeToSlide === true) {
_.$slideTrack.find('.slick-slide').each(function(index, slide) {
if (slide.offsetLeft - centerOffset + ($(slide).outerWidth() / 2) > (_.swipeLeft * -1)) {
swipedSlide = slide;
return false;
}
});
slidesTraversed = Math.abs($(swipedSlide).attr('data-slick-index') - _.currentSlide) || 1;
return slidesTraversed;
} else {
return _.options.slidesToScroll;
}
};
Slick.prototype.goTo = Slick.prototype.slickGoTo = function(slide, dontAnimate) {
var _ = this;
_.changeSlide({
data: {
message: 'index',
index: parseInt(slide)
}
}, dontAnimate);
};
Slick.prototype.init = function(creation) {
var _ = this;
if (!$(_.$slider).hasClass('slick-initialized')) {
$(_.$slider).addClass('slick-initialized');
_.buildRows();
_.buildOut();
_.setProps();
_.startLoad();
_.loadSlider();
_.initializeEvents();
_.updateArrows();
_.updateDots();
}
if (creation) {
_.$slider.trigger('init', [_]);
}
if (_.options.accessibility === true) {
_.initADA();
}
};
Slick.prototype.initArrowEvents = function() {
var _ = this;
if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) {
_.$prevArrow.on('click.slick', {
message: 'previous'
}, _.changeSlide);
_.$nextArrow.on('click.slick', {
message: 'next'
}, _.changeSlide);
}
};
Slick.prototype.initDotEvents = function() {
var _ = this;
if (_.options.dots === true && _.slideCount > _.options.slidesToShow) {
$('li', _.$dots).on('click.slick', {
message: 'index'
}, _.changeSlide);
}
if (_.options.dots === true && _.options.pauseOnDotsHover === true && _.options.autoplay === true) {
$('li', _.$dots)
.on('mouseenter.slick', $.proxy(_.setPaused, _, true))
.on('mouseleave.slick', $.proxy(_.setPaused, _, false));
}
};
Slick.prototype.initializeEvents = function() {
var _ = this;
_.initArrowEvents();
_.initDotEvents();
_.$list.on('touchstart.slick mousedown.slick', {
action: 'start'
}, _.swipeHandler);
_.$list.on('touchmove.slick mousemove.slick', {
action: 'move'
}, _.swipeHandler);
_.$list.on('touchend.slick mouseup.slick', {
action: 'end'
}, _.swipeHandler);
_.$list.on('touchcancel.slick mouseleave.slick', {
action: 'end'
}, _.swipeHandler);
_.$list.on('click.slick', _.clickHandler);
$(document).on(_.visibilityChange, $.proxy(_.visibility, _));
_.$list.on('mouseenter.slick', $.proxy(_.setPaused, _, true));
_.$list.on('mouseleave.slick', $.proxy(_.setPaused, _, false));
if (_.options.accessibility === true) {
_.$list.on('keydown.slick', _.keyHandler);
}
if (_.options.focusOnSelect === true) {
$(_.$slideTrack).children().on('click.slick', _.selectHandler);
}
$(window).on('orientationchange.slick.slick-' + _.instanceUid, $.proxy(_.orientationChange, _));
$(window).on('resize.slick.slick-' + _.instanceUid, $.proxy(_.resize, _));
$('[draggable!=true]', _.$slideTrack).on('dragstart', _.preventDefault);
$(window).on('load.slick.slick-' + _.instanceUid, _.setPosition);
$(document).on('ready.slick.slick-' + _.instanceUid, _.setPosition);
};
Slick.prototype.initUI = function() {
var _ = this;
if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) {
_.$prevArrow.show();
_.$nextArrow.show();
}
if (_.options.dots === true && _.slideCount > _.options.slidesToShow) {
_.$dots.show();
}
if (_.options.autoplay === true) {
_.autoPlay();
}
};
Slick.prototype.keyHandler = function(event) {
var _ = this;
//Dont slide if the cursor is inside the form fields and arrow keys are pressed
if(!event.target.tagName.match('TEXTAREA|INPUT|SELECT')) {
if (event.keyCode === 37 && _.options.accessibility === true) {
_.changeSlide({
data: {
message: 'previous'
}
});
} else if (event.keyCode === 39 && _.options.accessibility === true) {
_.changeSlide({
data: {
message: 'next'
}
});
}
}
};
Slick.prototype.lazyLoad = function() {
var _ = this,
loadRange, cloneRange, rangeStart, rangeEnd;
function loadImages(imagesScope) {
$('img[data-lazy]', imagesScope).each(function() {
var image = $(this),
imageSource = $(this).attr('data-lazy'),
imageToLoad = document.createElement('img');
imageToLoad.onload = function() {
image
.animate({ opacity: 0 }, 100, function() {
image
.attr('src', imageSource)
.animate({ opacity: 1 }, 200, function() {
image
.removeAttr('data-lazy')
.removeClass('slick-loading');
});
});
};
imageToLoad.src = imageSource;
});
}
if (_.options.centerMode === true) {
if (_.options.infinite === true) {
rangeStart = _.currentSlide + (_.options.slidesToShow / 2 + 1);
rangeEnd = rangeStart + _.options.slidesToShow + 2;
} else {
rangeStart = Math.max(0, _.currentSlide - (_.options.slidesToShow / 2 + 1));
rangeEnd = 2 + (_.options.slidesToShow / 2 + 1) + _.currentSlide;
}
} else {
rangeStart = _.options.infinite ? _.options.slidesToShow + _.currentSlide : _.currentSlide;
rangeEnd = rangeStart + _.options.slidesToShow;
if (_.options.fade === true) {
if (rangeStart > 0) rangeStart--;
if (rangeEnd <= _.slideCount) rangeEnd++;
}
}
loadRange = _.$slider.find('.slick-slide').slice(rangeStart, rangeEnd);
loadImages(loadRange);
if (_.slideCount <= _.options.slidesToShow) {
cloneRange = _.$slider.find('.slick-slide');
loadImages(cloneRange);
} else
if (_.currentSlide >= _.slideCount - _.options.slidesToShow) {
cloneRange = _.$slider.find('.slick-cloned').slice(0, _.options.slidesToShow);
loadImages(cloneRange);
} else if (_.currentSlide === 0) {
cloneRange = _.$slider.find('.slick-cloned').slice(_.options.slidesToShow * -1);
loadImages(cloneRange);
}
};
Slick.prototype.loadSlider = function() {
var _ = this;
_.setPosition();
_.$slideTrack.css({
opacity: 1
});
_.$slider.removeClass('slick-loading');
_.initUI();
if (_.options.lazyLoad === 'progressive') {
_.progressiveLazyLoad();
}
};
Slick.prototype.next = Slick.prototype.slickNext = function() {
var _ = this;
_.changeSlide({
data: {
message: 'next'
}
});
};
Slick.prototype.orientationChange = function() {
var _ = this;
_.checkResponsive();
_.setPosition();
};
Slick.prototype.pause = Slick.prototype.slickPause = function() {
var _ = this;
_.autoPlayClear();
_.paused = true;
};
Slick.prototype.play = Slick.prototype.slickPlay = function() {
var _ = this;
_.paused = false;
_.autoPlay();
};
Slick.prototype.postSlide = function(index) {
var _ = this;
_.$slider.trigger('afterChange', [_, index]);
_.animating = false;
_.setPosition();
_.swipeLeft = null;
if (_.options.autoplay === true && _.paused === false) {
_.autoPlay();
}
if (_.options.accessibility === true) {
_.initADA();
}
};
Slick.prototype.prev = Slick.prototype.slickPrev = function() {
var _ = this;
_.changeSlide({
data: {
message: 'previous'
}
});
};
Slick.prototype.preventDefault = function(event) {
event.preventDefault();
};
Slick.prototype.progressiveLazyLoad = function() {
var _ = this,
imgCount, targetImage;
imgCount = $('img[data-lazy]', _.$slider).length;
if (imgCount > 0) {
targetImage = $('img[data-lazy]', _.$slider).first();
targetImage.attr('src', targetImage.attr('data-lazy')).removeClass('slick-loading').load(function() {
targetImage.removeAttr('data-lazy');
_.progressiveLazyLoad();
if (_.options.adaptiveHeight === true) {
_.setPosition();
}
})
.error(function() {
targetImage.removeAttr('data-lazy');
_.progressiveLazyLoad();
});
}
};
Slick.prototype.refresh = function( initializing ) {
var _ = this, currentSlide, firstVisible;
firstVisible = _.slideCount - _.options.slidesToShow;
// check that the new breakpoint can actually accept the
// "current slide" as the current slide, otherwise we need
// to set it to the closest possible value.
if ( !_.options.infinite ) {
if ( _.slideCount <= _.options.slidesToShow ) {
_.currentSlide = 0;
} else if ( _.currentSlide > firstVisible ) {
_.currentSlide = firstVisible;
}
}
currentSlide = _.currentSlide;
_.destroy(true);
$.extend(_, _.initials, { currentSlide: currentSlide });
_.init();
if( !initializing ) {
_.changeSlide({
data: {
message: 'index',
index: currentSlide
}
}, false);
}
};
Slick.prototype.registerBreakpoints = function() {
var _ = this, breakpoint, currentBreakpoint, l,
responsiveSettings = _.options.responsive || null;
if ( $.type(responsiveSettings) === "array" && responsiveSettings.length ) {
_.respondTo = _.options.respondTo || 'window';
for ( breakpoint in responsiveSettings ) {
l = _.breakpoints.length-1;
currentBreakpoint = responsiveSettings[breakpoint].breakpoint;
if (responsiveSettings.hasOwnProperty(breakpoint)) {
// loop through the breakpoints and cut out any existing
// ones with the same breakpoint number, we don't want dupes.
while( l >= 0 ) {
if( _.breakpoints[l] && _.breakpoints[l] === currentBreakpoint ) {
_.breakpoints.splice(l,1);
}
l--;
}
_.breakpoints.push(currentBreakpoint);
_.breakpointSettings[currentBreakpoint] = responsiveSettings[breakpoint].settings;
}
}
_.breakpoints.sort(function(a, b) {
return ( _.options.mobileFirst ) ? a-b : b-a;
});
}
};
Slick.prototype.reinit = function() {
var _ = this;
_.$slides =
_.$slideTrack
.children(_.options.slide)
.addClass('slick-slide');
_.slideCount = _.$slides.length;
if (_.currentSlide >= _.slideCount && _.currentSlide !== 0) {
_.currentSlide = _.currentSlide - _.options.slidesToScroll;
}
if (_.slideCount <= _.options.slidesToShow) {
_.currentSlide = 0;
}
_.registerBreakpoints();
_.setProps();
_.setupInfinite();
_.buildArrows();
_.updateArrows();
_.initArrowEvents();
_.buildDots();
_.updateDots();
_.initDotEvents();
_.checkResponsive(false, true);
if (_.options.focusOnSelect === true) {
$(_.$slideTrack).children().on('click.slick', _.selectHandler);
}
_.setSlideClasses(0);
_.setPosition();
_.$slider.trigger('reInit', [_]);
if (_.options.autoplay === true) {
_.focusHandler();
}
};
Slick.prototype.resize = function() {
var _ = this;
if ($(window).width() !== _.windowWidth) {
clearTimeout(_.windowDelay);
_.windowDelay = window.setTimeout(function() {
_.windowWidth = $(window).width();
_.checkResponsive();
if( !_.unslicked ) { _.setPosition(); }
}, 50);
}
};
Slick.prototype.removeSlide = Slick.prototype.slickRemove = function(index, removeBefore, removeAll) {
var _ = this;
if (typeof(index) === 'boolean') {
removeBefore = index;
index = removeBefore === true ? 0 : _.slideCount - 1;
} else {
index = removeBefore === true ? --index : index;
}
if (_.slideCount < 1 || index < 0 || index > _.slideCount - 1) {
return false;
}
_.unload();
if (removeAll === true) {
_.$slideTrack.children().remove();
} else {
_.$slideTrack.children(this.options.slide).eq(index).remove();
}
_.$slides = _.$slideTrack.children(this.options.slide);
_.$slideTrack.children(this.options.slide).detach();
_.$slideTrack.append(_.$slides);
_.$slidesCache = _.$slides;
_.reinit();
};
Slick.prototype.setCSS = function(position) {
var _ = this,
positionProps = {},
x, y;
if (_.options.rtl === true) {
position = -position;
}
x = _.positionProp == 'left' ? Math.ceil(position) + 'px' : '0px';
y = _.positionProp == 'top' ? Math.ceil(position) + 'px' : '0px';
positionProps[_.positionProp] = position;
if (_.transformsEnabled === false) {
_.$slideTrack.css(positionProps);
} else {
positionProps = {};
if (_.cssTransitions === false) {
positionProps[_.animType] = 'translate(' + x + ', ' + y + ')';
_.$slideTrack.css(positionProps);
} else {
positionProps[_.animType] = 'translate3d(' + x + ', ' + y + ', 0px)';
_.$slideTrack.css(positionProps);
}
}
};
Slick.prototype.setDimensions = function() {
var _ = this;
if (_.options.vertical === false) {
if (_.options.centerMode === true) {
_.$list.css({
padding: ('0px ' + _.options.centerPadding)
});
}
} else {
_.$list.height(_.$slides.first().outerHeight(true) * _.options.slidesToShow);
if (_.options.centerMode === true) {
_.$list.css({
padding: (_.options.centerPadding + ' 0px')
});
}
}
_.listWidth = _.$list.width();
_.listHeight = _.$list.height();
if (_.options.vertical === false && _.options.variableWidth === false) {
_.slideWidth = Math.ceil(_.listWidth / _.options.slidesToShow);
_.$slideTrack.width(Math.ceil((_.slideWidth * _.$slideTrack.children('.slick-slide').length)));
} else if (_.options.variableWidth === true) {
_.$slideTrack.width(5000 * _.slideCount);
} else {
_.slideWidth = Math.ceil(_.listWidth);
_.$slideTrack.height(Math.ceil((_.$slides.first().outerHeight(true) * _.$slideTrack.children('.slick-slide').length)));
}
var offset = _.$slides.first().outerWidth(true) - _.$slides.first().width();
if (_.options.variableWidth === false) _.$slideTrack.children('.slick-slide').width(_.slideWidth - offset);
};
Slick.prototype.setFade = function() {
var _ = this,
targetLeft;
_.$slides.each(function(index, element) {
targetLeft = (_.slideWidth * index) * -1;
if (_.options.rtl === true) {
$(element).css({
position: 'relative',
right: targetLeft,
top: 0,
zIndex: _.options.zIndex - 2,
opacity: 0
});
} else {
$(element).css({
position: 'relative',
left: targetLeft,
top: 0,
zIndex: _.options.zIndex - 2,
opacity: 0
});
}
});
_.$slides.eq(_.currentSlide).css({
zIndex: _.options.zIndex - 1,
opacity: 1
});
};
Slick.prototype.setHeight = function() {
var _ = this;
if (_.options.slidesToShow === 1 && _.options.adaptiveHeight === true && _.options.vertical === false) {
var targetHeight = _.$slides.eq(_.currentSlide).outerHeight(true);
_.$list.css('height', targetHeight);
}
};
Slick.prototype.setOption = Slick.prototype.slickSetOption = function(option, value, refresh) {
var _ = this, l, item;
if( option === "responsive" && $.type(value) === "array" ) {
for ( item in value ) {
if( $.type( _.options.responsive ) !== "array" ) {
_.options.responsive = [ value[item] ];
} else {
l = _.options.responsive.length-1;
// loop through the responsive object and splice out duplicates.
while( l >= 0 ) {
if( _.options.responsive[l].breakpoint === value[item].breakpoint ) {
_.options.responsive.splice(l,1);
}
l--;
}
_.options.responsive.push( value[item] );
}
}
} else {
_.options[option] = value;
}
if (refresh === true) {
_.unload();
_.reinit();
}
};
Slick.prototype.setPosition = function() {
var _ = this;
_.setDimensions();
_.setHeight();
if (_.options.fade === false) {
_.setCSS(_.getLeft(_.currentSlide));
} else {
_.setFade();
}
_.$slider.trigger('setPosition', [_]);
};
Slick.prototype.setProps = function() {
var _ = this,
bodyStyle = document.body.style;
_.positionProp = _.options.vertical === true ? 'top' : 'left';
if (_.positionProp === 'top') {
_.$slider.addClass('slick-vertical');
} else {
_.$slider.removeClass('slick-vertical');
}
if (bodyStyle.WebkitTransition !== undefined ||
bodyStyle.MozTransition !== undefined ||
bodyStyle.msTransition !== undefined) {
if (_.options.useCSS === true) {
_.cssTransitions = true;
}
}
if ( _.options.fade ) {
if ( typeof _.options.zIndex === 'number' ) {
if( _.options.zIndex < 3 ) {
_.options.zIndex = 3;
}
} else {
_.options.zIndex = _.defaults.zIndex;
}
}
if (bodyStyle.OTransform !== undefined) {
_.animType = 'OTransform';
_.transformType = '-o-transform';
_.transitionType = 'OTransition';
if (bodyStyle.perspectiveProperty === undefined && bodyStyle.webkitPerspective === undefined) _.animType = false;
}
if (bodyStyle.MozTransform !== undefined) {
_.animType = 'MozTransform';
_.transformType = '-moz-transform';
_.transitionType = 'MozTransition';
if (bodyStyle.perspectiveProperty === undefined && bodyStyle.MozPerspective === undefined) _.animType = false;
}
if (bodyStyle.webkitTransform !== undefined) {
_.animType = 'webkitTransform';
_.transformType = '-webkit-transform';
_.transitionType = 'webkitTransition';
if (bodyStyle.perspectiveProperty === undefined && bodyStyle.webkitPerspective === undefined) _.animType = false;
}
if (bodyStyle.msTransform !== undefined) {
_.animType = 'msTransform';
_.transformType = '-ms-transform';
_.transitionType = 'msTransition';
if (bodyStyle.msTransform === undefined) _.animType = false;
}
if (bodyStyle.transform !== undefined && _.animType !== false) {
_.animType = 'transform';
_.transformType = 'transform';
_.transitionType = 'transition';
}
_.transformsEnabled = (_.animType !== null && _.animType !== false);
};
Slick.prototype.setSlideClasses = function(index) {
var _ = this,
centerOffset, allSlides, indexOffset, remainder;
allSlides = _.$slider
.find('.slick-slide')
.removeClass('slick-active slick-center slick-current')
.attr('aria-hidden', 'true');
_.$slides
.eq(index)
.addClass('slick-current');
if (_.options.centerMode === true) {
centerOffset = Math.floor(_.options.slidesToShow / 2);
if (_.options.infinite === true) {
if (index >= centerOffset && index <= (_.slideCount - 1) - centerOffset) {
_.$slides
.slice(index - centerOffset, index + centerOffset + 1)
.addClass('slick-active')
.attr('aria-hidden', 'false');
} else {
indexOffset = _.options.slidesToShow + index;
allSlides
.slice(indexOffset - centerOffset + 1, indexOffset + centerOffset + 2)
.addClass('slick-active')
.attr('aria-hidden', 'false');
}
if (index === 0) {
allSlides
.eq(allSlides.length - 1 - _.options.slidesToShow)
.addClass('slick-center');
} else if (index === _.slideCount - 1) {
allSlides
.eq(_.options.slidesToShow)
.addClass('slick-center');
}
}
_.$slides
.eq(index)
.addClass('slick-center');
} else {
if (index >= 0 && index <= (_.slideCount - _.options.slidesToShow)) {
_.$slides
.slice(index, index + _.options.slidesToShow)
.addClass('slick-active')
.attr('aria-hidden', 'false');
} else if (allSlides.length <= _.options.slidesToShow) {
allSlides
.addClass('slick-active')
.attr('aria-hidden', 'false');
} else {
remainder = _.slideCount % _.options.slidesToShow;
indexOffset = _.options.infinite === true ? _.options.slidesToShow + index : index;
if (_.options.slidesToShow == _.options.slidesToScroll && (_.slideCount - index) < _.options.slidesToShow) {
allSlides
.slice(indexOffset - (_.options.slidesToShow - remainder), indexOffset + remainder)
.addClass('slick-active')
.attr('aria-hidden', 'false');
} else {
allSlides
.slice(indexOffset, indexOffset + _.options.slidesToShow)
.addClass('slick-active')
.attr('aria-hidden', 'false');
}
}
}
if (_.options.lazyLoad === 'ondemand') {
_.lazyLoad();
}
};
Slick.prototype.setupInfinite = function() {
var _ = this,
i, slideIndex, infiniteCount;
if (_.options.fade === true) {
_.options.centerMode = false;
}
if (_.options.infinite === true && _.options.fade === false) {
slideIndex = null;
if (_.slideCount > _.options.slidesToShow) {
if (_.options.centerMode === true) {
infiniteCount = _.options.slidesToShow + 1;
} else {
infiniteCount = _.options.slidesToShow;
}
for (i = _.slideCount; i > (_.slideCount -
infiniteCount); i -= 1) {
slideIndex = i - 1;
$(_.$slides[slideIndex]).clone(true).attr('id', '')
.attr('data-slick-index', slideIndex - _.slideCount)
.prependTo(_.$slideTrack).addClass('slick-cloned');
}
for (i = 0; i < infiniteCount; i += 1) {
slideIndex = i;
$(_.$slides[slideIndex]).clone(true).attr('id', '')
.attr('data-slick-index', slideIndex + _.slideCount)
.appendTo(_.$slideTrack).addClass('slick-cloned');
}
_.$slideTrack.find('.slick-cloned').find('[id]').each(function() {
$(this).attr('id', '');
});
}
}
};
Slick.prototype.setPaused = function(paused) {
var _ = this;
if (_.options.autoplay === true && _.options.pauseOnHover === true) {
_.paused = paused;
if (!paused) {
_.autoPlay();
} else {
_.autoPlayClear();
}
}
};
Slick.prototype.selectHandler = function(event) {
var _ = this;
var targetElement =
$(event.target).is('.slick-slide') ?
$(event.target) :
$(event.target).parents('.slick-slide');
var index = parseInt(targetElement.attr('data-slick-index'));
if (!index) index = 0;
if (_.slideCount <= _.options.slidesToShow) {
_.setSlideClasses(index);
_.asNavFor(index);
return;
}
_.slideHandler(index);
};
Slick.prototype.slideHandler = function(index, sync, dontAnimate) {
var targetSlide, animSlide, oldSlide, slideLeft, targetLeft = null,
_ = this;
sync = sync || false;
if (_.animating === true && _.options.waitForAnimate === true) {
return;
}
if (_.options.fade === true && _.currentSlide === index) {
return;
}
if (_.slideCount <= _.options.slidesToShow) {
return;
}
if (sync === false) {
_.asNavFor(index);
}
targetSlide = index;
targetLeft = _.getLeft(targetSlide);
slideLeft = _.getLeft(_.currentSlide);
_.currentLeft = _.swipeLeft === null ? slideLeft : _.swipeLeft;
if (_.options.infinite === false && _.options.centerMode === false && (index < 0 || index > _.getDotCount() * _.options.slidesToScroll)) {
if (_.options.fade === false) {
targetSlide = _.currentSlide;
if (dontAnimate !== true) {
_.animateSlide(slideLeft, function() {
_.postSlide(targetSlide);
});
} else {
_.postSlide(targetSlide);
}
}
return;
} else if (_.options.infinite === false && _.options.centerMode === true && (index < 0 || index > (_.slideCount - _.options.slidesToScroll))) {
if (_.options.fade === false) {
targetSlide = _.currentSlide;
if (dontAnimate !== true) {
_.animateSlide(slideLeft, function() {
_.postSlide(targetSlide);
});
} else {
_.postSlide(targetSlide);
}
}
return;
}
if (_.options.autoplay === true) {
clearInterval(_.autoPlayTimer);
}
if (targetSlide < 0) {
if (_.slideCount % _.options.slidesToScroll !== 0) {
animSlide = _.slideCount - (_.slideCount % _.options.slidesToScroll);
} else {
animSlide = _.slideCount + targetSlide;
}
} else if (targetSlide >= _.slideCount) {
if (_.slideCount % _.options.slidesToScroll !== 0) {
animSlide = 0;
} else {
animSlide = targetSlide - _.slideCount;
}
} else {
animSlide = targetSlide;
}
_.animating = true;
_.$slider.trigger('beforeChange', [_, _.currentSlide, animSlide]);
oldSlide = _.currentSlide;
_.currentSlide = animSlide;
_.setSlideClasses(_.currentSlide);
_.updateDots();
_.updateArrows();
if (_.options.fade === true) {
if (dontAnimate !== true) {
_.fadeSlideOut(oldSlide);
_.fadeSlide(animSlide, function() {
_.postSlide(animSlide);
});
} else {
_.postSlide(animSlide);
}
_.animateHeight();
return;
}
if (dontAnimate !== true) {
_.animateSlide(targetLeft, function() {
_.postSlide(animSlide);
});
} else {
_.postSlide(animSlide);
}
};
Slick.prototype.startLoad = function() {
var _ = this;
if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) {
_.$prevArrow.hide();
_.$nextArrow.hide();
}
if (_.options.dots === true && _.slideCount > _.options.slidesToShow) {
_.$dots.hide();
}
_.$slider.addClass('slick-loading');
};
Slick.prototype.swipeDirection = function() {
var xDist, yDist, r, swipeAngle, _ = this;
xDist = _.touchObject.startX - _.touchObject.curX;
yDist = _.touchObject.startY - _.touchObject.curY;
r = Math.atan2(yDist, xDist);
swipeAngle = Math.round(r * 180 / Math.PI);
if (swipeAngle < 0) {
swipeAngle = 360 - Math.abs(swipeAngle);
}
if ((swipeAngle <= 45) && (swipeAngle >= 0)) {
return (_.options.rtl === false ? 'left' : 'right');
}
if ((swipeAngle <= 360) && (swipeAngle >= 315)) {
return (_.options.rtl === false ? 'left' : 'right');
}
if ((swipeAngle >= 135) && (swipeAngle <= 225)) {
return (_.options.rtl === false ? 'right' : 'left');
}
if (_.options.verticalSwiping === true) {
if ((swipeAngle >= 35) && (swipeAngle <= 135)) {
return 'left';
} else {
return 'right';
}
}
return 'vertical';
};
Slick.prototype.swipeEnd = function(event) {
var _ = this,
slideCount;
_.dragging = false;
_.shouldClick = (_.touchObject.swipeLength > 10) ? false : true;
if (_.touchObject.curX === undefined) {
return false;
}
if (_.touchObject.edgeHit === true) {
_.$slider.trigger('edge', [_, _.swipeDirection()]);
}
if (_.touchObject.swipeLength >= _.touchObject.minSwipe) {
switch (_.swipeDirection()) {
case 'left':
slideCount = _.options.swipeToSlide ? _.checkNavigable(_.currentSlide + _.getSlideCount()) : _.currentSlide + _.getSlideCount();
_.slideHandler(slideCount);
_.currentDirection = 0;
_.touchObject = {};
_.$slider.trigger('swipe', [_, 'left']);
break;
case 'right':
slideCount = _.options.swipeToSlide ? _.checkNavigable(_.currentSlide - _.getSlideCount()) : _.currentSlide - _.getSlideCount();
_.slideHandler(slideCount);
_.currentDirection = 1;
_.touchObject = {};
_.$slider.trigger('swipe', [_, 'right']);
break;
}
} else {
if (_.touchObject.startX !== _.touchObject.curX) {
_.slideHandler(_.currentSlide);
_.touchObject = {};
}
}
};
Slick.prototype.swipeHandler = function(event) {
var _ = this;
if ((_.options.swipe === false) || ('ontouchend' in document && _.options.swipe === false)) {
return;
} else if (_.options.draggable === false && event.type.indexOf('mouse') !== -1) {
return;
}
_.touchObject.fingerCount = event.originalEvent && event.originalEvent.touches !== undefined ?
event.originalEvent.touches.length : 1;
_.touchObject.minSwipe = _.listWidth / _.options
.touchThreshold;
if (_.options.verticalSwiping === true) {
_.touchObject.minSwipe = _.listHeight / _.options
.touchThreshold;
}
switch (event.data.action) {
case 'start':
_.swipeStart(event);
break;
case 'move':
_.swipeMove(event);
break;
case 'end':
_.swipeEnd(event);
break;
}
};
Slick.prototype.swipeMove = function(event) {
var _ = this,
edgeWasHit = false,
curLeft, swipeDirection, swipeLength, positionOffset, touches;
touches = event.originalEvent !== undefined ? event.originalEvent.touches : null;
if (!_.dragging || touches && touches.length !== 1) {
return false;
}
curLeft = _.getLeft(_.currentSlide);
_.touchObject.curX = touches !== undefined ? touches[0].pageX : event.clientX;
_.touchObject.curY = touches !== undefined ? touches[0].pageY : event.clientY;
_.touchObject.swipeLength = Math.round(Math.sqrt(
Math.pow(_.touchObject.curX - _.touchObject.startX, 2)));
if (_.options.verticalSwiping === true) {
_.touchObject.swipeLength = Math.round(Math.sqrt(
Math.pow(_.touchObject.curY - _.touchObject.startY, 2)));
}
swipeDirection = _.swipeDirection();
if (swipeDirection === 'vertical') {
return;
}
if (event.originalEvent !== undefined && _.touchObject.swipeLength > 4) {
event.preventDefault();
}
positionOffset = (_.options.rtl === false ? 1 : -1) * (_.touchObject.curX > _.touchObject.startX ? 1 : -1);
if (_.options.verticalSwiping === true) {
positionOffset = _.touchObject.curY > _.touchObject.startY ? 1 : -1;
}
swipeLength = _.touchObject.swipeLength;
_.touchObject.edgeHit = false;
if (_.options.infinite === false) {
if ((_.currentSlide === 0 && swipeDirection === 'right') || (_.currentSlide >= _.getDotCount() && swipeDirection === 'left')) {
swipeLength = _.touchObject.swipeLength * _.options.edgeFriction;
_.touchObject.edgeHit = true;
}
}
if (_.options.vertical === false) {
_.swipeLeft = curLeft + swipeLength * positionOffset;
} else {
_.swipeLeft = curLeft + (swipeLength * (_.$list.height() / _.listWidth)) * positionOffset;
}
if (_.options.verticalSwiping === true) {
_.swipeLeft = curLeft + swipeLength * positionOffset;
}
if (_.options.fade === true || _.options.touchMove === false) {
return false;
}
if (_.animating === true) {
_.swipeLeft = null;
return false;
}
_.setCSS(_.swipeLeft);
};
Slick.prototype.swipeStart = function(event) {
var _ = this,
touches;
if (_.touchObject.fingerCount !== 1 || _.slideCount <= _.options.slidesToShow) {
_.touchObject = {};
return false;
}
if (event.originalEvent !== undefined && event.originalEvent.touches !== undefined) {
touches = event.originalEvent.touches[0];
}
_.touchObject.startX = _.touchObject.curX = touches !== undefined ? touches.pageX : event.clientX;
_.touchObject.startY = _.touchObject.curY = touches !== undefined ? touches.pageY : event.clientY;
_.dragging = true;
};
Slick.prototype.unfilterSlides = Slick.prototype.slickUnfilter = function() {
var _ = this;
if (_.$slidesCache !== null) {
_.unload();
_.$slideTrack.children(this.options.slide).detach();
_.$slidesCache.appendTo(_.$slideTrack);
_.reinit();
}
};
Slick.prototype.unload = function() {
var _ = this;
$('.slick-cloned', _.$slider).remove();
if (_.$dots) {
_.$dots.remove();
}
if (_.$prevArrow && _.htmlExpr.test(_.options.prevArrow)) {
_.$prevArrow.remove();
}
if (_.$nextArrow && _.htmlExpr.test(_.options.nextArrow)) {
_.$nextArrow.remove();
}
_.$slides
.removeClass('slick-slide slick-active slick-visible slick-current')
.attr('aria-hidden', 'true')
.css('width', '');
};
Slick.prototype.unslick = function(fromBreakpoint) {
var _ = this;
_.$slider.trigger('unslick', [_, fromBreakpoint]);
_.destroy();
};
Slick.prototype.updateArrows = function() {
var _ = this,
centerOffset;
centerOffset = Math.floor(_.options.slidesToShow / 2);
if ( _.options.arrows === true &&
_.slideCount > _.options.slidesToShow &&
!_.options.infinite ) {
_.$prevArrow.removeClass('slick-disabled').attr('aria-disabled', 'false');
_.$nextArrow.removeClass('slick-disabled').attr('aria-disabled', 'false');
if (_.currentSlide === 0) {
_.$prevArrow.addClass('slick-disabled').attr('aria-disabled', 'true');
_.$nextArrow.removeClass('slick-disabled').attr('aria-disabled', 'false');
} else if (_.currentSlide >= _.slideCount - _.options.slidesToShow && _.options.centerMode === false) {
_.$nextArrow.addClass('slick-disabled').attr('aria-disabled', 'true');
_.$prevArrow.removeClass('slick-disabled').attr('aria-disabled', 'false');
} else if (_.currentSlide >= _.slideCount - 1 && _.options.centerMode === true) {
_.$nextArrow.addClass('slick-disabled').attr('aria-disabled', 'true');
_.$prevArrow.removeClass('slick-disabled').attr('aria-disabled', 'false');
}
}
};
Slick.prototype.updateDots = function() {
var _ = this;
if (_.$dots !== null) {
_.$dots
.find('li')
.removeClass('slick-active')
.attr('aria-hidden', 'true');
_.$dots
.find('li')
.eq(Math.floor(_.currentSlide / _.options.slidesToScroll))
.addClass('slick-active')
.attr('aria-hidden', 'false');
}
};
Slick.prototype.visibility = function() {
var _ = this;
if (document[_.hidden]) {
_.paused = true;
_.autoPlayClear();
} else {
if (_.options.autoplay === true) {
_.paused = false;
_.autoPlay();
}
}
};
Slick.prototype.initADA = function() {
var _ = this;
_.$slides.add(_.$slideTrack.find('.slick-cloned')).attr({
'aria-hidden': 'true',
'tabindex': '-1'
}).find('a, input, button, select').attr({
'tabindex': '-1'
});
_.$slideTrack.attr('role', 'list');
_.$slides.not(_.$slideTrack.find('.slick-cloned')).each(function(i) {
$(this).attr({
/*'role': 'option',*/
'role': 'listitem',
'aria-describedby': 'slick-slide' + _.instanceUid + i + ''
});
});
if (_.$dots !== null) {
_.$dots.attr('role', 'tablist').find('li').each(function(i) {
$(this).attr({
/*'role': 'presentation',
'aria-selected': 'false',*/
'aria-controls': 'content-' + _.instanceUid + i + '',
'id': 'slick-slide' + _.instanceUid + i + ''
});
})
/*.first().attr('aria-selected', 'true').end()
.find('button').attr('role', 'button').end()*/
.closest('div').attr('role', 'toolbar');
}
_.activateADA();
};
Slick.prototype.activateADA = function() {
var _ = this,
_isSlideOnFocus =_.$slider.find('*').is(':focus');
// _isSlideOnFocus = _.$slides.is(':focus') || _.$slides.find('*').is(':focus');
_.$slideTrack.find('.slick-active').attr({
'aria-hidden': 'false',
'tabindex': '0'
}).find('a, input, button, select').attr({
'tabindex': '0'
});
(_isSlideOnFocus) && _.$slideTrack.find('.slick-active').focus();
};
Slick.prototype.focusHandler = function() {
var _ = this;
_.$slider.on('focus.slick blur.slick', '*', function(event) {
event.stopImmediatePropagation();
var sf = $(this);
setTimeout(function() {
if (_.isPlay) {
if (sf.is(':focus')) {
_.autoPlayClear();
_.paused = true;
} else {
_.paused = false;
_.autoPlay();
}
}
}, 0);
});
};
$.fn.slick = function() {
var _ = this,
opt = arguments[0],
args = Array.prototype.slice.call(arguments, 1),
l = _.length,
i = 0,
ret;
for (i; i < l; i++) {
if (typeof opt == 'object' || typeof opt == 'undefined')
_[i].slick = new Slick(_[i], opt);
else
ret = _[i].slick[opt].apply(_[i].slick, args);
if (typeof ret != 'undefined') return ret;
}
return _;
};
}));
/*-- module:squiz-module-accordion --*/
/**
* Uber Accordion jQuery plugin
* @copyright Squiz
* @preserve
*/
(function($, window, document, undefined) {
'use strict';
var pluginName = "UberAccordion",
defaults = {
// Map buttons and targets to the accordion behavior
buttonClass: '',
// Apply classes to elements to help control the show/hide behavior
// Generally you won't need to change these
appliedClasses: {
base: 'uber-accordion',
button: 'uber-accordion__button',
target: 'uber-accordion__target',
activeButton: 'uber-accordion__button-active',
activeTarget: 'uber-accordion__target-active'
},
// An id to auto expand when first initialised
// null = no auto expansion
// #hash string = expand to this target/button pair
// function = return the hash to expand to
// Autoexpand function example:
// autoExpand: function($elem) {
// return this.$buttons.first().attr('href');
// }
autoExpand: null,
// Allow items to be toggled.
// true = successive clicks will toggle the visible state of the target element
// false = initial click will set the target element visible, successive clicks are ignored
toggle: true,
// Whether to allow multiple items to be expanded
// true = multiple
// false = only a single element can be expanded
multiple: false,
// Whether to automatically expand an item when button gets keyboard focus, or any element inside
// the target has been focused
expandOnFocus: false,
// Prevent the default button action (e.g hash change)
// If you don't prevent this the default browser scroll behavior to the
// target id will occur as button clicks may update the window.location.hash
preventDefaultButton: true,
// Whether this plugin should respond to hash change events
hashChange: true,
// Each time an item is selected this function will be called passing the active $button and $target pair.
onSelect: function($button, $target) {}
};
/**
* Uber Accordion jQuery Plugin
* @constructor
* @param {object} elem The DOM element
* @param {object} options JSON hash of options to apply
* @return {void}
*/
function UberAccordion(elem, options) {
this.$elem = $(elem);
this.inner = this.$elem.html();
this.settings = $.extend({}, defaults, options);
this._defaults = defaults;
this._name = pluginName;
this.init();
}//end UberAccordion constructor
function getTargetHash($elem) {
var href = $elem.attr('href');
if (!href) {
href = $elem.attr('data-target');
}
return href;
}
// Public methods
UberAccordion.prototype = {
/**
* Plugin initialisation
* @return {void}
*/
init: function() {
var self = this;
this.$buttons = $('.' + this.settings.buttonClass, this.$elem);
this.$targets = $();
// Setup buttons
this.$buttons.each(function() {
var $button = $(this);
var hash = getTargetHash($button);
if (!hash) {
return;
}
$button.attr({
'role': 'button',
'aria-controls': hash.replace(/^#/,'')
});
self.$targets = self.$targets.add($(hash));
});
if (!this.$buttons.length || !this.$targets.length) {
// Silent pass through?
//throw "Missing buttons or targets for " + pluginName;
}
// Add classes
this.$elem.addClass(this.settings.appliedClasses.base);
this.$buttons.addClass(this.settings.appliedClasses.button);
this.$targets.addClass(this.settings.appliedClasses.target);
// Setup targets
this.$targets.attr({
'role': 'region',
'aria-expanded': 'false'
});
// Bind button click events
this.$buttons.on('click.' + pluginName, function(e) {
// Override the default button behavior
if (self.settings.preventDefaultButton) {
e.preventDefault();
}//end if
var hash = getTargetHash($(this));
if (hash) {
self.toggleActive(hash);
}
});
// Focus events (only trigger expand, not collapse)
if (this.settings.expandOnFocus) {
this.$buttons.on('focus.' + pluginName, function() {
var hash = getTargetHash($(this));
if (hash) {
self.toggleActive(hash, true);
}
});
// Detect focus events on all child elements
this.$targets.each(function() {
var $target = $(this);
$target.find('*').on('focus.' + pluginName, function(){
var id = $target.attr('id');
if (!id) {
return;
}
self.toggleActive('#' + id, true);
});
});
}
// Bind hash change event to hook up hash to active target
if (this.settings.hashChange) {
$(window).on('hashchange.' + pluginName, function() {
self.toggleActive(window.location.hash);
});
}
var expandType = typeof(this.settings.autoExpand);
if (expandType === 'string') {
self.toggleActive(this.settings.autoExpand);
} else if (expandType === 'function') {
self.toggleActive(this.settings.autoExpand.call(this, this.$elem));
}
},
/**
* Toggle the active state of the button
* @param {string} hash Id hash to search for
* @param {boolean} active Whether to force only the active state (disable the toggle behavior)
* @return {void}
*/
toggleActive: function(hash, active) {
var $button = this.$buttons.filter('[href="' + hash + '"]');
var $target = $(hash);
var classes = this.settings.appliedClasses;
if (!$button.length || !$target.length) {
// No active target & button match found
return;
}
// Toggle the state of the buttons
if ($button.hasClass(classes.activeButton) &&
this.settings.toggle &&
!active) {
// De-activate button & target
$button.removeClass(classes.activeButton);
$target.attr('aria-expanded', false)
.removeClass(classes.activeTarget);
} else if (!$button.hasClass(classes.activeButton)) {
// Button classes
if (!this.settings.multiple) {
this.$buttons.removeClass(classes.activeButton);
}
$button.addClass(classes.activeButton);
// Target classes
if (!this.settings.multiple) {
this.$targets
.attr('aria-expanded', false)
.removeClass(classes.activeTarget);
}
$target
.attr('aria-expanded', true)
.addClass(classes.activeTarget);
}
this.settings.onSelect.call(this, $button, $target);
},
/**
* Destroy any markup and events bound by this plugin
* @return {void}
*/
destroy: function() {
// Unbind events
this.$buttons
.off('click. ' + pluginName + ' focus.' + pluginName);
this.$targets.find('*')
.off('focus.' + pluginName);
$(window).off('hashchange.' + pluginName);
// Reset HTML & Classes
this.$elem.removeClass(this.settings.appliedClasses.base);
this.$elem.html(this.inner);
}
};
// Use the lightweight plugin wrapper to prevent against multiple instantiations.
$.fn[pluginName] = function(options) {
var args = Array.prototype.slice.call(arguments, 1);
return this.each(function() {
// Invoke as a specific method
if (typeof(options) === 'string') {
var accordion = $.data(this, "plugin_" + pluginName);
var method = options;
if (accordion && typeof(accordion[method]) === 'function') {
accordion[method].apply(accordion, args);
}
// Init the accordion
} else if (!$.data(this, "plugin_" + pluginName)) {
$.data(this, "plugin_" + pluginName, new UberAccordion(this, options));
}
});
};
})(jQuery, window, document);
/**
* Lightning Touch makes links responsive without the several
* hundred millisecond delay typical in a hendheld touchscreen browser.
*
* Click events can take 300 ms or so to register on a mobile device because
* the device is waiting to see if it's a double click or a touch-and-drag
* event. Use touchStart etc. to work around this issue, but it's not as
* straightforward as one might hope.
*
* This code started with a portion of fastButtons created and shared by Google
* and used according to terms described in the Creative Commons 3.0 Attribution
* License. fastButtons can be found at:
* http://code.google.com/mobile/articles/fast_buttons.html
*
* @module Lightning Touch
* @author Rich Trott
* @copyright Copyright (c) 2012 UC Regents
* @version 1.0.1
*/
/*global document: false, history: false, location: false, window: false */
(function($) {
"use strict";
var link = [],
states = [],
indexToUrl = [],
defaultTargetId,
LightningTouch,
setState,
saveState,
getState,
hideArray,
coordinates,
pop,
preventGhostClick,
clickBust,
init;
coordinates = [];
pop = function () {
coordinates.splice(0, 2);
};
preventGhostClick = function (x, y) {
coordinates.push(x, y);
window.setTimeout(pop, 2500);
};
clickBust = function (event) {
var i, x, y;
for (i = 0; i < coordinates.length; i += 2) {
x = coordinates[i];
y = coordinates[i + 1];
if (Math.abs(event.clientX - x) < 25 && Math.abs(event.clientY - y) < 25) {
event.stopPropagation();
event.preventDefault();
}
}
};
document.addEventListener('click', clickBust, true);
LightningTouch = function (element, handler) {
this.element = element;
this.handler = handler;
element.addEventListener('touchstart', this, false);
element.addEventListener('click', this, false);
};
LightningTouch.prototype.handleEvent = function (event) {
switch (event.type) {
case 'touchstart':
this.onTouchStart(event);
break;
case 'touchmove':
this.onTouchMove(event);
break;
case 'touchend':
this.onClick(event);
break;
case 'click':
this.onClick(event);
break;
}
};
LightningTouch.prototype.onTouchStart = function (event) {
event.stopPropagation();
this.element.addEventListener('touchend', this, false);
document.body.addEventListener('touchmove', this, false);
this.startX = event.touches[0].clientX;
this.startY = event.touches[0].clientY;
};
LightningTouch.prototype.onTouchMove = function (event) {
if (Math.abs(event.touches[0].clientX - this.startX) > 10 ||
Math.abs(event.touches[0].clientY - this.startY) > 10) {
this.reset();
}
};
LightningTouch.prototype.onClick = function (event) {
event.stopPropagation();
this.reset();
this.handler(event);
if (event.type === 'touchend') {
preventGhostClick(this.startX, this.startY);
}
};
LightningTouch.prototype.reset = function () {
this.element.removeEventListener('touchend', this, false);
document.body.removeEventListener('touchmove', this, false);
};
setState = function (object, url) {
var index = indexToUrl.indexOf(url);
if (index < 0) {
index = indexToUrl.length;
indexToUrl.push(url);
}
states[index] = object;
};
saveState = function (object, title, url) {
url = url || location.pathname + location.hash;
setState(object, url);
history.replaceState(object, title, url);
};
getState = function (id) {
var url = id ? location.pathname + '#/' + id : location.pathname + location.hash,
index = indexToUrl.indexOf(url);
return index < 0 ? undefined : states[index];
};
hideArray = function (hide, newHideId) {
if (hide.indexOf(newHideId) < 0) {
hide.push(newHideId);
}
return hide;
};
init = function () {
var anchors, i, touchHandler, popHandler;
defaultTargetId = document.body.getAttribute('data-default-target-id') || '';
function showContent(show, hide) {
var hideElement, showElement, i;
showElement = document.getElementById(show) || document.getElementById(defaultTargetId);
if (showElement) {
for (i = 0; i < hide.length; i += 1) {
hideElement = document.getElementById(hide[i]);
if (hideElement) {
hideElement.setAttribute("style", "display:none");
}
}
showElement.setAttribute("style", "display:block");
}
}
if ((!location.hash) && (defaultTargetId !== '')) {
location.hash = '#/' + defaultTargetId;
}
showContent(location.hash.substring(2), [defaultTargetId]);
if (!(history instanceof Object && history.replaceState instanceof Function)) {
return;
}
touchHandler = function (event) {
var targetId, target, clickedNode, clickedNodeId, state, hide;
targetId = this.element.getAttribute("data-target-id");
target = document.getElementById(targetId);
if (target !== null) {
event.preventDefault();
clickedNode = document.getElementById(location.hash.substr(2));
clickedNodeId = clickedNode ? clickedNode.getAttribute('id') : defaultTargetId;
showContent(targetId, [clickedNodeId]);
state = getState();
hide = (state && state.hasOwnProperty('hide')) ?
hideArray(state.hide, targetId) :
[targetId];
saveState({
show: clickedNodeId,
hide: hide
}, '');
location.hash = '#/' + targetId;
state = getState();
hide = (state && state.hasOwnProperty('hide')) ?
hideArray(state.hide, clickedNodeId) :
[clickedNodeId];
saveState({
show: targetId,
hide: hide
}, '');
}
};
anchors = document.getElementsByTagName("a");
for (i = 0; i < anchors.length; i += 1) {
if (anchors[i].getAttribute('data-target-id') !== null) {
link.push(new LightningTouch(anchors[i], touchHandler));
}
}
popHandler = function (event) {
var state, previousState, hide;
state = getState();
if (state) {
showContent(state.show, state.hide);
}
if (event.state && event.state.hide) {
//Retrieve adjacent pages and add our "show" value to their hide values
for (i = 0; i < event.state.hide.length; i += 1) {
previousState = getState(event.state.hide[i]);
if (previousState) {
hide = hideArray(previousState.hide, event.state.show);
setState({
show: event.state.hide[i],
hide: hide
}, location.pathname + '#/' + event.state.hide[i]);
}
}
showContent(event.state.show, event.state.hide);
}
};
window.addEventListener("popstate", popHandler, false);
};
if (document.readyState === "complete" || document.readyState === "interactive") {
init();
} else {
document.addEventListener('DOMContentLoaded', init, false);
}
}());
/**
* GA Click Tracking Code
*/
if (typeof jQuery != 'undefined') {
jQuery(document).ready(function($) {
var filetypes = /\.(zip|exe|dmg|pdf|doc.*|xls.*|ppt.*|mp3|txt|rar|wma|mov|avi|wmv|flv|wav)$/i;
var baseHref = '';
if (jQuery('base').attr('href') != undefined) baseHref = jQuery('base').attr('href');
jQuery('a').on('click', function(event) {
var el = jQuery(this);
var track = true;
var href = (typeof(el.attr('href')) != 'undefined' ) ? el.attr('href') :"";
var isThisDomain = href.match(document.domain.split('.').reverse()[1] + '.' + document.domain.split('.').reverse()[0]);
if (!href.match(/^javascript:/i)) {
var elEv = []; elEv.value=0, elEv.non_i=false;
if (href.match(/^mailto\:/i)) {
elEv.category = "email";
elEv.action = "click";
elEv.label = href.replace(/^mailto\:/i, '');
elEv.loc = href;
}
else if (href.match(filetypes)) {
var extension = (/[.]/.exec(href)) ? /[^.]+$/.exec(href) : undefined;
elEv.category = "download";
elEv.action = "click-" + extension[0];
elEv.label = href.replace(/ /g,"-");
elEv.loc = baseHref + href;
}
else if (href.match(/^https?\:/i) && !isThisDomain) {
elEv.category = "external";
elEv.action = "click";
elEv.label = href.replace(/^https?\:\/\//i, '');
elEv.non_i = true;
elEv.loc = href;
}
else if (href.match(/^tel\:/i)) {
elEv.category = "telephone";
elEv.action = "click";
elEv.label = href.replace(/^tel\:/i, '');
elEv.loc = href;
}
else track = false;
if (track) {
_gaq.push(['_trackEvent', elEv.category.toLowerCase(), elEv.action.toLowerCase(), elEv.label.toLowerCase(), elEv.value, elEv.non_i]);
if ( el.attr('target') == undefined || el.attr('target').toLowerCase() != '_blank') {
setTimeout(function() { location.href = elEv.loc; }, 400);
return false;
}
}
}
});
});
}
/* Placeholders.js v4.0.1 */
/*!
* The MIT License
*
* Copyright (c) 2012 James Allardice
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*/
!function(a){"use strict";function b(){}function c(){try{return document.activeElement}catch(a){}}function d(a,b){for(var c=0,d=a.length;d>c;c++)if(a[c]===b)return!0;return!1}function e(a,b,c){return a.addEventListener?a.addEventListener(b,c,!1):a.attachEvent?a.attachEvent("on"+b,c):void 0}function f(a,b){var c;a.createTextRange?(c=a.createTextRange(),c.move("character",b),c.select()):a.selectionStart&&(a.focus(),a.setSelectionRange(b,b))}function g(a,b){try{return a.type=b,!0}catch(c){return!1}}function h(a,b){if(a&&a.getAttribute(B))b(a);else for(var c,d=a?a.getElementsByTagName("input"):N,e=a?a.getElementsByTagName("textarea"):O,f=d?d.length:0,g=e?e.length:0,h=f+g,i=0;h>i;i++)c=f>i?d[i]:e[i-f],b(c)}function i(a){h(a,k)}function j(a){h(a,l)}function k(a,b){var c=!!b&&a.value!==b,d=a.value===a.getAttribute(B);if((c||d)&&"true"===a.getAttribute(C)){a.removeAttribute(C),a.value=a.value.replace(a.getAttribute(B),""),a.className=a.className.replace(A,"");var e=a.getAttribute(I);parseInt(e,10)>=0&&(a.setAttribute("maxLength",e),a.removeAttribute(I));var f=a.getAttribute(D);return f&&(a.type=f),!0}return!1}function l(a){var b=a.getAttribute(B);if(""===a.value&&b){a.setAttribute(C,"true"),a.value=b,a.className+=" "+z;var c=a.getAttribute(I);c||(a.setAttribute(I,a.maxLength),a.removeAttribute("maxLength"));var d=a.getAttribute(D);return d?a.type="text":"password"===a.type&&g(a,"text")&&a.setAttribute(D,"password"),!0}return!1}function m(a){return function(){P&&a.value===a.getAttribute(B)&&"true"===a.getAttribute(C)?f(a,0):k(a)}}function n(a){return function(){l(a)}}function o(a){return function(){i(a)}}function p(a){return function(b){return v=a.value,"true"===a.getAttribute(C)&&v===a.getAttribute(B)&&d(x,b.keyCode)?(b.preventDefault&&b.preventDefault(),!1):void 0}}function q(a){return function(){k(a,v),""===a.value&&(a.blur(),f(a,0))}}function r(a){return function(){a===c()&&a.value===a.getAttribute(B)&&"true"===a.getAttribute(C)&&f(a,0)}}function s(a){var b=a.form;b&&"string"==typeof b&&(b=document.getElementById(b),b.getAttribute(E)||(e(b,"submit",o(b)),b.setAttribute(E,"true"))),e(a,"focus",m(a)),e(a,"blur",n(a)),P&&(e(a,"keydown",p(a)),e(a,"keyup",q(a)),e(a,"click",r(a))),a.setAttribute(F,"true"),a.setAttribute(B,T),(P||a!==c())&&l(a)}var t=document.createElement("input"),u=void 0!==t.placeholder;if(a.Placeholders={nativeSupport:u,disable:u?b:i,enable:u?b:j},!u){var v,w=["text","search","url","tel","email","password","number","textarea"],x=[27,33,34,35,36,37,38,39,40,8,46],y="#ccc",z="placeholdersjs",A=new RegExp("(?:^|\\s)"+z+"(?!\\S)"),B="data-placeholder-value",C="data-placeholder-active",D="data-placeholder-type",E="data-placeholder-submit",F="data-placeholder-bound",G="data-placeholder-focus",H="data-placeholder-live",I="data-placeholder-maxlength",J=100,K=document.getElementsByTagName("head")[0],L=document.documentElement,M=a.Placeholders,N=document.getElementsByTagName("input"),O=document.getElementsByTagName("textarea"),P="false"===L.getAttribute(G),Q="false"!==L.getAttribute(H),R=document.createElement("style");R.type="text/css";var S=document.createTextNode("."+z+" {color:"+y+";}");R.styleSheet?R.styleSheet.cssText=S.nodeValue:R.appendChild(S),K.insertBefore(R,K.firstChild);for(var T,U,V=0,W=N.length+O.length;W>V;V++)U=Va;a++)U=a>> 0;
if (typeof fun !== "function") { throw new TypeError(); }
for (i = 0; i < len; i += 1) {
if (i in t && fun.call(thisp, t[i], i, t)) { return true; }
}
return false;
};
}
// Return true if haystack contains needle
function contains(haystack, needle) {
function equals(haystrand) {
return haystrand === needle;
}
return haystack.some(equals);
}
// Configuration and defaults.
var pluginName = "dependentQuestions",
defaults = {
"effect": "slide", // Must be one of "slide" or "fade"
"duration": "fast"
},
effectsMap = {
"slide": {
"show": "slideDown",
"hide": "slideUp"
},
"fade": {
"show": "fadeIn",
"hide": "fadeOut"
}
};
// The actual plugin constructor
function QuestionToggler(element, options) {
this.element = element;
// Handle options.
this.options = $.extend({}, defaults, options);
this._defaults = defaults;
this._name = pluginName;
this.init();
}
// Initialisation. Parses all the "data-depends-on" attributes and sets event
// listeners.
QuestionToggler.prototype.init = function () {
// Find all elements that have a "data-depends-on" attribute.
var questions, dataRe, dependentsMap, effect, duration;
effect = this.options.effect;
duration = this.options.duration;
dependentsMap = {};
// Regular expression for parsing data attribute.
dataRe = new RegExp("([^=]*)=(.*)");
// Fetch all the elements with "data-depends-on" attributes.
if (!this.element.find) { this.element = $(this.element); }
questions = this.element.find("[data-depends-on]").parents(".sq-form-question");
questions = questions.add(this.element.find("[data-depends-on]").parents(".conditional-section"));
// Get the value of a form element by name, even if it is a radio button
// or checkbox
function getValueByName(inputName) {
var multiInputs, el, elType, multi, checkVals;
multiInputs = ["radio", "checkbox"];
el = $("[name=\"" + inputName + "\"]");
if (el.length === 0) { return undefined; }
elType = el.attr("type");
multi = contains(multiInputs, elType);
if (!multi) { return el.val(); }
if (elType === "radio") { return el.filter(":checked").val(); }
if (elType === "checkbox") {
checkVals = $.map(el.filter(":checked"), function (checkbox) {
return $(checkbox).val();
});
return checkVals;
}
}
// Event handler for when a toggling element changes value.
function onTogglerChange(evt) {
var toggler, toggleSpec;
toggler = $(evt.target);
toggleSpec = toggler.data("toggle-spec") || [];
$.each(toggleSpec, function(i, spec) {
var dependents, showVal, val, negate, show, effectFunc, action;
dependents = spec.dependents;
showVal = spec.showVal;
negate = (showVal[0] === "!");
if (negate) {
showVal = showVal.substring(1);
}
val = getValueByName(toggler.attr("name"));
if (typeof val === "object") {
show = contains(val, showVal);
}
else {
show = (val === showVal);
}
if (negate) {
show = !show;
}
action = (show) ? "show" : "hide";
effectFunc = effectsMap[effect][action];
dependents[effectFunc](duration);
});
}
// Create a map of things that need to be toggled.
function addMapEntry(i, element) {
var data, el;
el = $(element);
data = el.find("[data-depends-on]").data("depends-on");
if (!dependentsMap[data]) {
dependentsMap[data] = el;
} else {
dependentsMap[data] = el.add(dependentsMap[data]);
}
}
questions.each(addMapEntry);
// Create event listeners
function setListener(key, dependents) {
var matches, inverse, name, showVal, toggler, toggleSpec;
// Parse the key value
matches = dataRe.exec(key);
if (!matches) { return; }
name = matches[1];
showVal = matches[2];
// Grab the relevant elements
toggler = $("[name=\"" + name + "\"]");
toggleSpec = toggler.data("toggle-spec") || [];
toggleSpec.push({
dependents: dependents,
showVal: showVal
});
toggler.data("toggle-spec", toggleSpec);
toggler.change(onTogglerChange);
}
$.each(dependentsMap, setListener);
// Set the initial state of each dependent question to match form state.
function showHideByValue(key, dependents) {
var matches, name, showVal, toggler, val, negate, func, show;
// Parse the key value
matches = dataRe.exec(key);
if (!matches) { return; }
name = matches[1];
showVal = matches[2];
// Work out whether or not to show the value
toggler = $("[name=\"" + name + "\"]");
negate = (showVal[0] === "!");
if (negate) {
showVal = showVal.substring(1);
}
val = getValueByName(toggler.attr("name"));
if (typeof val === "object") {
show = contains(val, showVal);
}
else {
show = (val === showVal);
}
if (negate) {
show = !show;
}
func = (show) ? "show" : "hide";
dependents[func]();
}
$.each(dependentsMap, showHideByValue);
};
// A really lightweight plugin wrapper around the constructor,
// preventing against multiple instantiations
$.fn[pluginName] = function (options) {
return this.each(function () {
if (!$.data(this, "plugin_" + pluginName)) {
$.data(
this,
"plugin_" + pluginName,
new QuestionToggler(this, options)
);
}
});
};
}(jQuery, window, document));
// console.log("jq-update-global.js");
/*global jQuery*/
/**
* jcu
* Global JS
*
* version: 0.0.1
* file: global.js
* author: Squiz Australia
* change log:
* 15-04-2015 14:22 - First revision
*/
/*
* Table of Contents
*
* - Global
* - Modules
* carousel
* homepagecourses
* secondarynav
* toolbarmenu
* accordion (0.0.6)
* magnific-popup (0.1.0)
* responsive-tables (0.0.1)
* slick (0.0.1)
*/
/*
--------------------
Global
--------------------
*/
// Declare JS Enabled.
$('body').removeClass('no-js').addClass('js-enabled');
var jcu = {"flag": {}, "fn": {}};
jcu.flag.responsiveState = "";
// $(document).ready(function() {
// document.addEventListener("DOMContentLoaded", function(){
// console.log("DOM Content Loaded");
// jcu.fn.bindBodyEvents();
// jcu.fn.checkForViewportChange();
// jcu.fn.resizeViewPort();
// jcu.fn.bindBrowseCourseButtons();
// jcu.fn.bindMobileMegamenuShowHide();
// jcu.fn.dropDownSorting();
// jcu.fn.loadBrokenLinkForm();
// jcu.fn.loadEventRegistration();
// jcu.fn.filterEvents();
// jcu.fn.initAutocomplete();
// jcu.fn.reinitAutocomplete();
// jcu.fn.triggerBodyEvents();
// jcu.fn.bindKeyBoardFocus();
// jcu.fn.toggleMobileMenu();
// jcu.fn.resizeTilesToImageHeight();
// jcu.fn.fixIframesinIE();
// jcu.fn.ajaxEventsFeed();
// jcu.fn.bindApplyButton();
// jcu.fn.initConditionalForms();
// jcu.fn.initTooltips();
// jcu.fn.ajaxEventsSearch();
// jcu.fn.ajaxEventsPagination();
// jcu.fn.fixIE10Tables();
// jcu.fn.fixDuplicateSubjectIds();
// jcu.fn.openApplyTab;
// });
// });
// $(window).load(function() {
// jcu.fn.resizeTilesToImageHeight();
// });
$(window).on("load", function(){
jcu.fn.resizeTilesToImageHeight();
});
jcu.fn.initTooltips = function () {
$('i').tooltip();
};
//Fix duplicate IDs on course subjects
jcu.fn.fixDuplicateSubjectIds = function(e){
'use strict';
$('#accordion__subjects').find('div').attr('id','');
};
jcu.fn.initConditionalForms = function (){
if ($(".custom-form form").length > 0 ) {
var $customForm = $(".custom-form form");
// Init dependent questions plugin
$customForm.dependentQuestions({ effect: 'slide', duration: 'slow' });
};
};
jcu.fn.fixIframesinIE = function(){
$('iframe[src^="https://www.youtube.com/embed"]').each(function(){
var url = $(this).attr("src");
var separator = (url.indexOf('?') > 0) ? '&' : '?';
$(this).attr('src', url + separator + 'wmode=transparent');
});
};
//Resize function
jcu.fn.resizeViewPort = function(){
'use strict';
var delayResize;
$(window).resize(function () {
clearTimeout(delayResize);
delayResize = setTimeout(jcu.fn.checkForViewportChange, 200);
});
};
// Viewport changes
jcu.fn.checkForViewportChange = function(){
'use strict';
//Annoying workaround for this FF bug (548397) in /_edit, check whether we can access the window css
if (window.getComputedStyle(document.body) !== null) {
jcu.flag.responsiveState = window.getComputedStyle(document.body,':before').content.replace(/"/g, '').replace(/\'/g,'');
}
var state = jcu.flag.responsiveState;
this.lastState = this.lastState || "";
if (jcu.flag.responsiveState != this.lastState) {
$('[class*="reflow__"]').each(function(){
var reflowChildCounter = $(this).find('.secondarynav').children().length;
if(reflowChildCounter == 0){
$(this).addClass('reflow-no-children');
} else {
$(this).removeClass('reflow-no-children');
}
});
switch(jcu.flag.responsiveState){
case 'mobile':
// do something when viewport is in mobile state
jcu.fn.moveThingsAround(state);
jcu.fn.resizeTilesToImageHeight();
break;
case 'tablet':
// do something when viewport is in tablet state
jcu.fn.moveThingsAround(state);
jcu.fn.closeMobileMenu();
jcu.fn.resizeTilesToImageHeight();
jcu.fn.bindTouchFakeHover();
break;
case 'desktop':
// do something when viewport is in desktop state
jcu.fn.moveThingsAround(state);
jcu.fn.closeMobileMenu();
jcu.fn.resizeTilesToImageHeight();
jcu.fn.stickyCourseHeader();
jcu.fn.bindTouchFakeHover();
break;
}
this.lastState = jcu.flag.responsiveState;
}
};
//Ajaxes the events on the events widget on location change
jcu.fn.ajaxEventsFeed = function() {
'use strict';
$('body').on('change','.eventlist__location-options', function(key, value){
var dropdown = $(this);
var searchlocation = this.value;
var container = $(this).parent().parent();
var ajaxURL = $(container).attr('data-ajax-url');
var searchType = $(container).attr('data-search-type');
var numResults = $(container).attr('data-search-num_results');
$.ajax({
url:ajaxURL + '?queries_location_query=' + searchlocation + '&type=' + searchType + '&num_results=' + numResults,
type: "POST",
success: function(response){
$(container).parent().html(response);
}
});
});
};
//Ajaxes the events on the events landing on search
jcu.fn.ajaxEventsSearch = function() {
'use strict';
$('body').on('submit','#page_calendar_events_search_3416', function(e){
var container = $(this).parent();
var ajaxURL = $(this).find('input[type=submit]').attr('data-ajax-url');
var searchValue = $(this).find('#queries_everything_query').val();
$.ajax({
url:ajaxURL + '?queries_everything_query=' + searchValue,
type: "POST",
success: function(response){
$(container).html(response);
}
});
e.preventDefault();
});
};
//Ajaxes the events on the events landing on pagination
jcu.fn.ajaxEventsPagination = function() {
'use strict';
$('body').on('click','.eventslandinglisting__pagination a', function(e){
var container = $(this).parents('form');
var pageNumber = $(this).text();
var ajaxURL = $(container).find('.eventslandinglisting__pagination').attr('data-ajax-url');
var sSearchPageAssetID = "3416";
if($(container).find('.eventslandinglisting__pagination').attr('data-assetID')){
sSearchPageAssetID = $(container).find('.eventslandinglisting__pagination').attr('data-assetID')
}
$.ajax({
url:ajaxURL + '?result_' + sSearchPageAssetID + '_result_page=' + pageNumber,
type: "POST",
success: function(response){
$(container).html(response);
}
});
e.preventDefault();
});
};
//Inside tiles resize
jcu.fn.resizeTilesToImageHeight = function(){
'use strict';
if ($('.insidebody__contentmain .tiles').length > 0){
var array = [];
var tileitem = $('.insidebody__contentmain .tiles__item');
$(tileitem).each(function(){
array.push($(this).find('img').height());
});
var maxHeight = Math.max.apply(Math, array);
if (maxHeight !== 0) {
$(tileitem).each(function(){
$(this).height(maxHeight);
});
};
};
};
//Megamenu (run only mobile up)
jcu.fn.toggleMobileMenu = function(){
'use strict';
$('.megamenu__mobile-menu-toggle').on('click',function(){
$(this).parents('.megamenu').toggleClass('show');
});
};
//Closes the mobile megamenu if you resize your viewport from mobile to tablet (runs at tablet)
jcu.fn.closeMobileMenu = function() {
'use strict';
var $openmegamenu = $('.megamenu.show');
if ($openmegamenu.length > 0) {
$openmegamenu.removeClass('show');
}
}
//Bind homepage course browse buttons to show/hide (all)
jcu.fn.bindBrowseCourseButtons = function(e){
'use strict';
if ($('.homepagecourses').length > 0) {
var $studyareasbutton = $('.toggle-study-areas');
var $studyoptions = $('.homepagecourses__browse-studyarea-options')
var $deliverybutton = $('.toggle-delivery');
var $deliveryoptions = $('.homepagecourses__browse-delivery-options');
var $searchbutton = $('.homepagecourses__search-mobile');
var $searchform = $('.homepagecourses__search-form');
$($studyareasbutton).on('click',function(e) {
$deliverybutton.removeClass('active');
$searchbutton.removeClass('active');
$searchform.removeClass('open');
$deliveryoptions.removeClass('open');
$(this).toggleClass('active');
$studyoptions.toggleClass('open');
e.stopPropagation();
});
$($deliverybutton).on('click',function(e) {
$studyareasbutton.removeClass('active');
$searchbutton.removeClass('active');
$searchform.removeClass('open');
$studyoptions.removeClass('open');
$(this).toggleClass('active');
$deliveryoptions.toggleClass('open');
e.stopPropagation();
});
$($searchbutton).on('click',function(e) {
$studyareasbutton.removeClass('active');
$deliverybutton.removeClass('active');
$studyoptions.removeClass('open');
$deliveryoptions.removeClass('open');
$(this).toggleClass('active');
$searchform.toggleClass('open');
e.stopPropagation();
});
// register functions to hide drop downs when bubbling up to the body
jcu.fn.registerBodyEvent("homepagebuttons", function(){
$studyareasbutton.removeClass('active');
$deliverybutton.removeClass('active');
$studyoptions.removeClass('open');
$deliveryoptions.removeClass('open');
//$searchbutton.removeClass('active');
//$searchform.removeClass('open');
});
};
};
jcu.fn.bindTouchFakeHover = function(){
'use strict';
$('.touch body').on('click focus', '.psuedo-hover-link', function(e) {
e.preventDefault();
e.stopPropagation();
var target = $(e.currentTarget);
var destination = $(target).attr('href');
var parents = $(target).parent();
if ($(target).hasClass('opened')){
window.location = destination;
};
$(parents).siblings().find('.opened').removeClass('opened');
$(parents).siblings().removeClass('open');
if ($(parents).find('.psuedo-hover-sublist:first').length > 0) {
$(target).addClass('opened');
parents.addClass('open');
} else {
window.location = destination;
};
jcu.fn.registerBodyEvent('click focus', function(){
$('.psuedo-hover-link').removeClass('opened');
$('.psuedo-hover-link').parent().removeClass('open');
});
});
};
//Mobile megamenu show/hide buttons (mobile only)
jcu.fn.bindMobileMegamenuShowHide = function(){
'use strict';
$('.megamenu__level-toggle').on('click',function() {
$(this).parent().toggleClass('open');
});
};
//Function for moving elements around the page depending on breakpoints
jcu.fn.moveThingsAround = function(state){
'use strict';
//console.log('moving things around for ' + state);
$('.reflow').each(function(key, val){
$('.reflow__' + $(val).attr('id') + '__' + state + '').append(val);
});
}
//Load the broken link form onto 404
jcu.fn.loadBrokenLinkForm = function(){
'use strict';
var form = $('.report-broken-link-form');
if (form.length > 0) {
var url = $(form).attr('data-ajax-url');
$(form).load(url);
};
}
//Load the event registration form into events
jcu.fn.loadEventRegistration = function(){
'use strict';
if ($('.event__registration').length > 0) {
var div = $('.event__registration');
var url = $(div).attr('data-ajax-url');
var event = $(div).attr('data-form-id');
$(div).load(url + '&event=' + event);
};
}
// initialise the sorting select drop down menus for styling
jcu.fn.dropDownSorting = function(){
'use strict';
if($('.sorting__select').length > 0){
jcu.fn.initSortingSelect();
$('body').on('click', '.selector li a', jcu.fn.sortingListClicked);
$('#search_page_94263').on('change', 'select', jcu.fn.sortingSelectChanged);
$('body').on('click', '.sorting__select-title a', jcu.fn.sortListToggle);
}
}
// takes a select list and inserts an unordered list matching the select options
// requires select field to be within wrapper elemetn with class "sorting__select" - 1 select per parent wrapper.
jcu.fn.initSortingSelect = function(){
'use strict';
// loop through each sorting elements
$('.sorting__select').each(function(){
var $this = $(this);
if($this.find('select').length > 0){
// $this.find('select').addClass('hide-for-desktop');
$this.find('select').addClass('hidden');
// base template
var template = $('');
// var title = $('');
var title = $('');
// loop through each option
$this.find('select option').each(function(){
var val = $(this).val();
var txt = $(this).text();
// reflect the currently 'selected' option in the list
if($(this).is(':selected')){
$('' + txt + ' ').appendTo(template);
title.find('.sorting__text').text(txt);
} else {
$('' + txt + ' ').appendTo(template);
}
});
// insert the list below the select field
title.appendTo($this);
template.appendTo($this);
}
});
};
// when a sorting list item is clicked...
jcu.fn.sortingListClicked = function(e){
'use strict';
e.preventDefault();
// change selected option
var val = $(this).parent('li').data('value');
var txt = $(this).text();
var $sortingSelect = $(this).parents('.sorting__select');
$sortingSelect.find('select option:selected').prop("selected", false);
$sortingSelect.find('select option[value="' + val + '"]').prop("selected", true);
$sortingSelect.find('.sorting__text').text(txt);
$sortingSelect.find('.sorting__select-title a').trigger('click');
$sortingSelect.find('select').trigger('change');
};
// when a select is changed
jcu.fn.sortingSelectChanged = function(){
'use strict';
var $select = $(this);
var optionVal = $select.val();
// check for the grid option
if($select.attr('id') === 'view_option'){
$('.video-page__content').attr('data-layouttype', optionVal);
} else {
// otherwise hit up the ajax request
jcu.fn.sortFormSubmit($(this).parents('form'));
}
$select.siblings('.selector').find('.selected').removeClass('selected');
$select.siblings('.selector').find('[data-value="' + optionVal + '"]').addClass('selected');
};
jcu.fn.sortListToggle = function(e){
'use strict';
e.preventDefault();
e.stopPropagation();
var selector = $(this).parents('.sorting__select').find('.selector');
if(selector.hasClass('active')){
selector.removeClass('active');
} else {
$('.selector.active').removeClass('active');
selector.addClass('active');
}
// register functions to hide drop downs when bubbling up to the body
jcu.fn.registerBodyEvent("searchswitcher", function(){
$('.selector.active').removeClass('active');
});
};
//Function for events filtering
jcu.fn.filterEvents = function(){
'use strict';
//Only do if we're on the filtering page
if ($('.eventsfiltering__wrapper').length > 0) {
//Check if localStorage is working in the browser
if (typeof(localStorage) !== "undefined"){
//Check if there are any saved event preferences in localstorage
if (localStorage.getItem('eventsfilter') === null) {
//console.log('no events in local storage')
} else {
//If there are, uncheck all boxes and recheck the ones from localstorage
$('.eventsfiltering__checkbox').prop('checked',false);
var checkedarray = JSON.parse(localStorage.getItem('eventsfilter'));
$(checkedarray).each(function(e){
$('#filtering-' + checkedarray[e]).prop('checked', true);
});
jcu.fn.ajaxFilteredEvents();
}
//Checkbox change event to ajax in content
$('.eventsfiltering__checkbox').on('change', function(){
jcu.fn.ajaxFilteredEvents();
});
};
$('.eventsfiltering__button.js-uncheck-all').on('click', function(){
$(this).parent().find('input[type="checkbox"]').prop('checked', false);
});
$('.eventsfiltering__button.js-check-all').on('click', function(){
$(this).parent().find('input[type="checkbox"]').prop('checked', true);
});
};
};
jcu.fn.ajaxFilteredEvents = function() {
'use strict';
var array = [];
var storagearray = [];
//Grab the URL to ajax the events list later
var ajaxURL = $('.eventsfiltering__wrapper').data('ajax-url');
//Grab the current URL otherwise we won't know what to submit to later
var currentURL = $('.eventsfiltering__wrapper').data('current-url');
//Grab all checked boxes, save an array for search, and for localstorage
$('.eventsfiltering__checkbox:checked').each(function() {
var $thisCheckbox = $(this);
array.push([$thisCheckbox.attr('value'), $(this).data('filter-by')]);
storagearray.push($thisCheckbox.attr('value'));
});
//Check if localStorage is working in the browser
if (typeof(localStorage) !== "undefined"){
localStorage.setItem('eventsfilter',JSON.stringify(storagearray));
};
//start with parameter for searchquery
var parameter = '?';
//Build a search string out of the array
$.each(array, function( index, value ) {
parameter = parameter + 'queries_' + value[1] + '_query[' + index + ']=' + value[0] + '&';
});
//Ajax in content
$('.insidebody__contentmain').load(ajaxURL + parameter, function(response, status, xhr){
if ( status == "error" ) {
var msg = "Sorry but there was an error: ";
$('.eventsfiltering__wrapper').html( msg + xhr.status + " " + xhr.statusText );
} else {
$('.insidebody__contentmain form').attr('action', currentURL);
}
});
}
jcu.fn.initAutocomplete = function() {
'use strict';
$('.autocomplete-this').each(function(){
var collection = $(this).data('collection');
// funnelback page form query completion
jQuery($(this)).fbcompletion({
'enabled' : 'enabled',
'collection' : collection,
'program' : 'https://search.jcu.edu.au/s/suggest.json',
'interactionLog' : 'https://search.jcu.edu.au/s/log',
'format' : 'extended',
'alpha' : '.5',
'show' : '7',
'sort' : '0',
'length' : '3',
'delay' : '0',
'profile' : '_default'
});
});
//Some fix for the autocomplete width being wacky
jQuery.ui.autocomplete.prototype._resizeMenu = function () {
var ul = this.menu.element;
ul.outerWidth(this.element.outerWidth());
}
};
jcu.fn.reinitAutocomplete = function() {
'use strict';
$('.globalsearch__options').on('change',function(e){
var _this = e.target;
var selected = $(_this).val();
$('#queries_site_search_query').attr('data-collection', selected);
jcu.fn.initAutocomplete();
});
};
jcu.fn.stickyCourseHeader = function(){
'use strict';
if ($('.coursestitle_wrapper').length > 0) {
$('.coursestitle_wrapper').sticky({
topSpacing:30
});
//console.log('making header sticky')
};
}
jcu.fn.bindKeyBoardFocus = function(){
'use strict';
//Bind keyboard tabbing to open megamenus on focus
$('html:not(".touch")').on('focus', '.psuedo-hover-link', function(){
$('.psuedo-hover-link').parent().removeClass('open');
$(this).parent().addClass('open');
});
}
jcu.fn.fixOldAccordions = function(){
'use strict';
//Fix old templated accordions to work in new design/js
// "accordion" class needed for uber accordion to be applied to it
$('#accordion').addClass('accordion');
$('#accordion h1, #accordion h2, #accordion h3').each(function(key, value) {
var $heading = $(this);
var $content = $heading.nextUntil('h1, h2, h3');
//Fix headings
var $headingwords = $heading.text();
var $strippedheadingwords = $headingwords.replace(/[^a-zA-Z0-9]+/g, '');;
$heading.html('' + $headingwords + ' ');
//Fix content divs and link them
$content.wrapAll('
');
//Fix heading divs and link them
// $($heading).next('div').andSelf().wrapAll('
');
$($heading).next('div').addBack().wrapAll('
');
});
};
jcu.fn.bindApplyButton = function() {
$('.courses__applynow').on('click',function(){
var howToApply = $($(this).attr("href"));
howToApply.addClass('uber-accordion__target-active');
howToApply.parent().find('h2 a').addClass('uber-accordion__button-active');
var point = $(howToApply).offset().top - 200;
$('html, body').animate({
scrollTop: point
}, 500);
return false;
});
};
jcu.fn.fixIE10Tables = function(){
if (navigator.userAgent.indexOf('MSIE 10') > -1) {
jQuery('table').wrap('').unwrap();
}
};
jcu.fn.bindBodyEvents = function(){
// console.log("bindBodyEvents");
'use strict';
jcu.register = {};
jcu.register.bodyEventList = {};
jcu.fn.triggerBodyEvents = function(){
// bind to body - for each registered event, perform function
$('body').on('click', function(){
$.each(jcu.register.bodyEventList, function(key,callbackFunction){
(callbackFunction)();
});
});
}
jcu.fn.registerBodyEvent = function(name, callbackFunction){
jcu.register.bodyEventList[name] = callbackFunction;
// console.log('doing ' + name)
}
};
// Open the apply tab when a link is clicked
jcu.fn.openApplyTab = function(){
var apply_tab = document.querySelector('#apply-tab');
var apply_panel = document.querySelector('#apply-panel');
if (apply_tab && apply_panel) {
apply_tab['classList'].add('resp-tab-active');
apply_panel['classList'].add('resp-tab-content-active');
apply_panel.focus();
}
};
/*
--------------------
Modules
--------------------
*/
/*-- module:carousel --*/
(function($){
'use strict';
}(jQuery));
/*-- module:homepagecourses --*/
(function($){
'use strict';
}(jQuery));
/*-- module:secondarynav --*/
(function($){
'use strict';
}(jQuery));
/*-- module:toolbarmenu --*/
(function($){
'use strict';
}(jQuery));
/*-- module:squiz-module-accordion --*/
(function($){
'use strict';
//Hack to fix old JCU accordions before we do the rest.
if ($("#accordion").length > 0 ) {
jcu.fn.fixOldAccordions();
};
// First example is a standard accordion
$('.accordion').UberAccordion({
buttonClass: 'accordion__link',
autoExpand: function($elem) {
return this.$elem.attr('data-auto-expand');
},
toggle: true,
multiple: true,
expandOnFocus: false,
preventDefaultButton: true,
hashChange: true
});
// Second example is a tab-like setup
$('.tabs').UberAccordion({
buttonClass: 'tabs__link',
autoExpand: function() {
return window.location.hash;
},
toggle: false,
multiple: false,
preventDefaultButton: true,
});
}(jQuery));
/*-- module:squiz-module-magnific-popup --*/
(function($){
'use strict';
$('.popup__image').magnificPopup({
delegate: 'a',
type: 'image',
image: {
titleSrc: 'title'
}
});
$('.popup__gallery').magnificPopup({
delegate: 'a',
type: 'image',
gallery: {
enabled: true
},
image: {
titleSrc: 'title'
}
});
$('.image-gallery').magnificPopup({
delegate: 'a.img-bx',
type: 'image',
gallery: {
enabled: true
},
image: {
titleSrc: 'title'
}
});
}(jQuery));
/*-- module:squiz-module-responsive-tables --*/
(function($){
'use strict';
$('.responsive-table').each(function() {
var headings = $('th', this).map(function(){
return $(this).text();
});
$('tr', this).each(function(){
var $row = $(this);
$.each(headings, function(i, heading) {
$('td:eq(' + i + ')', $row).attr('data-th', heading);
});
});
});
}(jQuery));
/*-- module:squiz-module-slick --*/
(function($){
'use strict';
var $slideshow = $('.slick-slideshow');
$slideshow.slick({
dots: true,
arrows: true,
speed: 700,
slide: '.slick-slideshow__slide',
slidesToScroll: 1,
slidesToShow: 1,
autoplay: true,
autoplaySpeed: 10000,
pauseOnDotsHover: true,
pauseOnHover: false
});
$slideshow.on('beforeChange', function(event, slick, currentSlide, nextSlide) {
//console.log('current slide is' + currentSlide);
//console.log('next slide is' + nextSlide);
$('#backgroundcarousel').slick('slickGoTo', nextSlide);
});
var $backgroundslideshow = $('.slick-bg-slideshow');
//Carousel init
$backgroundslideshow.slick({
dots: false,
arrows: false,
fade: true,
speed: 400,
slide: '.slick-bg-slideshow__slide',
slidesToScroll: 1,
slidesToShow: 1
});
$('.slick-slideshow .slick-slide').hover(
//on mouse enter
function(event){
$slideshow.slick('slickPause');
},
//on mouse leave
function(){
if($('.slick-pause').hasClass('paused')){
$slideshow.slick('slickPause');
}
else {
$slideshow.slick('slickPlay');
}
}
);
$('.slick-dots').after('
0 ');
$('.slick-pause').on('click',function(){
var $pauseBtn = $(this);
if($pauseBtn.hasClass('paused')){
$slideshow.slick('slickPlay');
$pauseBtn.removeClass('paused');
}
else{
$slideshow.slick('slickPause');
$pauseBtn.addClass('paused');
}
});
}(jQuery));
document.addEventListener("DOMContentLoaded", function(){
// console.log("DOM Content Loaded END ");
jcu.fn.bindBodyEvents();
jcu.fn.checkForViewportChange();
jcu.fn.resizeViewPort();
jcu.fn.bindBrowseCourseButtons();
jcu.fn.bindMobileMegamenuShowHide();
jcu.fn.dropDownSorting();
jcu.fn.loadBrokenLinkForm();
jcu.fn.loadEventRegistration();
jcu.fn.filterEvents();
jcu.fn.initAutocomplete();
jcu.fn.reinitAutocomplete();
jcu.fn.triggerBodyEvents();
jcu.fn.bindKeyBoardFocus();
jcu.fn.toggleMobileMenu();
jcu.fn.resizeTilesToImageHeight();
jcu.fn.fixIframesinIE();
jcu.fn.ajaxEventsFeed();
jcu.fn.bindApplyButton();
jcu.fn.initConditionalForms();
jcu.fn.initTooltips();
jcu.fn.ajaxEventsSearch();
jcu.fn.ajaxEventsPagination();
jcu.fn.fixIE10Tables();
jcu.fn.fixDuplicateSubjectIds();
jcu.fn.openApplyTab;
});
// Funnelback auto-completion jQuery plugin
// Author: Nicolas Guillaumin, Matt Sheppard
// Copyright Funnelback, 2012
// $Id: jquery.funnelback-completion.js 41163 2014-11-28 06:00:43Z msheppard $
(function($) {
$.fn.fbcompletion = function(settings) {
var facetBasedCompletionSuccess = function(config, request, data) {
var responses = new Array();
var partial_query_parts = request.term.split(" ");
var last_partial_term = partial_query_parts[partial_query_parts.length -1];
var partial_complete_query = request.term.substring(0,
request.term.length - last_partial_term.length);
if(last_partial_term.substring(0,1) == '|') {
last_partial_term = last_partial_term.substring(last_partial_term.indexOf(':') + 1, last_partial_term.length);
}
var lower_last_partial_term = last_partial_term.toLowerCase();
var facets = data.response.facets;
var rank = 1;
for (var i=0; i
0) {
compiledTmpl = jQuery('#'+config.tmplId).template();
} else {
compiledTmpl = jQuery('').template();
}
}
$(targetElement).autocomplete( {
appendTo: ($("#fb-queryform").length > 0) ? "#fb-queryform" : "body",
source: function (request, response) {
var finished = [!config.searchBasedCompletionEnabled, !config.standardCompletionEnabled];
var allResponses = [new Array(), new Array()];
if(config.searchBasedCompletionEnabled) {
jQuery.ajax({
type: 'GET',
url: config.searchBasedCompletionProgram
+ '?'
+ replaceQueryInQuestionWithPartialQuery(config.query, request.term,
config.searchBasedCompletionProfile),
dataType: 'jsonp',
error: function(xhr, textStatus, errorThrown) {
if (window.console) {
console.log('Autocomplete error: ' + textStatus + ', ' + errorThrown);
}
},
success: function(data) {
//Call the function that will process the json.
allResponses[0] = config.searchBasedCompletionFunction(config, request, data);
finished[0] = true;
if(finished[1]) {
response (allResponses[1].concat(allResponses[0]));
}
}
});
}
if(config.standardCompletionEnabled) {
jQuery.ajax({
type: 'GET',
url: config.program
+ '?collection=' + config.collection
+ '&partial_query=' + request.term.replace(/ /g, '+')
+ '&show=' + config.show
+ '&sort=' + config.sort
+ '&alpha=' + config.alpha
+ '&fmt=' + ((config.format == 'simple') ? 'json' : 'json++')
+ ((config.profile !== '') ? '&profile=' + config.profile : '' )
,
dataType: 'jsonp',
error: function(xhr, textStatus, errorThrown) {
if (window.console) {
console.log('Autocomplete error: ' + textStatus + ', ' + errorThrown);
}
},
success: function(data) {
var responses = allResponses[1];
for (var i=0; i').parent().html();
} else {
label = '[Error: jQuery template plugin is unavailable]';
}
break;
case 'C': // JS callback
label = eval(item.extra.disp);
break;
case 'T': // Plain text
label = item.label.replace(new RegExp('('+item.matchOn+')', 'i'), '$1 ');
break;
case 'H': // HTML
// Label cannot be highlighted as there's no way
// to skip HTML tags when running the regexp, possibly
// corrupting them (ex: '+item.category+"");
currentCategory = item.category;
}
that._renderItemData(ul, item);
});
}
});
return this;
};
/**
* Replaces the query= value with the completed part of the partial query
*
*e.g. if question is query=old&bar=foo and partialQuery is 'hello moth'
*it will return query=hello&bar=foo
*
* */
function replaceQueryInQuestionWithPartialQuery(encodedQuestion, partialQuery, profile) {
var question = htmlDecode(encodedQuestion);
var partial_query_parts = partialQuery.split(" ");
var last_partial_term = partial_query_parts[partial_query_parts.length -1];
var partial_complete_query = partialQuery.substring(0, partialQuery.length - last_partial_term.length);
if(partial_complete_query.length == 0) {
partial_complete_query = '!padrenull';
}
var questionsParts = question.split('&');
var newQuestion = '';
var changedQuery = false;
var changedProfile = false;
for(var i = 0; i < questionsParts.length; i++) {
if(questionsParts[i].substring(0, 6) == 'query=') {
newQuestion += 'query=' + partial_complete_query;
changedQuery = true;
} else if(profile != null && questionsParts[i].substring(0, 8) == 'profile=') {
newQuestion += 'profile=' + profile;
changedProfile = true;
} else {
newQuestion += questionsParts[i];
}
newQuestion += '&';
}
if(!changedQuery) {
newQuestion += 'query=' + partial_complete_query;
newQuestion += '&';
}
if(!changedProfile && profile != null) {
newQuestion += 'profile=' + profile;
newQuestion += '&';
}
return newQuestion.substring(0, newQuestion.length -1);
}
function htmlDecode(value){
return $('
').html(value).text();
}
})(jQuery);
// Easy Responsive Tabs Plugin
(function ($) {
$.fn.extend({
easyResponsiveTabs: function (options) {
//Set the default values, use comma to separate the settings, example:
var defaults = {
type: 'default', //default, vertical, accordion;
width: 'auto',
fit: true,
closed: false,
activate: function(){}
}
//Variables
var options = $.extend(defaults, options);
var opt = options, jtype = opt.type, jfit = opt.fit, jwidth = opt.width, vtabs = 'vertical', accord = 'accordion';
//Events
$(this).bind('tabactivate', function(e, currentTab) {
if(typeof options.activate === 'function') {
options.activate.call(currentTab, e)
}
});
//Main function
this.each(function () {
var $respTabs = $(this);
var $respTabsList = $respTabs.find('ul.resp-tabs-list');
$respTabs.find('ul.resp-tabs-list li').addClass('resp-tab-item');
$respTabs.css({
'display': 'block',
'width': jwidth
});
$respTabs.find('.resp-tabs-container > div').addClass('resp-tab-content');
jtab_options();
//Properties Function
function jtab_options() {
if (jtype == vtabs) {
$respTabs.addClass('resp-vtabs');
}
if (jfit == true) {
$respTabs.css({ width: '100%', margin: '0px' });
}
if (jtype == accord) {
$respTabs.addClass('resp-easy-accordion');
$respTabs.find('.resp-tabs-list').css('display', 'none');
}
}
//Assigning the h2 markup to accordion title
var $tabItemh2;
$respTabs.find('.resp-tab-content').before(" ");
var itemCount = 0;
$respTabs.find('.resp-accordion').each(function () {
$tabItemh2 = $(this);
var innertext = $respTabs.find('.resp-tab-item:eq(' + itemCount + ')').html();
$respTabs.find('.resp-accordion:eq(' + itemCount + ')').append(innertext);
$tabItemh2.attr('aria-controls', 'tab_item-' + (itemCount));
itemCount++;
});
//Assigning the 'aria-controls' to Tab items
var count = 0,
$tabContent;
$respTabs.find('.resp-tab-item').each(function () {
$tabItem = $(this);
$tabItem.attr('aria-controls', 'tab_item-' + (count));
$tabItem.attr('role', 'tab');
//First active tab, keep closed if option = 'closed' or option is 'accordion' and the element is in accordion mode
if(options.closed !== true && !(options.closed === 'accordion' && !$respTabsList.is(':visible')) && !(options.closed === 'tabs' && $respTabsList.is(':visible'))) {
// Changed to open diploma tab
// $respTabs.find('.resp-tab-item').first().addClass('resp-tab-active');
// $respTabs.find('.resp-accordion').first().addClass('resp-tab-active');
// $respTabs.find('.resp-tab-content').first().addClass('resp-tab-content-active').attr('style', 'display:block');
$respTabs.find('.resp-tab-item').eq(1).addClass('resp-tab-active');
$respTabs.find('.resp-accordion').eq(1).addClass('resp-tab-active');
$respTabs.find('.resp-tab-content').eq(1).addClass('resp-tab-content-active').attr('style', 'display:block');
}
//Assigning the 'aria-labelledby' attr to tab-content
var tabcount = 0;
$respTabs.find('.resp-tab-content').each(function () {
$tabContent = $(this);
$tabContent.attr('aria-labelledby', 'tab_item-' + (tabcount));
tabcount++;
});
count++;
});
//Tab Click action function
$respTabs.find("[role=tab]").each(function () {
var $currentTab = $(this);
$currentTab.click(function () {
var $tabAria = $currentTab.attr('aria-controls');
if ($currentTab.hasClass('resp-accordion') && $currentTab.hasClass('resp-tab-active')) {
$respTabs.find('.resp-tab-content-active').slideUp('', function () { $(this).addClass('resp-accordion-closed'); });
$currentTab.removeClass('resp-tab-active');
return false;
}
if (!$currentTab.hasClass('resp-tab-active') && $currentTab.hasClass('resp-accordion')) {
$respTabs.find('.resp-tab-active').removeClass('resp-tab-active');
$respTabs.find('.resp-tab-content-active').slideUp().removeClass('resp-tab-content-active resp-accordion-closed');
$respTabs.find("[aria-controls=" + $tabAria + "]").addClass('resp-tab-active');
$respTabs.find('.resp-tab-content[aria-labelledby = ' + $tabAria + ']').slideDown().addClass('resp-tab-content-active');
} else {
console.log('current tag ' + $currentTab.attr('aria-controls'));
console.log('new tag ' + $tabAria);
$respTabs.find('.resp-tab-active').removeClass('resp-tab-active');
$respTabs.find('.resp-tab-content-active').removeAttr('style').removeClass('resp-tab-content-active').removeClass('resp-accordion-closed');
$respTabs.find("[aria-controls=" + $tabAria + "]").addClass('resp-tab-active');
$respTabs.find('.resp-tab-content[aria-labelledby = ' + $tabAria + ']').addClass('resp-tab-content-active').attr('style', 'display:block');
}
//Trigger tab activation event
$currentTab.trigger('tabactivate', $currentTab);
});
//Window resize function
$(window).resize(function () {
$respTabs.find('.resp-accordion-closed').removeAttr('style');
});
});
});
}
});
})(jQuery);
$(document).ready(function () {
$('.horizontalTab').easyResponsiveTabs({
type: 'default', //Types: default, vertical, accordion
width: 'auto', //auto or any width like 600px
fit: true, // 100% fit in a container
closed: 'accordion', // Start closed if in accordion view
activate: function(event) { // Callback function if tab is switched
var $tab = $(this);
var $info = $('#tabInfo');
var $name = $('span', $info);
$name.text($tab.text());
$info.show();
}
});
$('.verticalTab').easyResponsiveTabs({
type: 'vertical',
width: 'auto',
fit: true
});
});