function simpleSlide(e) { jQuery(function($) { var b = { 'status_width': 20, 'status_color_inside': '#fff', 'status_color_outside': '#aaa', 'set_speed': 500, 'fullscreen': 'false', 'swipe': 'false', 'callback': 'function()' }; $.extend(b, e); $.ss_options = b; $('.simpleSlide-slide').css({ 'opacity': '0' }); $('.simpleSlide-window').prepend('<span id="ssLoading" style="color: #808080;font-family:Helvetica, Arial, sans-serif;font-size: 12px; margin: 10px 0 0 10px;display: block">Loading slides...</span>'); var c = $('.simpleSlide-slide img').size(); if (c > 0) { var d = new Array(); var i = 0; $('.simpleSlide-slide img').each(function() { d[i] = $(this).attr('src'); i++ }); i = 0; $(d).each(function() { var a = new Image(); a.src = d[i]; if ((a).complete) { c--; i++; if (c == 0) { ssInit() } } else { $(a).load(function() { c--; i++; if (c == 0) { ssInit() } }) } }) } else { ssInit() } }) }; function ssInit() { jQuery(function($) { $('.simpleSlide-window').each(function() { if ($.ss_options.fullscreen == 'true') { $('body').css('overflow', 'hidden') } var a = $(this).html(); var b = removeWhiteSpace(a); $(this).html(b); var c = $(this).find('.simpleSlide-slide').size(); $(this).find('.simpleSlide-slide').css('display', 'block'); var d = $(this).find('.simpleSlide-slide').first().outerHeight(); if ($.ss_options.fullscreen == 'true') { fullScreen(this) }; $(this).find('.simpleSlide-slide').css({ 'display': 'inline', 'float': 'left' }); var e = $(this).find('.simpleSlide-slide').first().outerWidth(); var f = $(this).attr('rel'); if ($.ss_options.fullscreen == 'false') { $(this).css({ 'height': d, 'width': e, 'position': 'relative', 'margin-left': 0 }) }; $(this).css('overflow', 'hidden'); setTraySize(this, c, e); setSimpleSlideStatus(f, d, e, c); setPaging(this); $(this).find('#ssLoading').remove(); if ($.ss_options.swipe = 'true' && !$.browser.msie) { simpleSwipe(this) }; $(this).find('.simpleSlide-slide').animate({ 'opacity': '1' }, 300, "swing") }); if (typeof ($.ss_options.callback) == 'function') { $.ss_options.callback.call(this) }; function setPaging(a) { var b = 1; $(a).find('.simpleSlide-slide').each(function() { $(this).attr('alt', b); b++ }) }; function fullScreen(a) { var b = new Image(); b.src = $(a).find('img').first().attr('src'); var c = $(window).width() / $(window).height(); var d = b.width / b.height; var e = $(window).height(); var f = $(window).width(); if (c > d) { var g = (f / b.width) * b.height; var h = (g - e) / 2; $(a).find('img').attr('width', f).attr('height', g).css('marginLeft', 0); $(a).css({ 'marginLeft': 0, 'marginTop': '-' + h + 'px', 'height': e + h }); $(a).find('.simpleSlide-slide').css({ 'width': f, 'height': g, 'overflow': 'hidden' }) } else { var i = (e / b.height) * b.width; var j = (i - f) / 2; $(a).find('img').attr('height', e).attr('width', i); $(a).find('img').css({ 'marginLeft': '-' + j + 'px' }); $(a).find('.simpleSlide-slide').css({ 'width': f, 'height': e, 'overflow': 'hidden' }); $(a).css({ 'marginTop': 0, 'height': e }) }; $(a).find('.simpleSlide-tray').css('marginLeft', 0) }; function setTraySize(a, b, c) { var d = b * c; $(a).find('.simpleSlide-tray').css({ 'width': d + 'px' }); $(a).find('.simpleSlide-slide').css('display', 'inline-block') }; function setSimpleSlideStatus(a, b, c, d) { var e = $.ss_options.status_width / c; var f = e * b; $('.simpleSlideStatus-tray[rel="' + a + '"]').css({ 'width': $.ss_options.status_width * d, 'height': f, 'background-color': $.ss_options.status_color_outside }); $('.simpleSlideStatus-window[rel="' + a + '"]').css({ 'width': $.ss_options.status_width, 'height': f, 'background-color': $.ss_options.status_color_inside }); if (jQuery.support.opacity) { $('.simpleSlideStatus-window .simpleSlideStatus-tray[rel="' + a + '"]').css({ 'opacity': '.5', 'background-color': $.ss_options.status_color_inside }) }; if (!jQuery.support.opacity) { $('.simpleSlideStatus-window .simpleSlideStatus-tray[rel="' + a + '"]').css({ 'filter': 'alpha(opacity=50)', 'background-color': $.ss_options.status_color_inside }) } }; $('.left-button, .right-button, .jump-to').live('click', function() { var a = $(this).attr('rel'); if (!$('div.simpleSlide-tray[rel="' + a + '"]').is(':animated')) { simpleSlideAction(this, a) } }) }) }; function simpleSwipe(f) { var g = { threshold: { x: $(f).width() * .15, y: $(f).height() * .1 }, swipeLeft: function() { simpleSlideAction('.right-button', $(f).attr('rel')) }, swipeRight: function() { simpleSlideAction('.left-button', $(f).attr('rel')) }, preventDefaultEvents: true }; var h = $.extend(g, h); if (!f) return false; return $(f).each(function() { var c = $(f); var d = { x: 0, y: 0 }; var e = { x: 0, y: 0 }; function touchStart(a) { d.x = a.targetTouches[0].pageX; d.y = a.targetTouches[0].pageY }; function touchMove(a) { if (g.preventDefaultEvents) { a.preventDefault() }; e.x = a.targetTouches[0].pageX; e.y = a.targetTouches[0].pageY }; function touchEnd(a) { var b = d.y - e.y; if (b < g.threshold.y && b > (g.threshold.y * -1)) { changeX = d.x - e.x; if (changeX > g.threshold.x) { g.swipeLeft() }; if (changeX < (g.threshold.x * -1)) { g.swipeRight() } } }; function touchCancel(a) { console.log('Canceling swipe gesture...') }; f.addEventListener("touchstart", touchStart, false); f.addEventListener("touchmove", touchMove, false); f.addEventListener("touchend", touchEnd, false); f.addEventListener("touchcancel", touchCancel, false) }) }; function simpleSlideAction(p, q) { jQuery(function($) { var d = $.ss_options.set_speed; var e = $('.simpleSlide-window[rel="' + q + '"]').find('.simpleSlide-slide').size(); var f = $('.simpleSlide-window[rel="' + q + '"]').innerWidth(); var g = $('.simpleSlideStatus-window[rel="' + q + '"]').innerWidth(); var h = g * e; var i = parseInt($('.simpleSlide-tray[rel="' + q + '"]').css('margin-left'), 10); var j = parseInt($('.simpleSlideStatus-tray .simpleSlideStatus-window[rel="' + q + '"]').css('margin-left'), 10); var k = parseInt($('.simpleSlideStatus-window .simpleSlideStatus-tray[rel="' + q + '"]').css('margin-left'), 10); if ($(p).is('.jump-to')) { var l = $(p).attr('alt'); var m = (l - 1) * (f * (-1)); var n = (l - 1) * (g * (-1)); var o = (l - 1) * (g); move(m, o, n) }; if ($(p).is('.left-button')) { if (i == 0) { var m = i - ((e - 1) * f); var n = k - ((e - 1) * g); var o = j + ((e - 1) * g) } else { var m = i + f; var n = k + g; var o = j - g }; move(m, o, n) }; if ($(p).is('.right-button')) { if (i == (e - 1) * (f * -1)) { var m = 0; var n = 0; var o = 0 } else { var m = i - f; var n = k - g; var o = j + g }; move(m, o, n) }; function move(a, b, c) { $('.simpleSlide-tray[rel="' + q + '"]').animate({ 'marginLeft': a }, d, "swing"); $('.simpleSlideStatus-window .simpleSlideStatus-tray[rel="' + q + '"]').animate({ 'marginLeft': c }, d, "swing"); $('.simpleSlideStatus-tray .simpleSlideStatus-window[rel="' + q + '"]').animate({ 'marginLeft': b }, d, "swing") } }) }; function removeWhiteSpace(a) { var b = a.replace(/[\r+\n+\t+]\s\s+/g, ""); return b };
