!function(e,n){e.wp=e.wp||{},e.wp.mediaelement=new function(){var e={};return{initialize:function(){(e="undefined"!=typeof _wpmejsSettings?n.extend(!0,{},_wpmejsSettings):e).classPrefix="mejs-",e.success=e.success||function(e){var n,t;e.rendererName&&-1!==e.rendererName.indexOf("flash")&&(n=e.attributes.autoplay&&"false"!==e.attributes.autoplay,t=e.attributes.loop&&"false"!==e.attributes.loop,n&&e.addEventListener("canplay",function(){e.play()},!1),t&&e.addEventListener("ended",function(){e.play()},!1))},e.customError=function(e,n){if(-1!==e.rendererName.indexOf("flash")||-1!==e.rendererName.indexOf("flv"))return''+mejsL10n.strings["mejs.download-file"]+""},n(".wp-audio-shortcode, .wp-video-shortcode").not(".mejs-container").filter(function(){return!n(this).parent().hasClass("mejs-mediaelement")}).mediaelementplayer(e)}}},n(e.wp.mediaelement.initialize)}(window,jQuery);
(function (global, factory){
typeof exports==='object'&&typeof module!=='undefined' ? factory(exports) :
typeof define==='function'&&define.amd ? define(['exports'], factory) :
(global=global||self, factory(global.window=global.window||{}));
}(this, (function (exports){ 'use strict';
function _inheritsLoose(subClass, superClass){
subClass.prototype=Object.create(superClass.prototype);
subClass.prototype.constructor=subClass;
subClass.__proto__=superClass;
}
function _assertThisInitialized(self){
if(self===void 0){
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}
return self;
}
var _config={
autoSleep: 120,
force3D: "auto",
nullTargetWarn: 1,
units: {
lineHeight: ""
}},
_defaults={
duration: .5,
overwrite: false,
delay: 0
},
_suppressOverwrites,
_bigNum=1e8,
_tinyNum=1 / _bigNum,
_2PI=Math.PI * 2,
_HALF_PI=_2PI / 4,
_gsID=0,
_sqrt=Math.sqrt,
_cos=Math.cos,
_sin=Math.sin,
_isString=function _isString(value){
return typeof value==="string";
},
_isFunction=function _isFunction(value){
return typeof value==="function";
},
_isNumber=function _isNumber(value){
return typeof value==="number";
},
_isUndefined=function _isUndefined(value){
return typeof value==="undefined";
},
_isObject=function _isObject(value){
return typeof value==="object";
},
_isNotFalse=function _isNotFalse(value){
return value!==false;
},
_windowExists=function _windowExists(){
return typeof window!=="undefined";
},
_isFuncOrString=function _isFuncOrString(value){
return _isFunction(value)||_isString(value);
},
_isTypedArray=typeof ArrayBuffer==="function"&&ArrayBuffer.isView||function (){},
_isArray=Array.isArray,
_strictNumExp=/(?:-?\.?\d|\.)+/gi,
_numExp=/[-+=.]*\d+[.e\-+]*\d*[e\-+]*\d*/g,
_numWithUnitExp=/[-+=.]*\d+[.e-]*\d*[a-z%]*/g,
_complexStringNumExp=/[-+=.]*\d+\.?\d*(?:e-|e\+)?\d*/gi,
_relExp=/[+-]=-?[.\d]+/,
_delimitedValueExp=/[#\-+.]*\b[a-z\d-=+%.]+/gi,
_unitExp=/[\d.+\-=]+(?:e[-+]\d*)*/i,
_globalTimeline,
_win,
_coreInitted,
_doc,
_globals={},
_installScope={},
_coreReady,
_install=function _install(scope){
return (_installScope=_merge(scope, _globals))&&gsap;
},
_missingPlugin=function _missingPlugin(property, value){
return console.warn("Invalid property", property, "set to", value, "Missing plugin? gsap.registerPlugin()");
},
_warn=function _warn(message, suppress){
return !suppress&&console.warn(message);
},
_addGlobal=function _addGlobal(name, obj){
return name&&(_globals[name]=obj)&&_installScope&&(_installScope[name]=obj)||_globals;
},
_emptyFunc=function _emptyFunc(){
return 0;
},
_reservedProps={},
_lazyTweens=[],
_lazyLookup={},
_lastRenderedFrame,
_plugins={},
_effects={},
_nextGCFrame=30,
_harnessPlugins=[],
_callbackNames="",
_harness=function _harness(targets){
var target=targets[0],
harnessPlugin,
i;
_isObject(target)||_isFunction(target)||(targets=[targets]);
if(!(harnessPlugin=(target._gsap||{}).harness)){
i=_harnessPlugins.length;
while (i--&&!_harnessPlugins[i].targetTest(target)){}
harnessPlugin=_harnessPlugins[i];
}
i=targets.length;
while (i--){
targets[i]&&(targets[i]._gsap||(targets[i]._gsap=new GSCache(targets[i], harnessPlugin)))||targets.splice(i, 1);
}
return targets;
},
_getCache=function _getCache(target){
return target._gsap||_harness(toArray(target))[0]._gsap;
},
_getProperty=function _getProperty(target, property, v){
return (v=target[property])&&_isFunction(v) ? target[property]():_isUndefined(v)&&target.getAttribute&&target.getAttribute(property)||v;
},
_forEachName=function _forEachName(names, func){
return (names=names.split(",")).forEach(func)||names;
},
_round=function _round(value){
return Math.round(value * 100000) / 100000||0;
},
_arrayContainsAny=function _arrayContainsAny(toSearch, toFind){
var l=toFind.length,
i=0;
for (; toSearch.indexOf(toFind[i]) < 0&&++i < l;){}
return i < l;
},
_parseVars=function _parseVars(params, type, parent){
var isLegacy=_isNumber(params[1]),
varsIndex=(isLegacy ? 2:1) + (type < 2 ? 0:1),
vars=params[varsIndex],
irVars;
isLegacy&&(vars.duration=params[1]);
vars.parent=parent;
if(type){
irVars=vars;
while (parent&&!("immediateRender" in irVars)){
irVars=parent.vars.defaults||{};
parent=_isNotFalse(parent.vars.inherit)&&parent.parent;
}
vars.immediateRender=_isNotFalse(irVars.immediateRender);
type < 2 ? vars.runBackwards=1:vars.startAt=params[varsIndex - 1];
}
return vars;
},
_lazyRender=function _lazyRender(){
var l=_lazyTweens.length,
a=_lazyTweens.slice(0),
i,
tween;
_lazyLookup={};
_lazyTweens.length=0;
for (i=0; i < l; i++){
tween=a[i];
tween&&tween._lazy&&(tween.render(tween._lazy[0], tween._lazy[1], true)._lazy=0);
}},
_lazySafeRender=function _lazySafeRender(animation, time, suppressEvents, force){
_lazyTweens.length&&_lazyRender();
animation.render(time, suppressEvents, force);
_lazyTweens.length&&_lazyRender();
},
_numericIfPossible=function _numericIfPossible(value){
var n=parseFloat(value);
return (n||n===0)&&(value + "").match(_delimitedValueExp).length < 2 ? n:_isString(value) ? value.trim():value;
},
_passThrough=function _passThrough(p){
return p;
},
_setDefaults=function _setDefaults(obj, defaults){
for (var p in defaults){
p in obj||(obj[p]=defaults[p]);
}
return obj;
},
_setKeyframeDefaults=function _setKeyframeDefaults(obj, defaults){
for (var p in defaults){
p in obj||p==="duration"||p==="ease"||(obj[p]=defaults[p]);
}},
_merge=function _merge(base, toMerge){
for (var p in toMerge){
base[p]=toMerge[p];
}
return base;
},
_mergeDeep=function _mergeDeep(base, toMerge){
for (var p in toMerge){
p!=="__proto__"&&p!=="constructor"&&p!=="prototype"&&(base[p]=_isObject(toMerge[p]) ? _mergeDeep(base[p]||(base[p]={}), toMerge[p]):toMerge[p]);
}
return base;
},
_copyExcluding=function _copyExcluding(obj, excluding){
var copy={},
p;
for (p in obj){
p in excluding||(copy[p]=obj[p]);
}
return copy;
},
_inheritDefaults=function _inheritDefaults(vars){
var parent=vars.parent||_globalTimeline,
func=vars.keyframes ? _setKeyframeDefaults:_setDefaults;
if(_isNotFalse(vars.inherit)){
while (parent){
func(vars, parent.vars.defaults);
parent=parent.parent||parent._dp;
}}
return vars;
},
_arraysMatch=function _arraysMatch(a1, a2){
var i=a1.length,
match=i===a2.length;
while (match&&i--&&a1[i]===a2[i]){}
return i < 0;
},
_addLinkedListItem=function _addLinkedListItem(parent, child, firstProp, lastProp, sortBy){
if(firstProp===void 0){
firstProp="_first";
}
if(lastProp===void 0){
lastProp="_last";
}
var prev=parent[lastProp],
t;
if(sortBy){
t=child[sortBy];
while (prev&&prev[sortBy] > t){
prev=prev._prev;
}}
if(prev){
child._next=prev._next;
prev._next=child;
}else{
child._next=parent[firstProp];
parent[firstProp]=child;
}
if(child._next){
child._next._prev=child;
}else{
parent[lastProp]=child;
}
child._prev=prev;
child.parent=child._dp=parent;
return child;
},
_removeLinkedListItem=function _removeLinkedListItem(parent, child, firstProp, lastProp){
if(firstProp===void 0){
firstProp="_first";
}
if(lastProp===void 0){
lastProp="_last";
}
var prev=child._prev,
next=child._next;
if(prev){
prev._next=next;
}else if(parent[firstProp]===child){
parent[firstProp]=next;
}
if(next){
next._prev=prev;
}else if(parent[lastProp]===child){
parent[lastProp]=prev;
}
child._next=child._prev=child.parent=null;
},
_removeFromParent=function _removeFromParent(child, onlyIfParentHasAutoRemove){
child.parent&&(!onlyIfParentHasAutoRemove||child.parent.autoRemoveChildren)&&child.parent.remove(child);
child._act=0;
},
_uncache=function _uncache(animation, child){
if(animation&&(!child||child._end > animation._dur||child._start < 0)){
var a=animation;
while (a){
a._dirty=1;
a=a.parent;
}}
return animation;
},
_recacheAncestors=function _recacheAncestors(animation){
var parent=animation.parent;
while (parent&&parent.parent){
parent._dirty=1;
parent.totalDuration();
parent=parent.parent;
}
return animation;
},
_hasNoPausedAncestors=function _hasNoPausedAncestors(animation){
return !animation||animation._ts&&_hasNoPausedAncestors(animation.parent);
},
_elapsedCycleDuration=function _elapsedCycleDuration(animation){
return animation._repeat ? _animationCycle(animation._tTime, animation=animation.duration() + animation._rDelay) * animation:0;
},
_animationCycle=function _animationCycle(tTime, cycleDuration){
var whole=Math.floor(tTime /=cycleDuration);
return tTime&&whole===tTime ? whole - 1:whole;
},
_parentToChildTotalTime=function _parentToChildTotalTime(parentTime, child){
return (parentTime - child._start) * child._ts + (child._ts >=0 ? 0:child._dirty ? child.totalDuration():child._tDur);
},
_setEnd=function _setEnd(animation){
return animation._end=_round(animation._start + (animation._tDur / Math.abs(animation._ts||animation._rts||_tinyNum)||0));
},
_alignPlayhead=function _alignPlayhead(animation, totalTime){
var parent=animation._dp;
if(parent&&parent.smoothChildTiming&&animation._ts){
animation._start=_round(parent._time - (animation._ts > 0 ? totalTime / animation._ts:((animation._dirty ? animation.totalDuration():animation._tDur) - totalTime) / -animation._ts));
_setEnd(animation);
parent._dirty||_uncache(parent, animation);
}
return animation;
},
_postAddChecks=function _postAddChecks(timeline, child){
var t;
if(child._time||child._initted&&!child._dur){
t=_parentToChildTotalTime(timeline.rawTime(), child);
if(!child._dur||_clamp(0, child.totalDuration(), t) - child._tTime > _tinyNum){
child.render(t, true);
}}
if(_uncache(timeline, child)._dp&&timeline._initted&&timeline._time >=timeline._dur&&timeline._ts){
if(timeline._dur < timeline.duration()){
t=timeline;
while (t._dp){
t.rawTime() >=0&&t.totalTime(t._tTime);
t=t._dp;
}}
timeline._zTime=-_tinyNum;
}},
_addToTimeline=function _addToTimeline(timeline, child, position, skipChecks){
child.parent&&_removeFromParent(child);
child._start=_round(position + child._delay);
child._end=_round(child._start + (child.totalDuration() / Math.abs(child.timeScale())||0));
_addLinkedListItem(timeline, child, "_first", "_last", timeline._sort ? "_start":0);
timeline._recent=child;
skipChecks||_postAddChecks(timeline, child);
return timeline;
},
_scrollTrigger=function _scrollTrigger(animation, trigger){
return (_globals.ScrollTrigger||_missingPlugin("scrollTrigger", trigger))&&_globals.ScrollTrigger.create(trigger, animation);
},
_attemptInitTween=function _attemptInitTween(tween, totalTime, force, suppressEvents){
_initTween(tween, totalTime);
if(!tween._initted){
return 1;
}
if(!force&&tween._pt&&(tween._dur&&tween.vars.lazy!==false||!tween._dur&&tween.vars.lazy)&&_lastRenderedFrame!==_ticker.frame){
_lazyTweens.push(tween);
tween._lazy=[totalTime, suppressEvents];
return 1;
}},
_parentPlayheadIsBeforeStart=function _parentPlayheadIsBeforeStart(_ref){
var parent=_ref.parent;
return parent&&parent._ts&&parent._initted&&!parent._lock&&(parent.rawTime() < 0||_parentPlayheadIsBeforeStart(parent));
},
_renderZeroDurationTween=function _renderZeroDurationTween(tween, totalTime, suppressEvents, force){
var prevRatio=tween.ratio,
ratio=totalTime < 0||!totalTime&&(!tween._start&&_parentPlayheadIsBeforeStart(tween)||(tween._ts < 0||tween._dp._ts < 0)&&tween.data!=="isFromStart"&&tween.data!=="isStart") ? 0:1,
repeatDelay=tween._rDelay,
tTime=0,
pt,
iteration,
prevIteration;
if(repeatDelay&&tween._repeat){
tTime=_clamp(0, tween._tDur, totalTime);
iteration=_animationCycle(tTime, repeatDelay);
prevIteration=_animationCycle(tween._tTime, repeatDelay);
tween._yoyo&&iteration & 1&&(ratio=1 - ratio);
if(iteration!==prevIteration){
prevRatio=1 - ratio;
tween.vars.repeatRefresh&&tween._initted&&tween.invalidate();
}}
if(ratio!==prevRatio||force||tween._zTime===_tinyNum||!totalTime&&tween._zTime){
if(!tween._initted&&_attemptInitTween(tween, totalTime, force, suppressEvents)){
return;
}
prevIteration=tween._zTime;
tween._zTime=totalTime||(suppressEvents ? _tinyNum:0);
suppressEvents||(suppressEvents=totalTime&&!prevIteration);
tween.ratio=ratio;
tween._from&&(ratio=1 - ratio);
tween._time=0;
tween._tTime=tTime;
pt=tween._pt;
while (pt){
pt.r(ratio, pt.d);
pt=pt._next;
}
tween._startAt&&totalTime < 0&&tween._startAt.render(totalTime, true, true);
tween._onUpdate&&!suppressEvents&&_callback(tween, "onUpdate");
tTime&&tween._repeat&&!suppressEvents&&tween.parent&&_callback(tween, "onRepeat");
if((totalTime >=tween._tDur||totalTime < 0)&&tween.ratio===ratio){
ratio&&_removeFromParent(tween, 1);
if(!suppressEvents){
_callback(tween, ratio ? "onComplete":"onReverseComplete", true);
tween._prom&&tween._prom();
}}
}else if(!tween._zTime){
tween._zTime=totalTime;
}},
_findNextPauseTween=function _findNextPauseTween(animation, prevTime, time){
var child;
if(time > prevTime){
child=animation._first;
while (child&&child._start <=time){
if(!child._dur&&child.data==="isPause"&&child._start > prevTime){
return child;
}
child=child._next;
}}else{
child=animation._last;
while (child&&child._start >=time){
if(!child._dur&&child.data==="isPause"&&child._start < prevTime){
return child;
}
child=child._prev;
}}
},
_setDuration=function _setDuration(animation, duration, skipUncache, leavePlayhead){
var repeat=animation._repeat,
dur=_round(duration)||0,
totalProgress=animation._tTime / animation._tDur;
totalProgress&&!leavePlayhead&&(animation._time *=dur / animation._dur);
animation._dur=dur;
animation._tDur = !repeat ? dur:repeat < 0 ? 1e10:_round(dur * (repeat + 1) + animation._rDelay * repeat);
totalProgress&&!leavePlayhead ? _alignPlayhead(animation, animation._tTime=animation._tDur * totalProgress):animation.parent&&_setEnd(animation);
skipUncache||_uncache(animation.parent, animation);
return animation;
},
_onUpdateTotalDuration=function _onUpdateTotalDuration(animation){
return animation instanceof Timeline ? _uncache(animation):_setDuration(animation, animation._dur);
},
_zeroPosition={
_start: 0,
endTime: _emptyFunc
},
_parsePosition=function _parsePosition(animation, position){
var labels=animation.labels,
recent=animation._recent||_zeroPosition,
clippedDuration=animation.duration() >=_bigNum ? recent.endTime(false):animation._dur,
i,
offset;
if(_isString(position)&&(isNaN(position)||position in labels)){
i=position.charAt(0);
if(i==="<"||i===">"){
return (i==="<" ? recent._start:recent.endTime(recent._repeat >=0)) + (parseFloat(position.substr(1))||0);
}
i=position.indexOf("=");
if(i < 0){
position in labels||(labels[position]=clippedDuration);
return labels[position];
}
offset=+(position.charAt(i - 1) + position.substr(i + 1));
return i > 1 ? _parsePosition(animation, position.substr(0, i - 1)) + offset:clippedDuration + offset;
}
return position==null ? clippedDuration:+position;
},
_conditionalReturn=function _conditionalReturn(value, func){
return value||value===0 ? func(value):func;
},
_clamp=function _clamp(min, max, value){
return value < min ? min:value > max ? max:value;
},
getUnit=function getUnit(value){
if(typeof value!=="string"){
return "";
}
var v=_unitExp.exec(value);
return v ? value.substr(v.index + v[0].length):"";
},
clamp=function clamp(min, max, value){
return _conditionalReturn(value, function (v){
return _clamp(min, max, v);
});
},
_slice=[].slice,
_isArrayLike=function _isArrayLike(value, nonEmpty){
return value&&_isObject(value)&&"length" in value&&(!nonEmpty&&!value.length||value.length - 1 in value&&_isObject(value[0]))&&!value.nodeType&&value!==_win;
},
_flatten=function _flatten(ar, leaveStrings, accumulator){
if(accumulator===void 0){
accumulator=[];
}
return ar.forEach(function (value){
var _accumulator;
return _isString(value)&&!leaveStrings||_isArrayLike(value, 1) ? (_accumulator=accumulator).push.apply(_accumulator, toArray(value)):accumulator.push(value);
})||accumulator;
},
toArray=function toArray(value, leaveStrings){
return _isString(value)&&!leaveStrings&&(_coreInitted||!_wake()) ? _slice.call(_doc.querySelectorAll(value), 0):_isArray(value) ? _flatten(value, leaveStrings):_isArrayLike(value) ? _slice.call(value, 0):value ? [value]:[];
},
shuffle=function shuffle(a){
return a.sort(function (){
return .5 - Math.random();
});
},
distribute=function distribute(v){
if(_isFunction(v)){
return v;
}
var vars=_isObject(v) ? v:{
each: v
},
ease=_parseEase(vars.ease),
from=vars.from||0,
base=parseFloat(vars.base)||0,
cache={},
isDecimal=from > 0&&from < 1,
ratios=isNaN(from)||isDecimal,
axis=vars.axis,
ratioX=from,
ratioY=from;
if(_isString(from)){
ratioX=ratioY={
center: .5,
edges: .5,
end: 1
}[from]||0;
}else if(!isDecimal&&ratios){
ratioX=from[0];
ratioY=from[1];
}
return function (i, target, a){
var l=(a||vars).length,
distances=cache[l],
originX,
originY,
x,
y,
d,
j,
max,
min,
wrapAt;
if(!distances){
wrapAt=vars.grid==="auto" ? 0:(vars.grid||[1, _bigNum])[1];
if(!wrapAt){
max=-_bigNum;
while (max < (max=a[wrapAt++].getBoundingClientRect().left)&&wrapAt < l){}
wrapAt--;
}
distances=cache[l]=[];
originX=ratios ? Math.min(wrapAt, l) * ratioX - .5:from % wrapAt;
originY=ratios ? l * ratioY / wrapAt - .5:from / wrapAt | 0;
max=0;
min=_bigNum;
for (j=0; j < l; j++){
x=j % wrapAt - originX;
y=originY - (j / wrapAt | 0);
distances[j]=d = !axis ? _sqrt(x * x + y * y):Math.abs(axis==="y" ? y:x);
d > max&&(max=d);
d < min&&(min=d);
}
from==="random"&&shuffle(distances);
distances.max=max - min;
distances.min=min;
distances.v=l = (parseFloat(vars.amount)||parseFloat(vars.each) * (wrapAt > l ? l - 1:!axis ? Math.max(wrapAt, l / wrapAt):axis==="y" ? l / wrapAt:wrapAt)||0) * (from==="edges" ? -1:1);
distances.b=l < 0 ? base - l:base;
distances.u=getUnit(vars.amount||vars.each)||0;
ease=ease&&l < 0 ? _invertEase(ease):ease;
}
l=(distances[i] - distances.min) / distances.max||0;
return _round(distances.b + (ease ? ease(l):l) * distances.v) + distances.u;
};},
_roundModifier=function _roundModifier(v){
var p=v < 1 ? Math.pow(10, (v + "").length - 2):1;
return function (raw){
var n=Math.round(parseFloat(raw) / v) * v * p;
return (n - n % 1) / p + (_isNumber(raw) ? 0:getUnit(raw));
};},
snap=function snap(snapTo, value){
var isArray=_isArray(snapTo),
radius,
is2D;
if(!isArray&&_isObject(snapTo)){
radius=isArray=snapTo.radius||_bigNum;
if(snapTo.values){
snapTo=toArray(snapTo.values);
if(is2D = !_isNumber(snapTo[0])){
radius *=radius;
}}else{
snapTo=_roundModifier(snapTo.increment);
}}
return _conditionalReturn(value, !isArray ? _roundModifier(snapTo):_isFunction(snapTo) ? function (raw){
is2D=snapTo(raw);
return Math.abs(is2D - raw) <=radius ? is2D:raw;
}:function (raw){
var x=parseFloat(is2D ? raw.x:raw),
y=parseFloat(is2D ? raw.y:0),
min=_bigNum,
closest=0,
i=snapTo.length,
dx,
dy;
while (i--){
if(is2D){
dx=snapTo[i].x - x;
dy=snapTo[i].y - y;
dx=dx * dx + dy * dy;
}else{
dx=Math.abs(snapTo[i] - x);
}
if(dx < min){
min=dx;
closest=i;
}}
closest = !radius||min <=radius ? snapTo[closest]:raw;
return is2D||closest===raw||_isNumber(raw) ? closest:closest + getUnit(raw);
});
},
random=function random(min, max, roundingIncrement, returnFunction){
return _conditionalReturn(_isArray(min) ? !max:roundingIncrement===true ? !!(roundingIncrement=0):!returnFunction, function (){
return _isArray(min) ? min[~~(Math.random() * min.length)]:(roundingIncrement=roundingIncrement||1e-5)&&(returnFunction=roundingIncrement < 1 ? Math.pow(10, (roundingIncrement + "").length - 2):1)&&Math.floor(Math.round((min - roundingIncrement / 2 + Math.random() * (max - min + roundingIncrement * .99)) / roundingIncrement) * roundingIncrement * returnFunction) / returnFunction;
});
},
pipe=function pipe(){
for (var _len=arguments.length, functions=new Array(_len), _key=0; _key < _len; _key++){
functions[_key]=arguments[_key];
}
return function (value){
return functions.reduce(function (v, f){
return f(v);
}, value);
};},
unitize=function unitize(func, unit){
return function (value){
return func(parseFloat(value)) + (unit||getUnit(value));
};},
normalize=function normalize(min, max, value){
return mapRange(min, max, 0, 1, value);
},
_wrapArray=function _wrapArray(a, wrapper, value){
return _conditionalReturn(value, function (index){
return a[~~wrapper(index)];
});
},
wrap=function wrap(min, max, value){
var range=max - min;
return _isArray(min) ? _wrapArray(min, wrap(0, min.length), max):_conditionalReturn(value, function (value){
return (range + (value - min) % range) % range + min;
});
},
wrapYoyo=function wrapYoyo(min, max, value){
var range=max - min,
total=range * 2;
return _isArray(min) ? _wrapArray(min, wrapYoyo(0, min.length - 1), max):_conditionalReturn(value, function (value){
value=(total + (value - min) % total) % total||0;
return min + (value > range ? total - value:value);
});
},
_replaceRandom=function _replaceRandom(value){
var prev=0,
s="",
i,
nums,
end,
isArray;
while (~(i=value.indexOf("random(", prev))){
end=value.indexOf(")", i);
isArray=value.charAt(i + 7)==="[";
nums=value.substr(i + 7, end - i - 7).match(isArray ? _delimitedValueExp:_strictNumExp);
s +=value.substr(prev, i - prev) + random(isArray ? nums:+nums[0], isArray ? 0:+nums[1], +nums[2]||1e-5);
prev=end + 1;
}
return s + value.substr(prev, value.length - prev);
},
mapRange=function mapRange(inMin, inMax, outMin, outMax, value){
var inRange=inMax - inMin,
outRange=outMax - outMin;
return _conditionalReturn(value, function (value){
return outMin + ((value - inMin) / inRange * outRange||0);
});
},
interpolate=function interpolate(start, end, progress, mutate){
var func=isNaN(start + end) ? 0:function (p){
return (1 - p) * start + p * end;
};
if(!func){
var isString=_isString(start),
master={},
p,
i,
interpolators,
l,
il;
progress===true&&(mutate=1)&&(progress=null);
if(isString){
start={
p: start
};
end={
p: end
};}else if(_isArray(start)&&!_isArray(end)){
interpolators=[];
l=start.length;
il=l - 2;
for (i=1; i < l; i++){
interpolators.push(interpolate(start[i - 1], start[i]));
}
l--;
func=function func(p){
p *=l;
var i=Math.min(il, ~~p);
return interpolators[i](p - i);
};
progress=end;
}else if(!mutate){
start=_merge(_isArray(start) ? []:{}, start);
}
if(!interpolators){
for (p in end){
_addPropTween.call(master, start, p, "get", end[p]);
}
func=function func(p){
return _renderPropTweens(p, master)||(isString ? start.p:start);
};}}
return _conditionalReturn(progress, func);
},
_getLabelInDirection=function _getLabelInDirection(timeline, fromTime, backward){
var labels=timeline.labels,
min=_bigNum,
p,
distance,
label;
for (p in labels){
distance=labels[p] - fromTime;
if(distance < 0===!!backward&&distance&&min > (distance=Math.abs(distance))){
label=p;
min=distance;
}}
return label;
},
_callback=function _callback(animation, type, executeLazyFirst){
var v=animation.vars,
callback=v[type],
params,
scope;
if(!callback){
return;
}
params=v[type + "Params"];
scope=v.callbackScope||animation;
executeLazyFirst&&_lazyTweens.length&&_lazyRender();
return params ? callback.apply(scope, params):callback.call(scope);
},
_interrupt=function _interrupt(animation){
_removeFromParent(animation);
animation.scrollTrigger&&animation.scrollTrigger.kill(false);
animation.progress() < 1&&_callback(animation, "onInterrupt");
return animation;
},
_quickTween,
_createPlugin=function _createPlugin(config){
config = !config.name&&config["default"]||config;
var name=config.name,
isFunc=_isFunction(config),
Plugin=name&&!isFunc&&config.init ? function (){
this._props=[];
}:config,
instanceDefaults={
init: _emptyFunc,
render: _renderPropTweens,
add: _addPropTween,
kill: _killPropTweensOf,
modifier: _addPluginModifier,
rawVars: 0
},
statics={
targetTest: 0,
get: 0,
getSetter: _getSetter,
aliases: {},
register: 0
};
_wake();
if(config!==Plugin){
if(_plugins[name]){
return;
}
_setDefaults(Plugin, _setDefaults(_copyExcluding(config, instanceDefaults), statics));
_merge(Plugin.prototype, _merge(instanceDefaults, _copyExcluding(config, statics)));
_plugins[Plugin.prop=name]=Plugin;
if(config.targetTest){
_harnessPlugins.push(Plugin);
_reservedProps[name]=1;
}
name=(name==="css" ? "CSS":name.charAt(0).toUpperCase() + name.substr(1)) + "Plugin";
}
_addGlobal(name, Plugin);
config.register&&config.register(gsap, Plugin, PropTween);
},
_255=255,
_colorLookup={
aqua: [0, _255, _255],
lime: [0, _255, 0],
silver: [192, 192, 192],
black: [0, 0, 0],
maroon: [128, 0, 0],
teal: [0, 128, 128],
blue: [0, 0, _255],
navy: [0, 0, 128],
white: [_255, _255, _255],
olive: [128, 128, 0],
yellow: [_255, _255, 0],
orange: [_255, 165, 0],
gray: [128, 128, 128],
purple: [128, 0, 128],
green: [0, 128, 0],
red: [_255, 0, 0],
pink: [_255, 192, 203],
cyan: [0, _255, _255],
transparent: [_255, _255, _255, 0]
},
_hue=function _hue(h, m1, m2){
h=h < 0 ? h + 1:h > 1 ? h - 1:h;
return (h * 6 < 1 ? m1 + (m2 - m1) * h * 6:h < .5 ? m2:h * 3 < 2 ? m1 + (m2 - m1) * (2 / 3 - h) * 6:m1) * _255 + .5 | 0;
},
splitColor=function splitColor(v, toHSL, forceAlpha){
var a = !v ? _colorLookup.black:_isNumber(v) ? [v >> 16, v >> 8 & _255, v & _255]:0,
r,
g,
b,
h,
s,
l,
max,
min,
d,
wasHSL;
if(!a){
if(v.substr(-1)===","){
v=v.substr(0, v.length - 1);
}
if(_colorLookup[v]){
a=_colorLookup[v];
}else if(v.charAt(0)==="#"){
if(v.length < 6){
r=v.charAt(1);
g=v.charAt(2);
b=v.charAt(3);
v="#" + r + r + g + g + b + b + (v.length===5 ? v.charAt(4) + v.charAt(4):"");
}
if(v.length===9){
a=parseInt(v.substr(1, 6), 16);
return [a >> 16, a >> 8 & _255, a & _255, parseInt(v.substr(7), 16) / 255];
}
v=parseInt(v.substr(1), 16);
a=[v >> 16, v >> 8 & _255, v & _255];
}else if(v.substr(0, 3)==="hsl"){
a=wasHSL=v.match(_strictNumExp);
if(!toHSL){
h=+a[0] % 360 / 360;
s=+a[1] / 100;
l=+a[2] / 100;
g=l <=.5 ? l * (s + 1):l + s - l * s;
r=l * 2 - g;
a.length > 3&&(a[3] *=1);
a[0]=_hue(h + 1 / 3, r, g);
a[1]=_hue(h, r, g);
a[2]=_hue(h - 1 / 3, r, g);
}else if(~v.indexOf("=")){
a=v.match(_numExp);
forceAlpha&&a.length < 4&&(a[3]=1);
return a;
}}else{
a=v.match(_strictNumExp)||_colorLookup.transparent;
}
a=a.map(Number);
}
if(toHSL&&!wasHSL){
r=a[0] / _255;
g=a[1] / _255;
b=a[2] / _255;
max=Math.max(r, g, b);
min=Math.min(r, g, b);
l=(max + min) / 2;
if(max===min){
h=s = 0;
}else{
d=max - min;
s=l > 0.5 ? d / (2 - max - min):d / (max + min);
h=max===r ? (g - b) / d + (g < b ? 6:0):max===g ? (b - r) / d + 2:(r - g) / d + 4;
h *=60;
}
a[0]=~~(h + .5);
a[1]=~~(s * 100 + .5);
a[2]=~~(l * 100 + .5);
}
forceAlpha&&a.length < 4&&(a[3]=1);
return a;
},
_colorOrderData=function _colorOrderData(v){
var values=[],
c=[],
i=-1;
v.split(_colorExp).forEach(function (v){
var a=v.match(_numWithUnitExp)||[];
values.push.apply(values, a);
c.push(i +=a.length + 1);
});
values.c=c;
return values;
},
_formatColors=function _formatColors(s, toHSL, orderMatchData){
var result="",
colors=(s + result).match(_colorExp),
type=toHSL ? "hsla(":"rgba(",
i=0,
c,
shell,
d,
l;
if(!colors){
return s;
}
colors=colors.map(function (color){
return (color=splitColor(color, toHSL, 1))&&type + (toHSL ? color[0] + "," + color[1] + "%," + color[2] + "%," + color[3]:color.join(",")) + ")";
});
if(orderMatchData){
d=_colorOrderData(s);
c=orderMatchData.c;
if(c.join(result)!==d.c.join(result)){
shell=s.replace(_colorExp, "1").split(_numWithUnitExp);
l=shell.length - 1;
for (; i < l; i++){
result +=shell[i] + (~c.indexOf(i) ? colors.shift()||type + "0,0,0,0)":(d.length ? d:colors.length ? colors:orderMatchData).shift());
}}
}
if(!shell){
shell=s.split(_colorExp);
l=shell.length - 1;
for (; i < l; i++){
result +=shell[i] + colors[i];
}}
return result + shell[l];
},
_colorExp=function (){
var s="(?:\\b(?:(?:rgb|rgba|hsl|hsla)\\(.+?\\))|\\B#(?:[0-9a-f]{3,4}){1,2}\\b",
p;
for (p in _colorLookup){
s +="|" + p + "\\b";
}
return new RegExp(s + ")", "gi");
}(),
_hslExp=/hsl[a]?\(/,
_colorStringFilter=function _colorStringFilter(a){
var combined=a.join(" "),
toHSL;
_colorExp.lastIndex=0;
if(_colorExp.test(combined)){
toHSL=_hslExp.test(combined);
a[1]=_formatColors(a[1], toHSL);
a[0]=_formatColors(a[0], toHSL, _colorOrderData(a[1]));
return true;
}},
_tickerActive,
_ticker=function (){
var _getTime=Date.now,
_lagThreshold=500,
_adjustedLag=33,
_startTime=_getTime(),
_lastUpdate=_startTime,
_gap=1000 / 240,
_nextTime=_gap,
_listeners=[],
_id,
_req,
_raf,
_self,
_delta,
_i,
_tick=function _tick(v){
var elapsed=_getTime() - _lastUpdate,
manual=v===true,
overlap,
dispatch,
time,
frame;
elapsed > _lagThreshold&&(_startTime +=elapsed - _adjustedLag);
_lastUpdate +=elapsed;
time=_lastUpdate - _startTime;
overlap=time - _nextTime;
if(overlap > 0||manual){
frame=++_self.frame;
_delta=time - _self.time * 1000;
_self.time=time=time / 1000;
_nextTime +=overlap + (overlap >=_gap ? 4:_gap - overlap);
dispatch=1;
}
manual||(_id=_req(_tick));
if(dispatch){
for (_i=0; _i < _listeners.length; _i++){
_listeners[_i](time, _delta, frame, v);
}}
};
_self={
time: 0,
frame: 0,
tick: function tick(){
_tick(true);
},
deltaRatio: function deltaRatio(fps){
return _delta / (1000 / (fps||60));
},
wake: function wake(){
if(_coreReady){
if(!_coreInitted&&_windowExists()){
_win=_coreInitted=window;
_doc=_win.document||{};
_globals.gsap=gsap;
(_win.gsapVersions||(_win.gsapVersions=[])).push(gsap.version);
_install(_installScope||_win.GreenSockGlobals||!_win.gsap&&_win||{});
_raf=_win.requestAnimationFrame;
}
_id&&_self.sleep();
_req=_raf||function (f){
return setTimeout(f, _nextTime - _self.time * 1000 + 1 | 0);
};
_tickerActive=1;
_tick(2);
}},
sleep: function sleep(){
(_raf ? _win.cancelAnimationFrame:clearTimeout)(_id);
_tickerActive=0;
_req=_emptyFunc;
},
lagSmoothing: function lagSmoothing(threshold, adjustedLag){
_lagThreshold=threshold||1 / _tinyNum;
_adjustedLag=Math.min(adjustedLag, _lagThreshold, 0);
},
fps: function fps(_fps){
_gap=1000 / (_fps||240);
_nextTime=_self.time * 1000 + _gap;
},
add: function add(callback){
_listeners.indexOf(callback) < 0&&_listeners.push(callback);
_wake();
},
remove: function remove(callback){
var i;
~(i=_listeners.indexOf(callback))&&_listeners.splice(i, 1)&&_i >=i&&_i--;
},
_listeners: _listeners
};
return _self;
}(),
_wake=function _wake(){
return !_tickerActive&&_ticker.wake();
},
_easeMap={},
_customEaseExp=/^[\d.\-M][\d.\-,\s]/,
_quotesExp=/["']/g,
_parseObjectInString=function _parseObjectInString(value){
var obj={},
split=value.substr(1, value.length - 3).split(":"),
key=split[0],
i=1,
l=split.length,
index,
val,
parsedVal;
for (; i < l; i++){
val=split[i];
index=i!==l - 1 ? val.lastIndexOf(","):val.length;
parsedVal=val.substr(0, index);
obj[key]=isNaN(parsedVal) ? parsedVal.replace(_quotesExp, "").trim():+parsedVal;
key=val.substr(index + 1).trim();
}
return obj;
},
_valueInParentheses=function _valueInParentheses(value){
var open=value.indexOf("(") + 1,
close=value.indexOf(")"),
nested=value.indexOf("(", open);
return value.substring(open, ~nested&&nested < close ? value.indexOf(")", close + 1):close);
},
_configEaseFromString=function _configEaseFromString(name){
var split=(name + "").split("("),
ease=_easeMap[split[0]];
return ease&&split.length > 1&&ease.config ? ease.config.apply(null, ~name.indexOf("{") ? [_parseObjectInString(split[1])]:_valueInParentheses(name).split(",").map(_numericIfPossible)):_easeMap._CE&&_customEaseExp.test(name) ? _easeMap._CE("", name):ease;
},
_invertEase=function _invertEase(ease){
return function (p){
return 1 - ease(1 - p);
};},
_propagateYoyoEase=function _propagateYoyoEase(timeline, isYoyo){
var child=timeline._first,
ease;
while (child){
if(child instanceof Timeline){
_propagateYoyoEase(child, isYoyo);
}else if(child.vars.yoyoEase&&(!child._yoyo||!child._repeat)&&child._yoyo!==isYoyo){
if(child.timeline){
_propagateYoyoEase(child.timeline, isYoyo);
}else{
ease=child._ease;
child._ease=child._yEase;
child._yEase=ease;
child._yoyo=isYoyo;
}}
child=child._next;
}},
_parseEase=function _parseEase(ease, defaultEase){
return !ease ? defaultEase:(_isFunction(ease) ? ease:_easeMap[ease]||_configEaseFromString(ease))||defaultEase;
},
_insertEase=function _insertEase(names, easeIn, easeOut, easeInOut){
if(easeOut===void 0){
easeOut=function easeOut(p){
return 1 - easeIn(1 - p);
};}
if(easeInOut===void 0){
easeInOut=function easeInOut(p){
return p < .5 ? easeIn(p * 2) / 2:1 - easeIn((1 - p) * 2) / 2;
};}
var ease={
easeIn: easeIn,
easeOut: easeOut,
easeInOut: easeInOut
},
lowercaseName;
_forEachName(names, function (name){
_easeMap[name]=_globals[name]=ease;
_easeMap[lowercaseName=name.toLowerCase()]=easeOut;
for (var p in ease){
_easeMap[lowercaseName + (p==="easeIn" ? ".in":p==="easeOut" ? ".out":".inOut")]=_easeMap[name + "." + p]=ease[p];
}});
return ease;
},
_easeInOutFromOut=function _easeInOutFromOut(easeOut){
return function (p){
return p < .5 ? (1 - easeOut(1 - p * 2)) / 2 : .5 + easeOut((p - .5) * 2) / 2;
};},
_configElastic=function _configElastic(type, amplitude, period){
var p1=amplitude >=1 ? amplitude:1,
p2=(period||(type ? .3 : .45)) / (amplitude < 1 ? amplitude:1),
p3=p2 / _2PI * (Math.asin(1 / p1)||0),
easeOut=function easeOut(p){
return p===1 ? 1:p1 * Math.pow(2, -10 * p) * _sin((p - p3) * p2) + 1;
},
ease=type==="out" ? easeOut:type==="in" ? function (p){
return 1 - easeOut(1 - p);
}:_easeInOutFromOut(easeOut);
p2=_2PI / p2;
ease.config=function (amplitude, period){
return _configElastic(type, amplitude, period);
};
return ease;
},
_configBack=function _configBack(type, overshoot){
if(overshoot===void 0){
overshoot=1.70158;
}
var easeOut=function easeOut(p){
return p ? --p * p * ((overshoot + 1) * p + overshoot) + 1:0;
},
ease=type==="out" ? easeOut:type==="in" ? function (p){
return 1 - easeOut(1 - p);
}:_easeInOutFromOut(easeOut);
ease.config=function (overshoot){
return _configBack(type, overshoot);
};
return ease;
};
_forEachName("Linear,Quad,Cubic,Quart,Quint,Strong", function (name, i){
var power=i < 5 ? i + 1:i;
_insertEase(name + ",Power" + (power - 1), i ? function (p){
return Math.pow(p, power);
}:function (p){
return p;
}, function (p){
return 1 - Math.pow(1 - p, power);
}, function (p){
return p < .5 ? Math.pow(p * 2, power) / 2:1 - Math.pow((1 - p) * 2, power) / 2;
});
});
_easeMap.Linear.easeNone=_easeMap.none=_easeMap.Linear.easeIn;
_insertEase("Elastic", _configElastic("in"), _configElastic("out"), _configElastic());
(function (n, c){
var n1=1 / c,
n2=2 * n1,
n3=2.5 * n1,
easeOut=function easeOut(p){
return p < n1 ? n * p * p:p < n2 ? n * Math.pow(p - 1.5 / c, 2) + .75:p < n3 ? n * (p -=2.25 / c) * p + .9375:n * Math.pow(p - 2.625 / c, 2) + .984375;
};
_insertEase("Bounce", function (p){
return 1 - easeOut(1 - p);
}, easeOut);
})(7.5625, 2.75);
_insertEase("Expo", function (p){
return p ? Math.pow(2, 10 * (p - 1)):0;
});
_insertEase("Circ", function (p){
return -(_sqrt(1 - p * p) - 1);
});
_insertEase("Sine", function (p){
return p===1 ? 1:-_cos(p * _HALF_PI) + 1;
});
_insertEase("Back", _configBack("in"), _configBack("out"), _configBack());
_easeMap.SteppedEase=_easeMap.steps=_globals.SteppedEase={
config: function config(steps, immediateStart){
if(steps===void 0){
steps=1;
}
var p1=1 / steps,
p2=steps + (immediateStart ? 0:1),
p3=immediateStart ? 1:0,
max=1 - _tinyNum;
return function (p){
return ((p2 * _clamp(0, max, p) | 0) + p3) * p1;
};}};
_defaults.ease=_easeMap["quad.out"];
_forEachName("onComplete,onUpdate,onStart,onRepeat,onReverseComplete,onInterrupt", function (name){
return _callbackNames +=name + "," + name + "Params,";
});
var GSCache=function GSCache(target, harness){
this.id=_gsID++;
target._gsap=this;
this.target=target;
this.harness=harness;
this.get=harness ? harness.get:_getProperty;
this.set=harness ? harness.getSetter:_getSetter;
};
var Animation=function (){
function Animation(vars, time){
var parent=vars.parent||_globalTimeline;
this.vars=vars;
this._delay=+vars.delay||0;
if(this._repeat=vars.repeat===Infinity ? -2:vars.repeat||0){
this._rDelay=vars.repeatDelay||0;
this._yoyo = !!vars.yoyo||!!vars.yoyoEase;
}
this._ts=1;
_setDuration(this, +vars.duration, 1, 1);
this.data=vars.data;
_tickerActive||_ticker.wake();
parent&&_addToTimeline(parent, this, time||time===0 ? time:parent._time, 1);
vars.reversed&&this.reverse();
vars.paused&&this.paused(true);
}
var _proto=Animation.prototype;
_proto.delay=function delay(value){
if(value||value===0){
this.parent&&this.parent.smoothChildTiming&&this.startTime(this._start + value - this._delay);
this._delay=value;
return this;
}
return this._delay;
};
_proto.duration=function duration(value){
return arguments.length ? this.totalDuration(this._repeat > 0 ? value + (value + this._rDelay) * this._repeat:value):this.totalDuration()&&this._dur;
};
_proto.totalDuration=function totalDuration(value){
if(!arguments.length){
return this._tDur;
}
this._dirty=0;
return _setDuration(this, this._repeat < 0 ? value:(value - this._repeat * this._rDelay) / (this._repeat + 1));
};
_proto.totalTime=function totalTime(_totalTime, suppressEvents){
_wake();
if(!arguments.length){
return this._tTime;
}
var parent=this._dp;
if(parent&&parent.smoothChildTiming&&this._ts){
_alignPlayhead(this, _totalTime);
!parent._dp||parent.parent||_postAddChecks(parent, this);
while (parent.parent){
if(parent.parent._time!==parent._start + (parent._ts >=0 ? parent._tTime / parent._ts:(parent.totalDuration() - parent._tTime) / -parent._ts)){
parent.totalTime(parent._tTime, true);
}
parent=parent.parent;
}
if(!this.parent&&this._dp.autoRemoveChildren&&(this._ts > 0&&_totalTime < this._tDur||this._ts < 0&&_totalTime > 0||!this._tDur&&!_totalTime)){
_addToTimeline(this._dp, this, this._start - this._delay);
}}
if(this._tTime!==_totalTime||!this._dur&&!suppressEvents||this._initted&&Math.abs(this._zTime)===_tinyNum||!_totalTime&&!this._initted&&(this.add||this._ptLookup)){
this._ts||(this._pTime=_totalTime);
_lazySafeRender(this, _totalTime, suppressEvents);
}
return this;
};
_proto.time=function time(value, suppressEvents){
return arguments.length ? this.totalTime(Math.min(this.totalDuration(), value + _elapsedCycleDuration(this)) % this._dur||(value ? this._dur:0), suppressEvents):this._time;
};
_proto.totalProgress=function totalProgress(value, suppressEvents){
return arguments.length ? this.totalTime(this.totalDuration() * value, suppressEvents):this.totalDuration() ? Math.min(1, this._tTime / this._tDur):this.ratio;
};
_proto.progress=function progress(value, suppressEvents){
return arguments.length ? this.totalTime(this.duration() * (this._yoyo&&!(this.iteration() & 1) ? 1 - value:value) + _elapsedCycleDuration(this), suppressEvents):this.duration() ? Math.min(1, this._time / this._dur):this.ratio;
};
_proto.iteration=function iteration(value, suppressEvents){
var cycleDuration=this.duration() + this._rDelay;
return arguments.length ? this.totalTime(this._time + (value - 1) * cycleDuration, suppressEvents):this._repeat ? _animationCycle(this._tTime, cycleDuration) + 1:1;
};
_proto.timeScale=function timeScale(value){
if(!arguments.length){
return this._rts===-_tinyNum ? 0:this._rts;
}
if(this._rts===value){
return this;
}
var tTime=this.parent&&this._ts ? _parentToChildTotalTime(this.parent._time, this):this._tTime;
this._rts=+value||0;
this._ts=this._ps||value===-_tinyNum ? 0:this._rts;
return _recacheAncestors(this.totalTime(_clamp(-this._delay, this._tDur, tTime), true));
};
_proto.paused=function paused(value){
if(!arguments.length){
return this._ps;
}
if(this._ps!==value){
this._ps=value;
if(value){
this._pTime=this._tTime||Math.max(-this._delay, this.rawTime());
this._ts=this._act=0;
}else{
_wake();
this._ts=this._rts;
this.totalTime(this.parent&&!this.parent.smoothChildTiming ? this.rawTime():this._tTime||this._pTime, this.progress()===1&&(this._tTime -=_tinyNum)&&Math.abs(this._zTime)!==_tinyNum);
}}
return this;
};
_proto.startTime=function startTime(value){
if(arguments.length){
this._start=value;
var parent=this.parent||this._dp;
parent&&(parent._sort||!this.parent)&&_addToTimeline(parent, this, value - this._delay);
return this;
}
return this._start;
};
_proto.endTime=function endTime(includeRepeats){
return this._start + (_isNotFalse(includeRepeats) ? this.totalDuration():this.duration()) / Math.abs(this._ts);
};
_proto.rawTime=function rawTime(wrapRepeats){
var parent=this.parent||this._dp;
return !parent ? this._tTime:wrapRepeats&&(!this._ts||this._repeat&&this._time&&this.totalProgress() < 1) ? this._tTime % (this._dur + this._rDelay):!this._ts ? this._tTime:_parentToChildTotalTime(parent.rawTime(wrapRepeats), this);
};
_proto.globalTime=function globalTime(rawTime){
var animation=this,
time=arguments.length ? rawTime:animation.rawTime();
while (animation){
time=animation._start + time / (animation._ts||1);
animation=animation._dp;
}
return time;
};
_proto.repeat=function repeat(value){
if(arguments.length){
this._repeat=value===Infinity ? -2:value;
return _onUpdateTotalDuration(this);
}
return this._repeat===-2 ? Infinity:this._repeat;
};
_proto.repeatDelay=function repeatDelay(value){
if(arguments.length){
this._rDelay=value;
return _onUpdateTotalDuration(this);
}
return this._rDelay;
};
_proto.yoyo=function yoyo(value){
if(arguments.length){
this._yoyo=value;
return this;
}
return this._yoyo;
};
_proto.seek=function seek(position, suppressEvents){
return this.totalTime(_parsePosition(this, position), _isNotFalse(suppressEvents));
};
_proto.restart=function restart(includeDelay, suppressEvents){
return this.play().totalTime(includeDelay ? -this._delay:0, _isNotFalse(suppressEvents));
};
_proto.play=function play(from, suppressEvents){
from!=null&&this.seek(from, suppressEvents);
return this.reversed(false).paused(false);
};
_proto.reverse=function reverse(from, suppressEvents){
from!=null&&this.seek(from||this.totalDuration(), suppressEvents);
return this.reversed(true).paused(false);
};
_proto.pause=function pause(atTime, suppressEvents){
atTime!=null&&this.seek(atTime, suppressEvents);
return this.paused(true);
};
_proto.resume=function resume(){
return this.paused(false);
};
_proto.reversed=function reversed(value){
if(arguments.length){
!!value!==this.reversed()&&this.timeScale(-this._rts||(value ? -_tinyNum:0));
return this;
}
return this._rts < 0;
};
_proto.invalidate=function invalidate(){
this._initted=this._act=0;
this._zTime=-_tinyNum;
return this;
};
_proto.isActive=function isActive(){
var parent=this.parent||this._dp,
start=this._start,
rawTime;
return !!(!parent||this._ts&&this._initted&&parent.isActive()&&(rawTime=parent.rawTime(true)) >=start&&rawTime < this.endTime(true) - _tinyNum);
};
_proto.eventCallback=function eventCallback(type, callback, params){
var vars=this.vars;
if(arguments.length > 1){
if(!callback){
delete vars[type];
}else{
vars[type]=callback;
params&&(vars[type + "Params"]=params);
type==="onUpdate"&&(this._onUpdate=callback);
}
return this;
}
return vars[type];
};
_proto.then=function then(onFulfilled){
var self=this;
return new Promise(function (resolve){
var f=_isFunction(onFulfilled) ? onFulfilled:_passThrough,
_resolve=function _resolve(){
var _then=self.then;
self.then=null;
_isFunction(f)&&(f=f(self))&&(f.then||f===self)&&(self.then=_then);
resolve(f);
self.then=_then;
};
if(self._initted&&self.totalProgress()===1&&self._ts >=0||!self._tTime&&self._ts < 0){
_resolve();
}else{
self._prom=_resolve;
}});
};
_proto.kill=function kill(){
_interrupt(this);
};
return Animation;
}();
_setDefaults(Animation.prototype, {
_time: 0,
_start: 0,
_end: 0,
_tTime: 0,
_tDur: 0,
_dirty: 0,
_repeat: 0,
_yoyo: false,
parent: null,
_initted: false,
_rDelay: 0,
_ts: 1,
_dp: 0,
ratio: 0,
_zTime: -_tinyNum,
_prom: 0,
_ps: false,
_rts: 1
});
var Timeline=function (_Animation){
_inheritsLoose(Timeline, _Animation);
function Timeline(vars, time){
var _this;
if(vars===void 0){
vars={};}
_this=_Animation.call(this, vars, time)||this;
_this.labels={};
_this.smoothChildTiming = !!vars.smoothChildTiming;
_this.autoRemoveChildren = !!vars.autoRemoveChildren;
_this._sort=_isNotFalse(vars.sortChildren);
_this.parent&&_postAddChecks(_this.parent, _assertThisInitialized(_this));
vars.scrollTrigger&&_scrollTrigger(_assertThisInitialized(_this), vars.scrollTrigger);
return _this;
}
var _proto2=Timeline.prototype;
_proto2.to=function to(targets, vars, position){
new Tween(targets, _parseVars(arguments, 0, this), _parsePosition(this, _isNumber(vars) ? arguments[3]:position));
return this;
};
_proto2.from=function from(targets, vars, position){
new Tween(targets, _parseVars(arguments, 1, this), _parsePosition(this, _isNumber(vars) ? arguments[3]:position));
return this;
};
_proto2.fromTo=function fromTo(targets, fromVars, toVars, position){
new Tween(targets, _parseVars(arguments, 2, this), _parsePosition(this, _isNumber(fromVars) ? arguments[4]:position));
return this;
};
_proto2.set=function set(targets, vars, position){
vars.duration=0;
vars.parent=this;
_inheritDefaults(vars).repeatDelay||(vars.repeat=0);
vars.immediateRender = !!vars.immediateRender;
new Tween(targets, vars, _parsePosition(this, position), 1);
return this;
};
_proto2.call=function call(callback, params, position){
return _addToTimeline(this, Tween.delayedCall(0, callback, params), _parsePosition(this, position));
};
_proto2.staggerTo=function staggerTo(targets, duration, vars, stagger, position, onCompleteAll, onCompleteAllParams){
vars.duration=duration;
vars.stagger=vars.stagger||stagger;
vars.onComplete=onCompleteAll;
vars.onCompleteParams=onCompleteAllParams;
vars.parent=this;
new Tween(targets, vars, _parsePosition(this, position));
return this;
};
_proto2.staggerFrom=function staggerFrom(targets, duration, vars, stagger, position, onCompleteAll, onCompleteAllParams){
vars.runBackwards=1;
_inheritDefaults(vars).immediateRender=_isNotFalse(vars.immediateRender);
return this.staggerTo(targets, duration, vars, stagger, position, onCompleteAll, onCompleteAllParams);
};
_proto2.staggerFromTo=function staggerFromTo(targets, duration, fromVars, toVars, stagger, position, onCompleteAll, onCompleteAllParams){
toVars.startAt=fromVars;
_inheritDefaults(toVars).immediateRender=_isNotFalse(toVars.immediateRender);
return this.staggerTo(targets, duration, toVars, stagger, position, onCompleteAll, onCompleteAllParams);
};
_proto2.render=function render(totalTime, suppressEvents, force){
var prevTime=this._time,
tDur=this._dirty ? this.totalDuration():this._tDur,
dur=this._dur,
tTime=this!==_globalTimeline&&totalTime > tDur - _tinyNum&&totalTime >=0 ? tDur:totalTime < _tinyNum ? 0:totalTime,
crossingStart=this._zTime < 0!==totalTime < 0&&(this._initted||!dur),
time,
child,
next,
iteration,
cycleDuration,
prevPaused,
pauseTween,
timeScale,
prevStart,
prevIteration,
yoyo,
isYoyo;
if(tTime!==this._tTime||force||crossingStart){
if(prevTime!==this._time&&dur){
tTime +=this._time - prevTime;
totalTime +=this._time - prevTime;
}
time=tTime;
prevStart=this._start;
timeScale=this._ts;
prevPaused = !timeScale;
if(crossingStart){
dur||(prevTime=this._zTime);
(totalTime||!suppressEvents)&&(this._zTime=totalTime);
}
if(this._repeat){
yoyo=this._yoyo;
cycleDuration=dur + this._rDelay;
if(this._repeat < -1&&totalTime < 0){
return this.totalTime(cycleDuration * 100 + totalTime, suppressEvents, force);
}
time=_round(tTime % cycleDuration);
if(tTime===tDur){
iteration=this._repeat;
time=dur;
}else{
iteration=~~(tTime / cycleDuration);
if(iteration&&iteration===tTime / cycleDuration){
time=dur;
iteration--;
}
time > dur&&(time=dur);
}
prevIteration=_animationCycle(this._tTime, cycleDuration);
!prevTime&&this._tTime&&prevIteration!==iteration&&(prevIteration=iteration);
if(yoyo&&iteration & 1){
time=dur - time;
isYoyo=1;
}
if(iteration!==prevIteration&&!this._lock){
var rewinding=yoyo&&prevIteration & 1,
doesWrap=rewinding===(yoyo&&iteration & 1);
iteration < prevIteration&&(rewinding = !rewinding);
prevTime=rewinding ? 0:dur;
this._lock=1;
this.render(prevTime||(isYoyo ? 0:_round(iteration * cycleDuration)), suppressEvents, !dur)._lock=0;
!suppressEvents&&this.parent&&_callback(this, "onRepeat");
this.vars.repeatRefresh&&!isYoyo&&(this.invalidate()._lock=1);
if(prevTime&&prevTime!==this._time||prevPaused!==!this._ts||this.vars.onRepeat&&!this.parent&&!this._act){
return this;
}
dur=this._dur;
tDur=this._tDur;
if(doesWrap){
this._lock=2;
prevTime=rewinding ? dur:-0.0001;
this.render(prevTime, true);
}
this._lock=0;
if(!this._ts&&!prevPaused){
return this;
}
_propagateYoyoEase(this, isYoyo);
}}
if(this._hasPause&&!this._forcing&&this._lock < 2){
pauseTween=_findNextPauseTween(this, _round(prevTime), _round(time));
if(pauseTween){
tTime -=time - (time=pauseTween._start);
}}
this._tTime=tTime;
this._time=time;
this._act = !timeScale;
if(!this._initted){
this._onUpdate=this.vars.onUpdate;
this._initted=1;
this._zTime=totalTime;
prevTime=0;
}
!prevTime&&time&&!suppressEvents&&_callback(this, "onStart");
if(time >=prevTime&&totalTime >=0){
child=this._first;
while (child){
next=child._next;
if((child._act||time >=child._start)&&child._ts&&pauseTween!==child){
if(child.parent!==this){
return this.render(totalTime, suppressEvents, force);
}
child.render(child._ts > 0 ? (time - child._start) * child._ts:(child._dirty ? child.totalDuration():child._tDur) + (time - child._start) * child._ts, suppressEvents, force);
if(time!==this._time||!this._ts&&!prevPaused){
pauseTween=0;
next&&(tTime +=this._zTime=-_tinyNum);
break;
}}
child=next;
}}else{
child=this._last;
var adjustedTime=totalTime < 0 ? totalTime:time;
while (child){
next=child._prev;
if((child._act||adjustedTime <=child._end)&&child._ts&&pauseTween!==child){
if(child.parent!==this){
return this.render(totalTime, suppressEvents, force);
}
child.render(child._ts > 0 ? (adjustedTime - child._start) * child._ts:(child._dirty ? child.totalDuration():child._tDur) + (adjustedTime - child._start) * child._ts, suppressEvents, force);
if(time!==this._time||!this._ts&&!prevPaused){
pauseTween=0;
next&&(tTime +=this._zTime=adjustedTime ? -_tinyNum:_tinyNum);
break;
}}
child=next;
}}
if(pauseTween&&!suppressEvents){
this.pause();
pauseTween.render(time >=prevTime ? 0:-_tinyNum)._zTime=time >=prevTime ? 1:-1;
if(this._ts){
this._start=prevStart;
_setEnd(this);
return this.render(totalTime, suppressEvents, force);
}}
this._onUpdate&&!suppressEvents&&_callback(this, "onUpdate", true);
if(tTime===tDur&&tDur >=this.totalDuration()||!tTime&&prevTime) if(prevStart===this._start||Math.abs(timeScale)!==Math.abs(this._ts)) if(!this._lock){
(totalTime||!dur)&&(tTime===tDur&&this._ts > 0||!tTime&&this._ts < 0)&&_removeFromParent(this, 1);
if(!suppressEvents&&!(totalTime < 0&&!prevTime)&&(tTime||prevTime)){
_callback(this, tTime===tDur ? "onComplete":"onReverseComplete", true);
this._prom&&!(tTime < tDur&&this.timeScale() > 0)&&this._prom();
}}
}
return this;
};
_proto2.add=function add(child, position){
var _this2=this;
_isNumber(position)||(position=_parsePosition(this, position));
if(!(child instanceof Animation)){
if(_isArray(child)){
child.forEach(function (obj){
return _this2.add(obj, position);
});
return this;
}
if(_isString(child)){
return this.addLabel(child, position);
}
if(_isFunction(child)){
child=Tween.delayedCall(0, child);
}else{
return this;
}}
return this!==child ? _addToTimeline(this, child, position):this;
};
_proto2.getChildren=function getChildren(nested, tweens, timelines, ignoreBeforeTime){
if(nested===void 0){
nested=true;
}
if(tweens===void 0){
tweens=true;
}
if(timelines===void 0){
timelines=true;
}
if(ignoreBeforeTime===void 0){
ignoreBeforeTime=-_bigNum;
}
var a=[],
child=this._first;
while (child){
if(child._start >=ignoreBeforeTime){
if(child instanceof Tween){
tweens&&a.push(child);
}else{
timelines&&a.push(child);
nested&&a.push.apply(a, child.getChildren(true, tweens, timelines));
}}
child=child._next;
}
return a;
};
_proto2.getById=function getById(id){
var animations=this.getChildren(1, 1, 1),
i=animations.length;
while (i--){
if(animations[i].vars.id===id){
return animations[i];
}}
};
_proto2.remove=function remove(child){
if(_isString(child)){
return this.removeLabel(child);
}
if(_isFunction(child)){
return this.killTweensOf(child);
}
_removeLinkedListItem(this, child);
if(child===this._recent){
this._recent=this._last;
}
return _uncache(this);
};
_proto2.totalTime=function totalTime(_totalTime2, suppressEvents){
if(!arguments.length){
return this._tTime;
}
this._forcing=1;
if(!this._dp&&this._ts){
this._start=_round(_ticker.time - (this._ts > 0 ? _totalTime2 / this._ts:(this.totalDuration() - _totalTime2) / -this._ts));
}
_Animation.prototype.totalTime.call(this, _totalTime2, suppressEvents);
this._forcing=0;
return this;
};
_proto2.addLabel=function addLabel(label, position){
this.labels[label]=_parsePosition(this, position);
return this;
};
_proto2.removeLabel=function removeLabel(label){
delete this.labels[label];
return this;
};
_proto2.addPause=function addPause(position, callback, params){
var t=Tween.delayedCall(0, callback||_emptyFunc, params);
t.data="isPause";
this._hasPause=1;
return _addToTimeline(this, t, _parsePosition(this, position));
};
_proto2.removePause=function removePause(position){
var child=this._first;
position=_parsePosition(this, position);
while (child){
if(child._start===position&&child.data==="isPause"){
_removeFromParent(child);
}
child=child._next;
}};
_proto2.killTweensOf=function killTweensOf(targets, props, onlyActive){
var tweens=this.getTweensOf(targets, onlyActive),
i=tweens.length;
while (i--){
_overwritingTween!==tweens[i]&&tweens[i].kill(targets, props);
}
return this;
};
_proto2.getTweensOf=function getTweensOf(targets, onlyActive){
var a=[],
parsedTargets=toArray(targets),
child=this._first,
isGlobalTime=_isNumber(onlyActive),
children;
while (child){
if(child instanceof Tween){
if(_arrayContainsAny(child._targets, parsedTargets)&&(isGlobalTime ? (!_overwritingTween||child._initted&&child._ts)&&child.globalTime(0) <=onlyActive&&child.globalTime(child.totalDuration()) > onlyActive:!onlyActive||child.isActive())){
a.push(child);
}}else if((children=child.getTweensOf(parsedTargets, onlyActive)).length){
a.push.apply(a, children);
}
child=child._next;
}
return a;
};
_proto2.tweenTo=function tweenTo(position, vars){
vars=vars||{};
var tl=this,
endTime=_parsePosition(tl, position),
_vars=vars,
startAt=_vars.startAt,
_onStart=_vars.onStart,
onStartParams=_vars.onStartParams,
immediateRender=_vars.immediateRender,
tween=Tween.to(tl, _setDefaults({
ease: vars.ease||"none",
lazy: false,
immediateRender: false,
time: endTime,
overwrite: "auto",
duration: vars.duration||Math.abs((endTime - (startAt&&"time" in startAt ? startAt.time:tl._time)) / tl.timeScale())||_tinyNum,
onStart: function onStart(){
tl.pause();
var duration=vars.duration||Math.abs((endTime - tl._time) / tl.timeScale());
tween._dur!==duration&&_setDuration(tween, duration, 0, 1).render(tween._time, true, true);
_onStart&&_onStart.apply(tween, onStartParams||[]);
}}, vars));
return immediateRender ? tween.render(0):tween;
};
_proto2.tweenFromTo=function tweenFromTo(fromPosition, toPosition, vars){
return this.tweenTo(toPosition, _setDefaults({
startAt: {
time: _parsePosition(this, fromPosition)
}}, vars));
};
_proto2.recent=function recent(){
return this._recent;
};
_proto2.nextLabel=function nextLabel(afterTime){
if(afterTime===void 0){
afterTime=this._time;
}
return _getLabelInDirection(this, _parsePosition(this, afterTime));
};
_proto2.previousLabel=function previousLabel(beforeTime){
if(beforeTime===void 0){
beforeTime=this._time;
}
return _getLabelInDirection(this, _parsePosition(this, beforeTime), 1);
};
_proto2.currentLabel=function currentLabel(value){
return arguments.length ? this.seek(value, true):this.previousLabel(this._time + _tinyNum);
};
_proto2.shiftChildren=function shiftChildren(amount, adjustLabels, ignoreBeforeTime){
if(ignoreBeforeTime===void 0){
ignoreBeforeTime=0;
}
var child=this._first,
labels=this.labels,
p;
while (child){
if(child._start >=ignoreBeforeTime){
child._start +=amount;
child._end +=amount;
}
child=child._next;
}
if(adjustLabels){
for (p in labels){
if(labels[p] >=ignoreBeforeTime){
labels[p] +=amount;
}}
}
return _uncache(this);
};
_proto2.invalidate=function invalidate(){
var child=this._first;
this._lock=0;
while (child){
child.invalidate();
child=child._next;
}
return _Animation.prototype.invalidate.call(this);
};
_proto2.clear=function clear(includeLabels){
if(includeLabels===void 0){
includeLabels=true;
}
var child=this._first,
next;
while (child){
next=child._next;
this.remove(child);
child=next;
}
this._dp&&(this._time=this._tTime=this._pTime=0);
includeLabels&&(this.labels={});
return _uncache(this);
};
_proto2.totalDuration=function totalDuration(value){
var max=0,
self=this,
child=self._last,
prevStart=_bigNum,
prev,
start,
parent;
if(arguments.length){
return self.timeScale((self._repeat < 0 ? self.duration():self.totalDuration()) / (self.reversed() ? -value:value));
}
if(self._dirty){
parent=self.parent;
while (child){
prev=child._prev;
child._dirty&&child.totalDuration();
start=child._start;
if(start > prevStart&&self._sort&&child._ts&&!self._lock){
self._lock=1;
_addToTimeline(self, child, start - child._delay, 1)._lock=0;
}else{
prevStart=start;
}
if(start < 0&&child._ts){
max -=start;
if(!parent&&!self._dp||parent&&parent.smoothChildTiming){
self._start +=start / self._ts;
self._time -=start;
self._tTime -=start;
}
self.shiftChildren(-start, false, -1e999);
prevStart=0;
}
child._end > max&&child._ts&&(max=child._end);
child=prev;
}
_setDuration(self, self===_globalTimeline&&self._time > max ? self._time:max, 1, 1);
self._dirty=0;
}
return self._tDur;
};
Timeline.updateRoot=function updateRoot(time){
if(_globalTimeline._ts){
_lazySafeRender(_globalTimeline, _parentToChildTotalTime(time, _globalTimeline));
_lastRenderedFrame=_ticker.frame;
}
if(_ticker.frame >=_nextGCFrame){
_nextGCFrame +=_config.autoSleep||120;
var child=_globalTimeline._first;
if(!child||!child._ts) if(_config.autoSleep&&_ticker._listeners.length < 2){
while (child&&!child._ts){
child=child._next;
}
child||_ticker.sleep();
}}
};
return Timeline;
}(Animation);
_setDefaults(Timeline.prototype, {
_lock: 0,
_hasPause: 0,
_forcing: 0
});
var _addComplexStringPropTween=function _addComplexStringPropTween(target, prop, start, end, setter, stringFilter, funcParam){
var pt=new PropTween(this._pt, target, prop, 0, 1, _renderComplexString, null, setter),
index=0,
matchIndex=0,
result,
startNums,
color,
endNum,
chunk,
startNum,
hasRandom,
a;
pt.b=start;
pt.e=end;
start +="";
end +="";
if(hasRandom=~end.indexOf("random(")){
end=_replaceRandom(end);
}
if(stringFilter){
a=[start, end];
stringFilter(a, target, prop);
start=a[0];
end=a[1];
}
startNums=start.match(_complexStringNumExp)||[];
while (result=_complexStringNumExp.exec(end)){
endNum=result[0];
chunk=end.substring(index, result.index);
if(color){
color=(color + 1) % 5;
}else if(chunk.substr(-5)==="rgba("){
color=1;
}
if(endNum!==startNums[matchIndex++]){
startNum=parseFloat(startNums[matchIndex - 1])||0;
pt._pt={
_next: pt._pt,
p: chunk||matchIndex===1 ? chunk:",",
s: startNum,
c: endNum.charAt(1)==="=" ? parseFloat(endNum.substr(2)) * (endNum.charAt(0)==="-" ? -1:1):parseFloat(endNum) - startNum,
m: color&&color < 4 ? Math.round:0
};
index=_complexStringNumExp.lastIndex;
}}
pt.c=index < end.length ? end.substring(index, end.length):"";
pt.fp=funcParam;
if(_relExp.test(end)||hasRandom){
pt.e=0;
}
this._pt=pt;
return pt;
},
_addPropTween=function _addPropTween(target, prop, start, end, index, targets, modifier, stringFilter, funcParam){
_isFunction(end)&&(end=end(index||0, target, targets));
var currentValue=target[prop],
parsedStart=start!=="get" ? start:!_isFunction(currentValue) ? currentValue:funcParam ? target[prop.indexOf("set")||!_isFunction(target["get" + prop.substr(3)]) ? prop:"get" + prop.substr(3)](funcParam):target[prop](),
setter = !_isFunction(currentValue) ? _setterPlain:funcParam ? _setterFuncWithParam:_setterFunc,
pt;
if(_isString(end)){
if(~end.indexOf("random(")){
end=_replaceRandom(end);
}
if(end.charAt(1)==="="){
end=parseFloat(parsedStart) + parseFloat(end.substr(2)) * (end.charAt(0)==="-" ? -1:1) + (getUnit(parsedStart)||0);
}}
if(parsedStart!==end){
if(!isNaN(parsedStart * end)){
pt=new PropTween(this._pt, target, prop, +parsedStart||0, end - (parsedStart||0), typeof currentValue==="boolean" ? _renderBoolean:_renderPlain, 0, setter);
funcParam&&(pt.fp=funcParam);
modifier&&pt.modifier(modifier, this, target);
return this._pt=pt;
}
!currentValue&&!(prop in target)&&_missingPlugin(prop, end);
return _addComplexStringPropTween.call(this, target, prop, parsedStart, end, setter, stringFilter||_config.stringFilter, funcParam);
}},
_processVars=function _processVars(vars, index, target, targets, tween){
_isFunction(vars)&&(vars=_parseFuncOrString(vars, tween, index, target, targets));
if(!_isObject(vars)||vars.style&&vars.nodeType||_isArray(vars)||_isTypedArray(vars)){
return _isString(vars) ? _parseFuncOrString(vars, tween, index, target, targets):vars;
}
var copy={},
p;
for (p in vars){
copy[p]=_parseFuncOrString(vars[p], tween, index, target, targets);
}
return copy;
},
_checkPlugin=function _checkPlugin(property, vars, tween, index, target, targets){
var plugin, pt, ptLookup, i;
if(_plugins[property]&&(plugin=new _plugins[property]()).init(target, plugin.rawVars ? vars[property]:_processVars(vars[property], index, target, targets, tween), tween, index, targets)!==false){
tween._pt=pt=new PropTween(tween._pt, target, property, 0, 1, plugin.render, plugin, 0, plugin.priority);
if(tween!==_quickTween){
ptLookup=tween._ptLookup[tween._targets.indexOf(target)];
i=plugin._props.length;
while (i--){
ptLookup[plugin._props[i]]=pt;
}}
}
return plugin;
},
_overwritingTween,
_initTween=function _initTween(tween, time){
var vars=tween.vars,
ease=vars.ease,
startAt=vars.startAt,
immediateRender=vars.immediateRender,
lazy=vars.lazy,
onUpdate=vars.onUpdate,
onUpdateParams=vars.onUpdateParams,
callbackScope=vars.callbackScope,
runBackwards=vars.runBackwards,
yoyoEase=vars.yoyoEase,
keyframes=vars.keyframes,
autoRevert=vars.autoRevert,
dur=tween._dur,
prevStartAt=tween._startAt,
targets=tween._targets,
parent=tween.parent,
fullTargets=parent&&parent.data==="nested" ? parent.parent._targets:targets,
autoOverwrite=tween._overwrite==="auto"&&!_suppressOverwrites,
tl=tween.timeline,
cleanVars,
i,
p,
pt,
target,
hasPriority,
gsData,
harness,
plugin,
ptLookup,
index,
harnessVars,
overwritten;
tl&&(!keyframes||!ease)&&(ease="none");
tween._ease=_parseEase(ease, _defaults.ease);
tween._yEase=yoyoEase ? _invertEase(_parseEase(yoyoEase===true ? ease:yoyoEase, _defaults.ease)):0;
if(yoyoEase&&tween._yoyo&&!tween._repeat){
yoyoEase=tween._yEase;
tween._yEase=tween._ease;
tween._ease=yoyoEase;
}
if(!tl){
harness=targets[0] ? _getCache(targets[0]).harness:0;
harnessVars=harness&&vars[harness.prop];
cleanVars=_copyExcluding(vars, _reservedProps);
prevStartAt&&prevStartAt.render(-1, true).kill();
if(startAt){
_removeFromParent(tween._startAt=Tween.set(targets, _setDefaults({
data: "isStart",
overwrite: false,
parent: parent,
immediateRender: true,
lazy: _isNotFalse(lazy),
startAt: null,
delay: 0,
onUpdate: onUpdate,
onUpdateParams: onUpdateParams,
callbackScope: callbackScope,
stagger: 0
}, startAt)));
if(immediateRender){
if(time > 0){
autoRevert||(tween._startAt=0);
}else if(dur&&!(time < 0&&prevStartAt)){
time&&(tween._zTime=time);
return;
}}else if(autoRevert===false){
tween._startAt=0;
}}else if(runBackwards&&dur){
if(prevStartAt){
!autoRevert&&(tween._startAt=0);
}else{
time&&(immediateRender=false);
p=_setDefaults({
overwrite: false,
data: "isFromStart",
lazy: immediateRender&&_isNotFalse(lazy),
immediateRender: immediateRender,
stagger: 0,
parent: parent
}, cleanVars);
harnessVars&&(p[harness.prop]=harnessVars);
_removeFromParent(tween._startAt=Tween.set(targets, p));
if(!immediateRender){
_initTween(tween._startAt, _tinyNum);
}else if(!time){
return;
}}
}
tween._pt=0;
lazy=dur&&_isNotFalse(lazy)||lazy&&!dur;
for (i=0; i < targets.length; i++){
target=targets[i];
gsData=target._gsap||_harness(targets)[i]._gsap;
tween._ptLookup[i]=ptLookup={};
_lazyLookup[gsData.id]&&_lazyTweens.length&&_lazyRender();
index=fullTargets===targets ? i:fullTargets.indexOf(target);
if(harness&&(plugin=new harness()).init(target, harnessVars||cleanVars, tween, index, fullTargets)!==false){
tween._pt=pt=new PropTween(tween._pt, target, plugin.name, 0, 1, plugin.render, plugin, 0, plugin.priority);
plugin._props.forEach(function (name){
ptLookup[name]=pt;
});
plugin.priority&&(hasPriority=1);
}
if(!harness||harnessVars){
for (p in cleanVars){
if(_plugins[p]&&(plugin=_checkPlugin(p, cleanVars, tween, index, target, fullTargets))){
plugin.priority&&(hasPriority=1);
}else{
ptLookup[p]=pt=_addPropTween.call(tween, target, p, "get", cleanVars[p], index, fullTargets, 0, vars.stringFilter);
}}
}
tween._op&&tween._op[i]&&tween.kill(target, tween._op[i]);
if(autoOverwrite&&tween._pt){
_overwritingTween=tween;
_globalTimeline.killTweensOf(target, ptLookup, tween.globalTime(0));
overwritten = !tween.parent;
_overwritingTween=0;
}
tween._pt&&lazy&&(_lazyLookup[gsData.id]=1);
}
hasPriority&&_sortPropTweensByPriority(tween);
tween._onInit&&tween._onInit(tween);
}
tween._from = !tl&&!!vars.runBackwards;
tween._onUpdate=onUpdate;
tween._initted=(!tween._op||tween._pt)&&!overwritten;
},
_addAliasesToVars=function _addAliasesToVars(targets, vars){
var harness=targets[0] ? _getCache(targets[0]).harness:0,
propertyAliases=harness&&harness.aliases,
copy,
p,
i,
aliases;
if(!propertyAliases){
return vars;
}
copy=_merge({}, vars);
for (p in propertyAliases){
if(p in copy){
aliases=propertyAliases[p].split(",");
i=aliases.length;
while (i--){
copy[aliases[i]]=copy[p];
}}
}
return copy;
},
_parseFuncOrString=function _parseFuncOrString(value, tween, i, target, targets){
return _isFunction(value) ? value.call(tween, i, target, targets):_isString(value)&&~value.indexOf("random(") ? _replaceRandom(value):value;
},
_staggerTweenProps=_callbackNames + "repeat,repeatDelay,yoyo,repeatRefresh,yoyoEase",
_staggerPropsToSkip=(_staggerTweenProps + ",id,stagger,delay,duration,paused,scrollTrigger").split(",");
var Tween=function (_Animation2){
_inheritsLoose(Tween, _Animation2);
function Tween(targets, vars, time, skipInherit){
var _this3;
if(typeof vars==="number"){
time.duration=vars;
vars=time;
time=null;
}
_this3=_Animation2.call(this, skipInherit ? vars:_inheritDefaults(vars), time)||this;
var _this3$vars=_this3.vars,
duration=_this3$vars.duration,
delay=_this3$vars.delay,
immediateRender=_this3$vars.immediateRender,
stagger=_this3$vars.stagger,
overwrite=_this3$vars.overwrite,
keyframes=_this3$vars.keyframes,
defaults=_this3$vars.defaults,
scrollTrigger=_this3$vars.scrollTrigger,
yoyoEase=_this3$vars.yoyoEase,
parent=_this3.parent,
parsedTargets=(_isArray(targets)||_isTypedArray(targets) ? _isNumber(targets[0]):"length" in vars) ? [targets]:toArray(targets),
tl,
i,
copy,
l,
p,
curTarget,
staggerFunc,
staggerVarsToMerge;
_this3._targets=parsedTargets.length ? _harness(parsedTargets):_warn("GSAP target " + targets + " not found. https://greensock.com", !_config.nullTargetWarn)||[];
_this3._ptLookup=[];
_this3._overwrite=overwrite;
if(keyframes||stagger||_isFuncOrString(duration)||_isFuncOrString(delay)){
vars=_this3.vars;
tl=_this3.timeline=new Timeline({
data: "nested",
defaults: defaults||{}});
tl.kill();
tl.parent=tl._dp=_assertThisInitialized(_this3);
tl._start=0;
if(keyframes){
_setDefaults(tl.vars.defaults, {
ease: "none"
});
keyframes.forEach(function (frame){
return tl.to(parsedTargets, frame, ">");
});
}else{
l=parsedTargets.length;
staggerFunc=stagger ? distribute(stagger):_emptyFunc;
if(_isObject(stagger)){
for (p in stagger){
if(~_staggerTweenProps.indexOf(p)){
staggerVarsToMerge||(staggerVarsToMerge={});
staggerVarsToMerge[p]=stagger[p];
}}
}
for (i=0; i < l; i++){
copy={};
for (p in vars){
if(_staggerPropsToSkip.indexOf(p) < 0){
copy[p]=vars[p];
}}
copy.stagger=0;
yoyoEase&&(copy.yoyoEase=yoyoEase);
staggerVarsToMerge&&_merge(copy, staggerVarsToMerge);
curTarget=parsedTargets[i];
copy.duration=+_parseFuncOrString(duration, _assertThisInitialized(_this3), i, curTarget, parsedTargets);
copy.delay=(+_parseFuncOrString(delay, _assertThisInitialized(_this3), i, curTarget, parsedTargets)||0) - _this3._delay;
if(!stagger&&l===1&©.delay){
_this3._delay=delay=copy.delay;
_this3._start +=delay;
copy.delay=0;
}
tl.to(curTarget, copy, staggerFunc(i, curTarget, parsedTargets));
}
tl.duration() ? duration=delay=0:_this3.timeline=0;
}
duration||_this3.duration(duration=tl.duration());
}else{
_this3.timeline=0;
}
if(overwrite===true&&!_suppressOverwrites){
_overwritingTween=_assertThisInitialized(_this3);
_globalTimeline.killTweensOf(parsedTargets);
_overwritingTween=0;
}
parent&&_postAddChecks(parent, _assertThisInitialized(_this3));
if(immediateRender||!duration&&!keyframes&&_this3._start===_round(parent._time)&&_isNotFalse(immediateRender)&&_hasNoPausedAncestors(_assertThisInitialized(_this3))&&parent.data!=="nested"){
_this3._tTime=-_tinyNum;
_this3.render(Math.max(0, -delay));
}
scrollTrigger&&_scrollTrigger(_assertThisInitialized(_this3), scrollTrigger);
return _this3;
}
var _proto3=Tween.prototype;
_proto3.render=function render(totalTime, suppressEvents, force){
var prevTime=this._time,
tDur=this._tDur,
dur=this._dur,
tTime=totalTime > tDur - _tinyNum&&totalTime >=0 ? tDur:totalTime < _tinyNum ? 0:totalTime,
time,
pt,
iteration,
cycleDuration,
prevIteration,
isYoyo,
ratio,
timeline,
yoyoEase;
if(!dur){
_renderZeroDurationTween(this, totalTime, suppressEvents, force);
}else if(tTime!==this._tTime||!totalTime||force||!this._initted&&this._tTime||this._startAt&&this._zTime < 0!==totalTime < 0){
time=tTime;
timeline=this.timeline;
if(this._repeat){
cycleDuration=dur + this._rDelay;
if(this._repeat < -1&&totalTime < 0){
return this.totalTime(cycleDuration * 100 + totalTime, suppressEvents, force);
}
time=_round(tTime % cycleDuration);
if(tTime===tDur){
iteration=this._repeat;
time=dur;
}else{
iteration=~~(tTime / cycleDuration);
if(iteration&&iteration===tTime / cycleDuration){
time=dur;
iteration--;
}
time > dur&&(time=dur);
}
isYoyo=this._yoyo&&iteration & 1;
if(isYoyo){
yoyoEase=this._yEase;
time=dur - time;
}
prevIteration=_animationCycle(this._tTime, cycleDuration);
if(time===prevTime&&!force&&this._initted){
return this;
}
if(iteration!==prevIteration){
timeline&&this._yEase&&_propagateYoyoEase(timeline, isYoyo);
if(this.vars.repeatRefresh&&!isYoyo&&!this._lock){
this._lock=force=1;
this.render(_round(cycleDuration * iteration), true).invalidate()._lock=0;
}}
}
if(!this._initted){
if(_attemptInitTween(this, totalTime < 0 ? totalTime:time, force, suppressEvents)){
this._tTime=0;
return this;
}
if(dur!==this._dur){
return this.render(totalTime, suppressEvents, force);
}}
this._tTime=tTime;
this._time=time;
if(!this._act&&this._ts){
this._act=1;
this._lazy=0;
}
this.ratio=ratio=(yoyoEase||this._ease)(time / dur);
if(this._from){
this.ratio=ratio=1 - ratio;
}
time&&!prevTime&&!suppressEvents&&_callback(this, "onStart");
pt=this._pt;
while (pt){
pt.r(ratio, pt.d);
pt=pt._next;
}
timeline&&timeline.render(totalTime < 0 ? totalTime:!time&&isYoyo ? -_tinyNum:timeline._dur * ratio, suppressEvents, force)||this._startAt&&(this._zTime=totalTime);
if(this._onUpdate&&!suppressEvents){
totalTime < 0&&this._startAt&&this._startAt.render(totalTime, true, force);
_callback(this, "onUpdate");
}
this._repeat&&iteration!==prevIteration&&this.vars.onRepeat&&!suppressEvents&&this.parent&&_callback(this, "onRepeat");
if((tTime===this._tDur||!tTime)&&this._tTime===tTime){
totalTime < 0&&this._startAt&&!this._onUpdate&&this._startAt.render(totalTime, true, true);
(totalTime||!dur)&&(tTime===this._tDur&&this._ts > 0||!tTime&&this._ts < 0)&&_removeFromParent(this, 1);
if(!suppressEvents&&!(totalTime < 0&&!prevTime)&&(tTime||prevTime)){
_callback(this, tTime===tDur ? "onComplete":"onReverseComplete", true);
this._prom&&!(tTime < tDur&&this.timeScale() > 0)&&this._prom();
}}
}
return this;
};
_proto3.targets=function targets(){
return this._targets;
};
_proto3.invalidate=function invalidate(){
this._pt=this._op=this._startAt=this._onUpdate=this._lazy=this.ratio=0;
this._ptLookup=[];
this.timeline&&this.timeline.invalidate();
return _Animation2.prototype.invalidate.call(this);
};
_proto3.kill=function kill(targets, vars){
if(vars===void 0){
vars="all";
}
if(!targets&&(!vars||vars==="all")){
this._lazy=this._pt=0;
return this.parent ? _interrupt(this):this;
}
if(this.timeline){
var tDur=this.timeline.totalDuration();
this.timeline.killTweensOf(targets, vars, _overwritingTween&&_overwritingTween.vars.overwrite!==true)._first||_interrupt(this);
this.parent&&tDur!==this.timeline.totalDuration()&&_setDuration(this, this._dur * this.timeline._tDur / tDur, 0, 1);
return this;
}
var parsedTargets=this._targets,
killingTargets=targets ? toArray(targets):parsedTargets,
propTweenLookup=this._ptLookup,
firstPT=this._pt,
overwrittenProps,
curLookup,
curOverwriteProps,
props,
p,
pt,
i;
if((!vars||vars==="all")&&_arraysMatch(parsedTargets, killingTargets)){
vars==="all"&&(this._pt=0);
return _interrupt(this);
}
overwrittenProps=this._op=this._op||[];
if(vars!=="all"){
if(_isString(vars)){
p={};
_forEachName(vars, function (name){
return p[name]=1;
});
vars=p;
}
vars=_addAliasesToVars(parsedTargets, vars);
}
i=parsedTargets.length;
while (i--){
if(~killingTargets.indexOf(parsedTargets[i])){
curLookup=propTweenLookup[i];
if(vars==="all"){
overwrittenProps[i]=vars;
props=curLookup;
curOverwriteProps={};}else{
curOverwriteProps=overwrittenProps[i]=overwrittenProps[i]||{};
props=vars;
}
for (p in props){
pt=curLookup&&curLookup[p];
if(pt){
if(!("kill" in pt.d)||pt.d.kill(p)===true){
_removeLinkedListItem(this, pt, "_pt");
}
delete curLookup[p];
}
if(curOverwriteProps!=="all"){
curOverwriteProps[p]=1;
}}
}}
this._initted&&!this._pt&&firstPT&&_interrupt(this);
return this;
};
Tween.to=function to(targets, vars){
return new Tween(targets, vars, arguments[2]);
};
Tween.from=function from(targets, vars){
return new Tween(targets, _parseVars(arguments, 1));
};
Tween.delayedCall=function delayedCall(delay, callback, params, scope){
return new Tween(callback, 0, {
immediateRender: false,
lazy: false,
overwrite: false,
delay: delay,
onComplete: callback,
onReverseComplete: callback,
onCompleteParams: params,
onReverseCompleteParams: params,
callbackScope: scope
});
};
Tween.fromTo=function fromTo(targets, fromVars, toVars){
return new Tween(targets, _parseVars(arguments, 2));
};
Tween.set=function set(targets, vars){
vars.duration=0;
vars.repeatDelay||(vars.repeat=0);
return new Tween(targets, vars);
};
Tween.killTweensOf=function killTweensOf(targets, props, onlyActive){
return _globalTimeline.killTweensOf(targets, props, onlyActive);
};
return Tween;
}(Animation);
_setDefaults(Tween.prototype, {
_targets: [],
_lazy: 0,
_startAt: 0,
_op: 0,
_onInit: 0
});
_forEachName("staggerTo,staggerFrom,staggerFromTo", function (name){
Tween[name]=function (){
var tl=new Timeline(),
params=_slice.call(arguments, 0);
params.splice(name==="staggerFromTo" ? 5:4, 0, 0);
return tl[name].apply(tl, params);
};});
var _setterPlain=function _setterPlain(target, property, value){
return target[property]=value;
},
_setterFunc=function _setterFunc(target, property, value){
return target[property](value);
},
_setterFuncWithParam=function _setterFuncWithParam(target, property, value, data){
return target[property](data.fp, value);
},
_setterAttribute=function _setterAttribute(target, property, value){
return target.setAttribute(property, value);
},
_getSetter=function _getSetter(target, property){
return _isFunction(target[property]) ? _setterFunc:_isUndefined(target[property])&&target.setAttribute ? _setterAttribute:_setterPlain;
},
_renderPlain=function _renderPlain(ratio, data){
return data.set(data.t, data.p, Math.round((data.s + data.c * ratio) * 10000) / 10000, data);
},
_renderBoolean=function _renderBoolean(ratio, data){
return data.set(data.t, data.p, !!(data.s + data.c * ratio), data);
},
_renderComplexString=function _renderComplexString(ratio, data){
var pt=data._pt,
s="";
if(!ratio&&data.b){
s=data.b;
}else if(ratio===1&&data.e){
s=data.e;
}else{
while (pt){
s=pt.p + (pt.m ? pt.m(pt.s + pt.c * ratio):Math.round((pt.s + pt.c * ratio) * 10000) / 10000) + s;
pt=pt._next;
}
s +=data.c;
}
data.set(data.t, data.p, s, data);
},
_renderPropTweens=function _renderPropTweens(ratio, data){
var pt=data._pt;
while (pt){
pt.r(ratio, pt.d);
pt=pt._next;
}},
_addPluginModifier=function _addPluginModifier(modifier, tween, target, property){
var pt=this._pt,
next;
while (pt){
next=pt._next;
pt.p===property&&pt.modifier(modifier, tween, target);
pt=next;
}},
_killPropTweensOf=function _killPropTweensOf(property){
var pt=this._pt,
hasNonDependentRemaining,
next;
while (pt){
next=pt._next;
if(pt.p===property&&!pt.op||pt.op===property){
_removeLinkedListItem(this, pt, "_pt");
}else if(!pt.dep){
hasNonDependentRemaining=1;
}
pt=next;
}
return !hasNonDependentRemaining;
},
_setterWithModifier=function _setterWithModifier(target, property, value, data){
data.mSet(target, property, data.m.call(data.tween, value, data.mt), data);
},
_sortPropTweensByPriority=function _sortPropTweensByPriority(parent){
var pt=parent._pt,
next,
pt2,
first,
last;
while (pt){
next=pt._next;
pt2=first;
while (pt2&&pt2.pr > pt.pr){
pt2=pt2._next;
}
if(pt._prev=pt2 ? pt2._prev:last){
pt._prev._next=pt;
}else{
first=pt;
}
if(pt._next=pt2){
pt2._prev=pt;
}else{
last=pt;
}
pt=next;
}
parent._pt=first;
};
var PropTween=function (){
function PropTween(next, target, prop, start, change, renderer, data, setter, priority){
this.t=target;
this.s=start;
this.c=change;
this.p=prop;
this.r=renderer||_renderPlain;
this.d=data||this;
this.set=setter||_setterPlain;
this.pr=priority||0;
this._next=next;
if(next){
next._prev=this;
}}
var _proto4=PropTween.prototype;
_proto4.modifier=function modifier(func, tween, target){
this.mSet=this.mSet||this.set;
this.set=_setterWithModifier;
this.m=func;
this.mt=target;
this.tween=tween;
};
return PropTween;
}();
_forEachName(_callbackNames + "parent,duration,ease,delay,overwrite,runBackwards,startAt,yoyo,immediateRender,repeat,repeatDelay,data,paused,reversed,lazy,callbackScope,stringFilter,id,yoyoEase,stagger,inherit,repeatRefresh,keyframes,autoRevert,scrollTrigger", function (name){
return _reservedProps[name]=1;
});
_globals.TweenMax=_globals.TweenLite=Tween;
_globals.TimelineLite=_globals.TimelineMax=Timeline;
_globalTimeline=new Timeline({
sortChildren: false,
defaults: _defaults,
autoRemoveChildren: true,
id: "root",
smoothChildTiming: true
});
_config.stringFilter=_colorStringFilter;
var _gsap={
registerPlugin: function registerPlugin(){
for (var _len2=arguments.length, args=new Array(_len2), _key2=0; _key2 < _len2; _key2++){
args[_key2]=arguments[_key2];
}
args.forEach(function (config){
return _createPlugin(config);
});
},
timeline: function timeline(vars){
return new Timeline(vars);
},
getTweensOf: function getTweensOf(targets, onlyActive){
return _globalTimeline.getTweensOf(targets, onlyActive);
},
getProperty: function getProperty(target, property, unit, uncache){
_isString(target)&&(target=toArray(target)[0]);
var getter=_getCache(target||{}).get,
format=unit ? _passThrough:_numericIfPossible;
unit==="native"&&(unit="");
return !target ? target:!property ? function (property, unit, uncache){
return format((_plugins[property]&&_plugins[property].get||getter)(target, property, unit, uncache));
}:format((_plugins[property]&&_plugins[property].get||getter)(target, property, unit, uncache));
},
quickSetter: function quickSetter(target, property, unit){
target=toArray(target);
if(target.length > 1){
var setters=target.map(function (t){
return gsap.quickSetter(t, property, unit);
}),
l=setters.length;
return function (value){
var i=l;
while (i--){
setters[i](value);
}};}
target=target[0]||{};
var Plugin=_plugins[property],
cache=_getCache(target),
p=cache.harness&&(cache.harness.aliases||{})[property]||property,
setter=Plugin ? function (value){
var p=new Plugin();
_quickTween._pt=0;
p.init(target, unit ? value + unit:value, _quickTween, 0, [target]);
p.render(1, p);
_quickTween._pt&&_renderPropTweens(1, _quickTween);
}:cache.set(target, p);
return Plugin ? setter:function (value){
return setter(target, p, unit ? value + unit:value, cache, 1);
};},
isTweening: function isTweening(targets){
return _globalTimeline.getTweensOf(targets, true).length > 0;
},
defaults: function defaults(value){
value&&value.ease&&(value.ease=_parseEase(value.ease, _defaults.ease));
return _mergeDeep(_defaults, value||{});
},
config: function config(value){
return _mergeDeep(_config, value||{});
},
registerEffect: function registerEffect(_ref2){
var name=_ref2.name,
effect=_ref2.effect,
plugins=_ref2.plugins,
defaults=_ref2.defaults,
extendTimeline=_ref2.extendTimeline;
(plugins||"").split(",").forEach(function (pluginName){
return pluginName&&!_plugins[pluginName]&&!_globals[pluginName]&&_warn(name + " effect requires " + pluginName + " plugin.");
});
_effects[name]=function (targets, vars, tl){
return effect(toArray(targets), _setDefaults(vars||{}, defaults), tl);
};
if(extendTimeline){
Timeline.prototype[name]=function (targets, vars, position){
return this.add(_effects[name](targets, _isObject(vars) ? vars:(position=vars)&&{}, this), position);
};}},
registerEase: function registerEase(name, ease){
_easeMap[name]=_parseEase(ease);
},
parseEase: function parseEase(ease, defaultEase){
return arguments.length ? _parseEase(ease, defaultEase):_easeMap;
},
getById: function getById(id){
return _globalTimeline.getById(id);
},
exportRoot: function exportRoot(vars, includeDelayedCalls){
if(vars===void 0){
vars={};}
var tl=new Timeline(vars),
child,
next;
tl.smoothChildTiming=_isNotFalse(vars.smoothChildTiming);
_globalTimeline.remove(tl);
tl._dp=0;
tl._time=tl._tTime=_globalTimeline._time;
child=_globalTimeline._first;
while (child){
next=child._next;
if(includeDelayedCalls||!(!child._dur&&child instanceof Tween&&child.vars.onComplete===child._targets[0])){
_addToTimeline(tl, child, child._start - child._delay);
}
child=next;
}
_addToTimeline(_globalTimeline, tl, 0);
return tl;
},
utils: {
wrap: wrap,
wrapYoyo: wrapYoyo,
distribute: distribute,
random: random,
snap: snap,
normalize: normalize,
getUnit: getUnit,
clamp: clamp,
splitColor: splitColor,
toArray: toArray,
mapRange: mapRange,
pipe: pipe,
unitize: unitize,
interpolate: interpolate,
shuffle: shuffle
},
install: _install,
effects: _effects,
ticker: _ticker,
updateRoot: Timeline.updateRoot,
plugins: _plugins,
globalTimeline: _globalTimeline,
core: {
PropTween: PropTween,
globals: _addGlobal,
Tween: Tween,
Timeline: Timeline,
Animation: Animation,
getCache: _getCache,
_removeLinkedListItem: _removeLinkedListItem,
suppressOverwrites: function suppressOverwrites(value){
return _suppressOverwrites=value;
}}
};
_forEachName("to,from,fromTo,delayedCall,set,killTweensOf", function (name){
return _gsap[name]=Tween[name];
});
_ticker.add(Timeline.updateRoot);
_quickTween=_gsap.to({}, {
duration: 0
});
var _getPluginPropTween=function _getPluginPropTween(plugin, prop){
var pt=plugin._pt;
while (pt&&pt.p!==prop&&pt.op!==prop&&pt.fp!==prop){
pt=pt._next;
}
return pt;
},
_addModifiers=function _addModifiers(tween, modifiers){
var targets=tween._targets,
p,
i,
pt;
for (p in modifiers){
i=targets.length;
while (i--){
pt=tween._ptLookup[i][p];
if(pt&&(pt=pt.d)){
if(pt._pt){
pt=_getPluginPropTween(pt, p);
}
pt&&pt.modifier&&pt.modifier(modifiers[p], tween, targets[i], p);
}}
}},
_buildModifierPlugin=function _buildModifierPlugin(name, modifier){
return {
name: name,
rawVars: 1,
init: function init(target, vars, tween){
tween._onInit=function (tween){
var temp, p;
if(_isString(vars)){
temp={};
_forEachName(vars, function (name){
return temp[name]=1;
});
vars=temp;
}
if(modifier){
temp={};
for (p in vars){
temp[p]=modifier(vars[p]);
}
vars=temp;
}
_addModifiers(tween, vars);
};}};};
var gsap=_gsap.registerPlugin({
name: "attr",
init: function init(target, vars, tween, index, targets){
var p, pt;
for (p in vars){
pt=this.add(target, "setAttribute", (target.getAttribute(p)||0) + "", vars[p], index, targets, 0, 0, p);
pt&&(pt.op=p);
this._props.push(p);
}}
}, {
name: "endArray",
init: function init(target, value){
var i=value.length;
while (i--){
this.add(target, i, target[i]||0, value[i]);
}}
}, _buildModifierPlugin("roundProps", _roundModifier), _buildModifierPlugin("modifiers"), _buildModifierPlugin("snap", snap))||_gsap;
Tween.version=Timeline.version=gsap.version="3.6.1";
_coreReady=1;
if(_windowExists()){
_wake();
}
var Power0=_easeMap.Power0,
Power1=_easeMap.Power1,
Power2=_easeMap.Power2,
Power3=_easeMap.Power3,
Power4=_easeMap.Power4,
Linear=_easeMap.Linear,
Quad=_easeMap.Quad,
Cubic=_easeMap.Cubic,
Quart=_easeMap.Quart,
Quint=_easeMap.Quint,
Strong=_easeMap.Strong,
Elastic=_easeMap.Elastic,
Back=_easeMap.Back,
SteppedEase=_easeMap.SteppedEase,
Bounce=_easeMap.Bounce,
Sine=_easeMap.Sine,
Expo=_easeMap.Expo,
Circ=_easeMap.Circ;
var _win$1,
_doc$1,
_docElement,
_pluginInitted,
_tempDiv,
_tempDivStyler,
_recentSetterPlugin,
_windowExists$1=function _windowExists(){
return typeof window!=="undefined";
},
_transformProps={},
_RAD2DEG=180 / Math.PI,
_DEG2RAD=Math.PI / 180,
_atan2=Math.atan2,
_bigNum$1=1e8,
_capsExp=/([A-Z])/g,
_horizontalExp=/(?:left|right|width|margin|padding|x)/i,
_complexExp=/[\s,\(]\S/,
_propertyAliases={
autoAlpha: "opacity,visibility",
scale: "scaleX,scaleY",
alpha: "opacity"
},
_renderCSSProp=function _renderCSSProp(ratio, data){
return data.set(data.t, data.p, Math.round((data.s + data.c * ratio) * 10000) / 10000 + data.u, data);
},
_renderPropWithEnd=function _renderPropWithEnd(ratio, data){
return data.set(data.t, data.p, ratio===1 ? data.e:Math.round((data.s + data.c * ratio) * 10000) / 10000 + data.u, data);
},
_renderCSSPropWithBeginning=function _renderCSSPropWithBeginning(ratio, data){
return data.set(data.t, data.p, ratio ? Math.round((data.s + data.c * ratio) * 10000) / 10000 + data.u:data.b, data);
},
_renderRoundedCSSProp=function _renderRoundedCSSProp(ratio, data){
var value=data.s + data.c * ratio;
data.set(data.t, data.p, ~~(value + (value < 0 ? -.5 : .5)) + data.u, data);
},
_renderNonTweeningValue=function _renderNonTweeningValue(ratio, data){
return data.set(data.t, data.p, ratio ? data.e:data.b, data);
},
_renderNonTweeningValueOnlyAtEnd=function _renderNonTweeningValueOnlyAtEnd(ratio, data){
return data.set(data.t, data.p, ratio!==1 ? data.b:data.e, data);
},
_setterCSSStyle=function _setterCSSStyle(target, property, value){
return target.style[property]=value;
},
_setterCSSProp=function _setterCSSProp(target, property, value){
return target.style.setProperty(property, value);
},
_setterTransform=function _setterTransform(target, property, value){
return target._gsap[property]=value;
},
_setterScale=function _setterScale(target, property, value){
return target._gsap.scaleX=target._gsap.scaleY=value;
},
_setterScaleWithRender=function _setterScaleWithRender(target, property, value, data, ratio){
var cache=target._gsap;
cache.scaleX=cache.scaleY=value;
cache.renderTransform(ratio, cache);
},
_setterTransformWithRender=function _setterTransformWithRender(target, property, value, data, ratio){
var cache=target._gsap;
cache[property]=value;
cache.renderTransform(ratio, cache);
},
_transformProp="transform",
_transformOriginProp=_transformProp + "Origin",
_supports3D,
_createElement=function _createElement(type, ns){
var e=_doc$1.createElementNS ? _doc$1.createElementNS((ns||"http://www.w3.org/1999/xhtml").replace(/^https/, "http"), type):_doc$1.createElement(type);
return e.style ? e:_doc$1.createElement(type);
},
_getComputedProperty=function _getComputedProperty(target, property, skipPrefixFallback){
var cs=getComputedStyle(target);
return cs[property]||cs.getPropertyValue(property.replace(_capsExp, "-$1").toLowerCase())||cs.getPropertyValue(property)||!skipPrefixFallback&&_getComputedProperty(target, _checkPropPrefix(property)||property, 1)||"";
},
_prefixes="O,Moz,ms,Ms,Webkit".split(","),
_checkPropPrefix=function _checkPropPrefix(property, element, preferPrefix){
var e=element||_tempDiv,
s=e.style,
i=5;
if(property in s&&!preferPrefix){
return property;
}
property=property.charAt(0).toUpperCase() + property.substr(1);
while (i--&&!(_prefixes[i] + property in s)){}
return i < 0 ? null:(i===3 ? "ms":i >=0 ? _prefixes[i]:"") + property;
},
_initCore=function _initCore(){
if(_windowExists$1()&&window.document){
_win$1=window;
_doc$1=_win$1.document;
_docElement=_doc$1.documentElement;
_tempDiv=_createElement("div")||{
style: {}};
_tempDivStyler=_createElement("div");
_transformProp=_checkPropPrefix(_transformProp);
_transformOriginProp=_transformProp + "Origin";
_tempDiv.style.cssText="border-width:0;line-height:0;position:absolute;padding:0";
_supports3D = !!_checkPropPrefix("perspective");
_pluginInitted=1;
}},
_getBBoxHack=function _getBBoxHack(swapIfPossible){
var svg=_createElement("svg", this.ownerSVGElement&&this.ownerSVGElement.getAttribute("xmlns")||"http://www.w3.org/2000/svg"),
oldParent=this.parentNode,
oldSibling=this.nextSibling,
oldCSS=this.style.cssText,
bbox;
_docElement.appendChild(svg);
svg.appendChild(this);
this.style.display="block";
if(swapIfPossible){
try {
bbox=this.getBBox();
this._gsapBBox=this.getBBox;
this.getBBox=_getBBoxHack;
} catch (e){}}else if(this._gsapBBox){
bbox=this._gsapBBox();
}
if(oldParent){
if(oldSibling){
oldParent.insertBefore(this, oldSibling);
}else{
oldParent.appendChild(this);
}}
_docElement.removeChild(svg);
this.style.cssText=oldCSS;
return bbox;
},
_getAttributeFallbacks=function _getAttributeFallbacks(target, attributesArray){
var i=attributesArray.length;
while (i--){
if(target.hasAttribute(attributesArray[i])){
return target.getAttribute(attributesArray[i]);
}}
},
_getBBox=function _getBBox(target){
var bounds;
try {
bounds=target.getBBox();
} catch (error){
bounds=_getBBoxHack.call(target, true);
}
bounds&&(bounds.width||bounds.height)||target.getBBox===_getBBoxHack||(bounds=_getBBoxHack.call(target, true));
return bounds&&!bounds.width&&!bounds.x&&!bounds.y ? {
x: +_getAttributeFallbacks(target, ["x", "cx", "x1"])||0,
y: +_getAttributeFallbacks(target, ["y", "cy", "y1"])||0,
width: 0,
height: 0
}:bounds;
},
_isSVG=function _isSVG(e){
return !!(e.getCTM&&(!e.parentNode||e.ownerSVGElement)&&_getBBox(e));
},
_removeProperty=function _removeProperty(target, property){
if(property){
var style=target.style;
if(property in _transformProps&&property!==_transformOriginProp){
property=_transformProp;
}
if(style.removeProperty){
if(property.substr(0, 2)==="ms"||property.substr(0, 6)==="webkit"){
property="-" + property;
}
style.removeProperty(property.replace(_capsExp, "-$1").toLowerCase());
}else{
style.removeAttribute(property);
}}
},
_addNonTweeningPT=function _addNonTweeningPT(plugin, target, property, beginning, end, onlySetAtEnd){
var pt=new PropTween(plugin._pt, target, property, 0, 1, onlySetAtEnd ? _renderNonTweeningValueOnlyAtEnd:_renderNonTweeningValue);
plugin._pt=pt;
pt.b=beginning;
pt.e=end;
plugin._props.push(property);
return pt;
},
_nonConvertibleUnits={
deg: 1,
rad: 1,
turn: 1
},
_convertToUnit=function _convertToUnit(target, property, value, unit){
var curValue=parseFloat(value)||0,
curUnit=(value + "").trim().substr((curValue + "").length)||"px",
style=_tempDiv.style,
horizontal=_horizontalExp.test(property),
isRootSVG=target.tagName.toLowerCase()==="svg",
measureProperty=(isRootSVG ? "client":"offset") + (horizontal ? "Width":"Height"),
amount=100,
toPixels=unit==="px",
toPercent=unit==="%",
px,
parent,
cache,
isSVG;
if(unit===curUnit||!curValue||_nonConvertibleUnits[unit]||_nonConvertibleUnits[curUnit]){
return curValue;
}
curUnit!=="px"&&!toPixels&&(curValue=_convertToUnit(target, property, value, "px"));
isSVG=target.getCTM&&_isSVG(target);
if((toPercent||curUnit==="%")&&(_transformProps[property]||~property.indexOf("adius"))){
px=isSVG ? target.getBBox()[horizontal ? "width":"height"]:target[measureProperty];
return _round(toPercent ? curValue / px * amount:curValue / 100 * px);
}
style[horizontal ? "width":"height"]=amount + (toPixels ? curUnit:unit);
parent=~property.indexOf("adius")||unit==="em"&&target.appendChild&&!isRootSVG ? target:target.parentNode;
if(isSVG){
parent=(target.ownerSVGElement||{}).parentNode;
}
if(!parent||parent===_doc$1||!parent.appendChild){
parent=_doc$1.body;
}
cache=parent._gsap;
if(cache&&toPercent&&cache.width&&horizontal&&cache.time===_ticker.time){
return _round(curValue / cache.width * amount);
}else{
(toPercent||curUnit==="%")&&(style.position=_getComputedProperty(target, "position"));
parent===target&&(style.position="static");
parent.appendChild(_tempDiv);
px=_tempDiv[measureProperty];
parent.removeChild(_tempDiv);
style.position="absolute";
if(horizontal&&toPercent){
cache=_getCache(parent);
cache.time=_ticker.time;
cache.width=parent[measureProperty];
}}
return _round(toPixels ? px * curValue / amount:px&&curValue ? amount / px * curValue:0);
},
_get=function _get(target, property, unit, uncache){
var value;
_pluginInitted||_initCore();
if(property in _propertyAliases&&property!=="transform"){
property=_propertyAliases[property];
if(~property.indexOf(",")){
property=property.split(",")[0];
}}
if(_transformProps[property]&&property!=="transform"){
value=_parseTransform(target, uncache);
value=property!=="transformOrigin" ? value[property]:_firstTwoOnly(_getComputedProperty(target, _transformOriginProp)) + " " + value.zOrigin + "px";
}else{
value=target.style[property];
if(!value||value==="auto"||uncache||~(value + "").indexOf("calc(")){
value=_specialProps[property]&&_specialProps[property](target, property, unit)||_getComputedProperty(target, property)||_getProperty(target, property)||(property==="opacity" ? 1:0);
}}
return unit&&!~(value + "").trim().indexOf(" ") ? _convertToUnit(target, property, value, unit) + unit:value;
},
_tweenComplexCSSString=function _tweenComplexCSSString(target, prop, start, end){
if(!start||start==="none"){
var p=_checkPropPrefix(prop, target, 1),
s=p&&_getComputedProperty(target, p, 1);
if(s&&s!==start){
prop=p;
start=s;
}else if(prop==="borderColor"){
start=_getComputedProperty(target, "borderTopColor");
}}
var pt=new PropTween(this._pt, target.style, prop, 0, 1, _renderComplexString),
index=0,
matchIndex=0,
a,
result,
startValues,
startNum,
color,
startValue,
endValue,
endNum,
chunk,
endUnit,
startUnit,
relative,
endValues;
pt.b=start;
pt.e=end;
start +="";
end +="";
if(end==="auto"){
target.style[prop]=end;
end=_getComputedProperty(target, prop)||end;
target.style[prop]=start;
}
a=[start, end];
_colorStringFilter(a);
start=a[0];
end=a[1];
startValues=start.match(_numWithUnitExp)||[];
endValues=end.match(_numWithUnitExp)||[];
if(endValues.length){
while (result=_numWithUnitExp.exec(end)){
endValue=result[0];
chunk=end.substring(index, result.index);
if(color){
color=(color + 1) % 5;
}else if(chunk.substr(-5)==="rgba("||chunk.substr(-5)==="hsla("){
color=1;
}
if(endValue!==(startValue=startValues[matchIndex++]||"")){
startNum=parseFloat(startValue)||0;
startUnit=startValue.substr((startNum + "").length);
relative=endValue.charAt(1)==="=" ? +(endValue.charAt(0) + "1"):0;
if(relative){
endValue=endValue.substr(2);
}
endNum=parseFloat(endValue);
endUnit=endValue.substr((endNum + "").length);
index=_numWithUnitExp.lastIndex - endUnit.length;
if(!endUnit){
endUnit=endUnit||_config.units[prop]||startUnit;
if(index===end.length){
end +=endUnit;
pt.e +=endUnit;
}}
if(startUnit!==endUnit){
startNum=_convertToUnit(target, prop, startValue, endUnit)||0;
}
pt._pt={
_next: pt._pt,
p: chunk||matchIndex===1 ? chunk:",",
s: startNum,
c: relative ? relative * endNum:endNum - startNum,
m: color&&color < 4||prop==="zIndex" ? Math.round:0
};}}
pt.c=index < end.length ? end.substring(index, end.length):"";
}else{
pt.r=prop==="display"&&end==="none" ? _renderNonTweeningValueOnlyAtEnd:_renderNonTweeningValue;
}
_relExp.test(end)&&(pt.e=0);
this._pt=pt;
return pt;
},
_keywordToPercent={
top: "0%",
bottom: "100%",
left: "0%",
right: "100%",
center: "50%"
},
_convertKeywordsToPercentages=function _convertKeywordsToPercentages(value){
var split=value.split(" "),
x=split[0],
y=split[1]||"50%";
if(x==="top"||x==="bottom"||y==="left"||y==="right"){
value=x;
x=y;
y=value;
}
split[0]=_keywordToPercent[x]||x;
split[1]=_keywordToPercent[y]||y;
return split.join(" ");
},
_renderClearProps=function _renderClearProps(ratio, data){
if(data.tween&&data.tween._time===data.tween._dur){
var target=data.t,
style=target.style,
props=data.u,
cache=target._gsap,
prop,
clearTransforms,
i;
if(props==="all"||props===true){
style.cssText="";
clearTransforms=1;
}else{
props=props.split(",");
i=props.length;
while (--i > -1){
prop=props[i];
if(_transformProps[prop]){
clearTransforms=1;
prop=prop==="transformOrigin" ? _transformOriginProp:_transformProp;
}
_removeProperty(target, prop);
}}
if(clearTransforms){
_removeProperty(target, _transformProp);
if(cache){
cache.svg&&target.removeAttribute("transform");
_parseTransform(target, 1);
cache.uncache=1;
}}
}},
_specialProps={
clearProps: function clearProps(plugin, target, property, endValue, tween){
if(tween.data!=="isFromStart"){
var pt=plugin._pt=new PropTween(plugin._pt, target, property, 0, 0, _renderClearProps);
pt.u=endValue;
pt.pr=-10;
pt.tween=tween;
plugin._props.push(property);
return 1;
}}
},
_identity2DMatrix=[1, 0, 0, 1, 0, 0],
_rotationalProperties={},
_isNullTransform=function _isNullTransform(value){
return value==="matrix(1, 0, 0, 1, 0, 0)"||value==="none"||!value;
},
_getComputedTransformMatrixAsArray=function _getComputedTransformMatrixAsArray(target){
var matrixString=_getComputedProperty(target, _transformProp);
return _isNullTransform(matrixString) ? _identity2DMatrix:matrixString.substr(7).match(_numExp).map(_round);
},
_getMatrix=function _getMatrix(target, force2D){
var cache=target._gsap||_getCache(target),
style=target.style,
matrix=_getComputedTransformMatrixAsArray(target),
parent,
nextSibling,
temp,
addedToDOM;
if(cache.svg&&target.getAttribute("transform")){
temp=target.transform.baseVal.consolidate().matrix;
matrix=[temp.a, temp.b, temp.c, temp.d, temp.e, temp.f];
return matrix.join(",")==="1,0,0,1,0,0" ? _identity2DMatrix:matrix;
}else if(matrix===_identity2DMatrix&&!target.offsetParent&&target!==_docElement&&!cache.svg){
temp=style.display;
style.display="block";
parent=target.parentNode;
if(!parent||!target.offsetParent){
addedToDOM=1;
nextSibling=target.nextSibling;
_docElement.appendChild(target);
}
matrix=_getComputedTransformMatrixAsArray(target);
temp ? style.display=temp:_removeProperty(target, "display");
if(addedToDOM){
nextSibling ? parent.insertBefore(target, nextSibling):parent ? parent.appendChild(target):_docElement.removeChild(target);
}}
return force2D&&matrix.length > 6 ? [matrix[0], matrix[1], matrix[4], matrix[5], matrix[12], matrix[13]]:matrix;
},
_applySVGOrigin=function _applySVGOrigin(target, origin, originIsAbsolute, smooth, matrixArray, pluginToAddPropTweensTo){
var cache=target._gsap,
matrix=matrixArray||_getMatrix(target, true),
xOriginOld=cache.xOrigin||0,
yOriginOld=cache.yOrigin||0,
xOffsetOld=cache.xOffset||0,
yOffsetOld=cache.yOffset||0,
a=matrix[0],
b=matrix[1],
c=matrix[2],
d=matrix[3],
tx=matrix[4],
ty=matrix[5],
originSplit=origin.split(" "),
xOrigin=parseFloat(originSplit[0])||0,
yOrigin=parseFloat(originSplit[1])||0,
bounds,
determinant,
x,
y;
if(!originIsAbsolute){
bounds=_getBBox(target);
xOrigin=bounds.x + (~originSplit[0].indexOf("%") ? xOrigin / 100 * bounds.width:xOrigin);
yOrigin=bounds.y + (~(originSplit[1]||originSplit[0]).indexOf("%") ? yOrigin / 100 * bounds.height:yOrigin);
}else if(matrix!==_identity2DMatrix&&(determinant=a * d - b * c)){
x=xOrigin * (d / determinant) + yOrigin * (-c / determinant) + (c * ty - d * tx) / determinant;
y=xOrigin * (-b / determinant) + yOrigin * (a / determinant) - (a * ty - b * tx) / determinant;
xOrigin=x;
yOrigin=y;
}
if(smooth||smooth!==false&&cache.smooth){
tx=xOrigin - xOriginOld;
ty=yOrigin - yOriginOld;
cache.xOffset=xOffsetOld + (tx * a + ty * c) - tx;
cache.yOffset=yOffsetOld + (tx * b + ty * d) - ty;
}else{
cache.xOffset=cache.yOffset=0;
}
cache.xOrigin=xOrigin;
cache.yOrigin=yOrigin;
cache.smooth = !!smooth;
cache.origin=origin;
cache.originIsAbsolute = !!originIsAbsolute;
target.style[_transformOriginProp]="0px 0px";
if(pluginToAddPropTweensTo){
_addNonTweeningPT(pluginToAddPropTweensTo, cache, "xOrigin", xOriginOld, xOrigin);
_addNonTweeningPT(pluginToAddPropTweensTo, cache, "yOrigin", yOriginOld, yOrigin);
_addNonTweeningPT(pluginToAddPropTweensTo, cache, "xOffset", xOffsetOld, cache.xOffset);
_addNonTweeningPT(pluginToAddPropTweensTo, cache, "yOffset", yOffsetOld, cache.yOffset);
}
target.setAttribute("data-svg-origin", xOrigin + " " + yOrigin);
},
_parseTransform=function _parseTransform(target, uncache){
var cache=target._gsap||new GSCache(target);
if("x" in cache&&!uncache&&!cache.uncache){
return cache;
}
var style=target.style,
invertedScaleX=cache.scaleX < 0,
px="px",
deg="deg",
origin=_getComputedProperty(target, _transformOriginProp)||"0",
x,
y,
z,
scaleX,
scaleY,
rotation,
rotationX,
rotationY,
skewX,
skewY,
perspective,
xOrigin,
yOrigin,
matrix,
angle,
cos,
sin,
a,
b,
c,
d,
a12,
a22,
t1,
t2,
t3,
a13,
a23,
a33,
a42,
a43,
a32;
x=y = z=rotation=rotationX=rotationY=skewX=skewY=perspective=0;
scaleX=scaleY=1;
cache.svg = !!(target.getCTM&&_isSVG(target));
matrix=_getMatrix(target, cache.svg);
if(cache.svg){
t1 = !cache.uncache&&!uncache&&target.getAttribute("data-svg-origin");
_applySVGOrigin(target, t1||origin, !!t1||cache.originIsAbsolute, cache.smooth!==false, matrix);
}
xOrigin=cache.xOrigin||0;
yOrigin=cache.yOrigin||0;
if(matrix!==_identity2DMatrix){
a=matrix[0];
b=matrix[1];
c=matrix[2];
d=matrix[3];
x=a12=matrix[4];
y=a22=matrix[5];
if(matrix.length===6){
scaleX=Math.sqrt(a * a + b * b);
scaleY=Math.sqrt(d * d + c * c);
rotation=a||b ? _atan2(b, a) * _RAD2DEG:0;
skewX=c||d ? _atan2(c, d) * _RAD2DEG + rotation:0;
skewX&&(scaleY *=Math.abs(Math.cos(skewX * _DEG2RAD)));
if(cache.svg){
x -=xOrigin - (xOrigin * a + yOrigin * c);
y -=yOrigin - (xOrigin * b + yOrigin * d);
}}else{
a32=matrix[6];
a42=matrix[7];
a13=matrix[8];
a23=matrix[9];
a33=matrix[10];
a43=matrix[11];
x=matrix[12];
y=matrix[13];
z=matrix[14];
angle=_atan2(a32, a33);
rotationX=angle * _RAD2DEG;
if(angle){
cos=Math.cos(-angle);
sin=Math.sin(-angle);
t1=a12 * cos + a13 * sin;
t2=a22 * cos + a23 * sin;
t3=a32 * cos + a33 * sin;
a13=a12 * -sin + a13 * cos;
a23=a22 * -sin + a23 * cos;
a33=a32 * -sin + a33 * cos;
a43=a42 * -sin + a43 * cos;
a12=t1;
a22=t2;
a32=t3;
}
angle=_atan2(-c, a33);
rotationY=angle * _RAD2DEG;
if(angle){
cos=Math.cos(-angle);
sin=Math.sin(-angle);
t1=a * cos - a13 * sin;
t2=b * cos - a23 * sin;
t3=c * cos - a33 * sin;
a43=d * sin + a43 * cos;
a=t1;
b=t2;
c=t3;
}
angle=_atan2(b, a);
rotation=angle * _RAD2DEG;
if(angle){
cos=Math.cos(angle);
sin=Math.sin(angle);
t1=a * cos + b * sin;
t2=a12 * cos + a22 * sin;
b=b * cos - a * sin;
a22=a22 * cos - a12 * sin;
a=t1;
a12=t2;
}
if(rotationX&&Math.abs(rotationX) + Math.abs(rotation) > 359.9){
rotationX=rotation=0;
rotationY=180 - rotationY;
}
scaleX=_round(Math.sqrt(a * a + b * b + c * c));
scaleY=_round(Math.sqrt(a22 * a22 + a32 * a32));
angle=_atan2(a12, a22);
skewX=Math.abs(angle) > 0.0002 ? angle * _RAD2DEG:0;
perspective=a43 ? 1 / (a43 < 0 ? -a43:a43):0;
}
if(cache.svg){
t1=target.getAttribute("transform");
cache.forceCSS=target.setAttribute("transform", "")||!_isNullTransform(_getComputedProperty(target, _transformProp));
t1&&target.setAttribute("transform", t1);
}}
if(Math.abs(skewX) > 90&&Math.abs(skewX) < 270){
if(invertedScaleX){
scaleX *=-1;
skewX +=rotation <=0 ? 180:-180;
rotation +=rotation <=0 ? 180:-180;
}else{
scaleY *=-1;
skewX +=skewX <=0 ? 180:-180;
}}
cache.x=x - ((cache.xPercent=x&&(cache.xPercent||(Math.round(target.offsetWidth / 2)===Math.round(-x) ? -50:0))) ? target.offsetWidth * cache.xPercent / 100:0) + px;
cache.y=y - ((cache.yPercent=y&&(cache.yPercent||(Math.round(target.offsetHeight / 2)===Math.round(-y) ? -50:0))) ? target.offsetHeight * cache.yPercent / 100:0) + px;
cache.z=z + px;
cache.scaleX=_round(scaleX);
cache.scaleY=_round(scaleY);
cache.rotation=_round(rotation) + deg;
cache.rotationX=_round(rotationX) + deg;
cache.rotationY=_round(rotationY) + deg;
cache.skewX=skewX + deg;
cache.skewY=skewY + deg;
cache.transformPerspective=perspective + px;
if(cache.zOrigin=parseFloat(origin.split(" ")[2])||0){
style[_transformOriginProp]=_firstTwoOnly(origin);
}
cache.xOffset=cache.yOffset=0;
cache.force3D=_config.force3D;
cache.renderTransform=cache.svg ? _renderSVGTransforms:_supports3D ? _renderCSSTransforms:_renderNon3DTransforms;
cache.uncache=0;
return cache;
},
_firstTwoOnly=function _firstTwoOnly(value){
return (value=value.split(" "))[0] + " " + value[1];
},
_addPxTranslate=function _addPxTranslate(target, start, value){
var unit=getUnit(start);
return _round(parseFloat(start) + parseFloat(_convertToUnit(target, "x", value + "px", unit))) + unit;
},
_renderNon3DTransforms=function _renderNon3DTransforms(ratio, cache){
cache.z="0px";
cache.rotationY=cache.rotationX="0deg";
cache.force3D=0;
_renderCSSTransforms(ratio, cache);
},
_zeroDeg="0deg",
_zeroPx="0px",
_endParenthesis=") ",
_renderCSSTransforms=function _renderCSSTransforms(ratio, cache){
var _ref=cache||this,
xPercent=_ref.xPercent,
yPercent=_ref.yPercent,
x=_ref.x,
y=_ref.y,
z=_ref.z,
rotation=_ref.rotation,
rotationY=_ref.rotationY,
rotationX=_ref.rotationX,
skewX=_ref.skewX,
skewY=_ref.skewY,
scaleX=_ref.scaleX,
scaleY=_ref.scaleY,
transformPerspective=_ref.transformPerspective,
force3D=_ref.force3D,
target=_ref.target,
zOrigin=_ref.zOrigin,
transforms="",
use3D=force3D==="auto"&&ratio&&ratio!==1||force3D===true;
if(zOrigin&&(rotationX!==_zeroDeg||rotationY!==_zeroDeg)){
var angle=parseFloat(rotationY) * _DEG2RAD,
a13=Math.sin(angle),
a33=Math.cos(angle),
cos;
angle=parseFloat(rotationX) * _DEG2RAD;
cos=Math.cos(angle);
x=_addPxTranslate(target, x, a13 * cos * -zOrigin);
y=_addPxTranslate(target, y, -Math.sin(angle) * -zOrigin);
z=_addPxTranslate(target, z, a33 * cos * -zOrigin + zOrigin);
}
if(transformPerspective!==_zeroPx){
transforms +="perspective(" + transformPerspective + _endParenthesis;
}
if(xPercent||yPercent){
transforms +="translate(" + xPercent + "%, " + yPercent + "%) ";
}
if(use3D||x!==_zeroPx||y!==_zeroPx||z!==_zeroPx){
transforms +=z!==_zeroPx||use3D ? "translate3d(" + x + ", " + y + ", " + z + ") ":"translate(" + x + ", " + y + _endParenthesis;
}
if(rotation!==_zeroDeg){
transforms +="rotate(" + rotation + _endParenthesis;
}
if(rotationY!==_zeroDeg){
transforms +="rotateY(" + rotationY + _endParenthesis;
}
if(rotationX!==_zeroDeg){
transforms +="rotateX(" + rotationX + _endParenthesis;
}
if(skewX!==_zeroDeg||skewY!==_zeroDeg){
transforms +="skew(" + skewX + ", " + skewY + _endParenthesis;
}
if(scaleX!==1||scaleY!==1){
transforms +="scale(" + scaleX + ", " + scaleY + _endParenthesis;
}
target.style[_transformProp]=transforms||"translate(0, 0)";
},
_renderSVGTransforms=function _renderSVGTransforms(ratio, cache){
var _ref2=cache||this,
xPercent=_ref2.xPercent,
yPercent=_ref2.yPercent,
x=_ref2.x,
y=_ref2.y,
rotation=_ref2.rotation,
skewX=_ref2.skewX,
skewY=_ref2.skewY,
scaleX=_ref2.scaleX,
scaleY=_ref2.scaleY,
target=_ref2.target,
xOrigin=_ref2.xOrigin,
yOrigin=_ref2.yOrigin,
xOffset=_ref2.xOffset,
yOffset=_ref2.yOffset,
forceCSS=_ref2.forceCSS,
tx=parseFloat(x),
ty=parseFloat(y),
a11,
a21,
a12,
a22,
temp;
rotation=parseFloat(rotation);
skewX=parseFloat(skewX);
skewY=parseFloat(skewY);
if(skewY){
skewY=parseFloat(skewY);
skewX +=skewY;
rotation +=skewY;
}
if(rotation||skewX){
rotation *=_DEG2RAD;
skewX *=_DEG2RAD;
a11=Math.cos(rotation) * scaleX;
a21=Math.sin(rotation) * scaleX;
a12=Math.sin(rotation - skewX) * -scaleY;
a22=Math.cos(rotation - skewX) * scaleY;
if(skewX){
skewY *=_DEG2RAD;
temp=Math.tan(skewX - skewY);
temp=Math.sqrt(1 + temp * temp);
a12 *=temp;
a22 *=temp;
if(skewY){
temp=Math.tan(skewY);
temp=Math.sqrt(1 + temp * temp);
a11 *=temp;
a21 *=temp;
}}
a11=_round(a11);
a21=_round(a21);
a12=_round(a12);
a22=_round(a22);
}else{
a11=scaleX;
a22=scaleY;
a21=a12=0;
}
if(tx&&!~(x + "").indexOf("px")||ty&&!~(y + "").indexOf("px")){
tx=_convertToUnit(target, "x", x, "px");
ty=_convertToUnit(target, "y", y, "px");
}
if(xOrigin||yOrigin||xOffset||yOffset){
tx=_round(tx + xOrigin - (xOrigin * a11 + yOrigin * a12) + xOffset);
ty=_round(ty + yOrigin - (xOrigin * a21 + yOrigin * a22) + yOffset);
}
if(xPercent||yPercent){
temp=target.getBBox();
tx=_round(tx + xPercent / 100 * temp.width);
ty=_round(ty + yPercent / 100 * temp.height);
}
temp="matrix(" + a11 + "," + a21 + "," + a12 + "," + a22 + "," + tx + "," + ty + ")";
target.setAttribute("transform", temp);
forceCSS&&(target.style[_transformProp]=temp);
},
_addRotationalPropTween=function _addRotationalPropTween(plugin, target, property, startNum, endValue, relative){
var cap=360,
isString=_isString(endValue),
endNum=parseFloat(endValue) * (isString&&~endValue.indexOf("rad") ? _RAD2DEG:1),
change=relative ? endNum * relative:endNum - startNum,
finalValue=startNum + change + "deg",
direction,
pt;
if(isString){
direction=endValue.split("_")[1];
if(direction==="short"){
change %=cap;
if(change!==change % (cap / 2)){
change +=change < 0 ? cap:-cap;
}}
if(direction==="cw"&&change < 0){
change=(change + cap * _bigNum$1) % cap - ~~(change / cap) * cap;
}else if(direction==="ccw"&&change > 0){
change=(change - cap * _bigNum$1) % cap - ~~(change / cap) * cap;
}}
plugin._pt=pt=new PropTween(plugin._pt, target, property, startNum, change, _renderPropWithEnd);
pt.e=finalValue;
pt.u="deg";
plugin._props.push(property);
return pt;
},
_assign=function _assign(target, source){
for (var p in source){
target[p]=source[p];
}
return target;
},
_addRawTransformPTs=function _addRawTransformPTs(plugin, transforms, target){
var startCache=_assign({}, target._gsap),
exclude="perspective,force3D,transformOrigin,svgOrigin",
style=target.style,
endCache,
p,
startValue,
endValue,
startNum,
endNum,
startUnit,
endUnit;
if(startCache.svg){
startValue=target.getAttribute("transform");
target.setAttribute("transform", "");
style[_transformProp]=transforms;
endCache=_parseTransform(target, 1);
_removeProperty(target, _transformProp);
target.setAttribute("transform", startValue);
}else{
startValue=getComputedStyle(target)[_transformProp];
style[_transformProp]=transforms;
endCache=_parseTransform(target, 1);
style[_transformProp]=startValue;
}
for (p in _transformProps){
startValue=startCache[p];
endValue=endCache[p];
if(startValue!==endValue&&exclude.indexOf(p) < 0){
startUnit=getUnit(startValue);
endUnit=getUnit(endValue);
startNum=startUnit!==endUnit ? _convertToUnit(target, p, startValue, endUnit):parseFloat(startValue);
endNum=parseFloat(endValue);
plugin._pt=new PropTween(plugin._pt, endCache, p, startNum, endNum - startNum, _renderCSSProp);
plugin._pt.u=endUnit||0;
plugin._props.push(p);
}}
_assign(endCache, startCache);
};
_forEachName("padding,margin,Width,Radius", function (name, index){
var t="Top",
r="Right",
b="Bottom",
l="Left",
props=(index < 3 ? [t, r, b, l]:[t + l, t + r, b + r, b + l]).map(function (side){
return index < 2 ? name + side:"border" + side + name;
});
_specialProps[index > 1 ? "border" + name:name]=function (plugin, target, property, endValue, tween){
var a, vars;
if(arguments.length < 4){
a=props.map(function (prop){
return _get(plugin, prop, property);
});
vars=a.join(" ");
return vars.split(a[0]).length===5 ? a[0]:vars;
}
a=(endValue + "").split(" ");
vars={};
props.forEach(function (prop, i){
return vars[prop]=a[i]=a[i]||a[(i - 1) / 2 | 0];
});
plugin.init(target, vars, tween);
};});
var CSSPlugin={
name: "css",
register: _initCore,
targetTest: function targetTest(target){
return target.style&&target.nodeType;
},
init: function init(target, vars, tween, index, targets){
var props=this._props,
style=target.style,
startAt=tween.vars.startAt,
startValue,
endValue,
endNum,
startNum,
type,
specialProp,
p,
startUnit,
endUnit,
relative,
isTransformRelated,
transformPropTween,
cache,
smooth,
hasPriority;
_pluginInitted||_initCore();
for (p in vars){
if(p==="autoRound"){
continue;
}
endValue=vars[p];
if(_plugins[p]&&_checkPlugin(p, vars, tween, index, target, targets)){
continue;
}
type=typeof endValue;
specialProp=_specialProps[p];
if(type==="function"){
endValue=endValue.call(tween, index, target, targets);
type=typeof endValue;
}
if(type==="string"&&~endValue.indexOf("random(")){
endValue=_replaceRandom(endValue);
}
if(specialProp){
specialProp(this, target, p, endValue, tween)&&(hasPriority=1);
}else if(p.substr(0, 2)==="--"){
startValue=(getComputedStyle(target).getPropertyValue(p) + "").trim();
endValue +="";
_colorExp.lastIndex=0;
if(!_colorExp.test(startValue)){
startUnit=getUnit(startValue);
endUnit=getUnit(endValue);
}
endUnit ? startUnit!==endUnit&&(startValue=_convertToUnit(target, p, startValue, endUnit) + endUnit):startUnit&&(endValue +=startUnit);
this.add(style, "setProperty", startValue, endValue, index, targets, 0, 0, p);
}else if(type!=="undefined"){
if(startAt&&p in startAt){
startValue=typeof startAt[p]==="function" ? startAt[p].call(tween, index, target, targets):startAt[p];
p in _config.units&&!getUnit(startValue)&&(startValue +=_config.units[p]);
(startValue + "").charAt(1)==="="&&(startValue=_get(target, p));
}else{
startValue=_get(target, p);
}
startNum=parseFloat(startValue);
relative=type==="string"&&endValue.charAt(1)==="=" ? +(endValue.charAt(0) + "1"):0;
relative&&(endValue=endValue.substr(2));
endNum=parseFloat(endValue);
if(p in _propertyAliases){
if(p==="autoAlpha"){
if(startNum===1&&_get(target, "visibility")==="hidden"&&endNum){
startNum=0;
}
_addNonTweeningPT(this, style, "visibility", startNum ? "inherit":"hidden", endNum ? "inherit":"hidden", !endNum);
}
if(p!=="scale"&&p!=="transform"){
p=_propertyAliases[p];
~p.indexOf(",")&&(p=p.split(",")[0]);
}}
isTransformRelated=p in _transformProps;
if(isTransformRelated){
if(!transformPropTween){
cache=target._gsap;
cache.renderTransform&&!vars.parseTransform||_parseTransform(target, vars.parseTransform);
smooth=vars.smoothOrigin!==false&&cache.smooth;
transformPropTween=this._pt=new PropTween(this._pt, style, _transformProp, 0, 1, cache.renderTransform, cache, 0, -1);
transformPropTween.dep=1;
}
if(p==="scale"){
this._pt=new PropTween(this._pt, cache, "scaleY", cache.scaleY, relative ? relative * endNum:endNum - cache.scaleY);
props.push("scaleY", p);
p +="X";
}else if(p==="transformOrigin"){
endValue=_convertKeywordsToPercentages(endValue);
if(cache.svg){
_applySVGOrigin(target, endValue, 0, smooth, 0, this);
}else{
endUnit=parseFloat(endValue.split(" ")[2])||0;
endUnit!==cache.zOrigin&&_addNonTweeningPT(this, cache, "zOrigin", cache.zOrigin, endUnit);
_addNonTweeningPT(this, style, p, _firstTwoOnly(startValue), _firstTwoOnly(endValue));
}
continue;
}else if(p==="svgOrigin"){
_applySVGOrigin(target, endValue, 1, smooth, 0, this);
continue;
}else if(p in _rotationalProperties){
_addRotationalPropTween(this, cache, p, startNum, endValue, relative);
continue;
}else if(p==="smoothOrigin"){
_addNonTweeningPT(this, cache, "smooth", cache.smooth, endValue);
continue;
}else if(p==="force3D"){
cache[p]=endValue;
continue;
}else if(p==="transform"){
_addRawTransformPTs(this, endValue, target);
continue;
}}else if(!(p in style)){
p=_checkPropPrefix(p)||p;
}
if(isTransformRelated||(endNum||endNum===0)&&(startNum||startNum===0)&&!_complexExp.test(endValue)&&p in style){
startUnit=(startValue + "").substr((startNum + "").length);
endNum||(endNum=0);
endUnit=getUnit(endValue)||(p in _config.units ? _config.units[p]:startUnit);
startUnit!==endUnit&&(startNum=_convertToUnit(target, p, startValue, endUnit));
this._pt=new PropTween(this._pt, isTransformRelated ? cache:style, p, startNum, relative ? relative * endNum:endNum - startNum, !isTransformRelated&&(endUnit==="px"||p==="zIndex")&&vars.autoRound!==false ? _renderRoundedCSSProp:_renderCSSProp);
this._pt.u=endUnit||0;
if(startUnit!==endUnit){
this._pt.b=startValue;
this._pt.r=_renderCSSPropWithBeginning;
}}else if(!(p in style)){
if(p in target){
this.add(target, p, target[p], endValue, index, targets);
}else{
_missingPlugin(p, endValue);
continue;
}}else{
_tweenComplexCSSString.call(this, target, p, startValue, endValue);
}
props.push(p);
}}
hasPriority&&_sortPropTweensByPriority(this);
},
get: _get,
aliases: _propertyAliases,
getSetter: function getSetter(target, property, plugin){
var p=_propertyAliases[property];
p&&p.indexOf(",") < 0&&(property=p);
return property in _transformProps&&property!==_transformOriginProp&&(target._gsap.x||_get(target, "x")) ? plugin&&_recentSetterPlugin===plugin ? property==="scale" ? _setterScale:_setterTransform:(_recentSetterPlugin=plugin||{})&&(property==="scale" ? _setterScaleWithRender:_setterTransformWithRender):target.style&&!_isUndefined(target.style[property]) ? _setterCSSStyle:~property.indexOf("-") ? _setterCSSProp:_getSetter(target, property);
},
core: {
_removeProperty: _removeProperty,
_getMatrix: _getMatrix
}};
gsap.utils.checkPrefix=_checkPropPrefix;
(function (positionAndScale, rotation, others, aliases){
var all=_forEachName(positionAndScale + "," + rotation + "," + others, function (name){
_transformProps[name]=1;
});
_forEachName(rotation, function (name){
_config.units[name]="deg";
_rotationalProperties[name]=1;
});
_propertyAliases[all[13]]=positionAndScale + "," + rotation;
_forEachName(aliases, function (name){
var split=name.split(":");
_propertyAliases[split[1]]=all[split[0]];
});
})("x,y,z,scale,scaleX,scaleY,xPercent,yPercent", "rotation,rotationX,rotationY,skewX,skewY", "transform,transformOrigin,svgOrigin,force3D,smoothOrigin,transformPerspective", "0:translateX,1:translateY,2:translateZ,8:rotate,8:rotationZ,8:rotateZ,9:rotateX,10:rotateY");
_forEachName("x,y,z,top,right,bottom,left,width,height,fontSize,padding,margin,perspective", function (name){
_config.units[name]="px";
});
gsap.registerPlugin(CSSPlugin);
var gsapWithCSS=gsap.registerPlugin(CSSPlugin)||gsap,
TweenMaxWithCSS=gsapWithCSS.core.Tween;
exports.Back=Back;
exports.Bounce=Bounce;
exports.CSSPlugin=CSSPlugin;
exports.Circ=Circ;
exports.Cubic=Cubic;
exports.Elastic=Elastic;
exports.Expo=Expo;
exports.Linear=Linear;
exports.Power0=Power0;
exports.Power1=Power1;
exports.Power2=Power2;
exports.Power3=Power3;
exports.Power4=Power4;
exports.Quad=Quad;
exports.Quart=Quart;
exports.Quint=Quint;
exports.Sine=Sine;
exports.SteppedEase=SteppedEase;
exports.Strong=Strong;
exports.TimelineLite=Timeline;
exports.TimelineMax=Timeline;
exports.TweenLite=Tween;
exports.TweenMax=TweenMaxWithCSS;
exports.default=gsapWithCSS;
exports.gsap=gsapWithCSS;
if(typeof(window)==='undefined'||window!==exports){Object.defineProperty(exports, '__esModule', { value: true });}else{delete window.default;}})));
(function(window, $){
'use strict';
var counter=0,
$headCache=$('head'),
oldBigText=window.BigText,
oldjQueryMethod=$.fn.bigtext,
BigText={
DEBUG_MODE: false,
DEFAULT_MIN_FONT_SIZE_PX: null,
DEFAULT_MAX_FONT_SIZE_PX: 528,
GLOBAL_STYLE_ID: 'bigtext-style',
STYLE_ID: 'bigtext-id',
LINE_CLASS_PREFIX: 'bigtext-line',
EXEMPT_CLASS: 'bigtext-exempt',
noConflict: function(restore){
if(restore){
$.fn.bigtext=oldjQueryMethod;
window.BigText=oldBigText;
}
return BigText;
},
supports: {
wholeNumberFontSizeOnly: (function(){
if(!('getComputedStyle' in window)){
return true;
}
var test=$('
').css({
position: 'absolute',
'font-size': '14.1px'
}).insertBefore($('script').eq(0)),
computedStyle=window.getComputedStyle(test[0], null);
var ret=computedStyle&&computedStyle.getPropertyValue('font-size')==='14px';
test.remove();
return ret;
})()
},
init: function(){
if(!$('#'+BigText.GLOBAL_STYLE_ID).length){
$headCache.append(BigText.generateStyleTag(BigText.GLOBAL_STYLE_ID, ['.bigtext * { white-space: nowrap; } .bigtext > * { display: block; }',
'.bigtext .' + BigText.EXEMPT_CLASS + ', .bigtext .' + BigText.EXEMPT_CLASS + ' * { white-space: normal; }']));
}},
bindResize: function(eventName, resizeFunction){
var timeoutId;
$(window).unbind(eventName).bind(eventName, function(){
if(timeoutId){
clearTimeout(timeoutId);
}
timeoutId=setTimeout(resizeFunction, 300);
});
},
getStyleId: function(id){
return BigText.STYLE_ID + '-' + id;
},
generateStyleTag: function(id, css){
return $('').attr('id', id);
},
clearCss: function(id){
var styleId=BigText.getStyleId(id);
$('#' + styleId).remove();
},
generateCss: function(id, linesFontSizes, lineWordSpacings, minFontSizes){
var css=[];
BigText.clearCss(id);
for(var j=0, k=linesFontSizes.length; j=maxWidth){
$line.css(property, '');
if(width===maxWidth){
return {
match: 'exact',
size: parseFloat((parseFloat(size) - 0.1).toFixed(3))
};}
var under=maxWidth - previousWidth,
over=width - maxWidth;
return {
match: 'estimate',
size: parseFloat((parseFloat(size) - (property==='word-spacing'&&previousWidth&&(over < under) ? 0:interval)).toFixed(3))
};}
return width;
}
function calculateSizes($t, $children, maxWidth, maxFontSize, minFontSize){
var $c=$t.clone(true)
.addClass('bigtext-cloned')
.css({
fontFamily: $t.css('font-family'),
textTransform: $t.css('text-transform'),
wordSpacing: $t.css('word-spacing'),
letterSpacing: $t.css('letter-spacing'),
position: 'absolute',
left: BigText.DEBUG_MODE ? 0:-9999,
top: BigText.DEBUG_MODE ? 0:-9999
})
.appendTo(document.body);
var fontSizes=[],
wordSpacings=[],
minFontSizes=[],
ratios=[];
$children.css('float', 'left').each(function(){
var $line=$(this),
intervals=BigText.supports.wholeNumberFontSizeOnly ? [8, 4, 1]:[8, 4, 1, 0.1],
lineMax,
newFontSize;
if($line.hasClass(BigText.EXEMPT_CLASS)){
fontSizes.push(null);
ratios.push(null);
minFontSizes.push(false);
return;
}
var autoGuessSubtraction=32,
currentFontSize=parseFloat($line.css('font-size')),
ratio=($line.width() / currentFontSize).toFixed(6);
newFontSize=parseInt(maxWidth / ratio, 10) - autoGuessSubtraction;
outer: for(var m=0, n=intervals.length; m maxFontSize){
newFontSize=maxFontSize;
break outer;
}
lineMax=testLineDimensions($line, maxWidth, 'font-size', newFontSize + j*intervals[m], intervals[m], 'px', lineMax);
if(typeof lineMax!=='number'){
newFontSize=lineMax.size;
if(lineMax.match==='exact'){
break outer;
}
break inner;
}}
}
ratios.push(maxWidth / newFontSize);
if(newFontSize > maxFontSize){
fontSizes.push(maxFontSize);
minFontSizes.push(false);
}else if(!!minFontSize&&newFontSize < minFontSize){
fontSizes.push(minFontSize);
minFontSizes.push(true);
}else{
fontSizes.push(newFontSize);
minFontSizes.push(false);
}}).each(function(lineNumber){
var $line=$(this),
wordSpacing=0,
interval=1,
maxWordSpacing;
if($line.hasClass(BigText.EXEMPT_CLASS)){
wordSpacings.push(null);
return;
}
$line.css('font-size', fontSizes[lineNumber] + 'px');
for(var m=1, n=3; m 1&&col + colSpan > this.cols;
col=isOver ? 0:col;
var hasSize=item.size.outerWidth&&item.size.outerHeight;
this.horizontalColIndex=hasSize ? col + colSpan:this.horizontalColIndex;
return {
col: col,
y: this._getColGroupY(col, colSpan),
};};
proto._manageStamp=function(stamp){
var stampSize=getSize(stamp);
var offset=this._getElementOffset(stamp);
var isOriginLeft=this._getOption('originLeft');
var firstX=isOriginLeft ? offset.left:offset.right;
var lastX=firstX + stampSize.outerWidth;
var firstCol=Math.floor(firstX / this.columnWidth);
firstCol=Math.max(0, firstCol);
var lastCol=Math.floor(lastX / this.columnWidth);
lastCol -=lastX % this.columnWidth ? 0:1;
lastCol=Math.min(this.cols - 1, lastCol);
var isOriginTop=this._getOption('originTop');
var stampMaxY=(isOriginTop ? offset.top:offset.bottom) +
stampSize.outerHeight;
for(var i=firstCol; i <=lastCol; i++){
this.colYs[i]=Math.max(stampMaxY, this.colYs[i]);
}};
proto._getContainerSize=function(){
this.maxY=Math.max.apply(Math, this.colYs);
var size={
height: this.maxY
};
if(this._getOption('fitWidth')){
size.width=this._getContainerFitWidth();
}
return size;
};
proto._getContainerFitWidth=function(){
var unusedCols=0;
var i=this.cols;
while(--i){
if(this.colYs[i]!==0){
break;
}
unusedCols++;
}
return(this.cols - unusedCols) * this.columnWidth - this.gutter;
};
proto.needsResizeLayout=function(){
var previousWidth=this.containerWidth;
this.getContainerWidth();
return previousWidth!=this.containerWidth;
};
return Masonry;
}));
(function(window, factory){
if(typeof define=='function'&&define.amd){
define('isotope-layout/js/layout-modes/masonry',[
'../layout-mode',
'masonry-layout/masonry'
],
factory);
}else if(typeof module=='object'&&module.exports){
module.exports=factory(
require('../layout-mode'),
require('masonry-layout')
);
}else{
factory(
window.Isotope.LayoutMode,
window.Masonry
);
}}(window, function factory(LayoutMode, Masonry){
'use strict';
var MasonryMode=LayoutMode.create('masonry');
var proto=MasonryMode.prototype;
var keepModeMethods={
_getElementOffset: true,
layout: true,
_getMeasurement: true
};
for(var method in Masonry.prototype){
if(!keepModeMethods[ method ]){
proto[ method ]=Masonry.prototype[ method ];
}}
var measureColumns=proto.measureColumns;
proto.measureColumns=function(){
this.items=this.isotope.filteredItems;
measureColumns.call(this);
};
var _getOption=proto._getOption;
proto._getOption=function(option){
if(option=='fitWidth'){
return this.options.isFitWidth!==undefined ?
this.options.isFitWidth:this.options.fitWidth;
}
return _getOption.apply(this.isotope, arguments);
};
return MasonryMode;
}));
(function(window, factory){
if(typeof define=='function'&&define.amd){
define('isotope-layout/js/layout-modes/fit-rows',[
'../layout-mode'
],
factory);
}else if(typeof exports=='object'){
module.exports=factory(
require('../layout-mode')
);
}else{
factory(
window.Isotope.LayoutMode
);
}}(window, function factory(LayoutMode){
'use strict';
var FitRows=LayoutMode.create('fitRows');
var proto=FitRows.prototype;
proto._resetLayout=function(){
this.x=0;
this.y=0;
this.maxY=0;
this._getMeasurement('gutter', 'outerWidth');
};
proto._getItemLayoutPosition=function(item){
item.getSize();
var itemWidth=item.size.outerWidth + this.gutter;
var containerWidth=this.isotope.size.innerWidth + this.gutter;
if(this.x!==0&&itemWidth + this.x > containerWidth){
this.x=0;
this.y=this.maxY;
}
var position={
x: this.x,
y: this.y
};
this.maxY=Math.max(this.maxY, this.y + item.size.outerHeight);
this.x +=itemWidth;
return position;
};
proto._getContainerSize=function(){
return { height: this.maxY };};
return FitRows;
}));
(function(window, factory){
if(typeof define=='function'&&define.amd){
define('isotope-layout/js/layout-modes/vertical',[
'../layout-mode'
],
factory);
}else if(typeof module=='object'&&module.exports){
module.exports=factory(
require('../layout-mode')
);
}else{
factory(
window.Isotope.LayoutMode
);
}}(window, function factory(LayoutMode){
'use strict';
var Vertical=LayoutMode.create('vertical', {
horizontalAlignment: 0
});
var proto=Vertical.prototype;
proto._resetLayout=function(){
this.y=0;
};
proto._getItemLayoutPosition=function(item){
item.getSize();
var x=(this.isotope.size.innerWidth - item.size.outerWidth) *
this.options.horizontalAlignment;
var y=this.y;
this.y +=item.size.outerHeight;
return { x: x, y: y };};
proto._getContainerSize=function(){
return { height: this.y };};
return Vertical;
}));
(function(window, factory){
if(typeof define=='function'&&define.amd){
define([
'outlayer/outlayer',
'get-size/get-size',
'desandro-matches-selector/matches-selector',
'fizzy-ui-utils/utils',
'isotope-layout/js/item',
'isotope-layout/js/layout-mode',
'isotope-layout/js/layout-modes/masonry',
'isotope-layout/js/layout-modes/fit-rows',
'isotope-layout/js/layout-modes/vertical'
],
function(Outlayer, getSize, matchesSelector, utils, Item, LayoutMode){
return factory(window, Outlayer, getSize, matchesSelector, utils, Item, LayoutMode);
});
}else if(typeof module=='object'&&module.exports){
module.exports=factory(
window,
require('outlayer'),
require('get-size'),
require('desandro-matches-selector'),
require('fizzy-ui-utils'),
require('isotope-layout/js/item'),
require('isotope-layout/js/layout-mode'),
require('isotope-layout/js/layout-modes/masonry'),
require('isotope-layout/js/layout-modes/fit-rows'),
require('isotope-layout/js/layout-modes/vertical')
);
}else{
window.Isotope=factory(
window,
window.Outlayer,
window.getSize,
window.matchesSelector,
window.fizzyUIUtils,
window.Isotope.Item,
window.Isotope.LayoutMode
);
}}(window, function factory(window, Outlayer, getSize, matchesSelector, utils,
Item, LayoutMode){
var jQuery=window.jQuery;
var trim=String.prototype.trim ?
function(str){
return str.trim();
} :
function(str){
return str.replace(/^\s+|\s+$/g, '');
};
var Isotope=Outlayer.create('isotope', {
layoutMode: 'masonry',
isJQueryFiltering: true,
sortAscending: true
});
Isotope.Item=Item;
Isotope.LayoutMode=LayoutMode;
var proto=Isotope.prototype;
proto._create=function(){
this.itemGUID=0;
this._sorters={};
this._getSorters();
Outlayer.prototype._create.call(this);
this.modes={};
this.filteredItems=this.items;
this.sortHistory=[ 'original-order' ];
for(var name in LayoutMode.modes){
this._initLayoutMode(name);
}};
proto.reloadItems=function(){
this.itemGUID=0;
Outlayer.prototype.reloadItems.call(this);
};
proto._itemize=function(){
var items=Outlayer.prototype._itemize.apply(this, arguments);
for(var i=0; i < items.length; i++){
var item=items[i];
item.id=this.itemGUID++;
}
this._updateItemsSortData(items);
return items;
};
proto._initLayoutMode=function(name){
var Mode=LayoutMode.modes[ name ];
var initialOpts=this.options[ name ]||{};
this.options[ name ]=Mode.options ?
utils.extend(Mode.options, initialOpts):initialOpts;
this.modes[ name ]=new Mode(this);
};
proto.layout=function(){
if(!this._isLayoutInited&&this._getOption('initLayout')){
this.arrange();
return;
}
this._layout();
};
proto._layout=function(){
var isInstant=this._getIsInstant();
this._resetLayout();
this._manageStamps();
this.layoutItems(this.filteredItems, isInstant);
this._isLayoutInited=true;
};
proto.arrange=function(opts){
this.option(opts);
this._getIsInstant();
var filtered=this._filter(this.items);
this.filteredItems=filtered.matches;
this._bindArrangeComplete();
if(this._isInstant){
this._noTransition(this._hideReveal, [ filtered ]);
}else{
this._hideReveal(filtered);
}
this._sort();
this._layout();
};
proto._init=proto.arrange;
proto._hideReveal=function(filtered){
this.reveal(filtered.needReveal);
this.hide(filtered.needHide);
};
proto._getIsInstant=function(){
var isLayoutInstant=this._getOption('layoutInstant');
var isInstant=isLayoutInstant!==undefined ? isLayoutInstant :
!this._isLayoutInited;
this._isInstant=isInstant;
return isInstant;
};
proto._bindArrangeComplete=function(){
var isLayoutComplete, isHideComplete, isRevealComplete;
var _this=this;
function arrangeParallelCallback(){
if(isLayoutComplete&&isHideComplete&&isRevealComplete){
_this.dispatchEvent('arrangeComplete', null, [ _this.filteredItems ]);
}}
this.once('layoutComplete', function(){
isLayoutComplete=true;
arrangeParallelCallback();
});
this.once('hideComplete', function(){
isHideComplete=true;
arrangeParallelCallback();
});
this.once('revealComplete', function(){
isRevealComplete=true;
arrangeParallelCallback();
});
};
proto._filter=function(items){
var filter=this.options.filter;
filter=filter||'*';
var matches=[];
var hiddenMatched=[];
var visibleUnmatched=[];
var test=this._getFilterTest(filter);
for(var i=0; i < items.length; i++){
var item=items[i];
if(item.isIgnored){
continue;
}
var isMatched=test(item);
if(isMatched){
matches.push(item);
}
if(isMatched&&item.isHidden){
hiddenMatched.push(item);
}else if(!isMatched&&!item.isHidden){
visibleUnmatched.push(item);
}}
return {
matches: matches,
needReveal: hiddenMatched,
needHide: visibleUnmatched
};};
proto._getFilterTest=function(filter){
if(jQuery&&this.options.isJQueryFiltering){
return function(item){
return jQuery(item.element).is(filter);
};}
if(typeof filter=='function'){
return function(item){
return filter(item.element);
};}
return function(item){
return matchesSelector(item.element, filter);
};};
proto.updateSortData=function(elems){
var items;
if(elems){
elems=utils.makeArray(elems);
items=this.getItems(elems);
}else{
items=this.items;
}
this._getSorters();
this._updateItemsSortData(items);
};
proto._getSorters=function(){
var getSortData=this.options.getSortData;
for(var key in getSortData){
var sorter=getSortData[ key ];
this._sorters[ key ]=mungeSorter(sorter);
}};
proto._updateItemsSortData=function(items){
var len=items&&items.length;
for(var i=0; len&&i < len; i++){
var item=items[i];
item.updateSortData();
}};
var mungeSorter=(function(){
function mungeSorter(sorter){
if(typeof sorter!='string'){
return sorter;
}
var args=trim(sorter).split(' ');
var query=args[0];
var attrMatch=query.match(/^\[(.+)\]$/);
var attr=attrMatch&&attrMatch[1];
var getValue=getValueGetter(attr, query);
var parser=Isotope.sortDataParsers[ args[1] ];
sorter=parser ? function(elem){
return elem&&parser(getValue(elem));
} :
function(elem){
return elem&&getValue(elem);
};
return sorter;
}
function getValueGetter(attr, query){
if(attr){
return function getAttribute(elem){
return elem.getAttribute(attr);
};}
return function getChildText(elem){
var child=elem.querySelector(query);
return child&&child.textContent;
};}
return mungeSorter;
})();
Isotope.sortDataParsers={
'parseInt': function(val){
return parseInt(val, 10);
},
'parseFloat': function(val){
return parseFloat(val);
}};
proto._sort=function(){
if(!this.options.sortBy){
return;
}
var sortBys=utils.makeArray(this.options.sortBy);
if(!this._getIsSameSortBy(sortBys)){
this.sortHistory=sortBys.concat(this.sortHistory);
}
var itemSorter=getItemSorter(this.sortHistory, this.options.sortAscending);
this.filteredItems.sort(itemSorter);
};
proto._getIsSameSortBy=function(sortBys){
for(var i=0; i < sortBys.length; i++){
if(sortBys[i]!=this.sortHistory[i]){
return false;
}}
return true;
};
function getItemSorter(sortBys, sortAsc){
return function sorter(itemA, itemB){
for(var i=0; i < sortBys.length; i++){
var sortBy=sortBys[i];
var a=itemA.sortData[ sortBy ];
var b=itemB.sortData[ sortBy ];
if(a > b||a < b){
var isAscending=sortAsc[ sortBy ]!==undefined ? sortAsc[ sortBy ]:sortAsc;
var direction=isAscending ? 1:-1;
return(a > b ? 1:-1) * direction;
}}
return 0;
};}
proto._mode=function(){
var layoutMode=this.options.layoutMode;
var mode=this.modes[ layoutMode ];
if(!mode){
throw new Error('No layout mode: ' + layoutMode);
}
mode.options=this.options[ layoutMode ];
return mode;
};
proto._resetLayout=function(){
Outlayer.prototype._resetLayout.call(this);
this._mode()._resetLayout();
};
proto._getItemLayoutPosition=function(item){
return this._mode()._getItemLayoutPosition(item);
};
proto._manageStamp=function(stamp){
this._mode()._manageStamp(stamp);
};
proto._getContainerSize=function(){
return this._mode()._getContainerSize();
};
proto.needsResizeLayout=function(){
return this._mode().needsResizeLayout();
};
proto.appended=function(elems){
var items=this.addItems(elems);
if(!items.length){
return;
}
var filteredItems=this._filterRevealAdded(items);
this.filteredItems=this.filteredItems.concat(filteredItems);
};
proto.prepended=function(elems){
var items=this._itemize(elems);
if(!items.length){
return;
}
this._resetLayout();
this._manageStamps();
var filteredItems=this._filterRevealAdded(items);
this.layoutItems(this.filteredItems);
this.filteredItems=filteredItems.concat(this.filteredItems);
this.items=items.concat(this.items);
};
proto._filterRevealAdded=function(items){
var filtered=this._filter(items);
this.hide(filtered.needHide);
this.reveal(filtered.matches);
this.layoutItems(filtered.matches, true);
return filtered.matches;
};
proto.insert=function(elems){
var items=this.addItems(elems);
if(!items.length){
return;
}
var i, item;
var len=items.length;
for(i=0; i < len; i++){
item=items[i];
this.element.appendChild(item.element);
}
var filteredInsertItems=this._filter(items).matches;
for(i=0; i < len; i++){
items[i].isLayoutInstant=true;
}
this.arrange();
for(i=0; i < len; i++){
delete items[i].isLayoutInstant;
}
this.reveal(filteredInsertItems);
};
var _remove=proto.remove;
proto.remove=function(elems){
elems=utils.makeArray(elems);
var removeItems=this.getItems(elems);
_remove.call(this, elems);
var len=removeItems&&removeItems.length;
for(var i=0; len&&i < len; i++){
var item=removeItems[i];
utils.removeFrom(this.filteredItems, item);
}};
proto.shuffle=function(){
for(var i=0; i < this.items.length; i++){
var item=this.items[i];
item.sortData.random=Math.random();
}
this.options.sortBy='random';
this._sort();
this._layout();
};
proto._noTransition=function(fn, args){
var transitionDuration=this.options.transitionDuration;
this.options.transitionDuration=0;
var returnValue=fn.apply(this, args);
this.options.transitionDuration=transitionDuration;
return returnValue;
};
proto.getFilteredItemElements=function(){
return this.filteredItems.map(function(item){
return item.element;
});
};
return Isotope;
}));
(function(window, factory){
if(typeof define=='function'&&define.amd){
define('packery/js/rect',factory);
}else if(typeof module=='object'&&module.exports){
module.exports=factory();
}else{
window.Packery=window.Packery||{};
window.Packery.Rect=factory();
}}(window, function factory(){
function Rect(props){
for(var prop in Rect.defaults){
this[ prop ]=Rect.defaults[ prop ];
}
for(prop in props){
this[ prop ]=props[ prop ];
}}
Rect.defaults={
x: 0,
y: 0,
width: 0,
height: 0
};
var proto=Rect.prototype;
proto.contains=function(rect){
var otherWidth=rect.width||0;
var otherHeight=rect.height||0;
return this.x <=rect.x &&
this.y <=rect.y &&
this.x + this.width >=rect.x + otherWidth &&
this.y + this.height >=rect.y + otherHeight;
};
proto.overlaps=function(rect){
var thisRight=this.x + this.width;
var thisBottom=this.y + this.height;
var rectRight=rect.x + rect.width;
var rectBottom=rect.y + rect.height;
return this.x < rectRight &&
thisRight > rect.x &&
this.y < rectBottom &&
thisBottom > rect.y;
};
proto.getMaximalFreeRects=function(rect){
if(!this.overlaps(rect)){
return false;
}
var freeRects=[];
var freeRect;
var thisRight=this.x + this.width;
var thisBottom=this.y + this.height;
var rectRight=rect.x + rect.width;
var rectBottom=rect.y + rect.height;
if(this.y < rect.y){
freeRect=new Rect({
x: this.x,
y: this.y,
width: this.width,
height: rect.y - this.y
});
freeRects.push(freeRect);
}
if(thisRight > rectRight){
freeRect=new Rect({
x: rectRight,
y: this.y,
width: thisRight - rectRight,
height: this.height
});
freeRects.push(freeRect);
}
if(thisBottom > rectBottom){
freeRect=new Rect({
x: this.x,
y: rectBottom,
width: this.width,
height: thisBottom - rectBottom
});
freeRects.push(freeRect);
}
if(this.x < rect.x){
freeRect=new Rect({
x: this.x,
y: this.y,
width: rect.x - this.x,
height: this.height
});
freeRects.push(freeRect);
}
return freeRects;
};
proto.canFit=function(rect){
return this.width >=rect.width&&this.height >=rect.height;
};
return Rect;
}));
(function(window, factory){
if(typeof define=='function'&&define.amd){
define('packery/js/packer',[ './rect' ], factory);
}else if(typeof module=='object'&&module.exports){
module.exports=factory(
require('./rect')
);
}else{
var Packery=window.Packery=window.Packery||{};
Packery.Packer=factory(Packery.Rect);
}}(window, function factory(Rect){
function Packer(width, height, sortDirection){
this.width=width||0;
this.height=height||0;
this.sortDirection=sortDirection||'downwardLeftToRight';
this.reset();
}
var proto=Packer.prototype;
proto.reset=function(){
this.spaces=[];
var initialSpace=new Rect({
x: 0,
y: 0,
width: this.width,
height: this.height
});
this.spaces.push(initialSpace);
this.sorter=sorters[ this.sortDirection ]||sorters.downwardLeftToRight;
};
proto.pack=function(rect){
for(var i=0; i < this.spaces.length; i++){
var space=this.spaces[i];
if(space.canFit(rect)){
this.placeInSpace(rect, space);
break;
}}
};
proto.columnPack=function(rect){
for(var i=0; i < this.spaces.length; i++){
var space=this.spaces[i];
var canFitInSpaceColumn=space.x <=rect.x &&
space.x + space.width >=rect.x + rect.width &&
space.height >=rect.height - 0.01;
if(canFitInSpaceColumn){
rect.y=space.y;
this.placed(rect);
break;
}}
};
proto.rowPack=function(rect){
for(var i=0; i < this.spaces.length; i++){
var space=this.spaces[i];
var canFitInSpaceRow=space.y <=rect.y &&
space.y + space.height >=rect.y + rect.height &&
space.width >=rect.width - 0.01;
if(canFitInSpaceRow){
rect.x=space.x;
this.placed(rect);
break;
}}
};
proto.placeInSpace=function(rect, space){
rect.x=space.x;
rect.y=space.y;
this.placed(rect);
};
proto.placed=function(rect){
var revisedSpaces=[];
for(var i=0; i < this.spaces.length; i++){
var space=this.spaces[i];
var newSpaces=space.getMaximalFreeRects(rect);
if(newSpaces){
revisedSpaces.push.apply(revisedSpaces, newSpaces);
}else{
revisedSpaces.push(space);
}}
this.spaces=revisedSpaces;
this.mergeSortSpaces();
};
proto.mergeSortSpaces=function(){
Packer.mergeRects(this.spaces);
this.spaces.sort(this.sorter);
};
proto.addSpace=function(rect){
this.spaces.push(rect);
this.mergeSortSpaces();
};
Packer.mergeRects=function(rects){
var i=0;
var rect=rects[i];
rectLoop:
while(rect){
var j=0;
var compareRect=rects[ i + j ];
while(compareRect){
if(compareRect==rect){
j++;
}else if(compareRect.contains(rect)){
rects.splice(i, 1);
rect=rects[i];
continue rectLoop;
}else if(rect.contains(compareRect)){
rects.splice(i + j, 1);
}else{
j++;
}
compareRect=rects[ i + j ];
}
i++;
rect=rects[i];
}
return rects;
};
var sorters={
downwardLeftToRight: function(a, b){
return a.y - b.y||a.x - b.x;
},
rightwardTopToBottom: function(a, b){
return a.x - b.x||a.y - b.y;
}};
return Packer;
}));
(function(window, factory){
if(typeof define=='function'&&define.amd){
define('packery/js/item',[
'outlayer/outlayer',
'./rect'
],
factory);
}else if(typeof module=='object'&&module.exports){
module.exports=factory(
require('outlayer'),
require('./rect')
);
}else{
window.Packery.Item=factory(
window.Outlayer,
window.Packery.Rect
);
}}(window, function factory(Outlayer, Rect){
var docElemStyle=document.documentElement.style;
var transformProperty=typeof docElemStyle.transform=='string' ?
'transform':'WebkitTransform';
var Item=function PackeryItem(){
Outlayer.Item.apply(this, arguments);
};
var proto=Item.prototype=Object.create(Outlayer.Item.prototype);
var __create=proto._create;
proto._create=function(){
__create.call(this);
this.rect=new Rect();
};
var _moveTo=proto.moveTo;
proto.moveTo=function(x, y){
var dx=Math.abs(this.position.x - x);
var dy=Math.abs(this.position.y - y);
var canHackGoTo=this.layout.dragItemCount&&!this.isPlacing &&
!this.isTransitioning&&dx < 1&&dy < 1;
if(canHackGoTo){
this.goTo(x, y);
return;
}
_moveTo.apply(this, arguments);
};
proto.enablePlacing=function(){
this.removeTransitionStyles();
if(this.isTransitioning&&transformProperty){
this.element.style[ transformProperty ]='none';
}
this.isTransitioning=false;
this.getSize();
this.layout._setRectSize(this.element, this.rect);
this.isPlacing=true;
};
proto.disablePlacing=function(){
this.isPlacing=false;
};
proto.removeElem=function(){
this.element.parentNode.removeChild(this.element);
this.layout.packer.addSpace(this.rect);
this.emitEvent('remove', [ this ]);
};
proto.showDropPlaceholder=function(){
var dropPlaceholder=this.dropPlaceholder;
if(!dropPlaceholder){
dropPlaceholder=this.dropPlaceholder=document.createElement('div');
dropPlaceholder.className='packery-drop-placeholder';
dropPlaceholder.style.position='absolute';
}
dropPlaceholder.style.width=this.size.width + 'px';
dropPlaceholder.style.height=this.size.height + 'px';
this.positionDropPlaceholder();
this.layout.element.appendChild(dropPlaceholder);
};
proto.positionDropPlaceholder=function(){
this.dropPlaceholder.style[ transformProperty ]='translate(' +
this.rect.x + 'px, ' + this.rect.y + 'px)';
};
proto.hideDropPlaceholder=function(){
this.layout.element.removeChild(this.dropPlaceholder);
};
return Item;
}));
(function(window, factory){
if(typeof define=='function'&&define.amd){
define('packery/js/packery',[
'get-size/get-size',
'outlayer/outlayer',
'./rect',
'./packer',
'./item'
],
factory);
}else if(typeof module=='object'&&module.exports){
module.exports=factory(
require('get-size'),
require('outlayer'),
require('./rect'),
require('./packer'),
require('./item')
);
}else{
window.Packery=factory(
window.getSize,
window.Outlayer,
window.Packery.Rect,
window.Packery.Packer,
window.Packery.Item
);
}}(window, function factory(getSize, Outlayer, Rect, Packer, Item){
Rect.prototype.canFit=function(rect){
return this.width >=rect.width - 1&&this.height >=rect.height - 1;
};
var Packery=Outlayer.create('packery');
Packery.Item=Item;
var proto=Packery.prototype;
proto._create=function(){
Outlayer.prototype._create.call(this);
this.packer=new Packer();
this.shiftPacker=new Packer();
this.isEnabled=true;
this.dragItemCount=0;
var _this=this;
this.handleDraggabilly={
dragStart: function(){
_this.itemDragStart(this.element);
},
dragMove: function(){
_this.itemDragMove(this.element, this.position.x, this.position.y);
},
dragEnd: function(){
_this.itemDragEnd(this.element);
}};
this.handleUIDraggable={
start: function handleUIDraggableStart(event, ui){
if(!ui){
return;
}
_this.itemDragStart(event.currentTarget);
},
drag: function handleUIDraggableDrag(event, ui){
if(!ui){
return;
}
_this.itemDragMove(event.currentTarget, ui.position.left, ui.position.top);
},
stop: function handleUIDraggableStop(event, ui){
if(!ui){
return;
}
_this.itemDragEnd(event.currentTarget);
}};};
proto._resetLayout=function(){
this.getSize();
this._getMeasurements();
var width, height, sortDirection;
if(this._getOption('horizontal')){
width=Infinity;
height=this.size.innerHeight + this.gutter;
sortDirection='rightwardTopToBottom';
}else{
width=this.size.innerWidth + this.gutter;
height=Infinity;
sortDirection='downwardLeftToRight';
}
this.packer.width=this.shiftPacker.width=width;
this.packer.height=this.shiftPacker.height=height;
this.packer.sortDirection=this.shiftPacker.sortDirection=sortDirection;
this.packer.reset();
this.maxY=0;
this.maxX=0;
};
proto._getMeasurements=function(){
this._getMeasurement('columnWidth', 'width');
this._getMeasurement('rowHeight', 'height');
this._getMeasurement('gutter', 'width');
};
proto._getItemLayoutPosition=function(item){
this._setRectSize(item.element, item.rect);
if(this.isShifting||this.dragItemCount > 0){
var packMethod=this._getPackMethod();
this.packer[ packMethod ](item.rect);
}else{
this.packer.pack(item.rect);
}
this._setMaxXY(item.rect);
return item.rect;
};
proto.shiftLayout=function(){
this.isShifting=true;
this.layout();
delete this.isShifting;
};
proto._getPackMethod=function(){
return this._getOption('horizontal') ? 'rowPack':'columnPack';
};
proto._setMaxXY=function(rect){
this.maxX=Math.max(rect.x + rect.width, this.maxX);
this.maxY=Math.max(rect.y + rect.height, this.maxY);
};
proto._setRectSize=function(elem, rect){
var size=getSize(elem);
var w=size.outerWidth;
var h=size.outerHeight;
if(w||h){
w=this._applyGridGutter(w, this.columnWidth);
h=this._applyGridGutter(h, this.rowHeight);
}
rect.width=Math.min(w, this.packer.width);
rect.height=Math.min(h, this.packer.height);
};
proto._applyGridGutter=function(measurement, gridSize){
if(!gridSize){
return measurement + this.gutter;
}
gridSize +=this.gutter;
var remainder=measurement % gridSize;
var mathMethod=remainder&&remainder < 1 ? 'round':'ceil';
measurement=Math[ mathMethod ](measurement / gridSize) * gridSize;
return measurement;
};
proto._getContainerSize=function(){
if(this._getOption('horizontal')){
return {
width: this.maxX - this.gutter
};}else{
return {
height: this.maxY - this.gutter
};}};
proto._manageStamp=function(elem){
var item=this.getItem(elem);
var rect;
if(item&&item.isPlacing){
rect=item.rect;
}else{
var offset=this._getElementOffset(elem);
rect=new Rect({
x: this._getOption('originLeft') ? offset.left:offset.right,
y: this._getOption('originTop') ? offset.top:offset.bottom
});
}
this._setRectSize(elem, rect);
this.packer.placed(rect);
this._setMaxXY(rect);
};
function verticalSorter(a, b){
return a.position.y - b.position.y||a.position.x - b.position.x;
}
function horizontalSorter(a, b){
return a.position.x - b.position.x||a.position.y - b.position.y;
}
proto.sortItemsByPosition=function(){
var sorter=this._getOption('horizontal') ? horizontalSorter:verticalSorter;
this.items.sort(sorter);
};
proto.fit=function(elem, x, y){
var item=this.getItem(elem);
if(!item){
return;
}
this.stamp(item.element);
item.enablePlacing();
this.updateShiftTargets(item);
x=x===undefined ? item.rect.x: x;
y=y===undefined ? item.rect.y: y;
this.shift(item, x, y);
this._bindFitEvents(item);
item.moveTo(item.rect.x, item.rect.y);
this.shiftLayout();
this.unstamp(item.element);
this.sortItemsByPosition();
item.disablePlacing();
};
proto._bindFitEvents=function(item){
var _this=this;
var ticks=0;
function onLayout(){
ticks++;
if(ticks!=2){
return;
}
_this.dispatchEvent('fitComplete', null, [ item ]);
}
item.once('layout', onLayout);
this.once('layoutComplete', onLayout);
};
proto.resize=function(){
if(!this.isResizeBound||!this.needsResizeLayout()){
return;
}
if(this.options.shiftPercentResize){
this.resizeShiftPercentLayout();
}else{
this.layout();
}};
proto.needsResizeLayout=function(){
var size=getSize(this.element);
var innerSize=this._getOption('horizontal') ? 'innerHeight':'innerWidth';
return size[ innerSize ]!=this.size[ innerSize ];
};
proto.resizeShiftPercentLayout=function(){
var items=this._getItemsForLayout(this.items);
var isHorizontal=this._getOption('horizontal');
var coord=isHorizontal ? 'y':'x';
var measure=isHorizontal ? 'height':'width';
var segmentName=isHorizontal ? 'rowHeight':'columnWidth';
var innerSize=isHorizontal ? 'innerHeight':'innerWidth';
var previousSegment=this[ segmentName ];
previousSegment=previousSegment&&previousSegment + this.gutter;
if(previousSegment){
this._getMeasurements();
var currentSegment=this[ segmentName ] + this.gutter;
items.forEach(function(item){
var seg=Math.round(item.rect[ coord ] / previousSegment);
item.rect[ coord ]=seg * currentSegment;
});
}else{
var currentSize=getSize(this.element)[ innerSize ] + this.gutter;
var previousSize=this.packer[ measure ];
items.forEach(function(item){
item.rect[ coord ]=(item.rect[ coord ] / previousSize) * currentSize;
});
}
this.shiftLayout();
};
proto.itemDragStart=function(elem){
if(!this.isEnabled){
return;
}
this.stamp(elem);
var item=this.getItem(elem);
if(!item){
return;
}
item.enablePlacing();
item.showDropPlaceholder();
this.dragItemCount++;
this.updateShiftTargets(item);
};
proto.updateShiftTargets=function(dropItem){
this.shiftPacker.reset();
this._getBoundingRect();
var isOriginLeft=this._getOption('originLeft');
var isOriginTop=this._getOption('originTop');
this.stamps.forEach(function(stamp){
var item=this.getItem(stamp);
if(item&&item.isPlacing){
return;
}
var offset=this._getElementOffset(stamp);
var rect=new Rect({
x: isOriginLeft ? offset.left:offset.right,
y: isOriginTop ? offset.top:offset.bottom
});
this._setRectSize(stamp, rect);
this.shiftPacker.placed(rect);
}, this);
var isHorizontal=this._getOption('horizontal');
var segmentName=isHorizontal ? 'rowHeight':'columnWidth';
var measure=isHorizontal ? 'height':'width';
this.shiftTargetKeys=[];
this.shiftTargets=[];
var boundsSize;
var segment=this[ segmentName ];
segment=segment&&segment + this.gutter;
if(segment){
var segmentSpan=Math.ceil(dropItem.rect[ measure ] / segment);
var segs=Math.floor(( this.shiftPacker[ measure ] + this.gutter) / segment);
boundsSize=(segs - segmentSpan) * segment;
for(var i=0; i < segs; i++){
this._addShiftTarget(i * segment, 0, boundsSize);
}}else{
boundsSize=(this.shiftPacker[ measure ] + this.gutter) - dropItem.rect[ measure ];
this._addShiftTarget(0, 0, boundsSize);
}
var items=this._getItemsForLayout(this.items);
var packMethod=this._getPackMethod();
items.forEach(function(item){
var rect=item.rect;
this._setRectSize(item.element, rect);
this.shiftPacker[ packMethod ](rect);
this._addShiftTarget(rect.x, rect.y, boundsSize);
var cornerX=isHorizontal ? rect.x + rect.width:rect.x;
var cornerY=isHorizontal ? rect.y:rect.y + rect.height;
this._addShiftTarget(cornerX, cornerY, boundsSize);
if(segment){
var segSpan=Math.round(rect[ measure ] / segment);
for(var i=1; i < segSpan; i++){
var segX=isHorizontal ? cornerX:rect.x + segment * i;
var segY=isHorizontal ? rect.y + segment * i:cornerY;
this._addShiftTarget(segX, segY, boundsSize);
}}
}, this);
};
proto._addShiftTarget=function(x, y, boundsSize){
var checkCoord=this._getOption('horizontal') ? y:x;
if(checkCoord!==0&&checkCoord > boundsSize){
return;
}
var key=x + ',' + y;
var hasKey=this.shiftTargetKeys.indexOf(key)!=-1;
if(hasKey){
return;
}
this.shiftTargetKeys.push(key);
this.shiftTargets.push({ x: x, y: y });
};
proto.shift=function(item, x, y){
var shiftPosition;
var minDistance=Infinity;
var position={ x: x, y: y };
this.shiftTargets.forEach(function(target){
var distance=getDistance(target, position);
if(distance < minDistance){
shiftPosition=target;
minDistance=distance;
}});
item.rect.x=shiftPosition.x;
item.rect.y=shiftPosition.y;
};
function getDistance(a, b){
var dx=b.x - a.x;
var dy=b.y - a.y;
return Math.sqrt(dx * dx + dy * dy);
}
var DRAG_THROTTLE_TIME=120;
proto.itemDragMove=function(elem, x, y){
var item=this.isEnabled&&this.getItem(elem);
if(!item){
return;
}
x -=this.size.paddingLeft;
y -=this.size.paddingTop;
var _this=this;
function onDrag(){
_this.shift(item, x, y);
item.positionDropPlaceholder();
_this.layout();
}
var now=new Date();
if(this._itemDragTime&&now - this._itemDragTime < DRAG_THROTTLE_TIME){
clearTimeout(this.dragTimeout);
this.dragTimeout=setTimeout(onDrag, DRAG_THROTTLE_TIME);
}else{
onDrag();
this._itemDragTime=now;
}};
proto.itemDragEnd=function(elem){
var item=this.isEnabled&&this.getItem(elem);
if(!item){
return;
}
clearTimeout(this.dragTimeout);
item.element.classList.add('is-positioning-post-drag');
var completeCount=0;
var _this=this;
function onDragEndLayoutComplete(){
completeCount++;
if(completeCount!=2){
return;
}
item.element.classList.remove('is-positioning-post-drag');
item.hideDropPlaceholder();
_this.dispatchEvent('dragItemPositioned', null, [ item ]);
}
item.once('layout', onDragEndLayoutComplete);
this.once('layoutComplete', onDragEndLayoutComplete);
item.moveTo(item.rect.x, item.rect.y);
this.layout();
this.dragItemCount=Math.max(0, this.dragItemCount - 1);
this.sortItemsByPosition();
item.disablePlacing();
this.unstamp(item.element);
};
proto.bindDraggabillyEvents=function(draggie){
this._bindDraggabillyEvents(draggie, 'on');
};
proto.unbindDraggabillyEvents=function(draggie){
this._bindDraggabillyEvents(draggie, 'off');
};
proto._bindDraggabillyEvents=function(draggie, method){
var handlers=this.handleDraggabilly;
draggie[ method ]('dragStart', handlers.dragStart);
draggie[ method ]('dragMove', handlers.dragMove);
draggie[ method ]('dragEnd', handlers.dragEnd);
};
proto.bindUIDraggableEvents=function($elems){
this._bindUIDraggableEvents($elems, 'on');
};
proto.unbindUIDraggableEvents=function($elems){
this._bindUIDraggableEvents($elems, 'off');
};
proto._bindUIDraggableEvents=function($elems, method){
var handlers=this.handleUIDraggable;
$elems
[ method ]('dragstart', handlers.start)
[ method ]('drag', handlers.drag)
[ method ]('dragstop', handlers.stop);
};
var _destroy=proto.destroy;
proto.destroy=function(){
_destroy.apply(this, arguments);
this.isEnabled=false;
};
Packery.Rect=Rect;
Packery.Packer=Packer;
return Packery;
}));
(function(window, factory){
if(typeof define=='function'&&define.amd){
define([
'isotope-layout/js/layout-mode',
'packery/js/packery'
],
factory);
}else if(typeof module=='object'&&module.exports){
module.exports=factory(
require('isotope-layout/js/layout-mode'),
require('packery')
);
}else{
factory(
window.Isotope.LayoutMode,
window.Packery
);
}}(window, function factor(LayoutMode, Packery){
var PackeryMode=LayoutMode.create('packery');
var proto=PackeryMode.prototype;
var keepModeMethods={
_getElementOffset: true,
_getMeasurement: true
};
for(var method in Packery.prototype){
if(!keepModeMethods[ method ]){
proto[ method ]=Packery.prototype[ method ];
}}
var _resetLayout=proto._resetLayout;
proto._resetLayout=function(){
this.packer=this.packer||new Packery.Packer();
this.shiftPacker=this.shiftPacker||new Packery.Packer();
_resetLayout.apply(this, arguments);
};
var _getItemLayoutPosition=proto._getItemLayoutPosition;
proto._getItemLayoutPosition=function(item){
item.rect=item.rect||new Packery.Rect();
return _getItemLayoutPosition.call(this, item);
};
var _needsResizeLayout=proto.needsResizeLayout;
proto.needsResizeLayout=function(){
if(this._getOption('horizontal')){
return this.needsVerticalResizeLayout();
}else{
return _needsResizeLayout.call(this);
}};
var _getOption=proto._getOption;
proto._getOption=function(option){
if(option=='horizontal'){
return this.options.isHorizontal!==undefined ?
this.options.isHorizontal:this.options.horizontal;
}
return _getOption.apply(this.isotope, arguments);
};
return PackeryMode;
}));
(function(window, factory){
if(typeof define==='function'&&define.amd){
define([
'isotope/js/layout-mode'
],
factory);
}else if(typeof exports==='object'){
module.exports=factory(
require('isotope-layout/js/layout-mode')
);
}else{
factory(
window.Isotope.LayoutMode
);
}}(window, function factory(LayoutMode){
'use strict';
var CellsByRow=LayoutMode.create('cellsByRow');
var proto=CellsByRow.prototype;
proto._resetLayout=function(){
this.itemIndex=0;
this.getColumnWidth();
this.getRowHeight();
this.cols=Math.floor(this.isotope.size.innerWidth / this.columnWidth);
this.cols=Math.max(this.cols, 1);
};
proto._getItemLayoutPosition=function(item){
item.getSize();
var col=this.itemIndex % this.cols;
var row=Math.floor(this.itemIndex / this.cols);
var x=(col + 0.5) * this.columnWidth - item.size.outerWidth / 2;
var y=(row + 0.5) * this.rowHeight - item.size.outerHeight / 2;
this.itemIndex++;
return { x: x, y: y };};
proto._getContainerSize=function(){
return {
height: Math.ceil(this.itemIndex / this.cols) * this.rowHeight
};};
return CellsByRow;
}));
(function (factory){
if(typeof define==='function'&&define.amd){
define(['jquery'], factory);
}else{
factory(jQuery);
}}(function ($, undefined){
'use strict';
$.infinitescroll=function infscr(options, callback, element){
this.element=$(element);
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+RBIGCB4yAjpmQhZN0YGYGXitdZBIVGAsLoq4BBKQDswm1CQRkcG6ytrYKubq8vbfAcMK9v7q7EMO1ycrHvsW6zcTKsczNz8HZw9vG3cjTsMIYqQkCLBwHCgsMDQ4RDAYIqfYSFxDxEfz88/X38Onr16+Bp4ADCco7eC8hQYMAEe57yNCew4IVBU7EGNDiRn8Z831cGLHhSIgdFf9chIeBg7oA7gjaWUWTVQAGE3LqBDCTlc9WOHfm7PkTqNCh54rePDqB6M+lR536hCpUqs2gVZM+xbrTqtGoWqdy1emValeXKzggYBBB5y1acFNZmEvXAoN2cGfJrTv3bl69Ffj2xZt3L1+/fw3XRVw4sGDGcR0fJhxZsF3KtBTThZxZ8mLMgC3fRatCbYMNFCzwLEqLgE4NsDWs/tvqdezZf13Hvk2A9Szdu2X3pg18N+68xXn7rh1c+PLksI/Dhe6cuO3ow3NfV92bdArTqC2Ebd3A8vjf5QWfH6Bg7Nz17c2fj69+fnq+8N2Lty+fuP78/eV2X13neIcCeBRwxorbZrA1ANoCDGrgoG8RTshahQ9iSKEEzUmYIYfNWViUhheCGJyIP5E4oom7WWjgCeBFAJNv1DVV01MAdJhhjdkplWNzO/5oXI846njjVEIqR2OS2B1pE5PVscajkxhMycqLJghQSwT40PgfAl4GqNSXYdZXJn5gSkmmmmJu1aZYb14V51do+pTOCmA40AqVCIhG5IJ9PvYnhIFOxmdqhpaI6GeHCtpooisuutmg+Eg62KOMKuqoTaXgicQWoIYq6qiklmoqFV0UoeqqrLbq6quwxirrrLTWauutJ4QAACH5BAUKABwALAcABADOAAsAAAX/IPd0D2dyRCoUp/k8gpHOKtseR9yiSmGbuBykler9XLAhkbDavXTL5k2oqFqNOxzUZPU5YYZd1XsD72rZpBjbeh52mSNnMSC8lwblKZGwi+0QfIJ8CncnCoCDgoVnBHmKfByGJimPkIwtiAeBkH6ZHJaKmCeVnKKTHIihg5KNq4uoqmEtcRUtEREMBggtEr4QDrjCuRC8h7/BwxENeicSF8DKy82pyNLMOxzWygzFmdvD2L3P0dze4+Xh1Arkyepi7dfFvvTtLQkZBC0T/FX3CRgCMOBHsJ+EHYQY7OinAGECgQsB+Lu3AOK+CewcWjwxQeJBihtNGHSoQOE+iQ3//4XkwBBhRZMcUS6YSXOAwIL8PGqEaSJCiYt9SNoCmnJPAgUVLChdaoFBURN8MAzl2PQphwQLfDFd6lTowglHve6rKpbjhK7/pG5VinZP1qkiz1rl4+tr2LRwWU64cFEihwEtZgbgR1UiHaMVvxpOSwBA37kzGz9e8G+B5MIEKLutOGEsAH2ATQwYfTmuX8aETWdGPZmiZcccNSzeTCA1Sw0bdiitC7LBWgu8jQr8HRzqgpK6gX88QbrB14z/kF+ELpwB8eVQj/JkqdylAudji/+ts3039vEEfK8Vz2dlvxZKG0CmbkKDBvllRd6fCzDvBLKBDSCeffhRJEFebFk1k/Mv9jVIoIJZSeBggwUaNeB+Qk34IE0cXlihcfRxkOAJFFhwGmKlmWDiakZhUJtnLBpnWWcnKaAZcxI0piFGGLBm1mc90kajSCveeBVWKeYEoU2wqeaQi0PetoE+rr14EpVC7oAbAUHqhYExbn2XHHsVqbcVew9tx8+XJKk5AZsqqdlddGpqAKdbAYBn1pcczmSTdWvdmZ17c1b3FZ99vnTdCRFM8OEcAhLwm1NdXnWcBBSMRWmfkWZqVlsmLIiAp/o1gGV2vpS4lalGYsUOqXrddcKCmK61aZ8SjEpUpVFVoCpTj4r661Km7kBHjrDyc1RAIQAAIfkEBQoAGwAsBwAEAM4ACwAABf/gtmUCd4goQQgFKj6PYKi0yrrbc8i4ohQt12EHcal+MNSQiCP8gigdz7iCioaCIvUmZLp8QBzW0EN2vSlCuDtFKaq4RyHzQLEKZNdiQDhRDVooCwkbfm59EAmKi4SGIm+AjIsKjhsqB4mSjT2IOIOUnICeCaB/mZKFNTSRmqVpmJqklSqskq6PfYYCDwYHDC4REQwGCBLGxxIQDsHMwhAIX8bKzcENgSLGF9PU1j3Sy9zX2NrgzQziChLk1BHWxcjf7N046tvN82715czn9Pryz6Ilc4ACj4EBOCZM8KEnAYYADBRKnACAYUMFv1wotIhCEcaJCisqwJFgAUSQGyX/kCSVUUTIdKMwJlyo0oXHlhskwrTJciZHEXsgaqS4s6PJiCAr1uzYU8kBBSgnWFqpoMJMUjGtDmUwkmfVmVypakWhEKvXsS4nhLW5wNjVroJIoc05wSzTr0PtiigpYe4EC2vj4iWrFu5euWIMRBhacaVJhYQBEFjA9jHjyQ0xEABwGceGAZYjY0YBOrRLCxUp29QM+bRkx5s7ZyYgVbTqwwti2ybJ+vLtDYpycyZbYOlptxdx0kV+V7lC5iJAyyRrwYKxAdiz82ng0/jnAdMJFz0cPi104Ec1Vj9/M6F173vKL/feXv156dw11tlqeMMnv4V5Ap53GmjQQH97nFfg+IFiucfgRX5Z8KAgbUlQ4IULIlghhhdOSB6AgX0IVn8eReghen3NRIBsRgnH4l4LuEidZBjwRpt6NM5WGwoW0KSjCwX6yJSMab2GwwAPDXfaBCtWpluRTQqC5JM5oUZAjUNS+VeOLWpJEQ7VYQANW0INJSZVDFSnZphjSikfmzE5N4EEbQI1QJmnWXCmHulRp2edwDXF43txukenJwvI9xyg9Q26Z3MzGUcBYFEChZh6DVTq34AU8Iflh51Sd+CnKFYQ6mmZkhqfBKfSxZWqA9DZanWjxmhrWwi0qtCrt/43K6WqVjjpmhIqgEGvculaGKklKstAACEAACH5BAUKABwALAcABADOAAsAAAX/ICdyQmaMYyAUqPgIBiHPxNpy79kqRXH8wAPsRmDdXpAWgWdEIYm2llCHqjVHU+jjJkwqBTecwItShMXkEfNWSh8e1NGAcLgpDGlRgk7EJ/6Ae3VKfoF/fDuFhohVeDeCfXkcCQqDVQcQhn+VNDOYmpSWaoqBlUSfmowjEA+iEAEGDRGztAwGCDcXEA60tXEiCrq8vREMEBLIyRLCxMWSHMzExnbRvQ2Sy7vN0zvVtNfU2tLY3rPgLdnDvca4VQS/Cpk3ABwSLQkYAQwT/P309vcI7OvXr94jBQMJ/nskkGA/BQBRLNDncAIAiDcG6LsxAWOLiQzmeURBKWSLCQbv/1F0eDGinJUKR47YY1IEgQASKk7Yc7ACRwZm7mHweRJoz59BJUogisKCUaFMR0x4SlJBVBFTk8pZivTR0K73rN5wqlXEAq5Fy3IYgHbEzQ0nLy4QSoCjXLoom96VOJEeCosK5n4kkFfqXjl94wa+l1gvAcGICbewAOAxY8l/Ky/QhAGz4cUkGxu2HNozhwMGBnCUqUdBg9UuW9eUynqSwLHIBujePef1ZGQZXcM+OFuEBeBhi3OYgLyqcuaxbT9vLkf4SeqyWxSQpKGB2gQpm1KdWbu72rPRzR9Ne2Nu9Kzr/1Jqj0yD/fvqP4aXOt5sW/5qsXXVcv1Nsp8IBUAmgswGF3llGgeU1YVXXKTN1FlhWFXW3gIE+DVChApysACHHo7Q4A35lLichh+ROBmLKAzgYmYEYDAhCgxKGOOMn4WR4kkDaoBBOxJtdNKQxFmg5JIWIBnQc07GaORfUY4AEkdV6jHlCEISSZ5yTXpp1pbGZbkWmcuZmQCaE6iJ0FhjMaDjTMsgZaNEHFRAQVp3bqXnZED1qYcECOz5V6BhSWCoVJQIKuKQi2KFKEkEFAqoAo7uYSmO3jk61wUUMKmknJ4SGimBmAa0qVQBhAAAIfkEBQoAGwAsBwAEAM4ACwAABf/gJm5FmRlEqhJC+bywgK5pO4rHI0D3pii22+Mg6/0Ej96weCMAk7cDkXf7lZTTnrMl7eaYoy10JN0ZFdco0XAuvKI6qkgVFJXYNwjkIBcNBgR8TQoGfRsJCRuCYYQQiI+ICosiCoGOkIiKfSl8mJkHZ4U9kZMbKaI3pKGXmJKrngmug4WwkhA0lrCBWgYFCCMQFwoQDRHGxwwGCBLMzRLEx8iGzMMO0cYNeCMKzBDW19lnF9DXDIY/48Xg093f0Q3s1dcR8OLe8+Y91OTv5wrj7o7B+7VNQqABIoRVCMBggsOHE36kSoCBIcSH3EbFangxogJYFi8CkJhqQciLJEf/LDDJEeJIBT0GsOwYUYJGBS0fjpQAMidGmyVP6sx4Y6VQhzs9VUwkwqaCCh0tmKoFtSMDmBOf9phg4SrVrROuasRQAaxXpVUhdsU6IsECZlvX3kwLUWzRt0BHOLTbNlbZG3vZinArge5Dvn7wbqtQkSYAAgtKmnSsYKVKo2AfW048uaPmG386i4Q8EQMBAIAnfB7xBxBqvapJ9zX9WgRS2YMpnvYMGdPK3aMjt/3dUcNI4blpj7iwkMFWDXDvSmgAlijrt9RTR78+PS6z1uAJZIe93Q8g5zcsWCi/4Y+C8bah5zUv3vv89uft30QP23punGCx5954oBBwnwYaNCDY/wYrsYeggnM9B2Fpf8GG2CEUVWhbWAtGouEGDy7Y4IEJVrbSiXghqGKIo7z1IVcXIkKWWR361QOLWWnIhwERpLaaCCee5iMBGJQmJGyPFTnbkfHVZGRtIGrg5HALEJAZbu39BuUEUmq1JJQIPtZilY5hGeSWsSk52G9XqsmgljdIcABytq13HyIM6RcUA+r1qZ4EBF3WHWB29tBgAzRhEGhig8KmqKFv8SeCeo+mgsF7YFXa1qWSbkDpom/mqR1PmHCqJ3fwNRVXjC7S6CZhFVCQ2lWvZiirhQq42SACt25IK2hv8TprriUV1usGgeka7LFcNmCldMLi6qZMgFLgpw16Cipb7bC1knXsBiEAACH5BAUKABsALAcABADOAAsAAAX/4FZsJPkUmUGsLCEUTywXglFuSg7fW1xAvNWLF6sFFcPb42C8EZCj24EJdCp2yoegWsolS0Uu6fmamg8n8YYcLU2bXSiRaXMGvqV6/KAeJAh8VgZqCX+BexCFioWAYgqNi4qAR4ORhRuHY408jAeUhAmYYiuVlpiflqGZa5CWkzc5fKmbbhIpsAoQDRG8vQwQCBLCwxK6vb5qwhfGxxENahvCEA7NzskSy7vNzzzK09W/PNHF1NvX2dXcN8K55cfh69Luveol3vO8zwi4Yhj+AQwmCBw4IYclDAAJDlQggVOChAoLKkgFkSCAHDwWLKhIEOONARsDKryogFPIiAUb/95gJNIiw4wnI778GFPhzBKFOAq8qLJEhQpiNArjMcHCmlTCUDIouTKBhApELSxFWiGiVKY4E2CAekPgUphDu0742nRrVLJZnyrFSqKQ2ohoSYAMW6IoDpNJ4bLdILTnAj8KUF7UeENjAKuDyxIgOuGiOI0EBBMgLNew5AUrDTMGsFixwBIaNCQuAXJB57qNJ2OWm2Aj4skwCQCIyNkhhtMkdsIuodE0AN4LJDRgfLPtn5YDLdBlraAByuUbBgxQwICxMOnYpVOPej074OFdlfc0TqC62OIbcppHjV4o+LrieWhfT8JC/I/T6W8oCl29vQ0XjLdBaA3s1RcPBO7lFvpX8BVoG4O5jTXRQRDuJ6FDTzEWF1/BCZhgbyAKE9qICYLloQYOFtahVRsWYlZ4KQJHlwHS/IYaZ6sZd9tmu5HQm2xi1UaTbzxYwJk/wBF5g5EEYOBZeEfGZmNdFyFZmZIR4jikbLThlh5kUUVJGmRT7sekkziRWUIACABk3T4qCsedgO4xhgGcY7q5pHJ4klBBTQRJ0CeHcoYHHUh6wgfdn9uJdSdMiebGJ0zUPTcoS286FCkrZxnYoYYKWLkBowhQoBeaOlZAgVhLidrXqg2GiqpQpZ4apwSwRtjqrB3muoF9BboaXKmshlqWqsWiGt2wphJkQbAU5hoCACH5BAUKABsALAcABADOAAsAAAX/oGFw2WZuT5oZROsSQnGaKjRvilI893MItlNOJ5v5gDcFrHhKIWcEYu/xFEqNv6B1N62aclysF7fsZYe5aOx2yL5aAUGSaT1oTYMBwQ5VGCAJgYIJCnx1gIOBhXdwiIl7d0p2iYGQUAQBjoOFSQR/lIQHnZ+Ue6OagqYzSqSJi5eTpTxGcjcSChANEbu8DBAIEsHBChe5vL13G7fFuscRDcnKuM3H0La3EA7Oz8kKEsXazr7Cw9/Gztar5uHHvte47MjktznZ2w0G1+D3BgirAqJmJMAQgMGEgwgn5Ei0gKDBhBMALGRYEOJBb5QcWlQo4cbAihZz3GgIMqFEBSM1/4ZEOWPAgpIIJXYU+PIhRG8ja1qU6VHlzZknJNQ6UanCjQkWCIGSUGEjAwVLjc44+DTqUQtPPS5gejUrTa5TJ3g9sWCr1BNUWZI161StiQUDmLYdGfesibQ3XMq1OPYthrwuA2yU2LBs2cBHIypYQPPlYAKFD5cVvNPtW8eVGbdcQADATsiNO4cFAPkvHpedPzc8kUcPgNGgZ5RNDZG05reoE9s2vSEP79MEGiQGy1qP8LA4ZcdtsJE48ONoLTBtTV0B9LsTnPceoIDBDQvS7W7vfjVY3q3eZ4A339J4eaAmKqU/sV58HvJh2RcnIBsDUw0ABqhBA5aV5V9XUFGiHfVeAiWwoFgJJrIXRH1tEMiDFV4oHoAEGlaWhgIGSGBO2nFomYY3mKjVglidaNYJGJDkWW2xxTfbjCbVaOGNqoX2GloR8ZeTaECS9pthRGJH2g0b3Agbk6hNANtteHD2GJUucfajCQBy5OOTQ25ZgUPvaVVQmbKh9510/qQpwXx3SQdfk8tZJOd5b6JJFplT3ZnmmX3qd5l1eg5q00HrtUkUn0AKaiGjClSAgKLYZcgWXwocGRcCFGCKwSB6ceqphwmYRUFYT/1WKlOdUpipmxW0mlCqHjYkAaeoZlqrqZ4qd+upQKaapn/AmgAegZ8KUtYtFAQQAgAh+QQFCgAbACwHAAQAzgALAAAF/+C2PUcmiCiZGUTrEkKBis8jQEquKwU5HyXIbEPgyX7BYa5wTNmEMwWsSXsqFbEh8DYs9mrgGjdK6GkPY5GOeU6ryz7UFopSQEzygOGhJBjoIgMDBAcBM0V/CYqLCQqFOwobiYyKjn2TlI6GKC2YjJZknouaZAcQlJUHl6eooJwKooobqoewrJSEmyKdt59NhRKFMxLEEA4RyMkMEAjDEhfGycqAG8TQx9IRDRDE3d3R2ctD1RLg0ttKEnbY5wZD3+zJ6M7X2RHi9Oby7u/r9g38UFjTh2xZJBEBMDAboogAgwkQI07IMUORwocSJwCgWDFBAIwZOaJIsOBjRogKJP8wTODw5ESVHVtm3AhzpEeQElOuNDlTZ0ycEUWKWFASqEahGwYUPbnxoAgEdlYSqDBkgoUNClAlIHbSAoOsqCRQnQHxq1axVb06FWFxLIqyaze0Tft1JVqyE+pWXMD1pF6bYl3+HTqAWNW8cRUFzmih0ZAAB2oGKukSAAGGRHWJgLiR6AylBLpuHKKUMlMCngMpDSAa9QIUggZVVvDaJobLeC3XZpvgNgCmtPcuwP3WgmXSq4do0DC6o2/guzcseECtUoO0hmcsGKDgOt7ssBd07wqesAIGZC1YIBa7PQHvb1+SFo+++HrJSQfB33xfav3i5eX3Hnb4CTJgegEq8tH/YQEOcIJzbm2G2EoYRLgBXFpVmFYDcREV4HIcnmUhiGBRouEMJGJGzHIspqgdXxK0yCKHRNXoIX4uorCdTyjkyNtdPWrA4Up82EbAbzMRxxZRR54WXVLDIRmRcag5d2R6ugl3ZXzNhTecchpMhIGVAKAYpgJjjsSklBEd99maZoo535ZvdamjBEpusJyctg3h4X8XqodBMx0tiNeg/oGJaKGABpogS40KSqiaEgBqlQWLUtqoVQnytekEjzo0hHqhRorppOZt2p923M2AAV+oBtpAnnPNoB6HaU6mAAIU+IXmi3j2mtFXuUoHKwXpzVrsjcgGOauKEjQrwq157hitGq2NoWmjh7z6Wmxb0m5w66+2VRAuXN/yFUAIACH5BAUKABsALAcABADOAAsAAAX/4CZuRiaM45MZqBgIRbs9AqTcuFLE7VHLOh7KB5ERdjJaEaU4ClO/lgKWjKKcMiJQ8KgumcieVdQMD8cbBeuAkkC6LYLhOxoQ2PF5Ys9PKPBMen17f0CCg4VSh32JV4t8jSNqEIOEgJKPlkYBlJWRInKdiJdkmQlvKAsLBxdABA4RsbIMBggtEhcQsLKxDBC2TAS6vLENdJLDxMZAubu8vjIbzcQRtMzJz79S08oQEt/guNiyy7fcvMbh4OezdAvGrakLAQwyABsELQkY9BP+//ckyPDD4J9BfAMh1GsBoImMeQUN+lMgUJ9CiRMa5msxoB9Gh/o8GmxYMZXIgxtR/yQ46S/gQAURR0pDwYDfywoyLPip5AdnCwsMFPBU4BPFhKBDi444quCmDKZOfwZ9KEGpCKgcN1jdALSpPqIYsabS+nSqvqplvYqQYAeDPgwKwjaMtiDl0oaqUAyo+3TuWwUAMPpVCfee0cEjVBGQq2ABx7oTWmQk4FglZMGN9fGVDMCuiH2AOVOu/PmyxM630gwM0CCn6q8LjVJ8GXvpa5Uwn95OTC/nNxkda1/dLSK475IjCD6dHbK1ZOa4hXP9DXs5chJ00UpVm5xo2qRpoxptwF2E4/IbJpB/SDz9+q9b1aNfQH08+p4a8uvX8B53fLP+ycAfemjsRUBgp1H20K+BghHgVgt1GXZXZpZ5lt4ECjxYR4ScUWiShEtZqBiIInRGWnERNnjiBglw+JyGnxUmGowsyiiZg189lNtPGACjV2+S9UjbU0JWF6SPvEk3QZEqsZYTk3UAaRSUnznJI5LmESCdBVSyaOWUWLK4I5gDUYVeV1T9l+FZClCAUVA09uSmRHBCKAECFEhW51ht6rnmWBXkaR+NjuHpJ40D3DmnQXt2F+ihZxlqVKOfQRACACH5BAUKABwALAcABADOAAsAAAX/ICdyUCkUo/g8mUG8MCGkKgspeC6j6XEIEBpBUeCNfECaglBcOVfJFK7YQwZHQ6JRZBUqTrSuVEuD3nI45pYjFuWKvjjSkCoRaBUMWxkwBGgJCXspQ36Bh4EEB0oKhoiBgyNLjo8Ki4QElIiWfJqHnISNEI+Ql5J9o6SgkqKkgqYihamPkW6oNBgSfiMMDQkGCBLCwxIQDhHIyQwQCGMKxsnKVyPCF9DREQ3MxMPX0cu4wt7J2uHWx9jlKd3o39MiuefYEcvNkuLt5O8c1ePI2tyELXGQwoGDAQf+iEC2xByDCRAjTlAgIUWCBRgCPJQ4AQBFXAs0coT40WLIjRxL/47AcHLkxIomRXL0CHPERZkpa4q4iVKiyp0tR/7kwHMkTUBBJR5dOCEBAVcKKtCAyOHpowXCpk7goABqBZdcvWploACpBKkpIJI1q5OD2rIWE0R1uTZu1LFwbWL9OlKuWb4c6+o9i3dEgw0RCGDUG9KlRw56gDY2qmCByZBaASi+TACA0TucAaTteCcy0ZuOK3N2vJlx58+LRQyY3Xm0ZsgjZg+oPQLi7dUcNXi0LOJw1pgNtB7XG6CBy+U75SYfPTSQAgZTNUDnQHt67wnbZyvwLgKiMN3oCZB3C76tdewpLFgIP2C88rbi4Y+QT3+8S5USMICZXWj1pkEDeUU3lOYGB3alSoEiMIjgX4WlgNF2EibIwQIXauWXSRg2SAOHIU5IIIMoZkhhWiJaiFVbKo6AQEgQXrTAazO1JhkBrBG3Y2Y6EsUhaGn95hprSN0oWpFE7rhkeaQBchGOEWnwEmc0uKWZj0LeuNV3W4Y2lZHFlQCSRjTIl8uZ+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,
isPaused: false,
isBeyondMaxPage: false,
currPage: 1
},
debug: false,
behavior: undefined,
binder: $(window),
nextSelector: 'div.navigation a:first',
navSelector: 'div.navigation',
contentSelector: null,
extraScrollPx: 150,
itemSelector: 'div.post',
animate: false,
pathParse: undefined,
dataType: 'html',
appendCallback: true,
bufferPx: 40,
errorCallback: function (){ },
infid: 0,
pixelsFromNavToBottom: undefined,
path: undefined,
prefill: false,
maxPage: undefined
};
$.infinitescroll.prototype={
_binding: function infscr_binding(binding){
var instance=this,
opts=instance.options;
opts.v='2.0b2.120520';
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);
},
_create: function infscr_create(options, callback){
var opts=$.extend(true, {}, $.infinitescroll.defaults, options);
this.options=opts;
var $window=$(window);
var instance=this;
if(!instance._validate(options)){
return false;
}
var path=$(opts.nextSelector).attr('href');
if(!path){
this._debug('Navigation selector not found');
return false;
}
opts.path=opts.path||this._determinepath(path);
opts.contentSelector=opts.contentSelector||this.element;
opts.loading.selector=opts.loading.selector||opts.contentSelector;
opts.loading.msg=opts.loading.msg||$('' + opts.loading.msgText + '
');
(new Image()).src=opts.loading.img;
if(opts.pixelsFromNavToBottom===undefined){
opts.pixelsFromNavToBottom=$(document).height() - $(opts.navSelector).offset().top;
this._debug('pixelsFromNavToBottom: ' + opts.pixelsFromNavToBottom);
}
var self=this;
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));
};
opts.loading.finished=opts.loading.finished||function(){
if(!opts.state.isBeyondMaxPage)
opts.loading.msg.fadeOut(opts.loading.speed);
};
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){
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();
if(opts.prefill){
this._prefill();
}
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();
}});
};
this._prefill();
},
_debug: function infscr_debug(){
if(true!==this.options.debug){
return;
}
if(typeof console!=='undefined'&&typeof console.log==='function'){
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'){
Function.prototype.call.call(console.log, console, Array.prototype.slice.call(arguments));
}},
_determinepath: function infscr_determinepath(path){
var opts=this.options;
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);
}else if(path.match(/^(.*?)2(.*?$)/)){
if(path.match(/^(.*?page=)2(\/.*|$)/)){
path=path.match(/^(.*?page=)2(\/.*|$)/).slice(1);
return path;
}
path=path.match(/^(.*?)2(.*?$)/).slice(1);
}else{
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.");
opts.state.isInvalidPage=true;
}}
this._debug('determinePath', path);
return path;
},
_error: function infscr_error(xhr){
var opts=this.options;
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;
opts.state.isPaused=false;
opts.state.isBeyondMaxPage=false;
this._binding('unbind');
},
_loadcallback: function infscr_loadcallback(box, data, url){
var opts=this.options,
callback=this.options.callback,
result=(opts.state.isDone) ? 'done':(!opts.appendCallback) ? 'no-append':'append',
frag;
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='' + data + '
';
data=$(data).find(opts.itemSelector);
}
if(data.length===0){
return this._error('end');
}
break;
case 'append':
var children=box.children();
if(children.length===0){
return this._error('end');
}
frag=document.createDocumentFragment();
while (box[0].firstChild){
frag.appendChild(box[0].firstChild);
}
this._debug('contentSelector', $(opts.contentSelector)[0]);
$(opts.contentSelector)[0].appendChild(frag);
data=children.get();
break;
}
opts.loading.finished.call($(opts.contentSelector)[0],opts);
if(opts.animate){
var scrollTo=$(window).scrollTop() + $(opts.loading.msg).height() + opts.extraScrollPx + 'px';
$('html,body').animate({ scrollTop: scrollTo }, 800, function (){ opts.state.isDuringAjax=false; });
}
if(!opts.animate){
opts.state.isDuringAjax=false;
}
callback(this, data, url);
if(opts.prefill){
this._prefill();
}},
_nearbottom: function infscr_nearbottom(){
var opts=this.options,
pixelsFromWindowBottomToBottom=0 + $(document).height() - (opts.binder.scrollTop()) - $(window).height();
if(!!opts.behavior&&this['_nearbottom_'+opts.behavior]!==undefined){
return this['_nearbottom_'+opts.behavior].call(this);
}
this._debug('math:', pixelsFromWindowBottomToBottom, opts.pixelsFromNavToBottom);
return (pixelsFromWindowBottomToBottom - opts.bufferPx < opts.pixelsFromNavToBottom);
},
_pausing: function infscr_pausing(pause){
var opts=this.options;
if(!!opts.behavior&&this['_pausing_'+opts.behavior]!==undefined){
this['_pausing_'+opts.behavior].call(this,pause);
return;
}
if(pause!=='pause'&&pause!=='resume'&&pause!==null){
this._debug('Invalid argument. Toggling pause value instead');
}
pause=(pause&&(pause==='pause'||pause==='resume')) ? pause:'toggle';
switch (pause){
case 'pause':
opts.state.isPaused=true;
break;
case 'resume':
opts.state.isPaused=false;
break;
case 'toggle':
opts.state.isPaused = !opts.state.isPaused;
break;
}
this._debug('Paused', opts.state.isPaused);
return false;
},
_setup: function infscr_setup(){
var opts=this.options;
if(!!opts.behavior&&this['_setup_'+opts.behavior]!==undefined){
this['_setup_'+opts.behavior].call(this);
return;
}
this._binding('bind');
return false;
},
_showdonemsg: function infscr_showdonemsg(){
var opts=this.options;
if(!!opts.behavior&&this['_showdonemsg_'+opts.behavior]!==undefined){
this['_showdonemsg_'+opts.behavior].call(this);
return;
}
opts.loading.msg
.find('img')
.hide()
.parent()
.find('div').html(opts.loading.finishedMsg).animate({ opacity: 1 }, 2000, function (){
$(this).parent().fadeOut(opts.loading.speed);
});
opts.errorCallback.call($(opts.contentSelector)[0],'done');
},
_validate: function infscr_validate(opts){
for (var key in opts){
if(key.indexOf&&key.indexOf('Selector') > -1&&$(opts[key]).length===0){
this._debug('Your ' + key + ' found no elements.');
return false;
}}
return true;
},
bind: function infscr_bind(){
this._binding('bind');
},
destroy: function infscr_destroy(){
this.options.state.isDestroyed=true;
this.options.loading.finished();
return this._error('destroy');
},
pause: function infscr_pause(){
this._pausing('pause');
},
resume: function infscr_resume(){
this._pausing('resume');
},
beginAjax: function infscr_ajax(opts){
var instance=this,
path=opts.path,
box, desturl, method, condition;
opts.state.currPage++;
if(opts.maxPage!==undefined&&opts.state.currPage > opts.maxPage){
opts.state.isBeyondMaxPage=true;
this.destroy();
return;
}
box=$(opts.contentSelector).is('table, tbody') ? $(''):$('');
desturl=(typeof path==='function') ? path(opts.state.currPage):path.join(opts.state.currPage);
instance._debug('heading into ajax', desturl);
method=(opts.dataType==='html'||opts.dataType==='json') ? opts.dataType:'html+callback';
if(opts.appendCallback&&opts.dataType==='html'){
method +='+callback';
}
switch (method){
case 'html+callback':
instance._debug('Using HTML via .load() method');
box.load(desturl + ' ' + opts.itemSelector, undefined, function infscr_ajax_callback(responseText){
instance._loadcallback(box, responseText, desturl);
});
break;
case 'html':
instance._debug('Using ' + (method.toUpperCase()) + ' via $.ajax() method');
$.ajax({
url: desturl,
dataType: opts.dataType,
complete: function infscr_ajax_callback(jqXHR, textStatus){
condition=(typeof (jqXHR.isResolved)!=='undefined') ? (jqXHR.isResolved()):(textStatus==='success'||textStatus==='notmodified');
if(condition){
instance._loadcallback(box, jqXHR.responseText, desturl);
}else{
instance._error('end');
}}
});
break;
case 'json':
instance._debug('Using ' + (method.toUpperCase()) + ' via $.ajax() method');
$.ajax({
dataType: 'json',
type: 'GET',
url: desturl,
success: function (data, textStatus, jqXHR){
condition=(typeof (jqXHR.isResolved)!=='undefined') ? (jqXHR.isResolved()):(textStatus==='success'||textStatus==='notmodified');
if(opts.appendCallback){
if(opts.template!==undefined){
var theData=opts.template(data);
box.append(theData);
if(condition){
instance._loadcallback(box, theData);
}else{
instance._error('end');
}}else{
instance._debug('template must be defined.');
instance._error('end');
}}else{
if(condition){
instance._loadcallback(box, data, desturl);
}else{
instance._error('end');
}}
},
error: function(){
instance._debug('JSON ajax request failed.');
instance._error('end');
}});
break;
}},
retrieve: function infscr_retrieve(pageNum){
pageNum=pageNum||null;
var instance=this,
opts=instance.options;
if(!!opts.behavior&&this['retrieve_'+opts.behavior]!==undefined){
this['retrieve_'+opts.behavior].call(this,pageNum);
return;
}
if(opts.state.isDestroyed){
this._debug('Instance is destroyed');
return false;
}
opts.state.isDuringAjax=true;
opts.loading.start.call($(opts.contentSelector)[0],opts);
},
scroll: function infscr_scroll(){
var opts=this.options,
state=opts.state;
if(!!opts.behavior&&this['scroll_'+opts.behavior]!==undefined){
this['scroll_'+opts.behavior].call(this);
return;
}
if(state.isDuringAjax||state.isInvalidPage||state.isDone||state.isDestroyed||state.isPaused){
return;
}
if(!this._nearbottom()){
return;
}
this.retrieve();
},
toggle: function infscr_toggle(){
this._pausing();
},
unbind: function infscr_unbind(){
this._binding('unbind');
},
update: function infscr_options(key){
if($.isPlainObject(key)){
this.options=$.extend(true,this.options,key);
}}
};
$.fn.infinitescroll=function infscr_init(options, callback){
var thisCall=typeof options;
switch (thisCall){
case 'string':
var args=Array.prototype.slice.call(arguments, 1);
this.each(function (){
var instance=$.data(this, 'infinitescroll');
if(!instance){
return false;
}
if(!$.isFunction(instance[options])||options.charAt(0)==='_'){
return false;
}
instance[options].apply(instance, args);
});
break;
case 'object':
this.each(function (){
var instance=$.data(this, 'infinitescroll');
if(instance){
instance.update(options);
}else{
instance=new $.infinitescroll(options, callback, this);
if(!instance.failed){
$.data(this, 'infinitescroll', instance);
}}
});
break;
}
return this;
};
var event=$.event,
scrollTimeout;
event.special.smartscroll={
setup: function (){
$(this).bind('scroll', event.special.smartscroll.handler);
},
teardown: function (){
$(this).unbind('scroll', event.special.smartscroll.handler);
},
handler: function (event, execAsap){
var context=this,
args=arguments;
event.type='smartscroll';
if(scrollTimeout){ clearTimeout(scrollTimeout); }
scrollTimeout=setTimeout(function (){
$(context).trigger('smartscroll', args);
}, execAsap==='execAsap' ? 0:100);
}};
$.fn.smartscroll=function (fn){
return fn ? this.bind('smartscroll', fn):this.trigger('smartscroll', ['execAsap']);
};}));
(function(){
'use strict'
var keyCounter=0
var allWaypoints={}
function Waypoint(options){
if(!options){
throw new Error('No options passed to Waypoint constructor')
}
if(!options.element){
throw new Error('No element option passed to Waypoint constructor')
}
if(!options.handler){
throw new Error('No handler option passed to Waypoint constructor')
}
this.key='waypoint-' + keyCounter
this.options=Waypoint.Adapter.extend({}, Waypoint.defaults, options)
this.element=this.options.element
this.adapter=new Waypoint.Adapter(this.element)
this.callback=options.handler
this.axis=this.options.horizontal ? 'horizontal':'vertical'
this.enabled=this.options.enabled
this.triggerPoint=null
this.group=Waypoint.Group.findOrCreate({
name: this.options.group,
axis: this.axis
})
this.context=Waypoint.Context.findOrCreateByElement(this.options.context)
if(Waypoint.offsetAliases[this.options.offset]){
this.options.offset=Waypoint.offsetAliases[this.options.offset]
}
this.group.add(this)
this.context.add(this)
allWaypoints[this.key]=this
keyCounter +=1
}
Waypoint.prototype.queueTrigger=function(direction){
this.group.queueTrigger(this, direction)
}
Waypoint.prototype.trigger=function(args){
if(!this.enabled){
return
}
if(this.callback){
this.callback.apply(this, args)
}}
Waypoint.prototype.destroy=function(){
this.context.remove(this)
this.group.remove(this)
delete allWaypoints[this.key]
}
Waypoint.prototype.disable=function(){
this.enabled=false
return this
}
Waypoint.prototype.enable=function(){
this.context.refresh()
this.enabled=true
return this
}
Waypoint.prototype.next=function(){
return this.group.next(this)
}
Waypoint.prototype.previous=function(){
return this.group.previous(this)
}
Waypoint.invokeAll=function(method){
var allWaypointsArray=[]
for (var waypointKey in allWaypoints){
allWaypointsArray.push(allWaypoints[waypointKey])
}
for (var i=0, end=allWaypointsArray.length; i < end; i++){
allWaypointsArray[i][method]()
}}
Waypoint.destroyAll=function(){
Waypoint.invokeAll('destroy')
}
Waypoint.disableAll=function(){
Waypoint.invokeAll('disable')
}
Waypoint.enableAll=function(){
Waypoint.Context.refreshAll()
for (var waypointKey in allWaypoints){
allWaypoints[waypointKey].enabled=true
}
return this
}
Waypoint.refreshAll=function(){
Waypoint.Context.refreshAll()
}
Waypoint.viewportHeight=function(){
return window.innerHeight||document.documentElement.clientHeight
}
Waypoint.viewportWidth=function(){
return document.documentElement.clientWidth
}
Waypoint.adapters=[]
Waypoint.defaults={
context: window,
continuous: true,
enabled: true,
group: 'default',
horizontal: false,
offset: 0
}
Waypoint.offsetAliases={
'bottom-in-view': function(){
return this.context.innerHeight() - this.adapter.outerHeight()
},
'right-in-view': function(){
return this.context.innerWidth() - this.adapter.outerWidth()
}}
window.Waypoint=Waypoint
}())
;(function(){
'use strict'
function requestAnimationFrameShim(callback){
window.setTimeout(callback, 1000 / 60)
}
var keyCounter=0
var contexts={}
var Waypoint=window.Waypoint
var oldWindowLoad=window.onload
function Context(element){
this.element=element
this.Adapter=Waypoint.Adapter
this.adapter=new this.Adapter(element)
this.key='waypoint-context-' + keyCounter
this.didScroll=false
this.didResize=false
this.oldScroll={
x: this.adapter.scrollLeft(),
y: this.adapter.scrollTop()
}
this.waypoints={
vertical: {},
horizontal: {}}
element.waypointContextKey=this.key
contexts[element.waypointContextKey]=this
keyCounter +=1
if(!Waypoint.windowContext){
Waypoint.windowContext=true
Waypoint.windowContext=new Context(window)
}
this.createThrottledScrollHandler()
this.createThrottledResizeHandler()
}
Context.prototype.add=function(waypoint){
var axis=waypoint.options.horizontal ? 'horizontal':'vertical'
this.waypoints[axis][waypoint.key]=waypoint
this.refresh()
}
Context.prototype.checkEmpty=function(){
var horizontalEmpty=this.Adapter.isEmptyObject(this.waypoints.horizontal)
var verticalEmpty=this.Adapter.isEmptyObject(this.waypoints.vertical)
var isWindow=this.element==this.element.window
if(horizontalEmpty&&verticalEmpty&&!isWindow){
this.adapter.off('.waypoints')
delete contexts[this.key]
}}
Context.prototype.createThrottledResizeHandler=function(){
var self=this
function resizeHandler(){
self.handleResize()
self.didResize=false
}
this.adapter.on('resize.waypoints', function(){
if(!self.didResize){
self.didResize=true
Waypoint.requestAnimationFrame(resizeHandler)
}})
}
Context.prototype.createThrottledScrollHandler=function(){
var self=this
function scrollHandler(){
self.handleScroll()
self.didScroll=false
}
this.adapter.on('scroll.waypoints', function(){
if(!self.didScroll||Waypoint.isTouch){
self.didScroll=true
Waypoint.requestAnimationFrame(scrollHandler)
}})
}
Context.prototype.handleResize=function(){
Waypoint.Context.refreshAll()
}
Context.prototype.handleScroll=function(){
var triggeredGroups={}
var axes={
horizontal: {
newScroll: this.adapter.scrollLeft(),
oldScroll: this.oldScroll.x,
forward: 'right',
backward: 'left'
},
vertical: {
newScroll: this.adapter.scrollTop(),
oldScroll: this.oldScroll.y,
forward: 'down',
backward: 'up'
}}
for (var axisKey in axes){
var axis=axes[axisKey]
var isForward=axis.newScroll > axis.oldScroll
var direction=isForward ? axis.forward:axis.backward
for (var waypointKey in this.waypoints[axisKey]){
var waypoint=this.waypoints[axisKey][waypointKey]
if(waypoint.triggerPoint===null){
continue
}
var wasBeforeTriggerPoint=axis.oldScroll < waypoint.triggerPoint
var nowAfterTriggerPoint=axis.newScroll >=waypoint.triggerPoint
var crossedForward=wasBeforeTriggerPoint&&nowAfterTriggerPoint
var crossedBackward = !wasBeforeTriggerPoint&&!nowAfterTriggerPoint
if(crossedForward||crossedBackward){
waypoint.queueTrigger(direction)
triggeredGroups[waypoint.group.id]=waypoint.group
}}
}
for (var groupKey in triggeredGroups){
triggeredGroups[groupKey].flushTriggers()
}
this.oldScroll={
x: axes.horizontal.newScroll,
y: axes.vertical.newScroll
}}
Context.prototype.innerHeight=function(){
if(this.element==this.element.window){
return Waypoint.viewportHeight()
}
return this.adapter.innerHeight()
}
Context.prototype.remove=function(waypoint){
delete this.waypoints[waypoint.axis][waypoint.key]
this.checkEmpty()
}
Context.prototype.innerWidth=function(){
if(this.element==this.element.window){
return Waypoint.viewportWidth()
}
return this.adapter.innerWidth()
}
Context.prototype.destroy=function(){
var allWaypoints=[]
for (var axis in this.waypoints){
for (var waypointKey in this.waypoints[axis]){
allWaypoints.push(this.waypoints[axis][waypointKey])
}}
for (var i=0, end=allWaypoints.length; i < end; i++){
allWaypoints[i].destroy()
}}
Context.prototype.refresh=function(){
var isWindow=this.element==this.element.window
var contextOffset=isWindow ? undefined:this.adapter.offset()
var triggeredGroups={}
var axes
this.handleScroll()
axes={
horizontal: {
contextOffset: isWindow ? 0:contextOffset.left,
contextScroll: isWindow ? 0:this.oldScroll.x,
contextDimension: this.innerWidth(),
oldScroll: this.oldScroll.x,
forward: 'right',
backward: 'left',
offsetProp: 'left'
},
vertical: {
contextOffset: isWindow ? 0:contextOffset.top,
contextScroll: isWindow ? 0:this.oldScroll.y,
contextDimension: this.innerHeight(),
oldScroll: this.oldScroll.y,
forward: 'down',
backward: 'up',
offsetProp: 'top'
}}
for (var axisKey in axes){
var axis=axes[axisKey]
for (var waypointKey in this.waypoints[axisKey]){
var waypoint=this.waypoints[axisKey][waypointKey]
var adjustment=waypoint.options.offset
var oldTriggerPoint=waypoint.triggerPoint
var elementOffset=0
var freshWaypoint=oldTriggerPoint==null
var contextModifier, wasBeforeScroll, nowAfterScroll
var triggeredBackward, triggeredForward
if(waypoint.element!==waypoint.element.window){
elementOffset=waypoint.adapter.offset()[axis.offsetProp]
}
if(typeof adjustment==='function'){
adjustment=adjustment.apply(waypoint)
}
else if(typeof adjustment==='string'){
adjustment=parseFloat(adjustment)
if(waypoint.options.offset.indexOf('%') > - 1){
adjustment=Math.ceil(axis.contextDimension * adjustment / 100)
}}
contextModifier=axis.contextScroll - axis.contextOffset
waypoint.triggerPoint=Math.floor(elementOffset + contextModifier - adjustment)
wasBeforeScroll=oldTriggerPoint < axis.oldScroll
nowAfterScroll=waypoint.triggerPoint >=axis.oldScroll
triggeredBackward=wasBeforeScroll&&nowAfterScroll
triggeredForward = !wasBeforeScroll&&!nowAfterScroll
if(!freshWaypoint&&triggeredBackward){
waypoint.queueTrigger(axis.backward)
triggeredGroups[waypoint.group.id]=waypoint.group
}
else if(!freshWaypoint&&triggeredForward){
waypoint.queueTrigger(axis.forward)
triggeredGroups[waypoint.group.id]=waypoint.group
}
else if(freshWaypoint&&axis.oldScroll >=waypoint.triggerPoint){
waypoint.queueTrigger(axis.forward)
triggeredGroups[waypoint.group.id]=waypoint.group
}}
}
Waypoint.requestAnimationFrame(function(){
for (var groupKey in triggeredGroups){
triggeredGroups[groupKey].flushTriggers()
}})
return this
}
Context.findOrCreateByElement=function(element){
return Context.findByElement(element)||new Context(element)
}
Context.refreshAll=function(){
for (var contextId in contexts){
contexts[contextId].refresh()
}}
Context.findByElement=function(element){
return contexts[element.waypointContextKey]
}
window.onload=function(){
if(oldWindowLoad){
oldWindowLoad()
}
Context.refreshAll()
}
Waypoint.requestAnimationFrame=function(callback){
var requestFn=window.requestAnimationFrame ||
window.mozRequestAnimationFrame ||
window.webkitRequestAnimationFrame ||
requestAnimationFrameShim
requestFn.call(window, callback)
}
Waypoint.Context=Context
}())
;(function(){
'use strict'
function byTriggerPoint(a, b){
return a.triggerPoint - b.triggerPoint
}
function byReverseTriggerPoint(a, b){
return b.triggerPoint - a.triggerPoint
}
var groups={
vertical: {},
horizontal: {}}
var Waypoint=window.Waypoint
function Group(options){
this.name=options.name
this.axis=options.axis
this.id=this.name + '-' + this.axis
this.waypoints=[]
this.clearTriggerQueues()
groups[this.axis][this.name]=this
}
Group.prototype.add=function(waypoint){
this.waypoints.push(waypoint)
}
Group.prototype.clearTriggerQueues=function(){
this.triggerQueues={
up: [],
down: [],
left: [],
right: []
}}
Group.prototype.flushTriggers=function(){
for (var direction in this.triggerQueues){
var waypoints=this.triggerQueues[direction]
var reverse=direction==='up'||direction==='left'
waypoints.sort(reverse ? byReverseTriggerPoint:byTriggerPoint)
for (var i=0, end=waypoints.length; i < end; i +=1){
var waypoint=waypoints[i]
if(waypoint.options.continuous||i===waypoints.length - 1){
waypoint.trigger([direction])
}}
}
this.clearTriggerQueues()
}
Group.prototype.next=function(waypoint){
this.waypoints.sort(byTriggerPoint)
var index=Waypoint.Adapter.inArray(waypoint, this.waypoints)
var isLast=index===this.waypoints.length - 1
return isLast ? null:this.waypoints[index + 1]
}
Group.prototype.previous=function(waypoint){
this.waypoints.sort(byTriggerPoint)
var index=Waypoint.Adapter.inArray(waypoint, this.waypoints)
return index ? this.waypoints[index - 1]:null
}
Group.prototype.queueTrigger=function(waypoint, direction){
this.triggerQueues[direction].push(waypoint)
}
Group.prototype.remove=function(waypoint){
var index=Waypoint.Adapter.inArray(waypoint, this.waypoints)
if(index > -1){
this.waypoints.splice(index, 1)
}}
Group.prototype.first=function(){
return this.waypoints[0]
}
Group.prototype.last=function(){
return this.waypoints[this.waypoints.length - 1]
}
Group.findOrCreate=function(options){
return groups[options.axis][options.name]||new Group(options)
}
Waypoint.Group=Group
}())
;(function(){
'use strict'
var $=window.jQuery
var Waypoint=window.Waypoint
function JQueryAdapter(element){
this.$element=$(element)
}
$.each([
'innerHeight',
'innerWidth',
'off',
'offset',
'on',
'outerHeight',
'outerWidth',
'scrollLeft',
'scrollTop'
], function(i, method){
JQueryAdapter.prototype[method]=function(){
var args=Array.prototype.slice.call(arguments)
return this.$element[method].apply(this.$element, args)
}})
$.each([
'extend',
'inArray',
'isEmptyObject'
], function(i, method){
JQueryAdapter[method]=$[method]
})
Waypoint.adapters.push({
name: 'jquery',
Adapter: JQueryAdapter
})
Waypoint.Adapter=JQueryAdapter
}())
;(function(){
'use strict'
var Waypoint=window.Waypoint
function createExtension(framework){
return function(){
var waypoints=[]
var overrides=arguments[0]
if(framework.isFunction(arguments[0])){
overrides=framework.extend({}, arguments[1])
overrides.handler=arguments[0]
}
this.each(function(){
var options=framework.extend({}, overrides, {
element: this
})
if(typeof options.context==='string'){
options.context=framework(this).closest(options.context)[0]
}
waypoints.push(new Waypoint(options))
})
return waypoints
}}
if(window.jQuery){
window.jQuery.fn.waypoint=createExtension(window.jQuery)
}
if(window.Zepto){
window.Zepto.fn.waypoint=createExtension(window.Zepto)
}}())
;
(function(){
'use strict'
function noop(){}
var Waypoint=window.Waypoint
function Inview(options){
this.options=Waypoint.Adapter.extend({}, Inview.defaults, options)
this.axis=this.options.horizontal ? 'horizontal':'vertical'
this.waypoints=[]
this.element=this.options.element
this.createWaypoints()
}
Inview.prototype.createWaypoints=function(){
var configs={
vertical: [{
down: 'enter',
up: 'exited',
offset: '100%'
}, {
down: 'entered',
up: 'exit',
offset: 'bottom-in-view'
}, {
down: 'exit',
up: 'entered',
offset: 0
}, {
down: 'exited',
up: 'enter',
offset: function(){
return -this.adapter.outerHeight()
}}],
horizontal: [{
right: 'enter',
left: 'exited',
offset: '100%'
}, {
right: 'entered',
left: 'exit',
offset: 'right-in-view'
}, {
right: 'exit',
left: 'entered',
offset: 0
}, {
right: 'exited',
left: 'enter',
offset: function(){
return -this.adapter.outerWidth()
}}]
}
for (var i=0, end=configs[this.axis].length; i < end; i++){
var config=configs[this.axis][i]
this.createWaypoint(config)
}}
Inview.prototype.createWaypoint=function(config){
var self=this
this.waypoints.push(new Waypoint({
context: this.options.context,
element: this.options.element,
enabled: this.options.enabled,
handler: (function(config){
return function(direction){
self.options[config[direction]].call(self, direction)
}}(config)),
offset: config.offset,
horizontal: this.options.horizontal
}))
}
Inview.prototype.destroy=function(){
for (var i=0, end=this.waypoints.length; i < end; i++){
this.waypoints[i].destroy()
}
this.waypoints=[]
}
Inview.prototype.disable=function(){
for (var i=0, end=this.waypoints.length; i < end; i++){
this.waypoints[i].disable()
}}
Inview.prototype.enable=function(){
for (var i=0, end=this.waypoints.length; i < end; i++){
this.waypoints[i].enable()
}}
Inview.defaults={
context: window,
enabled: true,
enter: noop,
entered: noop,
exit: noop,
exited: noop
}
Waypoint.Inview=Inview
}())
;
(function($){
var menuTrees=[],
IE = !!window.createPopup,
IElt9=IE&&!document.defaultView,
IElt8=IE&&!document.querySelector,
IE6=IE&&typeof document.documentElement.currentStyle.minWidth=='undefined',
mouse=false,
mouseDetectionEnabled=false;
function initMouseDetection(disable){
if(!mouseDetectionEnabled&&!disable){
var firstTime=true,
lastMove=null;
$(document).bind({
'mousemove.smartmenus_mouse': function(e){
var thisMove={ x: e.pageX, y: e.pageY, timeStamp: new Date().getTime() };
if(lastMove){
var deltaX=Math.abs(lastMove.x - thisMove.x),
deltaY=Math.abs(lastMove.y - thisMove.y);
if((deltaX > 0||deltaY > 0)&&deltaX <=2&&deltaY <=2&&thisMove.timeStamp - lastMove.timeStamp <=300){
mouse=true;
if(firstTime){
var $a=$(e.target).closest('a');
if($a.is('a')){
$.each(menuTrees, function(){
if($.contains(this.$root[0], $a[0])){
this.itemEnter({ currentTarget: $a[0] });
return false;
}});
}
firstTime=false;
}}
}
lastMove=thisMove;
},
'touchstart.smartmenus_mouse pointerover.smartmenus_mouse MSPointerOver.smartmenus_mouse': function(e){
if(!/^(4|mouse)$/.test(e.originalEvent.pointerType)){
mouse=false;
}}
});
mouseDetectionEnabled=true;
}else if(mouseDetectionEnabled&&disable){
$(document).unbind('.smartmenus_mouse');
mouseDetectionEnabled=false;
}};
$.SmartMenus=function(elm, options){
this.$root=$(elm);
this.opts=options;
this.rootId='';
this.$subArrow=null;
this.subMenus=[];
this.activatedItems=[];
this.visibleSubMenus=[];
this.showTimeout=0;
this.hideTimeout=0;
this.scrollTimeout=0;
this.clickActivated=false;
this.zIndexInc=0;
this.$firstLink=null;
this.$firstSub=null;
this.disabled=false;
this.$disableOverlay=null;
this.init();
};
$.extend($.SmartMenus, {
hideAll: function(){
$.each(menuTrees, function(){
this.menuHideAll();
});
},
destroy: function(){
while (menuTrees.length){
menuTrees[0].destroy();
}
initMouseDetection(true);
},
prototype: {
init: function(refresh){
var self=this;
if(!refresh){
menuTrees.push(this);
this.rootId=(new Date().getTime() + Math.random() + '').replace(/\D/g, '');
if(this.$root.hasClass('sm-rtl')){
this.opts.rightToLeftSubMenus=true;
}
this.$root
.data('smartmenus', this)
.attr('data-smartmenus-id', this.rootId)
.dataSM('level', 1)
.bind({
'mouseover.smartmenus focusin.smartmenus': $.proxy(this.rootOver, this),
'mouseout.smartmenus focusout.smartmenus': $.proxy(this.rootOut, this)
})
.delegate('a, div.logo-container', {
'mouseenter.smartmenus': $.proxy(this.itemEnter, this),
'mouseleave.smartmenus': $.proxy(this.itemLeave, this),
'mousedown.smartmenus': $.proxy(this.itemDown, this),
'focus.smartmenus': $.proxy(this.itemFocus, this),
'blur.smartmenus': $.proxy(this.itemBlur, this),
'click.smartmenus': $.proxy(this.itemClick, this),
'touchend.smartmenus': $.proxy(this.itemTouchEnd, this)
});
var eNamespace='.smartmenus' + this.rootId;
if(this.opts.hideOnClick){
$(document).bind('touchstart' + eNamespace, $.proxy(this.docTouchStart, this))
.bind('touchmove' + eNamespace, $.proxy(this.docTouchMove, this))
.bind('touchend' + eNamespace, $.proxy(this.docTouchEnd, this))
.bind('click' + eNamespace, $.proxy(this.docClick, this));
}
$(window).bind('resize' + eNamespace + ' orientationchange' + eNamespace, $.proxy(this.winResize, this));
$(window).bind('scroll' + eNamespace + ' orientationchange' + eNamespace, $.proxy(this.winResize, this));
if(this.opts.subIndicators){
this.$subArrow=$('').addClass('sub-arrow');
if(this.opts.subIndicatorsText){
this.$subArrow.html(this.opts.subIndicatorsText);
}}
initMouseDetection();
}
this.$firstSub=this.$root.find('ul').each(function(){ self.menuInit($(this)); }).eq(0);
this.$firstLink=this.$root.find('a').eq(0);
if(this.opts.markCurrentItem){
var reDefaultDoc=/(index|default)\.[^#\?\/]*/i,
reHash=/#.*/,
locHref=window.location.href.replace(reDefaultDoc, ''),
locHrefNoHash=locHref.replace(reHash, '');
this.$root.find('a').each(function(){
var href=this.href.replace(reDefaultDoc, ''),
$this=$(this);
if(href==locHref||href==locHrefNoHash){
$this.addClass('current');
if(self.opts.markCurrentTree){
$this.parents('li').each(function(){
var $this=$(this);
if($this.dataSM('sub')){
$this.children('a').addClass('current');
}});
}}
});
}},
destroy: function(){
this.menuHideAll();
this.$root
.removeData('smartmenus')
.removeAttr('data-smartmenus-id')
.removeDataSM('level')
.unbind('.smartmenus')
.undelegate('.smartmenus');
var eNamespace='.smartmenus' + this.rootId;
$(document).unbind(eNamespace);
$(window).unbind(eNamespace);
if(this.opts.subIndicators){
this.$subArrow=null;
}
var self=this;
$.each(this.subMenus, function(){
if(this.hasClass('mega-menu')){
this.find('ul').removeDataSM('in-mega');
}
if(this.dataSM('shown-before')){
if(IElt8){
this.children().css({ styleFloat: '', width: '' });
}
if(self.opts.subMenusMinWidth||self.opts.subMenusMaxWidth){
if(!IE6){
this.css({ width: '', minWidth: '', maxWidth: '' }).removeClass('sm-nowrap');
}else{
this.css({ width: '', overflowX: '', overflowY: '' }).children().children('a').css('white-space', '');
}}
if(this.dataSM('scroll-arrows')){
this.dataSM('scroll-arrows').remove();
}
this.css({ zIndex: '', top: '', left: '', marginLeft: '', marginTop: '', display: '' });
}
if(self.opts.subIndicators){
this.dataSM('parent-a').removeClass('has-submenu').children('span.sub-arrow').remove();
}
this.removeDataSM('shown-before')
.removeDataSM('ie-shim')
.removeDataSM('scroll-arrows')
.removeDataSM('parent-a')
.removeDataSM('level')
.removeDataSM('beforefirstshowfired')
.parent().removeDataSM('sub');
});
if(this.opts.markCurrentItem){
this.$root.find('a.current').removeClass('current');
}
this.$root=null;
this.$firstLink=null;
this.$firstSub=null;
if(this.$disableOverlay){
this.$disableOverlay.remove();
this.$disableOverlay=null;
}
menuTrees.splice($.inArray(this, menuTrees), 1);
},
disable: function(noOverlay){
if(!this.disabled){
this.menuHideAll();
if(!noOverlay&&!this.opts.isPopup&&this.$root.is(':visible')){
var pos=this.$root.offset();
this.$disableOverlay=$('').css({
position: 'absolute',
top: pos.top,
left: pos.left,
width: this.$root.outerWidth(),
height: this.$root.outerHeight(),
zIndex: this.getStartZIndex() + 1,
opacity: 0
}).appendTo(document.body);
}
this.disabled=true;
}},
docClick: function(e){
if(this.visibleSubMenus.length&&!$.contains(this.$root[0], e.target)||$(e.target).is('a')){
this.menuHideAll($(e.target));
}},
docTouchEnd: function(e){
if(!this.lastTouch){
return;
}
if(this.visibleSubMenus.length&&(this.lastTouch.x2===undefined||this.lastTouch.x1==this.lastTouch.x2)&&(this.lastTouch.y2===undefined||this.lastTouch.y1==this.lastTouch.y2)&&(!this.lastTouch.target||!$.contains(this.$root[0], this.lastTouch.target))){
if(this.hideTimeout){
clearTimeout(this.hideTimeout);
this.hideTimeout=0;
}
var self=this;
this.hideTimeout=setTimeout(function(){ self.menuHideAll($(e.target)); }, 350);
}
this.lastTouch=null;
},
docTouchMove: function(e){
if(!this.lastTouch){
return;
}
var touchPoint=e.originalEvent.touches[0];
this.lastTouch.x2=touchPoint.pageX;
this.lastTouch.y2=touchPoint.pageY;
},
docTouchStart: function(e){
var touchPoint=e.originalEvent.touches[0];
this.lastTouch={ x1: touchPoint.pageX, y1: touchPoint.pageY, target: touchPoint.target };},
enable: function(){
if(this.disabled){
if(this.$disableOverlay){
this.$disableOverlay.remove();
this.$disableOverlay=null;
}
this.disabled=false;
}},
getHeight: function($elm){
return this.getOffset($elm, true);
},
getOffset: function($elm, height){
var old;
if($elm.css('display')=='none'){
old={ position: $elm[0].style.position, visibility: $elm[0].style.visibility };
$elm.css({ position: 'absolute', visibility: 'hidden' }).show();
}
var defaultView=$elm[0].ownerDocument.defaultView,
compStyle=defaultView&&defaultView.getComputedStyle&&defaultView.getComputedStyle($elm[0], null),
val=compStyle&&parseFloat(compStyle[height ? 'height':'width']);
if(val){
val +=parseFloat(compStyle[height ? 'paddingTop':'paddingLeft'])
+ parseFloat(compStyle[height ? 'paddingBottom':'paddingRight'])
+ parseInt(compStyle[height ? 'borderTopWidth':'borderLeftWidth'])
+ parseInt(compStyle[height ? 'borderBottomWidth':'borderRightWidth']);
}else{
val=height ? $elm[0].offsetHeight:$elm[0].offsetWidth;
}
if(old){
$elm.hide().css(old);
}
return val;
},
getWidth: function($elm){
return this.getOffset($elm);
},
getStartZIndex: function(){
var zIndex=parseInt(this.$root.css('z-index'));
return !isNaN(zIndex) ? zIndex:1;
},
handleEvents: function(){
return !this.disabled&&this.isCSSOn();
},
handleItemEvents: function($a){
return this.handleEvents()&&!this.isLinkInMegaMenu($a);
},
isCollapsible: function(){
return this.$firstSub.css('position')=='static';
},
isCSSOn: function(){
return this.$firstLink.css('display')=='block'||this.$firstLink.css('display')=='flex'||this.$firstLink.css('display')=='inline-flex'||this.$firstLink.css('display')=='table-cell'||this.$firstLink.css('display')=='inline';
},
isFixed: function(){
return this.$root.css('position')=='fixed';
},
isLinkInMegaMenu: function($a){
return !$a.parent().parent().dataSM('level');
},
isTouchMode: function(){
return !mouse||this.isCollapsible();
},
itemActivate: function($a){
var $li=$a.parent(),
$ul=$li.parent(),
level=$ul.dataSM('level');
if(level > 1&&(!this.activatedItems[level - 2]||this.activatedItems[level - 2][0]!=$ul.dataSM('parent-a')[0])){
var self=this;
$($ul.parentsUntil('[data-smartmenus-id]', 'ul').get().reverse()).add($ul).each(function(){
self.itemActivate($(this).dataSM('parent-a'));
});
}
if(this.visibleSubMenus.length > level){
for (var i=this.visibleSubMenus.length - 1, l = !this.activatedItems[level - 1]||this.activatedItems[level - 1][0]!=$a[0] ? level - 1:level; i > l; i--){
this.menuHide(this.visibleSubMenus[i]);
}}
this.activatedItems[level - 1]=$a;
this.visibleSubMenus[level - 1]=$ul;
if(this.$root.triggerHandler('activate.smapi', $a[0])===false){
return;
}
var $sub=$li.dataSM('sub');
if($sub&&(this.isTouchMode()||(!this.opts.showOnClick||this.clickActivated))){
this.menuShow($sub);
}},
itemBlur: function(e){
var $a=$(e.currentTarget);
if(!this.handleItemEvents($a)){
return;
}
this.$root.triggerHandler('blur.smapi', $a[0]);
},
itemClick: function(e){
var $a=$(e.currentTarget);
if(!this.handleItemEvents($a)){
return;
}
$a.removeDataSM('mousedown');
if(this.$root.triggerHandler('click.smapi', $a[0])===false){
return false;
}
var $sub=$a.parent().dataSM('sub');
if(this.isTouchMode()){
if($a.dataSM('href')){
$a.attr('href', $a.dataSM('href')).removeDataSM('href');
}
if($sub&&(!$sub.dataSM('shown-before')||!$sub.is(':visible'))){
this.itemActivate($a);
if($sub.is(':visible')){
return false;
}}
}else if(this.opts.showOnClick&&$a.parent().parent().dataSM('level')==1&&$sub){
this.clickActivated=true;
this.menuShow($sub);
return false;
}
if($a.hasClass('disabled')){
return false;
}
if(this.$root.triggerHandler('select.smapi', $a[0])===false){
return false;
}},
itemDown: function(e){
var $a=$(e.currentTarget);
if(!this.handleItemEvents($a)){
return;
}
$a.dataSM('mousedown', true);
},
itemEnter: function(e){
var $a=$(e.currentTarget);
if(!this.handleItemEvents($a)){
return;
}
if(!this.isTouchMode()){
if(this.showTimeout){
clearTimeout(this.showTimeout);
this.showTimeout=0;
}
var self=this;
this.showTimeout=setTimeout(function(){ self.itemActivate($a); }, this.opts.showOnClick&&$a.parent().parent().dataSM('level')==1 ? 1:this.opts.showTimeout);
}
this.$root.triggerHandler('mouseenter.smapi', $a[0]);
},
itemFocus: function(e){
var $a=$(e.currentTarget);
if(!this.handleItemEvents($a)){
return;
}
if((!this.isTouchMode()||!$a.dataSM('mousedown'))&&(!this.activatedItems.length||this.activatedItems[this.activatedItems.length - 1][0]!=$a[0])){
this.itemActivate($a);
}
this.$root.triggerHandler('focus.smapi', $a[0]);
},
itemLeave: function(e){
var $a=$(e.currentTarget);
if(!this.handleItemEvents($a)){
return;
}
if(!this.isTouchMode()){
if($a[0].blur){
$a[0].blur();
}
if(this.showTimeout){
clearTimeout(this.showTimeout);
this.showTimeout=0;
}}
$a.removeDataSM('mousedown');
this.$root.triggerHandler('mouseleave.smapi', $a[0]);
},
itemTouchEnd: function(e){
var $a=$(e.currentTarget);
if(!this.handleItemEvents($a)){
return;
}
var $sub=$a.parent().dataSM('sub');
if($a.attr('href').charAt(0)!=='#'&&$sub&&(!$sub.dataSM('shown-before')||!$sub.is(':visible'))){
$a.dataSM('href', $a.attr('href'));
$a.attr('href', '#');
}},
menuFixLayout: function($ul){
if(!$ul.dataSM('shown-before')){
$ul.hide().dataSM('shown-before', true);
if(IElt8){
$ul.children().css({ styleFloat: 'left', width: '100%' });
}}
},
menuHide: function($sub){
if(this.$root.triggerHandler('beforehide.smapi', $sub[0])===false){
return;
}
$sub.stop(true, true);
if($sub.is(':visible')){
var complete=function(){
if(IElt9){
$sub.parent().css('z-index', '');
}else{
$sub.css('z-index', '');
}};
if(this.isCollapsible()){
if(this.opts.collapsibleHideFunction){
this.opts.collapsibleHideFunction.call(this, $sub, complete);
}else{
$sub.hide(this.opts.collapsibleHideDuration, complete);
}}else{
if(this.opts.hideFunction){
this.opts.hideFunction.call(this, $sub, complete);
}else{
$sub.hide(this.opts.hideDuration, complete);
}}
if($sub.dataSM('ie-shim')){
$sub.dataSM('ie-shim').remove();
}
if($sub.dataSM('scroll')){
$sub.unbind('.smartmenus_scroll').removeDataSM('scroll').dataSM('scroll-arrows').hide();
}
$sub.dataSM('parent-a').removeClass('highlighted');
var level=$sub.dataSM('level');
this.activatedItems.splice(level - 1, 1);
this.visibleSubMenus.splice(level - 1, 1);
this.$root.triggerHandler('hide.smapi', $sub[0]);
}},
menuHideAll: function($item){
if($item!=undefined&&$item.parent().hasClass('menu-item')&&!$item.parent().hasClass('menu-item-has-children')) return;
var $win=$(window),
winW=$win.width();
if($('body').hasClass('vmenu')&&winW >=560){
return;
}
if(this.showTimeout){
clearTimeout(this.showTimeout);
this.showTimeout=0;
}
for (var i=this.visibleSubMenus.length - 1; i > 0; i--){
this.menuHide(this.visibleSubMenus[i]);
}
if(this.opts.isPopup){
this.$root.stop(true, true);
if(this.$root.is(':visible')){
if(this.opts.hideFunction){
this.opts.hideFunction.call(this, this.$root);
}else{
this.$root.hide(this.opts.hideDuration);
}
if(this.$root.dataSM('ie-shim')){
this.$root.dataSM('ie-shim').remove();
}}
}
this.activatedItems=[];
this.visibleSubMenus=[];
this.clickActivated=false;
this.zIndexInc=0;
},
menuIframeShim: function($ul){
if(IE&&this.opts.overlapControlsInIE&&!$ul.dataSM('ie-shim')){
$ul.dataSM('ie-shim', $('').attr({ src: 'javascript:0', tabindex: -9 })
.css({ position: 'absolute', top: 'auto', left: '0', opacity: 0, border: '0' })
);
}},
menuInit: function($ul){
if(!$ul.dataSM('in-mega')){
this.subMenus.push($ul);
if($ul.hasClass('mega-menu')){
$ul.find('ul').dataSM('in-mega', true);
}
var level=2,
par=$ul[0];
while (par!=null&&par.parentNode!=null&&(par=par.parentNode.parentNode)!=this.$root[0]){
level++;
}
$ul.dataSM('parent-a', $ul.prevAll('a').eq(-1))
.dataSM('level', level)
.parent().dataSM('sub', $ul);
if(this.opts.subIndicators){
$ul.dataSM('parent-a').addClass('has-submenu')[this.opts.subIndicatorsPos](this.$subArrow.clone());
}}
},
menuPosition: function($sub){
var fixIE=$('html.ie').length;
var $a=$sub.dataSM('parent-a'),
$li=$sub.parent(),
$ul=$sub.parent().parent(),
$container=$ul.closest('.row-menu-inner').length ?($('body').hasClass('megamenu-side-to-side') ? $ul.closest('.row-menu'):$ul.closest('.row-menu-inner')):$ul.closest('.uncol'),
level=$sub.dataSM('level'),
subW=this.getWidth($sub),
subH=this.getHeight($sub),
itemOffset=$a.offset(),
itemX=itemOffset.left,
itemY=itemOffset.top,
itemW=this.getWidth($a),
itemH=this.getHeight($a),
$win=$(window),
winX=$win.scrollLeft(),
winY=$win.scrollTop(),
winW=$win.width(),
winH=$win.height(),
containerW=$container.width(),
containerOffsetX=containerW + ((winW - containerW) / 2),
horizontalParent=$ul.hasClass('sm')&&!$ul.hasClass('sm-vertical'),
subOffsetX=level==2 ? this.opts.mainMenuSubOffsetX:this.opts.subMenusSubOffsetX,
subOffsetY=level==2 ? this.opts.mainMenuSubOffsetY:this.opts.subMenusSubOffsetY,
x, y, leftPos;
if(horizontalParent){
x=this.opts.rightToLeftSubMenus ? itemW - subW - subOffsetX:subOffsetX;
y=this.opts.bottomToTopSubMenus ? -subH - subOffsetY:itemH + subOffsetY;
}else{
x=this.opts.rightToLeftSubMenus ? subOffsetX - subW:subW - subOffsetX;
y=this.opts.bottomToTopSubMenus ? itemH - subOffsetY - subH:subOffsetY;
}
if(this.opts.keepInViewport&&!this.isCollapsible()){
if(this.isFixed()){
itemX -=winX;
itemY -=winY;
winX=winY=0;
}
var absX=itemX + x,
absY=itemY + y;
if(this.opts.rightToLeftSubMenus&&absX < winX){
x=horizontalParent ? winX - absX + x:itemW - subOffsetX;
}else if(!this.opts.rightToLeftSubMenus&&absX + subW > winX + containerOffsetX){
x=horizontalParent ? winX + containerOffsetX - subW - absX + x:subOffsetX - subW;
}
if(!horizontalParent){
if(subH < winH&&absY + subH > winY + winH){
y +=winY + winH - subH - absY;
}else if(subH >=winH||absY < winY){
y +=winY - absY;
}}
if(mouse&&(horizontalParent&&(absY + subH > winY + winH + 0.49||absY < winY)||!horizontalParent&&subH > winH + 0.49)){
var self=this;
if(!$sub.dataSM('scroll-arrows')){
$sub.dataSM('scroll-arrows', $([$('')[0], $('')[0]])
.bind({
mouseenter: function(){ self.menuScroll($sub, $(this).hasClass('scroll-up')); },
mouseleave: function(e){
self.menuScrollStop($sub);
self.menuScrollOut($sub, e);
},
'mousewheel DOMMouseScroll': function(e){ e.preventDefault(); }})
.insertAfter($sub)
);
}
var vportY=winY - (itemY + itemH);
$sub.dataSM('scroll', {
vportY: vportY,
subH: subH,
winH: winH,
step: 1
})
.bind({
'mouseover.smartmenus_scroll': function(e){ self.menuScrollOver($sub, e); },
'mouseout.smartmenus_scroll': function(e){ self.menuScrollOut($sub, e); },
'mousewheel.smartmenus_scroll DOMMouseScroll.smartmenus_scroll': function(e){ self.menuScrollMousewheel($sub, e); }})
.dataSM('scroll-arrows').css({ top: 'auto', left: '0', marginLeft: x + (parseInt($sub.css('border-left-width'))||0), width: this.getWidth($sub) - (parseInt($sub.css('border-left-width'))||0) - (parseInt($sub.css('border-right-width'))||0), zIndex: this.getStartZIndex() + this.zIndexInc })
.eq(0).css('margin-top', vportY).end()
.eq(1).css('margin-top', vportY + winH - this.getHeight($sub.dataSM('scroll-arrows').eq(1))).end()
.eq(horizontalParent&&this.opts.bottomToTopSubMenus ? 0:1).show();
}}
if(!$sub.closest('.menu-accordion').length){
var rightPos='auto';
if($sub.parents('.isotope-filters').length){
if($sub.parents('.text-right').eq(0).length){
leftPos='0px';
rightPos='auto';
}else{
leftPos='auto';
rightPos='0px';
}
x=0;
}else{
if($sub.hasClass('mega-menu-inner')){
$sub.css({ width: containerW});
leftPos=-1 * (parseFloat($sub.closest('ul.menu-smart').offset().left) - parseFloat($sub.closest('.row-menu').offset().left));
if(! $('body').hasClass('megamenu-side-to-side')){
leftPos +=parseFloat($sub.closest('.row-menu-inner').css('paddingLeft'));
}
x=0;
}else{
leftPos=(level > 2 ? $li.position().left - parseFloat($li.closest('ul').css('paddingLeft')):$li.position().left) + 'px';
x=(level > 2&&x >=0) ? x + 1:x - 1;
}}
}
$sub.css({ top: (level > 2) ? $a[0].offsetTop:(fixIE ? itemH:'100%'), left: leftPos, right: rightPos, marginLeft: x, marginTop: (level > 2) ? 0:y - itemH + ($sub.closest('.menu-borders').length&&!$sub.closest('.menu-borders.needs-after').length ? 1:0) });
this.menuIframeShim($sub);
if($sub.dataSM('ie-shim')){
$sub.dataSM('ie-shim').css({ zIndex: $sub.css('z-index'), width: subW, height: subH, marginLeft: x, marginTop: y - itemH + ($sub.closest('.menu-mini').length ? 0:1) });
}},
menuScroll: function($sub, up, wheel){
var y=parseFloat($sub.css('margin-top')),
scroll=$sub.dataSM('scroll'),
end=scroll.vportY + (up ? 0:scroll.winH - scroll.subH),
step=wheel||!this.opts.scrollAccelerate ? this.opts.scrollStep:Math.floor($sub.dataSM('scroll').step);
$sub.add($sub.dataSM('ie-shim')).css('margin-top', Math.abs(end - y) > step ? y + (up ? step:-step):end);
y=parseFloat($sub.css('margin-top'));
if(up&&y + scroll.subH > scroll.vportY + scroll.winH||!up&&y < scroll.vportY){
$sub.dataSM('scroll-arrows').eq(up ? 1:0).show();
}
if(!wheel&&this.opts.scrollAccelerate&&$sub.dataSM('scroll').step < this.opts.scrollStep){
$sub.dataSM('scroll').step +=0.5;
}
if(Math.abs(y - end) < 1){
$sub.dataSM('scroll-arrows').eq(up ? 0:1).hide();
$sub.dataSM('scroll').step=1;
}else if(!wheel){
var self=this;
this.scrollTimeout=setTimeout(function(){ self.menuScroll($sub, up); }, this.opts.scrollInterval);
}},
menuScrollMousewheel: function($sub, e){
var $closestSub=$(e.target).closest('ul');
while ($closestSub.dataSM('in-mega')){
$closestSub=$closestSub.parent().closest('ul');
}
if($closestSub[0]==$sub[0]){
var up=(e.originalEvent.wheelDelta||-e.originalEvent.detail) > 0;
if($sub.dataSM('scroll-arrows').eq(up ? 0:1).is(':visible')){
this.menuScroll($sub, up, true);
}}
e.preventDefault();
},
menuScrollOut: function($sub, e){
var reClass=/^scroll-(up|down)/,
$closestSub=$(e.relatedTarget).closest('ul');
while ($closestSub.dataSM('in-mega')){
$closestSub=$closestSub.parent().closest('ul');
}
if(!reClass.test((e.relatedTarget||'').className)&&($sub[0]!=e.relatedTarget&&!$.contains($sub[0], e.relatedTarget)||$closestSub[0]!=$sub[0])){
$sub.dataSM('scroll-arrows').css('visibility', 'hidden');
}},
menuScrollOver: function($sub, e){
var reClass=/^scroll-(up|down)/,
$closestSub=$(e.target).closest('ul');
while ($closestSub.dataSM('in-mega')){
$closestSub=$closestSub.parent().closest('ul');
}
if(!reClass.test(e.target.className)&&$closestSub[0]==$sub[0]){
$sub.dataSM('scroll-arrows').css('visibility', 'visible');
}},
menuScrollStop: function($sub){
if(this.scrollTimeout){
clearTimeout(this.scrollTimeout);
this.scrollTimeout=0;
$sub.dataSM('scroll').step=1;
}},
menuShow: function($sub){
if(!$sub.dataSM('beforefirstshowfired')){
$sub.dataSM('beforefirstshowfired', true);
if(this.$root.triggerHandler('beforefirstshow.smapi', $sub[0])===false){
return;
}}
if(this.$root.triggerHandler('beforeshow.smapi', $sub[0])===false){
return;
}
this.menuFixLayout($sub);
$sub.stop(true, true);
if(!$sub.is(':visible')){
$sub.css({
'visibility': 'visible',
'pointer-events': 'auto',
});
var zIndex=this.getStartZIndex() + (++this.zIndexInc);
if(IElt9){
$sub.parent().css('z-index', zIndex);
}else{
$sub.css('z-index', zIndex);
}
if(this.opts.keepHighlighted||this.isCollapsible()){
if($sub.dataSM('parent-a').attr('data-type')!='title')
$sub.dataSM('parent-a').addClass('highlighted');
}
if(this.opts.subMenusMinWidth||this.opts.subMenusMaxWidth){
if(!IElt8){
$sub.css({ width: ($sub.hasClass('mega-menu-inner')) ? $('.box-container').outerWidth() + 'px':'auto', minWidth: '', maxWidth: '' }).addClass('sm-nowrap');
if(this.opts.subMenusMinWidth){
$sub.css('min-width', this.opts.subMenusMinWidth);
}
if(this.opts.subMenusMaxWidth){
var noMaxWidth=this.getWidth($sub);
if(! $sub.hasClass('mega-menu-inner')){
$sub.css('max-width', this.opts.subMenusMaxWidth);
}
if(noMaxWidth > this.getWidth($sub)){
$sub.removeClass('sm-nowrap').css('width', this.opts.subMenusMaxWidth);
}}
}else{
$sub.children().css('styleFloat', 'none');
if(IE6){
$sub.width(this.opts.subMenusMinWidth ? this.opts.subMenusMinWidth:1)
.children().children('a').css('white-space', 'nowrap');
}else{
$sub.css({ width: ($sub.hasClass('mega-menu-inner')) ? $('.box-container').outerWidth() + 'px':'auto', minWidth: '', maxWidth: '' }).addClass('sm-nowrap');
if(this.opts.subMenusMinWidth){
$sub.css('min-width', this.opts.subMenusMinWidth);
}}
if(this.opts.subMenusMaxWidth){
var noMaxWidth=$sub.width();
if(IE6){
var maxWidth=$sub.css({ width: this.opts.subMenusMaxWidth, overflowX: 'hidden', overflowY: 'hidden' }).width();
if(noMaxWidth > maxWidth){
$sub.css({ width: maxWidth, overflowX: 'visible', overflowY: 'visible' }).children().children('a').css('white-space', '');
}else{
$sub.css({ width: noMaxWidth, overflowX: 'visible', overflowY: 'visible' });
}}else{
if(! $sub.hasClass('mega-menu-inner')){
$sub.css('max-width', this.opts.subMenusMaxWidth);
}
if(noMaxWidth > $sub.width()){
$sub.removeClass('sm-nowrap').css('width', this.opts.subMenusMaxWidth);
}else{
$sub.width(noMaxWidth);
}}
}else{
$sub.width($sub.width());
}
$sub.children().css('styleFloat', 'left');
}}
this.menuPosition($sub);
if($sub.dataSM('ie-shim')){
$sub.dataSM('ie-shim').insertBefore($sub);
}
var complete=function(){
$sub.css('overflow', '');
};
if(this.isCollapsible()){
if(this.opts.collapsibleShowFunction){
this.opts.collapsibleShowFunction.call(this, $sub, complete);
}else{
$sub.show(this.opts.collapsibleShowDuration, complete);
}}else{
if(this.opts.showFunction){
this.opts.showFunction.call(this, $sub, complete);
}else{
$sub.show(this.opts.showDuration, complete);
}}
this.visibleSubMenus[$sub.dataSM('level') - 1]=$sub;
this.$root.triggerHandler('show.smapi', $sub[0]);
}},
popupHide: function(noHideTimeout){
if(this.hideTimeout){
clearTimeout(this.hideTimeout);
this.hideTimeout=0;
}
var self=this;
this.hideTimeout=setTimeout(function(){
self.menuHideAll();
}, noHideTimeout ? 1:this.opts.hideTimeout);
},
popupShow: function(left, top){
if(!this.opts.isPopup){
alert('SmartMenus jQuery Error:\n\nIf you want to show this menu via the "popupShow" method, set the isPopup:true option.');
return;
}
if(this.hideTimeout){
clearTimeout(this.hideTimeout);
this.hideTimeout=0;
}
this.menuFixLayout(this.$root);
this.$root.stop(true, true);
if(!this.$root.is(':visible')){
this.$root.css({ left: left, top: top });
this.menuIframeShim(this.$root);
if(this.$root.dataSM('ie-shim')){
this.$root.dataSM('ie-shim').css({ zIndex: this.$root.css('z-index'), width: this.getWidth(this.$root), height: this.getHeight(this.$root), left: left, top: top }).insertBefore(this.$root);
}
if(this.opts.showFunction){
this.opts.showFunction.call(this, this.$root);
}else{
this.$root.show(this.opts.showDuration);
}
this.visibleSubMenus[0]=this.$root;
}},
refresh: function(){
this.menuHideAll();
this.$root.find('ul').each(function(){
var $this=$(this);
if($this.dataSM('scroll-arrows')){
$this.dataSM('scroll-arrows').remove();
}})
.removeDataSM('in-mega')
.removeDataSM('shown-before')
.removeDataSM('ie-shim')
.removeDataSM('scroll-arrows')
.removeDataSM('parent-a')
.removeDataSM('level')
.removeDataSM('beforefirstshowfired');
this.$root.find('a.has-submenu').removeClass('has-submenu')
.parent().removeDataSM('sub');
if(this.opts.subIndicators){
this.$root.find('span.sub-arrow').remove();
}
if(this.opts.markCurrentItem){
this.$root.find('a.current').removeClass('current');
}
this.subMenus=[];
this.init(true);
},
rootOut: function(e){
if(!this.handleEvents()||this.isTouchMode()||e.target==this.$root[0]){
return;
}
if(this.hideTimeout){
clearTimeout(this.hideTimeout);
this.hideTimeout=0;
}
if(!this.opts.showOnClick||!this.opts.hideOnClick){
var self=this;
this.hideTimeout=setTimeout(function(){ self.menuHideAll(); }, this.opts.hideTimeout);
}},
rootOver: function(e){
if(!this.handleEvents()||this.isTouchMode()||e.target==this.$root[0]){
return;
}
if(this.hideTimeout){
clearTimeout(this.hideTimeout);
this.hideTimeout=0;
}},
winResize: function(e){
if(!this.handleEvents()){
if(this.$disableOverlay){
var pos=this.$root.offset();
this.$disableOverlay.css({
top: pos.top,
left: pos.left,
width: this.$root.outerWidth(),
height: this.$root.outerHeight()
});
}
return;
}
if(!this.isCollapsible()&&(!('onorientationchange' in window)||e.type=='orientationchange')){
if(this.activatedItems.length){
this.activatedItems[this.activatedItems.length - 1][0].blur();
}
this.menuHideAll();
}}
}});
$.fn.dataSM=function(key, val){
if(val){
return this.data(key + '_smartmenus', val);
}
return this.data(key + '_smartmenus');
}
$.fn.removeDataSM=function(key){
return this.removeData(key + '_smartmenus');
}
$.fn.smartmenus=function(options){
if(typeof options=='string'){
var args=arguments,
method=options;
Array.prototype.shift.call(args);
return this.each(function(){
var smartmenus=$(this).data('smartmenus');
if(smartmenus&&smartmenus[method]){
smartmenus[method].apply(smartmenus, args);
}});
}
var opts=$.extend({}, $.fn.smartmenus.defaults, options);
return this.each(function(){
new $.SmartMenus(this, opts);
});
}
$.fn.smartmenus.defaults={
isPopup: false,
mainMenuSubOffsetX: 0,
mainMenuSubOffsetY: 0,
subMenusSubOffsetX: 0,
subMenusSubOffsetY: 0,
subMenusMinWidth: false, //'10em', // min-width for the sub menus (any CSS unit) - if set, the fixed width set in CSS will be ignored
subMenusMaxWidth: false, //'20em', // max-width for the sub menus (any CSS unit) - if set, the fixed width set in CSS will be ignored
subIndicators: true,
subIndicatorsPos: 'prepend',
subIndicatorsText: '+',
scrollStep: 30,
scrollInterval: 30,
scrollAccelerate: true,
showTimeout: 250,
hideTimeout: 500,
showDuration: 0,
showFunction: null,
hideDuration: 0,
hideFunction: function($ul, complete){ $ul.fadeOut(200, complete); },
collapsibleShowDuration:0,
collapsibleShowFunction:function($ul, complete){ $ul.slideDown(200, complete); },
collapsibleHideDuration:0,
collapsibleHideFunction:function($ul, complete){ $ul.slideUp(200, complete); },
showOnClick: false,
hideOnClick: true,
keepInViewport: true,
keepHighlighted: true,
markCurrentItem: false,
markCurrentTree: true,
rightToLeftSubMenus: false,
bottomToTopSubMenus: false,
overlapControlsInIE: true
};})(jQuery);
(function (factory){
if(typeof define==="function"&&define.amd){
define(['jquery'], function ($){
return factory($);
});
}else if(typeof module==="object"&&typeof module.exports==="object"){
module.exports=factory(require('jquery'));
}else{
factory(jQuery);
}})(function($){
if(typeof $.easing!=='undefined'){
$.easing['jswing']=$.easing['swing'];
}
var pow=Math.pow,
sqrt=Math.sqrt,
sin=Math.sin,
cos=Math.cos,
PI=Math.PI,
c1=1.70158,
c2=c1 * 1.525,
c3=c1 + 1,
c4=(2 * PI) / 3,
c5=(2 * PI) / 4.5;
function bounceOut(x){
var n1=7.5625,
d1=2.75;
if(x < 1/d1){
return n1*x*x;
}else if(x < 2/d1){
return n1*(x-=(1.5/d1))*x + .75;
}else if(x < 2.5/d1){
return n1*(x-=(2.25/d1))*x + .9375;
}else{
return n1*(x-=(2.625/d1))*x + .984375;
}}
$.extend($.easing, {
def: 'easeOutQuad',
swing: function (x){
return $.easing[$.easing.def](x);
},
easeInQuad: function (x){
return x * x;
},
easeOutQuad: function (x){
return 1 -(1 - x) *(1 - x);
},
easeInOutQuad: function (x){
return x < 0.5 ?
2 * x * x :
1 - pow(-2 * x + 2, 2) / 2;
},
easeInCubic: function (x){
return x * x * x;
},
easeOutCubic: function (x){
return 1 - pow(1 - x, 3);
},
easeInOutCubic: function (x){
return x < 0.5 ?
4 * x * x * x :
1 - pow(-2 * x + 2, 3) / 2;
},
easeInQuart: function (x){
return x * x * x * x;
},
easeOutQuart: function (x){
return 1 - pow(1 - x, 4);
},
easeInOutQuart: function (x){
return x < 0.5 ?
8 * x * x * x * x :
1 - pow(-2 * x + 2, 4) / 2;
},
easeInQuint: function (x){
return x * x * x * x * x;
},
easeOutQuint: function (x){
return 1 - pow(1 - x, 5);
},
easeInOutQuint: function (x){
return x < 0.5 ?
16 * x * x * x * x * x :
1 - pow(-2 * x + 2, 5) / 2;
},
easeInSine: function (x){
return 1 - cos(x * PI/2);
},
easeOutSine: function (x){
return sin(x * PI/2);
},
easeInOutSine: function (x){
return -(cos(PI * x) - 1) / 2;
},
easeInExpo: function (x){
return x===0 ? 0:pow(2, 10 * x - 10);
},
easeOutExpo: function (x){
return x===1 ? 1:1 - pow(2, -10 * x);
},
easeInOutExpo: function (x){
return x===0 ? 0:x===1 ? 1:x < 0.5 ?
pow(2, 20 * x - 10) / 2 :
(2 - pow(2, -20 * x + 10)) / 2;
},
easeInCirc: function (x){
return 1 - sqrt(1 - pow(x, 2));
},
easeOutCirc: function (x){
return sqrt(1 - pow(x - 1, 2));
},
easeInOutCirc: function (x){
return x < 0.5 ?
(1 - sqrt(1 - pow(2 * x, 2))) / 2 :
(sqrt(1 - pow(-2 * x + 2, 2)) + 1) / 2;
},
easeInElastic: function (x){
return x===0 ? 0:x===1 ? 1 :
-pow(2, 10 * x - 10) * sin(( x * 10 - 10.75) * c4);
},
easeOutElastic: function (x){
return x===0 ? 0:x===1 ? 1 :
pow(2, -10 * x) * sin(( x * 10 - 0.75) * c4) + 1;
},
easeInOutElastic: function (x){
return x===0 ? 0:x===1 ? 1:x < 0.5 ?
-(pow(2, 20 * x - 10) * sin(( 20 * x - 11.125) * c5)) / 2 :
pow(2, -20 * x + 10) * sin(( 20 * x - 11.125) * c5) / 2 + 1;
},
easeInBack: function (x){
return c3 * x * x * x - c1 * x * x;
},
easeOutBack: function (x){
return 1 + c3 * pow(x - 1, 3) + c1 * pow(x - 1, 2);
},
easeInOutBack: function (x){
return x < 0.5 ?
(pow(2 * x, 2) *(( c2 + 1) * 2 * x - c2)) / 2 :
(pow(2 * x - 2, 2) *(( c2 + 1) *(x * 2 - 2) + c2) + 2) / 2;
},
easeInBounce: function (x){
return 1 - bounceOut(1 - x);
},
easeOutBounce: bounceOut,
easeInOutBounce: function (x){
return x < 0.5 ?
(1 - bounceOut(1 - 2 * x)) / 2 :
(1 + bounceOut(2 * x - 1)) / 2;
}});
return $;
});
(function($){
var types=['DOMMouseScroll', 'mousewheel'];
if($.event.fixHooks){
for (var i=types.length; i;){
$.event.fixHooks[types[--i]]=$.event.mouseHooks;
}}
$.event.special.mousewheel={
setup: function(){
if(this.addEventListener){
for (var i=types.length; i;){
this.addEventListener(types[--i], handler, false);
}}else{
this.onmousewheel=handler;
}},
teardown: function(){
if(this.removeEventListener){
for (var i=types.length; i;){
this.removeEventListener(types[--i], handler, false);
}}else{
this.onmousewheel=null;
}}
};
$.fn.extend({
mousewheel: function(fn){
return fn ? this.bind("mousewheel", fn):this.trigger("mousewheel");
},
unmousewheel: function(fn){
return this.unbind("mousewheel", fn);
}});
function handler(event){
var orgEvent=event||window.event,
args=[].slice.call(arguments, 1),
delta=0,
returnValue=true,
deltaX=0,
deltaY=0;
event=$.event.fix(orgEvent);
event.type="mousewheel";
if(orgEvent.wheelDelta){
delta=orgEvent.wheelDelta / 120;
}
if(orgEvent.detail){
delta=-orgEvent.detail / 3;
}
deltaY=delta;
if(orgEvent.axis!==undefined&&orgEvent.axis===orgEvent.HORIZONTAL_AXIS){
deltaY=0;
deltaX=-1 * delta;
}
if(orgEvent.wheelDeltaY!==undefined){
deltaY=orgEvent.wheelDeltaY / 120;
}
if(orgEvent.wheelDeltaX!==undefined){
deltaX=-1 * orgEvent.wheelDeltaX / 120;
}
args.unshift(event, delta, deltaX, deltaY);
return ($.event.dispatch||$.event.handle).apply(this, args);
}})(jQuery);
(function($, window, undefined){
var extensions={
flash: ['swf'],
image: ['bmp', 'gif', 'jpeg', 'jpg', 'png', 'tiff', 'tif', 'jfif', 'jpe', 'webp'],
iframe: ['asp', 'aspx', 'cgi', 'cfm', 'htm', 'html', 'jsp', 'php', 'pl', 'php3', 'php4', 'php5', 'phtml', 'rb', 'rhtml', 'shtml', 'txt'],
video: ['avi', 'mov', 'mpg', 'mpeg', 'movie', 'mp4', 'webm', 'ogv', 'ogg', '3gp', 'm4v']
},
$win=$(window),
$doc=$(document),
browser,
transform,
gpuAcceleration,
fullScreenApi='',
userAgent=navigator.userAgent||navigator.vendor||window.opera,
supportTouch="ontouchstart" in window||navigator.msMaxTouchPoints||(navigator.maxTouchPoints&&navigator.userAgent.indexOf('Windows') > -1),
ishybrid=navigator.maxTouchPoints&&navigator.userAgent.indexOf('Windows') > -1,
isMobile=/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm(os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(userAgent)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s)|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp(i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac(|\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt(|\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg(g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v)|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v)|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-|)|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(userAgent.substr(0, 4)),
clickEvent=ishybrid ? "itap.iLightBox click.iLightBox":supportTouch ? "itap.iLightBox":"click.iLightBox",
touchStartEvent=ishybrid ? "touchstart.iLightBox mousedown.iLightBox":supportTouch ? "touchstart.iLightBox":"mousedown.iLightBox",
touchStopEvent=ishybrid ? "touchend.iLightBox mouseup.iLightBox":supportTouch ? "touchend.iLightBox":"mouseup.iLightBox",
touchMoveEvent=ishybrid ? "touchmove.iLightBox mousemove.iLightBox":supportTouch ? "touchmove.iLightBox":"mousemove.iLightBox",
abs=Math.abs,
sqrt=Math.sqrt,
round=Math.round,
max=Math.max,
min=Math.min,
floor=Math.floor,
random=Math.random,
pluginspages={
quicktime: 'http://www.apple.com/quicktime/download',
flash: 'http://www.adobe.com/go/getflash'
},
iLightBox=function(el, options, items, instant){
var iL=this;
iL.options=options,
iL.selector=options.selector||el,
iL.context=document,
iL.instant=instant;
if(items.length < 1) iL.attachItems();
else iL.items=items;
iL.vars={
total: iL.items.length,
start: 0,
current: null,
next: null,
prev: null,
BODY: $('body'),
loadRequests: 0,
overlay: $(''),
loader: $(''),
toolbar: $(''),
innerToolbar: $(''),
title: $(''),
closeButton: $(''),
fullScreenButton: $(''),
innerPlayButton: $(''),
innerNextButton: $(''),
innerPrevButton: $(''),
holder: $(''),
nextPhoto: $(''),
prevPhoto: $(''),
nextButton: $(''),
prevButton: $(''),
thumbnails: $(''),
thumbs: false,
nextLock: false,
prevLock: false,
hashLock: false,
isMobile: false,
mobileMaxWidth: 980,
isInFullScreen: false,
isSwipe: false,
mouseID: 0,
cycleID: 0,
isPaused: 0,
captionHeight: 39,
};
iL.vars.hideableElements=iL.vars.nextButton.add(iL.vars.prevButton);
iL.normalizeItems();
iL.availPlugins();
iL.options.startFrom=(iL.options.startFrom > 0&&iL.options.startFrom >=iL.vars.total) ? iL.vars.total - 1:iL.options.startFrom;
iL.options.startFrom=(iL.options.randomStart) ? floor(random() * iL.vars.total):iL.options.startFrom;
iL.vars.start=iL.options.startFrom;
if(instant) iL.instantCall();
else iL.patchItemsEvents();
if(iL.options.linkId){
iL.hashChangeHandler();
$win.iLightBoxHashChange(function(){
iL.hashChangeHandler();
});
}
if(supportTouch){
var RegExp=/(click|mouseenter|mouseleave|mouseover|mouseout)/ig,
replace="itap";
iL.options.caption.show=iL.options.caption.show.replace(RegExp, replace),
iL.options.caption.hide=iL.options.caption.hide.replace(RegExp, replace),
iL.options.social.show=iL.options.social.show.replace(RegExp, replace),
iL.options.social.hide=iL.options.social.hide.replace(RegExp, replace);
}
if(iL.options.controls.arrows||$(window).width() < UNCODE.mediaQuery){
$.extend(iL.options.styles, {
nextOffsetX: ($(window).width() > UNCODE.mediaQuery) ? 36:4,
prevOffsetX: ($(window).width() > UNCODE.mediaQuery) ? 36:4,
nextOpacity: 0,
prevOpacity: 0
});
}};
iLightBox.prototype={
showLoader: function(){
var iL=this;
iL.vars.loadRequests +=1;
if(iL.options.path.toLowerCase()=="horizontal") iL.vars.loader.addClass('ilightbox-show').stop().animate({
opacity: '1'
}, iL.options.show.speed, 'easeOutCirc');
else iL.vars.loader.addClass('ilightbox-show').stop().animate({
opacity: '1'
}, iL.options.show.speed, 'easeOutCirc');
},
hideLoader: function(){
var iL=this;
iL.vars.loadRequests -=1;
iL.vars.loadRequests=(iL.vars.loadRequests < 0) ? 0:iL.vars.loadRequests;
if(iL.options.path.toLowerCase()=="horizontal"){
if(iL.vars.loadRequests <=0) iL.vars.loader.removeClass('ilightbox-show').stop().animate({
opacity: '0'
}, iL.options.show.speed, 'easeInCirc');
}else{
if(iL.vars.loadRequests <=0) iL.vars.loader.removeClass('ilightbox-show').stop().animate({
opacity: '0'
}, iL.options.show.speed, 'easeInCirc');
}},
createUI: function(){
var iL=this;
iL.ui={
currentElement: iL.vars.holder,
nextElement: iL.vars.nextPhoto,
prevElement: iL.vars.prevPhoto,
currentItem: iL.vars.current,
nextItem: iL.vars.next,
prevItem: iL.vars.prev,
hide: function(){
iL.closeAction();
},
refresh: function(){
(arguments.length > 0) ? iL.repositionPhoto(true): iL.repositionPhoto();
},
fullscreen: function(){
iL.fullScreenAction();
}};},
attachItems: function(){
var iL=this,
itemsObject=new Array(),
items=new Array();
$(iL.selector, iL.context).each(function(){
var t=$(this),
URL=t.attr(iL.options.attr)||null,
options=t.data("options")&&eval("({" + t.data("options") + "})")||{},
caption=t.data('caption'),
title=t.data('title'),
type=t.data('type')||getTypeByExtension(URL),
clone=t.data('lbox-clone')||false;
if(type===false){
return;
}
if(t.data('lbox-clone')!=undefined) return;
if(typeof t.attr('data-album')!='undefined'&&t.attr('data-album')!=''){
var ALBUM_URLS=JSON.parse(t.attr('data-album')),
URL_i,
URLS_LENGHT=ALBUM_URLS.length;
for (URL_i=0; URL_i < URLS_LENGHT; URL_i++){
if(typeof ALBUM_URLS[URL_i].url!=='undefined'&&ALBUM_URLS[URL_i].url!=''){
var item_opts='width:' + ALBUM_URLS[URL_i].width + ',height:' + ALBUM_URLS[URL_i].height + ',thumbnail: \'' + ALBUM_URLS[URL_i].thumbnail + '\'';
item_opts=item_opts&&eval("({" + item_opts + "})")||{},
items.push({
URL: ALBUM_URLS[URL_i].url,
caption: ALBUM_URLS[URL_i].caption,
title: ALBUM_URLS[URL_i].title,
type: getTypeByExtension(ALBUM_URLS[URL_i].url),
options: item_opts,
clone: clone
});
var newT=t;
newT.attr('href',ALBUM_URLS[URL_i].url);
if(!iL.instant) itemsObject.push(newT);
}}
}else{
items.push({
URL: URL,
caption: caption,
title: title,
type: type,
options: options,
clone: clone
});
}
if(iL.vars!=undefined) iL.vars.total=items.length;
if(!iL.instant) itemsObject.push(t);
});
iL.items=items,
iL.itemsObject=itemsObject;
},
normalizeItems: function(){
var iL=this,
newItems=new Array();
$.each(iL.items, function(key, val){
if(typeof val=="string") val={
url: val
};
var URL=val.url||val.URL||null,
options=val.options||{},
caption=val.caption||null,
title=val.title||null,
type=(val.type) ? val.type.toLowerCase():getTypeByExtension(URL),
ext=(typeof URL!='object') ? getExtension(URL):'';
options.thumbnail=options.thumbnail||((type=="image") ? URL:null),
options.videoType=options.videoType||null,
options.skin=options.skin||iL.options.skin,
options.width=options.width||null,
options.height=options.height||null,
options.mousewheel=(typeof options.mousewheel!='undefined') ? options.mousewheel:true,
options.swipe=(typeof options.swipe!='undefined') ? options.swipe:true,
options.social=(typeof options.social!='undefined') ? options.social:iL.options.social.buttons&&$.extend({}, {}, iL.options.social.buttons);
if(type=="video"){
options.html5video=(typeof options.html5video!='undefined') ? options.html5video:{};
options.html5video.webm=options.html5video.webm||options.html5video.WEBM||null;
options.html5video.controls=(typeof options.html5video.controls!='undefined') ? options.html5video.controls:"controls";
options.html5video.preload=options.html5video.preload||"metadata";
options.html5video.autoplay=(typeof options.html5video.autoplay!='undefined') ? options.html5video.autoplay:false;
options.html5video.loop=(typeof options.html5video.loop!='undefined') ? options.html5video.loop:false;
}
if(!options.width||!options.height){
if(type=="video") options.width=1280, options.height=720;
else if(type=="iframe") options.width='100%', options.height='90%';
else if(type=="flash") options.width=1280, options.height=720;
}
delete val.url;
val.index=key;
val.URL=URL;
val.caption=caption;
val.title=title;
val.type=type;
val.options=options;
val.ext=ext;
newItems.push(val);
});
iL.items=newItems;
},
instantCall: function(){
var iL=this,
key=iL.vars.start;
iL.vars.current=key;
iL.vars.next=(iL.items[key + 1]) ? key + 1:null;
iL.vars.prev=(iL.items[key - 1]) ? key - 1:null;
iL.addContents();
iL.patchEvents();
},
addContents: function(){
var iL=this,
vars=iL.vars,
opts=iL.options,
viewport=getViewport(),
path=opts.path.toLowerCase(),
recognizingItems=vars.total > 0&&iL.items.filter(function(e, i, arr){
return ['image', 'flash', 'video'].indexOf(e.type)===-1&&typeof e.recognized==='undefined'&&(opts.smartRecognition||e.options.smartRecognition);
}),
needRecognition=recognizingItems.length > 0;
if(opts.mobileOptimizer&&!opts.innerToolbar)
vars.isMobile=viewport.width <=vars.mobileMaxWidth;
vars.overlay.addClass(opts.skin).hide().css('opacity', opts.overlay.opacity);
if(opts.linkId)
vars.overlay[0].setAttribute('linkid', opts.linkId);
if(opts.controls.toolbar){
vars.toolbar.addClass(opts.skin).append(vars.closeButton);
if(opts.controls.fullscreen)
vars.toolbar.append(vars.fullScreenButton);
if(opts.controls.slideshow)
vars.toolbar.append(vars.innerPlayButton);
if(vars.total > 1)
vars.toolbar.append(vars.innerPrevButton).append(vars.innerNextButton);
}
vars.BODY.addClass('ilightbox-noscroll').append(vars.overlay).append(vars.loader).append(vars.holder).append(vars.nextPhoto).append(vars.prevPhoto);
if(!opts.innerToolbar)
vars.BODY.append(vars.toolbar);
if(opts.controls.arrows)
vars.BODY.append(vars.nextButton).append(vars.prevButton);
if(opts.controls.thumbnail&&vars.total > 1){
vars.BODY.append(vars.thumbnails);
vars.thumbnails.addClass(opts.skin).addClass('ilightbox-' + path);
$('div.ilightbox-thumbnails-grid', vars.thumbnails).empty();
vars.thumbs=true;
}
var loaderCss=(opts.path.toLowerCase()=="horizontal") ? {
left: parseInt((viewport.width / 2) - (vars.loader.outerWidth() / 2))
}:{
top: parseInt((viewport.height / 2) - (vars.loader.outerHeight() / 2))
};
vars.loader.addClass(opts.skin).css(loaderCss);
vars.nextButton.add(vars.prevButton).addClass(opts.skin);
if(path=="horizontal")
vars.loader.add(vars.nextButton).add(vars.prevButton).addClass('horizontal');
vars.BODY[vars.isMobile ? 'addClass':'removeClass']('isMobile');
if(!opts.infinite){
vars.prevButton.add(vars.prevButton).add(vars.innerPrevButton).add(vars.innerNextButton).removeClass('disabled');
if(vars.current==0)
vars.prevButton.add(vars.innerPrevButton).addClass('disabled');
if(vars.current >=vars.total - 1)
vars.nextButton.add(vars.innerNextButton).addClass('disabled');
}
if(opts.show.effect){
vars.overlay.stop().fadeIn(opts.show.speed);
vars.toolbar.stop().fadeIn(opts.show.speed);
}else{
vars.overlay.show();
vars.toolbar.show();
}
var length=recognizingItems.length;
if(needRecognition){
iL.showLoader();
$.each(recognizingItems, function(key, val){
var resultFnc=function(result){
var key=-1,
filter=iL.items.filter(function(e, i, arr){
if(e.URL==result.url)
key=i;
return e.URL==result.url;
}),
self=iL.items[key];
if(result)
$.extend(true, self, {
URL: result.source,
type: result.type,
recognized: true,
options: {
html5video: result.html5video,
width: (result.type=="image") ? 0:(result.width||self.width),
height: (result.type=="image") ? 0:(result.height||self.height),
thumbnail: self.options.thumbnail||result.thumbnail
}});
length--;
if(length==0){
iL.hideLoader();
vars.dontGenerateThumbs=false;
iL.generateThumbnails();
if(opts.show.effect)
setTimeout(function(){
iL.generateBoxes();
}, opts.show.speed);
else
iL.generateBoxes();
}};
iL.ogpRecognition(this, resultFnc);
});
}else{
if(opts.show.effect)
setTimeout(function(){
iL.generateBoxes();
}, opts.show.speed);
else
iL.generateBoxes();
}
iL.createUI();
window.iLightBox={
close: function(){
iL.closeAction();
},
fullscreen: function(){
iL.fullScreenAction();
},
moveNext: function(){
iL.moveTo('next');
},
movePrev: function(){
iL.moveTo('prev');
},
goTo: function(index){
iL.goTo(index);
},
refresh: function(){
iL.refresh();
},
reposition: function(){
(arguments.length > 0) ? iL.repositionPhoto(true): iL.repositionPhoto();
},
setOption: function(options){
iL.setOption(options);
},
destroy: function(){
iL.closeAction();
iL.dispatchItemsEvents();
}};
if(opts.linkId){
vars.hashLock=true;
window.location.hash=opts.linkId + '/' + vars.current;
setTimeout(function(){
vars.hashLock=false;
}, 55);
}
if(!opts.slideshow.startPaused){
iL.resume();
vars.innerPlayButton.removeClass('ilightbox-play').addClass('ilightbox-pause');
}
if(typeof iL.options.callback.onOpen=='function') iL.options.callback.onOpen.call(iL);
},
loadContent: function(obj, opt, speed){
var iL=this,
holder, item;
iL.createUI();
obj.speed=speed||iL.options.effects.loadedFadeSpeed;
if(opt=='current'){
if(!obj.options.mousewheel) iL.vars.lockWheel=true;
else iL.vars.lockWheel=false;
if(!obj.options.swipe) iL.vars.lockSwipe=true;
else iL.vars.lockSwipe=false;
}
switch (opt){
case 'current':
holder=iL.vars.holder, item=iL.vars.current;
break;
case 'next':
holder=iL.vars.nextPhoto, item=iL.vars.next;
break;
case 'prev':
holder=iL.vars.prevPhoto, item=iL.vars.prev;
break;
}
holder.removeAttr('style class').addClass('ilightbox-holder' + (supportTouch ? ' supportTouch':'')).addClass(obj.options.skin);
$('div.ilightbox-inner-toolbar', holder).remove();
if(obj.title||iL.options.innerToolbar){
var innerToolbar=iL.vars.innerToolbar.clone();
if(obj.title&&iL.options.show.title){
var title=iL.vars.title.clone();
title.empty().html(obj.title);
innerToolbar.append(title);
}
if(iL.options.innerToolbar){
innerToolbar.append((iL.vars.total > 1) ? iL.vars.toolbar.clone():iL.vars.toolbar);
}
holder.prepend(innerToolbar);
}
iL.loadSwitcher(obj, holder, item, opt);
},
loadSwitcher: function(obj, holder, item, opt){
var iL=this,
opts=iL.options,
api={
element: holder,
position: item
};
switch (obj.type){
case 'image':
if(typeof opts.callback.onBeforeLoad=='function') opts.callback.onBeforeLoad.call(iL, iL.ui, item);
if(typeof obj.options.onBeforeLoad=='function') obj.options.onBeforeLoad.call(iL, api);
iL.loadImage(obj.URL, function(img){
if(typeof opts.callback.onAfterLoad=='function') opts.callback.onAfterLoad.call(iL, iL.ui, item);
if(typeof obj.options.onAfterLoad=='function') obj.options.onAfterLoad.call(iL, api);
var width=(img) ? img.width:400,
height=(img) ? img.height:200;
holder.data({
naturalWidth: width,
naturalHeight: height
});
$('div.ilightbox-container', holder).empty().append((img) ? '':'' + opts.errors.loadImage + '');
if(typeof opts.callback.onRender=='function') opts.callback.onRender.call(iL, iL.ui, item);
if(typeof obj.options.onRender=='function') obj.options.onRender.call(iL, api);
iL.configureHolder(obj, opt, holder);
});
break;
case 'video':
holder.data({
naturalWidth: obj.options.width,
naturalHeight: obj.options.height
});
if(opt==='current'){
iL.addContent(holder, obj);
if(typeof opts.callback.onRender=='function') opts.callback.onRender.call(iL, iL.ui, item);
if(typeof obj.options.onRender=='function') obj.options.onRender.call(iL, api);
}else{
$('div.ilightbox-container', holder).empty();
}
iL.configureHolder(obj, opt, holder);
break;
case 'iframe':
holder.data({
naturalWidth: obj.options.width,
naturalHeight: obj.options.height
});
iL.configureHolder(obj, opt, holder);
if(opt==='current'){
var el=iL.addContent(holder, obj);
if(typeof opts.callback.onRender=='function') opts.callback.onRender.call(iL, iL.ui, item);
if(typeof obj.options.onRender=='function') obj.options.onRender.call(iL, api);
if(typeof opts.callback.onBeforeLoad=='function') opts.callback.onBeforeLoad.call(iL, iL.ui, item);
if(typeof obj.options.onBeforeLoad=='function') obj.options.onBeforeLoad.call(iL, api);
el.bind('load', function(){
if(typeof opts.callback.onAfterLoad=='function') opts.callback.onAfterLoad.call(iL, iL.ui, item);
if(typeof obj.options.onAfterLoad=='function') obj.options.onAfterLoad.call(iL, api);
el.unbind('load');
});
}else{
$('div.ilightbox-container', holder).empty();
}
break;
case 'inline':
var el=$(obj.URL),
content=iL.addContent(holder, obj),
images=findImageInElement(holder);
holder.data({
naturalWidth: (iL.items[item].options.width||el.outerWidth()),
naturalHeight: (iL.items[item].options.height||el.outerHeight())
});
content.children().eq(0).show();
if(typeof opts.callback.onRender=='function') opts.callback.onRender.call(iL, iL.ui, item);
if(typeof obj.options.onRender=='function') obj.options.onRender.call(iL, api);
if(typeof opts.callback.onBeforeLoad=='function') opts.callback.onBeforeLoad.call(iL, iL.ui, item);
if(typeof obj.options.onBeforeLoad=='function') obj.options.onBeforeLoad.call(iL, api);
iL.loadImage(images, function(){
if(typeof opts.callback.onAfterLoad=='function') opts.callback.onAfterLoad.call(iL, iL.ui, item);
if(typeof obj.options.onAfterLoad=='function') obj.options.onAfterLoad.call(iL, api);
iL.configureHolder(obj, opt, holder);
});
break;
case 'flash':
var el=iL.addContent(holder, obj);
holder.data({
naturalWidth: (iL.items[item].options.width||el.outerWidth()),
naturalHeight: (iL.items[item].options.height||el.outerHeight())
});
if(typeof opts.callback.onRender=='function') opts.callback.onRender.call(iL, iL.ui, item);
if(typeof obj.options.onRender=='function') obj.options.onRender.call(iL, api);
iL.configureHolder(obj, opt, holder);
break;
case 'ajax':
var ajax=obj.options.ajax||{};
if(typeof opts.callback.onBeforeLoad=='function') opts.callback.onBeforeLoad.call(iL, iL.ui, item);
if(typeof obj.options.onBeforeLoad=='function') obj.options.onBeforeLoad.call(iL, api);
iL.showLoader();
$.ajax({
url: obj.URL||opts.ajaxSetup.url,
data: ajax.data||null,
dataType: ajax.dataType||"html",
type: ajax.type||opts.ajaxSetup.type,
cache: ajax.cache||opts.ajaxSetup.cache,
crossDomain: ajax.crossDomain||opts.ajaxSetup.crossDomain,
global: ajax.global||opts.ajaxSetup.global,
ifModified: ajax.ifModified||opts.ajaxSetup.ifModified,
username: ajax.username||opts.ajaxSetup.username,
password: ajax.password||opts.ajaxSetup.password,
beforeSend: ajax.beforeSend||opts.ajaxSetup.beforeSend,
complete: ajax.complete||opts.ajaxSetup.complete,
success: function(data, textStatus, jqXHR){
iL.hideLoader();
var el=$(data),
container=$('div.ilightbox-container', holder),
elWidth=iL.items[item].options.width||parseInt(el[0].getAttribute('width')),
elHeight=iL.items[item].options.height||parseInt(el[0].getAttribute('height')),
css=(el[0].getAttribute('width')&&el[0].getAttribute('height')) ? {
'overflow': 'hidden'
}:{};
container.empty().append($('').css(css).html(el));
holder.show().data({
naturalWidth: (elWidth||container.outerWidth()),
naturalHeight: (elHeight||container.outerHeight())
}).hide();
if(typeof opts.callback.onRender=='function') opts.callback.onRender.call(iL, iL.ui, item);
if(typeof obj.options.onRender=='function') obj.options.onRender.call(iL, api);
var images=findImageInElement(holder);
iL.loadImage(images, function(){
if(typeof opts.callback.onAfterLoad=='function') opts.callback.onAfterLoad.call(iL, iL.ui, item);
if(typeof obj.options.onAfterLoad=='function') obj.options.onAfterLoad.call(iL, api);
iL.configureHolder(obj, opt, holder);
});
opts.ajaxSetup.success(data, textStatus, jqXHR);
if(typeof ajax.success=='function') ajax.success(data, textStatus, jqXHR);
},
error: function(jqXHR, textStatus, errorThrown){
if(typeof opts.callback.onAfterLoad=='function') opts.callback.onAfterLoad.call(iL, iL.ui, item);
if(typeof obj.options.onAfterLoad=='function') obj.options.onAfterLoad.call(iL, api);
iL.hideLoader();
$('div.ilightbox-container', holder).empty().append('' + opts.errors.loadContents + '');
iL.configureHolder(obj, opt, holder);
opts.ajaxSetup.error(jqXHR, textStatus, errorThrown);
if(typeof ajax.error=='function') ajax.error(jqXHR, textStatus, errorThrown);
}});
break;
case 'html':
var object=obj.URL,
el
container=$('div.ilightbox-container', holder);
if(object[0].nodeName) el=object.clone();
else {
var dom=$(object);
if(dom.selector) el=$('' + dom + '
');
else el=dom;
}
var elWidth=iL.items[item].options.width||parseInt(el.attr('width')),
elHeight=iL.items[item].options.height||parseInt(el.attr('height'));
iL.addContent(holder, obj);
el.appendTo(document.documentElement).hide();
if(typeof opts.callback.onRender=='function') opts.callback.onRender.call(iL, iL.ui, item);
if(typeof obj.options.onRender=='function') obj.options.onRender.call(iL, api);
var images=findImageInElement(holder);
if(typeof opts.callback.onBeforeLoad=='function') opts.callback.onBeforeLoad.call(iL, iL.ui, item);
if(typeof obj.options.onBeforeLoad=='function') obj.options.onBeforeLoad.call(iL, api);
iL.loadImage(images, function(){
if(typeof opts.callback.onAfterLoad=='function') opts.callback.onAfterLoad.call(iL, iL.ui, item);
if(typeof obj.options.onAfterLoad=='function') obj.options.onAfterLoad.call(iL, api);
holder.show().data({
naturalWidth: (elWidth||container.outerWidth()),
naturalHeight: (elHeight||container.outerHeight())
}).hide();
el.remove();
iL.configureHolder(obj, opt, holder);
});
break;
}},
configureHolder: function(obj, opt, holder){
var iL=this,
vars=iL.vars,
opts=iL.options;
if(opt!="current")(opt=="next") ? holder.addClass('ilightbox-next'):holder.addClass('ilightbox-prev');
if(opt=="current")
var item=vars.current;
else if(opt=="next")
var opacity=opts.styles.nextOpacity,
item=vars.next;
else
var opacity=opts.styles.prevOpacity,
item=vars.prev;
var api={
element: holder,
position: item
};
iL.items[item].options.width=iL.items[item].options.width||0,
iL.items[item].options.height=iL.items[item].options.height||0;
if(opt=="current"){
if(opts.show.effect) holder.css(transform, gpuAcceleration).fadeIn(obj.speed, function(){
holder.css(transform, '');
if(obj.caption){
iL.setCaption(obj, holder);
var caption=$('div.ilightbox-caption', holder),
percent=parseInt((caption.outerHeight() / holder.outerHeight()) * 100);
if(opts.caption.start & percent <=50) caption.fadeIn(opts.effects.fadeSpeed);
}
var social=obj.options.social;
if(social){
iL.setSocial(social, obj.URL, holder);
if(opts.social.start) $('div.ilightbox-social', holder).fadeIn(opts.effects.fadeSpeed);
}
iL.generateThumbnails();
if(typeof opts.callback.onShow=='function') opts.callback.onShow.call(iL, iL.ui, item);
if(typeof obj.options.onShow=='function') obj.options.onShow.call(iL, api);
});
else {
holder.show();
iL.generateThumbnails();
if(typeof opts.callback.onShow=='function') opts.callback.onShow.call(iL, iL.ui, item);
if(typeof obj.options.onShow=='function') obj.options.onShow.call(iL, api);
}}else{
if(opts.show.effect) holder.fadeTo(obj.speed, opacity, function(){
if(opt=="next") vars.nextLock=false;
else vars.prevLock=false;
iL.generateThumbnails();
if(typeof opts.callback.onShow=='function') opts.callback.onShow.call(iL, iL.ui, item);
if(typeof obj.options.onShow=='function') obj.options.onShow.call(iL, api);
});
else {
holder.css({
opacity: opacity
}).show();
if(opt=="next") vars.nextLock=false;
else vars.prevLock=false;
iL.generateThumbnails();
if(typeof opts.callback.onShow=='function') opts.callback.onShow.call(iL, iL.ui, item);
if(typeof obj.options.onShow=='function') obj.options.onShow.call(iL, api);
}}
setTimeout(function(){
iL.repositionPhoto();
}, 0);
},
generateBoxes: function(){
var iL=this,
vars=iL.vars,
opts=iL.options;
if(opts.infinite&&vars.total >=3){
if(vars.current==vars.total - 1) vars.next=0;
if(vars.current==0) vars.prev=vars.total - 1;
} else opts.infinite=false;
if(typeof iL.items[vars.current]=='undefined')
vars.current=0;
iL.loadContent(iL.items[vars.current], 'current', opts.show.speed);
if(iL.items[vars.next]) iL.loadContent(iL.items[vars.next], 'next', opts.show.speed);
if(iL.items[vars.prev]) iL.loadContent(iL.items[vars.prev], 'prev', opts.show.speed);
},
generateThumbnails: function(){
var iL=this,
vars=iL.vars,
opts=iL.options,
timeOut=null;
if(vars.thumbs&&!iL.vars.dontGenerateThumbs){
var thumbnails=vars.thumbnails,
container=$('div.ilightbox-thumbnails-container', thumbnails),
grid=$('div.ilightbox-thumbnails-grid', container),
i=0;
grid.removeAttr('style').empty();
$.each(iL.items, function(key, val){
var isActive=(vars.current==key) ? 'ilightbox-active':'',
opacity=(vars.current==key) ? opts.thumbnails.activeOpacity:opts.thumbnails.normalOpacity,
thumb=val.options.thumbnail,
thumbnail=$(''),
icon=$('');
thumbnail.css({
opacity: 0
}).addClass(isActive);
if((val.type=="video"||val.type=="flash")&&typeof val.options.icon=='undefined'){
icon.addClass('ilightbox-thumbnail-video');
thumbnail.append(icon);
}else if(val.options.icon){
icon.addClass('ilightbox-thumbnail-' + val.options.icon);
thumbnail.append(icon);
}
if(thumb) iL.loadImage(thumb, function(img){
i++;
if(img) thumbnail.data({
naturalWidth: img.width,
naturalHeight: img.height
}).append('');
else thumbnail.data({
naturalWidth: opts.thumbnails.maxWidth,
naturalHeight: opts.thumbnails.maxHeight
});
clearTimeout(timeOut);
timeOut=setTimeout(function(){
iL.positionThumbnails(thumbnails, container, grid);
}, 20);
setTimeout(function(){
thumbnail.fadeTo(opts.effects.loadedFadeSpeed, opacity);
}, i * 20);
});
grid.append(thumbnail);
});
iL.vars.dontGenerateThumbs=true;
}},
positionThumbnails: function(thumbnails, container, grid){
var iL=this,
vars=iL.vars,
opts=iL.options,
viewport=getViewport(),
path=opts.path.toLowerCase();
if(!thumbnails) thumbnails=vars.thumbnails;
if(!container) container=$('div.ilightbox-thumbnails-container', thumbnails);
if(!grid) grid=$('div.ilightbox-thumbnails-grid', container);
var thumbs=$('.ilightbox-thumbnail', grid),
widthAvail=(path=='horizontal') ? viewport.width - opts.styles.pageOffsetX:thumbs.eq(0).outerWidth() - opts.styles.pageOffsetX,
heightAvail=(path=='horizontal') ? thumbs.eq(0).outerHeight() - opts.styles.pageOffsetY:viewport.height - opts.styles.pageOffsetY,
gridWidth=(path=='horizontal') ? 0:widthAvail,
gridHeight=(path=='horizontal') ? heightAvail:0,
active=$('.ilightbox-active', grid),
gridCss={},
css={};
if(arguments.length < 3){
thumbs.css({
opacity: opts.thumbnails.normalOpacity
});
active.css({
opacity: opts.thumbnails.activeOpacity
});
}
thumbs.each(function(i){
var t=$(this),
data=t.data(),
width=(path=='horizontal') ? 0:opts.thumbnails.maxWidth;
height=(path=='horizontal') ? opts.thumbnails.maxHeight:0;
dims=iL.getNewDimenstions(width, height, data.naturalWidth, data.naturalHeight, true);
t.css({
width: dims.width,
height: dims.height
});
if(path=='horizontal') t.css({
'float': 'left'
});
(path=='horizontal') ? (
gridWidth +=t.outerWidth()
):(
gridHeight +=t.outerHeight()
);
});
gridCss={
width: gridWidth,
height: gridHeight
};
grid.css(gridCss);
gridCss={};
var gridOffset=grid.offset(),
activeOffset=(active.length) ? active.offset():{
top: parseInt(heightAvail / 2),
left: parseInt(widthAvail / 2)
};
gridOffset.top=(gridOffset.top - $doc.scrollTop()),
gridOffset.left=(gridOffset.left - $doc.scrollLeft()),
activeOffset.top=(activeOffset.top - gridOffset.top - $doc.scrollTop()),
activeOffset.left=(activeOffset.left - gridOffset.left - $doc.scrollLeft());
(path=='horizontal') ? (
gridCss.top=0,
gridCss.left=parseInt((widthAvail / 2) - activeOffset.left - (active.outerWidth() / 2))
):(
gridCss.top=parseInt(((heightAvail / 2) - activeOffset.top - (active.outerHeight() / 2))),
gridCss.left=0
);
if(arguments.length < 3) grid.stop().animate(gridCss, opts.effects.repositionSpeed, 'easeOutCirc');
else grid.css(gridCss);
},
loadImage: function(image, callback){
if(!$.isArray(image)) image=[image];
var iL=this,
length=image.length;
if(length > 0){
iL.showLoader();
$.each(image, function(index, value){
var img=new Image();
img.onload=function(){
length -=1;
if(length==0){
iL.hideLoader();
callback(img);
}};
img.onerror=img.onabort=function(){
length -=1;
if(length==0){
iL.hideLoader();
callback(false);
}};
img.src=image[index];
});
} else callback(false);
},
patchItemsEvents: function(){
var iL=this,
vars=iL.vars,
clickEvent=ishybrid ? "itap.iL click.iL":supportTouch ? "itap.iL":"click.iL",
vEvent=ishybrid ? "click.iL itap.iL":supportTouch ? "click.iL":"itap.iL";
if(iL.context&&iL.selector){
var $items=$(iL.selector, iL.context);
$(iL.context).on(clickEvent, iL.selector, function(){
var $this=$(this),
key=typeof $(this).data('lb-index')!==''&&$(this).closest('.owl-item').length ? $(this).data('lb-index'):$items.index($this);
if(UNCODE.isMobile){
var isCarousel=$this.closest('.owl-carousel');
if(isCarousel.length){
if(isCarousel.hasClass('owl-translating')) return false;
}}
vars.current=key;
vars.next=iL.items[key + 1] ? key + 1:null;
vars.prev=iL.items[key - 1] ? key - 1:null;
if(vars.BODY.hasClass('fp-slide-scrolling'))
return false;
iL.addContents();
iL.patchEvents();
return false;
}).on(vEvent, iL.selector, function(){
return false;
});
} else
$.each(iL.itemsObject, function(key, val){
val.on(clickEvent, function(){
vars.current=key;
vars.next=iL.items[key + 1] ? key + 1:null;
vars.prev=iL.items[key - 1] ? key - 1:null;
iL.addContents();
iL.patchEvents();
return false;
}).on(vEvent, function(){
return false;
});
});
},
dispatchItemsEvents: function(){
var iL=this,
vars=iL.vars,
opts=iL.options;
if(iL.context&&iL.selector)
$(iL.context).off('.iL', iL.selector);
else
$.each(iL.itemsObject, function(key, val){
val.off('.iL');
});
},
refresh: function(){
var iL=this;
iL.dispatchItemsEvents();
iL.attachItems();
iL.normalizeItems();
iL.patchItemsEvents();
},
patchEvents: function(){
var iL=this,
vars=iL.vars,
opts=iL.options,
path=opts.path.toLowerCase(),
holders=$('.ilightbox-holder'),
fullscreenEvent=fullScreenApi.fullScreenEventName + '.iLightBox',
durationThreshold=1000,
horizontalDistanceThreshold =
verticalDistanceThreshold=100,
buttonsArray=[vars.nextButton[0], vars.prevButton[0], vars.nextButton[0].firstChild, vars.prevButton[0].firstChild];
$win.bind('resize.iLightBox', function(){
var viewport=getViewport();
if(opts.mobileOptimizer&&!opts.innerToolbar) vars.isMobile=viewport.width <=vars.mobileMaxWidth;
vars.BODY[vars.isMobile ? 'addClass':'removeClass']('isMobile');
iL.repositionPhoto(null);
if(supportTouch){
clearTimeout(vars.setTime);
vars.setTime=setTimeout(function(){
var scrollTop=getScrollXY().y;
window.scrollTo(0, scrollTop - 30);
window.scrollTo(0, scrollTop + 30);
window.scrollTo(0, scrollTop);
}, 2000);
}
if(vars.thumbs) iL.positionThumbnails();
}).bind('keydown.iLightBox', function(event){
if(opts.controls.keyboard){
switch (event.keyCode){
case 13:
if(event.shiftKey&&opts.keyboard.shift_enter) iL.fullScreenAction();
break;
case 27:
if(opts.keyboard.esc) iL.closeAction();
break;
case 37:
if(opts.keyboard.left&&!vars.lockKey) iL.moveTo('prev');
break;
case 38:
if(opts.keyboard.up&&!vars.lockKey) iL.moveTo('prev');
break;
case 39:
if(opts.keyboard.right&&!vars.lockKey) iL.moveTo('next');
break;
case 40:
if(opts.keyboard.down&&!vars.lockKey) iL.moveTo('next');
break;
}}
});
if(fullScreenApi.supportsFullScreen) $win.bind(fullscreenEvent, function(){
iL.doFullscreen();
});
var holderEventsArr=[opts.caption.show + '.iLightBox', opts.caption.hide + '.iLightBox', opts.social.show + '.iLightBox', opts.social.hide + '.iLightBox'].filter(function(e, i, arr){
return arr.lastIndexOf(e)===i;
}),
holderEvents="";
$.each(holderEventsArr, function(key, val){
if(key!=0) holderEvents +=' ';
holderEvents +=val;
});
$doc.on(clickEvent, '.ilightbox-overlay', function(){
if(opts.overlay.blur) iL.closeAction();
}).on(clickEvent, '.ilightbox-next, .ilightbox-next-button', function(){
iL.moveTo('next');
}).on(clickEvent, '.ilightbox-prev, .ilightbox-prev-button', function(){
iL.moveTo('prev');
}).on(clickEvent, '.ilightbox-thumbnail', function(){
var t=$(this),
thumbs=$('.ilightbox-thumbnail', vars.thumbnails),
index=thumbs.index(t);
if(index!=vars.current) iL.goTo(index);
}).on(holderEvents, '.ilightbox-holder:not(.ilightbox-next, .ilightbox-prev)', function(e){
var caption=$('div.ilightbox-caption', vars.holder),
social=$('div.ilightbox-social', vars.holder),
fadeSpeed=opts.effects.fadeSpeed;
if(vars.nextLock||vars.prevLock){
if(e.type==opts.caption.show&&!caption.is(':visible')) caption.fadeIn(fadeSpeed);
else if(e.type==opts.caption.hide&&caption.is(':visible')) caption.fadeOut(fadeSpeed);
if(e.type==opts.social.show&&!social.is(':visible')) social.fadeIn(fadeSpeed);
else if(e.type==opts.social.hide&&social.is(':visible')) social.fadeOut(fadeSpeed);
}else{
if(e.type==opts.caption.show&&!caption.is(':visible')) caption.stop().fadeIn(fadeSpeed);
else if(e.type==opts.caption.hide&&caption.is(':visible')) caption.stop().fadeOut(fadeSpeed);
if(e.type==opts.social.show&&!social.is(':visible')) social.stop().fadeIn(fadeSpeed);
else if(e.type==opts.social.hide&&social.is(':visible')) social.stop().fadeOut(fadeSpeed);
}}).on('mouseenter.iLightBox mouseleave.iLightBox', '.ilightbox-wrapper', function(e){
if(e.type=='mouseenter') vars.lockWheel=true;
else vars.lockWheel=false;
}).on(clickEvent, '.ilightbox-toolbar a.ilightbox-close, .ilightbox-toolbar a.ilightbox-fullscreen, .ilightbox-toolbar a.ilightbox-play, .ilightbox-toolbar a.ilightbox-pause', function(){
var t=$(this);
if(t.hasClass('ilightbox-fullscreen')) iL.fullScreenAction();
else if(t.hasClass('ilightbox-play')){
iL.resume();
t.addClass('ilightbox-pause').removeClass('ilightbox-play');
}else if(t.hasClass('ilightbox-pause')){
iL.pause();
t.addClass('ilightbox-play').removeClass('ilightbox-pause');
} else iL.closeAction();
}).on(touchMoveEvent, '.ilightbox-overlay, .ilightbox-thumbnails-container', function(e){
e.preventDefault();
});
function mouseMoveHandler(e){
if(!vars.isMobile){
if(!vars.mouseID){
vars.hideableElements.show();
}
vars.mouseID=clearTimeout(vars.mouseID);
if(buttonsArray.indexOf(e.target)===-1)
vars.mouseID=setTimeout(function(){
vars.hideableElements.hide();
vars.mouseID=clearTimeout(vars.mouseID);
}, 3000);
}}
if(opts.controls.arrows&&!supportTouch) $doc.on('mousemove.iLightBox', mouseMoveHandler);
if(opts.controls.slideshow&&opts.slideshow.pauseOnHover) $doc.on('mouseenter.iLightBox mouseleave.iLightBox', '.ilightbox-holder:not(.ilightbox-next, .ilightbox-prev)', function(e){
if(e.type=='mouseenter'&&vars.cycleID) iL.pause();
else if(e.type=='mouseleave'&&vars.isPaused) iL.resume();
});
var switchers=$('.ilightbox-overlay, .ilightbox-holder, .ilightbox-thumbnails'),
delay=false;
if(opts.controls.mousewheel) switchers.on('mousewheel.iLightBox', function(event, delta){
event.preventDefault();
if(delay) return;
delay=true;
if(!vars.lockWheel){
event.preventDefault();
if(delta < 0){
iL.moveTo('next');
}else if(delta > 0){
iL.moveTo('prev');
}}
setTimeout(function(){
delay=false;
}, 2000);
});
if(opts.controls.swipe) holders.on(touchStartEvent, function(event){
if(vars.nextLock||vars.prevLock||vars.total==1||vars.lockSwipe) return;
vars.BODY.addClass('ilightbox-closedhand');
var data=event.originalEvent.touches ? event.originalEvent.touches[0]:event,
scrollTop=$doc.scrollTop(),
scrollLeft=$doc.scrollLeft(),
offsets=[
holders.eq(0).offset(),
holders.eq(1).offset(),
holders.eq(2).offset()
],
offSet=[{
top: offsets[0].top - scrollTop,
left: offsets[0].left - scrollLeft
}, {
top: offsets[1].top - scrollTop,
left: offsets[1].left - scrollLeft
}, {
top: offsets[2].top - scrollTop,
left: offsets[2].left - scrollLeft
}],
start={
time: (new Date()).getTime(),
coords: [data.pageX - scrollLeft, data.pageY - scrollTop]
},
stop;
function moveEachHandler(i){
var t=$(this),
offset=offSet[i],
scroll=[(start.coords[0] - stop.coords[0]), (start.coords[1] - stop.coords[1])];
t[0].style[path=="horizontal" ? 'left':'top']=(path=="horizontal" ? offset.left - scroll[0]:offset.top - scroll[1]) + 'px';
}
function moveHandler(event){
if(!start) return;
var data=event.originalEvent.touches ? event.originalEvent.touches[0]:event;
stop={
time: (new Date()).getTime(),
coords: [data.pageX - scrollLeft, data.pageY - scrollTop]
};
holders.each(moveEachHandler);
event.preventDefault();
}
function repositionHolders(){
holders.each(function(){
var t=$(this),
offset=t.data('offset')||{
top: t.offset().top - scrollTop,
left: t.offset().left - scrollLeft
},
top=offset.top,
left=offset.left;
t.css(transform, gpuAcceleration).stop().animate({
top: top,
left: left
}, 500, 'easeOutCirc', function(){
t.css(transform, '');
});
});
}
holders.bind(touchMoveEvent, moveHandler);
$doc.one(touchStopEvent, function(event){
holders.unbind(touchMoveEvent, moveHandler);
vars.BODY.removeClass('ilightbox-closedhand');
if(start&&stop){
if(path=="horizontal"&&stop.time - start.time < durationThreshold&&abs(start.coords[0] - stop.coords[0]) > horizontalDistanceThreshold&&abs(start.coords[1] - stop.coords[1]) < verticalDistanceThreshold){
if(start.coords[0] > stop.coords[0]){
if(vars.current==vars.total - 1&&!opts.infinite) repositionHolders();
else {
vars.isSwipe=true;
iL.moveTo('next');
}}else{
if(vars.current==0&&!opts.infinite) repositionHolders();
else {
vars.isSwipe=true;
iL.moveTo('prev');
}}
}else if(path=="vertical"&&stop.time - start.time < durationThreshold&&abs(start.coords[1] - stop.coords[1]) > horizontalDistanceThreshold&&abs(start.coords[0] - stop.coords[0]) < verticalDistanceThreshold){
if(start.coords[1] > stop.coords[1]){
if(vars.current==vars.total - 1&&!opts.infinite) repositionHolders();
else {
vars.isSwipe=true;
iL.moveTo('next');
}}else{
if(vars.current==0&&!opts.infinite) repositionHolders();
else {
vars.isSwipe=true;
iL.moveTo('prev');
}}
} else repositionHolders();
}
start=stop=undefined;
});
});
},
goTo: function(index){
var iL=this,
vars=iL.vars,
opts=iL.options,
diff=(index - vars.current);
if(opts.infinite){
if(index==vars.total - 1&&vars.current==0) diff=-1;
if(vars.current==vars.total - 1&&index==0) diff=1;
}
if(diff==1) iL.moveTo('next');
else if(diff==-1) iL.moveTo('prev');
else {
if(vars.nextLock||vars.prevLock) return false;
if(typeof opts.callback.onBeforeChange=='function') opts.callback.onBeforeChange.call(iL, iL.ui);
if(opts.linkId){
vars.hashLock=true;
window.location.hash=opts.linkId + '/' + index;
}
if(iL.items[index]){
if(!iL.items[index].options.mousewheel) vars.lockWheel=true;
else iL.vars.lockWheel=false;
if(!iL.items[index].options.swipe) vars.lockSwipe=true;
else vars.lockSwipe=false;
}
$.each([vars.holder, vars.nextPhoto, vars.prevPhoto], function(key, val){
val.css(transform, gpuAcceleration).fadeOut(opts.effects.loadedFadeSpeed);
});
vars.current=index;
vars.next=index + 1;
vars.prev=index - 1;
iL.createUI();
setTimeout(function(){
iL.generateBoxes();
}, opts.effects.loadedFadeSpeed + 50);
$('.ilightbox-thumbnail', vars.thumbnails).removeClass('ilightbox-active').eq(index).addClass('ilightbox-active');
iL.positionThumbnails();
if(opts.linkId) setTimeout(function(){
vars.hashLock=false;
}, 55);
if(!opts.infinite){
vars.nextButton.add(vars.prevButton).add(vars.innerPrevButton).add(vars.innerNextButton).removeClass('disabled');
if(vars.current==0){
vars.prevButton.add(vars.innerPrevButton).addClass('disabled');
}
if(vars.current >=vars.total - 1){
vars.nextButton.add(vars.innerNextButton).addClass('disabled');
}}
iL.resetCycle();
if(typeof opts.callback.onAfterChange=='function') opts.callback.onAfterChange.call(iL, iL.ui);
}},
moveTo: function(side){
var iL=this,
vars=iL.vars,
opts=iL.options,
path=opts.path.toLowerCase(),
viewport=getViewport(),
switchSpeed=opts.effects.switchSpeed;
if(vars.nextLock||vars.prevLock) return false;
else {
var item=(side=="next") ? vars.next:vars.prev;
if(opts.linkId){
vars.hashLock=true;
window.location.hash=opts.linkId + '/' + item;
}
if(side=="next"){
if(!iL.items[item]) return false;
var firstHolder=vars.nextPhoto,
secondHolder=vars.holder,
lastHolder=vars.prevPhoto,
firstClass='ilightbox-prev',
secondClass='ilightbox-next';
}else if(side=="prev"){
if(!iL.items[item]) return false;
var firstHolder=vars.prevPhoto,
secondHolder=vars.holder,
lastHolder=vars.nextPhoto,
firstClass='ilightbox-next',
secondClass='ilightbox-prev';
}
if(typeof opts.callback.onBeforeChange=='function')
opts.callback.onBeforeChange.call(iL, iL.ui);
(side=="next") ? vars.nextLock=true: vars.prevLock=true;
var captionFirst=$('div.ilightbox-caption', secondHolder),
socialFirst=$('div.ilightbox-social', secondHolder);
if(captionFirst.length)
captionFirst.stop().fadeOut(switchSpeed, function(){
$(this).remove();
});
if(socialFirst.length)
socialFirst.stop().fadeOut(switchSpeed, function(){
$(this).remove();
});
if(iL.items[item].caption){
iL.setCaption(iL.items[item], firstHolder);
var caption=$('div.ilightbox-caption', firstHolder),
percent=parseInt((caption.outerHeight() / firstHolder.outerHeight()) * 100);
if(opts.caption.start&&percent <=50) caption.fadeIn(switchSpeed);
}
var social=iL.items[item].options.social;
if(social){
iL.setSocial(social, iL.items[item].URL, firstHolder);
if(opts.social.start) $('div.ilightbox-social', firstHolder).fadeIn(opts.effects.fadeSpeed);
}
$.each([firstHolder, secondHolder, lastHolder], function(key, val){
val.removeClass('ilightbox-next ilightbox-prev');
});
var firstOffset=firstHolder.data('offset'),
winW=(viewport.width - (opts.styles.pageOffsetX)),
winH=(viewport.height - (opts.styles.pageOffsetY)),
width=firstOffset.newDims.width,
height=firstOffset.newDims.height,
thumbsOffset=firstOffset.thumbsOffset,
diff=firstOffset.diff,
top=parseInt((winH / 2) - (height / 2) - diff.H - (thumbsOffset.H / 2)),
left=parseInt((winW / 2) - (width / 2) - diff.W - (thumbsOffset.W / 2));
var secondOffset=secondHolder.data('offset'),
object=secondOffset.object;
firstHolder.show().css(transform, gpuAcceleration).animate({
top: top,
left: left,
opacity: 1
}, switchSpeed, (vars.isSwipe) ? 'easeOutCirc':'easeInOutCirc', function(){
firstHolder.css(transform, '');
});
$('div.ilightbox-container', firstHolder).animate({
width: width,
height: height
}, switchSpeed, (vars.isSwipe) ? 'easeOutCirc':'easeInOutCirc');
diff=secondOffset.diff;
width=secondOffset.newDims.width,
height=secondOffset.newDims.height;
width=parseInt(width * opts.styles[side=='next' ? 'prevScale':'nextScale']),
height=parseInt(height * opts.styles[side=='next' ? 'prevScale':'nextScale']),
top=(path=='horizontal') ? parseInt((winH / 2) - object.offsetY - (height / 2) - diff.H - (thumbsOffset.H / 2)):parseInt(winH - object.offsetX - diff.H - (thumbsOffset.H / 2));
if(side=='prev')
left=(path=='horizontal') ? parseInt(winW - object.offsetX - diff.W - (thumbsOffset.W / 2)):parseInt((winW / 2) - (width / 2) - diff.W - object.offsetY - (thumbsOffset.W / 2));
else {
top=(path=='horizontal') ? top:parseInt(object.offsetX - diff.H - height - (thumbsOffset.H / 2)),
left=(path=='horizontal') ? parseInt(object.offsetX - diff.W - width - (thumbsOffset.W / 2)):parseInt((winW / 2) - object.offsetY - (width / 2) - diff.W - (thumbsOffset.W / 2));
}
$('div.ilightbox-container', secondHolder).animate({
width: width,
height: height
}, switchSpeed, (vars.isSwipe) ? 'easeOutCirc':'easeInOutCirc');
secondHolder.addClass(firstClass).css(transform, gpuAcceleration).animate({
top: top,
left: left,
opacity: opts.styles.prevOpacity,
}, switchSpeed, (vars.isSwipe) ? 'easeOutCirc':'easeInOutCirc', function(){
secondHolder.css(transform, '');
$('.ilightbox-thumbnail', vars.thumbnails).removeClass('ilightbox-active').eq(item).addClass('ilightbox-active');
iL.positionThumbnails();
if(iL.items[item]){
if(!iL.items[item].options.mousewheel) vars.lockWheel=true;
else vars.lockWheel=false;
if(!iL.items[item].options.swipe) vars.lockSwipe=true;
else vars.lockSwipe=false;
}
vars.isSwipe=false;
if(['iframe', 'video'].indexOf(iL.items[vars.current].type)!==-1){
$('div.ilightbox-container', secondHolder).empty();
}
if(side=="next"){
vars.nextPhoto=lastHolder,
vars.prevPhoto=secondHolder,
vars.holder=firstHolder;
vars.nextPhoto.hide();
vars.next=vars.next + 1,
vars.prev=vars.current,
vars.current=vars.current + 1;
if(opts.infinite){
if(vars.current > vars.total - 1) vars.current=0;
if(vars.current==vars.total - 1) vars.next=0;
if(vars.current==0) vars.prev=vars.total - 1;
}
iL.createUI();
if(!iL.items[vars.next])
vars.nextLock=false;
else
iL.loadContent(iL.items[vars.next], 'next');
}else{
vars.prevPhoto=lastHolder;
vars.nextPhoto=secondHolder;
vars.holder=firstHolder;
vars.prevPhoto.hide();
vars.next=vars.current;
vars.current=vars.prev;
vars.prev=vars.current - 1;
if(opts.infinite){
if(vars.current==vars.total - 1) vars.next=0;
if(vars.current==0) vars.prev=vars.total - 1;
}
iL.createUI();
if(!iL.items[vars.prev])
vars.prevLock=false;
else
iL.loadContent(iL.items[vars.prev], 'prev');
}
if(['iframe', 'video'].indexOf(iL.items[vars.current].type)!==-1){
iL.loadContent(iL.items[vars.current], 'current');
}
if(opts.linkId) setTimeout(function(){
vars.hashLock=false;
}, 55);
if(!opts.infinite){
vars.nextButton.add(vars.prevButton).add(vars.innerPrevButton).add(vars.innerNextButton).removeClass('disabled');
if(vars.current==0)
vars.prevButton.add(vars.innerPrevButton).addClass('disabled');
if(vars.current >=vars.total - 1)
vars.nextButton.add(vars.innerNextButton).addClass('disabled');
}
iL.repositionPhoto();
iL.resetCycle();
if(typeof opts.callback.onAfterChange=='function')
opts.callback.onAfterChange.call(iL, iL.ui);
});
top=(path=='horizontal') ? getPixel(lastHolder, 'top'):((side=="next") ? parseInt(-(winH / 2) - lastHolder.outerHeight()):parseInt(top * 2)),
left=(path=='horizontal') ? ((side=="next") ? parseInt(-(winW / 2) - lastHolder.outerWidth()):parseInt(left * 2)):getPixel(lastHolder, 'left');
lastHolder.css(transform, gpuAcceleration).animate({
top: top,
left: left,
opacity: opts.styles.nextOpacity
}, switchSpeed, (vars.isSwipe) ? 'easeOutCirc':'easeInOutCirc', function(){
lastHolder.css(transform, '');
}).addClass(secondClass);
}},
setCaption: function(obj, target){
var iL=this,
caption=$('');
if(obj.caption){
caption.html(obj.caption);
$('div.ilightbox-container', target).append(caption);
}},
normalizeSocial: function(obj, url){
var iL=this,
vars=iL.vars,
opts=iL.options,
baseURL=window.location.href;
$.each(obj, function(key, value){
if(!value)
return true;
var item=key.toLowerCase(),
source, text;
switch (item){
case 'facebook':
source="http://www.facebook.com/share.php?v=4&src=bm&u={URL}",
text="Share on Facebook";
break;
case 'twitter':
source="http://twitter.com/home?status={URL}",
text="Share on Twitter";
break;
case 'digg':
source="http://digg.com/submit?phase=2&url={URL}",
text="Share on Digg";
break;
case 'reddit':
source="http://reddit.com/submit?url={URL}",
text="Share on reddit";
break;
}
obj[key]={
URL: value.URL&&absolutizeURI(baseURL, value.URL)||opts.linkId&&window.location.href||typeof url!=='string'&&baseURL||url&&absolutizeURI(baseURL, url)||baseURL,
source: value.source||source||value.URL&&absolutizeURI(baseURL, value.URL)||url&&absolutizeURI(baseURL, url),
text: value.text||text||"Share on " + key,
width: (typeof(value.width)!='undefined'&&!isNaN(value.width)) ? parseInt(value.width):640,
height: value.height||360
};});
return obj;
},
setSocial: function(obj, url, target){
var iL=this,
socialBar=$(''),
buttons='';
obj=iL.normalizeSocial(obj, url);
$.each(obj, function(key, value){
var item=key.toLowerCase(),
source=value.source.replace(/\{URL\}/g, encodeURIComponent(value.URL).replace(/!/g, '%21').replace(/'/g, '%27').replace(/\(/g, '%28').replace(/\)/g, '%29').replace(/\*/g, '%2A').replace(/%20/g, '+'));
buttons +=' ';
});
buttons +='
';
socialBar.html(buttons);
$('div.ilightbox-container', target).append(socialBar);
},
fullScreenAction: function(){
var iL=this,
vars=iL.vars;
if(fullScreenApi.supportsFullScreen){
if(fullScreenApi.isFullScreen()) fullScreenApi.cancelFullScreen(document.documentElement);
else fullScreenApi.requestFullScreen(document.documentElement);
}else{
iL.doFullscreen();
}},
doFullscreen: function(){
var iL=this,
vars=iL.vars,
viewport=getViewport(),
opts=iL.options;
if(opts.fullAlone){
var currentHolder=vars.holder,
current=iL.items[vars.current],
windowWidth=viewport.width,
windowHeight=viewport.height,
elements=[currentHolder, vars.nextPhoto, vars.prevPhoto, vars.nextButton, vars.prevButton, vars.overlay, vars.toolbar, vars.thumbnails, vars.loader],
hideElements=[vars.nextPhoto, vars.prevPhoto, vars.nextButton, vars.prevButton, vars.loader, vars.thumbnails];
if(!vars.isInFullScreen){
vars.isInFullScreen=vars.lockKey=vars.lockWheel=vars.lockSwipe=true;
vars.overlay.css({
opacity: 1
});
$.each(hideElements, function(i, element){
element.hide();
});
vars.fullScreenButton.attr('title', opts.text.exitFullscreen);
if(opts.fullStretchTypes.indexOf(current.type)!=-1) currentHolder.data({
naturalWidthOld: currentHolder.data('naturalWidth'),
naturalHeightOld: currentHolder.data('naturalHeight'),
naturalWidth: windowWidth,
naturalHeight: windowHeight
});
else {
var viewport=current.options.fullViewPort||opts.fullViewPort||'',
newWidth=windowWidth,
newHeight=windowHeight,
width=currentHolder.data('naturalWidth'),
height=currentHolder.data('naturalHeight');
if(viewport.toLowerCase()=='fill'){
newHeight=(newWidth / width) * height;
if(newHeight < windowHeight){
newWidth=(windowHeight / height) * width,
newHeight=windowHeight;
}}else if(viewport.toLowerCase()=='fit'){
var dims=iL.getNewDimenstions(newWidth, newHeight, width, height, true);
newWidth=dims.width,
newHeight=dims.height;
}else if(viewport.toLowerCase()=='stretch'){
newWidth=newWidth,
newHeight=newHeight;
}else{
var scale=(width > newWidth||height > newHeight) ? true:false,
dims=iL.getNewDimenstions(newWidth, newHeight, width, height, scale);
newWidth=dims.width,
newHeight=dims.height;
}
currentHolder.data({
naturalWidthOld: currentHolder.data('naturalWidth'),
naturalHeightOld: currentHolder.data('naturalHeight'),
naturalWidth: newWidth,
naturalHeight: newHeight
});
}
$.each(elements, function(key, val){
val.addClass('ilightbox-fullscreen');
});
if(typeof opts.callback.onEnterFullScreen=='function') opts.callback.onEnterFullScreen.call(iL, iL.ui);
}else{
vars.isInFullScreen=vars.lockKey=vars.lockWheel=vars.lockSwipe=false;
vars.overlay.css({
opacity: iL.options.overlay.opacity
});
$.each(hideElements, function(i, element){
element.show();
});
vars.fullScreenButton.attr('title', opts.text.enterFullscreen);
currentHolder.data({
naturalWidth: currentHolder.data('naturalWidthOld'),
naturalHeight: currentHolder.data('naturalHeightOld'),
naturalWidthOld: null,
naturalHeightOld: null
});
$.each(elements, function(key, val){
val.removeClass('ilightbox-fullscreen');
});
if(typeof opts.callback.onExitFullScreen=='function') opts.callback.onExitFullScreen.call(iL, iL.ui);
}}else{
if(!vars.isInFullScreen) vars.isInFullScreen=true;
else vars.isInFullScreen=false;
}
iL.repositionPhoto(true);
},
closeAction: function(){
var iL=this,
vars=iL.vars,
opts=iL.options;
$win.unbind('.iLightBox');
$doc.off('.iLightBox');
if(vars.isInFullScreen) fullScreenApi.cancelFullScreen(document.documentElement);
$('.ilightbox-overlay, .ilightbox-holder, .ilightbox-thumbnails').off('.iLightBox');
if(opts.hide.effect) vars.overlay.stop().fadeOut(opts.hide.speed, function(){
vars.overlay.remove();
vars.BODY.removeClass('ilightbox-noscroll').off('.iLightBox');
});
else {
vars.overlay.remove();
vars.BODY.removeClass('ilightbox-noscroll').off('.iLightBox');
}
var fadeOuts=[vars.toolbar, vars.holder, vars.nextPhoto, vars.prevPhoto, vars.nextButton, vars.prevButton, vars.loader, vars.thumbnails];
$.each(fadeOuts, function(i, element){
element.removeAttr('style').remove();
});
vars.dontGenerateThumbs=vars.isInFullScreen=false;
window.iLightBox=null;
if(opts.linkId){
vars.hashLock=true;
removeHash();
setTimeout(function(){
vars.hashLock=false;
}, 55);
}
vars.nextButton.add(vars.prevButton).add(vars.innerPrevButton).add(vars.innerNextButton).removeClass('disabled');
if(typeof opts.callback.onHide=='function') opts.callback.onHide.call(iL, iL.ui);
},
repositionPhoto: function(){
var iL=this,
vars=iL.vars,
opts=iL.options,
path=opts.path.toLowerCase(),
viewport=getViewport(),
winWidth=viewport.width,
winHeight=viewport.height;
if(viewport.width < UNCODE.mediaQuery) opts.styles.nextOffsetX=0;
var thumbsOffsetW=(vars.isInFullScreen&&opts.fullAlone||vars.isMobile) ? 0:((path=='horizontal') ? 0:vars.thumbnails.outerWidth()),
thumbsOffsetH=vars.isMobile ? vars.toolbar.outerHeight():((vars.isInFullScreen&&opts.fullAlone) ? 0:((path=='horizontal') ? vars.thumbnails.outerHeight():0)),
width=(vars.isInFullScreen&&opts.fullAlone) ? winWidth:(winWidth - (opts.styles.pageOffsetX)),
height=(vars.isInFullScreen&&opts.fullAlone) ? winHeight:(winHeight - (opts.styles.pageOffsetY)),
offsetW=(path=='horizontal') ? parseInt((iL.items[vars.next]||iL.items[vars.prev]) ? ((opts.styles.nextOffsetX + opts.styles.prevOffsetX)) * 2:(((width / 10) <=30) ? 30:(width / 10))):parseInt(((width / 10) <=30) ? 30:(width / 10)) + thumbsOffsetW,
offsetH=(path=='horizontal') ? parseInt(((height / 10) <=30) ? 30:(height / 10)) + thumbsOffsetH:parseInt((iL.items[vars.next]||iL.items[vars.prev]) ? ((opts.styles.nextOffsetX + opts.styles.prevOffsetX)) * 2:(((height / 10) <=30) ? 30:(height / 10)));
var elObject={
type: 'current',
width: width,
height: height,
item: iL.items[vars.current],
offsetW: offsetW,
offsetH: offsetH,
thumbsOffsetW: thumbsOffsetW,
thumbsOffsetH: thumbsOffsetH,
animate: arguments.length,
holder: vars.holder
};
iL.repositionEl(elObject);
if(iL.items[vars.next]){
elObject=$.extend(elObject, {
type: 'next',
item: iL.items[vars.next],
offsetX: opts.styles.nextOffsetX,
offsetY: opts.styles.nextOffsetY,
holder: vars.nextPhoto
});
iL.repositionEl(elObject);
}
if(iL.items[vars.prev]){
elObject=$.extend(elObject, {
type: 'prev',
item: iL.items[vars.prev],
offsetX: opts.styles.nextOffsetX,
offsetY: opts.styles.prevOffsetY,
holder: vars.prevPhoto
});
iL.repositionEl(elObject);
}
var loaderCss=(path=="horizontal") ? {
left: parseInt((width / 2) - (vars.loader.outerWidth() / 2))
}:{
top: parseInt((height / 2) - (vars.loader.outerHeight() / 2))
};
vars.loader.css(loaderCss);
},
repositionEl: function(obj){
var iL=this,
vars=iL.vars,
opts=iL.options,
path=opts.path.toLowerCase(),
widthAvail=(obj.type=='current') ? ((vars.isInFullScreen&&opts.fullAlone) ? obj.width:(obj.width - obj.offsetW)):(obj.width - obj.offsetW),
heightAvail=(obj.type=='current') ? ((vars.isInFullScreen&&opts.fullAlone) ? obj.height:(obj.height - obj.offsetH)):(obj.height - obj.offsetH),
itemParent=obj.item,
item=obj.item.options,
holder=obj.holder,
offsetX=obj.offsetX||0,
offsetY=obj.offsetY||0,
toolbarHeight=$('.ilightbox-inner-toolbar', holder).length ? parseInt($('.ilightbox-inner-toolbar', holder).outerHeight()):0,
thumbsOffsetW=obj.thumbsOffsetW,
thumbsOffsetH=obj.thumbsOffsetH;
if(obj.type=='current'){
if(typeof item.width=='number'&&item.width) widthAvail=((vars.isInFullScreen&&opts.fullAlone)&&(opts.fullStretchTypes.indexOf(itemParent.type)!=-1||item.fullViewPort||opts.fullViewPort)) ? widthAvail:((item.width > widthAvail) ? widthAvail:item.width);
if(typeof item.height=='number'&&item.height) heightAvail=((vars.isInFullScreen&&opts.fullAlone)&&(opts.fullStretchTypes.indexOf(itemParent.type)!=-1||item.fullViewPort||opts.fullViewPort)) ? heightAvail:((item.height > heightAvail) ? heightAvail:item.height);
}else{
if(typeof item.width=='number'&&item.width) widthAvail=(item.width > widthAvail) ? widthAvail:item.width;
if(typeof item.height=='number'&&item.height) heightAvail=(item.height > heightAvail) ? heightAvail:item.height;
}
heightAvail=parseInt(heightAvail - toolbarHeight);
var width=(typeof item.width=='string'&&item.width.indexOf('%')!=-1) ? percentToValue(parseInt(item.width.replace('%', '')), obj.width):holder.data('naturalWidth'),
height=(typeof item.height=='string'&&item.height.indexOf('%')!=-1) ? percentToValue(parseInt(item.height.replace('%', '')), obj.height):holder.data('naturalHeight');
var dims=((typeof item.width=='string'&&item.width.indexOf('%')!=-1||typeof item.height=='string'&&item.height.indexOf('%')!=-1) ? {
width: width,
height: height
}:iL.getNewDimenstions(widthAvail, heightAvail, width, height)),
newDims=$.extend({}, dims, {});
if(obj.type=='prev'||obj.type=='next')
width=parseInt(dims.width * ((obj.type=='next') ? opts.styles.nextScale:opts.styles.prevScale)),
height=parseInt(dims.height * ((obj.type=='next') ? opts.styles.nextScale:opts.styles.prevScale));
else
width=dims.width,
height=dims.height;
var widthDiff=parseInt((getPixel(holder, 'padding-left') + getPixel(holder, 'padding-right') + getPixel(holder, 'border-left-width') + getPixel(holder, 'border-right-width')) / 2),
heightDiff=parseInt((getPixel(holder, 'padding-top') + getPixel(holder, 'padding-bottom') + getPixel(holder, 'border-top-width') + getPixel(holder, 'border-bottom-width') + ($('.ilightbox-inner-toolbar', holder).outerHeight()||0)) / 2);
switch (obj.type){
case 'current':
var top=parseInt((obj.height / 2) - (height / 2) - heightDiff - (thumbsOffsetH / 2)),
left=parseInt((obj.width / 2) - (width / 2) - widthDiff - (thumbsOffsetW / 2));
break;
case 'next':
var top=(path=='horizontal') ? parseInt((obj.height / 2) - offsetY - (height / 2) - heightDiff - (thumbsOffsetH / 2)):parseInt(obj.height - offsetX - heightDiff - (thumbsOffsetH / 2)),
left=(path=='horizontal') ? parseInt(obj.width - offsetX - widthDiff - (thumbsOffsetW / 2)):parseInt((obj.width / 2) - (width / 2) - widthDiff - offsetY - (thumbsOffsetW / 2));
break;
case 'prev':
var top=(path=='horizontal') ? parseInt((obj.height / 2) - offsetY - (height / 2) - heightDiff - (thumbsOffsetH / 2)):parseInt(offsetX - heightDiff - height - (thumbsOffsetH / 2)),
left=(path=='horizontal') ? parseInt(offsetX - widthDiff - width - (thumbsOffsetW / 2)):parseInt((obj.width / 2) - offsetY - (width / 2) - widthDiff - (thumbsOffsetW / 2));
break;
}
holder.data('offset', {
top: top,
left: left,
newDims: newDims,
diff: {
W: widthDiff,
H: heightDiff
},
thumbsOffset: {
W: thumbsOffsetW,
H: thumbsOffsetH
},
object: obj
});
var opacityMobile;
if(isMobile){
opacityMobile={
opacity: 1,
top: top,
left: left
};}else{
opacityMobile={
top: top,
left: left
};}
if(obj.animate > 0&&opts.effects.reposition){
holder.css(transform, gpuAcceleration).stop().animate(opacityMobile,
opts.effects.repositionSpeed, 'easeOutCirc', function(){
holder.css(transform, '');
});
$('div.ilightbox-container', holder).stop().animate({
width: width,
height: height
}, opts.effects.repositionSpeed, 'easeOutCirc');
$('div.ilightbox-inner-toolbar', holder).stop().animate({
width: width
}, opts.effects.repositionSpeed, 'easeOutCirc', function(){
$(this).css('overflow', 'visible');
});
}else{
holder.css(opacityMobile);
$('div.ilightbox-container', holder).css({
width: width,
height: height
});
$('div.ilightbox-inner-toolbar', holder).css({
width: width
});
}},
resume: function(priority){
var iL=this,
vars=iL.vars,
opts=iL.options;
if(!opts.slideshow.pauseTime||opts.controls.slideshow&&vars.total <=1||priority < vars.isPaused){
return;
}
vars.isPaused=0;
if(vars.cycleID){
vars.cycleID=clearTimeout(vars.cycleID);
}
vars.cycleID=setTimeout(function(){
if(vars.current==vars.total - 1) iL.goTo(0);
else iL.moveTo('next');
}, opts.slideshow.pauseTime);
},
pause: function(priority){
var iL=this,
vars=iL.vars,
opts=iL.options;
if(priority < vars.isPaused){
return;
}
vars.isPaused=priority||100;
if(vars.cycleID){
vars.cycleID=clearTimeout(vars.cycleID);
}},
resetCycle: function(){
var iL=this,
vars=iL.vars,
opts=iL.options;
if(opts.controls.slideshow&&vars.cycleID&&!vars.isPaused){
iL.resume();
}},
getNewDimenstions: function(width, height, width_old, height_old, thumb){
var iL=this;
if(!width) factor=height / height_old;
else if(!height) factor=width / width_old;
else factor=min(width / width_old, height / height_old);
if(!thumb){
if(factor > iL.options.maxScale) factor=iL.options.maxScale;
else if(factor < iL.options.minScale) factor=iL.options.minScale;
}
var final_width=(iL.options.keepAspectRatio) ? round(width_old * factor):width,
final_height=(iL.options.keepAspectRatio) ? round(height_old * factor):height;
return {
width: final_width,
height: final_height,
ratio: factor
};},
setOption: function(options){
var iL=this;
iL.options=$.extend(true, iL.options, options||{});
iL.refresh();
},
availPlugins: function(){
var iL=this,
testEl=document.createElement("video");
iL.plugins={
flash: !isMobile,
quicktime: (parseInt(PluginDetect.getVersion("QuickTime")) >=0) ? true:false,
html5H264: !!(testEl.canPlayType&&testEl.canPlayType('video/mp4').replace(/no/, '')),
html5WebM: !!(testEl.canPlayType&&testEl.canPlayType('video/webm').replace(/no/, '')),
html5Vorbis: !!(testEl.canPlayType&&testEl.canPlayType('video/ogg').replace(/no/, '')),
html5QuickTime: !!(testEl.canPlayType&&testEl.canPlayType('video/quicktime').replace(/no/, ''))
};},
addContent: function(element, obj){
var iL=this,
el;
switch (obj.type){
case 'video':
var HTML5=false,
videoType=obj.videoType,
html5video=obj.options.html5video;
if(((videoType=='video/mp4'||obj.ext=='mp4'||obj.ext=='m4v')||html5video.h264)&&iL.plugins.html5H264)
obj.ext='mp4',
obj.URL=html5video.h264||obj.URL;
else if(html5video.webm&&iL.plugins.html5WebM)
obj.ext='webm',
obj.URL=html5video.webm||obj.URL;
else if(html5video.ogg&&iL.plugins.html5Vorbis)
obj.ext='ogv',
obj.URL=html5video.ogg||obj.URL;
if(iL.plugins.html5H264&&(videoType=='video/mp4'||obj.ext=='mp4'||obj.ext=='m4v')) HTML5=true, videoType="video/mp4";
else if(iL.plugins.html5WebM&&(videoType=='video/webm'||obj.ext=='webm')) HTML5=true, videoType="video/webm";
else if(iL.plugins.html5Vorbis&&(videoType=='video/ogg'||obj.ext=='ogv')) HTML5=true, videoType="video/ogg";
else if(iL.plugins.html5QuickTime&&(videoType=='video/quicktime'||obj.ext=='mov'||obj.ext=='qt')) HTML5=true, videoType="video/quicktime";
if(HTML5){
el=$('', {
"width": "100%",
"height": "100%",
"preload": html5video.preload,
"autoplay": html5video.autoplay,
"loop": html5video.loop,
"poster": html5video.poster,
"controls": html5video.controls,
"controlslist": "nodownload"
}).append($('', {
"src": obj.URL,
"type": videoType
}));
}else{
if(!iL.plugins.quicktime) el=$('', {
"class": "ilightbox-alert",
html: iL.options.errors.missingPlugin.replace('{pluginspage}', pluginspages.quicktime).replace('{type}', 'QuickTime')
});
else {
el=$('', {
"type": "video/quicktime",
"pluginspage": pluginspages.quicktime
}).attr({
"data": obj.URL,
"width": "100%",
"height": "100%"
}).append($('', {
"name": "src",
"value": obj.URL
})).append($('', {
"name": "autoplay",
"value": "false"
})).append($('', {
"name": "loop",
"value": "false"
})).append($('', {
"name": "scale",
"value": "tofit"
}));
if(browser.msie) el=QT_GenerateOBJECTText(obj.URL, '100%', '100%', '', 'SCALE', 'tofit', 'AUTOPLAY', 'false', 'LOOP', 'false');
}}
break;
case 'flash':
if(!iL.plugins.flash) el=$('', {
"class": "ilightbox-alert",
html: iL.options.errors.missingPlugin.replace('{pluginspage}', pluginspages.flash).replace('{type}', 'Adobe Flash player')
});
else {
var flashvars="",
i=0;
if(obj.options.flashvars) $.each(obj.options.flashvars, function(k, v){
if(i!=0) flashvars +="&";
flashvars +=k + "=" + encodeURIComponent(v);
i++;
});
else flashvars=null;
el=$('').attr({
"type": "application/x-shockwave-flash",
"src": obj.URL,
"width": (typeof obj.options.width=='number'&&obj.options.width&&iL.options.minScale=='1'&&iL.options.maxScale=='1') ? obj.options.width:"100%",
"height": (typeof obj.options.height=='number'&&obj.options.height&&iL.options.minScale=='1'&&iL.options.maxScale=='1') ? obj.options.height:"100%",
"quality": "high",
"bgcolor": "#000000",
"play": "true",
"loop": "true",
"menu": "true",
"wmode": "transparent",
"scale": "showall",
"allowScriptAccess": "always",
"allowFullScreen": "true",
"flashvars": flashvars,
"fullscreen": "yes"
});
}
break;
case 'iframe':
el=$('').attr({
"width": (typeof obj.options.width=='number'&&obj.options.width&&iL.options.minScale=='1'&&iL.options.maxScale=='1') ? obj.options.width:"100%",
"height": (typeof obj.options.height=='number'&&obj.options.height&&iL.options.minScale=='1'&&iL.options.maxScale=='1') ? obj.options.height:"100%",
src: obj.URL,
frameborder: 0,
'hspace': 0,
'vspace': 0,
'scrolling': supportTouch ? 'auto':'scroll',
'webkitAllowFullScreen': '',
'mozallowfullscreen': '',
'allowFullScreen': ''
});
break;
case 'inline':
el=$('').html($(obj.URL).clone(true));
break;
case 'html':
var object=obj.URL,
el;
if(object[0].nodeName){
el=$('').html(object);
}else{
var dom=$(obj.URL),
html=(dom.selector) ? $('' + dom + '
'):dom;
el=$('').html(html);
}
break;
}
$('div.ilightbox-container', element).empty().html(el);
if(el[0].tagName.toLowerCase()==='video'&&browser.webkit) setTimeout(function(){
var src=el[0].currentSrc + '?' + floor(random() * 30000);
el[0].currentSrc=src;
el[0].src=src;
});
return el;
},
ogpRecognition: function(obj, callback){
var iL=this,
url=obj.URL;
iL.showLoader();
doAjax(url, function(data){
iL.hideLoader();
if(data){
var object=new Object();
object.length=false,
object.url=data.url;
if(data.status==200){
var result=data.results,
type=result.type,
source=result.source;
object.source=source.src,
object.width=source.width&&parseInt(source.width)||0,
object.height=source.height&&parseInt(source.height)||0,
object.type=type,
object.thumbnail=source.thumbnail||result.images&&result.images[0],
object.html5video=result.html5video||{},
object.length=true;
if(source.type=='application/x-shockwave-flash') object.type="flash";
else if(source.type.indexOf("video/")!=-1) object.type="video";
else if(source.type.indexOf("/html")!=-1) object.type="iframe";
else if(source.type.indexOf("image/")!=-1) object.type="image";
}else if(typeof data.response!='undefined')
throw data.response;
callback.call(this, object.length ? object:false);
}});
},
hashChangeHandler: function(url){
var iL=this,
vars=iL.vars,
opts=iL.options,
URL=url||window.location.href,
hash=parseURI(URL).hash,
split=hash.split('/'),
index=split[1];
if(vars.hashLock||('#' + opts.linkId!=split[0]&&hash.length > 1)) return;
if(index){
var target=split[1]||0;
if(iL.items[target]){
var overlay=$('.ilightbox-overlay');
if(overlay.length&&overlay.attr('linkid')==opts.linkId){
iL.goTo(target);
}else{
iL.itemsObject[target].trigger(ishybrid ? "itap click":supportTouch ? 'itap':'click');
}}else{
var overlay=$('.ilightbox-overlay');
if(overlay.length) iL.closeAction();
}}else{
var overlay=$('.ilightbox-overlay');
if(overlay.length) iL.closeAction();
}}
};
function getPixel($element, property){
return parseInt($element.css(property), 10)||0;
}
function within(number, min, max){
return number < min ? min:number > max ? max:number;
}
function getViewport(){
var e=window,
a='inner';
if(!('innerWidth' in window)){
a='client';
e=document.documentElement||document.body;
}
return {
width: e[a + 'Width'],
height: e[a + 'Height']
}}
function removeHash(){
var scroll=getScrollXY();
history.replaceState({}, document.title, window.location.pathname + window.location.search);
window.scrollTo(scroll.x, scroll.y);
}
function doAjax(url, callback){
var url="//ilightbox.net/getSource/jsonp.php?url=" + encodeURIComponent(url).replace(/!/g, '%21').replace(/'/g, '%27').replace(/\(/g, '%28').replace(/\)/g, '%29').replace(/\*/g, '%2A');
$.ajax({
url: url,
dataType: 'jsonp'
});
iLCallback=function(data){
callback.call(this, data);
};}
function findImageInElement(element){
var elements=$('*', element),
imagesArr=new Array();
elements.each(function(){
var url="",
element=this;
if($(element).css("background-image")!="none"){
url=$(element).css("background-image");
}else if(typeof($(element).attr("src"))!="undefined"&&element.nodeName.toLowerCase()=="img"){
url=$(element).attr("src");
}
if(url.indexOf("gradient")==-1){
url=url.replace(/url\(\"/g, "");
url=url.replace(/url\(/g, "");
url=url.replace(/\"\)/g, "");
url=url.replace(/\)/g, "");
var urls=url.split(",");
for (var i=0; i < urls.length; i++){
if(urls[i].length > 0&&$.inArray(urls[i], imagesArr)==-1){
var extra="";
if(browser.msie&&browser.version < 9){
extra="?" + floor(random() * 3000);
}
imagesArr.push(urls[i] + extra);
}}
}});
return imagesArr;
}
function getExtension(URL){
if(URL!==null){
var ext=URL.indexOf('?')!==-1 ? URL.split('?')[0]:URL;
ext=ext.split('.').pop().toLowerCase();
return ext;
}}
function getTypeByExtension(URL){
var type,
ext=getExtension(URL);
if(URL==undefined){
return false;
}
if(extensions.image.indexOf(ext)!==-1) type='image';
else if(extensions.flash.indexOf(ext)!==-1) type='flash';
else if(extensions.video.indexOf(ext)!==-1) type='video';
else if(ext.substring(0, 1)=="#") type='inline';
else type='iframe';
return type;
}
function percentToValue(percent, total){
return parseInt((total / 100) * percent);
}
function parseURI(url){
var m=String(url).replace(/^\s+|\s+$/g, '').match(/^([^:\/?#]+:)?(\/\/(?:[^:@]*(?::[^:@]*)?@)?(([^:\/?#]*)(?::(\d*))?))?([^?#]*)(\?[^#]*)?(#[\s\S]*)?/);
return (m ? {
href: m[0]||'',
protocol: m[1]||'',
authority: m[2]||'',
host: m[3]||'',
hostname: m[4]||'',
port: m[5]||'',
pathname: m[6]||'',
search: m[7]||'',
hash: m[8]||''
}:null);
}
function absolutizeURI(base, href){
var iL=this;
function removeDotSegments(input){
var output=[];
input.replace(/^(\.\.?(\/|$))+/, '')
.replace(/\/(\.(\/|$))+/g, '/')
.replace(/\/\.\.$/, '/../')
.replace(/\/?[^\/]*/g, function(p){
if(p==='/..'){
output.pop();
}else{
output.push(p);
}});
return output.join('').replace(/^\//, input.charAt(0)==='/' ? '/':'');
}
href=parseURI(href||'');
base=parseURI(base||'');
return !href||!base ? null:(href.protocol||base.protocol) +
(href.protocol||href.authority ? href.authority:base.authority) +
removeDotSegments(href.protocol||href.authority||href.pathname.charAt(0)==='/' ? href.pathname:(href.pathname ? ((base.authority&&!base.pathname ? '/':'') + base.pathname.slice(0, base.pathname.lastIndexOf('/') + 1) + href.pathname):base.pathname)) +
(href.protocol||href.authority||href.pathname ? href.search:(href.search||base.search)) +
href.hash;
}
function version_compare(v1, v2, operator){
this.php_js=this.php_js||{};
this.php_js.ENV=this.php_js.ENV||{};
var i=0,
x=0,
compare=0,
vm={
'dev': -6,
'alpha': -5,
'a': -5,
'beta': -4,
'b': -4,
'RC': -3,
'rc': -3,
'#': -2,
'p': 1,
'pl': 1
},
prepVersion=function(v){
v=('' + v).replace(/[_\-+]/g, '.');
v=v.replace(/([^.\d]+)/g, '.$1.').replace(/\.{2,}/g, '.');
return (!v.length ? [-8]:v.split('.'));
},
numVersion=function(v){
return !v ? 0:(isNaN(v) ? vm[v]||-7:parseInt(v, 10));
};
v1=prepVersion(v1);
v2=prepVersion(v2);
x=max(v1.length, v2.length);
for (i=0; i < x; i++){
if(v1[i]==v2[i]){
continue;
}
v1[i]=numVersion(v1[i]);
v2[i]=numVersion(v2[i]);
if(v1[i] < v2[i]){
compare=-1;
break;
}else if(v1[i] > v2[i]){
compare=1;
break;
}}
if(!operator){
return compare;
}
switch (operator){
case '>':
case 'gt':
return (compare > 0);
case '>=':
case 'ge':
return (compare >=0);
case '<=':
case 'le':
return (compare <=0);
case '==':
case '=':
case 'eq':
return (compare===0);
case '<>':
case '!=':
case 'ne':
return (compare!==0);
case '':
case '<':
case 'lt':
return (compare < 0);
default:
return null;
}}
$.fn.iLightBox=function(){
var args=arguments,
opt=($.isPlainObject(args[0])) ? args[0]:args[1],
items=($.isArray(args[0])||typeof args[0]=='string') ? args[0]:args[1];
if(!opt) opt={};
var options=$.extend(true, {
attr: 'href',
path: 'vertical',
skin: 'dark',
linkId: false,
infinite: false,
startFrom: 0,
randomStart: false,
keepAspectRatio: true,
maxScale: 1,
minScale: .2,
innerToolbar: false,
smartRecognition: false,
mobileOptimizer: true,
fullAlone: true,
fullViewPort: null,
fullStretchTypes: 'flash, video',
overlay: {
blur: true,
opacity: .85
},
controls: {
arrows: false,
slideshow: false,
toolbar: true,
fullscreen: true,
thumbnail: true,
keyboard: true,
mousewheel: true,
swipe: true
},
keyboard: {
left: true,
right: true,
up: true,
down: true,
esc: true,
shift_enter: true
},
show: {
effect: true,
speed: 300,
title: true
},
hide: {
effect: true,
speed: 300
},
caption: {
start: true,
show: 'mouseenter',
hide: 'mouseleave'
},
social: {
start: true,
show: 'mouseenter',
hide: 'mouseleave',
buttons: false
},
styles: {
pageOffsetX: 0,
pageOffsetY: 0,
nextOffsetX: 45,
nextOffsetY: 0,
nextOpacity: 1,
nextScale: 1,
prevOffsetX: 45,
prevOffsetY: 0,
prevOpacity: 1,
prevScale: 1
},
thumbnails: {
maxWidth: 120,
maxHeight: 80,
normalOpacity: 1,
activeOpacity: .6
},
effects: {
reposition: true,
repositionSpeed: 200,
switchSpeed: 500,
loadedFadeSpeed: 180,
fadeSpeed: 200
},
slideshow: {
pauseTime: 5000,
pauseOnHover: false,
startPaused: true
},
text: {
close: "Press Esc to close",
enterFullscreen: "Enter Fullscreen (Shift+Enter)",
exitFullscreen: "Exit Fullscreen (Shift+Enter)",
slideShow: "Slideshow",
next: "Next",
previous: "Previous"
},
errors: {
loadImage: "An error occurred when trying to load photo.",
loadContents: "An error occurred when trying to load contents.",
missingPlugin: "The content your are attempting to view requires the {type} plugin<\/a>."
},
ajaxSetup: {
url: '',
beforeSend: function(jqXHR, settings){},
cache: false,
complete: function(jqXHR, textStatus){},
crossDomain: false,
error: function(jqXHR, textStatus, errorThrown){},
success: function(data, textStatus, jqXHR){},
global: true,
ifModified: false,
username: null,
password: null,
type: 'GET'
},
callback: {}}, opt);
var instant=($.isArray(items)||typeof items=='string') ? true:false;
items=$.isArray(items) ? items:new Array();
if(typeof args[0]=='string') items[0]=args[0];
if(version_compare($.fn.jquery, '1.8', '>=')){
var iLB=new iLightBox($(this), options, items, instant);
return {
close: function(){
iLB.closeAction();
},
fullscreen: function(){
iLB.fullScreenAction();
},
moveNext: function(){
iLB.moveTo('next');
},
movePrev: function(){
iLB.moveTo('prev');
},
goTo: function(index){
iLB.goTo(index);
},
refresh: function(){
iLB.refresh();
},
reposition: function(){
(arguments.length > 0) ? iLB.repositionPhoto(true): iLB.repositionPhoto();
},
setOption: function(options){
iLB.setOption(options);
},
destroy: function(){
iLB.closeAction();
iLB.dispatchItemsEvents();
}};}else{
throw "The jQuery version that was loaded is too old. iLightBox requires jQuery 1.8+";
}};
$.iLightBox=function(){
return $.fn.iLightBox(arguments[0], arguments[1]);
};
function getScrollXY(){
var scrOfX=0,
scrOfY=0;
if(typeof(window.pageYOffset)=='number'){
scrOfY=window.pageYOffset;
scrOfX=window.pageXOffset;
}else if(document.body&&(document.body.scrollLeft||document.body.scrollTop)){
scrOfY=document.body.scrollTop;
scrOfX=document.body.scrollLeft;
}else if(document.documentElement&&(document.documentElement.scrollLeft||document.documentElement.scrollTop)){
scrOfY=document.documentElement.scrollTop;
scrOfX=document.documentElement.scrollLeft;
}
return {
x: scrOfX,
y: scrOfY
};}
(function(){
$.each(("touchstart touchmove touchend " +
"tap taphold " +
"swipe swipeleft swiperight " +
"scrollstart scrollstop").split(" "), function(i, name){
$.fn[name]=function(fn){
return fn ? this.bind(name, fn):this.trigger(name);
};});
var tapSettings={
startEvent: 'touchstart.iTap',
endEvent: 'touchend.iTap'
};
$.event.special.itap={
setup: function(){
var self=this,
$self=$(this),
start, stop;
$self.bind(tapSettings.startEvent, function(event){
start=getScrollXY();
$self.one(tapSettings.endEvent, function(event){
stop=getScrollXY();
var orgEvent=event||window.event;
event=$.event.fix(orgEvent);
event.type="itap";
if((start&&stop)&&(start.x==stop.x&&start.y==stop.y))($.event.dispatch||$.event.handle).call(self, event);
start=stop=undefined;
});
});
},
teardown: function(){
$(this).unbind(tapSettings.startEvent);
}};}());
(function(){
fullScreenApi={
supportsFullScreen: false,
isFullScreen: function(){
return false;
},
requestFullScreen: function(){},
cancelFullScreen: function(){},
fullScreenEventName: '',
prefix: ''
},
browserPrefixes='webkit moz o ms khtml'.split(' ');
if(typeof document.cancelFullScreen!='undefined'){
fullScreenApi.supportsFullScreen=true;
}else{
for (var i=0, il=browserPrefixes.length; i < il; i++){
fullScreenApi.prefix=browserPrefixes[i];
if(typeof document[fullScreenApi.prefix + 'CancelFullScreen']!='undefined'){
fullScreenApi.supportsFullScreen=true;
break;
}}
}
if(fullScreenApi.supportsFullScreen){
fullScreenApi.fullScreenEventName=fullScreenApi.prefix + 'fullscreenchange';
fullScreenApi.isFullScreen=function(){
switch (this.prefix){
case '':
return document.fullScreen;
case 'webkit':
return document.webkitIsFullScreen;
default:
return document[this.prefix + 'FullScreen'];
}}
fullScreenApi.requestFullScreen=function(el){
return (this.prefix==='') ? el.requestFullScreen():el[this.prefix + 'RequestFullScreen']();
}
fullScreenApi.cancelFullScreen=function(el){
return (this.prefix==='') ? document.cancelFullScreen():document[this.prefix + 'CancelFullScreen']();
}}
}());
(function(){
function uaMatch(ua){
ua=ua.toLowerCase();
var match=/(chrome)[ \/]([\w.]+)/.exec(ua) ||
/(webkit)[ \/]([\w.]+)/.exec(ua) ||
/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(ua) ||
/(msie) ([\w.]+)/.exec(ua) ||
ua.indexOf("compatible") < 0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(ua)||[];
return {
browser: match[1]||"",
version: match[2]||"0"
};}
var matched=uaMatch(navigator.userAgent);
browser={};
if(matched.browser){
browser[matched.browser]=true;
browser.version=matched.version;
}
if(browser.chrome){
browser.webkit=true;
}else if(browser.webkit){
browser.safari=true;
}}());
(function(){
var prefixes=['', 'webkit', 'moz', 'ms', 'o'];
var el=document.createElement('div');
function testProp(prop){
for (var p=0, pl=prefixes.length; p < pl; p++){
var prefixedProp=prefixes[p] ? prefixes[p] + prop.charAt(0).toUpperCase() + prop.slice(1):prop;
if(el.style[prefixedProp]!==undefined){
return prefixedProp;
}}
}
transform=testProp('transform')||'';
gpuAcceleration=testProp('perspective') ? 'translateZ(0) ':'';
}());
var PluginDetect={version:"0.7.9",name:"PluginDetect",handler:function(c,b,a){return function(){c(b,a)}},openTag:"<",isDefined:function(b){return typeof b!="undefined"},isArray:function(b){return(/array/i).test(Object.prototype.toString.call(b))},isFunc:function(b){return typeof b=="function"},isString:function(b){return typeof b=="string"},isNum:function(b){return typeof b=="number"},isStrNum:function(b){return(typeof b=="string"&&(/\d/).test(b))},getNumRegx:/[\d][\d\.\_,-]*/,splitNumRegx:/[\.\_,-]/g,getNum:function(b,c){var d=this,a=d.isStrNum(b)?(d.isDefined(c)?new RegExp(c):d.getNumRegx).exec(b):null;return a?a[0]:null},compareNums:function(h,f,d){var e=this,c,b,a,g=parseInt;if(e.isStrNum(h)&&e.isStrNum(f)){if(e.isDefined(d)&&d.compareNums){return d.compareNums(h,f)}c=h.split(e.splitNumRegx);b=f.split(e.splitNumRegx);for(a=0;ag(b[a],10)){return 1}if(g(c[a],10)c||!(/\d/).test(e[a])){e[a]="0"}}return e.slice(0,4).join(",")},$$hasMimeType:function(a){return function(c){if(!a.isIE&&c){var f,e,b,d=a.isArray(c)?c:(a.isString(c)?[c]:[]);for(b=0;b2||!f||!f.version||!(e=h.getNum(f.version))){return b}if(!b){return e}e=h.formatNum(e);b=h.formatNum(b);d=b.split(h.splitNumRegx);g=e.split(h.splitNumRegx);for(a=0;a-1&&a>c&&d[a]!="0"){return b}if(g[a]!=d[a]){if(c==-1){c=a}if(d[a]!="0"){return b}}}return e},AXO:window.ActiveXObject,getAXO:function(a){var f=null,d,b=this,c={};try{f=new b.AXO(a)}catch(d){}return f},convertFuncs:function(f){var a,g,d,b=/^[\$][\$]/,c=this;for(a in f){if(b.test(a)){try{g=a.slice(2);if(g.length>0&&!f[g]){f[g]=f[a](f);delete f[a]}}catch(d){}}}},initObj:function(e,b,d){var a,c;if(e){if(e[b[0]]==1||d){for(a=0;a=0;h=h-2){if(g[h]&&new RegExp(g[h],"i").test(b)){d.OS=g[h+1];break}}};d.head=i.getElementsByTagName("head")[0]||i.getElementsByTagName("body")[0]||i.body||null;d.isIE=new Function("return/*@cc_on!@*/!1")();d.verIE=d.isIE&&(/MSIE\s*(\d+\.?\d*)/i).test(l)?parseFloat(RegExp.$1,10):null;d.verIEfull=null;d.docModeIE=null;if(d.isIE){var f,n,c=document.createElement("div");try{c.style.behavior="url(#default#clientcaps)";d.verIEfull=(c.getComponentVersion("{89820200-ECBD-11CF-8B85-00AA005B4383}","componentid")).replace(/,/g,".")}catch(f){}n=parseFloat(d.verIEfull||"0",10);d.docModeIE=i.documentMode||((/back/i).test(i.compatMode||"")?5:n)||d.verIE;d.verIE=n||d.docModeIE};d.ActiveXEnabled=false;if(d.isIE){var h,m=["Msxml2.XMLHTTP","Msxml2.DOMDocument","Microsoft.XMLDOM","ShockwaveFlash.ShockwaveFlash","TDCCtl.TDCCtl","Shell.UIHelper","Scripting.Dictionary","wmplayer.ocx"];for(h=0;h0&&c.isFunc(b[0])))){a.push(b)}},callArray:function(b){var c=this,a;if(c.isArray(b)){for(a=0;a0&&b.isFunc(c[0])){c[0](b,a>1?c[1]:0,a>2?c[2]:0,a>3?c[3]:0)}else{if(b.isFunc(c)){c(b)}}},getVersionDelimiter:",",$$getVersion:function(a){return function(g,d,c){var e=a.init(g),f,b,h={};if(e.status<0){return null};f=e.plugin;if(f.getVersionDone!=1){f.getVersion(null,d,c);if(f.getVersionDone===null){f.getVersionDone=1}}a.cleanup();b=(f.version||f.version0);b=b?b.replace(a.splitNumRegx,a.getVersionDelimiter):b;return b}},cleanup:function(){var a=this;if(a.garbage&&a.isDefined(window.CollectGarbage)){window.CollectGarbage()}},isActiveXObject:function(d,b){var f=this,a=false,g,c='"}function QT_GenerateOBJECTText(){return _QTGenerate("QT_GenerateOBJECTText",!1,arguments)};
(function(){function e(a){a=a||location.href;return"#"+a.replace(/^[^#]*#?(.*)$/,"$1")}var k=document,b,f=$.event.special,p=k.documentMode,m="oniLightBoxHashChange"in window&&(void 0===p||7').hide().one("load",function(){d||n(e());a()}).attr("src",d||
"javascript:0").insertAfter("body")[0].contentWindow,k.onpropertychange=function(){try{"title"===event.propertyName&&(c.document.title=k.title)}catch(a){}})};h.stop=b;f=function(){return e(c.location.href)};n=function(a,d){var b=c.document,e=$.fn.iLightBoxHashChange.domain;a!==d&&(b.title=k.title,b.open(),e&&b.write('