vendor: 1,886 bytes, lines 1-67
1(function ($, undefined) { 2 'use strict'; 3 var defaults = { 4 item: 1, 5 autoWidth: false, 6 slideMove: 1, 7 slideMargin: 10, 8 addClass: '', 9 mode: 'slide', 10 useCSS: true, 11 cssEasing: 'ease', //'cubic-bezier(0.25, 0, 0.25, 1)', 12 easing: 'linear', //'for jquery animation',// 13 speed: 400, //ms' 14 auto: true, 15 pauseOnHover: false, 16 loop: false, 17 slideEndAnimation: true, 18 pause: 2000, 19 keyPress: false, 20 controls: true, 21 prevHtml: '', 22 nextHtml: '', 23 rtl: false, 24 adaptiveHeight: false, 25 vertical: false, 26 verticalHeight: 500, 27 vThumbWidth: 100, 28 thumbItem: 10, 29 pager: true, 30 gallery: false, 31 galleryMargin: 5, 32 thumbMargin: 5, 33 currentPagerPosition: 'middle', 34 enableTouch: true, 35 enableDrag: true, 36 freeMove: true, 37 swipeThreshold: 40, 38 responsive: [], 39 /* jshint ignore:start */ 40 onBeforeStart: function ($el) {}, 41 onSliderLoad: function ($el) {}, 42 onBeforeSlide: function ($el, scene) {}, 43 onAfterSlide: function ($el, scene) {}, 44 onBeforeNextSlide: function ($el, scene) {}, 45 onBeforePrevSlide: function ($el, scene) {} 46 /* jshint ignore:end */ 47 }; 48 $.fn.lightSlider = function (options) { 49 if (this.length === 0) { 50 return this; 51 } 52 53 if (this.length > 1) { 54 this.each(function () { 55 $(this).lightSlider(options); 56 }); 57 return this; 58 } 59 60 var plugin = {}, 61 settings = $.extend(true, {}, defaults, options), 62 settingsTemp = {}, 63 $el = this; 64 plugin.$el = this; 65 66 if (settings.mode === 'fade') { 67 settings.vertical = false;
68 } 69 var $children = $el.children(), 70 windowW = $(window).width(), 71 breakpoint = null, 72 resposiveObj = null, 73 length = 0, 74 w = 0, 75 on = false, 76 elSize = 0, 77 $slide = '', 78 scene = 0, 79 property = (settings.vertical === true) ? 'height' : 'width', 80 gutter = (settings.vertical === true) ? 'margin-bottom' : 'margin-right', 81 slideValue = 0, 82 pagerWidth = 0, 83 slideWidth = 0, 84 thumbWidth = 0, 85 slidereffect = 0, 86 slideflag = false, 87 interval = null, 88 isTouch = ('ontouchstart' in document.documentElement); 89 var refresh = {}; 90 window.mobilecheck = function() { 91 var check = false; 92 (function(a){if(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0,4))) check = true;})(navigator.userAgent||navigator.vendor||window.opera); 93 //console.log("this mobile device check", check) 94 return check; 95 }; 96 97 refresh.chbreakpoint = function () { 98 windowW = $(window).width(); 99 if (settings.responsive.length) { 100 var item; 101 if (settings.autoWidth === false) { 102 item = settings.item; 103 } 104 if (windowW < settings.responsive[0].breakpoint) { 105 for (var i = 0; i < settings.responsive.length; i++) { 106 if (windowW < settings.responsive[i].breakpoint) { 107 breakpoint = settings.responsive[i].breakpoint; 108 resposiveObj = settings.responsive[i]; 109 } 110 } 111 } 112 if (typeof resposiveObj !== 'undefined' && resposiveObj !== null) { 113 for (var j in resposiveObj.settings) { 114 // console.log("107_reponsiveObj:"+JSON.stringify(j)); 115 if (resposiveObj.settings.hasOwnProperty(j)) { 116 if (typeof settingsTemp[j] === 'undefined' || settingsTemp[j] === null) { 117 settingsTemp[j] = settings[j]; 118 } 119 settings[j] = resposiveObj.settings[j]; 120 } 121 } 122 } 123 if (!$.isEmptyObject(settingsTemp) && windowW > settings.responsive[0].breakpoint) { 124 for (var k in settingsTemp) { 125 if (settingsTemp.hasOwnProperty(k)) { 126 settings[k] = settingsTemp[k]; 127 } 128 } 129 } 130 if (settings.autoWidth === false) { 131 if (slideValue > 0 && slideWidth > 0) { 132 if (item !== settings.item) {
133 scene = Math.round(slideValue / ((slideWidth + settings.slideMargin) * settings.slideMove)); 134 } 135 } 136 } 137 } 138 }; 139 // console.log(elSize); 140 refresh.calSW = function () { 141 if (settings.autoWidth === false) { 142 slideWidth = (elSize - ((settings.item * (settings.slideMargin)) - settings.slideMargin)) / settings.item; 143 } 144 }; 145 146 refresh.calWidth = function (cln) { 147 var ln = cln === true ? $slide.find('.lslide').length : $children.length; 148 if (settings.autoWidth === false) { 149 w = ln * (slideWidth + settings.slideMargin); 150 } else { 151 w = 0; 152 for (var i = 0; i < ln; i++) { 153 w += (parseInt($children.eq(i).width()) + settings.slideMargin); 154 } 155 } 156 return w; 157 }; 158 plugin = { 159 doCss: function () { 160 var support = function () { 161 var transition = ['transition', 'MozTransition', 'WebkitTransition', 'OTransition', 'msTransition', 'KhtmlTransition']; 162 var root = document.documentElement; 163 for (var i = 0; i < transition.length; i++) { 164 if (transition[i] in root.style) { 165 return true; 166 } 167 } 168 }; 169 if (settings.useCSS && support()) { 170 return true; 171 } 172 return false; 173 }, 174 keyPress: function () { 175 if (settings.keyPress) { 176 $(document).on('keyup.lightslider', function (e) { 177 if (!$(':focus').is('input, textarea')) { 178 if (e.preventDefault) { 179 e.preventDefault(); 180 } else { 181 e.returnValue = false; 182 } 183 if (e.keyCode === 37) { 184 $el.goToPrevSlide(); 185 } else if (e.keyCode === 39) { 186 $el.goToNextSlide(); 187 } 188 } 189 }); 190 } 191 }, 192 controls: function () { 193 if (settings.controls) { 194 if ($(window).width() > 981) { $el.after('<div class="lSAction"><a class="lSPrev" ><i class="fas fa-chevron-left" style="font-size:30px; color:black"></i>' + settings.prevHtml + '</a><a class="lSNext">' + settings.nextHtml + '<i class="fas fa-chevron-right" style="font-size:30px; color:black"></i></a></div>');} 195 $(window).resize(function() { 196 if ($(window).width() > 981) { 197 var existed = $('.lSAction').length; 198 if(existed == 0) 199 { 200 $el.after('<div class="lSAction"><a class="lSPrev" ><i class="fas fa-chevron-left" style="font-size:30px; color:black"></i>' + settings.prevHtml + '</a><a class="lSNext">' + settings.nextHtml + '<i class="fas fa-chevron-right" style="font-size:30px; color:black"></i></a></div>'); 201 } 202 } 203 else{ 204 $('.lSAction').remove(); 205 } 206 }); 207 208 if (!settings.autoWidth) { 209 if (length <= settings.item) { 210 $slide.find('.lSAction').hide(); 211 } 212 } else { 213 if (refresh.calWidth(false) < elSize) { 214 $slide.find('.lSAction').hide(); 215 } 216 } 217 $slide.find('.lSAction a').on('click', function (e) { 218 if (e.preventDefault) { 219 e.preventDefault(); 220 } else { 221 e.returnValue = false;
vendor: 14,274 bytes, lines 222-514
222 } 223 if ($(this).attr('class') === 'lSPrev') { 224 $el.goToPrevSlide(); 225 } else { 226 $el.goToNextSlide(); 227 } 228 return false; 229 }); 230 } 231 }, 232 initialStyle: function () { 233 var $this = this; 234 if (settings.mode === 'fade') { 235 settings.autoWidth = false; 236 settings.slideEndAnimation = false; 237 } 238 if (settings.auto) { 239 settings.slideEndAnimation = false; 240 } 241 if (settings.autoWidth) { 242 settings.slideMove = 1; 243 settings.item = 1; 244 } 245 if (settings.loop) { 246 settings.slideMove = 1; 247 settings.freeMove = false; 248 } 249 settings.onBeforeStart.call(this, $el); 250 refresh.chbreakpoint(); 251 $el.addClass('lightSlider').wrap('<div class="lSSlideOuter ' + settings.addClass + '"><div class="lSSlideWrapper"></div></div>'); 252 $slide = $el.parent('.lSSlideWrapper'); 253 if (settings.rtl === true) { 254 $slide.parent().addClass('lSrtl'); 255 } 256 if (settings.vertical) { 257 $slide.parent().addClass('vertical'); 258 elSize = settings.verticalHeight; 259 $slide.css('height', elSize + 'px'); 260 } else { 261 elSize = $el.outerWidth(); 262 } 263 $children.addClass('lslide'); 264 if (settings.loop === true && settings.mode === 'slide') { 265 refresh.calSW(); 266 refresh.clone = function () { 267 if (refresh.calWidth(true) > elSize) { 268 /**/ 269 var tWr = 0, 270 tI = 0; 271 for (var k = 0; k < $children.length; k++) { 272 tWr += (parseInt($el.find('.lslide').eq(k).width()) + settings.slideMargin); 273 // console.log("254_width"+$el.find('.lslide').eq(k).width()); 274 tI++; 275 if (tWr >= (elSize + settings.slideMargin)) { 276 break; 277 } 278 } 279 var tItem = settings.autoWidth === true ? tI : settings.item; 280 281 /**/ 282 if (tItem < $el.find('.clone.left').length) { 283 for (var i = 0; i < $el.find('.clone.left').length - tItem; i++) { 284 $children.eq(i).remove(); 285 } 286 } 287 if (tItem < $el.find('.clone.right').length) { 288 for (var j = $children.length - 1; j > ($children.length - 1 - $el.find('.clone.right').length); j--) { 289 scene--; 290 $children.eq(j).remove(); 291 } 292 } 293 /**/ 294 for (var n = $el.find('.clone.right').length; n < tItem; n++) { 295 $el.find('.lslide').eq(n).clone().removeClass('lslide').addClass('clone right').appendTo($el); 296 scene++; 297 } 298 for (var m = $el.find('.lslide').length - $el.find('.clone.left').length; m > ($el.find('.lslide').length - tItem); m--) { 299 $el.find('.lslide').eq(m - 1).clone().removeClass('lslide').addClass('clone left').prependTo($el); 300 } 301 $children = $el.children(); 302 } else { 303 if ($children.hasClass('clone')) { 304 $el.find('.clone').remove(); 305 $this.move($el, 0); 306 } 307 } 308 }; 309 refresh.clone(); 310 } 311 refresh.sSW = function () { 312 length = $children.length; 313 if (settings.rtl === true && settings.vertical === false) { 314 gutter = 'margin-left'; 315 } 316 if (settings.autoWidth === false) { 317 $children.css(property, slideWidth + 'px'); 318 } 319 $children.css(gutter, settings.slideMargin + 'px'); 320 w = refresh.calWidth(false); 321 $el.css(property, w + 'px'); 322 if (settings.loop === true && settings.mode === 'slide') { 323 if (on === false) { 324 scene = $el.find('.clone.left').length; 325 } 326 } 327 }; 328 refresh.calL = function () { 329 $children = $el.children(); 330 length = $children.length; 331 }; 332 if (this.doCss()) { 333 $slide.addClass('usingCss'); 334 } 335 refresh.calL(); 336 if (settings.mode === 'slide') { 337 refresh.calSW(); 338 refresh.sSW(); 339 if (settings.loop === true) { 340 slideValue = $this.slideValue(); 341 this.move($el, slideValue); 342 } 343 if (settings.vertical === false) { 344 this.setHeight($el, false); 345 } 346 347 } else { 348 this.setHeight($el, true); 349 $el.addClass('lSFade'); 350 if (!this.doCss()) { 351 $children.fadeOut(0); 352 $children.eq(scene).fadeIn(0); 353 } 354 } 355 if (settings.loop === true && settings.mode === 'slide') { 356 $children.eq(scene).addClass('active'); 357 // console.log("335_scene:"+JSON.stringify($children)); 358 } else { 359 $children.first().addClass('active'); 360 // console.log("337_scene:"+JSON.stringify($children)); 361 } 362 }, 363 pager: function () { 364 var $this = this; 365 console.log("refresh start"); 366 refresh.createPager = function () { 367 window.mobilecheck() ? elSize = 180 : elSize = 110 368 thumbWidth = (elSize - ((settings.thumbItem * (settings.thumbMargin)) - settings.thumbMargin)) / settings.thumbItem; 369 var $children = $slide.find('.lslide'); 370 var length = $slide.find('.lslide').length; 371 var i = 0, 372 pagers = '', 373 v = 0; 374 for (i = 0; i < length; i++) { 375 if (settings.mode === 'slide') { 376 // calculate scene * slide value 377 if (!settings.autoWidth) { 378 v = i * ((slideWidth + settings.slideMargin) * settings.slideMove); 379 } else { 380 v += ((parseInt($children.eq(i).width()) + settings.slideMargin) * settings.slideMove); 381 } 382 } 383 var thumb = $children.eq(i * settings.slideMove).attr('data-thumb'); 384 if (settings.gallery === true) { 385 pagers += '<li style="width:100%;' + property + ':' + thumbWidth + 'px;' + gutter + ':' + settings.thumbMargin + 'px"><i class=" fas fa-circle dot_sliders" style="font-size:8px;color:#C4C4C4;"></i></li>'; 386 } else { 387 pagers += '<li><a href="#">' + (i + 1) + '</a></li>'; 388 } 389 if (settings.mode === 'slide') { 390 if ((v) >= w - elSize - settings.slideMargin) { 391 i = i + 1; 392 var minPgr = 2; 393 if (settings.autoWidth) { 394 pagers += '<li><a href="#">' + (i + 1) + '</a></li>'; 395 minPgr = 1; 396 } 397 if (i < minPgr) { 398 pagers = null; 399 $slide.parent().addClass('noPager'); 400 } else { 401 $slide.parent().removeClass('noPager'); 402 } 403 break; 404 } 405 } 406 } 407 var $cSouter = $slide.parent(); 408 $cSouter.find('.lSPager').html(pagers); 409 if (settings.gallery === true) { 410 if (settings.vertical === true) { 411 // set Gallery thumbnail width 412 $cSouter.find('.lSPager').css('width', settings.vThumbWidth + 'px'); 413 } 414 pagerWidth = (i * (settings.thumbMargin + thumbWidth)) + 0.5; 415 $cSouter.find('.lSPager').css({ 416 property: pagerWidth + 'px', 417 'transition-duration': settings.speed + 'ms' 418 }); 419 if (settings.vertical === true) { 420 $slide.parent().css('padding-right', (settings.vThumbWidth + settings.galleryMargin) + 'px'); 421 } 422 $cSouter.find('.lSPager').css(property, pagerWidth + 'px'); 423 } 424 var $pager = $cSouter.find('.lSPager').find('li'); 425 $pager.first().addClass('active'); 426 // console.log("408_page.first:"+$pager.first().addClass('active')); 427 $pager.on('click', function () { 428 if (settings.loop === true && settings.mode === 'slide') { 429 scene = scene + ($pager.index(this) - $cSouter.find('.lSPager').find('li.active').index()); 430 // console.log("409_scene"+":"+$pager.index(this)); 431 } else { 432 scene = $pager.index(this); 433 } 434 // console.log("418_scene"+scene); 435 $el.mode(false); 436 if (settings.gallery === true) { 437 $this.slideThumb(); 438 } 439 return false; 440 }); 441 }; 442 if (settings.pager) { 443 var cl = 'lSpg'; 444 if (settings.gallery) { 445 cl = 'lSGallery'; 446 } 447 window.mobilecheck() ? elSize = 180 : elSize = 110 448 // $slide.after('<div style="width:'+(170)+'px; margin-left:'+(percent_margin)+'%; overflow:hidden"><ul class="lSPager ' + cl + '"></ul></div>'); 449 $slide.after('<div class="pager_new" style="width:'+(elSize)+'px; overflow:hidden;"><ul class="lSPager ' + cl + '" style="margin:auto"></ul></div>'); 450 var gMargin = (settings.vertical) ? 'margin-left' : 'margin-top'; 451 $slide.parent().find('.lSPager').css(gMargin, settings.galleryMargin + 'px'); 452 refresh.createPager(); 453 } 454 455 setTimeout(function () { 456 refresh.init(); 457 }, 0); 458 }, 459 setHeight: function (ob, fade) { 460 var obj = null, 461 $this = this; 462 if (settings.loop) { 463 obj = ob.children('.lslide ').first(); 464 } else { 465 obj = ob.children().first(); 466 } 467 var setCss = function () { 468 var tH = obj.outerHeight(), 469 tP = 0, 470 tHT = tH; 471 if (fade) { 472 tH = 0; 473 tP = ((tHT) * 100) / elSize; 474 } 475 ob.css({ 476 'height': tH + 'px', 477 'padding-bottom': tP + '%' 478 }); 479 }; 480 setCss(); 481 if (obj.find('img').length) { 482 if ( obj.find('img')[0].complete) { 483 setCss(); 484 if (!interval) { 485 $this.auto(); 486 } 487 }else{ 488 obj.find('img').on('load', function () { 489 setTimeout(function () { 490 setCss(); 491 if (!interval) { 492 $this.auto(); 493 } 494 }, 100); 495 }); 496 } 497 }else{ 498 if (!interval) { 499 $this.auto(); 500 } 501 } 502 }, 503 active: function (ob, t) { 504 if (this.doCss() && settings.mode === 'fade') { 505 $slide.addClass('on'); 506 } 507 var sc = 0; 508 if (scene * settings.slideMove < length) { 509 ob.removeClass('active'); 510 if (!this.doCss() && settings.mode === 'fade' && t === false) { 511 ob.fadeOut(settings.speed); 512 } 513 if (t === true) { 514 sc = scene;
515 } else { 516 sc = scene * settings.slideMove; 517 } 518 //t === true ? sc = scene : sc = scene * settings.slideMove; 519 var l, nl; 520 if (t === true) { 521 l = ob.length; 522 nl = l - 1; 523 if (sc + 1 >= l) { 524 sc = nl; 525 } 526 } 527 if (settings.loop === true && settings.mode === 'slide') { 528 //t === true ? sc = scene - $el.find('.clone.left').length : sc = scene * settings.slideMove; 529 if (t === true) { 530 sc = scene - $el.find('.clone.left').length; 531 } else { 532 sc = scene * settings.slideMove; 533 } 534 if (t === true) { 535 l = ob.length; 536 nl = l - 1; 537 if (sc + 1 === l) { 538 sc = nl; 539 } else if (sc + 1 > l) { 540 sc = 0; 541 } 542 } 543 } 544 545 if (!this.doCss() && settings.mode === 'fade' && t === false) { 546 ob.eq(sc).fadeIn(settings.speed); 547 } 548 // console.log(sc); 549 if (ob.length < 6) { 550 for (var i=0 ;i <= (ob.length-1); i++) { 551 ob.eq(i).removeClass("active focus") 552 } 553 ob.eq(sc).addClass('active'); 554 ob.eq(sc).addClass('focus'); 555 } else { 556 for (var i=0 ;i <= (ob.length-1); i++) 557 { 558 ob.eq(i).removeClass('dot_medium dot_small_1 dot_small_2 dot_small_3 active focus inactive'); 559 } 560 if (sc > 0 ) { 561 var len = ob.length; 562 ob.eq(sc).addClass('active focus'); 563 if ( sc+1 <= len ) ob.eq(sc+1).addClass('dot_medium'); 564 if ( sc-1 >= 0 ) ob.eq(sc-1).addClass('dot_medium'); 565 if ( sc+2 <= len ) ob.eq(sc+2).addClass('dot_small_1'); 566 if ( sc-2 >= 0 ) ob.eq(sc-2).addClass('dot_small_1'); 567 if ( sc-3 >= 0 ) ob.eq(sc-3).addClass('dot_small_2'); 568 if ( sc+3 <= len ) ob.eq(sc+3).addClass('dot_small_2'); 569 if ( sc-4 >= 0 ) ob.eq(sc-4).addClass('dot_small_3'); 570 if ( sc+4 <= len ) ob.eq(sc+4).addClass('dot_small_3'); 571 if ( sc+5 <= len ) ob.eq(sc+5).removeClass('dot_small_2'); 572 if ( sc-5 >= 0 ) ob.eq(sc-5).addClass('inactive'); 573 if ( sc+5 <= len ) ob.eq(sc+5).addClass('inactive'); 574 if ( sc+6 <= len ) ob.eq(sc+6).addClass('inactive'); 575 if ( sc-6 >= 0 ) ob.eq(sc-6).addClass('inactive'); 576 } 577 else { 578 ob.eq(sc).addClass('active'); 579 ob.eq(sc).addClass('focus'); 580 ob.eq(sc+1).addClass('dot_medium'); 581 ob.eq(sc+2).addClass('dot_small_1'); 582 ob.eq(sc+3).addClass('dot_small_2'); 583 ob.eq(sc+4).addClass('dot_small_3'); 584 ob.eq(sc+5).addClass('inactive'); 585 ob.eq(sc+6).addClass('inactive'); 586 587 } 588 } 589 590 } else { 591 ob.removeClass('active'); 592 // ob.removeClass('active_color'); 593 ob.eq(ob.length - 1).addClass('active'); 594 if (!this.doCss() && settings.mode === 'fade' && t === false) { 595 ob.fadeOut(settings.speed); 596 ob.eq(sc).fadeIn(settings.speed); 597 } 598 } 599 // console.log("537_active"); 600 }, 601 move: function (ob, v) { 602 // console.log(slideflag) 603 if (settings.rtl === true) { 604 v = -v; 605 } 606 if (this.doCss()) { 607 if (settings.vertical === true) { 608 ob.css({ 609 'transform': 'translate3d(0px, ' + (-v) + 'px, 0px)',
vendor: 7,635 bytes, lines 610-778
610 '-webkit-transform': 'translate3d(0px, ' + (-v) + 'px, 0px)' 611 }); 612 } else { 613 if ( slideflag === false ) { 614 ob.css({ 615 'transform': 'translate3d(' + (-v) + 'px, 0px, 0px)', 616 '-webkit-transform': 'translate3d(' + (-v) + 'px, 0px, 0px)', 617 }); 618 } 619 620 } 621 } else { 622 if (settings.vertical === true) { 623 ob.css('position', 'relative').animate({ 624 top: -v + 'px' 625 }, settings.speed, settings.easing); 626 } else { 627 ob.css('position', 'relative').animate({ 628 left: (4-v) + 'px' 629 }, settings.speed, settings.easing); 630 } 631 } 632 var $thumb = $slide.parent().find('.lSPager').find('li'); 633 // console.log("568_$thumb:"+JSON.stringify($thumb)); 634 this.active($thumb, true); 635 }, 636 fade: function () { 637 this.active($children, false); 638 var $thumb = $slide.parent().find('.lSPager').find('li'); 639 this.active($thumb, true); 640 // console.log("573_$thumb:"+$thumb); 641 }, 642 slide: function () { 643 var $this = this; 644 refresh.calSlide = function () { 645 if (w > elSize) { 646 slideValue = $this.slideValue(); 647 $this.active($children, false); 648 if ((slideValue) > w - elSize - settings.slideMargin) { 649 slideValue = w - elSize - settings.slideMargin; 650 } else if (slideValue < 0) { 651 slideValue = 0; 652 } 653 $this.move($el, slideValue); 654 if (settings.loop === true && settings.mode === 'slide') { 655 if (scene >= (length - ($el.find('.clone.left').length / settings.slideMove))) { 656 $this.resetSlide($el.find('.clone.left').length); 657 } 658 if (scene === 0) { 659 $this.resetSlide($slide.find('.lslide').length); 660 } 661 } 662 } 663 }; 664 refresh.calSlide(); 665 }, 666 resetSlide: function (s) { 667 var $this = this; 668 $slide.find('.lSAction a').addClass('disabled'); 669 setTimeout(function () { 670 scene = s; 671 $slide.css('transition-duration', '0ms'); 672 slideValue = $this.slideValue(); 673 $this.active($children, false); 674 plugin.move($el, slideValue); 675 setTimeout(function () { 676 $slide.css('transition-duration', settings.speed + 'ms'); 677 $slide.find('.lSAction a').removeClass('disabled'); 678 }, 50); 679 }, settings.speed + 100); 680 }, 681 slideValue: function () { 682 var _sV = 0; 683 if (settings.autoWidth === false) { 684 _sV = scene * ((slideWidth + settings.slideMargin) * settings.slideMove); 685 } else { 686 _sV = 0; 687 for (var i = 0; i < scene; i++) { 688 _sV += (parseInt($children.eq(i).width()) + settings.slideMargin); 689 } 690 } 691 return _sV; 692 }, 693 slideThumb: function () { 694 var position; 695 switch (settings.currentPagerPosition) { 696 case 'left': 697 position = 0; 698 break; 699 case 'middle': 700 position = (elSize / 2) - (thumbWidth / 2); 701 break; 702 case 'right': 703 position = elSize - thumbWidth; 704 } 705 var sc = scene - $el.find('.clone.left').length; 706 var $pager = $slide.parent().find('.lSPager'); 707 if (settings.mode === 'slide' && settings.loop === true) { 708 if (sc >= $pager.children().length) { 709 sc = 0; 710 } else if (sc < 0) { 711 sc = $pager.children().length; 712 } 713 } 714 var thumbSlide = sc * ((thumbWidth + settings.thumbMargin)) - (position); 715 if ((thumbSlide + elSize) > pagerWidth) { 716 thumbSlide = pagerWidth - elSize - settings.thumbMargin; 717 } 718 if (thumbSlide < 0) { 719 thumbSlide = 0; 720 } 721 this.move($pager, thumbSlide); 722 for (var i=0;i <= 14; i++){ 723 724 725 726 } 727 }, 728 auto: function () { 729 if (settings.auto) { 730 clearInterval(interval); 731 interval = setInterval(function () { 732 $el.goToNextSlide(); 733 }, settings.pause); 734 } 735 }, 736 pauseOnHover: function(){ 737 var $this = this; 738 if (settings.auto && settings.pauseOnHover) { 739 $slide.on('mouseenter', function(){ 740 $(this).addClass('ls-hover'); 741 $el.pause(); 742 settings.auto = true; 743 }); 744 $slide.on('mouseleave',function(){ 745 $(this).removeClass('ls-hover'); 746 if (!$slide.find('.lightSlider').hasClass('lsGrabbing')) { 747 $this.auto(); 748 } 749 }); 750 } 751 }, 752 touchMove: function (endCoords, startCoords) { 753 $slide.css('transition-duration', '0ms'); 754 if (settings.mode === 'slide') { 755 var distance = endCoords - startCoords; 756 var swipeVal = slideValue - distance; 757 // console.log(slideValue) 758 if ((swipeVal) >= w - elSize - settings.slideMargin) { 759 if (settings.freeMove === false) { 760 swipeVal = w - elSize - settings.slideMargin; 761 } else { 762 var swipeValT = w - elSize - settings.slideMargin; 763 swipeVal = swipeValT + ((swipeVal - swipeValT) / 5); 764 765 } 766 } else if (swipeVal < 0) { 767 if (settings.freeMove === false) { 768 swipeVal = 0; 769 } else { 770 swipeVal = swipeVal / 5; 771 } 772 } 773 // if (swipeVal < ) 774 var touch_slider_width=$('#image-gallery').width(); 775 var items= $slide.find('.lslide').length; 776 // console.log((touch_slider_width/items)*(items-1)); 777 slidereffect = (touch_slider_width/items)*(items-1) ; 778 if ( swipeVal > slidereffect ) { slideflag = true } else { slideflag = false
vendor: 18,138 bytes, lines 778-1233
778 } 779 this.move($el, swipeVal); 780 } 781 }, 782 783 touchEnd: function (distance) { 784 $slide.css('transition-duration', settings.speed + 'ms'); 785 if (settings.mode === 'slide') { 786 var mxVal = false; 787 var _next = true; 788 slideValue = slideValue - distance; 789 if ((slideValue) > w - elSize - settings.slideMargin) { 790 slideValue = w - elSize - settings.slideMargin; 791 if (settings.autoWidth === false) { 792 mxVal = true; 793 } 794 } else if (slideValue < 0) { 795 slideValue = 0; 796 } 797 var gC = function (next) { 798 var ad = 0; 799 if (!mxVal) { 800 if (next) { 801 ad = 1; 802 } 803 } 804 if (!settings.autoWidth) { 805 var num = slideValue / ((slideWidth + settings.slideMargin) * settings.slideMove); 806 scene = parseInt(num) + ad; 807 if (slideValue >= (w - elSize - settings.slideMargin)) { 808 if (num % 1 !== 0) { 809 scene++; 810 } 811 } 812 } else { 813 var tW = 0; 814 for (var i = 0; i < $children.length; i++) { 815 tW += (parseInt($children.eq(i).width()) + settings.slideMargin); 816 scene = i + ad; 817 if (tW >= slideValue) { 818 break; 819 } 820 } 821 } 822 }; 823 if (distance >= settings.swipeThreshold) { 824 gC(false); 825 _next = false; 826 } else if (distance <= -settings.swipeThreshold) { 827 gC(true); 828 _next = false; 829 } 830 $el.mode(_next); 831 this.slideThumb(); 832 } else { 833 if (distance >= settings.swipeThreshold) { 834 $el.goToPrevSlide(); 835 } else if (distance <= -settings.swipeThreshold) { 836 $el.goToNextSlide(); 837 } 838 } 839 }, 840 841 842 843 enableDrag: function () { 844 var $this = this; 845 if (!isTouch) { 846 var startCoords = 0, 847 endCoords = 0, 848 isDraging = false; 849 $slide.find('.lightSlider').addClass('lsGrab'); 850 $slide.on('mousedown', function (e) { 851 if (w < elSize) { 852 if (w !== 0) { 853 return false; 854 } 855 } 856 if ($(e.target).attr('class') !== ('lSPrev') && $(e.target).attr('class') !== ('lSNext')) { 857 startCoords = (settings.vertical === true) ? e.pageY : e.pageX; 858 isDraging = true; 859 if (e.preventDefault) { 860 e.preventDefault(); 861 } else { 862 e.returnValue = false; 863 } 864 // ** Fix for webkit cursor issue https://code.google.com/p/chromium/issues/detail?id=26723 865 $slide.scrollLeft += 1; 866 $slide.scrollLeft -= 1; 867 // * 868 $slide.find('.lightSlider').removeClass('lsGrab').addClass('lsGrabbing'); 869 clearInterval(interval); 870 } 871 }); 872 $(window).on('mousemove', function (e) { 873 if (isDraging) { 874 endCoords = (settings.vertical === true) ? e.pageY : e.pageX; 875 $this.touchMove(endCoords, startCoords); 876 } 877 }); 878 $(window).on('mouseup', function (e) { 879 if (isDraging) { 880 $slide.find('.lightSlider').removeClass('lsGrabbing').addClass('lsGrab'); 881 isDraging = false; 882 endCoords = (settings.vertical === true) ? e.pageY : e.pageX; 883 var distance = endCoords - startCoords; 884 if (Math.abs(distance) >= settings.swipeThreshold) { 885 $(window).on('click.ls', function (e) { 886 if (e.preventDefault) { 887 e.preventDefault(); 888 } else { 889 e.returnValue = false; 890 } 891 e.stopImmediatePropagation(); 892 e.stopPropagation(); 893 $(window).off('click.ls'); 894 }); 895 } 896 897 $this.touchEnd(distance); 898 899 } 900 }); 901 } 902 }, 903 904 905 906 907 enableTouch: function () { 908 var $this = this; 909 if (isTouch) { 910 var startCoords = {}, 911 endCoords = {}; 912 $slide.on('touchstart', function (e) { 913 endCoords = e.originalEvent.targetTouches[0]; 914 startCoords.pageX = e.originalEvent.targetTouches[0].pageX; 915 startCoords.pageY = e.originalEvent.targetTouches[0].pageY; 916 clearInterval(interval); 917 }); 918 $slide.on('touchmove', function (e) { 919 if (w < elSize) { 920 if (w !== 0) { 921 return false; 922 } 923 } 924 var orig = e.originalEvent; 925 endCoords = orig.targetTouches[0]; 926 var xMovement = Math.abs(endCoords.pageX - startCoords.pageX); 927 var yMovement = Math.abs(endCoords.pageY - startCoords.pageY); 928 if (settings.vertical === true) { 929 if ((yMovement * 3) > xMovement) { 930 e.preventDefault(); 931 } 932 $this.touchMove(endCoords.pageY, startCoords.pageY); 933 } else { 934 if ((xMovement * 3) > yMovement) { 935 e.preventDefault(); 936 } 937 $this.touchMove(endCoords.pageX, startCoords.pageX); 938 } 939 940 }); 941 $slide.on('touchend', function () { 942 if (w < elSize) { 943 if (w !== 0) { 944 return false; 945 } 946 } 947 var distance; 948 if (settings.vertical === true) { 949 distance = endCoords.pageY - startCoords.pageY; 950 } else { 951 distance = endCoords.pageX - startCoords.pageX; 952 } 953 $this.touchEnd(distance); 954 }); 955 } 956 }, 957 build: function () { 958 var $this = this; 959 $this.initialStyle(); 960 if (this.doCss()) { 961 962 if (settings.enableTouch === true) { 963 $this.enableTouch(); 964 } 965 if (settings.enableDrag === true) { 966 $this.enableDrag(); 967 } 968 } 969 970 $(window).on('focus', function(){ 971 $this.auto(); 972 }); 973 974 $(window).on('blur', function(){ 975 clearInterval(interval); 976 }); 977 978 $this.pager(); 979 $this.pauseOnHover(); 980 $this.controls(); 981 $this.keyPress(); 982 } 983 }; 984 plugin.build(); 985 refresh.init = function () { 986 refresh.chbreakpoint(); 987 if (settings.vertical === true) { 988 if (settings.item > 1) { 989 elSize = settings.verticalHeight; 990 } else { 991 elSize = $children.outerHeight(); 992 } 993 $slide.css('height', elSize + 'px'); 994 } else { 995 elSize = $slide.outerWidth(); 996 } 997 if (settings.loop === true && settings.mode === 'slide') { 998 refresh.clone(); 999 } 1000 refresh.calL(); 1001 if (settings.mode === 'slide') { 1002 $el.removeClass('lSSlide'); 1003 } 1004 if (settings.mode === 'slide') { 1005 refresh.calSW(); 1006 refresh.sSW(); 1007 } 1008 setTimeout(function () { 1009 if (settings.mode === 'slide') { 1010 $el.addClass('lSSlide'); 1011 } 1012 }, 1000); 1013 if (settings.pager) { 1014 refresh.createPager(); 1015 } 1016 if (settings.adaptiveHeight === true && settings.vertical === false) { 1017 $el.css('height', $children.eq(scene).outerHeight(true)); 1018 } 1019 if (settings.adaptiveHeight === false) { 1020 if (settings.mode === 'slide') { 1021 if (settings.vertical === false) { 1022 plugin.setHeight($el, false); 1023 }else{ 1024 plugin.auto(); 1025 } 1026 } else { 1027 plugin.setHeight($el, true); 1028 } 1029 } 1030 if (settings.gallery === true) { 1031 plugin.slideThumb(); 1032 } 1033 if (settings.mode === 'slide') { 1034 plugin.slide(); 1035 } 1036 if (settings.autoWidth === false) { 1037 if ($children.length <= settings.item) { 1038 $slide.find('.lSAction').hide(); 1039 } else { 1040 $slide.find('.lSAction').show(); 1041 } 1042 } else { 1043 if ((refresh.calWidth(false) < elSize) && (w !== 0)) { 1044 $slide.find('.lSAction').hide(); 1045 } else { 1046 $slide.find('.lSAction').show(); 1047 } 1048 } 1049 }; 1050 $el.goToPrevSlide = function () { 1051 if (scene > 0) { 1052 settings.onBeforePrevSlide.call(this, $el, scene); 1053 scene--; 1054 $el.mode(false); 1055 if (settings.gallery === true) { 1056 plugin.slideThumb(); 1057 } 1058 } else { 1059 if (settings.loop === true) { 1060 settings.onBeforePrevSlide.call(this, $el, scene); 1061 if (settings.mode === 'fade') { 1062 var l = (length - 1); 1063 scene = parseInt(l / settings.slideMove); 1064 } 1065 $el.mode(false); 1066 if (settings.gallery === true) { 1067 plugin.slideThumb(); 1068 } 1069 } else if (settings.slideEndAnimation === true) { 1070 $el.addClass('leftEnd'); 1071 setTimeout(function () { 1072 $el.removeClass('leftEnd'); 1073 }, 400); 1074 } 1075 } 1076 }; 1077 $el.goToNextSlide = function () { 1078 var nextI = true; 1079 if (settings.mode === 'slide') { 1080 var _slideValue = plugin.slideValue(); 1081 nextI = _slideValue < w - elSize - settings.slideMargin; 1082 } 1083 if (((scene * settings.slideMove) < length - settings.slideMove) && nextI) { 1084 settings.onBeforeNextSlide.call(this, $el, scene); 1085 scene++; 1086 $el.mode(false); 1087 if (settings.gallery === true) { 1088 plugin.slideThumb(); 1089 } 1090 } else { 1091 if (settings.loop === true) { 1092 settings.onBeforeNextSlide.call(this, $el, scene); 1093 scene = 0; 1094 $el.mode(false); 1095 if (settings.gallery === true) { 1096 plugin.slideThumb(); 1097 } 1098 } else if (settings.slideEndAnimation === true) { 1099 $el.addClass('rightEnd'); 1100 setTimeout(function () { 1101 $el.removeClass('rightEnd'); 1102 }, 400); 1103 } 1104 } 1105 }; 1106 $el.mode = function (_touch) { 1107 if (settings.adaptiveHeight === true && settings.vertical === false) { 1108 $el.css('height', $children.eq(scene).outerHeight(true)); 1109 } 1110 if (on === false) { 1111 if (settings.mode === 'slide') { 1112 if (plugin.doCss()) { 1113 $el.addClass('lSSlide'); 1114 if (settings.speed !== '') { 1115 $slide.css('transition-duration', settings.speed + 'ms'); 1116 } 1117 if (settings.cssEasing !== '') { 1118 $slide.css('transition-timing-function', settings.cssEasing); 1119 } 1120 } 1121 } else { 1122 if (plugin.doCss()) { 1123 if (settings.speed !== '') { 1124 $el.css('transition-duration', settings.speed + 'ms'); 1125 } 1126 if (settings.cssEasing !== '') { 1127 $el.css('transition-timing-function', settings.cssEasing); 1128 } 1129 } 1130 } 1131 } 1132 if (!_touch) { 1133 settings.onBeforeSlide.call(this, $el, scene); 1134 } 1135 if (settings.mode === 'slide') { 1136 plugin.slide(); 1137 } else { 1138 plugin.fade(); 1139 } 1140 if (!$slide.hasClass('ls-hover')) { 1141 plugin.auto(); 1142 } 1143 setTimeout(function () { 1144 if (!_touch) { 1145 settings.onAfterSlide.call(this, $el, scene); 1146 } 1147 }, settings.speed); 1148 on = true; 1149 }; 1150 $el.play = function () { 1151 $el.goToNextSlide(); 1152 settings.auto = true; 1153 plugin.auto(); 1154 }; 1155 $el.pause = function () { 1156 settings.auto = false; 1157 clearInterval(interval); 1158 }; 1159 $el.refresh = function () { 1160 refresh.init(); 1161 }; 1162 $el.getCurrentSlideCount = function () { 1163 var sc = scene; 1164 if (settings.loop) { 1165 var ln = $slide.find('.lslide').length, 1166 cl = $el.find('.clone.left').length; 1167 if (scene <= cl - 1) { 1168 sc = ln + (scene - cl); 1169 } else if (scene >= (ln + cl)) { 1170 sc = scene - ln - cl; 1171 } else { 1172 sc = scene - cl; 1173 } 1174 } 1175 return sc + 1; 1176 }; 1177 $el.getTotalSlideCount = function () { 1178 return $slide.find('.lslide').length; 1179 }; 1180 $el.goToSlide = function (s) { 1181 if (settings.loop) { 1182 scene = (s + $el.find('.clone.left').length - 1); 1183 } else { 1184 scene = s; 1185 } 1186 $el.mode(false); 1187 if (settings.gallery === true) { 1188 plugin.slideThumb(); 1189 } 1190 }; 1191 $el.destroy = function () { 1192 if ($el.lightSlider) { 1193 $el.goToPrevSlide = function(){}; 1194 $el.goToNextSlide = function(){}; 1195 $el.mode = function(){}; 1196 $el.play = function(){}; 1197 $el.pause = function(){}; 1198 $el.refresh = function(){}; 1199 $el.getCurrentSlideCount = function(){}; 1200 $el.getTotalSlideCount = function(){}; 1201 $el.goToSlide = function(){}; 1202 $el.lightSlider = null; 1203 refresh = { 1204 init : function(){} 1205 }; 1206 $el.parent().parent().find('.lSAction, .lSPager').remove(); 1207 $el.removeClass('lightSlider lSFade lSSlide lsGrab lsGrabbing leftEnd right').removeAttr('style').unwrap().unwrap(); 1208 $el.children().removeAttr('style'); 1209 $children.removeClass('lslide active'); 1210 $el.find('.clone').remove(); 1211 $children = null; 1212 interval = null; 1213 on = false; 1214 scene = 0; 1215 } 1216 1217 }; 1218 setTimeout(function () { 1219 settings.onSliderLoad.call(this, $el); 1220 }, 10); 1221 $(window).on('resize orientationchange', function (e) { 1222 setTimeout(function () { 1223 if (e.preventDefault) { 1224 e.preventDefault(); 1225 } else { 1226 e.returnValue = false; 1227 } 1228 refresh.init(); 1229 }, 200); 1230 }); 1231 return this; 1232 }; 1233}(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.