1/* 2Supersized - Fullscreen Slideshow jQuery Plugin 3By Sam Dunn (www.buildinternet.com // www.onemightyroar.com) 4Version: supersized.2.0.js // Relase Date: 5/7/09 5Website: www.buildinternet.com/project/supersized 6Thanks to Aen for preloading, fade effect, & vertical centering 7*/ 8 9//Slideshow Next Slide 10function nextslide() { 11 if ($.inAnimation) return false; 12 else $.inAnimation = true; 13 var options = $.extend($.fn.supersized.defaults, $.fn.supersized.options); 14 var currentslide = $('#supersize .activeslide'); 15 currentslide.removeClass('activeslide'); 16 17 if (currentslide.length == 0) currentslide = $('#supersize a:last'); 18 19 var nextslide = currentslide.next().length ? currentslide.next() : $('#supersize a:first'); 20 var prevslide = nextslide.prev().length ? nextslide.prev() : $('#supersize a:last'); 21 22 23 //Display slide counter 24 if (options.slide_counter == 1) { 25 var slidecount = $('#slidecounter .slidenumber').html(); 26 currentslide.next().length ? slidecount++ : slidecount = 1; 27 $('#slidecounter .slidenumber').html(slidecount); 28 } 29 30 $('.prevslide').removeClass('prevslide'); 31 prevslide.addClass('prevslide'); 32 33 //Captions require img in <a> 34 if (options.slide_captions == 1) $('#slidecaption').html($(nextslide).find('img').attr('title')); 35 36 nextslide.hide().addClass('activeslide') 37 if (options.transition == 0) { 38 nextslide.show(); $.inAnimation = false; 39 } 40 if (options.transition == 1) { 41 nextslide.fadeIn(750, function () { $.inAnimation = false; }); 42 } 43 if (options.transition == 2) { 44 nextslide.show("slide", { direction: "up" }, 'slow', function () { $.inAnimation = false; }); 45 } 46 if (options.transition == 3) { 47 nextslide.show("slide", { direction: "right" }, 'slow', function () { $.inAnimation = false; }); 48 } 49 if (options.transition == 4) { 50 nextslide.show("slide", { direction: "down" }, 'slow', function () { $.inAnimation = false; }); 51 } 52 if (options.transition == 5) { 53 nextslide.show("slide", { direction: "left" }, 'slow', function () { $.inAnimation = false; }); 54 } 55 56 $('#supersize').resizenow();//Fix for resize mid-transition 57 58} 59 60//Slideshow Previous Slide 61function prevslide() { 62 if ($.inAnimation) return false; 63 else $.inAnimation = true; 64 var options = $.extend($.fn.supersized.defaults, $.fn.supersized.options); 65 var currentslide = $('#supersize .activeslide'); 66 currentslide.removeClass('activeslide'); 67 68 if (currentslide.length == 0) currentslide = $('#supersize a:first'); 69 70 var nextslide = currentslide.prev().length ? currentslide.prev() : $('#supersize a:last'); 71 var prevslide = nextslide.next().length ? nextslide.next() : $('#supersize a:first'); 72 73 //Display slide counter 74 if (options.slide_counter == 1) { 75 var slidecount = $('#slidecounter .slidenumber').html(); 76 currentslide.prev().length ? slidecount-- : slidecount = $("#supersize > *").size(); 77 $('#slidecounter .slidenumber').html(slidecount); 78 } 79 80 $('.prevslide').removeClass('prevslide'); 81 prevslide.addClass('prevslide'); 82 83 //Captions require img in <a> 84 if (options.slide_captions == 1) $('#slidecaption').html($(nextslide).find('img').attr('title')); 85 86 nextslide.hide().addClass('activeslide') 87 if (options.transition == 0) { 88 nextslide.show(); $.inAnimation = false; 89 } 90 if (options.transition == 1) { 91 nextslide.fadeIn(750, function () { $.inAnimation = false; }); 92 } 93 if (options.transition == 2) { 94 nextslide.show("slide", { direction: "down" }, 'slow', function () { $.inAnimation = false; }); 95 } 96 if (options.transition == 3) { 97 nextslide.show("slide", { direction: "left" }, 'slow', function () { $.inAnimation = false; }); 98 } 99 if (options.transition == 4) { 100 nextslide.show("slide", { direction: "up" }, 'slow', function () { $.inAnimation = false; }); 101 } 102 if (options.transition == 5) { 103 nextslide.show("slide", { direction: "right" }, 'slow', function () { $.inAnimation = false; }); 104 } 105 106 $('#supersize').resizenow();//Fix for resize mid-transition 107} 108 109var slideFlashTimeout = function () { }; 110slideFlashTimeout.interval = undefined; 111slideFlashTimeout.timeout = 6000; 112slideFlashTimeout.play = function () { 113 slideFlashTimeout.stop(); 114 slideFlashTimeout.interval = setTimeout(slideFlashTimeout.next, slideFlashTimeout.timeout); 115};
116slideFlashTimeout.next = function () { 117 slideFlashTimeout.stop(); 118 nextslide(); 119 slideFlashTimeout.play(); 120}; 121slideFlashTimeout.prev = function () { 122 slideFlashTimeout.stop(); 123 prevslide(); 124 slideFlashTimeout.play(); 125}; 126slideFlashTimeout.stop = function () { 127 if (slideFlashTimeout.interval != undefined && slideFlashTimeout.interval != null) { 128 clearTimeout(slideFlashTimeout.interval); 129 slideFlashTimeout.interval = null; 130 } 131}; 132 133(function ($) { 134 135 //Resize image on ready or resize 136 $.fn.supersized = function () { 137 $.inAnimation = false; 138 $.paused = false; 139 var options = $.extend($.fn.supersized.defaults, $.fn.supersized.options); 140 var slideshow_interval = undefined; 141 142 //$('#loading').hide(); 143 $('#supersize').fadeIn('fast'); 144 $('#content').show(); 145 if ($('#slideshow .activeslide').length == 0) $('#supersize a:first').addClass('activeslide'); 146 if (options.slide_captions == 1) $('#slidecaption').html($('#supersize .activeslide').find('img').attr('title')); 147 if (options.navigation == 0) $('#navigation').hide(); 148 //Slideshow 149 if (options.slideshow == 1) { 150 if (options.slide_counter == 1) { //Initiate slide counter if active 151 $('#slidecounter .slidenumber').html(1); 152 $('#slidecounter .totalslides').html($("#supersize > *").size()); 153 } 154 155 slideFlashTimeout.timeout = options.slide_interval; 156 slideFlashTimeout.play();
157 if (options.navigation == 1) { //Skip if no navigation 158 $('#navigation a').click(function () { 159 $(this).blur(); 160 return false; 161 }); 162 //Slide Navigation 163 $('#nextslide').click(function () { 164 if ($.paused) return false; if ($.inAnimation) return false; 165 slideFlashTimeout.next(); 166 return false; 167 }); 168 $('#prevslide').click(function () { 169 if ($.paused) return false; if ($.inAnimation) return false; 170 slideFlashTimeout.prev(); 171 return false; 172 }); 173 $('#nextslide img').hover(function () { 174 if ($.paused == true) return false; 175 $(this).attr("src", "images/all/forward.png"); 176 }, function () { 177 if ($.paused == true) return false; 178 $(this).attr("src", "images/all/forward_dull.png"); 179 }); 180 $('#prevslide img').hover(function () { 181 if ($.paused == true) return false; 182 $(this).attr("src", "images/all/back.png"); 183 }, function () { 184 if ($.paused == true) return false; 185 $(this).attr("src", "images/all/back_dull.png"); 186 }); 187 188 //Play/Pause Button 189 $('#pauseplay').click(function () { 190 if ($.inAnimation) return false; 191 var src = ($(this).find('img').attr("src") === "images/play.png") ? "images/pause.png" : "images/play.png"; 192 if (src == "images/pause.png") { 193 $(this).find('img').attr("src", "images/play.png"); 194 $.paused = false; 195 slideFlashTimeout.play(); 196 } else { 197 $(this).find('img').attr("src", "images/pause.png"); 198 slideFlashTimeout.stop(); 199 $.paused = true; 200 } 201 $(this).find('img').attr("src", src); 202 return false; 203 }); 204 $('#pauseplay').mouseover(function () { 205 var imagecheck = ($(this).find('img').attr("src") === "images/play_dull.png"); 206 if (imagecheck) { 207 $(this).find('img').attr("src", "images/play.png"); 208 } else { 209 $(this).find('img').attr("src", "images/pause.png"); 210 } 211 }); 212 213 $('#pauseplay').mouseout(function () { 214 var imagecheck = ($(this).find('img').attr("src") === "images/play.png"); 215 if (imagecheck) { 216 $(this).find('img').attr("src", "images/play_dull.png"); 217 } else { 218 $(this).find('img').attr("src", "images/pause_dull.png"); 219 } 220 return false; 221 }); 222 } 223 } 224 225 226 $(document).ready(function () { 227 $('#supersize').resizenow(); 228 }); 229 230 //Pause when hover on image 231 $('#supersize > *').hover(function () { 232 if (options.slideshow == 1 && options.pause_hover == 1) { 233 if (!($.paused) && options.navigation == 1) { 234 $('#pauseplay > img').attr("src", "images/pause.png"); 235 slideFlashTimeout.stop(); 236 } 237 } 238 original_title = $(this).find('img').attr("title"); 239 if ($.inAnimation) return false; else $(this).find('img').attr("title", ""); 240 }, function () { 241 if (options.slideshow == 1 && options.pause_hover == 1) { 242 if (!($.paused) && options.navigation == 1) { 243 $('#pauseplay > img').attr("src", "images/pause_dull.png"); 244 slideFlashTimeout.play(); 245 } 246 } 247 $(this).find('img').attr("title", original_title); 248 }); 249 250 $(window).bind("resize", function () { 251 $('#supersize').resizenow(); 252 }); 253 254 //$('#supersize').hide(); 255 $('#content').hide(); 256 }; 257 258 //Adjust image size 259 $.fn.resizenow = function () { 260 var options = $.extend($.fn.supersized.defaults, $.fn.supersized.options); 261 return this.each(function () { 262 263 //Define image ratio 264 var ratio = options.startheight / options.startwidth; 265 266 //Gather browser and current image size 267 var imagewidth = $(this).width(); 268 var imageheight = $(this).height(); 269 var browserwidth = $(window).width(); 270 var browserheight = $(window).height(); 271 var offset; 272 273 //Resize image to proper ratio 274 if ((browserheight / browserwidth) > ratio) { 275 $(this).height(browserheight); 276 $(this).width(browserheight / ratio); 277 $(this).children().height(browserheight); 278 $(this).children().width(browserheight / ratio); 279 } else { 280 $(this).width(browserwidth); 281 $(this).height(browserwidth * ratio); 282 $(this).children().width(browserwidth); 283 $(this).children().height(browserwidth * ratio); 284 } 285 if (options.vertical_center == 1) { 286 $(this).children().css('left', (browserwidth - $(this).width()) / 2); 287 $(this).children().css('top', (browserheight - $(this).height()) / 2); 288 } 289 return false; 290 }); 291 }; 292 293 $.fn.supersized.defaults = { 294 startwidth: 4, 295 startheight: 3, 296 vertical_center: 1, 297 slideshow: 1, 298 navigation: 1, 299 transition: 1, //0-None, 1-Fade, 2-slide top, 3-slide right, 4-slide bottom, 5-slide left 300 pause_hover: 0, 301 slide_counter: 1, 302 slide_captions: 1, 303 slide_interval: 5000 304 }; 305 306})(jQuery);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.