1/* 2 3 Supersized - Fullscreen Slideshow jQuery Plugin 4 Version : 3.2.7 5 Theme : Shutter 1.1 6 7 Site : www.buildinternet.com/project/supersized 8 Author : Sam Dunn 9 Company : One Mighty Roar (www.onemightyroar.com) 10 License : MIT License / GPL License 11 12*/ 13 14(function($){ 15 16 theme = { 17 18 19 /* Initial Placement 20 ----------------------------*/ 21 _init : function(){ 22 23 // Center Slide Links 24 if (api.options.slide_links) $(vars.slide_list).css('margin-left', -$(vars.slide_list).width()/2); 25 26 // Start progressbar if autoplay enabled 27 if (api.options.autoplay){ 28 if (api.options.progress_bar) theme.progressBar(); 29 }else{ 30 if ($(vars.play_button).attr('src')) $(vars.play_button).attr("src", vars.image_path + "play.png"); // If pause play button is image, swap src 31 if (api.options.progress_bar) $(vars.progress_bar).stop().css({left : -$(window).width()}); // Place progress bar 32 } 33 34 35 /* Thumbnail Tray 36 ----------------------------*/ 37 // Hide tray off screen 38 $(vars.thumb_tray).css({bottom : -$(vars.thumb_tray).height()}); 39 40 // Thumbnail Tray Toggle 41 $(vars.tray_button).toggle(function(){ 42 $(vars.thumb_tray).stop().animate({bottom : 0, avoidTransforms : true}, 300 ); 43 if ($(vars.tray_arrow).attr('src')) $(vars.tray_arrow).attr("src", vars.image_path + "button-tray-down.png"); 44 return false; 45 }, function() { 46 $(vars.thumb_tray).stop().animate({bottom : -$(vars.thumb_tray).height(), avoidTransforms : true}, 300 ); 47 if ($(vars.tray_arrow).attr('src')) $(vars.tray_arrow).attr("src", vars.image_path + "button-tray-up.png"); 48 return false; 49 }); 50 51 // Make thumb tray proper size 52 $(vars.thumb_list).width($('> li', vars.thumb_list).length * $('> li', vars.thumb_list).outerWidth(true)); //Adjust to true width of thumb markers 53 54 // Display total slides 55 if ($(vars.slide_total).length){ 56 $(vars.slide_total).html(api.options.slides.length); 57 } 58 59 60 /* Thumbnail Tray Navigation 61 ----------------------------*/ 62 if (api.options.thumb_links){ 63 //Hide thumb arrows if not needed 64 if ($(vars.thumb_list).width() <= $(vars.thumb_tray).width()){ 65 $(vars.thumb_back +','+vars.thumb_forward).fadeOut(0); 66 } 67 68 // Thumb Intervals 69 vars.thumb_interval = Math.floor($(vars.thumb_tray).width() / $('> li', vars.thumb_list).outerWidth(true)) * $('> li', vars.thumb_list).outerWidth(true); 70 vars.thumb_page = 0; 71 72 // Cycle thumbs forward 73 $(vars.thumb_forward).click(function(){ 74 if (vars.thumb_page - vars.thumb_interval <= -$(vars.thumb_list).width()){ 75 vars.thumb_page = 0; 76 $(vars.thumb_list).stop().animate({'left': vars.thumb_page}, {duration:500, easing:'easeOutExpo'}); 77 }else{ 78 vars.thumb_page = vars.thumb_page - vars.thumb_interval; 79 $(vars.thumb_list).stop().animate({'left': vars.thumb_page}, {duration:500, easing:'easeOutExpo'}); 80 } 81 }); 82 83 // Cycle thumbs backwards 84 $(vars.thumb_back).click(function(){ 85 if (vars.thumb_page + vars.thumb_interval > 0){ 86 vars.thumb_page = Math.floor($(vars.thumb_list).width() / vars.thumb_interval) * -vars.thumb_interval; 87 if ($(vars.thumb_list).width() <= -vars.thumb_page) vars.thumb_page = vars.thumb_page + vars.thumb_interval; 88 $(vars.thumb_list).stop().animate({'left': vars.thumb_page}, {duration:500, easing:'easeOutExpo'}); 89 }else{ 90 vars.thumb_page = vars.thumb_page + vars.thumb_interval; 91 $(vars.thumb_list).stop().animate({'left': vars.thumb_page}, {duration:500, easing:'easeOutExpo'}); 92 } 93 }); 94 95 } 96 97 98 /* Navigation Items 99 ----------------------------*/ 100 $(vars.next_slide).click(function() { 101 api.nextSlide(); 102 }); 103 104 $(vars.prev_slide).click(function() { 105 api.prevSlide(); 106 }); 107 108 // Full Opacity on Hover 109 if(jQuery.support.opacity){ 110 $(vars.prev_slide +','+vars.next_slide).mouseover(function() { 111 $(this).stop().animate({opacity:1},100); 112 }).mouseout(function(){ 113 $(this).stop().animate({opacity:0.6},100); 114 }); 115 } 116 117 if (api.options.thumbnail_navigation){ 118 // Next thumbnail clicked 119 $(vars.next_thumb).click(function() { 120 api.nextSlide(); 121 }); 122 // Previous thumbnail clicked 123 $(vars.prev_thumb).click(function() { 124 api.prevSlide(); 125 }); 126 } 127 128 $(vars.play_button).click(function() {
129 api.playToggle(); 130 }); 131 132 133 /* Thumbnail Mouse Scrub 134 ----------------------------*/ 135 if (api.options.mouse_scrub){ 136 $(vars.thumb_tray).mousemove(function(e) { 137 var containerWidth = $(vars.thumb_tray).width(), 138 listWidth = $(vars.thumb_list).width(); 139 if (listWidth > containerWidth){ 140 var mousePos = 1, 141 diff = e.pageX - mousePos; 142 if (diff > 10 || diff < -10) { 143 mousePos = e.pageX; 144 newX = (containerWidth - listWidth) * (e.pageX/containerWidth); 145 diff = parseInt(Math.abs(parseInt($(vars.thumb_list).css('left'))-newX )).toFixed(0); 146 $(vars.thumb_list).stop().animate({'left':newX}, {duration:diff*3, easing:'easeOutExpo'}); 147 } 148 } 149 }); 150 } 151 152 153 /* Window Resize 154 ----------------------------*/ 155 $(window).resize(function(){ 156 157 // Delay progress bar on resize 158 if (api.options.progress_bar && !vars.in_animation){ 159 if (vars.slideshow_interval) clearInterval(vars.slideshow_interval); 160 if (api.options.slides.length - 1 > 0) clearInterval(vars.slideshow_interval); 161 162 $(vars.progress_bar).stop().css({left : -$(window).width()}); 163 164 if (!vars.progressDelay && api.options.slideshow){ 165 // Delay slideshow from resuming so Chrome can refocus images 166 vars.progressDelay = setTimeout(function() { 167 if (!vars.is_paused){ 168 theme.progressBar(); 169 vars.slideshow_interval = setInterval(api.nextSlide, api.options.slide_interval); 170 } 171 vars.progressDelay = false; 172 }, 1000); 173 } 174 } 175 176 // Thumb Links 177 if (api.options.thumb_links && vars.thumb_tray.length){ 178 // Update Thumb Interval & Page 179 vars.thumb_page = 0;
180 vars.thumb_interval = Math.floor($(vars.thumb_tray).width() / $('> li', vars.thumb_list).outerWidth(true)) * $('> li', vars.thumb_list).outerWidth(true); 181 182 // Adjust thumbnail markers 183 if ($(vars.thumb_list).width() > $(vars.thumb_tray).width()){ 184 $(vars.thumb_back +','+vars.thumb_forward).fadeIn('fast'); 185 $(vars.thumb_list).stop().animate({'left':0}, 200); 186 }else{ 187 $(vars.thumb_back +','+vars.thumb_forward).fadeOut('fast'); 188 } 189 190 } 191 }); 192 193 194 }, 195 196 197 /* Go To Slide 198 ----------------------------*/ 199 goTo : function(){ 200 if (api.options.progress_bar && !vars.is_paused){ 201 $(vars.progress_bar).stop().css({left : -$(window).width()}); 202 theme.progressBar(); 203 } 204 }, 205 206 /* Play & Pause Toggle 207 ----------------------------*/ 208 playToggle : function(state){ 209 210 if (state =='play'){ 211 // If image, swap to pause 212 if ($(vars.play_button).attr('src')) $(vars.play_button).attr("src", vars.image_path + "pause.png"); 213 if (api.options.progress_bar && !vars.is_paused) theme.progressBar(); 214 }else if (state == 'pause'){ 215 // If image, swap to play 216 if ($(vars.play_button).attr('src')) $(vars.play_button).attr("src", vars.image_path + "play.png"); 217 if (api.options.progress_bar && vars.is_paused)$(vars.progress_bar).stop().css({left : -$(window).width()}); 218 } 219 220 }, 221 222 223 /* Before Slide Transition 224 ----------------------------*/ 225 beforeAnimation : function(direction){ 226 if (api.options.progress_bar && !vars.is_paused) $(vars.progress_bar).stop().css({left : -$(window).width()}); 227 228 /* Update Fields 229 ----------------------------*/ 230 // Update slide caption 231 if ($(vars.slide_caption).length){ 232 (api.getField('title')) ? $(vars.slide_caption).html(api.getField('title')) : $(vars.slide_caption).html(''); 233 } 234 // Update slide number 235 if (vars.slide_current.length){ 236 $(vars.slide_current).html(vars.current_slide + 1); 237 } 238 239 240 // Highlight current thumbnail and adjust row position 241 if (api.options.thumb_links){ 242 243 $('.current-thumb').removeClass('current-thumb'); 244 $('li', vars.thumb_list).eq(vars.current_slide).addClass('current-thumb'); 245 246 // If thumb out of view 247 if ($(vars.thumb_list).width() > $(vars.thumb_tray).width()){ 248 // If next slide direction 249 if (direction == 'next'){ 250 if (vars.current_slide == 0){ 251 vars.thumb_page = 0; 252 $(vars.thumb_list).stop().animate({'left': vars.thumb_page}, {duration:500, easing:'easeOutExpo'}); 253 } else if ($('.current-thumb').offset().left - $(vars.thumb_tray).offset().left >= vars.thumb_interval){ 254 vars.thumb_page = vars.thumb_page - vars.thumb_interval; 255 $(vars.thumb_list).stop().animate({'left': vars.thumb_page}, {duration:500, easing:'easeOutExpo'}); 256 } 257 // If previous slide direction 258 }else if(direction == 'prev'){ 259 if (vars.current_slide == api.options.slides.length - 1){ 260 vars.thumb_page = Math.floor($(vars.thumb_list).width() / vars.thumb_interval) * -vars.thumb_interval; 261 if ($(vars.thumb_list).width() <= -vars.thumb_page) vars.thumb_page = vars.thumb_page + vars.thumb_interval; 262 $(vars.thumb_list).stop().animate({'left': vars.thumb_page}, {duration:500, easing:'easeOutExpo'}); 263 } else if ($('.current-thumb').offset().left - $(vars.thumb_tray).offset().left < 0){ 264 if (vars.thumb_page + vars.thumb_interval > 0) return false; 265 vars.thumb_page = vars.thumb_page + vars.thumb_interval; 266 $(vars.thumb_list).stop().animate({'left': vars.thumb_page}, {duration:500, easing:'easeOutExpo'}); 267 } 268 } 269 } 270 271 272 } 273 274 }, 275 276 277 /* After Slide Transition 278 ----------------------------*/ 279 afterAnimation : function(){ 280 if (api.options.progress_bar && !vars.is_paused) theme.progressBar(); // Start progress bar 281 }, 282 283 284 /* Progress Bar 285 ----------------------------*/ 286 progressBar : function(){ 287 $(vars.progress_bar).stop().css({left : -$(window).width()}).animate({ left:0 }, api.options.slide_interval); 288 } 289 290 291 }; 292 293 294 /* Theme Specific Variables 295 ----------------------------*/ 296 $.supersized.themeVars = { 297 298 // Internal Variables 299 progress_delay : false, // Delay after resize before resuming slideshow 300 thumb_page : false, // Thumbnail page 301 thumb_interval : false, // Thumbnail interval 302 image_path : 'img/', // Default image path 303 304 // General Elements 305 play_button : '#pauseplay', // Play/Pause button 306 next_slide : '#nextslide', // Next slide button 307 prev_slide : '#prevslide', // Prev slide button 308 next_thumb : '#nextthumb', // Next slide thumb button 309 prev_thumb : '#prevthumb', // Prev slide thumb button 310 311 slide_caption : '#slidecaption', // Slide caption 312 slide_current : '.slidenumber', // Current slide number 313 slide_total : '.totalslides', // Total Slides 314 slide_list : '#slide-list', // Slide jump list 315 316 thumb_tray : '#thumb-tray', // Thumbnail tray 317 thumb_list : '#thumb-list', // Thumbnail list 318 thumb_forward : '#thumb-forward', // Cycles forward through thumbnail list 319 thumb_back : '#thumb-back', // Cycles backwards through thumbnail list 320 tray_arrow : '#tray-arrow', // Thumbnail tray button arrow 321 tray_button : '#tray-button', // Thumbnail tray button 322 323 progress_bar : '#progress-bar' // Progress bar 324 325 }; 326 327 /* Theme Specific Options 328 ----------------------------*/ 329 $.supersized.themeOptions = { 330 331 progress_bar : 1, // Timer for each slide 332 mouse_scrub : 0 // Thumbnails move with mouse 333 334 }; 335 336 337})(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.