﻿YUI.add("gallery-slideshow-animated", function (C) {
    function B(D) { B.superclass.constructor.apply(this, arguments); } B.NAME = "slideshowanimated"; B.ANIMATION_DURATION = 0.5; B.EASING = C.Easing.easeNone; B.ATTRS = { animation_out: { value: { from: { opacity: 1 }, to: { opacity: 0 }, duration: B.ANIMATION_DURATION, easing: B.EASING} }, animation_in: { value: { from: { opacity: 0 }, to: { opacity: 1 }, duration: B.ANIMATION_DURATION, easing: B.EASING} }, reverse_animation: { value: false} }; C.extend(B, C.Slideshow, { initializer: function () { if (this.get("animation_in")) { this.anim_in = new C.Anim(this.get("animation_in")); this.anim_in.on("end", this._after_display, this); if (this.get("reverse_animation")) { this.orig_anim_in = this.anim_in; this.reverse_anim_in = new C.Anim(this.get("animation_out")); this.reverse_anim_in.on("end", this._after_display, this); this.reverse_anim_in.set("reverse", true); } } else { this.anim_in = null; } if (this.get("animation_in")) { this.anim_out = new C.Anim(this.get("animation_out")); this.anim_out.on("end", this._after_hide, this); if (this.get("reverse_animation")) { this.orig_anim_out = this.anim_out; this.reverse_anim_out = new C.Anim(this.get("animation_in")); this.reverse_anim_out.on("end", this._after_hide, this); this.reverse_anim_out.set("reverse", true); } } else { this.anim_out = null; } this._prep_slides(); }, _prep_slides: function () { var E = this.anim_out.get("to"), D = (parseInt(E.opacity, 10)); if (!isNaN(D)) { this.get("slides").each(function (F) { if (!F.hasClass(C.Slideshow.CURRENT_CLASS)) { F.setStyle("opacity", D); } }); } }, show_slide: function (D) { this.timer.cancel(); if (this._anim_running()) { C.later(this.get("pause_time") / 20, this, "show_slide", D); } else { if (D != this.get("current_slide")) { this.set("current_slide", D); this.syncUI(); } } }, _anim_running: function () { if (this.anim_in.get("running") || this.anim_out.get("running")) { return true; } else { return false; } }, _display_slide: function (E) { var D = this.get("slides").item(E); this._before_display(); D.addClass(C.Slideshow.CURRENT_CLASS); this.anim_in.set("node", D); this.anim_in.run(); }, _hide_slide: function (D) { this._before_hide(); this.anim_out.set("node", this.get("slides").item(D)); this.anim_out.run(); }, _after_hide: function () { this.get("slides").item(this.hide_slide).removeClass(C.Slideshow.CURRENT_CLASS); this.fire("slideshow:slide-hidden", { slide: this.get("slides").item(this.hide_slide), slide_number: this.hide_slide }); }, advance: function () { if (this.get("reverse_animation")) { this.anim_in = this.orig_anim_in; this.anim_out = this.orig_anim_out; } this.anim_in.set("reverse", false); this.anim_out.set("reverse", false); this.show_slide(this._get_next_slide()); }, previous: function () { if (this.get("reverse_animation")) { this.anim_in = this.reverse_anim_in; this.anim_out = this.reverse_anim_out; } this.show_slide(this._get_previous_slide()); } }); function A(D) { A.superclass.constructor.apply(this, arguments); } A.NAME = "slideshowpanned"; A.ATTRS = { container: { value: null} }; A.CONTAINER_SELECTOR = ".container"; A.HTML_PARSER = { container: function (D) { return D.one(A.CONTAINER_SELECTOR); } }; C.extend(A, B, { initializer: function () { var D, F, E = this.get("slides").item(this.get("current_slide")); this.anim_in.set("node", this.get("container")); this.anim_in.on("end", this._after_hide, this); this.top_corner = { y: E.getY(), x: E.getX() }; this.slide_start_positions = []; this.get("slides").each(function (G) { F = G.getY(); D = G.getX(); this.slide_start_positions.push({ x: D - this.top_corner.x, y: F - this.top_corner.y }); }, this); }, _prep_slides: function () { }, _container_location: function () { var E = this.get("container"), D = E.getX(), F = E.getY(); return { x: D, y: F }; }, _display_slide: function (J) { var F = this.slide_start_positions[J], I = this.slide_start_positions[this.hide_slide], D = this._container_location(), H = false, G = false, E = {}; if (F.y != I.y) { if (F.y < I.y) { H = (Math.abs(I.y) - Math.abs(F.y)) + D.y - this.top_corner.y; } else { H = (F.y - Math.abs(I.y) - D.y + this.top_corner.y) * -1; } } if (H !== false) { E.top = H; } if (F.x != I.x) { if (F.x < I.x) { G = (Math.abs(I.x) - Math.abs(F.x)) + D.x - this.top_corner.x; } else { G = (F.x - Math.abs(I.x) - D.x + this.top_corner.x) * -1; } } if (G !== false) { E.left = G; } this._before_display(); this.anim_in.set("to", E); this._before_hide(); this.anim_in.run(); this.get("slides").item(J).addClass(C.Slideshow.CURRENT_CLASS); this.get("slides").item(this.hide_slide).removeClass(C.Slideshow.CURRENT_CLASS); }, _hide_slide: function (D) { } }); B.AUTO_HORIZONTAL_CLASS = "horizontalSlideshow"; B.AUTO_CROSS_HORIZONTAL_CLASS = "horizontalCrossSlideshow"; B.AUTO_VERTICAL_CLASS = "verticalSlideshow"; B.AUTO_CROSS_VERTICAL_CLASS = "verticalCrossSlideshow"; B.AUTO_PANNING_CLASS = "panningSlideshow"; B.auto_shows = {}; B._auto_get_slide = function (E) { var D = E.one(".slide.current"); if (!D) { D = E.one(".slide"); D.addClass(C.Slideshow.CURRENT_CLASS); } return D; }; B._auto_merge_attrs = function (D, E) { var F = D, G = B.ANIMATION_DURATION, H = B.EASING; if (E) { if (E.duration) { G = E.duration; } if (E.easing) { H = E.easing; } F = C.merge(E, D); } if (F.animation_in) { if (!F.animation_in.duration) { F.animation_in.duration = G; } if (!F.animation_in.easing) { F.animation_in.easing = H; } } if (F.animation_out) { if (!F.animation_out.duration) { F.animation_out.duration = G; } if (!F.animation_out.easing) { F.animation_out.easing = H; } } return F; }; B._auto_horizontal = function (J, F, G) { var E = B._auto_get_slide(J), H = parseInt(E.getComputedStyle("width"), 10), D, K, I; if (!H) { if (E.getStyle("display").toLowerCase() == "none") { E.setStyle("display", "block"); H = parseInt(E.getComputedStyle("width"), 10); } } D = parseInt(E.getComputedStyle("left"), 10) || 0; K = D + H; if (F === B.AUTO_CROSS_HORIZONTAL_CLASS) { I = { animation_out: { from: { left: D }, to: { left: K} }, animation_in: { from: { left: K }, to: { left: D}} }; } else { I = { animation_out: { from: { left: D }, to: { left: (-1 * K)} }, animation_in: { from: { left: K }, to: { left: D}} }; } I.contentBox = J; I.reverse_animation = { value: true }; return new B(B._auto_merge_attrs(I, G)); }; B._auto_vertical = function (I, F, G) {
        var E = B._auto_get_slide(I), D = parseInt(E.getComputedStyle("height"), 10), H; if (!D) { if (E.getStyle("display").toLowerCase() == "none") { E.setStyle("display", "block"); D = parseInt(E.getComputedStyle("height"), 10); } } if (F === B.AUTO_CROSS_VERTICAL_CLASS) { H = { animation_out: { from: { top: 0 }, to: { top: (-1 * D)} }, animation_in: { from: { top: (-1 * D) }, to: { top: 0}} }; } else {
            H = { animation_out: { from: { top: 0 }, to: { top: D} }, animation_in: { from: { top: (-1 * D) }, to: { top: 0}} };
        } H.contentBox = I; H.reverse_animation = { value: true }; return new B(B._auto_merge_attrs(H, G));
    }; B.auto_shows[B.AUTO_HORIZONTAL_CLASS] = function (E, D) { return B._auto_horizontal(E, B.AUTO_HORIZONTAL_CLASS, D); }; B.auto_shows[B.AUTO_CROSS_HORIZONTAL_CLASS] = function (E, D) { return B._auto_horizontal(E, B.AUTO_CROSS_HORIZONTAL_CLASS, D); }; B.auto_shows[B.AUTO_VERTICAL_CLASS] = function (E, D) { return B._auto_vertical(E, B.AUTO_VERTICAL_CLASS, D); }; B.auto_shows[B.AUTO_CROSS_VERTICAL_CLASS] = function (E, D) { return B._auto_vertical(E, B.AUTO_CROSS_VERTICAL_CLASS, D); }; B.auto_shows[B.AUTO_PANNING_CLASS] = function (E, D) { return new A(B._auto_merge_attrs({ contentBox: E }, D)); }; B.auto = function (F) { var H = [], E, I, G, D; for (I in B.auto_shows) { if (B.auto_shows.hasOwnProperty(I)) { H.push(I); } } C.all(C.Slideshow.AUTO_SLIDESHOW_SELECTOR).each(function () { E = false; for (G = 0, D = H.length; G < D; G++) { if (this.hasClass(H[G])) { E = B.auto_shows[H[G]](this, F); break; } } if (!E) { E = new B(B._auto_merge_attrs({ contentBox: this }, F)); } E.render(); }); }; C.SlideshowAnimated = B; C.SlideshowPanned = A;
}, "@VERSION@", { requires: ["node", "event", "widget", "anim", "gallery-slideshow-base"] });

