/* * Sudo Slider ver 2.0.11 - jQuery plugin * Written by Erik Kristensen info@webbies.dk. * Based on Easy Slider 1.7 by Alen Grakalic http://cssglobe.com/post/5780/easy-slider-17-numeric-navigation-jquery-slider * Although the two scripts doesn't share much code anymore. But Sudo Slider is still based on it. * * Dual licensed under the MIT * and GPL licenses. * * Built for jQuery library * http://jquery.com * */ (function($) { $.fn.sudoSlider = function(options) { // Saves space in the minified version. // It might look complicated, but it isn't. It's easy to make using "replace all" and it saves about ˝kb in the minified version. var truev = true; var falsev = !truev; // default configuration properties var defaults = { prevNext: truev, prevHtml: ' ', nextHtml: ' ', controlsShow: truev, controlsAttr: 'id="controls"', controlsFadeSpeed: '400', controlsFade: truev, insertAfter: truev, firstShow: falsev, firstHtml: ' first ', lastShow: falsev, lastHtml: ' last ', numericAttr: 'class="controls"', numericText: ['1'], vertical: falsev, speed: '800', ease: 'swing', auto: falsev, pause: '2000', continuous: falsev, clickableAni: falsev, numeric: falsev, updateBefore: falsev, history: falsev, speedhistory: '400', autoheight: truev, customLink: falsev, fade: falsev, crossFade: truev, fadespeed: '1000', ajax: falsev, loadingText: 'Loading Content...', preloadAjax: falsev, startSlide: falsev, ajaxLoadFunction: falsev, beforeAniFunc: falsev, afterAniFunc: falsev, uncurrentFunc: falsev, currentFunc: falsev, autowidth: truev, slideCount: 1, resumePause: falsev }; var options = $.extend(defaults, options); // To make it smaller. // There is a way to make it even smaller, but that doesn't work with the public functions setOption() and getOption(). var option = [ options.controlsShow, /* option[0]/*controlsShow*/ options.controlsFadeSpeed,/* option[1]/*controlsFadeSpeed*/ options.controlsFade,/* option[2]/*controlsFade*/ options.insertAfter,/* option[3]/*insertAfter*/ options.firstShow,/* option[4]/*firstShow*/ options.lastShow,/* option[5]/*lastShow*/ options.vertical,/* option[6]/*vertical*/ options.speed,/* option[7]/*speed*/ options.ease,/* option[8]/*ease*/ options.auto,/* option[9]/*auto*/ options.pause,/* option[10]/*pause*/ options.continuous,/* option[11]/*continuous*/ options.prevNext,/* option[12]/*prevNext*/ options.numeric,/* option[13]/*numeric*/ options.numericAttr,/* option[14]/*numericAttr*/ options.numericText,/* option[15]/*numericText*/ options.clickableAni,/* option[16]/*clickableAni*/ options.history,/* option[17]/*history*/ options.speedhistory,/* option[18]/*speedhistory*/ options.autoheight,/* option[19]/*autoheight*/ options.customLink,/* option[20]/*customLink*/ options.fade,/* option[21]/*fade*/ options.crossFade,/* option[22]/*crossFade*/ options.fadespeed,/* option[23]/*fadespeed*/ options.updateBefore,/* option[24]/*updateBefore*/ options.ajax,/* option[25]/*ajax*/ options.preloadAjax,/* option[26]/*preloadAjax*/ options.startSlide,/* option[27]/*startSlide*/ options.ajaxLoadFunction,/* option[28]/*ajaxLoadFunction*/ options.beforeAniFunc,/* option[29]/*beforeAniFunc*/ options.afterAniFunc,/* option[30]/*afterAniFunc*/ options.uncurrentFunc,/* option[31]/*uncurrentFunc*/ options.currentFunc,/* option[32]/*currentFunc*/ options.prevHtml,/* option[33]/*prevHtml*/ options.nextHtml,/* option[34]/*nextHtml*/ options.loadingText,/* option[35]/*loadingText*/ options.firstHtml,/* option[36]/*firstHtml*/ options.controlsAttr,/* option[37]/*controlsAttr*/ options.lastHtml,/* option[38]/*lastHtml*/ options.autowidth,/* option[39]/*autowidth*/ options.slideCount,/* option[40]/*slideCount*/ options.resumePause/* option[41]/*resumePause*/ ]; // Defining the base element. // This is needed if i want to have public functions (And i want public functions). var baseSlider = this; return this.each(function() { /* * Lets start this baby. */ // First we declare a lot of variables. // Some of the names may be long, but they get minified. var init, ul, li, liConti, s, w, h, t, ot, nt, ts, clickable, buttonclicked, fading, ajaxloading, autoheightdocument, numericControls, numericContainer, destroyed, fontsmoothing, controls, html, firstbutton, lastbutton, nextbutton, prevbutton, timeout, destroyT, oldSpeed, dontCountinue, dontCountinueInit, obj = $(this); initSudoSlider(obj, falsev, falsev); function initSudoSlider(obj, destroyT, ajaxcallback) { //if (option[6]/*vertical*/) option[19]/*autoheight*/ = falsev; // With the new system of determining the position of the slides, this line is no longer needed. destroyed = falsev; // In case this isn't the first init. // There are some things we don't do at init. init = truev; // I know it's an ugly workaround, but it works. // If auto is on, so is continuous. (People tend to forget things they don't think about :p) if (option[9]/*auto*/) option[11]/*continuous*/ = truev; // Fix for nested list items ul = obj.children("ul"); li = ul.children("li"); liConti = li; // Some variables i'm gonna use alot. s = li.length; // The below two lines shouldn't be necessary anymore. //w = li.eq(0).outerWidth(truev); // All slides must be same width, so this shouldn't be a problem. And it makes it posibble to mave multiple slides pr. "page" (2 slides in the viewport). //h = li.eq(0).outerHeight(truev); // Same, just the height. // Now we are going to fix the document, if it's 'broken'. (No