').appendTo('.wpcf7-select-parent');
// wrap variation forms select and add arrow
jQuery('table.variations select').wrap('');
jQuery('
').appendTo('table.variations .avada-select-parent');
// wrap gravity forms select and add arrow
jQuery('.gform_wrapper select:not([multiple])').wrap('');
jQuery('
').appendTo('.gravity-select-parent');
// wrap woo and bbpress select and add arrow
jQuery('#bbp_stick_topic_select, #bbp_topic_status_select, #bbp_forum_id, #bbp_destination_topic').wrap('').after('
');
});
jQuery(document).bind('gform_post_conditional_logic', function(){
var select = jQuery('.gform_wrapper select');
jQuery(select).each(function() {
if(jQuery(this).hasClass('chzn-done') && jQuery(this).parent().hasClass('gravity-select-parent')) {
jQuery('.gform_wrapper select.chzn-done').unwrap('');
jQuery('.gform_wrapper select.chzn-done').parent().find('.select-arrow').remove();
}
});
});
/*!
* Bootstrap v3.1.1 (http://getbootstrap.com)
* Copyright 2011-2014 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* scrollspy.js
* modified by ThemeFusion 2014
*/
+function ($) {
'use strict';
// SCROLLSPY CLASS DEFINITION
// ==========================
function ScrollSpy(element, options) {
var href;
var process = $.proxy(this.process, this);
this.$element = $(element).is('body') ? $(window) : $(element);
this.$body = $('body');
this.$scrollElement = this.$element.on('scroll.bs.scroll-spy.data-api', process);
this.options = $.extend({}, ScrollSpy.DEFAULTS, options);
this.selector = (this.options.target
|| ((href = $(element).attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
|| '') + ' .fusion-navbar-nav li > a';
this.offsets = $([]);
this.targets = $([]);
this.activeTarget = null;
this.refresh();
this.process();
}
ScrollSpy.DEFAULTS = {
offset: 10
};
ScrollSpy.prototype.refresh = function () {
var offsetMethod = this.$element[0] == window ? 'offset' : 'position';
this.offsets = $([]);
this.targets = $([]);
var self = this;
var $targets = this.$body
.find(this.selector)
.map(function () {
var $el = $(this);
var href = $el.data('target') || $el.attr('href');
var $href = /^#./.test(href) && $(href);
return ($href
&& $href.length
&& $href.is(':visible')
&& [[ $href[offsetMethod]().top + (!$.isWindow(self.$scrollElement.get(0)) && self.$scrollElement.scrollTop()), href ]]) || null;
})
.sort(function (a, b) { return a[0] - b[0]; })
.each(function () {
self.offsets.push(this[0]);
self.targets.push(this[1]);
});
};
ScrollSpy.prototype.process = function () {
var scrollTop = this.$scrollElement.scrollTop() + this.options.offset;
var scrollHeight = this.$scrollElement[0].scrollHeight || this.$body[0].scrollHeight;
var maxScroll = scrollHeight - this.$scrollElement.height();
var offsets = this.offsets;
var targets = this.targets;
var activeTarget = this.activeTarget;
var i;
if (scrollTop >= maxScroll) {
return activeTarget != (i = targets.last()[0]) && this.activate(i);
}
for (i = offsets.length; i--;) {
activeTarget != targets[i]
&& scrollTop >= offsets[i]
&& (!offsets[i + 1] || scrollTop <= offsets[i + 1])
&& this.activate( targets[i] );
}
};
ScrollSpy.prototype.activate = function (target) {
this.activeTarget = target;
$(this.selector)
.parents('.current-menu-item')
.removeClass('current-menu-item');
var selector = this.selector +
'[data-target="' + target + '"],' +
this.selector + '[href="' + target + '"]';
var active = $(selector)
.parents('li')
.addClass('current-menu-item');
if (active.parent('.sub-menu').length) {
active = active
.closest('li.fusion-dropdown-menu')
.addClass('current-menu-item');
}
active.trigger('activate.bs.scrollspy');
};
// SCROLLSPY PLUGIN DEFINITION
// ===========================
var old = $.fn.scrollspy;
$.fn.scrollspy = function (option) {
return this.each(function () {
var $this = $(this);
var data = $this.data('bs.scrollspy');
var options = typeof option == 'object' && option;
if (!data) $this.data('bs.scrollspy', (data = new ScrollSpy(this, options)));
if (typeof option == 'string') data[option]();
});
};
$.fn.scrollspy.Constructor = ScrollSpy;
// SCROLLSPY NO CONFLICT
// =====================
$.fn.scrollspy.noConflict = function () {
$.fn.scrollspy = old;
return this;
};
// SCROLLSPY DATA-API
// ==================
$(window).on('load', function () {
$('[data-spy="scroll"]').each(function () {
var $spy = $(this);
$spy.scrollspy($spy.data());
});
});
}(jQuery);
// Generated by CoffeeScript 1.6.2
/*
jQuery Waypoints - v2.0.3
Copyright (c) 2011-2013 Caleb Troughton
Dual licensed under the MIT license and GPL license.
https://github.com/imakewebthings/jquery-waypoints/blob/master/licenses.txt
*/
(function() {
var __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; },
__slice = [].slice;
(function(root, factory) {
if (typeof define === 'function' && define.amd) {
return define('waypoints', ['jquery'], function($) {
return factory($, root);
});
} else {
return factory(root.jQuery, root);
}
})(this, function($, window) {
var $w, Context, Waypoint, allWaypoints, contextCounter, contextKey, contexts, isTouch, jQMethods, methods, resizeEvent, scrollEvent, waypointCounter, waypointKey, wp, wps;
$w = $(window);
isTouch = __indexOf.call(window, 'ontouchstart') >= 0;
allWaypoints = {
horizontal: {},
vertical: {}
};
contextCounter = 1;
contexts = {};
contextKey = 'waypoints-context-id';
resizeEvent = 'resize.waypoints';
scrollEvent = 'scroll.waypoints';
waypointCounter = 1;
waypointKey = 'waypoints-waypoint-ids';
wp = 'waypoint';
wps = 'waypoints';
Context = (function() {
function Context($element) {
var _this = this;
this.$element = $element;
this.element = $element[0];
this.didResize = false;
this.didScroll = false;
this.id = 'context' + contextCounter++;
this.oldScroll = {
x: $element.scrollLeft(),
y: $element.scrollTop()
};
this.waypoints = {
horizontal: {},
vertical: {}
};
$element.data(contextKey, this.id);
contexts[this.id] = this;
$element.bind(scrollEvent, function() {
var scrollHandler;
if (!(_this.didScroll || isTouch)) {
_this.didScroll = true;
scrollHandler = function() {
_this.doScroll();
return _this.didScroll = false;
};
return window.setTimeout(scrollHandler, $[wps].settings.scrollThrottle);
}
});
$element.bind(resizeEvent, function() {
var resizeHandler;
if (!_this.didResize) {
_this.didResize = true;
resizeHandler = function() {
$[wps]('refresh');
return _this.didResize = false;
};
return window.setTimeout(resizeHandler, $[wps].settings.resizeThrottle);
}
});
}
Context.prototype.doScroll = function() {
var axes,
_this = this;
axes = {
horizontal: {
newScroll: this.$element.scrollLeft(),
oldScroll: this.oldScroll.x,
forward: 'right',
backward: 'left'
},
vertical: {
newScroll: this.$element.scrollTop(),
oldScroll: this.oldScroll.y,
forward: 'down',
backward: 'up'
}
};
if (isTouch && (!axes.vertical.oldScroll || !axes.vertical.newScroll)) {
$[wps]('refresh');
}
$.each(axes, function(aKey, axis) {
var direction, isForward, triggered;
triggered = [];
isForward = axis.newScroll > axis.oldScroll;
direction = isForward ? axis.forward : axis.backward;
$.each(_this.waypoints[aKey], function(wKey, waypoint) {
var _ref, _ref1;
if ((axis.oldScroll < (_ref = waypoint.offset) && _ref <= axis.newScroll)) {
return triggered.push(waypoint);
} else if ((axis.newScroll < (_ref1 = waypoint.offset) && _ref1 <= axis.oldScroll)) {
return triggered.push(waypoint);
}
});
triggered.sort(function(a, b) {
return a.offset - b.offset;
});
if (!isForward) {
triggered.reverse();
}
return $.each(triggered, function(i, waypoint) {
if (waypoint.options.continuous || i === triggered.length - 1) {
return waypoint.trigger([direction]);
}
});
});
return this.oldScroll = {
x: axes.horizontal.newScroll,
y: axes.vertical.newScroll
};
};
Context.prototype.refresh = function() {
var axes, cOffset, isWin,
_this = this;
isWin = $.isWindow(this.element);
cOffset = this.$element.offset();
this.doScroll();
axes = {
horizontal: {
contextOffset: isWin ? 0 : cOffset.left,
contextScroll: isWin ? 0 : this.oldScroll.x,
contextDimension: this.$element.width(),
oldScroll: this.oldScroll.x,
forward: 'right',
backward: 'left',
offsetProp: 'left'
},
vertical: {
contextOffset: isWin ? 0 : cOffset.top,
contextScroll: isWin ? 0 : this.oldScroll.y,
contextDimension: isWin ? $[wps]('viewportHeight') : this.$element.height(),
oldScroll: this.oldScroll.y,
forward: 'down',
backward: 'up',
offsetProp: 'top'
}
};
return $.each(axes, function(aKey, axis) {
return $.each(_this.waypoints[aKey], function(i, waypoint) {
var adjustment, elementOffset, oldOffset, _ref, _ref1;
adjustment = waypoint.options.offset;
oldOffset = waypoint.offset;
elementOffset = $.isWindow(waypoint.element) ? 0 : waypoint.$element.offset()[axis.offsetProp];
if ($.isFunction(adjustment)) {
adjustment = adjustment.apply(waypoint.element);
} else if (typeof adjustment === 'string') {
adjustment = parseFloat(adjustment);
if (waypoint.options.offset.indexOf('%') > -1) {
adjustment = Math.ceil(axis.contextDimension * adjustment / 100);
}
}
waypoint.offset = elementOffset - axis.contextOffset + axis.contextScroll - adjustment;
if ((waypoint.options.onlyOnScroll && (oldOffset != null)) || !waypoint.enabled) {
return;
}
if (oldOffset !== null && (oldOffset < (_ref = axis.oldScroll) && _ref <= waypoint.offset)) {
return waypoint.trigger([axis.backward]);
} else if (oldOffset !== null && (oldOffset > (_ref1 = axis.oldScroll) && _ref1 >= waypoint.offset)) {
return waypoint.trigger([axis.forward]);
} else if (oldOffset === null && axis.oldScroll >= waypoint.offset) {
return waypoint.trigger([axis.forward]);
}
});
});
};
Context.prototype.checkEmpty = function() {
if ($.isEmptyObject(this.waypoints.horizontal) && $.isEmptyObject(this.waypoints.vertical)) {
this.$element.unbind([resizeEvent, scrollEvent].join(' '));
return delete contexts[this.id];
}
};
return Context;
})();
Waypoint = (function() {
function Waypoint($element, context, options) {
var idList, _ref;
options = $.extend({}, $.fn[wp].defaults, options);
if (options.offset === 'bottom-in-view') {
options.offset = function() {
var contextHeight;
contextHeight = $[wps]('viewportHeight');
if (!$.isWindow(context.element)) {
contextHeight = context.$element.height();
}
return contextHeight - $(this).outerHeight();
};
}
this.$element = $element;
this.element = $element[0];
this.axis = options.horizontal ? 'horizontal' : 'vertical';
this.callback = options.handler;
this.context = context;
this.enabled = options.enabled;
this.id = 'waypoints' + waypointCounter++;
this.offset = null;
this.options = options;
context.waypoints[this.axis][this.id] = this;
allWaypoints[this.axis][this.id] = this;
idList = (_ref = $element.data(waypointKey)) != null ? _ref : [];
idList.push(this.id);
$element.data(waypointKey, idList);
}
Waypoint.prototype.trigger = function(args) {
if (!this.enabled) {
return;
}
if (this.callback != null) {
this.callback.apply(this.element, args);
}
if (this.options.triggerOnce) {
return this.destroy();
}
};
Waypoint.prototype.disable = function() {
return this.enabled = false;
};
Waypoint.prototype.enable = function() {
this.context.refresh();
return this.enabled = true;
};
Waypoint.prototype.destroy = function() {
delete allWaypoints[this.axis][this.id];
delete this.context.waypoints[this.axis][this.id];
return this.context.checkEmpty();
};
Waypoint.getWaypointsByElement = function(element) {
var all, ids;
ids = $(element).data(waypointKey);
if (!ids) {
return [];
}
all = $.extend({}, allWaypoints.horizontal, allWaypoints.vertical);
return $.map(ids, function(id) {
return all[id];
});
};
return Waypoint;
})();
methods = {
init: function(f, options) {
var _ref;
if (options == null) {
options = {};
}
if ((_ref = options.handler) == null) {
options.handler = f;
}
this.each(function() {
var $this, context, contextElement, _ref1;
$this = $(this);
contextElement = (_ref1 = options.context) != null ? _ref1 : $.fn[wp].defaults.context;
if (!$.isWindow(contextElement)) {
contextElement = $this.closest(contextElement);
}
contextElement = $(contextElement);
context = contexts[contextElement.data(contextKey)];
if (!context) {
context = new Context(contextElement);
}
return new Waypoint($this, context, options);
});
$[wps]('refresh');
return this;
},
disable: function() {
return methods._invoke(this, 'disable');
},
enable: function() {
return methods._invoke(this, 'enable');
},
destroy: function() {
return methods._invoke(this, 'destroy');
},
prev: function(axis, selector) {
return methods._traverse.call(this, axis, selector, function(stack, index, waypoints) {
if (index > 0) {
return stack.push(waypoints[index - 1]);
}
});
},
next: function(axis, selector) {
return methods._traverse.call(this, axis, selector, function(stack, index, waypoints) {
if (index < waypoints.length - 1) {
return stack.push(waypoints[index + 1]);
}
});
},
_traverse: function(axis, selector, push) {
var stack, waypoints;
if (axis == null) {
axis = 'vertical';
}
if (selector == null) {
selector = window;
}
waypoints = jQMethods.aggregate(selector);
stack = [];
this.each(function() {
var index;
index = $.inArray(this, waypoints[axis]);
return push(stack, index, waypoints[axis]);
});
return this.pushStack(stack);
},
_invoke: function($elements, method) {
$elements.each(function() {
var waypoints;
waypoints = Waypoint.getWaypointsByElement(this);
return $.each(waypoints, function(i, waypoint) {
waypoint[method]();
return true;
});
});
return this;
}
};
$.fn[wp] = function() {
var args, method;
method = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
if (methods[method]) {
return methods[method].apply(this, args);
} else if ($.isFunction(method)) {
return methods.init.apply(this, arguments);
} else if ($.isPlainObject(method)) {
return methods.init.apply(this, [null, method]);
} else if (!method) {
return $.error("jQuery Waypoints needs a callback function or handler option.");
} else {
return $.error("The " + method + " method does not exist in jQuery Waypoints.");
}
};
$.fn[wp].defaults = {
context: window,
continuous: true,
enabled: true,
horizontal: false,
offset: 0,
triggerOnce: false
};
jQMethods = {
refresh: function() {
return $.each(contexts, function(i, context) {
return context.refresh();
});
},
viewportHeight: function() {
var _ref;
return (_ref = window.innerHeight) != null ? _ref : $w.height();
},
aggregate: function(contextSelector) {
var collection, waypoints, _ref;
collection = allWaypoints;
if (contextSelector) {
collection = (_ref = contexts[$(contextSelector).data(contextKey)]) != null ? _ref.waypoints : void 0;
}
if (!collection) {
return [];
}
waypoints = {
horizontal: [],
vertical: []
};
$.each(waypoints, function(axis, arr) {
$.each(collection[axis], function(key, waypoint) {
return arr.push(waypoint);
});
arr.sort(function(a, b) {
return a.offset - b.offset;
});
waypoints[axis] = $.map(arr, function(waypoint) {
return waypoint.element;
});
return waypoints[axis] = $.unique(waypoints[axis]);
});
return waypoints;
},
above: function(contextSelector) {
if (contextSelector == null) {
contextSelector = window;
}
return jQMethods._filter(contextSelector, 'vertical', function(context, waypoint) {
return waypoint.offset <= context.oldScroll.y;
});
},
below: function(contextSelector) {
if (contextSelector == null) {
contextSelector = window;
}
return jQMethods._filter(contextSelector, 'vertical', function(context, waypoint) {
return waypoint.offset > context.oldScroll.y;
});
},
left: function(contextSelector) {
if (contextSelector == null) {
contextSelector = window;
}
return jQMethods._filter(contextSelector, 'horizontal', function(context, waypoint) {
return waypoint.offset <= context.oldScroll.x;
});
},
right: function(contextSelector) {
if (contextSelector == null) {
contextSelector = window;
}
return jQMethods._filter(contextSelector, 'horizontal', function(context, waypoint) {
return waypoint.offset > context.oldScroll.x;
});
},
enable: function() {
return jQMethods._invoke('enable');
},
disable: function() {
return jQMethods._invoke('disable');
},
destroy: function() {
return jQMethods._invoke('destroy');
},
extendFn: function(methodName, f) {
return methods[methodName] = f;
},
_invoke: function(method) {
var waypoints;
waypoints = $.extend({}, allWaypoints.vertical, allWaypoints.horizontal);
return $.each(waypoints, function(key, waypoint) {
waypoint[method]();
return true;
});
},
_filter: function(selector, axis, test) {
var context, waypoints;
context = contexts[$(selector).data(contextKey)];
if (!context) {
return [];
}
waypoints = [];
$.each(context.waypoints[axis], function(i, waypoint) {
if (test(context, waypoint)) {
return waypoints.push(waypoint);
}
});
waypoints.sort(function(a, b) {
return a.offset - b.offset;
});
return $.map(waypoints, function(waypoint) {
return waypoint.element;
});
}
};
$[wps] = function() {
var args, method;
method = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
if (jQMethods[method]) {
return jQMethods[method].apply(null, args);
} else {
return jQMethods.aggregate.call(null, method);
}
};
$[wps].settings = {
resizeThrottle: 100,
scrollThrottle: 30
};
return $w.load(function() {
return $[wps]('refresh');
});
});
}).call(this);
/*! http://mths.be/placeholder v2.0.7 by @mathias */
;(function(window, document, $) {
var isInputSupported = 'placeholder' in document.createElement('input');
var isTextareaSupported = 'placeholder' in document.createElement('textarea');
var prototype = $.fn;
var valHooks = $.valHooks;
var propHooks = $.propHooks;
var hooks;
var placeholder;
if (isInputSupported && isTextareaSupported) {
placeholder = prototype.placeholder = function() {
return this;
};
placeholder.input = placeholder.textarea = true;
} else {
placeholder = prototype.placeholder = function() {
var $this = this;
$this
.filter((isInputSupported ? 'textarea' : ':input') + '[placeholder]')
.not('.placeholder')
.bind({
'focus.placeholder': clearPlaceholder,
'blur.placeholder': setPlaceholder
})
.data('placeholder-enabled', true)
.trigger('blur.placeholder');
return $this;
};
placeholder.input = isInputSupported;
placeholder.textarea = isTextareaSupported;
hooks = {
'get': function(element) {
var $element = $(element);
var $passwordInput = $element.data('placeholder-password');
if ($passwordInput) {
return $passwordInput[0].value;
}
return $element.data('placeholder-enabled') && $element.hasClass('placeholder') ? '' : element.value;
},
'set': function(element, value) {
var $element = $(element);
var $passwordInput = $element.data('placeholder-password');
if ($passwordInput) {
return $passwordInput[0].value = value;
}
if (!$element.data('placeholder-enabled')) {
return element.value = value;
}
if (value == '') {
element.value = value;
// Issue #56: Setting the placeholder causes problems if the element continues to have focus.
if (element != safeActiveElement()) {
// We can't use `triggerHandler` here because of dummy text/password inputs :(
setPlaceholder.call(element);
}
} else if ($element.hasClass('placeholder')) {
clearPlaceholder.call(element, true, value) || (element.value = value);
} else {
element.value = value;
}
// `set` can not return `undefined`; see http://jsapi.info/jquery/1.7.1/val#L2363
return $element;
}
};
if (!isInputSupported) {
valHooks.input = hooks;
propHooks.value = hooks;
}
if (!isTextareaSupported) {
valHooks.textarea = hooks;
propHooks.value = hooks;
}
$(function() {
// Look for forms
$(document).delegate('form', 'submit.placeholder', function() {
// Clear the placeholder values so they don't get submitted
var $inputs = $('.placeholder', this).each(clearPlaceholder);
setTimeout(function() {
$inputs.each(setPlaceholder);
}, 10);
});
});
// Clear placeholder values upon page reload
$(window).bind('beforeunload.placeholder', function() {
$('.placeholder').each(function() {
this.value = '';
});
});
}
function args(elem) {
// Return an object of element attributes
var newAttrs = {};
var rinlinejQuery = /^jQuery\d+$/;
$.each(elem.attributes, function(i, attr) {
if (attr.specified && !rinlinejQuery.test(attr.name)) {
newAttrs[attr.name] = attr.value;
}
});
return newAttrs;
}
function clearPlaceholder(event, value) {
var input = this;
var $input = $(input);
if (input.value == $input.attr('placeholder') && $input.hasClass('placeholder')) {
if ($input.data('placeholder-password')) {
$input = $input.hide().next().show().attr('id', $input.removeAttr('id').data('placeholder-id'));
// If `clearPlaceholder` was called from `$.valHooks.input.set`
if (event === true) {
return $input[0].value = value;
}
$input.focus();
} else {
input.value = '';
$input.removeClass('placeholder');
input == safeActiveElement() && input.select();
}
}
}
function setPlaceholder() {
var $replacement;
var input = this;
var $input = $(input);
var id = this.id;
if (input.value == '') {
if (input.type == 'password') {
if (!$input.data('placeholder-textinput')) {
try {
$replacement = $input.clone().attr({ 'type': 'text' });
} catch(e) {
$replacement = $('').attr($.extend(args(this), { 'type': 'text' }));
}
$replacement
.removeAttr('name')
.data({
'placeholder-password': $input,
'placeholder-id': id
})
.bind('focus.placeholder', clearPlaceholder);
$input
.data({
'placeholder-textinput': $replacement,
'placeholder-id': id
})
.before($replacement);
}
$input = $input.removeAttr('id').hide().prev().attr('id', id).show();
// Note: `$input[0] != input` now!
}
$input.addClass('placeholder');
$input[0].value = $input.attr('placeholder');
} else {
$input.removeClass('placeholder');
}
}
function safeActiveElement() {
// Avoid IE9 `document.activeElement` of death
// https://github.com/mathiasbynens/jquery-placeholder/pull/99
try {
return document.activeElement;
} catch (err) {}
}
}(this, document, jQuery));
/**
* Isotope v1.5.25
* An exquisite jQuery plugin for magical layouts
* http://isotope.metafizzy.co
*
* Commercial use requires one-time purchase of a commercial license
* http://isotope.metafizzy.co/docs/license.html
*
* Non-commercial use is licensed under the MIT License
*
* Copyright 2013 Metafizzy
*/
/*jshint asi: true, browser: true, curly: true, eqeqeq: true, forin: false, immed: false, newcap: true, noempty: true, strict: true, undef: true */
/*global jQuery: false */
(function( window, $, undefined ){
'use strict';
// get global vars
var document = window.document;
var Modernizr = window.Modernizr;
// helper function
var capitalize = function( str ) {
return str.charAt(0).toUpperCase() + str.slice(1);
};
// ========================= getStyleProperty by kangax ===============================
// http://perfectionkills.com/feature-testing-css-properties/
var prefixes = 'Moz Webkit O Ms'.split(' ');
var getStyleProperty = function( propName ) {
var style = document.documentElement.style,
prefixed;
// test standard property first
if ( typeof style[propName] === 'string' ) {
return propName;
}
// capitalize
propName = capitalize( propName );
// test vendor specific properties
for ( var i=0, len = prefixes.length; i < len; i++ ) {
prefixed = prefixes[i] + propName;
if ( typeof style[ prefixed ] === 'string' ) {
return prefixed;
}
}
};
var transformProp = getStyleProperty('transform'),
transitionProp = getStyleProperty('transitionProperty');
// ========================= miniModernizr ===============================
// <3<3<3 and thanks to Faruk and Paul for doing the heavy lifting
/*!
* Modernizr v1.6ish: miniModernizr for Isotope
* http://www.modernizr.com
*
* Developed by:
* - Faruk Ates http://farukat.es/
* - Paul Irish http://paulirish.com/
*
* Copyright (c) 2009-2010
* Dual-licensed under the BSD or MIT licenses.
* http://www.modernizr.com/license/
*/
/*
* This version whittles down the script just to check support for
* CSS transitions, transforms, and 3D transforms.
*/
var tests = {
csstransforms: function() {
return !!transformProp;
},
csstransforms3d: function() {
var test = !!getStyleProperty('perspective');
// double check for Chrome's false positive
if ( test ) {
var vendorCSSPrefixes = ' -o- -moz- -ms- -webkit- -khtml- '.split(' '),
mediaQuery = '@media (' + vendorCSSPrefixes.join('transform-3d),(') + 'modernizr)',
$style = $('')
.appendTo('head'),
$div = $('').appendTo('html');
test = $div.height() === 3;
$div.remove();
$style.remove();
}
return test;
},
csstransitions: function() {
return !!transitionProp;
}
};
var testName;
if ( Modernizr ) {
// if there's a previous Modernzir, check if there are necessary tests
for ( testName in tests) {
if ( !Modernizr.hasOwnProperty( testName ) ) {
// if test hasn't been run, use addTest to run it
Modernizr.addTest( testName, tests[ testName ] );
}
}
} else {
// or create new mini Modernizr that just has the 3 tests
Modernizr = window.Modernizr = {
_version : '1.6ish: miniModernizr for Isotope'
};
var classes = ' ';
var result;
// Run through tests
for ( testName in tests) {
result = tests[ testName ]();
Modernizr[ testName ] = result;
classes += ' ' + ( result ? '' : 'no-' ) + testName;
}
// Add the new classes to the element.
$('html').addClass( classes );
}
// ========================= isoTransform ===============================
/**
* provides hooks for .css({ scale: value, translate: [x, y] })
* Progressively enhanced CSS transforms
* Uses hardware accelerated 3D transforms for Safari
* or falls back to 2D transforms.
*/
if ( Modernizr.csstransforms ) {
// i.e. transformFnNotations.scale(0.5) >> 'scale3d( 0.5, 0.5, 1)'
var transformFnNotations = Modernizr.csstransforms3d ?
{ // 3D transform functions
translate : function ( position ) {
return 'translate3d(' + position[0] + 'px, ' + position[1] + 'px, 0) ';
},
scale : function ( scale ) {
return 'scale3d(' + scale + ', ' + scale + ', 1) ';
}
} :
{ // 2D transform functions
translate : function ( position ) {
return 'translate(' + position[0] + 'px, ' + position[1] + 'px) ';
},
scale : function ( scale ) {
return 'scale(' + scale + ') ';
}
}
;
var setIsoTransform = function ( elem, name, value ) {
// unpack current transform data
var data = $.data( elem, 'isoTransform' ) || {},
newData = {},
fnName,
transformObj = {},
transformValue;
// i.e. newData.scale = 0.5
newData[ name ] = value;
// extend new value over current data
$.extend( data, newData );
for ( fnName in data ) {
transformValue = data[ fnName ];
transformObj[ fnName ] = transformFnNotations[ fnName ]( transformValue );
}
// get proper order
// ideally, we could loop through this give an array, but since we only have
// a couple transforms we're keeping track of, we'll do it like so
var translateFn = transformObj.translate || '',
scaleFn = transformObj.scale || '',
// sorting so translate always comes first
valueFns = translateFn + scaleFn;
// set data back in elem
$.data( elem, 'isoTransform', data );
// set name to vendor specific property
elem.style[ transformProp ] = valueFns;
};
// ==================== scale ===================
$.cssNumber.scale = true;
$.cssHooks.scale = {
set: function( elem, value ) {
// uncomment this bit if you want to properly parse strings
// if ( typeof value === 'string' ) {
// value = parseFloat( value );
// }
setIsoTransform( elem, 'scale', value );
},
get: function( elem, computed ) {
var transform = $.data( elem, 'isoTransform' );
return transform && transform.scale ? transform.scale : 1;
}
};
$.fx.step.scale = function( fx ) {
$.cssHooks.scale.set( fx.elem, fx.now+fx.unit );
};
// ==================== translate ===================
$.cssNumber.translate = true;
$.cssHooks.translate = {
set: function( elem, value ) {
// uncomment this bit if you want to properly parse strings
// if ( typeof value === 'string' ) {
// value = value.split(' ');
// }
//
// var i, val;
// for ( i = 0; i < 2; i++ ) {
// val = value[i];
// if ( typeof val === 'string' ) {
// val = parseInt( val );
// }
// }
setIsoTransform( elem, 'translate', value );
},
get: function( elem, computed ) {
var transform = $.data( elem, 'isoTransform' );
return transform && transform.translate ? transform.translate : [ 0, 0 ];
}
};
}
// ========================= get transition-end event ===============================
var transitionEndEvent, transitionDurProp;
if ( Modernizr.csstransitions ) {
transitionEndEvent = {
WebkitTransitionProperty: 'webkitTransitionEnd', // webkit
MozTransitionProperty: 'transitionend',
OTransitionProperty: 'oTransitionEnd otransitionend',
transitionProperty: 'transitionend'
}[ transitionProp ];
transitionDurProp = getStyleProperty('transitionDuration');
}
// ========================= smartresize ===============================
/*
* smartresize: debounced resize event for jQuery
*
* latest version and complete README available on Github:
* https://github.com/louisremi/jquery.smartresize.js
*
* Copyright 2011 @louis_remi
* Licensed under the MIT license.
*/
var $event = $.event,
dispatchMethod = $.event.handle ? 'handle' : 'dispatch',
resizeTimeout;
$event.special.smartresize = {
setup: function() {
$(this).bind( "resize", $event.special.smartresize.handler );
},
teardown: function() {
$(this).unbind( "resize", $event.special.smartresize.handler );
},
handler: function( event, execAsap ) {
// Save the context
var context = this,
args = arguments;
// set correct event type
event.type = "smartresize";
if ( resizeTimeout ) { clearTimeout( resizeTimeout ); }
resizeTimeout = setTimeout(function() {
$event[ dispatchMethod ].apply( context, args );
}, execAsap === "execAsap"? 0 : 100 );
}
};
$.fn.smartresize = function( fn ) {
return fn ? this.bind( "smartresize", fn ) : this.trigger( "smartresize", ["execAsap"] );
};
// ========================= Isotope ===============================
// our "Widget" object constructor
$.Isotope = function( options, element, callback ){
this.element = $( element );
this._create( options );
this._init( callback );
};
// styles of container element we want to keep track of
var isoContainerStyles = [ 'width', 'height' ];
var $window = $(window);
$.Isotope.settings = {
resizable: true,
layoutMode : 'masonry',
containerClass : 'isotope',
itemClass : 'isotope-item',
hiddenClass : 'isotope-hidden',
hiddenStyle: { opacity: 0, scale: 0.001 },
visibleStyle: { opacity: 1, scale: 1 },
containerStyle: {
position: 'relative',
overflow: 'hidden'
},
animationEngine: 'best-available',
animationOptions: {
queue: false,
duration: 800
},
sortBy : 'original-order',
sortAscending : true,
resizesContainer : true,
transformsEnabled: true,
itemPositionDataEnabled: false
};
$.Isotope.prototype = {
// sets up widget
_create : function( options ) {
this.options = $.extend( {}, $.Isotope.settings, options );
this.styleQueue = [];
this.elemCount = 0;
// get original styles in case we re-apply them in .destroy()
var elemStyle = this.element[0].style;
this.originalStyle = {};
// keep track of container styles
var containerStyles = isoContainerStyles.slice(0);
for ( var prop in this.options.containerStyle ) {
containerStyles.push( prop );
}
for ( var i=0, len = containerStyles.length; i < len; i++ ) {
prop = containerStyles[i];
this.originalStyle[ prop ] = elemStyle[ prop ] || '';
}
// apply container style from options
this.element.css( this.options.containerStyle );
this._updateAnimationEngine();
this._updateUsingTransforms();
// sorting
var originalOrderSorter = {
'original-order' : function( $elem, instance ) {
instance.elemCount ++;
return instance.elemCount;
},
random : function() {
return Math.random();
}
};
this.options.getSortData = $.extend( this.options.getSortData, originalOrderSorter );
// need to get atoms
this.reloadItems();
// get top left position of where the bricks should be
this.offset = {
left: parseInt( ( this.element.css('padding-left') || 0 ), 10 ),
top: parseInt( ( this.element.css('padding-top') || 0 ), 10 )
};
// add isotope class first time around
var instance = this;
setTimeout( function() {
instance.element.addClass( instance.options.containerClass );
}, 0 );
// bind resize method
if ( this.options.resizable ) {
$window.bind( 'smartresize.isotope', function() {
instance.resize();
});
}
// dismiss all click events from hidden events
this.element.delegate( '.' + this.options.hiddenClass, 'click', function(){
return false;
});
},
_getAtoms : function( $elems ) {
var selector = this.options.itemSelector,
// filter & find
$atoms = selector ? $elems.filter( selector ).add( $elems.find( selector ) ) : $elems,
// base style for atoms
atomStyle = { position: 'absolute' };
// filter out text nodes
$atoms = $atoms.filter( function( i, atom ) {
return atom.nodeType === 1;
});
if ( this.usingTransforms ) {
atomStyle.left = 0;
atomStyle.top = 0;
}
$atoms.css( atomStyle ).addClass( this.options.itemClass );
this.updateSortData( $atoms, true );
return $atoms;
},
// _init fires when your instance is first created
// (from the constructor above), and when you
// attempt to initialize the widget again (by the bridge)
// after it has already been initialized.
_init : function( callback ) {
this.$filteredAtoms = this._filter( this.$allAtoms );
this._sort();
this.reLayout( callback );
},
option : function( opts ){
// change options AFTER initialization:
// signature: $('#foo').bar({ cool:false });
if ( $.isPlainObject( opts ) ){
this.options = $.extend( true, this.options, opts );
// trigger _updateOptionName if it exists
var updateOptionFn;
for ( var optionName in opts ) {
updateOptionFn = '_update' + capitalize( optionName );
if ( this[ updateOptionFn ] ) {
this[ updateOptionFn ]();
}
}
}
},
// ====================== updaters ====================== //
// kind of like setters
_updateAnimationEngine : function() {
var animationEngine = this.options.animationEngine.toLowerCase().replace( /[ _\-]/g, '');
var isUsingJQueryAnimation;
// set applyStyleFnName
switch ( animationEngine ) {
case 'css' :
case 'none' :
isUsingJQueryAnimation = false;
break;
case 'jquery' :
isUsingJQueryAnimation = true;
break;
default : // best available
isUsingJQueryAnimation = !Modernizr.csstransitions;
}
this.isUsingJQueryAnimation = isUsingJQueryAnimation;
this._updateUsingTransforms();
},
_updateTransformsEnabled : function() {
this._updateUsingTransforms();
},
_updateUsingTransforms : function() {
var usingTransforms = this.usingTransforms = this.options.transformsEnabled &&
Modernizr.csstransforms && Modernizr.csstransitions && !this.isUsingJQueryAnimation;
// prevent scales when transforms are disabled
if ( !usingTransforms ) {
delete this.options.hiddenStyle.scale;
delete this.options.visibleStyle.scale;
}
this.getPositionStyles = usingTransforms ? this._translate : this._positionAbs;
},
// ====================== Filtering ======================
_filter : function( $atoms ) {
var filter = this.options.filter === '' ? '*' : this.options.filter;
if ( !filter ) {
return $atoms;
}
var hiddenClass = this.options.hiddenClass,
hiddenSelector = '.' + hiddenClass,
$hiddenAtoms = $atoms.filter( hiddenSelector ),
$atomsToShow = $hiddenAtoms;
if ( filter !== '*' ) {
$atomsToShow = $hiddenAtoms.filter( filter );
var $atomsToHide = $atoms.not( hiddenSelector ).not( filter ).addClass( hiddenClass );
this.styleQueue.push({ $el: $atomsToHide, style: this.options.hiddenStyle });
}
this.styleQueue.push({ $el: $atomsToShow, style: this.options.visibleStyle });
$atomsToShow.removeClass( hiddenClass );
return $atoms.filter( filter );
},
// ====================== Sorting ======================
updateSortData : function( $atoms, isIncrementingElemCount ) {
var instance = this,
getSortData = this.options.getSortData,
$this, sortData;
$atoms.each(function(){
$this = $(this);
sortData = {};
// get value for sort data based on fn( $elem ) passed in
for ( var key in getSortData ) {
if ( !isIncrementingElemCount && key === 'original-order' ) {
// keep original order original
sortData[ key ] = $.data( this, 'isotope-sort-data' )[ key ];
} else {
sortData[ key ] = getSortData[ key ]( $this, instance );
}
}
// apply sort data to element
$.data( this, 'isotope-sort-data', sortData );
});
},
// used on all the filtered atoms
_sort : function() {
var sortBy = this.options.sortBy,
getSorter = this._getSorter,
sortDir = this.options.sortAscending ? 1 : -1,
sortFn = function( alpha, beta ) {
var a = getSorter( alpha, sortBy ),
b = getSorter( beta, sortBy );
// fall back to original order if data matches
if ( a === b && sortBy !== 'original-order') {
a = getSorter( alpha, 'original-order' );
b = getSorter( beta, 'original-order' );
}
return ( ( a > b ) ? 1 : ( a < b ) ? -1 : 0 ) * sortDir;
};
this.$filteredAtoms.sort( sortFn );
},
_getSorter : function( elem, sortBy ) {
return $.data( elem, 'isotope-sort-data' )[ sortBy ];
},
// ====================== Layout Helpers ======================
_translate : function( x, y ) {
return { translate : [ x, y ] };
},
_positionAbs : function( x, y ) {
return { left: x, top: y };
},
_pushPosition : function( $elem, x, y ) {
x = Math.round( x + this.offset.left );
y = Math.round( y + this.offset.top );
var position = this.getPositionStyles( x, y );
this.styleQueue.push({ $el: $elem, style: position });
if ( this.options.itemPositionDataEnabled ) {
$elem.data('isotope-item-position', {x: x, y: y} );
}
},
// ====================== General Layout ======================
// used on collection of atoms (should be filtered, and sorted before )
// accepts atoms-to-be-laid-out to start with
layout : function( $elems, callback ) {
var layoutMode = this.options.layoutMode;
// layout logic
this[ '_' + layoutMode + 'Layout' ]( $elems );
// set the size of the container
if ( this.options.resizesContainer ) {
var containerStyle = this[ '_' + layoutMode + 'GetContainerSize' ]();
this.styleQueue.push({ $el: this.element, style: containerStyle });
}
this._processStyleQueue( $elems, callback );
this.isLaidOut = true;
},
_processStyleQueue : function( $elems, callback ) {
// are we animating the layout arrangement?
// use plugin-ish syntax for css or animate
var styleFn = !this.isLaidOut ? 'css' : (
this.isUsingJQueryAnimation ? 'animate' : 'css'
),
animOpts = this.options.animationOptions,
onLayout = this.options.onLayout,
objStyleFn, processor,
triggerCallbackNow, callbackFn;
// default styleQueue processor, may be overwritten down below
processor = function( i, obj ) {
obj.$el[ styleFn ]( obj.style, animOpts );
};
if ( this._isInserting && this.isUsingJQueryAnimation ) {
// if using styleQueue to insert items
processor = function( i, obj ) {
// only animate if it not being inserted
objStyleFn = obj.$el.hasClass('no-transition') ? 'css' : styleFn;
obj.$el[ objStyleFn ]( obj.style, animOpts );
};
} else if ( callback || onLayout || animOpts.complete ) {
// has callback
var isCallbackTriggered = false,
// array of possible callbacks to trigger
callbacks = [ callback, onLayout, animOpts.complete ],
instance = this;
triggerCallbackNow = true;
// trigger callback only once
callbackFn = function() {
if ( isCallbackTriggered ) {
return;
}
var hollaback;
for (var i=0, len = callbacks.length; i < len; i++) {
hollaback = callbacks[i];
if ( typeof hollaback === 'function' ) {
hollaback.call( instance.element, $elems, instance );
}
}
isCallbackTriggered = true;
};
if ( this.isUsingJQueryAnimation && styleFn === 'animate' ) {
// add callback to animation options
animOpts.complete = callbackFn;
triggerCallbackNow = false;
} else if ( Modernizr.csstransitions ) {
// detect if first item has transition
var i = 0,
firstItem = this.styleQueue[0],
testElem = firstItem && firstItem.$el,
styleObj;
// get first non-empty jQ object
while ( !testElem || !testElem.length ) {
styleObj = this.styleQueue[ i++ ];
// HACK: sometimes styleQueue[i] is undefined
if ( !styleObj ) {
return;
}
testElem = styleObj.$el;
}
// get transition duration of the first element in that object
// yeah, this is inexact
var duration = parseFloat( getComputedStyle( testElem[0] )[ transitionDurProp ] );
if ( duration > 0 ) {
processor = function( i, obj ) {
obj.$el[ styleFn ]( obj.style, animOpts )
// trigger callback at transition end
.one( transitionEndEvent, callbackFn );
};
triggerCallbackNow = false;
}
}
}
// process styleQueue
$.each( this.styleQueue, processor );
if ( triggerCallbackNow ) {
callbackFn();
}
// clear out queue for next time
this.styleQueue = [];
},
resize : function() {
if ( this[ '_' + this.options.layoutMode + 'ResizeChanged' ]() ) {
this.reLayout();
}
},
reLayout : function( callback ) {
this[ '_' + this.options.layoutMode + 'Reset' ]();
this.layout( this.$filteredAtoms, callback );
},
// ====================== Convenience methods ======================
// ====================== Adding items ======================
// adds a jQuery object of items to a isotope container
addItems : function( $content, callback ) {
var $newAtoms = this._getAtoms( $content );
// add new atoms to atoms pools
this.$allAtoms = this.$allAtoms.add( $newAtoms );
if ( callback ) {
callback( $newAtoms );
}
},
// convienence method for adding elements properly to any layout
// positions items, hides them, then animates them back in <--- very sezzy
insert : function( $content, callback ) {
// position items
this.element.append( $content );
var instance = this;
this.addItems( $content, function( $newAtoms ) {
var $newFilteredAtoms = instance._filter( $newAtoms );
instance._addHideAppended( $newFilteredAtoms );
instance._sort();
instance.reLayout();
instance._revealAppended( $newFilteredAtoms, callback );
});
},
// convienence method for working with Infinite Scroll
appended : function( $content, callback ) {
var instance = this;
this.addItems( $content, function( $newAtoms ) {
instance._addHideAppended( $newAtoms );
instance.layout( $newAtoms );
instance._revealAppended( $newAtoms, callback );
});
},
// adds new atoms, then hides them before positioning
_addHideAppended : function( $newAtoms ) {
this.$filteredAtoms = this.$filteredAtoms.add( $newAtoms );
$newAtoms.addClass('no-transition');
this._isInserting = true;
// apply hidden styles
this.styleQueue.push({ $el: $newAtoms, style: this.options.hiddenStyle });
},
// sets visible style on new atoms
_revealAppended : function( $newAtoms, callback ) {
var instance = this;
// apply visible style after a sec
setTimeout( function() {
// enable animation
$newAtoms.removeClass('no-transition');
// reveal newly inserted filtered elements
instance.styleQueue.push({ $el: $newAtoms, style: instance.options.visibleStyle });
instance._isInserting = false;
instance._processStyleQueue( $newAtoms, callback );
}, 10 );
},
// gathers all atoms
reloadItems : function() {
this.$allAtoms = this._getAtoms( this.element.children() );
},
// removes elements from Isotope widget
remove: function( $content, callback ) {
// remove elements immediately from Isotope instance
this.$allAtoms = this.$allAtoms.not( $content );
this.$filteredAtoms = this.$filteredAtoms.not( $content );
// remove() as a callback, for after transition / animation
var instance = this;
var removeContent = function() {
$content.remove();
if ( callback ) {
callback.call( instance.element );
}
};
if ( $content.filter( ':not(.' + this.options.hiddenClass + ')' ).length ) {
// if any non-hidden content needs to be removed
this.styleQueue.push({ $el: $content, style: this.options.hiddenStyle });
this._sort();
this.reLayout( removeContent );
} else {
// remove it now
removeContent();
}
},
shuffle : function( callback ) {
this.updateSortData( this.$allAtoms );
this.options.sortBy = 'random';
this._sort();
this.reLayout( callback );
},
// destroys widget, returns elements and container back (close) to original style
destroy : function() {
var usingTransforms = this.usingTransforms;
var options = this.options;
this.$allAtoms
.removeClass( options.hiddenClass + ' ' + options.itemClass )
.each(function(){
var style = this.style;
style.position = '';
style.top = '';
style.left = '';
style.opacity = '';
if ( usingTransforms ) {
style[ transformProp ] = '';
}
});
// re-apply saved container styles
var elemStyle = this.element[0].style;
for ( var prop in this.originalStyle ) {
elemStyle[ prop ] = this.originalStyle[ prop ];
}
this.element
.unbind('.isotope')
.undelegate( '.' + options.hiddenClass, 'click' )
.removeClass( options.containerClass )
.removeData('isotope');
$window.unbind('.isotope');
},
// ====================== LAYOUTS ======================
// calculates number of rows or columns
// requires columnWidth or rowHeight to be set on namespaced object
// i.e. this.masonry.columnWidth = 200
_getSegments : function( isRows ) {
var namespace = this.options.layoutMode,
measure = isRows ? 'rowHeight' : 'columnWidth',
size = isRows ? 'height' : 'width',
segmentsName = isRows ? 'rows' : 'cols',
containerSize = this.element[ size ](),
segments,
// i.e. options.masonry && options.masonry.columnWidth
segmentSize = this.options[ namespace ] && this.options[ namespace ][ measure ] ||
// or use the size of the first item, i.e. outerWidth
this.$filteredAtoms[ 'outer' + capitalize(size) ](true) ||
// if there's no items, use size of container
containerSize;
segments = Math.floor( containerSize / segmentSize );
segments = Math.max( segments, 1 );
// i.e. this.masonry.cols = ....
this[ namespace ][ segmentsName ] = segments;
// i.e. this.masonry.columnWidth = ...
this[ namespace ][ measure ] = segmentSize;
},
_checkIfSegmentsChanged : function( isRows ) {
var namespace = this.options.layoutMode,
segmentsName = isRows ? 'rows' : 'cols',
prevSegments = this[ namespace ][ segmentsName ];
// update cols/rows
this._getSegments( isRows );
// return if updated cols/rows is not equal to previous
return ( this[ namespace ][ segmentsName ] !== prevSegments );
},
// ====================== Masonry ======================
_masonryReset : function() {
// layout-specific props
this.masonry = {};
// FIXME shouldn't have to call this again
this._getSegments();
var i = this.masonry.cols;
this.masonry.colYs = [];
while (i--) {
this.masonry.colYs.push( 0 );
}
},
_masonryLayout : function( $elems ) {
var instance = this,
props = instance.masonry;
$elems.each(function(){
var $this = $(this),
//how many columns does this brick span
colSpan = Math.ceil( $this.outerWidth(true) / props.columnWidth );
colSpan = Math.min( colSpan, props.cols );
if ( colSpan === 1 ) {
// if brick spans only one column, just like singleMode
instance._masonryPlaceBrick( $this, props.colYs );
} else {
// brick spans more than one column
// how many different places could this brick fit horizontally
var groupCount = props.cols + 1 - colSpan,
groupY = [],
groupColY,
i;
// for each group potential horizontal position
for ( i=0; i < groupCount; i++ ) {
// make an array of colY values for that one group
groupColY = props.colYs.slice( i, i+colSpan );
// and get the max value of the array
groupY[i] = Math.max.apply( Math, groupColY );
}
instance._masonryPlaceBrick( $this, groupY );
}
});
},
// worker method that places brick in the columnSet
// with the the minY
_masonryPlaceBrick : function( $brick, setY ) {
// get the minimum Y value from the columns
var minimumY = Math.min.apply( Math, setY ),
shortCol = 0;
// Find index of short column, the first from the left
for (var i=0, len = setY.length; i < len; i++) {
if ( setY[i] === minimumY ) {
shortCol = i;
break;
}
}
// position the brick
var x = this.masonry.columnWidth * shortCol,
y = minimumY;
this._pushPosition( $brick, x, y );
// apply setHeight to necessary columns
var setHeight = minimumY + $brick.outerHeight(true),
setSpan = this.masonry.cols + 1 - len;
for ( i=0; i < setSpan; i++ ) {
this.masonry.colYs[ shortCol + i ] = setHeight;
}
},
_masonryGetContainerSize : function() {
var containerHeight = Math.max.apply( Math, this.masonry.colYs );
return { height: containerHeight };
},
_masonryResizeChanged : function() {
return this._checkIfSegmentsChanged();
},
// ====================== fitRows ======================
_fitRowsReset : function() {
this.fitRows = {
x : 0,
y : 0,
height : 0
};
},
_fitRowsLayout : function( $elems ) {
var instance = this,
containerWidth = this.element.width(),
props = this.fitRows;
$elems.each( function() {
var $this = $(this),
atomW = $this.outerWidth(true),
atomH = $this.outerHeight(true);
if ( props.x !== 0 && atomW + props.x > containerWidth ) {
// if this element cannot fit in the current row
props.x = 0;
props.y = props.height;
}
// position the atom
instance._pushPosition( $this, props.x, props.y );
props.height = Math.max( props.y + atomH, props.height );
props.x += atomW;
});
},
_fitRowsGetContainerSize : function () {
return { height : this.fitRows.height };
},
_fitRowsResizeChanged : function() {
return true;
},
// ====================== cellsByRow ======================
_cellsByRowReset : function() {
this.cellsByRow = {
index : 0
};
// get this.cellsByRow.columnWidth
this._getSegments();
// get this.cellsByRow.rowHeight
this._getSegments(true);
},
_cellsByRowLayout : function( $elems ) {
var instance = this,
props = this.cellsByRow;
$elems.each( function(){
var $this = $(this),
col = props.index % props.cols,
row = Math.floor( props.index / props.cols ),
x = ( col + 0.5 ) * props.columnWidth - $this.outerWidth(true) / 2,
y = ( row + 0.5 ) * props.rowHeight - $this.outerHeight(true) / 2;
instance._pushPosition( $this, x, y );
props.index ++;
});
},
_cellsByRowGetContainerSize : function() {
return { height : Math.ceil( this.$filteredAtoms.length / this.cellsByRow.cols ) * this.cellsByRow.rowHeight + this.offset.top };
},
_cellsByRowResizeChanged : function() {
return this._checkIfSegmentsChanged();
},
// ====================== straightDown ======================
_straightDownReset : function() {
this.straightDown = {
y : 0
};
},
_straightDownLayout : function( $elems ) {
var instance = this;
$elems.each( function( i ){
var $this = $(this);
instance._pushPosition( $this, 0, instance.straightDown.y );
instance.straightDown.y += $this.outerHeight(true);
});
},
_straightDownGetContainerSize : function() {
return { height : this.straightDown.y };
},
_straightDownResizeChanged : function() {
return true;
},
// ====================== masonryHorizontal ======================
_masonryHorizontalReset : function() {
// layout-specific props
this.masonryHorizontal = {};
// FIXME shouldn't have to call this again
this._getSegments( true );
var i = this.masonryHorizontal.rows;
this.masonryHorizontal.rowXs = [];
while (i--) {
this.masonryHorizontal.rowXs.push( 0 );
}
},
_masonryHorizontalLayout : function( $elems ) {
var instance = this,
props = instance.masonryHorizontal;
$elems.each(function(){
var $this = $(this),
//how many rows does this brick span
rowSpan = Math.ceil( $this.outerHeight(true) / props.rowHeight );
rowSpan = Math.min( rowSpan, props.rows );
if ( rowSpan === 1 ) {
// if brick spans only one column, just like singleMode
instance._masonryHorizontalPlaceBrick( $this, props.rowXs );
} else {
// brick spans more than one row
// how many different places could this brick fit horizontally
var groupCount = props.rows + 1 - rowSpan,
groupX = [],
groupRowX, i;
// for each group potential horizontal position
for ( i=0; i < groupCount; i++ ) {
// make an array of colY values for that one group
groupRowX = props.rowXs.slice( i, i+rowSpan );
// and get the max value of the array
groupX[i] = Math.max.apply( Math, groupRowX );
}
instance._masonryHorizontalPlaceBrick( $this, groupX );
}
});
},
_masonryHorizontalPlaceBrick : function( $brick, setX ) {
// get the minimum Y value from the columns
var minimumX = Math.min.apply( Math, setX ),
smallRow = 0;
// Find index of smallest row, the first from the top
for (var i=0, len = setX.length; i < len; i++) {
if ( setX[i] === minimumX ) {
smallRow = i;
break;
}
}
// position the brick
var x = minimumX,
y = this.masonryHorizontal.rowHeight * smallRow;
this._pushPosition( $brick, x, y );
// apply setHeight to necessary columns
var setWidth = minimumX + $brick.outerWidth(true),
setSpan = this.masonryHorizontal.rows + 1 - len;
for ( i=0; i < setSpan; i++ ) {
this.masonryHorizontal.rowXs[ smallRow + i ] = setWidth;
}
},
_masonryHorizontalGetContainerSize : function() {
var containerWidth = Math.max.apply( Math, this.masonryHorizontal.rowXs );
return { width: containerWidth };
},
_masonryHorizontalResizeChanged : function() {
return this._checkIfSegmentsChanged(true);
},
// ====================== fitColumns ======================
_fitColumnsReset : function() {
this.fitColumns = {
x : 0,
y : 0,
width : 0
};
},
_fitColumnsLayout : function( $elems ) {
var instance = this,
containerHeight = this.element.height(),
props = this.fitColumns;
$elems.each( function() {
var $this = $(this),
atomW = $this.outerWidth(true),
atomH = $this.outerHeight(true);
if ( props.y !== 0 && atomH + props.y > containerHeight ) {
// if this element cannot fit in the current column
props.x = props.width;
props.y = 0;
}
// position the atom
instance._pushPosition( $this, props.x, props.y );
props.width = Math.max( props.x + atomW, props.width );
props.y += atomH;
});
},
_fitColumnsGetContainerSize : function () {
return { width : this.fitColumns.width };
},
_fitColumnsResizeChanged : function() {
return true;
},
// ====================== cellsByColumn ======================
_cellsByColumnReset : function() {
this.cellsByColumn = {
index : 0
};
// get this.cellsByColumn.columnWidth
this._getSegments();
// get this.cellsByColumn.rowHeight
this._getSegments(true);
},
_cellsByColumnLayout : function( $elems ) {
var instance = this,
props = this.cellsByColumn;
$elems.each( function(){
var $this = $(this),
col = Math.floor( props.index / props.rows ),
row = props.index % props.rows,
x = ( col + 0.5 ) * props.columnWidth - $this.outerWidth(true) / 2,
y = ( row + 0.5 ) * props.rowHeight - $this.outerHeight(true) / 2;
instance._pushPosition( $this, x, y );
props.index ++;
});
},
_cellsByColumnGetContainerSize : function() {
return { width : Math.ceil( this.$filteredAtoms.length / this.cellsByColumn.rows ) * this.cellsByColumn.columnWidth };
},
_cellsByColumnResizeChanged : function() {
return this._checkIfSegmentsChanged(true);
},
// ====================== straightAcross ======================
_straightAcrossReset : function() {
this.straightAcross = {
x : 0
};
},
_straightAcrossLayout : function( $elems ) {
var instance = this;
$elems.each( function( i ){
var $this = $(this);
instance._pushPosition( $this, instance.straightAcross.x, 0 );
instance.straightAcross.x += $this.outerWidth(true);
});
},
_straightAcrossGetContainerSize : function() {
return { width : this.straightAcross.x };
},
_straightAcrossResizeChanged : function() {
return true;
}
};
// ======================= imagesLoaded Plugin ===============================
/*!
* jQuery imagesLoaded plugin v1.1.0
* http://github.com/desandro/imagesloaded
*
* MIT License. by Paul Irish et al.
*/
// $('#my-container').imagesLoaded(myFunction)
// or
// $('img').imagesLoaded(myFunction)
// execute a callback when all images have loaded.
// needed because .load() doesn't work on cached images
// callback function gets image collection as argument
// `this` is the container
$.fn.imagesLoaded = function( callback ) {
var $this = this,
$images = $this.find('img').add( $this.filter('img') ),
len = $images.length,
blank = 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==',
loaded = [];
function triggerCallback() {
callback.call( $this, $images );
}
function imgLoaded( event ) {
var img = event.target;
if ( img.src !== blank && $.inArray( img, loaded ) === -1 ){
loaded.push( img );
if ( --len <= 0 ){
setTimeout( triggerCallback );
$images.unbind( '.imagesLoaded', imgLoaded );
}
}
}
// if no images, trigger immediately
if ( !len ) {
triggerCallback();
}
$images.bind( 'load.imagesLoaded error.imagesLoaded', imgLoaded ).each( function() {
// cached images don't fire load sometimes, so we reset src.
var src = this.src;
// webkit hack from http://groups.google.com/group/jquery-dev/browse_thread/thread/eee6ab7b2da50e1f
// data uri bypasses webkit log warning (thx doug jones)
this.src = blank;
this.src = src;
});
return $this;
};
// helper function for logging errors
// $.error breaks jQuery chaining
var logError = function( message ) {
if ( window.console ) {
window.console.error( message );
}
};
// ======================= Plugin bridge ===============================
// leverages data method to either create or return $.Isotope constructor
// A bit from jQuery UI
// https://github.com/jquery/jquery-ui/blob/master/ui/jquery.ui.widget.js
// A bit from jcarousel
// https://github.com/jsor/jcarousel/blob/master/lib/jquery.jcarousel.js
$.fn.isotope = function( options, callback ) {
if ( typeof options === 'string' ) {
// call method
var args = Array.prototype.slice.call( arguments, 1 );
this.each(function(){
var instance = $.data( this, 'isotope' );
if ( !instance ) {
logError( "cannot call methods on isotope prior to initialization; " +
"attempted to call method '" + options + "'" );
return;
}
if ( !$.isFunction( instance[options] ) || options.charAt(0) === "_" ) {
logError( "no such method '" + options + "' for isotope instance" );
return;
}
// apply method
instance[ options ].apply( instance, args );
});
} else {
this.each(function() {
var instance = $.data( this, 'isotope' );
if ( instance ) {
// apply options & init
instance.option( options );
instance._init( callback );
} else {
// initialize new instance
$.data( this, 'isotope', new $.Isotope( options, this, callback ) );
}
});
}
// return jQuery object
// so plugin methods do not have to
return this;
};
})( window, jQuery );
/**
* Isotope v1.5.25
* An exquisite jQuery plugin for magical layouts
* http://isotope.metafizzy.co
*
* Commercial use requires one-time purchase of a commercial license
* http://isotope.metafizzy.co/docs/license.html
*
* Non-commercial use is licensed under the MIT License
*
* Copyright 2013 Metafizzy
*//*jshint asi: true, browser: true, curly: true, eqeqeq: true, forin: false, immed: false, newcap: true, noempty: true, strict: true, undef: true *//*global jQuery: false */(function(e,t,n){"use strict";var r=e.document,i=e.Modernizr,s=function(e){return e.charAt(0).toUpperCase()+e.slice(1)},o="Moz Webkit O Ms".split(" "),u=function(e){var t=r.documentElement.style,n;if(typeof t[e]=="string")return e;e=s(e);for(var i=0,u=o.length;i"+r+"{#modernizr{height:3px}}"+"").appendTo("head"),s=t('').appendTo("html");e=s.height()===3;s.remove();i.remove()}return e},csstransitions:function(){return!!f}},c;if(i)for(c in l)i.hasOwnProperty(c)||i.addTest(c,l[c]);else{i=e.Modernizr={_version:"1.6ish: miniModernizr for Isotope"};var h=" ",p;for(c in l){p=l[c]();i[c]=p;h+=" "+(p?"":"no-")+c}t("html").addClass(h)}if(i.csstransforms){var d=i.csstransforms3d?{translate:function(e){return"translate3d("+e[0]+"px, "+e[1]+"px, 0) "},scale:function(e){return"scale3d("+e+", "+e+", 1) "}}:{translate:function(e){return"translate("+e[0]+"px, "+e[1]+"px) "},scale:function(e){return"scale("+e+") "}},v=function(e,n,r){var i=t.data(e,"isoTransform")||{},s={},o,u={},f;s[n]=r;t.extend(i,s);for(o in i){f=i[o];u[o]=d[o](f)}var l=u.translate||"",c=u.scale||"",h=l+c;t.data(e,"isoTransform",i);e.style[a]=h};t.cssNumber.scale=!0;t.cssHooks.scale={set:function(e,t){v(e,"scale",t)},get:function(e,n){var r=t.data(e,"isoTransform");return r&&r.scale?r.scale:1}};t.fx.step.scale=function(e){t.cssHooks.scale.set(e.elem,e.now+e.unit)};t.cssNumber.translate=!0;t.cssHooks.translate={set:function(e,t){v(e,"translate",t)},get:function(e,n){var r=t.data(e,"isoTransform");return r&&r.translate?r.translate:[0,0]}}}var m,g;if(i.csstransitions){m={WebkitTransitionProperty:"webkitTransitionEnd",MozTransitionProperty:"transitionend",OTransitionProperty:"oTransitionEnd otransitionend",transitionProperty:"transitionend"}[f];g=u("transitionDuration")}var y=t.event,b=t.event.handle?"handle":"dispatch",w;y.special.smartresize={setup:function(){t(this).bind("resize",y.special.smartresize.handler)},teardown:function(){t(this).unbind("resize",y.special.smartresize.handler)},handler:function(e,t){var n=this,r=arguments;e.type="smartresize";w&&clearTimeout(w);w=setTimeout(function(){y[b].apply(n,r)},t==="execAsap"?0:100)}};t.fn.smartresize=function(e){return e?this.bind("smartresize",e):this.trigger("smartresize",["execAsap"])};t.Isotope=function(e,n,r){this.element=t(n);this._create(e);this._init(r)};var E=["width","height"],S=t(e);t.Isotope.settings={resizable:!0,layoutMode:"masonry",containerClass:"isotope",itemClass:"isotope-item",hiddenClass:"isotope-hidden",hiddenStyle:{opacity:0,scale:.001},visibleStyle:{opacity:1,scale:1},containerStyle:{position:"relative",overflow:"hidden"},animationEngine:"best-available",animationOptions:{queue:!1,duration:800},sortBy:"original-order",sortAscending:!0,resizesContainer:!0,transformsEnabled:!0,itemPositionDataEnabled:!1};t.Isotope.prototype={_create:function(e){this.options=t.extend({},t.Isotope.settings,e);this.styleQueue=[];this.elemCount=0;var n=this.element[0].style;this.originalStyle={};var r=E.slice(0);for(var i in this.options.containerStyle)r.push(i);for(var s=0,o=r.length;so?1:s0){a=function(e,t){t.$el[r](t.style,s).one(m,l)};f=!1}}}t.each(this.styleQueue,a);f&&l();this.styleQueue=[]},resize:function(){this["_"+this.options.layoutMode+"ResizeChanged"]()&&this.reLayout()},reLayout:function(e){this["_"+this.options.layoutMode+"Reset"]();this.layout(this.$filteredAtoms,e)},addItems:function(e,t){var n=this._getAtoms(e);this.$allAtoms=this.$allAtoms.add(n);t&&t(n)},insert:function(e,t){this.element.append(e);var n=this;this.addItems(e,function(e){var r=n._filter(e);n._addHideAppended(r);n._sort();n.reLayout();n._revealAppended(r,t)})},appended:function(e,t){var n=this;this.addItems(e,function(e){n._addHideAppended(e);n.layout(e);n._revealAppended(e,t)})},_addHideAppended:function(e){this.$filteredAtoms=this.$filteredAtoms.add(e);e.addClass("no-transition");this._isInserting=!0;this.styleQueue.push({$el:e,style:this.options.hiddenStyle})},_revealAppended:function(e,t){var n=this;setTimeout(function(){e.removeClass("no-transition");n.styleQueue.push({$el:e,style:n.options.visibleStyle});n._isInserting=!1;n._processStyleQueue(e,t)},10)},reloadItems:function(){this.$allAtoms=this._getAtoms(this.element.children())},remove:function(e,t){this.$allAtoms=this.$allAtoms.not(e);this.$filteredAtoms=this.$filteredAtoms.not(e);var n=this,r=function(){e.remove();t&&t.call(n.element)};if(e.filter(":not(."+this.options.hiddenClass+")").length){this.styleQueue.push({$el:e,style:this.options.hiddenStyle});this._sort();this.reLayout(r)}else r()},shuffle:function(e){this.updateSortData(this.$allAtoms);this.options.sortBy="random";this._sort();this.reLayout(e)},destroy:function(){var e=this.usingTransforms,t=this.options;this.$allAtoms.removeClass(t.hiddenClass+" "+t.itemClass).each(function(){var t=this.style;t.position="";t.top="";t.left="";t.opacity="";e&&(t[a]="")});var n=this.element[0].style;for(var r in this.originalStyle)n[r]=this.originalStyle[r];this.element.unbind(".isotope").undelegate("."+t.hiddenClass,"click").removeClass(t.containerClass).removeData("isotope");S.unbind(".isotope")},_getSegments:function(e){var t=this.options.layoutMode,n=e?"rowHeight":"columnWidth",r=e?"height":"width",i=e?"rows":"cols",o=this.element[r](),u,a=this.options[t]&&this.options[t][n]||this.$filteredAtoms["outer"+s(r)](!0)||o;u=Math.floor(o/a);u=Math.max(u,1);this[t][i]=u;this[t][n]=a},_checkIfSegmentsChanged:function(e){var t=this.options.layoutMode,n=e?"rows":"cols",r=this[t][n];this._getSegments(e);return this[t][n]!==r},_masonryReset:function(){this.masonry={};this._getSegments();var e=this.masonry.cols;this.masonry.colYs=[];while(e--)this.masonry.colYs.push(0)},_masonryLayout:function(e){var n=this,r=n.masonry;e.each(function(){var e=t(this),i=Math.ceil(e.outerWidth(!0)/r.columnWidth);i=Math.min(i,r.cols);if(i===1)n._masonryPlaceBrick(e,r.colYs);else{var s=r.cols+1-i,o=[],u,a;for(a=0;ar){i.x=0;i.y=i.height}n._pushPosition(e,i.x,i.y);i.height=Math.max(i.y+o,i.height);i.x+=s})},_fitRowsGetContainerSize:function(){return{height:this.fitRows.height}},_fitRowsResizeChanged:function(){return!0},_cellsByRowReset:function(){this.cellsByRow={index:0};this._getSegments();this._getSegments(!0)},_cellsByRowLayout:function(e){var n=this,r=this.cellsByRow;e.each(function(){var e=t(this),i=r.index%r.cols,s=Math.floor(r.index/r.cols),o=(i+.5)*r.columnWidth-e.outerWidth(!0)/2,u=(s+.5)*r.rowHeight-e.outerHeight(!0)/2;n._pushPosition(e,o,u);r.index++})},_cellsByRowGetContainerSize:function(){return{height:Math.ceil(this.$filteredAtoms.length/this.cellsByRow.cols)*this.cellsByRow.rowHeight+this.offset.top}},_cellsByRowResizeChanged:function(){return this._checkIfSegmentsChanged()},_straightDownReset:function(){this.straightDown={y:0}},_straightDownLayout:function(e){var n=this;e.each(function(e){var r=t(this);n._pushPosition(r,0,n.straightDown.y);n.straightDown.y+=r.outerHeight(!0)})},_straightDownGetContainerSize:function(){return{height:this.straightDown.y}},_straightDownResizeChanged:function(){return!0},_masonryHorizontalReset:function(){this.masonryHorizontal={};this._getSegments(!0);var e=this.masonryHorizontal.rows;this.masonryHorizontal.rowXs=[];while(e--)this.masonryHorizontal.rowXs.push(0)},_masonryHorizontalLayout:function(e){var n=this,r=n.masonryHorizontal;e.each(function(){var e=t(this),i=Math.ceil(e.outerHeight(!0)/r.rowHeight);i=Math.min(i,r.rows);if(i===1)n._masonryHorizontalPlaceBrick(e,r.rowXs);else{var s=r.rows+1-i,o=[],u,a;for(a=0;ar){i.x=i.width;i.y=0}n._pushPosition(e,i.x,i.y);i.width=Math.max(i.x+s,i.width);i.y+=o})},_fitColumnsGetContainerSize:function(){return{width:this.fitColumns.width}},_fitColumnsResizeChanged:function(){return!0},_cellsByColumnReset:function(){this.cellsByColumn={index:0};this._getSegments();this._getSegments(!0)},_cellsByColumnLayout:function(e){var n=this,r=this.cellsByColumn;e.each(function(){var e=t(this),i=Math.floor(r.index/r.rows),s=r.index%r.rows,o=(i+.5)*r.columnWidth-e.outerWidth(!0)/2,u=(s+.5)*r.rowHeight-e.outerHeight(!0)/2;n._pushPosition(e,o,u);r.index++})},_cellsByColumnGetContainerSize:function(){return{width:Math.ceil(this.$filteredAtoms.length/this.cellsByColumn.rows)*this.cellsByColumn.columnWidth}},_cellsByColumnResizeChanged:function(){return this._checkIfSegmentsChanged(!0)},_straightAcrossReset:function(){this.straightAcross={x:0}},_straightAcrossLayout:function(e){var n=this;e.each(function(e){var r=t(this);n._pushPosition(r,n.straightAcross.x,0);n.straightAcross.x+=r.outerWidth(!0)})},_straightAcrossGetContainerSize:function(){return{width:this.straightAcross.x}},_straightAcrossResizeChanged:function(){return!0}};t.fn.imagesLoaded=function(e){function u(){e.call(n,r)}function a(e){var n=e.target;if(n.src!==s&&t.inArray(n,o)===-1){o.push(n);if(--i<=0){setTimeout(u);r.unbind(".imagesLoaded",a)}}}var n=this,r=n.find("img").add(n.filter("img")),i=r.length,s="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==",o=[];i||u();r.bind("load.imagesLoaded error.imagesLoaded",a).each(function(){var e=this.src;this.src=s;this.src=e});return n};var x=function(t){e.console&&e.console.error(t)};t.fn.isotope=function(e,n){if(typeof e=="string"){var r=Array.prototype.slice.call(arguments,1);this.each(function(){var n=t.data(this,"isotope");if(!n){x("cannot call methods on isotope prior to initialization; attempted to call method '"+e+"'");return}if(!t.isFunction(n[e])||e.charAt(0)==="_"){x("no such method '"+e+"' for isotope instance");return}n[e].apply(n,r)})}else this.each(function(){var r=t.data(this,"isotope");if(r){r.option(e);r._init(n)}else t.data(this,"isotope",new t.Isotope(e,this,n))});return this}})(window,jQuery);
// RTL support for grid layouts
if(jQuery('body.rtl').length >= 1){
jQuery.Isotope.prototype._positionAbs = function( x, y ) {
return { right: x, top: y };
};
}
/*!
* hoverIntent r7 // 2013.03.11 // jQuery 1.9.1+
* http://cherne.net/brian/resources/jquery.hoverIntent.html
*
* You may use hoverIntent under the terms of the MIT license. Basically that
* means you are free to use hoverIntent as long as this header is left intact.
* Copyright 2007, 2013 Brian Cherne
*/
/* hoverIntent is similar to jQuery's built-in "hover" method except that
* instead of firing the handlerIn function immediately, hoverIntent checks
* to see if the user's mouse has slowed down (beneath the sensitivity
* threshold) before firing the event. The handlerOut function is only
* called after a matching handlerIn.
*
* // basic usage ... just like .hover()
* .hoverIntent( handlerIn, handlerOut )
* .hoverIntent( handlerInOut )
*
* // basic usage ... with event delegation!
* .hoverIntent( handlerIn, handlerOut, selector )
* .hoverIntent( handlerInOut, selector )
*
* // using a basic configuration object
* .hoverIntent( config )
*
* @param handlerIn function OR configuration object
* @param handlerOut function OR selector for delegation OR undefined
* @param selector selector OR undefined
* @author Brian Cherne
*/
(function($) {
$.fn.hoverIntent = function(handlerIn,handlerOut,selector) {
// default configuration values
var cfg = {
interval: 100,
sensitivity: 7,
timeout: 0
};
if ( typeof handlerIn === "object" ) {
cfg = $.extend(cfg, handlerIn );
} else if ($.isFunction(handlerOut)) {
cfg = $.extend(cfg, { over: handlerIn, out: handlerOut, selector: selector } );
} else {
cfg = $.extend(cfg, { over: handlerIn, out: handlerIn, selector: handlerOut } );
}
// instantiate variables
// cX, cY = current X and Y position of mouse, updated by mousemove event
// pX, pY = previous X and Y position of mouse, set by mouseover and polling interval
var cX, cY, pX, pY;
// A private function for getting mouse position
var track = function(ev) {
cX = ev.pageX;
cY = ev.pageY;
};
// A private function for comparing current and previous mouse position
var compare = function(ev,ob) {
ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t);
// compare mouse positions to see if they've crossed the threshold
if ( ( Math.abs(pX-cX) + Math.abs(pY-cY) ) < cfg.sensitivity ) {
$(ob).off("mousemove.hoverIntent",track);
// set hoverIntent state to true (so mouseOut can be called)
ob.hoverIntent_s = 1;
return cfg.over.apply(ob,[ev]);
} else {
// set previous coordinates for next time
pX = cX; pY = cY;
// use self-calling timeout, guarantees intervals are spaced out properly (avoids JavaScript timer bugs)
ob.hoverIntent_t = setTimeout( function(){compare(ev, ob);} , cfg.interval );
}
};
// A private function for delaying the mouseOut function
var delay = function(ev,ob) {
ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t);
ob.hoverIntent_s = 0;
return cfg.out.apply(ob,[ev]);
};
// A private function for handling mouse 'hovering'
var handleHover = function(e) {
// copy objects to be passed into t (required for event object to be passed in IE)
var ev = jQuery.extend({},e);
var ob = this;
// cancel hoverIntent timer if it exists
if (ob.hoverIntent_t) { ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t); }
// if e.type == "mouseenter"
if (e.type == "mouseenter") {
// set "previous" X and Y position based on initial entry point
pX = ev.pageX; pY = ev.pageY;
// update "current" X and Y position based on mousemove
$(ob).on("mousemove.hoverIntent",track);
// start polling interval (self-calling timeout) to compare mouse coordinates over time
if (ob.hoverIntent_s != 1) { ob.hoverIntent_t = setTimeout( function(){compare(ev,ob);} , cfg.interval );}
// else e.type == "mouseleave"
} else {
// unbind expensive mousemove event
$(ob).off("mousemove.hoverIntent",track);
// if hoverIntent state is true, then call the mouseOut function after the specified delay
if (ob.hoverIntent_s == 1) { ob.hoverIntent_t = setTimeout( function(){delay(ev,ob);} , cfg.timeout );}
}
};
// listen for mouseenter and mouseleave
return this.on({'mouseenter.hoverIntent':handleHover,'mouseleave.hoverIntent':handleHover}, cfg.selector);
};
})(jQuery);
/*
|--------------------------------------------------------------------------
| UItoTop jQuery Plugin 1.2 by Matt Varone
| http://www.mattvarone.com/web-design/uitotop-jquery-plugin/
|--------------------------------------------------------------------------
*/
(function($){
$.fn.UItoTop = function(options) {
var defaults = {
text: '',
min: 200,
inDelay:600,
outDelay:400,
containerID: 'toTop',
containerHoverID: 'toTopHover',
scrollSpeed: 1200,
easingType: 'linear'
},
settings = $.extend(defaults, options),
containerIDhash = '#' + settings.containerID,
containerHoverIDHash = '#'+settings.containerHoverID;
$('body').append(''+settings.text+'');
$(containerIDhash).hide().on('click.UItoTop',function(){
$('html, body').animate({scrollTop:0}, settings.scrollSpeed, settings.easingType);
$('#'+settings.containerHoverID, this).stop().animate({'opacity': 0 }, settings.inDelay, settings.easingType);
return false;
})
.prepend('')
.hover(function() {
$(containerHoverIDHash, this).stop().animate({
'opacity': 1
}, 600, 'linear');
}, function() {
$(containerHoverIDHash, this).stop().animate({
'opacity': 0
}, 700, 'linear');
});
$(window).scroll(function() {
var sd = $(window).scrollTop();
if(typeof document.body.style.maxHeight === "undefined") {
$(containerIDhash).css({
'position': 'absolute',
'top': sd + $(window).height() - 50
});
}
if ( sd > settings.min ) {
$(containerIDhash).fadeIn(settings.inDelay);
} else {
$(containerIDhash).fadeOut(settings.Outdelay);
}
});
};
})(jQuery);
(function( window, $, undefined ) {
/*
* smartresize: debounced resize event for jQuery
*
* latest version and complete README available on Github:
* https://github.com/louisremi/jquery.smartresize.js
*
* Copyright 2011 @louis_remi
* Licensed under the MIT license.
*/
var $event = $.event, resizeTimeout;
$event.special.smartresize = {
setup: function() {
$(this).bind( "resize", $event.special.smartresize.handler );
},
teardown: function() {
$(this).unbind( "resize", $event.special.smartresize.handler );
},
handler: function( event, execAsap ) {
// Save the context
var context = this,
args = arguments;
// set correct event type
event.type = "smartresize";
if ( resizeTimeout ) { clearTimeout( resizeTimeout ); }
resizeTimeout = setTimeout(function() {
jQuery.event.handle.apply( context, args );
}, execAsap === "execAsap"? 0 : 100 );
}
};
$.fn.smartresize = function( fn ) {
return fn ? this.bind( "smartresize", fn ) : this.trigger( "smartresize", ["execAsap"] );
};
$.Slideshow = function( options, element ) {
this.$el = $( element );
/***** images ****/
// list of image items
this.$list = this.$el.find('ul.ei-slider-large');
// image items
this.$imgItems = this.$list.children('li');
// total number of items
this.itemsCount = this.$imgItems.length;
// images
this.$images = this.$imgItems.find('img:first');
/***** thumbs ****/
// thumbs wrapper
this.$sliderthumbs = this.$el.find('ul.ei-slider-thumbs').hide();
// slider elements
this.$sliderElems = this.$sliderthumbs.children('li');
// sliding div
this.$sliderElem = this.$sliderthumbs.children('li.ei-slider-element');
// thumbs
this.$thumbs = this.$sliderElems.not('.ei-slider-element');
// initialize slideshow
this._init( options );
};
$.Slideshow.defaults = {
// animation types:
// "sides" : new slides will slide in from left / right
// "center": new slides will appear in the center
animation : 'sides', // sides || center
// if true the slider will automatically slide, and it will only stop if the user clicks on a thumb
autoplay : false,
// interval for the slideshow
slideshow_interval : 3000,
// speed for the sliding animation
speed : 800,
// easing for the sliding animation
easing : '',
// percentage of speed for the titles animation. Speed will be speed * titlesFactor
titlesFactor : 0.60,
// titles animation speed
titlespeed : 800,
// titles animation easing
titleeasing : '',
// maximum width for the thumbs in pixels
thumbMaxWidth : 150
};
$.Slideshow.prototype = {
_init : function( options ) {
this.options = $.extend( true, {}, $.Slideshow.defaults, options );
// set the opacity of the title elements and the image items
this.$imgItems.css( 'opacity', 0 );
this.$imgItems.find('div.ei-title > *').css( 'opacity', 0 );
// index of current visible slider
this.current = 0;
var _self = this;
// preload images
// add loading status
this.$loading = $('
Loading
').prependTo( _self.$el );
$.when( this._preloadImages() ).done( function() {
// hide loading status
_self.$loading.hide();
// calculate size and position for each image
_self._setImagesSize();
// configure thumbs container
_self._initThumbs();
// show first
_self.$imgItems.eq( _self.current ).css({
'opacity' : 1,
'z-index' : 10
}).show().find('div.ei-title > *').css( 'opacity', 1 );
// if autoplay is true
if( _self.options.autoplay ) {
_self._startSlideshow();
}
// initialize the events
_self._initEvents();
});
},
_preloadImages : function() {
// preloads all the large images
var _self = this,
loaded = 0;
return $.Deferred(
function(dfd) {
_self.$images.each( function( i ) {
$('').load( function() {
if( ++loaded === _self.itemsCount ) {
dfd.resolve();
}
}).attr( 'src', $(this).attr('src') );
});
}
).promise();
},
_setImagesSize : function() {
// save ei-slider's width
this.elWidth = this.$el.width();
var _self = this;
this.$images.each( function( i ) {
var $img = $(this);
imgDim = _self._getImageDim( $img.attr('src') );
$img.css({
width : imgDim.width,
height : imgDim.height,
marginLeft : imgDim.left,
marginTop : imgDim.top
});
});
},
_getImageDim : function( src ) {
var $img = new Image();
$img.src = src;
var c_w = this.elWidth,
c_h = this.$el.height(),
r_w = c_h / c_w,
i_w = $img.width,
i_h = $img.height,
r_i = i_h / i_w,
new_w, new_h, new_left, new_top;
if( r_w > r_i ) {
new_h = c_h;
new_w = c_h / r_i;
}
else {
new_h = c_w * r_i;
new_w = c_w;
}
return {
width : new_w,
height : new_h,
left : ( c_w - new_w ) / 2,
top : ( c_h - new_h ) / 2
};
},
_initThumbs : function() {
// set the max-width of the slider elements to the one set in the plugin's options
// also, the width of each slider element will be 100% / total number of elements
this.$sliderElems.css({
'max-width' : this.options.thumbMaxWidth + 'px',
'width' : 100 / this.itemsCount + '%'
});
// set the max-width of the slider and show it
this.$sliderthumbs.css( 'max-width', this.options.thumbMaxWidth * this.itemsCount + 'px' ).show();
},
_startSlideshow : function() {
var _self = this;
this.slideshow = setTimeout( function() {
var pos;
( _self.current === _self.itemsCount - 1 ) ? pos = 0 : pos = _self.current + 1;
_self._slideTo( pos );
if( _self.options.autoplay ) {
_self._startSlideshow();
}
}, this.options.slideshow_interval);
},
// shows the clicked thumb's slide
_slideTo : function( pos ) {
// return if clicking the same element or if currently animating
if( pos === this.current || this.isAnimating )
return false;
this.isAnimating = true;
var $currentSlide = this.$imgItems.eq( this.current ),
$nextSlide = this.$imgItems.eq( pos ),
_self = this,
preCSS = {zIndex : 10},
animCSS = {opacity : 1};
// new slide will slide in from left or right side
if( this.options.animation === 'sides' ) {
preCSS.left = ( pos > this.current ) ? -1 * this.elWidth : this.elWidth;
animCSS.left = 0;
}
// titles animation
$nextSlide.find('div.ei-title > h2')
.css( 'margin-right', 50 + 'px' )
.stop()
.delay( this.options.speed * this.options.titlesFactor )
.animate({ marginRight : 0 + 'px', opacity : 1 }, this.options.titlespeed, this.options.titleeasing )
.end()
.find('div.ei-title > h3')
.css( 'margin-right', -50 + 'px' )
.stop()
.delay( this.options.speed * this.options.titlesFactor )
.animate({ marginRight : 0 + 'px', opacity : 1 }, this.options.titlespeed, this.options.titleeasing );
$.when(
// fade out current titles
$currentSlide.css( 'z-index' , 1 ).find('div.ei-title > *').stop().fadeOut( this.options.speed / 2, function() {
// reset style
$(this).show().css( 'opacity', 0 );
}),
// animate next slide in
$nextSlide.css( preCSS ).stop().animate( animCSS, this.options.speed, this.options.easing ),
// "sliding div" moves to new position
this.$sliderElem.stop().animate({
left : this.$thumbs.eq( pos ).position().left
}, this.options.speed )
).done( function() {
// reset values
$currentSlide.css( 'opacity' , 0 ).find('div.ei-title > *').css( 'opacity', 0 );
_self.current = pos;
_self.isAnimating = false;
});
},
_initEvents : function() {
var _self = this;
// window resize
$(window).on( 'smartresize.eislideshow', function( event ) {
// resize the images
_self._setImagesSize();
// reset position of thumbs sliding div
_self.$sliderElem.css( 'left', _self.$thumbs.eq( _self.current ).position().left );
});
// click the thumbs
this.$thumbs.on( 'click.eislideshow', function( event ) {
if( _self.options.autoplay ) {
clearTimeout( _self.slideshow );
_self.options.autoplay = false;
}
var $thumb = $(this),
idx = $thumb.index() - 1; // exclude sliding div
_self._slideTo( idx );
return false;
});
}
};
var logError = function( message ) {
if ( this.console ) {
console.error( message );
}
};
$.fn.eislideshow = function( options ) {
if ( typeof options === 'string' ) {
var args = Array.prototype.slice.call( arguments, 1 );
this.each(function() {
var instance = $.data( this, 'eislideshow' );
if ( !instance ) {
logError( "cannot call methods on eislideshow prior to initialization; " +
"attempted to call method '" + options + "'" );
return;
}
if ( !$.isFunction( instance[options] ) || options.charAt(0) === "_" ) {
logError( "no such method '" + options + "' for eislideshow instance" );
return;
}
instance[ options ].apply( instance, args );
});
}
else {
this.each(function() {
var instance = $.data( this, 'eislideshow' );
if ( !instance ) {
$.data( this, 'eislideshow', new $.Slideshow( options, this ) );
}
});
}
return this;
};
})( window, jQuery );
/*!
* jQuery Cycle Lite Plugin
* http://malsup.com/jquery/cycle/lite/
* Copyright (c) 2008-2012 M. Alsup
* Version: 1.7 (20-FEB-2013)
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
* Requires: jQuery v1.3.2 or later
*/
;(function($) {
"use strict";
var ver = 'Lite-1.7';
var msie = /MSIE/.test(navigator.userAgent);
$.fn.cycle = function(options) {
return this.each(function() {
options = options || {};
if (this.cycleTimeout)
clearTimeout(this.cycleTimeout);
this.cycleTimeout = 0;
this.cyclePause = 0;
var $cont = $(this);
var $slides = options.slideExpr ? $(options.slideExpr, this) : $cont.children();
var els = $slides.get();
if (els.length < 2) {
if (window.console)
console.log('terminating; too few slides: ' + els.length);
return; // don't bother
}
// support metadata plugin (v1.0 and v2.0)
var opts = $.extend({}, $.fn.cycle.defaults, options || {}, $.metadata ? $cont.metadata() : $.meta ? $cont.data() : {});
var meta = $.isFunction($cont.data) ? $cont.data(opts.metaAttr) : null;
if (meta)
opts = $.extend(opts, meta);
opts.before = opts.before ? [opts.before] : [];
opts.after = opts.after ? [opts.after] : [];
opts.after.unshift(function(){ opts.busy=0; });
// allow shorthand overrides of width, height and timeout
var cls = this.className;
opts.width = parseInt((cls.match(/w:(\d+)/)||[])[1], 10) || opts.width;
opts.height = parseInt((cls.match(/h:(\d+)/)||[])[1], 10) || opts.height;
opts.timeout = parseInt((cls.match(/t:(\d+)/)||[])[1], 10) || opts.timeout;
if ($cont.css('position') == 'static')
$cont.css('position', 'relative');
if (opts.width)
$cont.width(opts.width);
if (opts.height && opts.height != 'auto')
$cont.height(opts.height);
var first = 0;
$slides.css({position: 'absolute', top:0}).each(function(i) {
$(this).css('z-index', els.length-i);
});
$(els[first]).css('opacity',1).show(); // opacity bit needed to handle reinit case
if (msie)
els[first].style.removeAttribute('filter');
if (opts.fit && opts.width)
$slides.width(opts.width);
if (opts.fit && opts.height && opts.height != 'auto')
$slides.height(opts.height);
if (opts.pause)
$cont.hover(function(){this.cyclePause=1;}, function(){this.cyclePause=0;});
var txFn = $.fn.cycle.transitions[opts.fx];
if (txFn)
txFn($cont, $slides, opts);
$slides.each(function() {
var $el = $(this);
this.cycleH = (opts.fit && opts.height) ? opts.height : $el.height();
this.cycleW = (opts.fit && opts.width) ? opts.width : $el.width();
});
if (opts.cssFirst)
$($slides[first]).css(opts.cssFirst);
if (opts.timeout) {
// ensure that timeout and speed settings are sane
if (opts.speed.constructor == String)
opts.speed = {slow: 600, fast: 200}[opts.speed] || 400;
if (!opts.sync)
opts.speed = opts.speed / 2;
while((opts.timeout - opts.speed) < 250)
opts.timeout += opts.speed;
}
opts.speedIn = opts.speed;
opts.speedOut = opts.speed;
opts.slideCount = els.length;
opts.currSlide = first;
opts.nextSlide = 1;
// fire artificial events
var e0 = $slides[first];
if (opts.before.length)
opts.before[0].apply(e0, [e0, e0, opts, true]);
if (opts.after.length > 1)
opts.after[1].apply(e0, [e0, e0, opts, true]);
if (opts.click && !opts.next)
opts.next = opts.click;
if (opts.next)
$(opts.next).unbind('click.cycle').bind('click.cycle', function(){return advance(els,opts,opts.rev?-1:1);});
if (opts.prev)
$(opts.prev).unbind('click.cycle').bind('click.cycle', function(){return advance(els,opts,opts.rev?1:-1);});
if (opts.timeout)
this.cycleTimeout = setTimeout(function() {
go(els,opts,0,!opts.rev);
}, opts.timeout + (opts.delay||0));
});
};
function go(els, opts, manual, fwd) {
if (opts.busy)
return;
var p = els[0].parentNode, curr = els[opts.currSlide], next = els[opts.nextSlide];
if (p.cycleTimeout === 0 && !manual)
return;
if (manual || !p.cyclePause) {
if (opts.before.length)
$.each(opts.before, function(i,o) { o.apply(next, [curr, next, opts, fwd]); });
var after = function() {
if (msie)
this.style.removeAttribute('filter');
$.each(opts.after, function(i,o) { o.apply(next, [curr, next, opts, fwd]); });
queueNext(opts);
};
if (opts.nextSlide != opts.currSlide) {
opts.busy = 1;
$.fn.cycle.custom(curr, next, opts, after);
}
var roll = (opts.nextSlide + 1) == els.length;
opts.nextSlide = roll ? 0 : opts.nextSlide+1;
opts.currSlide = roll ? els.length-1 : opts.nextSlide-1;
} else {
queueNext(opts);
}
function queueNext(opts) {
if (opts.timeout)
p.cycleTimeout = setTimeout(function() { go(els,opts,0,!opts.rev); }, opts.timeout);
}
}
// advance slide forward or back
function advance(els, opts, val) {
var p = els[0].parentNode, timeout = p.cycleTimeout;
if (timeout) {
clearTimeout(timeout);
p.cycleTimeout = 0;
}
opts.nextSlide = opts.currSlide + val;
if (opts.nextSlide < 0) {
opts.nextSlide = els.length - 1;
}
else if (opts.nextSlide >= els.length) {
opts.nextSlide = 0;
}
go(els, opts, 1, val>=0);
return false;
}
$.fn.cycle.custom = function(curr, next, opts, cb) {
var $l = $(curr), $n = $(next);
$n.css(opts.cssBefore);
var fn = function() {$n.animate(opts.animIn, opts.speedIn, opts.easeIn, cb);};
$l.animate(opts.animOut, opts.speedOut, opts.easeOut, function() {
$l.css(opts.cssAfter);
if (!opts.sync)
fn();
});
if (opts.sync)
fn();
};
$.fn.cycle.transitions = {
fade: function($cont, $slides, opts) {
$slides.not(':eq(0)').hide();
opts.cssBefore = { opacity: 0, display: 'block' };
opts.cssAfter = { display: 'none' };
opts.animOut = { opacity: 0 };
opts.animIn = { opacity: 1 };
},
fadeout: function($cont, $slides, opts) {
opts.before.push(function(curr,next,opts,fwd) {
$(curr).css('zIndex',opts.slideCount + (fwd === true ? 1 : 0));
$(next).css('zIndex',opts.slideCount + (fwd === true ? 0 : 1));
});
$slides.not(':eq(0)').hide();
opts.cssBefore = { opacity: 1, display: 'block', zIndex: 1 };
opts.cssAfter = { display: 'none', zIndex: 0 };
opts.animOut = { opacity: 0 };
opts.animIn = { opacity: 1 };
}
};
$.fn.cycle.ver = function() { return ver; };
// @see: http://malsup.com/jquery/cycle/lite/
$.fn.cycle.defaults = {
animIn: {},
animOut: {},
fx: 'fade',
after: null,
before: null,
cssBefore: {},
cssAfter: {},
delay: 0,
fit: 0,
height: 'auto',
metaAttr: 'cycle',
next: null,
pause: false,
prev: null,
speed: 1000,
slideExpr: null,
sync: true,
timeout: 4000
};
})(jQuery);
/*!
* imagesLoaded PACKAGED v3.0.4
* JavaScript is all like "You images are done yet or what?"
* MIT License
*/
(function(){"use strict";function e(){}function t(e,t){for(var n=e.length;n--;)if(e[n].listener===t)return n;return-1}function n(e){return function(){return this[e].apply(this,arguments)}}var i=e.prototype;i.getListeners=function(e){var t,n,i=this._getEvents();if("object"==typeof e){t={};for(n in i)i.hasOwnProperty(n)&&e.test(n)&&(t[n]=i[n])}else t=i[e]||(i[e]=[]);return t},i.flattenListeners=function(e){var t,n=[];for(t=0;e.length>t;t+=1)n.push(e[t].listener);return n},i.getListenersAsObject=function(e){var t,n=this.getListeners(e);return n instanceof Array&&(t={},t[e]=n),t||n},i.addListener=function(e,n){var i,r=this.getListenersAsObject(e),o="object"==typeof n;for(i in r)r.hasOwnProperty(i)&&-1===t(r[i],n)&&r[i].push(o?n:{listener:n,once:!1});return this},i.on=n("addListener"),i.addOnceListener=function(e,t){return this.addListener(e,{listener:t,once:!0})},i.once=n("addOnceListener"),i.defineEvent=function(e){return this.getListeners(e),this},i.defineEvents=function(e){for(var t=0;e.length>t;t+=1)this.defineEvent(e[t]);return this},i.removeListener=function(e,n){var i,r,o=this.getListenersAsObject(e);for(r in o)o.hasOwnProperty(r)&&(i=t(o[r],n),-1!==i&&o[r].splice(i,1));return this},i.off=n("removeListener"),i.addListeners=function(e,t){return this.manipulateListeners(!1,e,t)},i.removeListeners=function(e,t){return this.manipulateListeners(!0,e,t)},i.manipulateListeners=function(e,t,n){var i,r,o=e?this.removeListener:this.addListener,s=e?this.removeListeners:this.addListeners;if("object"!=typeof t||t instanceof RegExp)for(i=n.length;i--;)o.call(this,t,n[i]);else for(i in t)t.hasOwnProperty(i)&&(r=t[i])&&("function"==typeof r?o.call(this,i,r):s.call(this,i,r));return this},i.removeEvent=function(e){var t,n=typeof e,i=this._getEvents();if("string"===n)delete i[e];else if("object"===n)for(t in i)i.hasOwnProperty(t)&&e.test(t)&&delete i[t];else delete this._events;return this},i.removeAllListeners=n("removeEvent"),i.emitEvent=function(e,t){var n,i,r,o,s=this.getListenersAsObject(e);for(r in s)if(s.hasOwnProperty(r))for(i=s[r].length;i--;)n=s[r][i],n.once===!0&&this.removeListener(e,n.listener),o=n.listener.apply(this,t||[]),o===this._getOnceReturnValue()&&this.removeListener(e,n.listener);return this},i.trigger=n("emitEvent"),i.emit=function(e){var t=Array.prototype.slice.call(arguments,1);return this.emitEvent(e,t)},i.setOnceReturnValue=function(e){return this._onceReturnValue=e,this},i._getOnceReturnValue=function(){return this.hasOwnProperty("_onceReturnValue")?this._onceReturnValue:!0},i._getEvents=function(){return this._events||(this._events={})},"function"==typeof define&&define.amd?define(function(){return e}):"object"==typeof module&&module.exports?module.exports=e:this.EventEmitter=e}).call(this),function(e){"use strict";var t=document.documentElement,n=function(){};t.addEventListener?n=function(e,t,n){e.addEventListener(t,n,!1)}:t.attachEvent&&(n=function(t,n,i){t[n+i]=i.handleEvent?function(){var t=e.event;t.target=t.target||t.srcElement,i.handleEvent.call(i,t)}:function(){var n=e.event;n.target=n.target||n.srcElement,i.call(t,n)},t.attachEvent("on"+n,t[n+i])});var i=function(){};t.removeEventListener?i=function(e,t,n){e.removeEventListener(t,n,!1)}:t.detachEvent&&(i=function(e,t,n){e.detachEvent("on"+t,e[t+n]);try{delete e[t+n]}catch(i){e[t+n]=void 0}});var r={bind:n,unbind:i};"function"==typeof define&&define.amd?define(r):e.eventie=r}(this),function(e){"use strict";function t(e,t){for(var n in t)e[n]=t[n];return e}function n(e){return"[object Array]"===c.call(e)}function i(e){var t=[];if(n(e))t=e;else if("number"==typeof e.length)for(var i=0,r=e.length;r>i;i++)t.push(e[i]);else t.push(e);return t}function r(e,n){function r(e,n,s){if(!(this instanceof r))return new r(e,n);"string"==typeof e&&(e=document.querySelectorAll(e)),this.elements=i(e),this.options=t({},this.options),"function"==typeof n?s=n:t(this.options,n),s&&this.on("always",s),this.getImages(),o&&(this.jqDeferred=new o.Deferred);var a=this;setTimeout(function(){a.check()})}function c(e){this.img=e}r.prototype=new e,r.prototype.options={},r.prototype.getImages=function(){this.images=[];for(var e=0,t=this.elements.length;t>e;e++){var n=this.elements[e];"IMG"===n.nodeName&&this.addImage(n);for(var i=n.querySelectorAll("img"),r=0,o=i.length;o>r;r++){var s=i[r];this.addImage(s)}}},r.prototype.addImage=function(e){var t=new c(e);this.images.push(t)},r.prototype.check=function(){function e(e,r){return t.options.debug&&a&&s.log("confirm",e,r),t.progress(e),n++,n===i&&t.complete(),!0}var t=this,n=0,i=this.images.length;if(this.hasAnyBroken=!1,!i)return this.complete(),void 0;for(var r=0;i>r;r++){var o=this.images[r];o.on("confirm",e),o.check()}},r.prototype.progress=function(e){this.hasAnyBroken=this.hasAnyBroken||!e.isLoaded;var t=this;setTimeout(function(){t.emit("progress",t,e),t.jqDeferred&&t.jqDeferred.notify(t,e)})},r.prototype.complete=function(){var e=this.hasAnyBroken?"fail":"done";this.isComplete=!0;var t=this;setTimeout(function(){if(t.emit(e,t),t.emit("always",t),t.jqDeferred){var n=t.hasAnyBroken?"reject":"resolve";t.jqDeferred[n](t)}})},o&&(o.fn.imagesLoaded=function(e,t){var n=new r(this,e,t);return n.jqDeferred.promise(o(this))});var f={};return c.prototype=new e,c.prototype.check=function(){var e=f[this.img.src];if(e)return this.useCached(e),void 0;if(f[this.img.src]=this,this.img.complete&&void 0!==this.img.naturalWidth)return this.confirm(0!==this.img.naturalWidth,"naturalWidth"),void 0;var t=this.proxyImage=new Image;n.bind(t,"load",this),n.bind(t,"error",this),t.src=this.img.src},c.prototype.useCached=function(e){if(e.isConfirmed)this.confirm(e.isLoaded,"cached was confirmed");else{var t=this;e.on("confirm",function(e){return t.confirm(e.isLoaded,"cache emitted confirmed"),!0})}},c.prototype.confirm=function(e,t){this.isConfirmed=!0,this.isLoaded=e,this.emit("confirm",this,t)},c.prototype.handleEvent=function(e){var t="on"+e.type;this[t]&&this[t](e)},c.prototype.onload=function(){this.confirm(!0,"onload"),this.unbindProxyEvents()},c.prototype.onerror=function(){this.confirm(!1,"onerror"),this.unbindProxyEvents()},c.prototype.unbindProxyEvents=function(){n.unbind(this.proxyImage,"load",this),n.unbind(this.proxyImage,"error",this)},r}var o=e.jQuery,s=e.console,a=s!==void 0,c=Object.prototype.toString;"function"==typeof define&&define.amd?define(["eventEmitter/EventEmitter","eventie/eventie"],r):e.imagesLoaded=r(e.EventEmitter,e.eventie)}(window);
/*jshint undef: true */
/*global jQuery: true */
/*
--------------------------------
Infinite Scroll
--------------------------------
+ https://github.com/paulirish/infinite-scroll
+ version 2.0b2.120519
+ Copyright 2011/12 Paul Irish & Luke Shumard
+ Licensed under the MIT license
+ Documentation: http://infinite-scroll.com/
*/
(function (window, $, undefined) {
"use strict";
$.infinitescroll = function infscr(options, callback, element) {
this.element = $(element);
// Flag the object in the event of a failed creation
if (!this._create(options, callback)) {
this.failed = true;
}
};
$.infinitescroll.defaults = {
loading: {
finished: undefined,
finishedMsg: "Congratulations, you've reached the end of the internet.",
img: "data:image/gif;base64,R0lGODlh3AATAPQeAPDy+MnQ6LW/4N3h8MzT6rjC4sTM5r/I5NHX7N7j8c7U6tvg8OLl8uXo9Ojr9b3G5MfP6Ovu9tPZ7PT1+vX2+tbb7vf4+8/W69jd7rC73vn5/O/x+K243ai02////wAAACH/C05FVFNDQVBFMi4wAwEAAAAh+QQECgD/ACwAAAAA3AATAAAF/6AnjmRpnmiqrmzrvnAsz3Rt33iu73zv/8CgcEj0BAScpHLJbDqf0Kh0Sq1ar9isdioItAKGw+MAKYMFhbF63CW438f0mg1R2O8EuXj/aOPtaHx7fn96goR4hmuId4qDdX95c4+RBIGCB4yAjpmQhZN0YGYGXitdZBIVGAsLoq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2EibIwQIXauWXSRg2SAOHIU5IIIMoZkhhWiJaiFVbKo6AQEgQXrTAazO1JhkBrBG3Y2Y6EsUhaGn95hprSN0oWpFE7rhkeaQBchGOEWnwEmc0uKWZj0LeuNV3W4Y2lZHFlQCSRjTIl8uZ+kG5HU/3sRlnTG2ytyadytnD3HrmuRcSn+0h1dycexIK1KCjYaCnjCCVqOFFJTZ5GkUUjESWaUIKU2lgCmAKKQIUjHapXRKE+t2og1VgankNYnohqKJ2CmKplso6GKz7WYCgqxeuyoF8u9IQAgA7",
msg: null,
msgText: "Loading the next set of posts...",
selector: null,
speed: 'fast',
start: undefined
},
state: {
isDuringAjax: false,
isInvalidPage: false,
isDestroyed: false,
isDone: false, // For when it goes all the way through the archive.
isPaused: false,
isBeyondMaxPage: false,
currPage: 1
},
debug: false,
behavior: undefined,
binder: $(window), // used to cache the selector
nextSelector: "div.navigation a:first",
navSelector: "div.navigation",
contentSelector: null, // rename to pageFragment
extraScrollPx: 150,
itemSelector: "div.post",
animate: false,
pathParse: undefined,
dataType: 'html',
appendCallback: true,
bufferPx: 40,
errorCallback: function () { },
infid: 0, //Instance ID
pixelsFromNavToBottom: undefined,
path: undefined, // Either parts of a URL as an array (e.g. ["/page/", "/"] or a function that takes in the page number and returns a URL
prefill: false, // When the document is smaller than the window, load data until the document is larger or links are exhausted
maxPage: undefined // to manually control maximum page (when maxPage is undefined, maximum page limitation is not work)
};
$.infinitescroll.prototype = {
/*
----------------------------
Private methods
----------------------------
*/
// Bind or unbind from scroll
_binding: function infscr_binding(binding) {
var instance = this,
opts = instance.options;
opts.v = '2.0b2.120520';
// if behavior is defined and this function is extended, call that instead of default
if (!!opts.behavior && this['_binding_'+opts.behavior] !== undefined) {
this['_binding_'+opts.behavior].call(this);
return;
}
if (binding !== 'bind' && binding !== 'unbind') {
this._debug('Binding value ' + binding + ' not valid');
return false;
}
if (binding === 'unbind') {
(this.options.binder).unbind('smartscroll.infscr.' + instance.options.infid);
} else {
(this.options.binder)[binding]('smartscroll.infscr.' + instance.options.infid, function () {
instance.scroll();
});
}
this._debug('Binding', binding);
},
// Fundamental aspects of the plugin are initialized
_create: function infscr_create(options, callback) {
// Add custom options to defaults
var opts = $.extend(true, {}, $.infinitescroll.defaults, options);
this.options = opts;
var $window = $(window);
var instance = this;
// Validate selectors
if (!instance._validate(options)) {
return false;
}
// Validate page fragment path
var path = $(opts.nextSelector).attr('href');
if (!path) {
this._debug('Navigation selector not found');
return false;
}
// Set the path to be a relative URL from root.
opts.path = opts.path || this._determinepath(path);
// contentSelector is 'page fragment' option for .load() / .ajax() calls
opts.contentSelector = opts.contentSelector || this.element;
// loading.selector - if we want to place the load message in a specific selector, defaulted to the contentSelector
opts.loading.selector = opts.loading.selector || opts.contentSelector;
// Define loading.msg
opts.loading.msg = opts.loading.msg || $('
' + opts.loading.msgText + '
');
// Preload loading.img
(new Image()).src = opts.loading.img;
// distance from nav links to bottom
// computed as: height of the document + top offset of container - top offset of nav link
if(opts.pixelsFromNavToBottom === undefined) {
opts.pixelsFromNavToBottom = $(document).height() - $(opts.navSelector).offset().top;
this._debug("pixelsFromNavToBottom: " + opts.pixelsFromNavToBottom);
}
var self = this;
// determine loading.start actions
opts.loading.start = opts.loading.start || function() {
$(opts.navSelector).hide();
opts.loading.msg
.appendTo(opts.loading.selector)
.show(opts.loading.speed, $.proxy(function() {
this.beginAjax(opts);
}, self));
};
// determine loading.finished actions
opts.loading.finished = opts.loading.finished || function() {
if (!opts.state.isBeyondMaxPage)
opts.loading.msg.fadeOut(opts.loading.speed);
};
// callback loading
opts.callback = function(instance, data, url) {
if (!!opts.behavior && instance['_callback_'+opts.behavior] !== undefined) {
instance['_callback_'+opts.behavior].call($(opts.contentSelector)[0], data, url);
}
if (callback) {
callback.call($(opts.contentSelector)[0], data, opts, url);
}
if (opts.prefill) {
$window.bind("resize.infinite-scroll", instance._prefill);
}
};
if (options.debug) {
// Tell IE9 to use its built-in console
if (Function.prototype.bind && (typeof console === 'object' || typeof console === 'function') && typeof console.log === "object") {
["log","info","warn","error","assert","dir","clear","profile","profileEnd"]
.forEach(function (method) {
console[method] = this.call(console[method], console);
}, Function.prototype.bind);
}
}
this._setup();
// Setups the prefill method for use
if (opts.prefill) {
this._prefill();
}
// Return true to indicate successful creation
return true;
},
_prefill: function infscr_prefill() {
var instance = this;
var $window = $(window);
function needsPrefill() {
return (instance.options.contentSelector.height() <= $window.height());
}
this._prefill = function() {
if (needsPrefill()) {
instance.scroll();
}
$window.bind("resize.infinite-scroll", function() {
if (needsPrefill()) {
$window.unbind("resize.infinite-scroll");
instance.scroll();
}
});
};
// Call self after setting up the new function
this._prefill();
},
// Console log wrapper
_debug: function infscr_debug() {
if (true !== this.options.debug) {
return;
}
if (typeof console !== 'undefined' && typeof console.log === 'function') {
// Modern browsers
// Single argument, which is a string
if ((Array.prototype.slice.call(arguments)).length === 1 && typeof Array.prototype.slice.call(arguments)[0] === 'string') {
console.log( (Array.prototype.slice.call(arguments)).toString() );
} else {
console.log( Array.prototype.slice.call(arguments) );
}
} else if (!Function.prototype.bind && typeof console !== 'undefined' && typeof console.log === 'object') {
// IE8
Function.prototype.call.call(console.log, console, Array.prototype.slice.call(arguments));
}
},
// find the number to increment in the path.
_determinepath: function infscr_determinepath(path) {
var opts = this.options;
// if behavior is defined and this function is extended, call that instead of default
if (!!opts.behavior && this['_determinepath_'+opts.behavior] !== undefined) {
return this['_determinepath_'+opts.behavior].call(this,path);
}
if (!!opts.pathParse) {
this._debug('pathParse manual');
return opts.pathParse(path, this.options.state.currPage+1);
} else if (path.match(/^(.*?)\b2\b(.*?$)/)) {
path = path.match(/^(.*?)\b2\b(.*?$)/).slice(1);
// if there is any 2 in the url at all.
} else if (path.match(/^(.*?)2(.*?$)/)) {
// page= is used in django:
// http://www.infinite-scroll.com/changelog/comment-page-1/#comment-127
if (path.match(/^(.*?page=)2(\/.*|$)/)) {
path = path.match(/^(.*?page=)2(\/.*|$)/).slice(1);
return path;
}
path = path.match(/^(.*?)2(.*?$)/).slice(1);
} else {
// page= is used in drupal too but second page is page=1 not page=2:
// thx Jerod Fritz, vladikoff
if (path.match(/^(.*?page=)1(\/.*|$)/)) {
path = path.match(/^(.*?page=)1(\/.*|$)/).slice(1);
return path;
} else {
this._debug('Sorry, we couldn\'t parse your Next (Previous Posts) URL. Verify your the css selector points to the correct A tag. If you still get this error: yell, scream, and kindly ask for help at infinite-scroll.com.');
// Get rid of isInvalidPage to allow permalink to state
opts.state.isInvalidPage = true; //prevent it from running on this page.
}
}
this._debug('determinePath', path);
return path;
},
// Custom error
_error: function infscr_error(xhr) {
var opts = this.options;
// if behavior is defined and this function is extended, call that instead of default
if (!!opts.behavior && this['_error_'+opts.behavior] !== undefined) {
this['_error_'+opts.behavior].call(this,xhr);
return;
}
if (xhr !== 'destroy' && xhr !== 'end') {
xhr = 'unknown';
}
this._debug('Error', xhr);
if (xhr === 'end' || opts.state.isBeyondMaxPage) {
this._showdonemsg();
}
opts.state.isDone = true;
opts.state.currPage = 1; // if you need to go back to this instance
opts.state.isPaused = false;
opts.state.isBeyondMaxPage = false;
this._binding('unbind');
},
// Load Callback
_loadcallback: function infscr_loadcallback(box, data, url) {
var opts = this.options,
callback = this.options.callback, // GLOBAL OBJECT FOR CALLBACK
result = (opts.state.isDone) ? 'done' : (!opts.appendCallback) ? 'no-append' : 'append',
frag;
// if behavior is defined and this function is extended, call that instead of default
if (!!opts.behavior && this['_loadcallback_'+opts.behavior] !== undefined) {
this['_loadcallback_'+opts.behavior].call(this,box,data);
return;
}
switch (result) {
case 'done':
this._showdonemsg();
return false;
case 'no-append':
if (opts.dataType === 'html') {
data = '