// Camera slideshow v1.4.0 - a jQuery slideshow with many effects, transitions, easy to customize, using canvas and mobile ready, based on jQuery 1.4+ // Copyright (c) 2012 by Manuel Masia - www.pixedelic.com // Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php (function (a) { a.fn.camera = function (b, c) { function e() { if (navigator.userAgent.match(/Android/i) || navigator.userAgent.match(/webOS/i) || navigator.userAgent.match(/iPad/i) || navigator.userAgent.match(/iPhone/i) || navigator.userAgent.match(/iPod/i)) { return true } } function H() { var b = a(s).width(); a("li", s).removeClass("camera_visThumb"); a("li", s).each(function () { var c = a(this).position(), d = a("ul", s).outerWidth(), e = a("ul", s).offset().left, f = a("> div", s).offset().left, g = f - e; if (g > 0) { a(".camera_prevThumbs", V).removeClass("hideNav") } else { a(".camera_prevThumbs", V).addClass("hideNav") } if (d - g > b) { a(".camera_nextThumbs", V).removeClass("hideNav") } else { a(".camera_nextThumbs", V).addClass("hideNav") } var h = c.left, i = c.left + a(this).width(); if (i - g <= b && h - g >= 0) { a(this).addClass("camera_visThumb") } }) } function K() { function d() { t = f.width(); if (b.height.indexOf("%") != -1) { var c = Math.round(t / (100 / parseFloat(b.height))); if (b.minHeight != "" && c < parseFloat(b.minHeight)) { u = parseFloat(b.minHeight) } else { u = c } f.css({ height: u }) } else if (b.height == "auto") { u = f.height() } else { u = parseFloat(b.height); f.css({ height: u }) } a(".camerarelative", k).css({ width: t, height: u }); a(".imgLoaded", k).each(function () { var c = a(this), d = c.attr("width"), e = c.attr("height"), f = c.index(), g, h, i = c.attr("data-alignment"), j = c.attr("data-portrait"); if (typeof i === "undefined" || i === false || i === "") { i = b.alignment } if (typeof j === "undefined" || j === false || j === "") { j = b.portrait } if (j == false || j == "false") { if (d / e < t / u) { var k = t / d; var l = Math.abs(u - e * k) * .5; switch (i) { case "topLeft": g = 0; break; case "topCenter": g = 0; break; case "topRight": g = 0; break; case "centerLeft": g = "-" + l + "px"; break; case "center": g = "-" + l + "px"; break; case "centerRight": g = "-" + l + "px"; break; case "bottomLeft": g = "-" + l * 2 + "px"; break; case "bottomCenter": g = "-" + l * 2 + "px"; break; case "bottomRight": g = "-" + l * 2 + "px"; break } c.css({ height: e * k, "margin-left": 0, "margin-top": g, position: "absolute", visibility: "visible", width: t }) } else { var k = u / e; var l = Math.abs(t - d * k) * .5; switch (i) { case "topLeft": h = 0; break; case "topCenter": h = "-" + l + "px"; break; case "topRight": h = "-" + l * 2 + "px"; break; case "centerLeft": h = 0; break; case "center": h = "-" + l + "px"; break; case "centerRight": h = "-" + l * 2 + "px"; break; case "bottomLeft": h = 0; break; case "bottomCenter": h = "-" + l + "px"; break; case "bottomRight": h = "-" + l * 2 + "px"; break } c.css({ height: u, "margin-left": h, "margin-top": 0, position: "absolute", visibility: "visible", width: d * k }) } } else { if (d / e < t / u) { var k = u / e; var l = Math.abs(t - d * k) * .5; switch (i) { case "topLeft": h = 0; break; case "topCenter": h = l + "px"; break; case "topRight": h = l * 2 + "px"; break; case "centerLeft": h = 0; break; case "center": h = l + "px"; break; case "centerRight": h = l * 2 + "px"; break; case "bottomLeft": h = 0; break; case "bottomCenter": h = l + "px"; break; case "bottomRight": h = l * 2 + "px"; break } c.css({ height: u, "margin-left": h, "margin-top": 0, position: "absolute", visibility: "visible", width: d * k }) } else { var k = t / d; var l = Math.abs(u - e * k) * .5; switch (i) { case "topLeft": g = 0; break; case "topCenter": g = 0; break; case "topRight": g = 0; break; case "centerLeft": g = l + "px"; break; case "center": g = l + "px"; break; case "centerRight": g = l + "px"; break; case "bottomLeft": g = l * 2 + "px"; break; case "bottomCenter": g = l * 2 + "px"; break; case "bottomRight": g = l * 2 + "px"; break } c.css({ height: e * k, "margin-left": 0, "margin-top": g, position: "absolute", visibility: "visible", width: t }) } } }) } var c; if (I == true) { clearTimeout(c); c = setTimeout(d, 200) } else { d() } I = true } function X(a) { for (var b, c, d = a.length; d; b = parseInt(Math.random() * d), c = a[--d], a[d] = a[b], a[b] = c); return a } function Y(a) { return Math.ceil(a) == Math.floor(a) } function hb() { if (a(s).length && !a(r).length) { var b = a(s).outerWidth(), c = a("ul > li", s).outerWidth(), d = a("li.cameracurrent", s).length ? a("li.cameracurrent", s).position() : "", e = a("ul > li", s).length * a("ul > li", s).outerWidth(), g = a("ul", s).offset().left, h = a("> div", s).offset().left, i; if (g < 0) { i = "-" + (h - g) } else { i = h - g } if (gb == true) { a("ul", s).width(a("ul > li", s).length * a("ul > li", s).outerWidth()); if (a(s).length && !a(r).lenght) { f.css({ marginBottom: a(s).outerHeight() }) } H(); a("ul", s).width(a("ul > li", s).length * a("ul > li", s).outerWidth()); if (a(s).length && !a(r).lenght) { f.css({ marginBottom: a(s).outerHeight() }) } } gb = false; var j = a("li.cameracurrent", s).length ? d.left : "", k = a("li.cameracurrent", s).length ? d.left + a("li.cameracurrent", s).outerWidth() : ""; if (j < a("li.cameracurrent", s).outerWidth()) { j = 0 } if (k - i > b) { if (j + b < e) { a("ul", s).animate({ "margin-left": "-" + j + "px" }, 500, H) } else { a("ul", s).animate({ "margin-left": "-" + (a("ul", s).outerWidth() - b) + "px" }, 500, H) } } else if (j - i < 0) { a("ul", s).animate({ "margin-left": "-" + j + "px" }, 500, H) } else { a("ul", s).css({ "margin-left": "auto", "margin-right": "auto" }); setTimeout(H, 100) } } } function ib() { bb = 0; var c = a(".camera_bar_cont", V).width(), d = a(".camera_bar_cont", V).height(); if (h != "pie") { switch (U) { case "leftToRight": a("#" + i).css({ right: c }); break; case "rightToLeft": a("#" + i).css({ left: c }); break; case "topToBottom": a("#" + i).css({ bottom: d }); break; case "bottomToTop": a("#" + i).css({ top: d }); break } } else { db.clearRect(0, 0, b.pieDiameter, b.pieDiameter) } } function jb(c) { j.addClass("camerasliding"); R = false; var d = parseFloat(a("div.cameraSlide.cameracurrent", k).index()); if (c > 0) { var l = c - 1 } else if (d == B - 1) { var l = 0 } else { var l = d + 1 } var m = a(".cameraSlide:eq(" + l + ")", k); var n = a(".cameraSlide:eq(" + (l + 1) + ")", k).addClass("cameranext"); if (d != l + 1) { n.hide() } a(".cameraContent", g).fadeOut(600); a(".camera_caption", g).show(); a(".camerarelative", m).append(a("> div ", j).eq(l).find("> div.camera_effected")); a(".camera_target_content .cameraContent:eq(" + l + ")", f).append(a("> div ", j).eq(l).find("> div")); if (!a(".imgLoaded", m).length) { var o = v[l]; var p = new Image; p.src = o + "?" + (new Date).getTime(); m.css("visibility", "hidden"); m.prepend(a(p).attr("class", "imgLoaded").css("visibility", "hidden")); var q, w; if (!a(p).get(0).complete || q == "0" || w == "0" || typeof q === "undefined" || q === false || typeof w === "undefined" || w === false) { a(".camera_loader", f).delay(500).fadeIn(400); p.onload = function () { q = p.naturalWidth; w = p.naturalHeight; a(p).attr("data-alignment", z[l]).attr("data-portrait", y[l]); a(p).attr("width", q); a(p).attr("height", w); k.find(".cameraSlide_" + l).hide().css("visibility", "visible"); K(); jb(l + 1) } } } else { if (v.length > l + 1 && !a(".imgLoaded", n).length) { var x = v[l + 1]; var A = new Image; A.src = x + "?" + (new Date).getTime(); n.prepend(a(A).attr("class", "imgLoaded").css("visibility", "hidden")); A.onload = function () { q = A.naturalWidth; w = A.naturalHeight; a(A).attr("data-alignment", z[l + 1]).attr("data-portrait", y[l + 1]); a(A).attr("width", q); a(A).attr("height", w); K() } } b.onLoaded.call(this); if (a(".camera_loader", f).is(":visible")) { a(".camera_loader", f).fadeOut(400) } else { a(".camera_loader", f).css({ visibility: "hidden" }); a(".camera_loader", f).fadeOut(400, function () { a(".camera_loader", f).css({ visibility: "visible" }) }) } var C = b.rows, D = b.cols, F = 1, G = 0, H, I, J, N, O, P = new Array("simpleFade", "curtainTopLeft", "curtainTopRight", "curtainBottomLeft", "curtainBottomRight", "curtainSliceLeft", "curtainSliceRight", "blindCurtainTopLeft", "blindCurtainTopRight", "blindCurtainBottomLeft", "blindCurtainBottomRight", "blindCurtainSliceBottom", "blindCurtainSliceTop", "stampede", "mosaic", "mosaicReverse", "mosaicRandom", "mosaicSpiral", "mosaicSpiralReverse", "topLeftBottomRight", "bottomRightTopLeft", "bottomLeftTopRight", "topRightBottomLeft", "scrollLeft", "scrollRight", "scrollTop", "scrollBottom", "scrollHorz"); marginLeft = 0, marginTop = 0, opacityOnGrid = 0; if (b.opacityOnGrid == true) { opacityOnGrid = 0 } else { opacityOnGrid = 1 } var Q = a(" > div", j).eq(l).attr("data-fx"); if (e() && b.mobileFx != "" && b.mobileFx != "default") { N = b.mobileFx } else { if (typeof Q !== "undefined" && Q !== false && Q !== "default") { N = Q } else { N = b.fx } } if (N == "random") { N = X(P); N = N[0] } else { N = N; if (N.indexOf(",") > 0) { N = N.replace(/ /g, ""); N = N.split(","); N = X(N); N = N[0] } } dataEasing = a(" > div", j).eq(l).attr("data-easing"); mobileEasing = a(" > div", j).eq(l).attr("data-mobileEasing"); if (e() && b.mobileEasing != "" && b.mobileEasing != "default") { if (typeof mobileEasing !== "undefined" && mobileEasing !== false && mobileEasing !== "default") { O = mobileEasing } else { O = b.mobileEasing } } else { if (typeof dataEasing !== "undefined" && dataEasing !== false && dataEasing !== "default") { O = dataEasing } else { O = b.easing } } H = a(" > div", j).eq(l).attr("data-slideOn"); if (typeof H !== "undefined" && H !== false) { T = H } else { if (b.slideOn == "random") { var T = new Array("next", "prev"); T = X(T); T = T[0] } else { T = b.slideOn } } var Y = a(" > div", j).eq(l).attr("data-time"); if (typeof Y !== "undefined" && Y !== false && Y !== "") { I = parseFloat(Y) } else { I = b.time } var Z = a(" > div", j).eq(l).attr("data-transPeriod"); if (typeof Z !== "undefined" && Z !== false && Z !== "") { J = parseFloat(Z) } else { J = b.transPeriod } if (!a(j).hasClass("camerastarted")) { N = "simpleFade"; T = "next"; O = ""; J = 400; a(j).addClass("camerastarted") } switch (N) { case "simpleFade": D = 1; C = 1; break; case "curtainTopLeft": if (b.slicedCols == 0) { D = b.cols } else { D = b.slicedCols } C = 1; break; case "curtainTopRight": if (b.slicedCols == 0) { D = b.cols } else { D = b.slicedCols } C = 1; break; case "curtainBottomLeft": if (b.slicedCols == 0) { D = b.cols } else { D = b.slicedCols } C = 1; break; case "curtainBottomRight": if (b.slicedCols == 0) { D = b.cols } else { D = b.slicedCols } C = 1; break; case "curtainSliceLeft": if (b.slicedCols == 0) { D = b.cols } else { D = b.slicedCols } C = 1; break; case "curtainSliceRight": if (b.slicedCols == 0) { D = b.cols } else { D = b.slicedCols } C = 1; break; case "blindCurtainTopLeft": if (b.slicedRows == 0) { C = b.rows } else { C = b.slicedRows } D = 1; break; case "blindCurtainTopRight": if (b.slicedRows == 0) { C = b.rows } else { C = b.slicedRows } D = 1; break; case "blindCurtainBottomLeft": if (b.slicedRows == 0) { C = b.rows } else { C = b.slicedRows } D = 1; break; case "blindCurtainBottomRight": if (b.slicedRows == 0) { C = b.rows } else { C = b.slicedRows } D = 1; break; case "blindCurtainSliceTop": if (b.slicedRows == 0) { C = b.rows } else { C = b.slicedRows } D = 1; break; case "blindCurtainSliceBottom": if (b.slicedRows == 0) { C = b.rows } else { C = b.slicedRows } D = 1; break; case "stampede": G = "-" + J; break; case "mosaic": G = b.gridDifference; break; case "mosaicReverse": G = b.gridDifference; break; case "mosaicRandom": break; case "mosaicSpiral": G = b.gridDifference; F = 1.7; break; case "mosaicSpiralReverse": G = b.gridDifference; F = 1.7; break; case "topLeftBottomRight": G = b.gridDifference; F = 6; break; case "bottomRightTopLeft": G = b.gridDifference; F = 6; break; case "bottomLeftTopRight": G = b.gridDifference; F = 6; break; case "topRightBottomLeft": G = b.gridDifference; F = 6; break; case "scrollLeft": D = 1; C = 1; break; case "scrollRight": D = 1; C = 1; break; case "scrollTop": D = 1; C = 1; break; case "scrollBottom": D = 1; C = 1; break; case "scrollHorz": D = 1; C = 1; break } var _ = 0; var ab = C * D; var eb = t - Math.floor(t / D) * D; var fb = u - Math.floor(u / C) * C; var gb; var kb; var lb = 0; var mb = 0; var nb = new Array; var ob = new Array; var pb = new Array; while (_ < ab) { nb.push(_); ob.push(_); E.append('