(function ($) { function gettransformproperty(a) { var b = ["transform", "webkittransform", "mstransform", "moztransform", "otransform"]; var c; while (c = b.shift()) { if (typeof a.style[c] != "undefined") { return c } } return "transform" } $.fn.extend({ quake: function (options) { var settings = $.extend({ animationspeed: 500, pausetime: 4e3, rows: 4, cols: 12, thumbnails: true, thumbnailspath: "", applyeffectsrandomly: true, effects: ["swirlfadeoutrotate", "swirlfadeoutrotatefancy", "swirlfadein", "swirlfadeout", "slabs", "spiral", "spiralreverse", "diagonalshow", "diagonalshowreverse", "spiraldimension", "spiralreversedimension", "boxfadein", "boxfadeoutoriginal", "boxfadeoutoriginalrotate", "diagonalfade", "diagonalfadereverse", "randomfade", "randomdimensions", "boxes", "explode", "explodefancy", "linearpeal", "linearpealreverse", "linearpealdimensions", "linearpealreversedimensions", "blind", "blindhorizontal", "barsup", "barsdown", "barsdownreverse", "blindfade", "fallingblindfade", "raisingblindfade", "mixbars", "mixbarsfancy", "fade", "blindfadereverse", "slidein", "slideinfancy", "slideinreverse", "chop", "chopdimensions", "chopdiagonal", "chopdiagonalreverse", "slideleft", "slideright", "slideup", "slidedown"], nexttext: "next", prevtext: "prev", navplacement: "outside", navalwaysvisible: false, hasnextprev: true, captionopacity: .5, captionorientations: ["right"], captionanimationspeed: 1e3, captionssetup: null }, options); return this.each(function () { function setup() { captioncontainer.css("opacity", settings.captionopacity).html(""); slidercontainer.html(""); var a = $("").addclass("quake-link"); a.css("display", "none"); a.css("width", sliderwidth); a.css("height", sliderheight); slidercontainer.prepend(a); if (settings.hasnextprev) { sliderwrapper.prepend(navcontainer); if (!settings.navalwaysvisible) { navcontainer.hide(); sliderwrapper.mouseenter(function () { navcontainer.show(); setupnavvisibility(true) }).mouseleave(function () { navcontainer.hide(); setupnavvisibility(false) }) } navcontainer.find(".quake-prev").click(function () { if (!isanimating) { stop(); currentimageindex = previousimageindex; currentimageindex -= 1; if (currentimageindex < 0) currentimageindex = images.length - 1; runanimation(); start() } }); navcontainer.find(".quake-next").click(function () { if (!isanimating) { stop(); runanimation(); start() } }) } else { if (!settings.navalwaysvisible) { sliderwrapper.mouseenter(function () { setupnavvisibility(true) }).mouseleave(function () { setupnavvisibility(false) }) } } sliderwrapper.mouseenter(stop).mouseleave(start); if (theme == "violet") sliderwrapper.append(captioncontainer); else slidercontainer.append(captioncontainer) } function start() { animationinterval = setinterval(runanimation, pausetime) } function stop() { isanimating = false; clearinterval(animationinterval); animationinterval = null } function setupnavvisibility(a) { if (settings.navplacement == "inside") { if (a) sliderwrapper.find(".quake-nav-wrapper").show(); else sliderwrapper.find(".quake-nav-wrapper").hide() } } function addnavigationcontrols() { var a = $("
").addclass("quake-nav-wrapper " + settings.navplacement + ""); var b = $("
").addclass("quake-nav-container"); a.append(b); if (settings.hasnextprev && !settings.navalwaysvisible) a.hide(); $(images).each(function (a, c) { b.append($("").attr("href", "#").attr("rel", a).addclass("quake-nav-control").html(a)) }); $(".quake-nav-container a").live("click", onnavclick); slidercontainer.after(a); var c = totalimages * parsefloat(b.find("a").outerwidth()); b.css("width", c); if (settings.thumbnails) { var d = $("
").css({ display: "none", opacity: "0" }); d.addclass("quake-thumbnail").append($("
").addclass("quake-thumbnail-preview").append($(""))); a.append(d); var e = d.find(".quake-thumbnail-preview").width(); var f = d.find(".quake-thumbnail-preview").height(); var g = sliderwidth / sliderheight; var h = e / f; if (g - h > 1) { g = (g + h) / (g - h) } if (g > 0) e = g * f; $(".quake-nav-container a").live("mouseenter", function () { var a = $(this).position().left + $(this).outerwidth() / 2; var b = a - d.outerwidth() / 2; var c = $(this).position().top - d.outerheight(); var g = images[parseint($(this).html())]; if (g != null) { var h = getimagesrc(g); if (settings.thumbnailspath != "") { var i = getimagesrc(g).split("/"); h = settings.thumbnailspath + "/" + i[i.length - 1] } d.find("img").attr("src", h).css({ width: e, height: f }); d.css({ left: b, top: c, display: "block" }).stop(true, true).animate({ opacity: 1 }, 500) } }); $(".quake-nav-container a").live("mouseleave", function () { d.css({ display: "none", opacity: 0 }) }) } } function onnavclick() { if (!isanimating && !$(this).hasclass("active")) { isanimating = false; currentimageindex = parseint($(this).attr("rel")); stop(); runanimation(); start() } return false } function animaterandomfade() { createboxes(); var a = $(".quake-el").get().sort(function () { return math.round(math.random()) - .5 }); $(a).each(function (a) { var b = coordinates[a]; var c = "left:" + b.left + "; top:" + b.top + ""; $(this).css("background-position", c) }); $(a).each(function (b) { if (complete < a.length) { var c = $(this); settimeout(function () { try { c.fadein(animationspeed, function () { complete++; if (complete == a.length) { animationcomplete() } }) } catch (b) { } }, factor); factor += timefactor * 2 } }) } function animaterandomfadedimensions() { createboxes(); var a = math.ceil(sliderwidth / cols); var b = math.ceil(sliderheight / rows); $(".quake-el").css({ width: 0, height: 0, opacity: 0, display: "block" }); var c = $(".quake-el").get().sort(function () { return math.round(math.random()) - .5 }); $(c).each(function (a) { var b = coordinates[a]; var c = "left:" + b.left + "; top:" + b.top + ""; $(this).css("background-position", c) }); $(c).each(function (d) { if (complete < c.length) { var e = $(this); settimeout(function () { try { e.animate({ opacity: 1, width: a, height: b }, animationspeed, function () { complete++; if (complete == c.length) { animationcomplete() } }) } catch (d) { } }, factor); factor += timefactor * 2 } }) } function animateboxes() { createboxes(); var a = math.ceil(sliderwidth / cols); var b = math.ceil(sliderheight / rows); $(".quake-el").css({ width: 0, height: 0, opacity: 0, display: "block" }); $(".quake-el").each(function (c) { var d = $(this); try { d.animate({ opacity: 1, width: a, height: b }, animationspeed, function () { complete++; if (complete == noofboxes) { animationcomplete() } }) } catch (e) { } factor += timefactor * 2 }) } function animatelinearpealdimensions() { createboxes(); var a = math.ceil(sliderwidth / cols); var b = math.ceil(sliderheight / rows); $(".quake-el", slidercontainer).each(function () { var c = $(this); settimeout(function () { c.css({ width: 0, height: 0, opacity: 1, display: "block" }).animate({ width: a, height: b }, animationspeed, function () { complete++; if (complete == noofboxes) { animationcomplete() } }) }, factor * 1.5); factor += timefactor }) } function animatereversepealdimensions() { createboxes(); var a = math.ceil(sliderwidth / cols); var b = math.ceil(sliderheight / rows); var c = new array; $(".quake-el", slidercontainer).each(function (a) { swapdirection(a); if (direction == "forward") { c.push(a) } else { var b = currentrow * cols - 1 + ((currentrow - 1) * cols - a); c.push(b) } }); $(".quake-el", slidercontainer).each(function (d) { settimeout(function () { $(".quake-el:eq(" + c[d] + ")", slidercontainer).css({ width: 0, height: b, opacity: 1, display: "block" }).animate({ width: a, height: b }, animationspeed / 2, function () { complete++; if (complete == c.length) { animationcomplete() } }) }, factor * 1.5); factor += timefactor }) } function animatelinearpeal() { createboxes(); $(".quake-el", slidercontainer).each(function () { var a = $(this); settimeout(function () { a.fadein(animationspeed, function () { complete++; if (complete == noofboxes) { animationcomplete() } }) }, factor * 1.3); factor += timefactor }) } function animatereversepeal() { createboxes(); var a = new array; $(".quake-el", slidercontainer).each(function (b) { swapdirection(b); if (direction == "forward") { a.push(b) } else { var c = currentrow * cols - 1 + ((currentrow - 1) * cols - b); a.push(c) } }); $(".quake-el", slidercontainer).each(function (b) { settimeout(function () { $(".quake-el:eq(" + a[b] + ")", slidercontainer).fadein(animationspeed / 2, function () { complete++; if (complete == a.length) { animationcomplete() } }) }, factor * 1.5); factor += timefactor }) } function animatespiral(a, b) { createboxes(); var c = math.ceil(sliderwidth / cols); var d = math.ceil(sliderheight / rows); if (b) $(".quake-el", slidercontainer).css({ width: 0, height: 0, opacity: 1 }); var e = new array; var f = 0; for (var g = 0; g < rows; g++) { var h = new array; e.push(h); for (var i = 0; i < cols; i++) { h.push(f); f++ } } var j = new array; j = spiralify(e); if (a) j.reverse(); $(".quake-el", slidercontainer).each(function (a) { settimeout(function () { if (!b) { $(".quake-el:eq(" + j[a] + ")", slidercontainer).fadein(animationspeed / 2, function () { complete++; if (complete == j.length) { animationcomplete() } }) } else { $(".quake-el:eq(" + j[a] + ")", slidercontainer).show().animate({ width: c, height: d }, animationspeed / 2, function () { complete++; if (complete == j.length) { animationcomplete() } }) } }, factor * 1.5); factor += timefactor }) } function animateswirlfadein() { createcircles(currentimageindex); var a = new array; $(".quake-el", slidercontainer).each(function (b) { a.push(mincircumeference * (b + 1)) }); a[a.length - 1] = 0; $(".quake-el", slidercontainer).each(function (b) { var c = $(this); settimeout(function () { c.css({ borderradius: a[b] }).animate({ opacity: 1, zindex: 0 }, animationspeed, function () { complete++; if (complete == a.length) { animationcomplete() } }) }, factor); factor += timefactor }) } function animateboxfadeoutoriginal(a) { if (previousimage == null) previousimage = images[images.length - 1]; var b = $("
").css({ zindex: 1, backgroundimage: "url(" + getimagesrc(currentimage) + ")", backgroundposition: "center", backgroundrepeat: "no-repeat", position: "absolute", width: "100%", height: "100%" }).addclass("quake-fi"); createcircles(previousimageindex); slidercontainer.append(b); var c = $(".quake-el", slidercontainer).css("opacity", 1).length; var d = sliderwidth / animationspeed; var e = 0; if (a) e = 360; $(".quake-el", slidercontainer).each(function (a) { var b = $(this); settimeout(function () { b.animate({ opacity: 0, scale: "-=1", rotate: "+=" + e + "deg" }, animationspeed, function () { complete++; if (complete == c - 1) { animationcomplete() } }) }, factor); factor += timefactor }) } function animateboxfadein() { var a = circles * 2; var b = currentimageindex; mincircumeference = sliderwidth / a; mincircumeference++; zindex = 100; timefactor = animationspeed / circles; for (var c = 0; c < a; c++) { var d = c + 1; d /= a; var e = (c + 1) * mincircumeference; var f = centerleft - e / 2; var g = centertop - e / 2; var h = (c + 1) * mincircumeference; var i = $("
").css({ backgroundimage: "url(" + getimagesrc(images[b]) + ")", backgroundposition: "center", backgroundrepeat: "no-repeat", left: f, top: g, position: "absolute", width: e, height: e, opacity: 0 }).addclass("quake-el"); slidercontainer.append(i) } var j = new array; $(".quake-el", slidercontainer).each(function (a) { j.push(mincircumeference * (a + 1)) }); $(".quake-el", slidercontainer).each(function (a) { var b = $(this); settimeout(function () { b.animate({ opacity: 1 }, animationspeed, function () { complete++; if (complete == j.length) { animationcomplete() } }) }, factor); factor += timefactor }) } function animateswirlfadeout() { var a = $("
").css({ zindex: 1, backgroundimage: "url(" + getimagesrc(currentimage) + ")", backgroundposition: "center", backgroundrepeat: "no-repeat", position: "absolute", width: "100%", height: "100%" }).addclass("quake-fi"); createcircles(previousimageindex); $(".quake-el", slidercontainer).css({ opacity: 1, zindex: 2 }); var b = new array; $(".quake-el", slidercontainer).each(function (a) { $(this).css({ borderradius: mincircumeference * (a + 1) }) }); $(".quake-el:last").css({ borderradius: 0 }); slidercontainer.append(a); settimeout(function () { hideit(1) }, 0) } function animateswirlfadeoutrotate(a) { var b = $("
").css({ zindex: 1, backgroundimage: "url(" + getimagesrc(currentimage) + ")", backgroundposition: "center", backgroundrepeat: "no-repeat", position: "absolute", width: "100%", height: "100%" }).addclass("quake-fi"); createcircles(previousimageindex); $(".quake-el", slidercontainer).css({ opacity: 1 }); var c = new array; var d = new array; $(".quake-el", slidercontainer).css("background-repeat", "repeat").each(function (a) { $(this).css({ borderradius: mincircumeference * (a + 1) }); d.push(a) }); slidercontainer.append(b); d = d.reverse(); var e = d.length; var f = 20; $(d).each(function (b, c) { var d = $(".quake-el", slidercontainer).eq(b); f += 5; var g = f; if (a) if (c % 2 != 0) g = -f; factor = 100 * c; settimeout(function () { d.animate({ opacity: 0, rotate: g + "deg" }, animationspeed, function () { complete++; if (complete == e - 1) animationcomplete() }) }, factor) }) } function animatediagonally(a, b) { var c = math.ceil(sliderwidth / cols); var d = math.ceil(sliderheight / rows); for (var e = 0; e < rows; e++) { for (var f = 0; f < cols; f++) { $("
").addclass("quake-el").css({ width: b ? 0 : c, height: b ? 0 : d, left: math.ceil(f * c), top: math.ceil(e * d), position: "absolute", opacity: b ? 1 : 0, backgroundimage: "url(" + getimagesrc(currentimage) + ")", backgroundposition: "" + -(f * c) + "px " + -(e * d) + "px" }).appendto(slidercontainer) } } timefactor = animationspeed / noofboxes; var g = new array; for (var h = 0; h < rows + cols - 1; h++) { g.push(h); g[h] = new array; for (var i = math.min(rows, h + 1) - 1; i >= math.max(0, h - cols + 1); i--) { g[h].push(i * cols + h - i) } } if (a) g.reverse(); $(g).each(function (a, b) { settimeout(function () { $(b).each(function (a, b) { $(".quake-el:eq(" + b + ")").animate({ opacity: 1, width: c, height: d }, animationspeed, function () { complete++; if (complete == noofboxes) { animationcomplete() } }) }) }, factor * 6); factor += timefactor }) } function animateblind() { var a = wbars; var b = sliderwidth / a; if (b % 10 != 0) b++; for (var c = 0; c < a; c++) { $("
").css({ width: 0, height: sliderheight, left: math.ceil(c * sliderwidth / a), position: "absolute", backgroundimage: "url(" + getimagesrc(currentimage) + ")", backgroundposition: "" + -(c * sliderwidth / a) + "px 0px" }).addclass("quake-el").appendto(slidercontainer) } timefactor = animationspeed / a; $(".quake-el", slidercontainer).each(function (c) { var d = $(this); settimeout(function () { d.animate({ width: b }, animationspeed, function () { complete++; if (complete == a) { animationcomplete() } }) }, factor); factor += timefactor }) } function animateslabs() { var a = wbars; var b = sliderwidth / a; if (b % 10 != 0) b++; for (var c = 0; c < a; c++) { $("
").css({ width: b, height: sliderheight, left: -b, position: "absolute", backgroundimage: "url(" + getimagesrc(currentimage) + ")", backgroundposition: "" + -(c * sliderwidth / a) + "px 0px", opacity: 0 }).addclass("quake-el").appendto(slidercontainer) } timefactor = animationspeed / a; $(".quake-el", slidercontainer).each(function (b) { var c = a - b; var d = $(".quake-el", slidercontainer).eq(c); var e = math.ceil(c * sliderwidth / a); settimeout(function () { d.animate({ left: e, opacity: 1 }, animationspeed) }, factor); factor += timefactor }); factor -= timefactor; settimeout(function () { $(".quake-el", slidercontainer).eq(0).animate({ left: 0, opacity: 1 }, animationspeed, animationcomplete) }, factor) } function animateblindhorizontal() { var a = hbars; var b = sliderheight / a; if (b % 10 != 0) b++; for (var c = 0; c < a; c++) { $("
").css({ width: sliderwidth, height: 0, top: math.ceil(c * sliderheight / a), position: "absolute", backgroundimage: "url(" + getimagesrc(currentimage) + ")", backgroundposition: "0px " + -(c * sliderheight / a) + "px" }).addclass("quake-el").appendto(slidercontainer) } timefactor = animationspeed / a; $(".quake-el", slidercontainer).each(function (c) { var d = $(this); settimeout(function () { d.animate({ height: b }, animationspeed, function () { complete++; if (complete == a) { animationcomplete() } }) }, factor); factor += timefactor }) } function animateblindfade() { var a = wbars; var b = sliderwidth / a; if (b % 10 != 0) b += 1; for (var c = 0; c < a; c++) { $("
").css({ width: b, height: sliderheight, left: math.ceil(c * sliderwidth / a), position: "absolute", backgroundimage: "url(" + getimagesrc(currentimage) + ")", backgroundposition: "" + -(c * sliderwidth / a) + "px 0px", opacity: 0 }).addclass("quake-el").appendto(slidercontainer) } timefactor = animationspeed / a; $(".quake-el", slidercontainer).each(function (b) { var c = $(this); settimeout(function () { c.animate({ opacity: 1 }, animationspeed, function () { complete++; if (complete == a - 1) { animationcomplete() } }) }, factor * 2); factor += timefactor }) } function animateblindfadereverse() { var a = wbars; var b = sliderwidth / a; if (b % 10 != 0) b += 1; for (var c = 0; c < a; c++) { $("
").css({ width: b, height: sliderheight, left: math.ceil(c * sliderwidth / a), position: "absolute", backgroundimage: "url(" + getimagesrc(currentimage) + ")", backgroundposition: "" + -(c * sliderwidth / a) + "px 0px", opacity: 0 }).addclass("quake-el").appendto(slidercontainer) } timefactor = animationspeed / a; $(".quake-el", slidercontainer).each(function (b) { var c = $(".quake-el", slidercontainer).eq(a - (b + 1)); settimeout(function () { c.animate({ opacity: 1 }, animationspeed, function () { complete++; if (complete == a - 1) { animationcomplete() } }) }, factor * 2); factor += timefactor }) } function animatefallingblindfade() { var a = hbars; var b = sliderheight / a; if (b % 10 != 0) b += 1; for (var c = 0; c < a; c++) { $("
").css({ width: sliderwidth, height: b, left: 0, top: math.ceil(c * sliderheight / a), position: "absolute", backgroundimage: "url(" + getimagesrc(currentimage) + ")", backgroundposition: "0px " + -(c * sliderheight / a) + "px", opacity: 0 }).addclass("quake-el").appendto(slidercontainer) } timefactor = animationspeed / a; $(".quake-el", slidercontainer).each(function (b) { var c = $(this); settimeout(function () { c.animate({ opacity: 1 }, animationspeed, function () { complete++; if (complete == a) { animationcomplete() } }) }, factor * 2); factor += timefactor }) } function animateraisingblindfade() { var a = hbars; var b = sliderheight / a; if (b % 10 != 0) b += 1; for (var c = 0; c < a; c++) { $("
").css({ width: sliderwidth, height: b, left: 0, top: math.ceil(c * sliderheight / a), position: "absolute", backgroundimage: "url(" + getimagesrc(currentimage) + ")", backgroundposition: "0px " + -(c * sliderheight / a) + "px", opacity: 0 }).addclass("quake-el").appendto(slidercontainer) } timefactor = animationspeed / a; $(".quake-el", slidercontainer).each(function (b) { var c = $(".quake-el", slidercontainer).eq(a - (b + 1)); settimeout(function () { c.animate({ opacity: 1 }, animationspeed, function () { complete++; if (complete == a) { animationcomplete() } }) }, factor * 2); factor += timefactor }) } function animatemixbars() { var a = wbars; timefactor = animationspeed / a; for (var b = 0; b < a; b++) { $("
").css({ width: math.ceil(sliderwidth / a), height: sliderheight, margintop: b % 2 == 0 ? -sliderheight : sliderheight, left: math.ceil(b * sliderwidth / a), position: "absolute", backgroundimage: "url(" + getimagesrc(currentimage) + ")", backgroundposition: "" + -(b * sliderwidth / a) + "px 0px", opacity: 0 }).addclass("quake-el").appendto(slidercontainer) } $(".quake-el", slidercontainer).each(function (b) { var c = $(this); settimeout(function () { c.animate({ margintop: 0, opacity: 1 }, animationspeed, function () { complete++; if (complete == a - 1) animationcomplete() }) }, factor * 1.5); factor += timefactor }) } function animatemixbarsfancy() { var a = wbars; timefactor = animationspeed / a; for (var b = 0; b < a; b++) { $("
").css({ width: math.ceil(sliderwidth / a), height: sliderheight, margintop: b % 2 == 0 ? -sliderheight : sliderheight, left: math.ceil(b * sliderwidth / a), position: "absolute", backgroundimage: "url(" + getimagesrc(currentimage) + ")", backgroundposition: "" + -(b * sliderwidth / a) + "px 0px", opacity: 0 }).addclass("quake-el").appendto(slidercontainer) } $(".quake-el:odd", slidercontainer).each(function (b) { var c = $(".quake-el", slidercontainer).eq(b); var d = $(".quake-el", slidercontainer).eq(a - (b + 1)); settimeout(function () { c.animate({ margintop: 0, opacity: 1 }, animationspeed, function () { complete++; if (complete == a - 1) animationcomplete() }); d.animate({ margintop: 0, opacity: 1 }, animationspeed, function () { complete++; if (complete == a - 1) animationcomplete() }) }, factor * 1.5); factor += timefactor }) } function animatebarsdown(a) { var b = wbars; timefactor = animationspeed / b; if (previousimage == null) previousimage = currentimage; for (var c = 0; c < b; c++) { $("
").css({ width: math.ceil(sliderwidth / b), height: sliderheight, margintop: a ? 0 : -sliderheight, left: math.ceil(c * sliderwidth / b), position: "absolute", backgroundimage: "url(" + getimagesrc(a ? previousimage : currentimage) + ")", backgroundposition: "" + -(c * sliderwidth / b) + "px 0px", opacity: 0 }).addclass("quake-el").appendto(slidercontainer) } var d = $("
").css({ zindex: 0, backgroundimage: "url(" + getimagesrc(currentimage) + ")", backgroundposition: "center", backgroundrepeat: "no-repeat", position: "absolute", width: "100%", height: "100%" }).addclass("quake-fi"); if (a) { $(".quake-el", slidercontainer).css({ opacity: 1, zindex: 2 }); slidercontainer.append(d) } $(".quake-el", slidercontainer).each(function (c) { var d = $(this); settimeout(function () { d.animate({ margintop: a ? -sliderheight : 0, opacity: 1 }, animationspeed, function () { complete++; if (complete == b - 1) animationcomplete() }) }, factor * 1.5); factor += timefactor }) } function animatebarup() { var a = wbars; timefactor = animationspeed / a; for (var b = 0; b < a; b++) { $("
").css({ width: math.ceil(sliderwidth / a), height: sliderheight, margintop: sliderheight, left: math.ceil(b * sliderwidth / a), position: "absolute", backgroundimage: "url(" + getimagesrc(currentimage) + ")", backgroundposition: "" + -(b * sliderwidth / a) + "px 0px", opacity: 0 }).addclass("quake-el").appendto(slidercontainer) } $(".quake-el", slidercontainer).each(function (b) { var c = $(this); settimeout(function () { c.animate({ margintop: 0, opacity: 1 }, animationspeed, function () { complete++; if (complete == a - 1) animationcomplete() }) }, factor * 1.5); factor += timefactor }) } function animateexplode() { timefactor = animationspeed / noofboxes; var a = math.ceil(sliderwidth / cols); var b = math.ceil(sliderheight / rows); var c = new array; for (var d = 0; d < rows; d++) { for (var e = 0; e < cols; e++) { $("
").css({ width: a, height: b, left: math.ceil(sliderwidth / 2 - a / 2), top: math.ceil(sliderheight / 2 - b / 2), opacity: 0, position: "absolute", backgroundimage: "url(" + getimagesrc(currentimage) + ")", backgroundposition: "" + -(e * a) + "px " + -(d * b) + "px" }).addclass("quake-el").appendto(slidercontainer); var f = [{ left: e * a, top: d * b}]; c.push(f) } } $(".quake-el", slidercontainer).each(function (a) { var b = $(this); var d = c[a][0]; b.animate({ left: d.left, top: d.top, opacity: 1 }, animationspeed * 2, function () { complete++; if (complete == noofboxes) animationcomplete() }); factor += timefactor }) } function animateexplodefancy() { timefactor = animationspeed / noofboxes; var a = math.ceil(sliderwidth / cols); var b = math.ceil(sliderheight / rows); var c = new array; for (var d = 0; d < rows; d++) { for (var e = 0; e < cols; e++) { $("
").css({ width: 0, height: 0, left: math.ceil(sliderwidth / 2 - a / 2), top: math.ceil(sliderheight / 2 - b / 2), opacity: 0, position: "absolute", backgroundimage: "url(" + getimagesrc(currentimage) + ")", backgroundposition: "" + -(e * a) + "px " + -(d * b) + "px" }).addclass("quake-el").appendto(slidercontainer); var f = [{ left: e * a, top: d * b}]; c.push(f) } } $(".quake-el", slidercontainer).each(function (d) { var e = $(this); settimeout(function () { var f = c[d][0]; e.animate({ left: f.left, top: f.top, opacity: 1, width: a, height: b }, animationspeed, function () { complete++; if (complete == noofboxes) { animationcomplete() } }) }, factor * 2); factor += timefactor }) } function animatefade() { $("
").css({ width: sliderwidth, height: sliderheight, backgroundimage: "url(" + getimagesrc(currentimage) + ")", backgroundposition: "center", backgroundrepeat: "no-repeat", position: "absolute", left: 0, top: 0, zindex: 100, opacity: 0 }).addclass("quake-el").appendto(slidercontainer); $(".quake-el", slidercontainer).animate({ opacity: 1 }, animationspeed * 2, function () { animationcomplete() }) } function animateslidein(a) { var b = hbars; if (wbars - hbars >= wbars / 2) { b += hbars / 2 } for (var c = 0; c < b; c++) { $("
").css({ width: sliderwidth, height: math.ceil(sliderheight / b), marginleft: a ? sliderwidth : -sliderwidth, top: math.ceil(c * sliderheight / b), position: "absolute", backgroundimage: "url(" + getimagesrc(currentimage) + ")", backgroundposition: "0px " + -math.ceil(c * sliderheight / b) + "px", opacity: 0 }).addclass("quake-el").appendto(slidercontainer) } timefactor = animationspeed / b; $(".quake-el", slidercontainer).each(function () { var a = $(this); settimeout(function () { a.animate({ marginleft: 0, opacity: 1 }, animationspeed, function () { complete++; if (complete == b) animationcomplete() }) }, factor * 2); factor += timefactor }) } function animateslideinfancy() { var a = hbars; if (wbars - hbars >= wbars / 2) { a += hbars / 2 } for (var b = 0; b < a; b++) { $("
").css({ width: sliderwidth, height: math.ceil(sliderheight / a), marginleft: b % 2 == 0 ? -sliderwidth : sliderwidth, top: math.ceil(b * sliderheight / a), position: "absolute", backgroundimage: "url(" + getimagesrc(currentimage) + ")", backgroundposition: "0px " + -math.ceil(b * sliderheight / a) + "px", opacity: 0 }).addclass("quake-el").appendto(slidercontainer) } timefactor = animationspeed / a; $(".quake-el", slidercontainer).each(function () { var b = $(this); settimeout(function () { b.animate({ marginleft: 0, opacity: 1 }, animationspeed, function () { complete++; if (complete == a) animationcomplete() }) }, factor * 2); factor += timefactor }) } function animatechop(a, b, c) { var d = math.ceil(sliderwidth / cols); var e = math.ceil(sliderheight / rows); var f = hbars / 2; if (wbars - hbars >= wbars / 2) { f += hbars / 2 } if (previousimage == null) previousimage = images[images.length - 1]; var g = $("
").css({ zindex: 0, backgroundimage: "url(" + getimagesrc(currentimage) + ")", backgroundposition: "center", backgroundrepeat: "no-repeat", position: "absolute", width: "100%", height: "100%", display: "none" }).addclass("quake-fi"); for (var h = 0; h < f; h++) { $("
").css({ width: sliderwidth, height: math.ceil(sliderheight / f), top: math.ceil(h * sliderheight / f), position: "absolute", backgroundimage: "url(" + getimagesrc(previousimage) + ")", backgroundposition: "0px " + -math.ceil(h * sliderheight / f) + "px", zindex: 2 }).addclass("quake-el").appendto(slidercontainer) } g.css("display", "block"); slidercontainer.append(g); timefactor = animationspeed / f; $(".quake-el", slidercontainer).each(function (d, e) { var e = $(this); var g = d % 2 == 0 ? -sliderwidth : sliderwidth; settimeout(function () { if (a) { e.animate({ marginleft: g, opacity: 1, height: 0, width: 0 }, animationspeed, function () { complete++; if (complete == f) animationcomplete() }) } else { if (b) g = sliderwidth; if (c) g = -sliderwidth; e.animate({ marginleft: g, opacity: 1 }, animationspeed, function () { complete++; if (complete == f) animationcomplete() }) } }, factor); factor += timefactor }) } function animateslideleft() { var a = $("
").addclass("quake-el").css({ width: sliderwidth, height: sliderheight, left: sliderwidth, top: 0, position: "absolute", backgroundimage: "url(" + getimagesrc(currentimage) + ")", backgroundposition: "center", backgroundrepeat: "no-repeat", zindex: 100, opacity: 1 }); slidercontainer.append(a); if (previousimage != null) { var b = $("
").addclass("quake-el").css({ width: sliderwidth, height: sliderheight, left: 0, top: 0, position: "absolute", backgroundimage: "url(" + getimagesrc(previousimage) + ")", backgroundposition: "center", backgroundrepeat: "no-repeat", zindex: 100 }); slidercontainer.append(b) } $(".quake-el", slidercontainer).animate({ left: "-=" + sliderwidth, opacity: 1 }, animationspeed, function () { complete++; if (complete == 1) animationcomplete() }) } function animateslideright() { var a = $("
").addclass("quake-el").css({ width: sliderwidth, height: sliderheight, left: -sliderwidth, top: 0, position: "absolute", backgroundimage: "url(" + getimagesrc(currentimage) + ")", backgroundposition: "center", backgroundrepeat: "no-repeat", zindex: 100, opacity: 1 }); slidercontainer.append(a); if (previousimage != null) { var b = $("
").addclass("quake-el").css({ width: sliderwidth, height: sliderheight, left: 0, top: 0, position: "absolute", backgroundimage: "url(" + getimagesrc(previousimage) + ")", backgroundposition: "center", backgroundrepeat: "no-repeat", zindex: 100 }); slidercontainer.append(b) } $(".quake-el", slidercontainer).animate({ left: "+=" + sliderwidth, opacity: 1 }, animationspeed, function () { complete++; if (complete == 1) animationcomplete() }) } function animateslidedown() { var a = $("
").addclass("quake-el").css({ width: sliderwidth, height: sliderheight, left: 0, top: -sliderheight, position: "absolute", backgroundimage: "url(" + getimagesrc(currentimage) + ")", backgroundposition: "center", backgroundrepeat: "no-repeat", zindex: 100, opacity: 1 }); slidercontainer.append(a); if (previousimage != null) { var b = $("
").addclass("quake-el").css({ width: sliderwidth, height: sliderheight, left: 0, top: 0, position: "absolute", backgroundimage: "url(" + getimagesrc(previousimage) + ")", backgroundposition: "center", backgroundrepeat: "no-repeat", zindex: 100 }); slidercontainer.append(b) } $(".quake-el", slidercontainer).animate({ top: "+=" + sliderheight, opacity: 1 }, animationspeed, function () { complete++; if (complete == 1) animationcomplete() }) } function animateslideup() { var a = $("
").addclass("quake-el").css({ width: sliderwidth, height: sliderheight, left: 0, top: sliderheight, position: "absolute", backgroundimage: "url(" + getimagesrc(currentimage) + ")", backgroundposition: "center", backgroundrepeat: "no-repeat", zindex: 100, opacity: 1 }); slidercontainer.append(a); if (previousimage != null) { var b = $("
").addclass("quake-el").css({ width: sliderwidth, height: sliderheight, left: 0, top: 0, position: "absolute", backgroundimage: "url(" + getimagesrc(previousimage) + ")", backgroundposition: "center", backgroundrepeat: "no-repeat", zindex: 100 }); slidercontainer.append(b) } slidercontainer.append(a).append(b); $(".quake-el", slidercontainer).animate({ top: "-=" + sliderheight, opacity: 1 }, animationspeed, function () { complete++; if (complete == 1) animationcomplete() }) } function animationcomplete() { $(".quake-dn", slidercontainer).remove(); $(".quake-el", slidercontainer).removeclass("quake-el").addclass("quake-dn").css("z-index", "0"); $(".quake-fi").removeclass("quake-fi").addclass("quake-dn").css("z-index", "0"); if (currentimage.is("a")) slidercontainer.find(".quake-link").css({ display: "block" }).attr("href", currentimage.attr("href")).attr("target", currentimage.attr("target")); else slidercontainer.find(".quake-link").css({ display: "none" }).attr("href", "#"); isanimating = false } function hideit(a) { var b = circles - a; var c = b + 1; c /= 10; c = 1 - c; $(".quake-el:eq(" + b + ")", slidercontainer).animate({ opacity: c }, timefactor, function () { if (a < $(".quake-el", slidercontainer).length - 1) { a++; hideit(a) } else { $(".quake-el", slidercontainer).animate({ opacity: 0 }, animationspeed); settimeout(animationcomplete, animationspeed + 1) } }) } function spiralify(a) { if (a.length == 1) { return a[0] } var b = a[0], c = a.length, d = [], e, f, g = a[1].length - 1; for (g; g >= 0; g--) { e = []; for (f = 1; f < c; f++) { e.push(a[f][g]) } d.push(e) } b.push.apply(b, spiralify(d)); return b } function swapdirection(a) { if (a % cols == 0) { currentrow++; if (direction == "forward") direction = "backward"; else direction = "forward" } } function createboxes() { var a = sliderwidth / cols; var b = sliderheight / rows; if (a % 10 > 0) { a = parseint(a); a++ } if (b % 10 > 0) { b = parseint(b); b++ } timefactor = animationspeed / noofboxes; for (var c = 0; c < rows; c++) { for (var d = 0; d < cols; d++) { var e = $("
").css({ width: a + "px", height: b + "px", top: c * b + "px", left: d * a + "px", position: "absolute", backgroundimage: "url(" + getimagesrc(currentimage) + ")", backgroundrepeat: "no-repeat", backgroundposition: "" + d * -a + "px " + c * -b + "px" }).addclass("quake-el").hide(); slidercontainer.append(e) } } $(".quake-el", slidercontainer).each(function (a) { var b = { left: $(this).css("left"), top: $(this).css("top") }; coordinates.push(b) }) } function getimagesrc(a) { if (a.is("img")) { return a.attr("src") } else if (a.is("a") && a.children().is("img")) return a.children().attr("src") } function createcircles(a) { mincircumeference = sliderwidth / circles; if (mincircumeference % 2 != 0 && a != currentimageindex) mincircumeference++; zindex = 100; timefactor = animationspeed / circles; for (var b = 0; b < circles; b++) { var c = b + 1; c /= 10; var d = (b + 1) * mincircumeference; var e = centerleft - d / 2; var f = centertop - d / 2; var g = (b + 1) * mincircumeference; var h = $("
").css({ backgroundimage: "url(" + getimagesrc(images[a]) + ")", backgroundposition: "center", backgroundrepeat: "no-repeat", left: e, top: f, position: "absolute", width: d, height: d, zindex: zindex--, opacity: 0 }).addclass("quake-el"); slidercontainer.append(h) } } function animatecaption() { if (captions.length > currentimageindex) { var a = settings.captionorientations.length; var b = settings.captionorientations[a - 1]; if (currentimageindex < a) b = settings.captionorientations[currentimageindex]; captioncontainer.removeattr("style").removeclass("vertical left right bottom top horizontal"); captioncontainer.parent().find(".quake-slider-caption").remove(); var c = captions.eq(currentimageindex).removeattr("style").css("opacity", "0").removeclass("vertical left right bottom top horizontal"); captioncontainer.after(c); if (settings.captionssetup == null) { captiondefaultanimation(captioncontainer, c, b) } else { var d = getconfiguration(currentimageindex); if (d != null) { if (d.orientation != null) b = d.orientation; setorientation(captioncontainer, c, b); captioncontainer.show().css("opacity", settings.captionopacity); c.css({ opacity: 1 }); if (d.callback != null) d.callback(captioncontainer, c, b); else captiondefaultanimation(captioncontainer, c, b) } else captiondefaultanimation(captioncontainer, c, b) } } else { captioncontainer.stop(true, true).animate({ opacity: 0 }, settings.captionanimationspeed, function () { $(this).parent().find(".quake-slider-caption").remove() }) } } function getconfiguration(slide) { if (settings.captionssetup == null) return null; var setups = eval(settings.captionssetup); for (var i = 0; i < setups.length; i++) { if (setups[i].slides != null) { if ($.inarray(slide, setups[i].slides) != -1) return setups[i] } } return null } function setorientation(a, b, c) { var d; if (c == "top") d = "horizontal top"; if (c == "bottom") d = "horizontal bottom"; if (c == "left") d = "vertical left"; if (c == "right") d = "vertical right"; a.addclass("quake-slider-caption-container " + d); b.addclass("quake-slider-caption " + d) } function captiondefaultanimation(a, b, c) { setorientation(a, b, c); a.show().css("opacity", "0").stop(true, true).animate({ opacity: settings.captionopacity }, settings.captionanimationspeed); b.stop(true, true).animate({ opacity: 1 }, settings.captionanimationspeed) } function runanimation() { if (!isanimating) { isanimating = true; currentrow = 0; if (settings.applyeffectsrandomly) { var a = math.floor(math.random() * effects.length); currenteffect = effects[a] } else currenteffect = effects[currenteffectindex]; if (currenteffect == undefined) currenteffect = "randomfade"; $(".quake-nav-container a").removeclass("active").eq(currentimageindex).addclass("active"); animatecaption(); currentimage = images[currentimageindex]; factor = 0; complete = 0; if (!initialized) { initialized = true; previousimageindex = images.length - 1 } switch (currenteffect) { case "slabs": animateslabs(); break; case "randomfade": animaterandomfade(); break; case "fade": animatefade(); break; case "linearpeal": animatelinearpeal(); break; case "linearpealreverse": animatereversepeal(); break; case "linearpealreversedimensions": animatereversepealdimensions(); break; case "swirlfadein": animateswirlfadein(); break; case "swirlfadeout": animateswirlfadeout(); break; case "diagonalfade": animatediagonally(false, false); break; case "diagonalfadereverse": animatediagonally(true, false); break; case "diagonalshow": animatediagonally(false, true); break; case "diagonalshowreverse": animatediagonally(true, true); break; case "blind": animateblind(); break; case "blindhorizontal": animateblindhorizontal(); break; case "blindfade": animateblindfade(); break; case "blindfadereverse": animateblindfadereverse(); break; case "explode": animateexplode(); break; case "explodefancy": animateexplodefancy(); break; case "barsup": animatebarup(); break; case "barsdown": animatebarsdown(false); break; case "barsdownreverse": animatebarsdown(true); break; case "mixbars": animatemixbars(); break; case "mixbarsfancy": animatemixbarsfancy(); break; case "slidein": animateslidein(false); break; case "slideinreverse": animateslidein(true); break; case "slideinfancy": animateslideinfancy(); break; case "slideleft": animateslideleft(); break; case "slideright": animateslideright(); break; case "slideup": animateslideup(); break; case "slidedown": animateslidedown(); break; case "fallingblindfade": animatefallingblindfade(); break; case "raisingblindfade": animateraisingblindfade(); break; case "spiral": animatespiral(false, false); break; case "spiralreverse": animatespiral(true, false); break; case "spiraldimension": animatespiral(false, true); break; case "spiralreversedimension": animatespiral(true, true); break; case "linearpealdimensions": animatelinearpealdimensions(); break; case "chop": animatechop(false, false, false); break; case "chopdimensions": animatechop(true, false, false); break; case "chopdiagonal": animatechop(false, true, false); break; case "chopdiagonalreverse": animatechop(false, false, true); break; case "randomdimensions": animaterandomfadedimensions(); break; case "boxes": animateboxes(); break; case "swirlfadeoutrotate": animateswirlfadeoutrotate(false); break; case "swirlfadeoutrotatefancy": animateswirlfadeoutrotate(true); break; case "swirlfadeindimensions": animateswirlfadeindimensions(); break; case "boxfadein": animateboxfadein(); break; case "boxfadeoutoriginal": animateboxfadeoutoriginal(false); break; case "boxfadeoutoriginalrotate": animateboxfadeoutoriginal(true); break } previousimage = currentimage; previousimageindex = currentimageindex; currentimageindex++; if (currentimageindex == images.length) currentimageindex = 0; currenteffectindex++; if (currenteffectindex == effects.length) currenteffectindex = 0 } } var cols = settings.cols; var rows = settings.rows; var smallthumbheight = 10; var animationspeed = settings.animationspeed; var pausetime = settings.pausetime + animationspeed; var effects = settings.effects; var slidercontainer = $(this); var showthumbnails = settings.thumbnails; var images = new array; var currentimage = null; var previousimage = null; var currentimageindex = 0; var previousimageindex = 0; var coordinates = new array; var timefactor = 0; var animationinterval; var centerleft = 0; var centertop = 0; var zindex = 100; var circles = 10; var direction = "backward"; var isforward = true; var mincircumeference; var currentrow = 0; var isanimating = false; var captioncontainer; var navcontainer; var totalimages; var captions; var visibletumbnails = 0; var sliderwidth = slidercontainer.width(); var sliderheight = slidercontainer.height(); var theme = ""; var wbars = cols * 2; var hbars = rows * 2; var noofboxes = rows * cols; var factor = 0; var complete = 0; var sliderwrapper = $("
").addclass("quake-slider-wrapper"); sliderwrapper.css({ width: sliderwidth, height: sliderheight }); if (!slidercontainer.hasclass("quake-slider")) slidercontainer.addclass("quake-slider"); slidercontainer.before(sliderwrapper); sliderwrapper.append(slidercontainer); slidercontainer.find(".quake-slider-images").css("display", "none"); captioncontainer = slidercontainer.find(".quake-slider-captions").css("display", "none").addclass("quake-slider-caption-container"); if (sliderwidth % 2 != 0) circles--; centerleft = sliderwidth / 2; centertop = sliderheight / 2; $(window).load(function () { $('link[href*="quake.skin.css"]').each(function () { var a = $(this).attr("href").split("/"); theme = a[a.length - 2] }); navcontainer = $("
").addclass("quake-nav"); navcontainer.append($("").addclass("quake-prev").html(settings.prevtext)).append($("").addclass("quake-next").html(settings.nexttext)); totalimages = slidercontainer.find(".quake-slider-images img").length; captions = slidercontainer.find(".quake-slider-caption").clone(true).css({ opacity: 1 }); $(".quake-slider-images img", slidercontainer).each(function () { if ($(this).parent().is("a")) { var a = $(this).parent().clone(); images.push(a) } else images.push($(this).clone()) }); setup(); addnavigationcontrols(); runanimation(); start() }); var currenteffect = "randomfade"; var initialized = false; var currenteffectindex = 0 }) } }); var rotateunits = "deg"; $.fn.rotate = function (a) { var b = $(this).css("transform") || "none"; if (typeof a == "undefined") { if (b) { var c = b.match(/rotate\(([^)]+)\)/); if (c && c[1]) { return c[1] } } return 0 } var c = a.tostring().match(/^(-?\d+(\.\d+)?)(.+)?$/); if (c) { if (c[3]) rotateunits = c[3]; $(this).css("transform", b.replace(/none|rotate\([^)]*\)/, "") + "rotate(" + c[1] + rotateunits + ")") } return this }; $.fn.scale = function (a, b, c) { var d = $(this).css("transform"); if (typeof a == "undefined") { if (d) { var e = d.match(/scale\(([^)]+)\)/); if (e && e[1]) { return e[1] } } return 1 } $(this).css("transform", d.replace(/none|scale\([^)]*\)/, "") + "scale(" + a + ")"); return this }; var curproxied = $.fx.prototype.cur; $.fx.prototype.cur = function () { if (this.prop == "rotate") { return parsefloat($(this.elem).rotate()) } else if (this.prop == "scale") { return parsefloat($(this.elem).scale()) } return curproxied.apply(this, arguments) }; $.fx.step.rotate = function (a) { $(a.elem).rotate(a.now + rotateunits) }; $.fx.step.scale = function (a) { $(a.elem).scale(a.now) }; var animateproxied = $.fn.animate; $.fn.animate = function (a) { if (typeof a["rotate"] != "undefined") { var b = a["rotate"].tostring().match(/^(([+-]=)?(-?\d+(\.\d+)?))(.+)?$/); if (b && b[5]) { rotateunits = b[5] } a["rotate"] = b[1] } return animateproxied.apply(this, arguments) }; var _propsobj = null; var proxied = $.fn.css; $.fn.css = function (a, b) { if (_propsobj === null) { if (typeof $.cssprops != "undefined") { _propsobj = $.cssprops } else if (typeof $.props != "undefined") { _propsobj = $.props } else { _propsobj = {} } } if (typeof _propsobj["transform"] == "undefined" && (a == "transform" || typeof a == "object" && typeof a["transform"] != "undefined")) { _propsobj["transform"] = gettransformproperty(this.get(0)) } if (_propsobj["transform"] != "transform") { if (a == "transform") { a = _propsobj["transform"]; if (typeof b == "undefined" && jquery.style) { return jquery.style(this.get(0), a) } } else if (typeof a == "object" && typeof a["transform"] != "undefined") { a[_propsobj["transform"]] = a["transform"]; delete a["transform"] } } return proxied.apply(this, arguments) } })(jquery)