1/*! 2 * Slidorion, An Image Slider and Accordion Combined 3 * Intructions: http://www.slidorion.com 4 * Created by Ben Holland - http://www.benholland.me 5 * Version: 1.2.0 6 * Copyright 2013 Ben Holland <[email protected]> 7 */ 8!(function ($) { 9 "use strict"; 10 $.fn.extend({ 11 slidorion: function (options) { 12 var defaults = { 13 autoPlay: !0, 14 controlNav: !1, 15 controlNavClass: "slidorion-nav", 16 easing: "", 17 effect: "random", 18 first: 1, 19 interval: 5e3, 20 hoverPause: !1, 21 speed: 1e3, 22 }, 23 opts = $.extend(defaults, options), 24 firstSlide = window.location.hash.match(/slidorion/i) 25 ? location.hash.split("/")[1] - 1 26 : null; 27 return this.each(function () { 28 var current = firstSlide || opts.first - 1, 29 effect = (opts.first, opts.effect), 30 interval = opts.interval, 31 controlNav = opts.controlNav, 32 controlNavClass = opts.controlNavClass, 33 zPos = 1, 34 intervalPause = !1, 35 active = !1, 36 prevEffect = "", 37 obj = $(this), 38 autoPlaying = null, 39 $slider = $(".slider", obj), 40 $accordion = $(".accordion", obj), 41 $slides = $slider.find(".slide"), 42 $linkHeaders = $accordion.find(".heading"), 43 $linkContent = $accordion.find(".content"), 44 effects = [ 45 "fade", 46 "slideLeft", 47 "slideUp", 48 "slideRight", 49 "slideDown", 50 "overLeft", 51 "overRight", 52 "overUp", 53 "overDown", 54 ], 55 slideEffects = ["slideLeft", "slideUp", "slideRight", "slideDown"], 56 overEffects = ["overLeft", "overRight", "overUp", "overDown"], 57 animationOptions = { 58 queue: !0, 59 duration: opts.speed, 60 easing: opts.easingOption, 61 }, 62 sliderCount = $slides.length, 63 accordionCount = $linkHeaders.length, 64 randomEffectMap = { 65 random: effects, 66 slideRandom: slideEffects, 67 overRandom: overEffects, 68 }, 69 init = function () { 70 sliderCount === accordionCount 71 ? (opts.autoPlay === !0 && 72 ((autoPlaying = setInterval(function () { 73 playSlider(current, effect); 74 }, interval)), 75 obj.data("interval", autoPlaying)), 76 opts.hoverPause === !0 && 77 opts.autoPlay === !0 && 78 obj.hover( 79 function () { 80 (intervalPause = !0), stopAuto(); 81 }, 82 function () { 83 (intervalPause = !1), restartAuto(); 84 } 85 ), 86 resetLayers(), 87 $slides.eq(current).css("z-index", zPos), 88 zPos++, 89 $linkContent.hide(), 90 $linkHeaders.eq(current).addClass("active").next().show(), 91 controlNav && 92 (obj.append( 93 '<div class="' + 94 controlNavClass + 95 " " + 96 controlNavClass + 97 '-left"></div><div class="' + 98 controlNavClass + 99 " " + 100 controlNavClass + 101 '-right"></div>' 102 ), 103 $("." + controlNavClass + "-left").click(leftNavigation), 104 $("." + controlNavClass + "-right").click(rightNavigation)), 105 $linkHeaders.click(sectionClicked)) 106 : console.log( 107 "The number of slider images does not match the number of accordion sections." 108 ); 109 }, 110 getRandomEffect = function (effect, arr) { 111 return ( 112 (effect = arr[~~(Math.random() * arr.length)]), 113 effect == prevEffect ? getRandomEffect(effect, arr) : effect 114 ); 115 }, 116 animation = function (current, section, effect) { 117 if (!active) { 118 (active = !0), 119 opts.autoPlay === !0 && 120 opts.intervalPause === !1 && 121 restartAuto();
122 var $current = $slides.eq(current), 123 $new = $slides.eq(section), 124 currentWidth = $current.outerWidth(), 125 currentHeight = $current.outerHeight(); 126 randomEffectMap[effect] && 127 (effect = getRandomEffect(effect, randomEffectMap[effect])); 128 var changeSlideCSS = function ($el, settings) { 129 var defs = { left: "0", top: "0", zIndex: zPos }; 130 $el.css($.extend(defs, settings)); 131 }, 132 animateSlides = function ($el, settings) { 133 if ($el instanceof Array) 134 return ( 135 $.each($el, function () { 136 animateSlides($(this), settings); 137 }), 138 void 0 139 ); 140 var defs = { left: "0", top: "0" }; 141 $el.animate($.extend(defs, settings), animationOptions); 142 }; 143 switch (((prevEffect = effect), effect)) { 144 case "fade": 145 $new 146 .css({ 147 "z-index": zPos, 148 top: "0", 149 left: "0", 150 display: "none", 151 }) 152 .fadeIn(opts.speed); 153 break; 154 case "slideLeft": 155 changeSlideCSS($new, { left: currentWidth, top: 0 }), 156 animateSlides([$current, $new], { 157 left: "-=" + currentWidth, 158 }); 159 break; 160 case "slideRight": 161 changeSlideCSS($new, { 162 left: "-" + currentWidth + "px", 163 top: 0, 164 }), 165 animateSlides([$current, $new], { 166 left: "+=" + currentWidth, 167 }); 168 break; 169 case "slideUp": 170 changeSlideCSS($new, { top: currentHeight, left: 0 }), 171 animateSlides([$current, $new], { 172 top: "-=" + currentHeight, 173 }); 174 break; 175 case "slideDown": 176 changeSlideCSS($new, { 177 top: "-" + currentHeight + "px", 178 left: 0, 179 }), 180 animateSlides([$current, $new], { 181 top: "+=" + currentHeight, 182 }); 183 break; 184 case "overLeft": 185 changeSlideCSS($new, { left: currentWidth }), 186 animateSlides($new, { left: "-=" + currentWidth }); 187 break; 188 case "overRight": 189 changeSlideCSS($new, { left: "-" + currentWidth + "px" }), 190 animateSlides($new, { left: "+=" + currentWidth + "px" }); 191 break; 192 case "overUp": 193 changeSlideCSS($new, { top: currentHeight }), 194 animateSlides($new, { top: "-=" + currentHeight }); 195 break; 196 case "overDown": 197 changeSlideCSS($new, { top: "-" + currentHeight + "px" }), 198 animateSlides($new, { top: "+=" + currentHeight }); 199 break; 200 case "none": 201 $new.css({ "z-index": zPos }); 202 } 203 setTimeout(function () { 204 (active = !1), resetZpos($new); 205 }, opts.speed); 206 } 207 }, 208 sectionClicked = function () { 209 if (!active) { 210 var section = $(this).index() / 2; 211 return section === current 212 ? !1 213 : ($linkHeaders 214 .removeClass("active") 215 .next(".content") 216 .slideUp(), 217 $linkHeaders 218 .eq(section) 219 .addClass("active") 220 .next(".content") 221 .slideDown(), 222 animation(current, section, effect), 223 zPos++, 224 (current = section), 225 !1); 226 } 227 }, 228 playSlider = function (current) { 229 $linkHeaders 230 .eq(getNextSlide(current)) 231 .trigger("click", sectionClicked); 232 }, 233 stopAuto = function () { 234 clearInterval(obj.data("interval")); 235 }, 236 restartAuto = function () { 237 clearInterval(obj.data("interval")), 238 (autoPlaying = setInterval(function () { 239 playSlider(current, effect); 240 }, interval)), 241 obj.data("interval", autoPlaying); 242 }, 243 leftNavigation = function () { 244 $linkHeaders 245 .eq(getNextSlide(current - 2)) 246 .trigger("click", sectionClicked); 247 }, 248 rightNavigation = function () { 249 $linkHeaders 250 .eq(getNextSlide(current)) 251 .trigger("click", sectionClicked); 252 }, 253 getNextSlide = function (tempSection) { 254 return ( 255 tempSection++, 256 tempSection === sliderCount 257 ? 0 258 : 0 > tempSection 259 ? accordionCount - 1 260 : tempSection 261 ); 262 }, 263 resetZpos = function ($el) { 264 zPos > 3 * sliderCount && 265 ((zPos = 2), 266 $slides.css("z-index", "1"), 267 $el.css("z-index", zPos), 268 zPos++); 269 }, 270 resetLayers = function () { 271 for (var i = sliderCount - 1; i > 0; i--) 272 $slides.eq(i).css("z-index", zPos), zPos++; 273 }; 274 init(); 275 }); 276 }, 277 }); 278})(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.