in assets/www/scripts/MetroJs.lt.js [412:542]
$this.slide = function (callback) {
if (typeof (callback) == "undefined" || callback == null)
callback = null;
if (tdata.repeatCount > -1) {
if (tdata.loopCount > tdata.repeatCount) {
tdata.stopTimer(false);
tdata.loopCount = 0;
tdata.hasRun = false;
$this.data("LiveTile", tdata);
return;
}
}
if (!doAnimations)
return;
var clojIsReversed = tdata.isReversed;
var fData = $firstContainer.data("tile");
var stop = jQuery.trim(tdata.stops[tdata.slideIndex]);
var pxIdx = stop.indexOf('px');
var offset = 0;
var amount = 0
var metric = (tdata.direction == "vertical") ? height : width;
var prop = (tdata.direction == "vertical") ? "top" : "left";
if (pxIdx > 0) {
amount = parseInt(stop.substring(0, pxIdx));
offset = (amount - metric) + 'px';
} else {
//is a percentage
amount = parseInt(stop.replace('%', ''));
offset = (amount - 100) + '%';
}
if (canTransition && tdata.useHwAccel) {
if (typeof (fData.animated) != "undefined" && fData.animated == true)
return;
fData.animated = true;
var css = {
WebkitTransitionProperty: prop, WebkitTransitionDuration: tdata.speed + 'ms',
MozTransitionProperty: prop, MozTransitionDuration: tdata.speed + 'ms',
OTransitionProperty: prop, OTransitionDuration: tdata.speed + 'ms',
msTransitionProperty: prop, msTransitionDuration: tdata.speed + 'ms',
KhtmlTransitionProperty: prop, KhtmlTransitionDuration: tdata.speed + 'ms',
TransitionProperty: prop, TransitionDuration: tdata.speed + 'ms'
};
if (tdata.direction == "vertical") {
css.top = (clojIsReversed && tdata.stops.length == 1) ? "0px" : stop;
} else {
css.left = (clojIsReversed && tdata.stops.length == 1) ? "0px" : stop;
}
$firstContainer.css(css);
if (tdata.stack == true) {
if (tdata.direction == "vertical") {
css.top = (clojIsReversed && tdata.stops.length == 1) ? -metric + 'px' : offset;
} else {
css.left = (clojIsReversed && tdata.stops.length == 1) ? -metric + 'px' : offset;
}
$scndContainer.css(css);
}
window.setTimeout(function () {
var index = staticCount;
if (swapFrontSource && stgs.frontIsRandom) {
//make sure the random bag is ready
if (frontRandomBag.length == 0) {
for (var i = 0; i < stgs.frontImages.length; i++) {
//make sure there's not an immediate repeat
if (i != prevBackIndex || stgs.frontImages.length == 1)
frontRandomBag[i] = i;
}
frontRandomBag = privMethods.shuffleArray(frontRandomBag);
}
index = frontRandomBag.pop();
prevFrontIndex = index;
}
privMethods.handleSlide(clojIsReversed, $firstContainer, swapFrontSource, stgs, index);
fData.animated = false;
$firstContainer.data("tile", fData);
if (!clojIsReversed && swapFrontSource) {
staticCount += 1;
if (staticCount >= stgs.frontImages.length)
staticCount = 0;
}
stgs.animationComplete(tdata, $firstContainer, $scndContainer);
if (callback != null)
callback();
}, tdata.speed);
} else {
if ($firstContainer.is(':animated')) {
return;
}
var uCss = (tdata.direction == "vertical") ?
{ top: (clojIsReversed && tdata.stops.length == 1) ? "0px" : stop} :
{ left: (clojIsReversed && tdata.stops.length == 1) ? "0px" : stop };
var dCss = (tdata.direction == "vertical") ?
{ top: (clojIsReversed && tdata.stops.length == 1) ? -metric + 'px' : offset} :
{ left: (clojIsReversed && tdata.stops.length == 1) ? -metric + 'px' : offset };
$firstContainer.animate(uCss, tdata.speed, function () {
var index = staticCount;
if (swapFrontSource && stgs.frontIsRandom) {
//make sure the random bag is ready
if (frontRandomBag.length == 0) {
for (var i = 0; i < stgs.frontImages.length; i++) {
//make sure there's not an immediate repeat
if (i != prevBackIndex || stgs.frontImages.length == 1)
frontRandomBag[i] = i;
}
frontRandomBag = privMethods.shuffleArray(frontRandomBag);
}
index = frontRandomBag.pop();
prevFrontIndex = index;
}
privMethods.handleSlide(clojIsReversed, $firstContainer, swapFrontSource, stgs, index);
if (!clojIsReversed && swapFrontSource) {
staticCount += 1;
if (staticCount >= stgs.frontImages.length)
staticCount = 0;
}
stgs.animationComplete(tdata, $firstContainer, $scndContainer);
if (callback != null)
callback();
});
if (tdata.stack == true) {
$scndContainer.animate(dCss, tdata.speed, function () { });
}
}
//increment slide count
tdata.slideIndex += 1;
if (tdata.slideIndex >= tdata.stops.length) {
tdata.slideIndex = 0;
tdata.isReversed = !tdata.isReversed;
tdata.loopCount += 1;
}
};