/*! * jquery slider evolution - for jquery 1.3+ * http://codecanyon.net/user/aeroalquimia/portfolio?ref=aeroalquimia * * copyright 2011, eduardo daniel sada * http://codecanyon.net/wiki/buying/howto-buying/licensing/ * * version: 1.1.5 (08 jun 2011) * * includes jquery easing v1.3 * http://gsgd.co.uk/sandbox/jquery/easing/ * copyright (c) 2008 george mcginley smith * jquery easing released under the bsd license. */ (function ($) { var u = (jquery.browser.msie && parseint(jquery.browser.version, 10) < 7 && parseint(jquery.browser.version, 10) > 4); if (u) { try { document.execcommand("backgroundimagecache", false, true) } catch (err) {} }; if ($.proxy === undefined) { $.extend({ proxy: function (a, b) { if (a) { proxy = function () { return a.apply(b || this, arguments) } }; return proxy } }) }; $.extend($.easing, { easeoutcubic: function (x, t, b, c, d) { return c * ((t = t / d - 1) * t * t + 1) + b } }); sliderobject = function (a, b) { this.create(a, b) }; $.extend(sliderobject.prototype, { version: "1.1.4", create: function (a, b) { this.defaults = { name: 'jquery-slider', navigation: true, selector: true, timer: true, control: true, pauseonclick: true, pauseonhover: true, loop: true, slideshow: true, delay: 4500, duration: 400, bars: 9, columns: 7, rows: 3, speed: 80, padding: 8, easing: "easeoutcubic", transition: 'random', oncomplete: function () {}, onslideshowend: function () {} }; this.options = {}; this.transitions = ['fade', 'square', 'bar', 'squarerandom', 'fountain', 'rain', ]; this.dom = {}; this.img = []; this.titles = []; this.links = []; this.imginc = 0; this.imginterval = 0; this.inc = 0; this.order = []; this.resto = 0; this.selectores = []; this.direction = 0; this.degrees = 0; this.timer = 0; this.slides = []; this.esqueleto = { wrapper: [], navigation: [], timer: [], selector: [], control: [], clock: [] }; this.events = { clicked: false, hovered: false, playing: false, paused: false, stopped: false }; this.element = $(a); var c = this.options; var d = this; var e = this.element.children("div"); if (e.length < 2) { return false } if (!b['width']) { b['width'] = 0; b['height'] = 0; var f = {}; e.children().each(function () { if ($(this).is("img")) { f['width'] = $(this).outerwidth(); f['height'] = $(this).outerheight(); b['width'] = (f['width'] >= b['width']) ? f['width'] : 0; b['height'] = (f['height'] >= b['height']) ? f['height'] : 0 } }); delete f; if (b['width'] == 0 || b['height'] == 0) { delete b['width']; delete b['height'] } } this.options = $.extend(true, this.defaults, b); var g = this.options.name + '-option'; $.each(['navigation', 'selector', 'control', 'timer'], function (i, s) { if (d.options[s]) { g += '-' + s } }); this.esqueleto.wrapper = this.element.wrap('
').parent(); this.esqueleto.wrapper.css({ 'width': this.options.width, 'height': this.options.height }); this.element.css({ 'width': this.options.width, 'height': this.options.height, 'overflow': 'hidden', 'position': 'relative' }); e.each(function (i) { if (i == 0) { $(this).addclass(d.options.name + '-slide-current') } $(this).addclass(d.options.name + '-slide'); $(this).addclass(d.options.name + '-slide-' + (i + 1)); d.selectores = $(d.selectores).add($(' ')); if (i == 0) { $(d.selectores).addclass(d.options.name + '-selector-current') } }); this.esqueleto.selector = $('').insertafter(a); this.esqueleto.selector.append(this.selectores); if (!this.options.selector) { this.esqueleto.selector.hide() } else { if (this.rgbtohex(this.esqueleto.selector.css("color")) == "#ffffff") { var h = $('.' + this.options.name + '-selector').outerwidth(true); h = -((h * e.length) / 2); this.esqueleto.selector.css({ "margin-left": h }) } } if (this.options.navigation) { this.esqueleto.navigation = $('').insertafter(a); var j = $('prev'); var k = $('next'); this.esqueleto.navigation.append(j, k) } if (this.options.control) { this.esqueleto.control = $('play/pause').insertafter(a) } if (this.options.timer) { this.esqueleto.timer = $('').insertafter(a); this.esqueleto.clock.mask = $(''); this.esqueleto.clock.rotator = $(''); this.esqueleto.clock.bar = $(''); this.esqueleto.clock.command = this.rgbtohex(this.esqueleto.timer.css("color")); this.esqueleto.timer.append(this.esqueleto.clock.mask.append(this.esqueleto.clock.rotator), this.esqueleto.clock.bar) } this.addevents(); if (this.options.slideshow) { this.starttimer() } else { this.stoptimer() } }, addevents: function () { var c = this; var d = this.esqueleto.wrapper; var e = this.options; d.hover(function () { d.addclass(e.name + '-hovered'); if (e.pauseonhover && !c.events.paused) { c.events.hovered = true; c.pausetimer() } }, function () { d.removeclass(e.name + '-hovered'); if (e.pauseonhover && c.events.hovered) { c.starttimer() } c.events.hovered = false }); this.esqueleto.selector.children("a").click(function (a) { if (c.events.playing == false) { if ($(this).hasclass(e.name + '-selector-current') == false) { var b = c.events.stopped; c.stoptimer(); c.callslide($(this).attr('rel')); if (!e.pauseonclick && !b) { c.starttimer() } } } a.preventdefault() }); if (e.navigation) { this.esqueleto.navigation.children("a").click(function (a) { if (c.events.playing == false) { var b = c.events.stopped; c.stoptimer(); c.callslide($(this).attr("rel")); if (!e.pauseonclick && !b) { c.starttimer() } } a.preventdefault() }) }; if (e.control) { this.esqueleto.control.click($.proxy(function (a) { if (this.events.stopped) { this.starttimer() } else { this.stoptimer() } this.events.hovered = false; a.preventdefault() }, this)) } }, starttimer: function () { if (this.options.timer) { if (this.esqueleto.clock.command == "#000000") { this.esqueleto.clock.bar.animate({ "width": "100%" }, (this.resto > 0 ? this.resto : this.options.delay), "linear", $.proxy(function () { this.callslide("+1"); this.resto = 0; this.esqueleto.clock.bar.css({ "width": 0 }); this.starttimer() }, this)) } else if (this.esqueleto.clock.command = "#ffffff") { this.timer = setinterval($.proxy(function () { var a = "rotate(" + this.degrees + "deg)"; this.degrees += 2; this.esqueleto.clock.rotator.css({ "-webkit-transform": a, "-moz-transform": a, "-o-transform": a, "transform": a }); if (jquery.browser.msie) { this.esqueleto.clock.rotator.get(0).style['mstransform'] = a } if (this.degrees > 180) { this.esqueleto.clock.rotator.addclass(this.options.name + '-timer-rotator-move'); this.esqueleto.clock.mask.addclass(this.options.name + '-timer-mask-move') } if (this.degrees > 360) { this.esqueleto.clock.rotator.removeclass(this.options.name + '-timer-rotator-move'); this.esqueleto.clock.mask.removeclass(this.options.name + '-timer-mask-move'); this.degrees = 0; this.callslide("+1"); this.resto = 0 } }, this), this.options.delay / 180) } if (this.options.control) { this.esqueleto.control.removeclass(this.options.name + '-control-play'); this.esqueleto.control.addclass(this.options.name + '-control-pause') } } else { if (!this.timer) { this.timer = setinterval($.proxy(function () { this.callslide("+1") }, this), this.options.delay) } } this.events.paused = false; this.events.stopped = false; this.element.trigger("sliderplay") }, pausetimer: function () { clearinterval(this.timer); this.timer = ""; if (this.options.timer) { this.esqueleto.clock.bar.stop(true); var a = 100 - (parseint(this.esqueleto.clock.bar.css("width"), 10) * 100 / this.options.width); this.resto = this.options.delay * a / 100 } this.events.paused = true; if (this.options.control && !this.events.hovered) { this.esqueleto.control.removeclass(this.options.name + '-control-pause'); this.esqueleto.control.addclass(this.options.name + '-control-play') } this.element.trigger("sliderpause") }, stoptimer: function () { clearinterval(this.timer); this.timer = ""; if (this.options.timer) { this.esqueleto.clock.bar.stop(); this.resto = 0; if (this.esqueleto.clock.command == "#000000") { this.esqueleto.clock.bar.css({ "width": 0 }) } else if (this.esqueleto.clock.command == "#ffffff") { this.esqueleto.clock.rotator.removeclass(this.options.name + '-timer-rotator-move'); this.esqueleto.clock.mask.removeclass(this.options.name + '-timer-mask-move'); this.degrees = 0; var a = "rotate(" + this.degrees + "deg)"; this.esqueleto.clock.rotator.css({ "-webkit-transform": a, "-moz-transform": a, "-o-transform": a, "transform": a }); if (jquery.browser.msie) { this.esqueleto.clock.rotator.get(0).style['mstransform'] = a } } } this.events.paused = true; this.events.stopped = true; this.events.hovered = false; if (this.options.control) { this.esqueleto.control.removeclass(this.options.name + '-control-pause'); this.esqueleto.control.addclass(this.options.name + '-control-play') } this.element.trigger("sliderstop") }, shuffle: function (a) { for (var j, x, i = a.length; i; j = parseint(math.random() * i, 10), x = a[--i], a[i] = a[j], a[j] = x) {} return a }, rgbtohex: function (b) { if (b.match(/^#[0-9a-fa-f]{6}$/)) { return b.touppercase() } var c = /rgb\((.+),(.+),(.+)\)/i.exec(b); if (!c) { return b.touppercase() } var d = parseint(c[1]); var e = parseint(c[2]); var f = parseint(c[3]); var g = function (a) { return ((a.length < 2 ? '0' : '') + a).touppercase() }; return ('#' + g(d.tostring(16)) + g(e.tostring(16)) + g(f.tostring(16))).touppercase() }, callslide: function (a) { if (this.events.playing) { return false } var b = this.element.children("." + this.options.name + '-slide-current'); var c = this.esqueleto.selector.children("." + this.options.name + '-selector-current'); if (a == "+1") { var d = b.next("." + this.options.name + '-slide'); var e = c.next(); if (d.length <= 0) { if (this.options.loop) { d = this.element.children("." + this.options.name + '-slide').first(); e = this.selectores.first("a") } else { this.stoptimer(); return false } } } else if (a == "-1") { var d = b.prev("." + this.options.name + '-slide'); var e = c.prev("a"); if (d.length <= 0) { d = this.element.children("." + this.options.name + '-slide').last(); e = this.selectores.last("a") } } else { var d = this.element.children("." + this.options.name + '-slide-' + a); var e = this.esqueleto.selector.children("." + this.options.name + '-selector[rel=' + a + ']') } this.transition(b, c, d, e); this.element.trigger("sliderchange", d) }, transition: function (a, b, c, d) { if ($.isarray(this.options.transition)) { this.transitions = this.options.transition; this.options.transition = "random" } var e = c.attr('class').split(" ")[0].split(this.options.name + "-trans-")[1]; if (e === undefined) { e = this.options.transition } if (e == "random") { var f = ''; while (f == this.lasttransition || f == '') { f = this.shuffle(this.transitions)[0].tolowercase() } e = f } e = e.tolowercase(); this.lasttransition = e; this["trans" + e](a, b, c, d) }, transfade: function (a, b, c, d) { this.events.playing = true; c.css({ "opacity": 1 }).addclass(this.options.name + '-slide-next'); b.removeclass(this.options.name + '-selector-current'); d.addclass(this.options.name + '-selector-current'); a.stop().animate({ "opacity": 0 }, this.options.duration, $.proxy(function () { a.removeclass(this.options.name + '-slide-current'); c.addclass(this.options.name + '-slide-current'); c.removeclass(this.options.name + '-slide-next'); this.element.trigger("slidertransitionfinishes", c); this.events.playing = false }, this)) }, transbar: function (b, d, e, f, g) { g = $.extend(true, { 'direction': 'left' }, g); this.events.playing = true; var h = { 'width': math.round(this.options.width / this.options.bars), 'height': this.options.height }; bar_array = new array(this.options.bars); if (g['direction'] == "right") { c = 0; for (i = this.options.bars; i > 0; i--) { bar_array[c] = i; c++ } } else if (g['direction'] == "left") { for (i = 1; i <= this.options.bars; i++) { bar_array[i] = i } } else if (g['direction'] == "fountain" || g['direction'] == "rain") { var j = 1; var k = parseint(this.options.bars / 2); for (i = 1; i <= this.options.bars; i++) { bar_array[i - 1] = (k - (parseint((i) / 2) * j)) + 1; j *= -1 } } $.each(bar_array, $.proxy(function (i, a) { position = (a * h.width) - h.width; bar = $(''); bar.css({ 'position': 'absolute', 'overflow': 'hidden', 'left': position, 'z-index': 3, 'opacity': 0, 'background-position': '-' + position + 'px top' }).css(h); if (g['direction'] == "fountain") { bar.css({ 'top': this.options.height }) } else if (g['direction'] == "rain") { bar.css({ 'top': -this.options.height }) } bar.append('