1(function($){ 2 "use strict"; 3 var defaults = { 4 type: "", 5 appendTo: "", 6 listContainer: "", 7 listItems: 4, 8 contentContainer: "", 9 duration: 500 10 }; 11 12 var methods = 13 { 14 init : function(options){ 15 return this.each(function(){ 16 options = $.extend(false, defaults, options); 17 var self = $(this); 18 var expando = self.get(0)[jQuery.expando]; 19 self.attr("id", "slider_" + expando); 20 21 //slider controls 22 var sliderControl = $("<ul class='slider_navigation' id='slider_navigation_" + expando + "'>"); 23 sliderControl.append($("<li class='slider_control'><a class='left_" + expando + "' href='#' title='prev'></a></li>")); 24 sliderControl.append($("<li class='slider_control'><a class='right_" + expando + "' href='#' title='next'></a></li>")); 25 //sliderControl.append("<li class='slider_bar' style='width:" + (100/self.children().length) + "%;'></li>"); 26 27 if(options.listContainer!="" && options.listContainer.length) 28 { 29 //slider posts list 30 var sliderPostsList = $("<ul class='slider_posts_list clearfix' id='slider_posts_list_" + expando + "'>"); 31 32 var lastSlide; 33 self.children(".slide").each(function(index){ 34 $(this).attr("id", "slide_" + expando + "_" + index); 35 if(index==0 && options.type!="small") 36 lastSlide = $("<li id='slider_posts_list_post_" + expando + "_" + index + "' style='width:" + (100/self.children().length) + "%;'><span class='date'>" + ($("#slide_" + expando + "_" + index + " .date").length ? $("#slide_" + expando + "_" + index + " .date").html() : '') + "</span><h5>" + $($("#slide_" + expando + "_" + index + " h2").html()).text() + "</h5></li>"); 37 else 38 sliderPostsList.append($("<li id='slider_posts_list_post_" + expando + "_" + index + "' style='width:" + (100/self.children().length) + "%;'><span class='date'>" + ($("#slide_" + expando + "_" + index + " .date").length ? $("#slide_" + expando + "_" + index + " .date").html() : '') + "</span><h5>" + $($("#slide_" + expando + "_" + index + " h2").html()).text() + "</h5></li>")); 39 }); 40 sliderPostsList.append(lastSlide); 41 42 if(options.listContainer!="") 43 options.listContainer.prepend(sliderPostsList); 44 45 sliderPostsList.carouFredSel({ 46 responsive: true, 47 items: { 48 visible: options.listItems 49 }, 50 scroll: { 51 items: 1, 52 easing: "easeInOutQuint", 53 duration: 750 54 }, 55 auto: { 56 play: false 57 } 58 }); 59 if(sliderPostsList.children().length>options.listItems) 60 { 61 sliderPostsList.parent().before("<a class='slider_control left slider_control_" + expando + "' href='#' title='prev'></a>"); 62 sliderPostsList.parent().after("<a class='slider_control right slider_control_" + expando + "' href='#' title='next'></a>"); 63 $("#slider_posts_list_" + expando).parent().parent().hover(function(){ 64 //$(".slider_control_" + expando).css("display", "block"); 65 $(".slider_posts_list_container .left.slider_control_" + expando).removeClass("slideRightBack").addClass("slideRight"); 66 $(".slider_posts_list_container .right.slider_control_" + expando).removeClass("slideLeftBack").addClass("slideLeft"); 67 }, 68 function(){ 69 //$(".slider_control_" + expando).css("display", "none"); 70 $(".left.slider_control_" + expando).removeClass("slideRight").addClass("slideRightBack"); 71 $(".right.slider_control_" + expando).removeClass("slideLeft").addClass("slideLeftBack"); 72 }); 73 $(".slider_posts_list_container .left.slider_control_" + expando).click(function(event){ 74 event.preventDefault(); 75 sliderPostsList.trigger("prevPage"); 76 var index = $("#slider_posts_list_" + expando + " li").index($("#slider_posts_list_" + expando + " .current")); 77 if(index==options.listItems) 78 $(".left_" + expando + ":first").trigger("click"); 79 }); 80 $(".slider_posts_list_container .right.slider_control_" + expando).click(function(event){ 81 event.preventDefault(); 82 sliderPostsList.trigger("nextPage"); 83 var index = $("#slider_posts_list_" + expando + " li").index($("#slider_posts_list_" + expando + " .current")); 84 if(index==0) 85 $(".right_" + expando + ":first").trigger("click"); 86 }); 87 } 88 } 89 else 90 { 91 self.children(".slide").each(function(index){ 92 $(this).attr("id", "slide_" + expando + "_" + index); 93 }); 94 } 95 if(options.appendTo=="") 96 self.after(sliderControl); 97 else 98 $("#slider_" + expando).find(options.appendTo).append(sliderControl); 99 100 if(options.listContainer!="" && options.listContainer.length) 101 { 102 $("#slider_posts_list_post_" + expando + "_" + (options.type=="small" ? "0" : "1")).append("<div class='slider_posts_list_progress_block' id='slider_posts_list_progress_block_" + expando + "'></div><div class='slider_posts_list_bar' id='slider_posts_list_bar_" + expando + "'></div>").addClass("current"); 103 self.sliderControl("barAnimation", expando); 104 105 $("#slider_" + expando + ", #slider_posts_list_" + expando + ", .slider_control_" + expando).hover(function(){ 106 $("#slider_posts_list_progress_block_" + expando + ", #slider_posts_list_bar_" + expando).stop(true); 107 }, 108 function(){ 109 self.sliderControl("barAnimation", expando); 110 }); 111 } 112 113 var currentSlide = $("#slide_" + expando + "_0"); 114 var slideTo; 115 $(".left_" + expando).click(function(event, param){ 116 event.preventDefault(); 117 self.trigger("isScrolling", function(isScrolling){ 118 if(!isScrolling) 119 { 120 if(currentSlide.prev().length) 121 slideTo = currentSlide.prev() 122 else
123 slideTo = currentSlide.parent().children().last(); 124 self.sliderControl("slideTo", self, expando, slideTo, options, "left", param); 125 if(parseInt(param)!=2) 126 currentSlide = slideTo; 127 } 128 }); 129 }); 130 $(".right_" + expando).click(function(event, param){ 131 event.preventDefault(); 132 self.trigger("isScrolling", function(isScrolling){ 133 if(!isScrolling) 134 { 135 if(currentSlide.next().length) 136 slideTo = currentSlide.next() 137 else 138 slideTo = currentSlide.parent().children().first(); 139 self.sliderControl("slideTo", self, expando, slideTo, options, "right", param); 140 currentSlide = slideTo; 141 } 142 }); 143 }); 144 var base = "x"; 145 var scrollOptions = { 146 scroll: { 147 easing: "linear", 148 duration: 200 149 } 150 }; 151 self.swipe({ 152 fallbackToMouseEvents: false, 153 allowPageScroll: "vertical", 154 excludedElements:"button, input, select, textarea, .noSwipe", 155 /*swipeLeft: function(event, direction, distance, duration, fingerCount, fingerData){ 156 $(".right_" + expando).trigger("click"); 157 }, 158 swipeRight: function(){ 159 $(".left_" + expando).trigger("click"); 160 },*/ 161 swipeStatus: function(event, phase, direction, distance, fingerCount, fingerData ) { 162 if(!self.is(":animated")) 163 { 164 self.trigger("isScrolling", function(isScrolling){ 165 if(!isScrolling) 166 { 167 $("#slider_posts_list_progress_block_" + expando + ", #slider_posts_list_bar_" + expando).stop(true); 168 //If we are moving before swipe, and we are going L or R in X mode, or U or D in Y mode then drag. 169 if (phase == "move" && (direction == "left" || direction == "right")) 170 { 171 if(base=="x") 172 { 173 self.trigger("configuration", scrollOptions); 174 $("#slider_posts_list_" + expando).trigger("configuration", scrollOptions); 175 } 176 if (direction == "left") 177 { 178 if(options.type=="small") 179 { 180 if(base=="x") 181 base = 0; 182 self.css("left", parseInt(base)-distance + "px"); 183 } 184 else 185 { 186 if(base=="x") 187 { 188 base = self.offset().left; 189 } 190 self.css("left", parseInt(base)-distance + "px"); 191 } 192 } 193 else if (direction == "right") 194 { 195 if(options.type=="small") 196 { 197 if(base=="x" || base==0) 198 { 199 self.children().last().prependTo(self); 200 base = -self.children().first().width(); 201 } 202 self.css("left", base+distance + "px"); 203 } 204 else 205 { 206 if(base=="x") 207 { 208 self.children().last().prependTo(self); 209 base = self.offset().left-self.children().first().width(); 210 } 211 self.css("left", base+distance + "px"); 212 } 213 } 214 215 } 216 else if (phase == "cancel") 217 { 218 if(distance!=0) 219 { 220 self.animate({ 221 "left": base + "px" 222 }, 750, "easeInOutQuint", function(){ 223 /*self.trigger("configuration", {scroll: { 224 easing: "easeInOutQuint", 225 duration: 750 226 }}); 227 $("#slider_posts_list_" + expando).trigger("configuration", {scroll: { 228 easing: "easeInOutQuint", 229 duration: 750 230 }});??*/ 231 if(options.type=="small") 232 { 233 if(base==-self.children().first().width()) 234 { 235 self.children().first().appendTo(self); 236 self.css("left", "0px"); 237 base = 0; 238 } 239 } 240 }); 241 } 242 } 243 else if (phase == "end") 244 { 245 if (direction == "right") 246 { 247 $(".left_" + expando + ":first").trigger("click", [2]); 248 self.animate({ 249 "left": (options.type=="small" ? 0 : (base+self.children().first().width())) + "px" 250 }, 200, "linear", function(){ 251 if(options.type!="small") 252 self.children().first().appendTo(self); 253 $(".left_" + expando + ":first").trigger("click", [1]); 254 base = "x"; 255 }); 256 257 } 258 else if (direction == "left") 259 { 260 $(".right_" + expando + ":first").trigger("click"); 261 base = "x"; 262 } 263 } 264 } 265 }); 266 } 267 } 268 }); 269 if(options.type!="small") 270 { 271 $(this).children(".slide").click(function(event, param){ 272 var self2 = $(this); 273 self.trigger("isScrolling", function(isScrolling){ 274 if(!isScrolling) 275 { 276 if(typeof(param)=="undefined") 277 { 278 slideTo = (self2.prev().hasClass("slide") ? self2.prev() : self2.parent().children().last(
278)); 279 if(slideTo.attr("id")!=currentSlide.attr("id")) 280 { 281 self.sliderControl("slideTo", self, expando, slideTo, options); 282 currentSlide = slideTo; 283 } 284 } 285 } 286 }); 287 }); 288 } 289 if(options.listContainer!="" && options.listContainer.length) 290 { 291 $("#slider_posts_list_" + expando + " li").click(function(){ 292 var self2 = $(this); 293 self.trigger("isScrolling", function(isScrolling){ 294 if(!isScrolling) 295 { 296 //var index = $("#slider_posts_list_" + expando + " li").index(self2); 297 var index = self2.attr("id").replace("slider_posts_list_post_" + expando + "_", ""); 298 if(options.type!="small") 299 { 300 if((parseInt(index))==0) 301 index = $("#slider_posts_list_" + expando).children().length; 302 index--; 303 } 304 slideTo = $("#slide_" + expando + "_" + index); 305 if(slideTo.attr("id")!=currentSlide.attr("id")) 306 { 307 self.sliderControl("slideTo", self, expando, slideTo, options); 308 currentSlide = slideTo; 309 } 310 } 311 }); 312 }); 313 } 314 /*$("#slider_navigation_" + expando + " .slider_control a").click(function(event){ 315 event.preventDefault(); 316 if(!$(this).hasClass("inactive")) 317 { 318 var self2 = $(this).parent(); 319 self.trigger("isScrolling", function(isScrolling){ 320 if(!isScrolling) 321 self.trigger("slideTo", $("#slider_navigation_" + expando + " .slider_control").index(self2)); 322 }); 323 } 324 });*/ 325 self.addClass("pr_initialized"); 326 }); 327 }, 328 barAnimation: function(name, expando){ 329 var distance = parseFloat($("#slider_posts_list_bar_" + expando)[0].style.width)/100; 330 if(parseFloat(distance)==0 || isNaN(distance)) 331 distance = 1; 332 else 333 distance = 1-distance; 334 335 $("#slider_posts_list_progress_block_" + expando + ", #slider_posts_list_bar_" + expando).animate({ 336 width: "100%" 337 }, distance*5000, "linear", function(){ 338 $(".right_" + expando + ":first").trigger("click", [3]); 339 }); 340 }, 341 slideTo: function(name, self, expando, slide, options, direction, param){ 342 var scrollOptions = { 343 scroll: { 344 easing: "easeInOutQuint", 345 duration: 750 346 } 347 }; 348 if(typeof(param)=="undefined") 349 self.trigger("slideTo", [slide, {direction: (direction=="left" ? "prev" : "next"), onAfter: function(){ 350 self.trigger("configuration", scrollOptions); 351 $("#slider_posts_list_" + expando).trigger("configuration", scrollOptions); 352 }}]); 353 else if(parseInt(param)==1) 354 self.trigger("slideTo", [slide, {duration: 0, direction: (direction=="left" ? "prev" : "next"), onAfter: function(){ 355 self.trigger("configuration", scrollOptions); 356 $("#slider_posts_list_" + expando).trigger("configuration", scrollOptions); 357 }}]); 358 else if(parseInt(param)==3) 359 self.trigger("slideTo", slide); 360 var index = slide.attr("id").replace("slide_" + expando + "_", ""); 361 if(options.type!="small") 362 { 363 if((parseInt(index)+1)==$("#slider_posts_list_" + expando).children().length) 364 index = 0; 365 else 366 index++; 367 } 368 if(options.listContainer!="" && options.listContainer.length && (typeof(param)=="undefined" || parseInt(param)==2 || parseInt(param)==3)) 369 { 370 //slider post list 371 $("#slider_posts_list_progress_block_" + expando + ", #slider_posts_list_bar_" + expando).css("width", 0); 372 var next = $("#slider_posts_list_post_" + expando + "_" + index); 373 $("#slider_posts_list_bar_" + expando).parent().removeClass("current");//({"background": "#FFFFFF", "border-color" : "#E9E9E9"}); 374 next.append($("#slider_posts_list_progress_block_" + expando + ", #slider_posts_list_bar_" + expando)).addClass("current"); 375 $("#slider_posts_list_progress_block_" + expando + ", #slider_posts_list_bar_" + expando).stop(true); 376 $.fn.sliderControl("barAnimation", expando); 377 var index2 = $("#slider_posts_list_" + expando + " li").index($("#slider_posts_list_" + expando + " .current")); 378 if(index2==options.listItems && options.listItems==$("#slider_posts_list_" + expando).children().length-1) 379 { 380 if(direction=="left") 381 $(".slider_posts_list_container .left.slider_control_" + expando).trigger("click"); 382 else 383 $(".slider_posts_list_container .right.slider_control_" + expando).trigger("click"); 384 } 385 else if(index2==options.listItems) 386 $(".slider_posts_list_container .right.slider_control_" + expando).trigger("click"); 387 else if(index2==$("#slider_posts_list_" + expando).children().length-1) 388 $(".slider_posts_list_container .left.slider_control_" + expando).trigger("click"); 389 } 390 }, 391 destroy: function(){ 392 var expando = $(this).get(0)[jQuery.expando]; 393 $(".slider_navigation#slider_navigation_" + expando).remove(); 394 $("#slider_posts_list_progress_block_" + expando + ", #slider_posts_list_bar_" + expando).clearQueue().stop(); 395 $("#slider_posts_list_" + expando).parent().parent().children().remove(); 396 } 397 }; 398 399 jQuery.fn.sliderControl = function(method){ 400 if(methods[method]) 401 return methods[method].apply(this, arguments); 402 else if(typeof(method)==='object' || !method) 403 return methods.init.apply(this, arguments); 404 }; 405})(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.