vendor: 3,595 bytes, lines 1-88
1/******/ (function(modules) { // webpackBootstrap 2/******/ // The module cache 3/******/ var installedModules = {}; 4/******/ 5/******/ // The require function 6/******/ function __webpack_require__(moduleId) { 7/******/ 8/******/ // Check if module is in cache 9/******/ if(installedModules[moduleId]) { 10/******/ return installedModules[moduleId].exports; 11/******/ } 12/******/ // Create a new module (and put it into the cache) 13/******/ var module = installedModules[moduleId] = { 14/******/ i: moduleId, 15/******/ l: false, 16/******/ exports: {} 17/******/ }; 18/******/ 19/******/ // Execute the module function 20/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 21/******/ 22/******/ // Flag the module as loaded 23/******/ module.l = true; 24/******/ 25/******/ // Return the exports of the module 26/******/ return module.exports; 27/******/ } 28/******/ 29/******/ 30/******/ // expose the modules object (__webpack_modules__) 31/******/ __webpack_require__.m = modules; 32/******/ 33/******/ // expose the module cache 34/******/ __webpack_require__.c = installedModules; 35/******/ 36/******/ // define getter function for harmony exports 37/******/ __webpack_require__.d = function(exports, name, getter) { 38/******/ if(!__webpack_require__.o(exports, name)) { 39/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); 40/******/ } 41/******/ }; 42/******/ 43/******/ // define __esModule on exports 44/******/ __webpack_require__.r = function(exports) { 45/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { 46/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); 47/******/ } 48/******/ Object.defineProperty(exports, '__esModule', { value: true }); 49/******/ }; 50/******/ 51/******/ // create a fake namespace object 52/******/ // mode & 1: value is a module id, require it 53/******/ // mode & 2: merge all properties of value into the ns 54/******/ // mode & 4: return value when already ns object 55/******/ // mode & 8|1: behave like require 56/******/ __webpack_require__.t = function(value, mode) { 57/******/ if(mode & 1) value = __webpack_require__(value); 58/******/ if(mode & 8) return value; 59/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; 60/******/ var ns = Object.create(null); 61/******/ __webpack_require__.r(ns); 62/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); 63/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); 64/******/ return ns; 65/******/ }; 66/******/ 67/******/ // getDefaultExport function for compatibility with non-harmony modules 68/******/ __webpack_require__.n = function(module) { 69/******/ var getter = module && module.__esModule ? 70/******/ function getDefault() { return module['default']; } : 71/******/ function getModuleExports() { return module; }; 72/******/ __webpack_require__.d(getter, 'a', getter); 73/******/ return getter; 74/******/ }; 75/******/ 76/******/ // Object.prototype.hasOwnProperty.call 77/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; 78/******/ 79/******/ // __webpack_public_path__ 80/******/ __webpack_require__.p = "/"; 81/******/ 82/******/ 83/******/ // Load entry module and return exports 84/******/ return __webpack_require__(__webpack_require__.s = 2); 85/******/ }) 86/************************************************************************/ 87/******/ ({ 88
89/***/ "./assets/scripts/components/article-header.js": 90/*!*****************************************************!*\ 91 !*** ./assets/scripts/components/article-header.js ***! 92 \*****************************************************/ 93/*! no exports provided */ 94/***/ (function(module, __webpack_exports__, __webpack_require__) { 95 96 "use strict"; 97 __webpack_require__.r(__webpack_exports__); 98 /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "jquery"); 99 /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__); 100 101 var $header = jquery__WEBPACK_IMPORTED_MODULE_0___default()('.sf-article-header'); 102 103 if ($header.length && 'objectFit' in document.documentElement.style === false) { 104 var $image = $header.children('.sf-article-header__image'); 105 106 if ($image.length) { 107 $header.css('backgroundImage', "url(".concat($image.prop('src'), ")")).addClass('sf-article-header--object-fit'); 108 } 109 } 110 111 /***/ }), 112 113
113/***/ "./assets/scripts/components/card.js": 114 /*!*******************************************!*\ 115 !*** ./assets/scripts/components/card.js ***! 116 \*******************************************/ 117 /*! no exports provided */ 118 /***/ (function(module, __webpack_exports__, __webpack_require__) { 119 120 "use strict"; 121 __webpack_require__.r(__webpack_exports__); 122 /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "jquery"); 123 /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__); 124 125 126 if (!('objectFit' in document.documentElement.style)) { 127 jquery__WEBPACK_IMPORTED_MODULE_0___default()('.sf-card__image-link, .sf-featured__header, .sf-profile__image, .sf-hero-header__image, .gallery-icon').each(function () { 128 var $container = jquery__WEBPACK_IMPORTED_MODULE_0___default()(this); 129 var imgUrl = $container.find('img').prop('src'); 130 131 if (imgUrl) { 132 $container.css('backgroundImage', 'url(' + imgUrl + ')').addClass('object-fit'); 133 } 134 }); 135 } 136 137 /***/ }), 138 139
139/***/ "./assets/scripts/components/carousel.js": 140 /*!***********************************************!*\ 141 !*** ./assets/scripts/components/carousel.js ***! 142 \***********************************************/ 143 /*! no exports provided */ 144 /***/ (function(module, __webpack_exports__, __webpack_require__) { 145 146 "use strict"; 147 __webpack_require__.r(__webpack_exports__); 148 /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "jquery"); 149 /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__); 150 /* harmony import */ var slick_carousel__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! slick-carousel */ "./node_modules/slick-carousel/slick/slick.js"); 151 /* harmony import */ var slick_carousel__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(slick_carousel__WEBPACK_IMPORTED_MODULE_1__); 152 153 154 var $carousel = jquery__WEBPACK_IMPORTED_MODULE_0___default()('.sf-carousel'); 155 const $homeSlider = jquery__WEBPACK_IMPORTED_MODULE_0___default()('.homeSlider'); 156 const $latestNewsSlider = jquery__WEBPACK_IMPORTED_MODULE_0___default()('.newsContainer'); 157 const $missionVisionSlider = jquery__WEBPACK_IMPORTED_MODULE_0___default()('#missionVisionSlider'); 158 const $projectsSlider = jquery__WEBPACK_IMPORTED_MODULE_0___default()('#projectsContainer'); 159 const $newsletterRecentSlider = jquery__WEBPACK_IMPORTED_MODULE_0___default()('#newsletterRecentContainer'); 160 const $trainingRecentSlider = jquery__WEBPACK_IMPORTED_MODULE_0___default()('#recentTrainingNewsSlider'); 161 162 // New Home Slider 163 if ($homeSlider.length) { 164 $homeSlider.slick({ 165 responsive: [{ 166 breakpoint: 768, 167 settings: { 168 dots:true, 169 arrows: false, 170 } 171 }], 172 slidesToShow: 1, 173 slidesToScroll: 1, 174 infinite: true, 175 autoplay: true, 176 autoplaySpeed: 5000, 177 prevArrow: '<button type="button" class="slick-prev"><img src="/content/themes/cimmyt/assets/images/prev_arrow.svg" /></button>', 178 nextArrow: '<button type="button" class="slick-next"><img src="/content/themes/cimmyt/assets/images/next_arrow.svg" /></button>' 179 }); 180 $homeSlider.removeClass('invisible'); 181 } 182 183 // Mission & Vision Slider 184 if ($missionVisionSlider.length) { 185 $missionVisionSlider.slick({ 186 dots: true, 187 arrows: false, 188 autoplay: false, 189 slidesToShow: 1, 190 slidesToScroll: 1, 191 }); 192 } 193 194 // Latest Newsletters Mobile Slider 195 let $newsletterRecentSliderActive = false; 196 if ($newsletterRecentSlider.length) { 197 198 function newsletterRecentSliderChange(){ 199 if(jquery__WEBPACK_IMPORTED_MODULE_0___default()(window).width() < 769){ 200 if(!$newsletterRecentSliderActive){ 201 $newsletterRecentSlider.slick({ 202 slidesToShow: 1, 203 slidesToScroll: 1, 204 infinite: true, 205 autoplay: true, 206 autoplaySpeed: 5000, 207 arrows: false, 208 dots: true, 209 }); 210 $newsletterRecentSliderActive = true; 211 } 212 } else if(jquery__WEBPACK_IMPORTED_MODULE_0___default()(window).width() > 768) { 213 if($newsletterRecentSliderActive){ 214 $newsletterRecentSlider.slick('unslick'); 215 $newsletterRecentSliderActive = false; 216 } 217 } 218 }; 219 220 newsletterRecentSliderChange(); 221 222 jquery__WEBPACK_IMPORTED_MODULE_0___default()(window).on('resize', function(){ 223 newsletterRecentSliderChange(); 224 }); 225 } 226 227 228 // Latest News Mobile Slider 229 let $sliderActive = false;
230 231 if ($latestNewsSlider.length) { 232 233 function latestNewsSliderChange(){ 234 if(jquery__WEBPACK_IMPORTED_MODULE_0___default()(window).width() < 769){ 235 if(!$sliderActive){ 236 $latestNewsSlider.slick({ 237 slidesToShow: 1, 238 slidesToScroll: 1, 239 infinite: true, 240 autoplay: true, 241 autoplaySpeed: 5000, 242 arrows: false, 243 dots: true, 244 }); 245 $sliderActive = true; 246 } 247 } else if(jquery__WEBPACK_IMPORTED_MODULE_0___default()(window).width() > 768) { 248 if($sliderActive){ 249 $latestNewsSlider.slick('unslick'); 250 $sliderActive = false; 251 } 252 } 253 }; 254 255 latestNewsSliderChange(); 256 257 jquery__WEBPACK_IMPORTED_MODULE_0___default()(window).on('resize', function(){ 258 latestNewsSliderChange(); 259 }); 260 } 261 262 // Latest Projects Mobile Slider 263 let $sliderProjectsActive = false; 264 if ($projectsSlider.length) { 265 266 function projectsSliderChange(){ 267 if(jquery__WEBPACK_IMPORTED_MODULE_0___default()(window).width() < 769){ 268 if(!$sliderProjectsActive){ 269 $projectsSlider.slick({ 270 slidesToShow: 1, 271 slidesToScroll: 1, 272 infinite: true, 273 autoplay: true, 274 autoplaySpeed: 5000, 275 arrows: false, 276 dots: true, 277 }); 278 $sliderProjectsActive = true; 279 } 280 } else if(jquery__WEBPACK_IMPORTED_MODULE_0___default()(window).width() > 768) { 281 if($sliderProjectsActive){ 282 $projectsSlider.slick('unslick'); 283 $sliderProjectsActive = false; 284 } 285 } 286 }; 287 288 projectsSliderChange(); 289 290 jquery__WEBPACK_IMPORTED_MODULE_0___default()(window).on('resize', function(){ 291 projectsSliderChange(); 292 }); 293 } 294 295 // Latest Training News Mobile Slider 296 let $latestTrainingNewsActive = false; 297 if ($trainingRecentSlider.length) { 298 299 function trainingRecentSliderChange(){ 300 if(jquery__WEBPACK_IMPORTED_MODULE_0___default()(window).width() < 769){ 301 if(!$latestTrainingNewsActive){ 302 $trainingRecentSlider.slick({ 303 slidesToShow: 1, 304 slidesToScroll: 1, 305 infinite: true, 306 autoplay: true, 307 autoplaySpeed: 5000, 308 arrows: false, 309 dots: false, 310 }); 311 $latestTrainingNewsActive = true; 312 } 313 } else if(jquery__WEBPACK_IMPORTED_MODULE_0___default()(window).width() > 768) { 314 if($latestTrainingNewsActive){ 315 $trainingRecentSlider.slick('unslick'); 316 $latestTrainingNewsActive = false; 317 } 318 } 319 }; 320 321 trainingRecentSliderChange(); 322 323 jquery__WEBPACK_IMPORTED_MODULE_0___default()(window).on('resize', function(){ 324 trainingRecentSliderChange(); 325 }); 326 } 327 328 if ($carousel.length) { 329 $carousel.slick({ 330 responsive: [{ 331 breakpoint: 1000, 332 settings: { 333 slidesToShow: 1, 334 slidesToScroll: 1 335 } 336 }], 337 autoplay: false, 338 autoplaySpeed: 5000 339 }); 340 341 setTimeout(function(){var stHeight = jquery__WEBPACK_IMPORTED_MODULE_0___default()( 342 ".slick-track" 343 ).height(); 344 jquery__WEBPACK_IMPORTED_MODULE_0___default()(".slick-slide").css( 345 "height", 346 stHeight + "px" 347 );}, 1500); 348 jquery__WEBPACK_IMPORTED_MODULE_0___default()(".slick-cloned").each( 349 function() { 350 jquery__WEBPACK_IMPORTED_MODULE_0___default()(this) 351 .find(".gallery-item a") 352 .removeAttr( 353 "data-slb-active data-slb-asset data-slb-internal data-slb-group" 354 ); 355 } 356 ); 357 } 358 359 360 /*var $gallery = jquery__WEBPACK_IMPORTED_MODULE_0___default()('.sf-article-content .gallery'); 361 362 if ($gallery.length) { 363 364 $gallery.slick({ 365 responsive: [{ 366 breakpoint: 1000, 367 settings: { 368 slidesToShow: 1, 369 slidesToScroll: 1 370 } 371 }], 372 autoplay: false, 373 autoplaySpeed: 5000 374 }); 375 376 }*/ 377 378 if (jquery__WEBPACK_IMPORTED_MODULE_0___default()('.home .sf-carou
378sel').length) { 379 jquery__WEBPACK_IMPORTED_MODULE_0___default()(document).ready(function () { 380 jquery__WEBPACK_IMPORTED_MODULE_0___default()('.slick-slide').each(function () { 381 var img = jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).find('img').attr('src'); 382 jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).find('img').hide(); 383 jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).find('.sf-card__header').css('background-image', 'url("' + img + '")'); 384 }); 385 }); 386 } 387 388 if (jquery__WEBPACK_IMPORTED_MODULE_0___default()('.sf-carousel-people').length > 0 && jquery__WEBPACK_IMPORTED_MODULE_0___default()('.sf-carousel-people .sf-card').length > 3) { 389 jquery__WEBPACK_IMPORTED_MODULE_0___default()('.sf-carousel-people').slick({ 390 slidesToShow: 3, 391 slidesToScroll: 3, 392 autoplay: false, 393 infinite: false, 394 responsive: [{ 395 breakpoint: 1000, 396 settings: { 397 slidesToShow: 1, 398 slidesToScroll: 1 399 } 400 }] 401 }); 402 var stHeight2 = jquery__WEBPACK_IMPORTED_MODULE_0___default()('.sf-carousel-people .slick-track').height(); 403 jquery__WEBPACK_IMPORTED_MODULE_0___default()('.sf-carousel-people .slick-slide, .sf-carousel-people .slick-slide > div, .sf-carousel-people .slick-slide > div > div').css('height', stHeight2 + 'px'); 404 } 405 406 if (jquery__WEBPACK_IMPORTED_MODULE_0___default()('.sf-carousel-orcid').length > 0 && jquery__WEBPACK_IMPORTED_MODULE_0___default()('.sf-carousel-orcid .sf-card').length > 3) { 407 jquery__WEBPACK_IMPORTED_MODULE_0___default()('.sf-carousel-orcid').slick({ 408 slidesToShow: 3, 409 slidesToScroll: 3, 410 autoplay: false, 411 infinite: false, 412 responsive: [{ 413 breakpoint: 1000, 414 settings: { 415 slidesToShow: 1, 416 slidesToScroll: 1 417 } 418 }] 419 }); 420 var stHeight3 = jquery__WEBPACK_IMPORTED_MODULE_0___default()('.sf-carousel-orcid .slick-track').height(); 421 jquery__WEBPACK_IMPORTED_MODULE_0___default()('.sf-carousel-orcid .slick-slide, .sf-carousel-orcid .slick-slide > div, .sf-carousel-orcid .slick-slide > div > div').css('height', stHeight3 + 'px'); 422 } 423 424 /***/ }), 425 426
426/***/ "./assets/scripts/components/contents-link.js": 427 /*!****************************************************!*\ 428 !*** ./assets/scripts/components/contents-link.js ***! 429 \****************************************************/ 430 /*! no exports provided */ 431 /***/ (function(module, __webpack_exports__, __webpack_require__) { 432 433 "use strict"; 434 __webpack_require__.r(__webpack_exports__); 435 /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "jquery"); 436 /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__); 437 438 var $links = jquery__WEBPACK_IMPORTED_MODULE_0___default()('.sf-contents-link'); 439 var $root = jquery__WEBPACK_IMPORTED_MODULE_0___default()('html, body'); 440 441 if ($links.length) { 442 $links.on('click', function (e) { 443 e.preventDefault(); 444 var target = this.hash; 445 var $target = jquery__WEBPACK_IMPORTED_MODULE_0___default()(target); 446 $root.stop().animate({ 447 'scrollTop': $target.offset().top - 110 448 }, 900, 'swing', function () { 449 window.location.hash = target; 450 }); 451 }); 452 } 453 454 /***/ }), 455 456
456/***/ "./assets/scripts/components/contents.js": 457 /*!***********************************************!*\ 458 !*** ./assets/scripts/components/contents.js ***! 459 \***********************************************/ 460 /*! no exports provided */ 461 /***/ (function(module, __webpack_exports__, __webpack_require__) { 462 463 "use strict"; 464 __webpack_require__.r(__webpack_exports__); 465 /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "jquery"); 466 /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__); 467 var _this = undefined; 468 469 470 var $links = jquery__WEBPACK_IMPORTED_MODULE_0___default()('.sf-contents__link'); 471 var $root = jquery__WEBPACK_IMPORTED_MODULE_0___default()('html, body'); 472 473 if ($links.length) { 474 $links.on('click', function (e) { 475 e.preventDefault(); 476 var target = _this.hash; 477 var $target = jquery__WEBPACK_IMPORTED_MODULE_0___default()(target); 478 $root.stop().animate({ 479 'scrollTop': $target.offset().top - 110 480 }, 900, 'swing', function () { 481 window.location.hash = target; 482 }); 483 }); 484 } 485 486 jquery__WEBPACK_IMPORTED_MODULE_0___default()('.filter-list__group input[value=" "]').parent().hide(); 487 488 489 if (jquery__WEBPACK_IMPORTED_MODULE_0___default()('#filter-archive').length > 0) { 490 jquery__WEBPACK_IMPORTED_MODULE_0___default()(document).ready(function () { 491 var fdd = false; 492 jquery__WEBPACK_IMPORTED_MODULE_0___default()('#filter-archive select').each(function () { 493 if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).val() != 0) fdd = true; 494 }); 495 if (!fdd) jquery__WEBPACK_IMPORTED_MODULE_0___default()('#filter-btn').attr('disabled', 'disabled');else jquery__WEBPACK_IMPORTED_MODULE_0___default()('#filter-btn').removeAttr('disabled'); 496 }); 497 jquery__WEBPACK_IMPORTED_MODULE_0___default()('#clear-filters').click(function () { 498 jquery__WEBPACK_IMPORTED_MODULE_0___default()('#filter-archive select').val(0); 499 jquery__WEBPACK_IMPORTED_MODULE_0___default()('#filter-archive input[type=text]').val(""); 500 jquery__WEBPACK_IMPORTED_MODULE_0___default()('#original-letter').val(""); 501 jquery__WEBPACK_IMPORTED_MODULE_0___default()('#filter-btn').removeAttr('disabled'); 502 /*var slug = $('#original-slug').val(); 503 var tax = $('#original-tax').val(); 504 switch( tax ){ 505 case 'category': $('#sel-category').val(slug); break; 506 case 'theme': $('#sel-theme').val(slug); break; 507 case 'location': $('#sel-location').val(slug); break; 508 case 'research': $('#sel-research').val(slug); break; 509 default: break; 510 }*/ 511 512 return false; 513 }); 514 515 jquery__WEBPACK_IMPORTED_MODULE_0___default()('#filter-archive').on('change', 'select', function () { 516 var flag = false; 517 jquery__WEBPACK_IMPORTED_MODULE_0___default()('#filter-archive select').each(function () { 518 if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).val() != 0) flag = true; 519 }); 520 if (!flag) jquery__WEBPACK_IMPORTED_MODULE_0___default()('#filter-btn').attr('disabled', 'disabled');else jquery__WEBPACK_IMPORTED_MODULE_0___default()('#filter-btn').removeAttr('disabled'); 521 }); 522 523 if (jquery__WEBPACK_IMPORTED_MODULE_0___default()('#filter-archive').find("input[type=text]").length > 0) { 524 jquery__WEBPACK_IMPORTED_MODULE_0___default()('#filter-archive').on('keyup', 'input[type=text]', function () { 525 if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).val() == "") jquery__WEBPACK_IMPORTED_MODULE_0___default()('#filter-btn').attr('disabled', 'disabled');else jquery__WEBPACK_IMPORTED_MODULE_0___default()('#filter-btn').removeAttr('disabled'); 526 }); 527 } 528 529 if (jquery__WEBPACK_IMPORTED_MODULE_0___default()('#filter-archive').find(".filter-list input").length > 0) { 530 jquery__WEBPACK_IMPORTED_MODULE_0___default()('.filter-list button').on('click', function () { 531 jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).parent().parent().find("input").click(); 532 }); 533 } 534 535 536 } 537 538 if (jquery__WEBPACK_IMPORTED_MODULE_0___default()('.sf-content-main--people').length > 0) {// $('.sf-content-main--people img').wrap('<div class="people-pp"></div>'); 539 } 540 541 if (jquery__WEBPACK_IMPORTED_MODULE_0___default()('img.large').length > 0 && jquery__WEBPACK_IMPORTED_MODULE_0___default()('.sf-template--feature').length > 0) { 542 jquery__WEBPACK_IMPORTED_MODULE_0___default()('img.large').each(function () { 543 if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).parent().is('figure')) { 544 jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).parent().wrap('<div class="large-img"></div>'); 545 } 546 }); 547 } 548 549 if (jquery__WEBPACK_IMPORTED_MODULE_0___default()('img.full-width').length > 0 && jquery__WEBPACK_IMPORTED_MODULE_0___default()('.sf-template--feature').length > 0) { 550 jquery__WEBPACK_IMPORTED_MODULE_0___default()('img.full-width').each(function () { 551 if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).parent().is('figure')) { 552 jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).parent().wrap('<div class="full-width"></div>'); 553 } 554 }); 555 } 556 557 if (jquery__WEBPACK_IMPORTED_MODULE_0___default()('img.parallax').length > 0 && jquery__WEBPACK_IMPORTED_MODULE_0___default()('.sf-template--feature').length > 0) { 558 jquery__WEBPACK_IMPORTED_MODULE_0___default()('img.parallax').each(function () { 559 if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).parent().is('figure')) { 560 var img = jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).parent().find('img').attr('src'); 561 var caption = jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).parent().find('figcaption').html(); 562 jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).parent().wrap('<div class="parallax-block"><div class="parallax-block--img" style="background-image:url(' + img + ')"></div><div class="parallax-block--caption">' + caption + '</div></div>'); 563 jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).parent().find('figcaption, img').remove(); 564 } 565 }); 566 } 567 568 jquery__WEBPACK_IMPORTED_MODULE_0___default()('.sf-article-content__text [class*="drop-two"]').html(function (i, html) { 569 if (checkIfTagExists(html, 'strong')) jquery__WEBPACK_IMPORTED_MODULE_0___default()('.sf-article-content__text [class*="drop-two"] strong').html(function (i, html) { 570 return '<span class="cap">' + html.charAt(0) + html.charAt(1) + '</span>' + html.substring(2, html.length); 571 });else return '<span class="cap">' + html.charAt(0) + html.charAt(1) + '</span>' + html.substring(2, html.length); 572 }); 573 jquery__WEBPACK_IMPORTED_MODULE_0___default()('.sf-article-content__text [class*="drop-cap"]').html(function (i, html) { 574 if (!isNaN(html.charAt(0))) { 575 if (!isNaN(html.charAt(1))) return '<span class="cap">' + html.charAt(0) + html.charAt(1) + '</span>' + html.substring(2, html.length);else return '<span class="cap">' + html.charAt(0) + '</span>' + html.substring(1, html.length); 576 } else { 577 if (checkIfTagExists(html, 'strong')) jquery__WEBPACK_IMPORTED_MODULE_0___default()('.sf-article-content__text [class*="drop-cap"] strong').html(function (i, html) { 578 // return html.replace(/^[^a-zA-Z'"<]*([a-zA-Z])/g, '<span class="cap">$1</span>'); 579 return '<span class="cap">' + html.charAt(0) + '</span>' + html.substring(1, html.length); 580 });else return '<span class="cap">' + html.charAt(0) + '</span>' + html.substring(1, html.length); // else return html.replace(/^[^0-9a-zA-Z'"<]*([a-zA-Z])/g, '<span class="cap">$1</span>'); 581 } 582 }); 583 584 function checkIfTagExists(str, tag) { 585 return new RegExp('<' + tag + '[^>]*>', 'g').test(str); 586 } 587 588 /***/ }), 589 590
590/***/ "./assets/scripts/components/cta-tracker.js": 591 /*!**************************************************!*\ 592 !*** ./assets/scripts/components/cta-tracker.js ***! 593 \**************************************************/ 594 /*! no exports provided */ 595 /***/ (function(module, __webpack_exports__, __webpack_require__) { 596 597 "use strict"; 598 __webpack_require__.r(__webpack_exports__); 599 /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "jquery"); 600 /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__); 601 602 var $trackers = jquery__WEBPACK_IMPORTED_MODULE_0___default()('.sf-cta__tracker'); 603 604 if (!$trackers.length) { 605 $trackers.each(function (i, el) { 606 var $tracker = jquery__WEBPACK_IMPORTED_MODULE_0___default()(el); 607 var $clickable = $tracker.children().andSelf(); 608 var category = $tracker.data('category'); 609 var action = $tracker.data('action'); 610 var label = $tracker.data('label'); 611 var value = $tracker.data('value'); 612 $clickable.on('click', function () { 613 // eslint-disable-next-line no-undef 614 window.ga && ga('send', 'event', category, action, label, value); 615 }); 616 }); 617 } 618 619 /***/ }), 620 621
621/***/ "./assets/scripts/components/header-search-toggle.js": 622 /*!***********************************************************!*\ 623 !*** ./assets/scripts/components/header-search-toggle.js ***! 624 \***********************************************************/ 625 /*! no exports provided */ 626 /***/ (function(module, __webpack_exports__, __webpack_require__) { 627 628 "use strict"; 629 __webpack_require__.r(__webpack_exports__); 630 /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "jquery"); 631 /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__); 632 633 var $document = jquery__WEBPACK_IMPORTED_MODULE_0___default()(document); 634 jquery__WEBPACK_IMPORTED_MODULE_0___default()('.sf-header-search-toggle').on('click', function (e) { 635 e.preventDefault(); 636 $document.trigger('header-search-toggle.click'); 637 }); 638 639 /***/ }), 640 641
641/***/ "./assets/scripts/components/header-search.js": 642 /*!****************************************************!*\ 643 !*** ./assets/scripts/components/header-search.js ***! 644 \****************************************************/ 645 /*! no exports provided */ 646 /***/ (function(module, __webpack_exports__, __webpack_require__) { 647 648 "use strict"; 649 __webpack_require__.r(__webpack_exports__); 650 /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "jquery"); 651 /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__); 652 653 var $headerSearch = jquery__WEBPACK_IMPORTED_MODULE_0___default()('.sf-header-search'); 654 var $headerSearchInput = $headerSearch.find('.sf-header-search__input'); 655 var $menuItems = jquery__WEBPACK_IMPORTED_MODULE_0___default()('.sf-primary-menu'); 656 var $donateMenu = jquery__WEBPACK_IMPORTED_MODULE_0___default()('.sf-donate-menu'); 657 var $searchToggle = jquery__WEBPACK_IMPORTED_MODULE_0___default()('.sf-header-search-toggle-link--search'); 658 var $searchDismiss = jquery__WEBPACK_IMPORTED_MODULE_0___default()('.sf-header-search-toggle-link--dismiss'); 659 var $sfLogo = jquery__WEBPACK_IMPORTED_MODULE_0___default()('.sf-logo'); 660 jquery__WEBPACK_IMPORTED_MODULE_0___default()(document).on('header-search-toggle.click', function () { 661 $headerSearch.toggleClass('sf-header-search--is-opened'); 662 $menuItems.toggleClass('sf-primary-menu--hide'); 663 $donateMenu.toggleClass('sf-donate-menu--hide'); 664 $searchToggle.toggleClass('sf-header-search-toggle-link--search-hide'); 665 $searchDismiss.toggleClass('sf-header-search-toggle-link--dismiss-hide'); 666 $sfLogo.toggleClass('sf-logo--hidden'); 667 $headerSearchInput.focus(); 668 }); 669 670 /***/ }), 671 672
672/***/ "./assets/scripts/components/header-sticky.js": 673 /*!****************************************************!*\ 674 !*** ./assets/scripts/components/header-sticky.js ***! 675 \****************************************************/ 676 /*! no exports provided */ 677 /***/ (function(module, __webpack_exports__, __webpack_require__) { 678 679 "use strict"; 680 __webpack_require__.r(__webpack_exports__); 681 /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "jquery"); 682 /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__); 683 684 var $window = jquery__WEBPACK_IMPORTED_MODULE_0___default()(window); 685 $window.on('scroll resize', function () { 686 var $header = jquery__WEBPACK_IMPORTED_MODULE_0___default()('.sf-header'), 687 headerHeight = $header.height(), 688 scrollTop = $window.scrollTop(); 689 690 if ($window.width() >= 1000) { 691 if (scrollTop > headerHeight) { 692 $header.addClass('sf-header--sticky'); 693 } else if (scrollTop === 0) { 694 $header.removeClass('sf-header--sticky'); 695 } 696 } else { 697 $header.toggleClass('sf-header--sticky', scrollTop > 0); 698 } 699 }).on("scroll", ); 700 701 /***/ }), 702 703
703/***/ "./assets/scripts/components/no-blend-mode.js": 704 /*!****************************************************!*\ 705 !*** ./assets/scripts/components/no-blend-mode.js ***! 706 \****************************************************/ 707 /*! no static exports found */ 708 /***/ (function(module, exports) { 709 710 if (typeof window.getComputedStyle(document.body).backgroundBlendMode === 'undefined') { 711 document.documentElement.className += ' no-background-blend-mode'; 712 } 713 714 /***/ }), 715 716
716/***/ "./assets/scripts/components/primary-menu-toggle.js": 717 /*!**********************************************************!*\ 718 !*** ./assets/scripts/components/primary-menu-toggle.js ***! 719 \**********************************************************/ 720 /*! no exports provided */ 721 /***/ (function(module, __webpack_exports__, __webpack_require__) { 722 723 "use strict"; 724 __webpack_require__.r(__webpack_exports__); 725 /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "jquery"); 726 /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__); 727 728 var $document = jquery__WEBPACK_IMPORTED_MODULE_0___default()(document); 729 jquery__WEBPACK_IMPORTED_MODULE_0___default()('.sf-primary-menu-toggle').on('click', function () { 730 $document.trigger('primary-menu-toggle.click'); 731 }); 732 733 /***/ }), 734 735
735/***/ "./assets/scripts/components/primary-menu.js": 736 /*!***************************************************!*\ 737 !*** ./assets/scripts/components/primary-menu.js ***! 738 \***************************************************/ 739 /*! no exports provided */ 740 /***/ (function(module, __webpack_exports__, __webpack_require__) { 741 742 "use strict"; 743 __webpack_require__.r(__webpack_exports__); 744 /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "jquery"); 745 /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__); 746 747 var $menu = jquery__WEBPACK_IMPORTED_MODULE_0___default()('.sf-primary-menu'); 748 jquery__WEBPACK_IMPORTED_MODULE_0___default()(document).on('primary-menu-toggle.click', function () { 749 $menu.toggleClass('sf-primary-menu--is-opened'); // Close all sub menus when primary is closed 750 751 if (jquery__WEBPACK_IMPORTED_MODULE_0___default()('.sf-primary-menu--is-opened').length === 0) { 752 jquery__WEBPACK_IMPORTED_MODULE_0___default()('.sf-primary-menu__list--depth-1').slideUp(); 753 jquery__WEBPACK_IMPORTED_MODULE_0___default()('.sf-primary-menu__sub-toggle').removeClass('sf-primary-menu__sub-toggle--open'); 754 } 755 }); // Sub menu toggle 756 757 jquery__WEBPACK_IMPORTED_MODULE_0___default()('li.sf-primary-menu__item').has('ul.sf-primary-menu__list').prepend('<span class="sf-primary-menu__sub-toggle"></span>'); 758 jquery__WEBPACK_IMPORTED_MODULE_0___default()('span.sf-primary-menu__sub-toggle').on("click", function () { 759 jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).siblings('ul.sf-primary-menu__list').slideToggle(); 760 jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).toggleClass('sf-primary-menu__sub-toggle--open'); 761 }); // Page resize - close sub-menus 762 763 jquery__WEBPACK_IMPORTED_MODULE_0___default()(window).on('resize', function () { 764 if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(window).width() > 1000) { 765 jquery__WEBPACK_IMPORTED_MODULE_0___default()('.sf-primary-menu__list--depth-1').removeAttr('style'); 766 jquery__WEBPACK_IMPORTED_MODULE_0___default()('.sf-primary-menu__sub-toggle').removeClass('sf-primary-menu__sub-toggle--open'); 767 } 768 }); 769 770 /***/ }), 771 772
772/***/ "./assets/scripts/components/projects-widget.js": 773 /*!******************************************************!*\ 774 !*** ./assets/scripts/components/projects-widget.js ***! 775 \******************************************************/ 776 /*! no exports provided */ 777 /***/ (function(module, __webpack_exports__, __webpack_require__) { 778 779 "use strict"; 780 __webpack_require__.r(__webpack_exports__); 781 /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "jquery"); 782 /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__); 783 784 var $widget = jquery__WEBPACK_IMPORTED_MODULE_0___default()('.projects-widget'); 785 $widget.length && bootstrap(); 786 787 function bootstrap() { 788 var $map = $widget.children('.projects-widget__map'); 789 var $dropdowns = $widget.find('.projects-widget__dropdown'); 790 var projects = $widget.data('projects'); 791 var map = new google.maps.Map($map[0], { 792 center: new google.maps.LatLng(0, 0), 793 zoom: 2, 794 styles: [{ 795 'elementType': 'geometry', 796 'stylers': [{ 797 'color': '#f5f5f5' 798 }] 799 }, { 800 'elementType': 'geometry.stroke', 801 'stylers': [{ 802 'color': '#eee' 803 }] 804 }, { 805 'elementType': 'labels', 806 'stylers': [{ 807 'visibility': 'off' 808 }] 809 }, { 810 'elementType': 'labels.icon', 811 'stylers': [{ 812 'visibility': 'off' 813 }] 814 }, { 815 'elementType': 'labels.text.fill', 816 'stylers': [{ 817 'color': '#616161' 818 }] 819 }, { 820 'elementType': 'labels.text.stroke', 821 'stylers': [{ 822 'color': '#f5f5f5' 823 }] 824 }, { 825 'featureType': 'administrative.land_parcel', 826 'stylers': [{ 827 'visibility': 'off' 828 }] 829 }, { 830 'featureType': 'administrative.land_parcel', 831 'elementType': 'labels.text.fill', 832 'stylers': [{ 833 'color': '#bdbdbd' 834 }] 835 }, { 836 'featureType': 'administrative.neighborhood', 837 'stylers': [{ 838 'visibility': 'off' 839 }] 840 }, { 841 'featureType': 'poi', 842 'elementType': 'geometry', 843 'stylers': [{ 844 'color': '#eeeeee' 845 }] 846 }, { 847 'featureType': 'poi', 848 'elementType': 'labels.text.fill', 849 'stylers': [{ 850 'color': '#757575' 851 }] 852 }, { 853 'featureType': 'poi.park', 854 'elementType': 'geometry', 855 'stylers': [{ 856 'color': '#e5e5e5' 857 }] 858 }, { 859 'featureType': 'poi.park', 860 'elementType': 'labels.text.fill', 861 'stylers': [{ 862 'color': '#9e9e9e' 863 }] 864 }, { 865 'featureType': 'road', 866 'elementType': 'geometry', 867 'stylers': [{ 868 'color': '#ffffff' 869 }] 870 }, { 871 'featureType': 'road.arterial', 872 'elementType': 'labels.text.fill', 873 'stylers': [{ 874 'color': '#757575' 875 }] 876 }, { 877 'featureType': 'road.highway', 878 'elementType': 'geometry', 879 'stylers': [{ 880 'color': '#dadada' 881 }] 882 }, { 883 'featureType': 'road.highway', 884 'elementType': 'labels.text.fill', 885 'stylers': [{ 886 'color': '#616161' 887 }] 888 }, { 889 'featureType': 'road.local', 890 'elementType': 'labels.text.fill', 891 'stylers': [{ 892 'color': '#9e9e9e' 893 }] 894 }, { 895 'featureType': 'transit.line', 896 'elementType': 'geometry', 897 'stylers': [{ 898 'color': '#e5e5e5' 899 }] 900 }, { 901 'featureType': 'transit.station', 902 'elementType': 'geometry', 903 'stylers': [{ 904 'color': '#eeeeee' 905 }] 906 }, { 907 'featureType': 'water', 908 'elementType': 'geometry', 909 'stylers': [{ 910 'color': '#e1eaed' 911 }] 912 }, { 913 'featureType': 'water', 914 'elementType': 'labels.text.fill', 915 'stylers': [{ 916 'color': '#9e9e9e' 917 }] 918 }] 919 }); 920 var infoWindow = new google.maps.InfoWindow();
921 projects.forEach(function (project) { 922 if(project.latitude){ 923 console.log(project.latitude); 924 var iconCircle = { 925 path: 'M 100, 100 m -75, 0 a 75,75 0 1,0 150,0 a 75,75 0 1,0 -150,0', 926 fillColor: '#77bd43', 927 fillOpacity: 0.5, 928 scale: 0.1, 929 strokeColor: '#fff', 930 strokeOpacity: 0.9, 931 strokeWeight: 2 932 }; 933 var marker = new google.maps.Marker({ 934 position: new google.maps.LatLng(project.latitude, project.longitude), 935 icon: iconCircle, 936 title: project.title 937 }); 938 marker.addListener('click', function () { 939 infoWindow.setContent("<a href='".concat(project.permalink, "'>").concat(project.title, "</a>")); 940 infoWindow.open(map, marker); 941 }); 942 project.marker = marker; 943 project.marker.setMap(map); 944 } 945 }); 946 947 // var filter = function filter() { 948 // var _projects = projects; 949 950 // _projects.forEach(function (project) { 951 // project.marker.setMap(null); 952 // }); 953 954 // $dropdowns.each(function (i, el) { 955 // var $dropdown = jquery__WEBPACK_IMPORTED_MODULE_0___default()(el); 956 // var val = $dropdown.val(); 957 // if (val === '-1') return; 958 // _projects = jquery__WEBPACK_IMPORTED_MODULE_0___default.a.grep(_projects, function (item) { 959 // return jquery__WEBPACK_IMPORTED_MODULE_0___default.a.inArray(val, item['program']) !== -1; 960 // }); 961 // }); 962 963 // _projects.forEach(function (project) { 964 // project.marker.setMap(map); 965 // }); 966 // }; 967 968 // $dropdowns.on('change', filter); 969 // filter(); 970 } 971 972 /***/ }), 973 974
974/***/ "./assets/scripts/components/repository-search.js": 975 /*!********************************************************!*\ 976 !*** ./assets/scripts/components/repository-search.js ***! 977 \********************************************************/ 978 /*! no exports provided */ 979 /***/ (function(module, __webpack_exports__, __webpack_require__) { 980 981 "use strict"; 982 __webpack_require__.r(__webpack_exports__); 983 /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "jquery"); 984 /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__); 985 986 var $form = jquery__WEBPACK_IMPORTED_MODULE_0___default()('.sf-publications-search')[0]; 987 var $resultsCards = jquery__WEBPACK_IMPORTED_MODULE_0___default()('.sf-publications-results'); 988 $form && $form.addEventListener('submit', search); 989 990 function search(e) { 991 var $url = 'http://52.18.30.225/cimmyt/search?format=json'; 992 var $term = jquery__WEBPACK_IMPORTED_MODULE_0___default()('.sf-publications-search__terms--input').val(); 993 var $type = jquery__WEBPACK_IMPORTED_MODULE_0___default()('.sf-publications-search__type--select').val(); 994 var $theme = jquery__WEBPACK_IMPORTED_MODULE_0___default()('.sf-publications-search__themes--select').val(); 995 var $region = jquery__WEBPACK_IMPORTED_MODULE_0___default()('.sf-publications-search__regions--select').val(); 996 var $group = jquery__WEBPACK_IMPORTED_MODULE_0___default()('.sf-publications-search__group--select').val(); 997 var $checkboxes = jquery__WEBPACK_IMPORTED_MODULE_0___default()('.sf-publications-search__years--checkboxes-year'); 998 var $years = []; 999 $checkboxes.each(function (i, el) { 1000 var $year = jquery__WEBPACK_IMPORTED_MODULE_0___default()(el)[0]; 1001 var $checked = $year.checked; 1002 1003 if ($checked === true) { 1004 $years[i] = $year.value; 1005 } 1006 }); 1007 1008 if (typeof $term !== 'undefined' && $term) { 1009 $url += '&freetext=' + $term; 1010 } 1011 1012 if (typeof $type !== 'undefined' && $type !== '-1') { 1013 $url += '&type=' + $type; 1014 } 1015 1016 if (typeof $theme !== 'undefined' && $theme !== '-1') { 1017 $url += '&theme=' + $theme; 1018 } 1019 1020 if (typeof $region !== 'undefined' && $region !== '-1') { 1021 $url += '&location=' + $region; 1022 } 1023 1024 if (typeof $group !== 'undefined' && $group !== '-1') { 1025 $url += '&collection=' + $group; 1026 } 1027 1028 if (typeof $years !== 'undefined' && $years.length) { 1029 $years = $years.filter(function (n) { 1030 return n; 1031 }); 1032 $url += '&date=' + $years.join(); 1033 } 1034 1035 $url = encodeURI($url); 1036 fetch($url).then(function (resp) { 1037 return resp.json(); 1038 }).then(function (data) { 1039 var $results = data.results; 1040 var length = $results.length; 1041 $resultsCards.empty(); 1042 1043 for (var i = 0; i < length; i++) { 1044 var $resource = $results[i]; 1045 $resource && createCard($resource); 1046 } 1047 }).catch(function (error) { 1048 console.log(error); 1049 }); 1050 e.preventDefault(); 1051 } 1052 1053 function createCard($resource) { 1054 var $card = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="sf-publications-results__card"></div>'); 1055 var $meta = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="sf-publications-results__card--meta"></div>'); 1056 var $date = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="sf-publications-results__card--meta-date">' + $resource.updated + '</div>'); 1057 1058 if ($resource.detailed.aggregation.shownBy[2]) { 1059 var $thumb = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<img class="sf-publications-results__card--thumbnail" src="' + $resource.detailed.aggregation.shownBy[2].value + '" />'); 1060 } 1061 1062 if ($resource.title) { 1063 var $title = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<h3 class="sf-publications-results__card--title">' + $resource.title.value + '</h3>'); 1064 } 1065 1066 if ($resource.detailed.creator) { 1067 var $author = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="sf-publications-results__card--meta-author">' + $resource.detailed.creator.value + '</div>'); 1068 } 1069 1070 if ($resource.detailed.url[0]) { 1071 var $link = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<a class="sf-publications-results__card--link" href="' + $resource.detailed.url[0].value + '">Link to publication</a>'); 1072 } 1073 1074 if ($resource.description && $resource.description.value) { 1075 var $description = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="sf-publications-results__card--description">' + $resource.description.value + '</div>'); 1076 } 1077 1078 $card.append($thumb); 1079 $card.append($title); 1080 $card.append($meta.append($date).append($author)); 1081 $card.append($link); 1082 $card.append($description); 1083 $resultsCards.append($card); 1084 } 1085 1086 /***/ }), 1087 1088
1088/***/ "./assets/scripts/components/sharing.js": 1089 /*!**********************************************!*\ 1090 !*** ./assets/scripts/components/sharing.js ***! 1091 \**********************************************/ 1092 /*! no exports provided */ 1093 /***/ (function(module, __webpack_exports__, __webpack_require__) { 1094 1095 "use strict"; 1096 __webpack_require__.r(__webpack_exports__); 1097 /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "jquery"); 1098 /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__); 1099 /* harmony import */ var sticky_kit_dist_sticky_kit__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! sticky-kit/dist/sticky-kit */ "./node_modules/sticky-kit/dist/sticky-kit.js"); 1100 /* harmony import */ var sticky_kit_dist_sticky_kit__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(sticky_kit_dist_sticky_kit__WEBPACK_IMPORTED_MODULE_1__); 1101 1102 1103 var $sharing = jquery__WEBPACK_IMPORTED_MODULE_0___default()('.sf-sharing'); 1104 1105 if ($sharing.length && jquery__WEBPACK_IMPORTED_MODULE_0___default()(window).width() > 760) { 1106 $sharing.stick_in_parent({ 1107 offset_top: 120 1108 }); 1109 } 1110 1111 /***/ }), 1112 1113
1113/***/ "./assets/scripts/main.js": 1114 /*!********************************!*\ 1115 !*** ./assets/scripts/main.js ***! 1116 \********************************/ 1117 /*! no exports provided */ 1118 /***/ (function(module, __webpack_exports__, __webpack_require__) { 1119 1120 "use strict"; 1121 __webpack_require__.r(__webpack_exports__); 1122 /* harmony import */ var fitvids__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! fitvids */ "./node_modules/fitvids/index.js"); 1123 /* harmony import */ var fitvids__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(fitvids__WEBPACK_IMPORTED_MODULE_0__); 1124 /* harmony import */ var _components_article_header__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./components/article-header */ "./assets/scripts/components/article-header.js"); 1125 /* harmony import */ var _components_card__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./components/card */ "./assets/scripts/components/card.js"); 1126 /* harmony import */ var _components_carousel__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./components/carousel */ "./assets/scripts/components/carousel.js"); 1127 /* harmony import */ var _components_contents__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./components/contents */ "./assets/scripts/components/contents.js"); 1128 /* harmony import */ var _components_contents_link__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./components/contents-link */ "./assets/scripts/components/contents-link.js"); 1129 /* harmony import */ var _components_cta_tracker__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./components/cta-tracker */ "./assets/scripts/components/cta-tracker.js"); 1130 /* harmony import */ var _components_header_search__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./components/header-search */ "./assets/scripts/components/header-search.js"); 1131 /* harmony import */ var _components_header_search_toggle__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./components/header-search-toggle */ "./assets/scripts/components/header-search-toggle.js"); 1132 /* harmony import */ var _components_header_sticky__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./components/header-sticky */ "./assets/scripts/components/header-sticky.js"); 1133 /* harmony import */ var _components_no_blend_mode__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./components/no-blend-mode */ "./assets/scripts/components/no-blend-mode.js"); 1134 /* harmony import */ var _components_no_blend_mode__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(_components_no_blend_mode__WEBPACK_IMPORTED_MODULE_10__); 1135 /* harmony import */ var _components_primary_menu__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./components/primary-menu */ "./assets/scripts/components/primary-menu.js"); 1136 /* harmony import */ var _components_primary_menu_toggle__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./components/primary-menu-toggle */ "./assets/scripts/components/primary-menu-toggle.js"); 1137 /* harmony import */ var _components_projects_widget__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./components/projects-widget */ "./assets/scripts/components/projects-widget.js"); 1138 /* harmony import */ var _components_repository_search__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./components/repository-search */ "./assets/scripts/components/repository-search.js"); 1139 /* harmony import */ var _components_sharing__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./components/sharing */ "./assets/scripts/components/sharing.js"); 1140 // vendor 1141 // components 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 fitvids__WEBPACK_IMPORTED_MODULE_0___default()(); 1159 1160 /***/ }), 1161 1162
vendor: 4,192 bytes, lines 1162-1297
1162/***/ "./node_modules/fitvids/index.js": 1163 /*!***************************************!*\ 1164 !*** ./node_modules/fitvids/index.js ***! 1165 \***************************************/ 1166 /*! no static exports found */ 1167 /***/ (function(module, exports, __webpack_require__) { 1168 1169 "use strict"; 1170 1171 1172 1173 var selectors = [ 1174 'iframe[src*="player.vimeo.com"]', 1175 'iframe[src*="youtube.com"]', 1176 'iframe[src*="youtube-nocookie.com"]', 1177 'iframe[src*="kickstarter.com"][src*="video.html"]', 1178 'object' 1179 ] 1180 1181 var css = '.fluid-width-video-wrapper{width:100%;position:relative;padding:0;}.fluid-width-video-wrapper iframe,.fluid-width-video-wrapper object,.fluid-width-video-wrapper embed {position:absolute;top:0;left:0;width:100%;height:100%;}' 1182 1183 module.exports = function (parentSelector, opts) { 1184 parentSelector = parentSelector || 'body' 1185 opts = opts || {} 1186 1187 if (isObject(parentSelector)) { 1188 opts = parentSelector 1189 parentSelector = 'body' 1190 } 1191 1192 opts.ignore = opts.ignore || '' 1193 opts.players = opts.players || '' 1194 1195 var containers = queryAll(parentSelector) 1196 if (!hasLength(containers)) return 1197 1198 if (!document.getElementById('fit-vids-style')) { 1199 var head = document.head || document.getElementsByTagName('head')[0] 1200 head.appendChild(styles()) 1201 } 1202 1203 var custom = toSelectorArray(opts.players) || [] 1204 var ignored = toSelectorArray(opts.ignore) || [] 1205 var selector = selectors 1206 .filter(notIgnored(ignored)) 1207 .concat(custom) 1208 .join() 1209 1210 if (!hasLength(selector)) return 1211 1212 containers.forEach(function (container) { 1213 var videos = queryAll(container, selector) 1214 videos.forEach(function (video) { 1215 wrap(video) 1216 }) 1217 }) 1218 } 1219 1220 function queryAll (el, selector) { 1221 if (typeof el === 'string') { 1222 selector = el 1223 el = document 1224 } 1225 return Array.prototype.slice.call(el.querySelectorAll(selector)) 1226 } 1227 1228 function toSelectorArray (input) { 1229 if (typeof input === 'string') { 1230 return input.split(',').map(trim).filter(hasLength) 1231 } else if (isArray(input)) { 1232 return flatten(input.map(toSelectorArray).filter(hasLength)) 1233 } 1234 return input || [] 1235 } 1236 1237 function wrap (el) { 1238 if (/fluid-width-video-wrapper/.test(el.parentNode.className)) return 1239 1240 var widthAttr = parseInt(el.getAttribute('width'), 10) 1241 var heightAttr = parseInt(el.getAttribute('height'), 10) 1242 1243 var width = !isNaN(widthAttr) ? widthAttr : el.clientWidth 1244 var height = !isNaN(heightAttr) ? heightAttr : el.clientHeight 1245 var aspect = height / width 1246 1247 el.removeAttribute('width') 1248 el.removeAttribute('height') 1249 1250 var wrapper = document.createElement('div') 1251 el.parentNode.insertBefore(wrapper, el) 1252 wrapper.className = 'fluid-width-video-wrapper' 1253 wrapper.style.paddingTop = (aspect * 100) + '%' 1254 wrapper.appendChild(el) 1255 } 1256 1257 function styles () { 1258 var div = document.createElement('div') 1259 div.innerHTML = '<p>x</p><style id="fit-vids-style">' + css + '</style>' 1260 return div.childNodes[1] 1261 } 1262 1263 function notIgnored (ignored) { 1264 if (ignored.length < 1) { 1265 return function () { 1266 return true 1267 } 1268 } 1269 return function (selector) { 1270 return ignored.indexOf(selector) === -1 1271 } 1272 } 1273 1274 function hasLength (input) { 1275 return input.length > 0 1276 } 1277 1278 function trim (str) { 1279 return str.replace(/^\s+|\s+$/g, '') 1280 } 1281 1282 function flatten (input) { 1283 return [].concat.apply([], input) 1284 } 1285 1286 function isObject (input) { 1287 return Object.prototype.toString.call(input) === '[object Object]' 1288 } 1289 1290 function isArray (input) { 1291 return Object.prototype.toString.call(input) === '[object Array]' 1292 } 1293 1294 1295 /***/ }), 1296 1297
vendor: 101,735 bytes, lines 1297-4318
1297/***/ "./node_modules/slick-carousel/slick/slick.js": 1298 /*!****************************************************!*\ 1299 !*** ./node_modules/slick-carousel/slick/slick.js ***! 1300 \****************************************************/ 1301 /*! no static exports found */ 1302 /***/ (function(module, exports, __webpack_require__) { 1303 1304 var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* 1305 _ _ _ _ 1306 ___| (_) ___| | __ (_)___ 1307 / __| | |/ __| |/ / | / __| 1308 \__ \ | | (__| < _ | \__ \ 1309 |___/_|_|\___|_|\_(_)/ |___/ 1310 |__/ 1311 1312 Version: 1.8.1 1313 Author: Ken Wheeler 1314 Website: http://kenwheeler.github.io 1315 Docs: http://kenwheeler.github.io/slick 1316 Repo: http://github.com/kenwheeler/slick 1317 Issues: http://github.com/kenwheeler/slick/issues 1318 1319 */ 1320 /* global window, document, define, jQuery, setInterval, clearInterval */ 1321 ;(function(factory) { 1322 'use strict'; 1323 if (true) { 1324 !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(/*! jquery */ "jquery")], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), 1325 __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? 1326 (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), 1327 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); 1328 } else {} 1329 1330 }(function($) { 1331 'use strict'; 1332 var Slick = window.Slick || {}; 1333 1334 Slick = (function() { 1335 1336 var instanceUid = 0; 1337 1338 function Slick(element, settings) { 1339 1340 var _ = this, dataSettings; 1341 1342 _.defaults = { 1343 accessibility: true, 1344 adaptiveHeight: false, 1345 appendArrows: $(element), 1346 appendDots: $(element), 1347 arrows: true, 1348 asNavFor: null, 1349 prevArrow: '<button class="slick-prev" aria-label="Previous" type="button">Previous</button>', 1350 nextArrow: '<button class="slick-next" aria-label="Next" type="button">Next</button>', 1351 autoplay: false, 1352 autoplaySpeed: 3000, 1353 centerMode: false, 1354 centerPadding: '50px', 1355 cssEase: 'ease', 1356 customPaging: function(slider, i) { 1357 return $('<button type="button" />').text(i + 1); 1358 }, 1359 dots: false, 1360 dotsClass: 'slick-dots', 1361 draggable: true, 1362 easing: 'linear', 1363 edgeFriction: 0.35, 1364 fade: false, 1365 focusOnSelect: false, 1366 focusOnChange: false, 1367 infinite: true, 1368 initialSlide: 0, 1369 lazyLoad: 'ondemand', 1370 mobileFirst: false, 1371 pauseOnHover: true, 1372 pauseOnFocus: true, 1373 pauseOnDotsHover: false, 1374 respondTo: 'window', 1375 responsive: null, 1376 rows: 1, 1377 rtl: false, 1378 slide: '', 1379 slidesPerRow: 1, 1380 slidesToShow: 1, 1381 slidesToScroll: 1, 1382 speed: 500, 1383 swipe: true, 1384 swipeToSlide: false, 1385 touchMove: true, 1386 touchThreshold: 5, 1387 useCSS: true, 1388 useTransform: true, 1389 variableWidth: false, 1390 vertical: false, 1391 verticalSwiping: false, 1392 waitForAnimate: true, 1393 zIndex: 1000 1394 }; 1395 1396 _.initials = { 1397 animating: false, 1398 dragging: false, 1399 autoPlayTimer: null, 1400 currentDirection: 0, 1401 currentLeft: null, 1402 currentSlide: 0, 1403 direction: 1, 1404 $dots: null, 1405 listWidth: null, 1406 listHeight: null, 1407 loadIndex: 0, 1408 $nextArrow: null, 1409 $prevArrow: null, 1410 scrolling: false, 1411 slideCount: null, 1412 slideWidth: null, 1413 $slideTrack: null, 1414 $slides: null, 1415 sliding: false, 1416 slideOffset: 0, 1417 swipeLeft: null, 1418 swiping: false, 1419 $list: null, 1420 touchObject: {}, 1421 transformsEnabled: false, 1422 unslicked: false 1423 }; 1424 1425 $.extend(_, _.initials); 1426 1427 _.activeBreakpoint = null; 1428 _.animType = null; 1429 _.animProp = null; 1430 _.breakpoints = []; 1431 _.breakpointSettings = []; 1432 _.cssTransitions = false; 1433 _.focussed = false; 1434 _.interrupted = false; 1435 _.hidden = 'hidden'; 1436 _.paused = true; 1437 _.positionProp = null; 1438 _.respondTo = null; 1439 _.rowCount = 1; 1440 _.shouldClick = true; 1441 _.$slider = $(element); 1442 _.$slidesCache = null; 1443 _.transformType = null; 1444 _.transitionType = null; 1445 _.visibilityChange = 'visibilitychange'; 1446 _.windowWidth = 0; 1447 _.windowTimer = null; 1448 1449 dataSettings = $(element).data('slick') || {}; 1450 1451 _.options = $.extend({}, _.defaults, settings, dataSettings); 1452 1453 _.currentSlide = _.options.initialSlide; 1454 1455 _.originalSettings = _.options; 1456 1457 if (typeof document.mozHidden !== 'undefined') { 1458 _.hidden = 'mozHidden'; 1459 _.visibilityChange = 'mozvisibilitychange'; 1460 } else if (typeof document.webkitHidden !== 'undefined') { 1461 _.hidden = 'webkitHidden'; 1462 _.visibilityChange = 'webkitvisibilitychange'; 1463 } 1464 1465 _.autoPlay = $.proxy(_.autoPlay, _); 1466 _.autoPlayClear = $.proxy(_.autoPlayClear, _); 1467 _.autoPlayIterator = $.proxy(_.autoPlayIterator, _); 1468 _.changeSlide = $.proxy(_.changeSlide, _); 1469 _.clickHandler = $.proxy(_.clickHandler, _); 1470 _.selectHandler = $.proxy(_.selectHandler, _); 1471 _.setPosition = $.proxy(_.setPosition, _); 1472 _.swipeHandler = $.proxy(_.swipeHandler, _); 1473 _.dragHandler = $.proxy(_.dragHandler, _); 1474 _.keyHandler = $.proxy(_.keyHandler, _); 1475 1476 _.instanceUid = instanceUid++; 1477 1478 // A simple way to check for HTML strings 1479 // Strict HTML recognition (must start with <) 1480 // Extracted from jQuery v1.11 source 1481 _.htmlExpr = /^(?:\s*(<[\w\W]+>)[^>]*)$/; 1482 1483 1484 _.registerBreakpoints(); 1485 _.init(true); 1486 1487 } 1488 1489 return Slick; 1490 1491 }()); 1492 1493 Slick.prototype.activateADA = function() { 1494 var _ = this; 1495 1496 _.$slideTrack.find('.slick-active').attr({ 1497 'aria-hidden': 'false' 1498 }).find('a, input, button, select').attr({ 1499 'tabindex': '0' 1500 }); 1501 1502 }; 1503 1504 Slick.prototype.addSlide = Slick.prototype.slickAdd = function(markup, index, addBefore) { 1505 1506 var _ = this; 1507 1508 if (typeof(index) === 'boolean') { 1509 addBefore = index; 1510 index = null; 1511 } else if (index < 0 || (index >= _.slideCount)) { 1512 return false; 1513 } 1514 1515 _.unload(); 1516 1517 if (typeof(index) === 'number') { 1518 if (index === 0 && _.$slides.length === 0) { 1519 $(markup).appendTo(_.$slideTrack); 1520 } else if (addBefore) { 1521 $(markup).insertBefore(_.$slides.eq(index)); 1522 } else { 1523 $(markup).insertAfter(_.$slides.eq(index)); 1524 } 1525 } else { 1526 if (addBefore === true) { 1527 $(markup).prependTo(_.$slideTrack); 1528 } else { 1529 $(markup).appendTo(_.$slideTrack); 1530 } 1531 } 1532 1533 _.$slides = _.$slideTrack.children(this.options.slide); 1534 1535 _.$slideTrack.children(this.options.slide).detach(); 1536 1537 _.$slideTrack.append(_.$slides); 1538 1539 _.$slides.each(function(index, element) { 1540 $(element).attr('data-slick-index', index); 1541 }); 1542 1543 _.$slidesCache = _.$slides; 1544 1545 _.reinit(); 1546 1547 }; 1548 1549 Slick.prototype.animateHeight = function() { 1550 var _ = this; 1551 if (_.options.slidesToShow === 1 && _.options.adaptiveHeight === true && _.options.vertical === false) { 1552 var targetHeight = _.$slides.eq(_.currentSlide).outerHeight(true); 1553 _.$list.animate({ 1554 height: targetHeight 1555 }, _.options.speed); 1556 } 1557 }; 1558 1559 Slick.prototype.animateSlide = function(targetLeft, callback) { 1560 1561 var animProps = {}, 1562 _ = this; 1563 1564 _.animateHeight(); 1565 1566 if (_.options.rtl === true && _.options.vertical === false) { 1567 targetLeft = -targetLeft; 1568 } 1569 if (_.transformsEnabled === false) { 1570 if (_.options.vertical === false) { 1571 _.$slideTrack.animate({ 1572 left: targetLeft 1573 }, _.options.speed, _.options.easing, callback); 1574 } else { 1575 _.$slideTrack.animate({ 1576 top: targetLeft 1577 }, _.options.speed, _.options.easing, callback); 1578 } 1579 1580 } else { 1581 1582 if (_.cssTransitions === false) { 1583 if (_.options.rtl === true) { 1584 _.currentLeft = -(_.currentLeft); 1585 } 1586 $({ 1587 animStart: _.currentLeft 1588 }).animate({ 1589 animStart: targetLeft 1590 }, { 1591 duration: _.options.speed, 1592 easing: _.options.easing, 1593 step: function(now) { 1594 now = Math.ceil(now); 1595 if (_.options.vertical === false) { 1596 animProps[_.animType] = 'translate(' + 1597 now + 'px, 0px)'; 1598 _.$slideTrack.css(animProps); 1599 } else { 1600 animProps[_.animType] = 'translate(0px,' + 1601 now + 'px)'; 1602 _.$slideTrack.css(animProps); 1603 } 1604 }, 1605 complete: function() { 1606 if (callback) { 1607 callback.call(); 1608 } 1609 } 1610 }); 1611 1612 } else { 1613 1614 _.applyTransition(); 1615 targetLeft = Math.ceil(targetLeft); 1616 1617 if (_.options.vertical === false) { 1618 animProps[_.animType] = 'translate3d(' + targetLeft + 'px, 0px, 0px)'; 1619 } else { 1620 animProps[_.animType] = 'translate3d(0px,' + targetLeft + 'px, 0px)'; 1621 } 1622 _.$slideTrack.css(animProps); 1623 1624 if (callback) { 1625 setTimeout(function() { 1626 1627 _.disableTransition(); 1628 1629 callback.call(); 1630 }, _.options.speed); 1631 } 1632 1633 } 1634 1635 } 1636 1637 }; 1638 1639 Slick.prototype.getNavTarget = function() { 1640 1641 var _ = this, 1642 asNavFor = _.options.asNavFor; 1643 1644 if ( asNavFor && asNavFor !== null ) { 1645 asNavFor = $(asNavFor).not(_.$slider); 1646 } 1647 1648 return asNavFor; 1649 1650 }; 1651 1652 Slick.prototype.asNavFor = function(index) { 1653 1654 var _ = this, 1655 asNavFor = _.getNavTarget(); 1656 1657 if ( asNavFor !== null && typeof asNavFor === 'object' ) { 1658 asNavFor.each(function() { 1659 var target = $(this).slick('getSlick'); 1660 if(!target.unslicked) { 1661 target.slideHandler(index, true); 1662 } 1663 }); 1664 } 1665 1666 }; 1667 1668 Slick.prototype.applyTransition = function(slide) { 1669 1670 var _ = this, 1671 transition = {}; 1672 1673 if (_.options.fade === false) { 1674 transition[_.transitionType] = _.transformType + ' ' + _.options.speed + 'ms ' + _.options.cssEase; 1675 } else { 1676 transition[_.transitionType] = 'opacity ' + _.options.speed + 'ms ' + _.options.cssEase; 1677 } 1678 1679 if (_.options.fade === false) { 1680 _.$slideTrack.css(transition); 1681 } else { 1682 _.$slides.eq(slide).css(transition); 1683 } 1684 1685 }; 1686 1687 Slick.prototype.autoPlay = function() { 1688 1689 var _ = this; 1690 1691 _.autoPlayClear(); 1692 1693 if ( _.slideCount > _.options.slidesToShow ) { 1694 _.autoPlayTimer = setInterval( _.autoPlayIterator, _.options.autoplaySpeed ); 1695 } 1696 1697 }; 1698 1699 Slick.prototype.autoPlayClear = function() { 1700 1701 var _ = this; 1702 1703 if (_.autoPlayTimer) { 1704 clearInterval(_.autoPlayTimer); 1705 } 1706 1707 }; 1708 1709 Slick.prototype.autoPlayIterator = function() { 1710 1711 var _ = this, 1712 slideTo = _.currentSlide + _.options.slidesToScroll; 1713 1714 if ( !_.paused && !_.interrupted && !_.focussed ) { 1715 1716 if ( _.options.infinite === false ) { 1717 1718 if ( _.direction === 1 && ( _.currentSlide + 1 ) === ( _.slideCount - 1 )) { 1719 _.direction = 0; 1720 } 1721 1722 else if ( _.direction === 0 ) { 1723 1724 slideTo = _.currentSlide - _.options.slidesToScroll; 1725 1726 if ( _.currentSlide - 1 === 0 ) { 1727 _.direction = 1; 1728 } 1729 1730 } 1731 1732 } 1733 1734 _.slideHandler( slideTo ); 1735 1736 } 1737 1738 }; 1739 1740 Slick.prototype.buildArrows = function() { 1741 1742 var _ = this; 1743 1744 if (_.options.arrows === true ) { 1745 1746 _.$prevArrow = $(_.options.prevArrow).addClass('slick-arrow'); 1747 _.$nextArrow = $(_.options.nextArrow).addClass('slick-arrow'); 1748 1749 if( _.slideCount > _.options.slidesToShow ) { 1750 1751 _.$prevArrow.removeClass('slick-hidden').removeAttr('aria-hidden tabindex'); 1752 _.$nextArrow.removeClass('slick-hidden').removeAttr('aria-hidden tabindex'); 1753 1754 if (_.htmlExpr.test(_.options.prevArrow)) { 1755 _.$prevArrow.prependTo(_.options.appendArrows); 1756 } 1757 1758 if (_.htmlExpr.test(_.options.nextArrow)) { 1759 _.$nextArrow.appendTo(_.options.appendArrows); 1760 } 1761 1762 if (_.options.infinite !== true) { 1763 _.$prevArrow 1764 .addClass('slick-disabled') 1765 .attr('aria-disabled', 'true'); 1766 } 1767 1768 } else { 1769 1770 _.$prevArrow.add( _.$nextArrow ) 1771 1772 .addClass('slick-hidden') 1773 .attr({ 1774 'aria-disabled': 'true', 1775 'tabindex': '-1' 1776 }); 1777 1778 } 1779 1780 } 1781 1782 }; 1783 1784 Slick.prototype.buildDots = function() { 1785 1786 var _ = this, 1787 i, dot; 1788 1789 if (_.options.dots === true && _.slideCount > _.options.slidesToShow) { 1790 1791 _.$slider.addClass('slick-dotted'); 1792 1793 dot = $('<ul />').addClass(_.options.dotsClass); 1794 1795 for (i = 0; i <= _.getDotCount(); i += 1) { 1796 dot.append($('<li />').append(_.options.customPaging.call(this, _, i))); 1797 } 1798 1799 _.$dots = dot.appendTo(_.options.appendDots); 1800 1801 _.$dots.find('li').first().addClass('slick-active'); 1802 1803 } 1804 1805 }; 1806 1807 Slick.prototype.buildOut = function() { 1808 1809 var _ = this; 1810 1811 _.$slides = 1812 _.$slider 1813 .children( _.options.slide + ':not(.slick-cloned)') 1814 .addClass('slick-slide'); 1815 1816 _.slideCount = _.$slides.length; 1817 1818 _.$slides.each(function(index, element) { 1819 $(element) 1820 .attr('data-slick-index', index) 1821 .data('originalStyling', $(element).attr('style') || ''); 1822 }); 1823 1824 _.$slider.addClass('slick-slider'); 1825 1826 _.$slideTrack = (_.slideCount === 0) ? 1827 $('<div class="slick-track"/>').appendTo(_.$slider) : 1828 _.$slides.wrapAll('<div class="slick-track"/>').parent(); 1829 1830 _.$list = _.$slideTrack.wrap( 1831 '<div class="slick-list"/>').parent(); 1832 _.$slideTrack.css('opacity', 0); 1833 1834 if (_.options.centerMode === true || _.options.swipeToSlide === true) { 1835 _.options.slidesToScroll = 1; 1836 } 1837 1838 $('img[data-lazy]', _.$slider).not('[src]').addClass('slick-loading'); 1839 1840 _.setupInfinite(); 1841 1842 _.buildArrows(); 1843 1844 _.buildDots(); 1845 1846 _.updateDots(); 1847 1848 1849 _.setSlideClasses(typeof _.currentSlide === 'number' ? _.currentSlide : 0); 1850 1851 if (_.options.draggable === true) { 1852 _.$list.addClass('draggable'); 1853 } 1854 1855 }; 1856 1857 Slick.prototype.buildRows = function() { 1858 1859 var _ = this, a, b, c, newSlides, numOfSlides, originalSlides,slidesPerSection; 1860 1861 newSlides = document.createDocumentFragment(); 1862 originalSlides = _.$slider.children(); 1863 1864 if(_.options.rows > 0) { 1865 1866 slidesPerSection = _.options.slidesPerRow * _.options.rows; 1867 numOfSlides = Math.ceil( 1868 originalSlides.length / slidesPerSection 1869 ); 1870 1871 for(a = 0; a < numOfSlides; a++){ 1872 var slide = document.createElement('div'); 1873 for(b = 0; b < _.options.rows; b++) { 1874 var row = document.createElement('div'); 1875 for(c = 0; c < _.options.slidesPerRow; c++) { 1876 var target = (a * slidesPerSection + ((b * _.options.slidesPerRow) + c)); 1877 if (originalSlides.get(target)) { 1878 row.appendChild(originalSlides.get(target)); 1879 } 1880 } 1881 slide.appendChild(row); 1882 } 1883 newSlides.appendChild(slide); 1884 } 1885 1886 _.$slider.empty().append(newSlides); 1887 _.$slider.children().children().children() 1888 .css({ 1889 'width':(100 / _.options.slidesPerRow) + '%', 1890 'display': 'inline-block' 1891 }); 1892 1893 } 1894 1895 }; 1896 1897 Slick.prototype.checkResponsive = function(initial, forceUpdate) { 1898 1899 var _ = this, 1900 breakpoint, targetBreakpoint, respondToWidth, triggerBreakpoint = false; 1901 var sliderWidth = _.$slider.width(); 1902 var windowWidth = window.innerWidth || $(window).width(); 1903 1904 if (_.respondTo === 'window') { 1905 respondToWidth = windowWidth; 1906 } else if (_.respondTo === 'slider') { 1907 respondToWidth = sliderWidth; 1908 } else if (_.respondTo === 'min') { 1909 respondToWidth = Math.min(windowWidth, sliderWidth); 1910 } 1911 1912 if ( _.options.responsive && 1913 _.options.responsive.length && 1914 _.options.responsive !== null) { 1915 1916 targetBreakpoint = null; 1917 1918 for (breakpoint in _.breakpoints) { 1919 if (_.breakpoints.hasOwnProperty(breakpoint)) { 1920 if (_.originalSettings.mobileFirst === false) { 1921 if (respondToWidth < _.breakpoints[breakpoint]) { 1922 targetBreakpoint = _.breakpoints[breakpoint]; 1923 } 1924 } else { 1925 if (respondToWidth > _.breakpoints[breakpoint]) { 1926 targetBreakpoint = _.breakpoints[breakpoint]; 1927 } 1928 } 1929 } 1930 } 1931 1932 if (targetBreakpoint !== null) { 1933 if (_.activeBreakpoint !== null) { 1934 if (targetBreakpoint !== _.activeBreakpoint || forceUpdate) { 1935 _.activeBreakpoint = 1936 targetBreakpoint; 1937 if (_.breakpointSettings[targetBreakpoint] === 'unslick') { 1938 _.unslick(targetBreakpoint); 1939 } else { 1940 _.options = $.extend({}, _.originalSettings, 1941 _.breakpointSettings[ 1942 targetBreakpoint]); 1943 if (initial === true) { 1944 _.currentSlide = _.options.initialSlide; 1945 } 1946 _.refresh(initial); 1947 } 1948 triggerBreakpoint = targetBreakpoint; 1949 } 1950 } else { 1951 _.activeBreakpoint = targetBreakpoint; 1952 if (_.breakpointSettings[targetBreakpoint] === 'unslick') { 1953 _.unslick(targetBreakpoint); 1954 } else { 1955 _.options = $.extend({}, _.originalSettings, 1956 _.breakpointSettings[ 1957 targetBreakpoint]); 1958 if (initial === true) { 1959 _.currentSlide = _.options.initialSlide; 1960 } 1961 _.refresh(initial); 1962 } 1963 triggerBreakpoint = targetBreakpoint; 1964 } 1965 } else { 1966 if (_.activeBreakpoint !== null) { 1967 _.activeBreakpoint = null; 1968 _.options = _.originalSettings; 1969 if (initial === true) { 1970 _.currentSlide = _.options.initialSlide; 1971 } 1972 _.refresh(initial); 1973 triggerBreakpoint = targetBreakpoint; 1974 } 1975 } 1976 1977 // only trigger breakpoints during an actual break. not on initialize. 1978 if( !initial && triggerBreakpoint !== false ) { 1979 _.$slider.trigger('breakpoint', [_, triggerBreakpoint]); 1980 } 1981 } 1982 1983 }; 1984 1985 Slick.prototype.changeSlide = function(event, dontAnimate) { 1986 1987 var _ = this, 1988 $target = $(event.currentTarget), 1989 indexOffset, slideOffset, unevenOffset; 1990 1991 // If target is a link, prevent default action. 1992 if($target.is('a')) { 1993 event.preventDefault(); 1994 } 1995 1996 // If target is not the <li> element (ie: a child), find the <li>. 1997 if(!$target.is('li')) { 1998 $target = $target.closest('li'); 1999 } 2000 2001 unevenOffset = (_.slideCount % _.options.slidesToScroll !== 0); 2002 indexOffset = unevenOffset ? 0 : (_.slideCount - _.currentSlide) % _.options.slidesToScroll; 2003 2004 switch (event.data.message) { 2005 2006 case 'previous': 2007 slideOffset = indexOffset === 0 ? _.options.slidesToScroll : _.options.slidesToShow - indexOffset; 2008 if (_.slideCount > _.options.slidesToShow) { 2009 _.slideHandler(_.currentSlide - slideOffset, false, dontAnimate); 2010 } 2011 break; 2012 2013 case 'next': 2014 slideOffset = indexOffset === 0 ? _.options.slidesToScroll : indexOffset; 2015 if (_.slideCount > _.options.slidesToShow) { 2016 _.slideHandler(_.currentSlide + slideOffset, false, dontAnimate); 2017 } 2018 break; 2019 2020 case 'index': 2021 var index = event.data.index === 0 ? 0 : 2022 event.data.index || $target.index() * _.options.slidesToScroll; 2023 2024 _.slideHandler(_.checkNavigable(index), false, dontAnimate); 2025 $target.children().trigger('focus'); 2026 break; 2027 2028 default: 2029 return; 2030 } 2031 2032 }; 2033 2034 Slick.prototype.checkNavigable = function(index) { 2035 2036 var _ = this, 2037 navigables, prevNavigable; 2038 2039 navigables = _.getNavigableIndexes(); 2040 prevNavigable = 0; 2041 if (index > navigables[navigables.length - 1]) { 2042 index = navigables[navigables.length - 1]; 2043 } else { 2044 for (var n in navigables) { 2045 if (index < navigables[n]) { 2046 index = prevNavigable; 2047 break; 2048 } 2049 prevNavigable = navigables[n]; 2050 } 2051 } 2052 2053 return index; 2054 }; 2055 2056 Slick.prototype.cleanUpEvents = function() { 2057 2058 var _ = this; 2059 2060 if (_.options.dots && _.$dots !== null) { 2061 2062 $('li', _.$dots) 2063 .off('click.slick', _.changeSlide) 2064 .off('mouseenter.slick', $.proxy(_.interrupt, _, true)) 2065 .off('mouseleave.slick', $.proxy(_.interrupt, _, false)); 2066 2067 if (_.options.accessibility === true) { 2068 _.$dots.off('keydown.slick', _.keyHandler); 2069 } 2070 } 2071 2072 _.$slider.off('focus.slick blur.slick'); 2073 2074 if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) { 2075 _.$prevArrow && _.$prevArrow.off('click.slick', _.changeSlide); 2076 _.$nextArrow && _.$nextArrow.off('click.slick', _.changeSlide); 2077 2078 if (_.options.accessibility === true) { 2079 _.$prevArrow && _.$prevArrow.off('keydown.slick', _.keyHandler); 2080 _.$nextArrow && _.$nextArrow.off('keydown.slick', _.keyHandler); 2081 } 2082 } 2083 2084 _.$list.off('touchstart.slick mousedown.slick', _.swipeHandler); 2085 _.$list.off('touchmove.slick mousemove.slick', _.swipeHandler); 2086 _.$list.off('touchend.slick mouseup.slick', _.swipeHandler); 2087 _.$list.off('touchcancel.slick mouseleave.slick', _.swipeHandler); 2088 2089 _.$list.off('click.slick', _.clickHandler); 2090 2091 $(document).off(_.visibilityChange, _.visibility); 2092 2093 _.cleanUpSlideEvents(); 2094 2095 if (_.options.accessibility === true) { 2096 _.$list.off('keydown.slick', _.keyHandler); 2097 } 2098 2099 if (_.options.focusOnSelect === true) { 2100 $(_.$slideTrack).children().off('click.slick', _.selectHandler); 2101 } 2102 2103 $(window).off('orientationchange.slick.slick-' + _.instanceUid, _.orientationChange); 2104 2105 $(window).off('resize.slick.slick-' + _.instanceUid, _.resize); 2106 2107 $('[draggable!=true]', _.$slideTrack).off('dragstart', _.preventDefault); 2108 2109 $(window).off('load.slick.slick-' + _.instanceUid, _.setPosition); 2110 2111 }; 2112 2113 Slick.prototype.cleanUpSlideEvents = function() { 2114 2115 var _ = this; 2116 2117 _.$list.off('mouseenter.slick', $.proxy(_.interrupt, _, true)); 2118 _.$list.off('mouseleave.slick', $.proxy(_.interrupt, _, false)); 2119 2120 }; 2121 2122 Slick.prototype.cleanUpRows = function() { 2123 2124 var _ = this, originalSlides; 2125 2126 if(_.options.rows > 0) { 2127 originalSlides = _.$slides.children().children(); 2128 originalSlides.removeAttr('style'); 2129 _.$slider.empty().append(originalSlides); 2130 } 2131 2132 }; 2133 2134 Slick.prototype.clickHandler = function(event) { 2135 2136 var _ = this; 2137 2138 if (_.shouldClick === false) { 2139 event.stopImmediatePropagation(); 2140 event.stopPropagation(); 2141 event.preventDefault(); 2142 } 2143 2144 }; 2145 2146 Slick.prototype.destroy = function(refresh) { 2147 2148 var _ = this; 2149 2150 _.autoPlayClear(); 2151 2152 _.touchObject = {}; 2153 2154 _.cleanUpEvents(); 2155 2156 $('.slick-cloned', _.$slider).detach(); 2157 2158 if (_.$dots) { 2159 _.$dots.remove(); 2160 } 2161 2162 if ( _.$prevArrow && _.$prevArrow.length ) { 2163 2164 _.$prevArrow 2165 .removeClass('slick-disabled slick-arrow slick-hidden') 2166 .removeAttr('aria-hidden aria-disabled tabindex') 2167 .css('display',''); 2168 2169 if ( _.htmlExpr.test( _.options.prevArrow )) { 2170 _.$prevArrow.remove(); 2171 } 2172 } 2173 2174 if ( _.$nextArrow && _.$nextArrow.length ) { 2175 2176 _.$nextArrow 2177 .removeClass('slick-disabled slick-arrow slick-hidden') 2178 .removeAttr('aria-hidden aria-disabled tabindex') 2179 .css('display',''); 2180 2181 if ( _.htmlExpr.test( _.options.nextArrow )) { 2182 _.$nextArrow.remove(); 2183 } 2184 } 2185 2186 2187 if (_.$slides) { 2188 2189 _.$slides 2190 .removeClass('slick-slide slick-active slick-center slick-visible slick-current') 2191 .removeAttr('aria-hidden') 2192 .removeAttr('data-slick-index') 2193 .each(function(){ 2194 $(this).attr('style', $(this).data('originalStyling')); 2195 }); 2196 2197 _.$slideTrack.children(this.options.slide).detach(); 2198 2199 _.$slideTrack.detach(); 2200 2201 _.$list.detach(); 2202 2203 _.$slider.append(_.$slides); 2204 } 2205 2206 _.cleanUpRows(); 2207 2208 _.$slider.removeClass('slick-slider'); 2209 _.$slider.removeClass('slick-initialized'); 2210 _.$slider.removeClass('slick-dotted'); 2211 2212 _.unslicked = true; 2213 2214 if(!refresh) { 2215 _.$slider.trigger('destroy', [_]); 2216 } 2217 2218 }; 2219 2220 Slick.prototype.disableTransition = function(slide) { 2221 2222 var _ = this, 2223 transition = {}; 2224 2225 transition[_.transitionType] = ''; 2226 2227 if (_.options.fade === false) { 2228 _.$slideTrack.css(transition); 2229 } else { 2230 _.$slides.eq(slide).css(transition); 2231 } 2232 2233 }; 2234 2235 Slick.prototype.fadeSlide = function(slideIndex, callback) { 2236 2237 var _ = this; 2238 2239 if (_.cssTransitions === false) { 2240 2241 _.$slides.eq(slideIndex).css({ 2242 zIndex: _.options.zIndex 2243 }); 2244 2245 _.$slides.eq(slideIndex).animate({ 2246 opacity: 1 2247 }, _.options.speed, _.options.easing, callback); 2248 2249 } else { 2250 2251 _.applyTransition(slideIndex); 2252 2253 _.$slides.eq(slideIndex).css({ 2254 opacity: 1, 2255 zIndex: _.options.zIndex 2256 }); 2257 2258 if (callback) { 2259 setTimeout(function() { 2260 2261 _.disableTransition(slideIndex); 2262 2263 callback.call(); 2264 }, _.options.speed); 2265 } 2266 2267 } 2268 2269 }; 2270 2271 Slick.prototype.fadeSlideOut = function(slideIndex) { 2272 2273 var _ = this; 2274 2275 if (_.cssTransitions === false) { 2276 2277 _.$slides.eq(slideIndex).animate({ 2278 opacity: 0, 2279 zIndex: _.options.zIndex - 2 2280 }, _.options.speed, _.options.easing); 2281 2282 } else { 2283 2284 _.applyTransition(slideIndex); 2285 2286 _.$slides.eq(slideIndex).css({ 2287 opacity: 0, 2288 zIndex: _.options.zIndex - 2 2289 }); 2290 2291 } 2292 2293 }; 2294 2295 Slick.prototype.filterSlides = Slick.prototype.slickFilter = function(filter) { 2296 2297 var _ = this; 2298 2299 if (filter !== null) { 2300 2301 _.$slidesCache = _.$slides; 2302 2303 _.unload(); 2304 2305 _.$slideTrack.children(this.options.slide).detach(); 2306 2307 _.$slidesCache.filter(filter).appendTo(_.$slideTrack); 2308 2309 _.reinit(); 2310 2311 } 2312 2313 }; 2314 2315 Slick.prototype.focusHandler = function() { 2316 2317 var _ = this; 2318 2319 _.$slider 2320 .off('focus.slick blur.slick') 2321 .on('focus.slick blur.slick', '*', function(event) { 2322 2323 event.stopImmediatePropagation(); 2324 var $sf = $(this); 2325 2326 setTimeout(function() { 2327 2328 if( _.options.pauseOnFocus ) { 2329 _.focussed = $sf.is(':focus'); 2330 _.autoPlay(); 2331 } 2332 2333 }, 0); 2334 2335 }); 2336 }; 2337 2338 Slick.prototype.getCurrent = Slick.prototype.slickCurrentSlide = function() { 2339 2340 var _ = this; 2341 return _.currentSlide; 2342 2343 }; 2344 2345 Slick.prototype.getDotCount = function() { 2346 2347 var _ = this; 2348 2349 var breakPoint = 0; 2350 var counter = 0; 2351 var pagerQty = 0; 2352 2353 if (_.options.infinite === true) { 2354 if (_.slideCount <= _.options.slidesToShow) { 2355 ++pagerQty; 2356 } else { 2357 while (breakPoint < _.slideCount) { 2358 ++pagerQty; 2359 breakPoint = counter + _.options.slidesToScroll; 2360 counter += _.options.slidesToScroll <= _.options.slidesToShow ? _.options.slidesToScroll : _.options.slidesToShow; 2361 } 2362 } 2363 } else if (_.options.centerMode === true) { 2364 pagerQty = _.slideCount; 2365 } else if(!_.options.asNavFor) { 2366 pagerQty = 1 + Math.ceil((_.slideCount - _.options.slidesToShow) / _.options.slidesToScroll); 2367 }else { 2368 while (breakPoint < _.slideCount) { 2369 ++pagerQty; 2370 breakPoint = counter + _.options.slidesToScroll; 2371 counter += _.options.slidesToScroll <= _.options.slidesToShow ? _.options.slidesToScroll : _.options.slidesToShow; 2372 } 2373 } 2374 2375 return pagerQty - 1; 2376 2377 }; 2378 2379 Slick.prototype.getLeft = function(slideIndex) { 2380 2381 var _ = this, 2382 targetLeft, 2383 verticalHeight, 2384 verticalOffset = 0, 2385 targetSlide, 2386 coef; 2387 2388 _.slideOffset = 0; 2389 verticalHeight = _.$slides.first().outerHeight(true); 2390 2391 if (_.options.infinite === true) { 2392 if (_.slideCount > _.options.slidesToShow) { 2393 _.slideOffset = (_.slideWidth * _.options.slidesToShow) * -1; 2394 coef = -1 2395 2396 if (_.options.vertical === true && _.options.centerMode === true) { 2397 if (_.options.slidesToShow === 2) { 2398 coef = -1.5; 2399 } else if (_.options.slidesToShow === 1) { 2400 coef = -2 2401 } 2402 } 2403 verticalOffset = (verticalHeight * _.options.slidesToShow) * coef; 2404 } 2405 if (_.slideCount % _.options.slidesToScroll !== 0) { 2406 if (slideIndex + _.options.slidesToScroll > _.slideCount && _.slideCount > _.options.slidesToShow) { 2407 if (slideIndex > _.slideCount) { 2408 _.slideOffset = ((_.options.slidesToShow - (slideIndex - _.slideCount)) * _.slideWidth) * -1; 2409 verticalOffset = ((_.options.slidesToShow - (slideIndex - _.slideCount)) * verticalHeight) * -1; 2410 } else { 2411 _.slideOffset = ((_.slideCount % _.options.slidesToScroll) * _.slideWidth) * -1; 2412 verticalOffset = ((_.slideCount % _.options.slidesToScroll) * verticalHeight) * -1; 2413 } 2414 } 2415 } 2416 } else { 2417 if (slideIndex + _.options.slidesToShow > _.slideCount) { 2418 _.slideOffset = ((slideIndex + _.options.slidesToShow) - _.slideCount) * _.slideWidth; 2419 verticalOffset = ((slideIndex + _.options.slidesToShow) - _.slideCount) * verticalHeight; 2420 } 2421 } 2422 2423 if (_.slideCount <= _.options.slidesToShow) { 2424 _.slideOffset = 0; 2425 verticalOffset = 0; 2426 } 2427 2428 if (_.options.centerMode === true && _.slideCount <= _.options.slidesToShow) { 2429 _.slideOffset = ((_.slideWidth * Math.floor(_.options.slidesToShow)) / 2) - ((_.slideWidth * _.slideCount) / 2); 2430 } else if (_.options.centerMode === true && _.options.infinite === true) { 2431 _.slideOffset += _.slideWidth * Math.floor(_.options.slidesToShow / 2) - _.slideWidth; 2432 } else if (_.options.centerMode === true) { 2433 _.slideOffset = 0; 2434 _.slideOffset += _.slideWidth * Math.floor(_.options.slidesToShow / 2); 2435 } 2436 2437 if (_.options.vertical === false) { 2438 targetLeft = ((slideIndex * _.slideWidth) * -1) + _.slideOffset; 2439 } else { 2440 targetLeft = ((slideIndex * verticalHeight) * -1) + verticalOffset; 2441 } 2442 2443 if (_.options.variableWidth === true) { 2444 2445 if (_.slideCount <= _.options.slidesToShow || _.options.infinite === false) { 2446 targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex); 2447 } else { 2448 targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex + _.options.slidesToShow); 2449 } 2450 2451 if (_.options.rtl === true) { 2452 if (targetSlide[0]) { 2453 targetLeft = (_.$slideTrack.width() - targetSlide[0].offsetLeft - targetSlide.width()) * -1; 2454 } else { 2455 targetLeft = 0; 2456 } 2457 } else { 2458 targetLeft = targetSlide[0] ? targetSlide[0].offsetLeft * -1 : 0; 2459 } 2460 2461 if (_.options.centerMode === true) { 2462 if (_.slideCount <= _.options.slidesToShow || _.options.infinite === false) { 2463 targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex); 2464 } else { 2465 targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex + _.options.slidesToShow + 1); 2466 } 2467 2468 if (_.options.rtl === true) { 2469 if (targetSlide[0]) { 2470 targetLeft = (_.$slideTrack.width() - targetSlide[0].offsetLeft - targetSlide.width()) * -1; 2471 } else { 2472 targetLeft = 0; 2473 } 2474 } else { 2475 targetLeft = targetSlide[0] ? targetSlide[0].offsetLeft * -1 : 0; 2476 } 2477 2478 targetLeft += (_.$list.width() - targetSlide.outerWidth()) / 2; 2479 } 2480 } 2481 2482 return targetLeft; 2483 2484 }; 2485 2486 Slick.prototype.getOption = Slick.prototype.slickGetOption = function(option) { 2487 2488 var _ = this; 2489 2490 return _.options[option]; 2491 2492 }; 2493 2494 Slick.prototype.getNavigableIndexes = function() { 2495 2496 var _ = this, 2497 breakPoint = 0, 2498 counter = 0, 2499 indexes = [], 2500 max; 2501 2502 if (_.options.infinite === false) { 2503 max = _.slideCount; 2504 } else { 2505 breakPoint = _.options.slidesToScroll * -1; 2506 counter = _.options.slidesToScroll * -1; 2507 max = _.slideCount * 2; 2508 } 2509 2510 while (breakPoint < max) { 2511 indexes.push(breakPoint); 2512 breakPoint = counter + _.options.slidesToScroll; 2513 counter += _.options.slidesToScroll <= _.options.slidesToShow ? _.options.slidesToScroll : _.options.slidesToShow; 2514 } 2515 2516 return indexes; 2517 2518 }; 2519 2520 Slick.prototype.getSlick = function() { 2521 2522 return this; 2523 2524 }; 2525 2526 Slick.prototype.getSlideCount = function() { 2527 2528 var _ = this, 2529 slidesTraversed, swipedSlide, centerOffset; 2530 2531 centerOffset = _.options.centerMode === true ? _.slideWidth * Math.floor(_.options.slidesToShow / 2) : 0; 2532 2533 if (_.options.swipeToSlide === true) { 2534 _.$slideTrack.find('.slick-slide').each(function(index, slide) { 2535 if (slide.offsetLeft - centerOffset + ($(slide).outerWidth() / 2) > (_.swipeLeft * -1)) { 2536 swipedSlide = slide; 2537 return false; 2538 } 2539 }); 2540 2541 slidesTraversed = Math.abs($(swipedSlide).attr('data-slick-index') - _.currentSlide) || 1; 2542 2543 return slidesTraversed; 2544 2545 } else { 2546 return _.options.slidesToScroll; 2547 } 2548 2549 }; 2550 2551 Slick.prototype.goTo = Slick.prototype.slickGoTo = function(slide, dontAnimate) { 2552 2553 var _ = this; 2554 2555 _.changeSlide({ 2556 data: { 2557 message: 'index', 2558 index: parseInt(slide) 2559 } 2560 }, dontAnimate); 2561 2562 }; 2563 2564 Slick.prototype.init = function(creation) { 2565 2566 var _ = this; 2567 2568 if (!$(_.$slider).hasClass('slick-initialized')) { 2569 2570 $(_.$slider).addClass('slick-initialized'); 2571 2572 _.buildRows(); 2573 _.buildOut(); 2574 _.setProps(); 2575 _.startLoad(); 2576 _.loadSlider(); 2577 _.initializeEvents(); 2578 _.updateArrows(); 2579 _.updateDots(); 2580 _.checkResponsive(true); 2581 _.focusHandler(); 2582 2583 } 2584 2585 if (creation) { 2586 _.$slider.trigger('init', [_]); 2587 } 2588 2589 if (_.options.accessibility === true) { 2590 _.initADA(); 2591 } 2592 2593 if ( _.options.autoplay ) { 2594 2595 _.paused = false; 2596 _.autoPlay(); 2597 2598 } 2599 2600 }; 2601 2602 Slick.prototype.initADA = function() { 2603 var _ = this, 2604 numDotGroups = Math.ceil(_.slideCount / _.options.slidesToShow), 2605 tabControlIndexes = _.getNavigableIndexes().filter(function(val) { 2606 return (val >= 0) && (val < _.slideCount); 2607 }); 2608 2609 _.$slides.add(_.$slideTrack.find('.slick-cloned')).attr({ 2610 'aria-hidden': 'true', 2611 'tabindex': '-1' 2612 }).find('a, input, button, select').attr({ 2613 'tabindex': '-1' 2614 }); 2615 2616 if (_.$dots !== null) { 2617 _.$slides.not(_.$slideTrack.find('.slick-cloned')).each(function(i) { 2618 var slideControlIndex = tabControlIndexes.indexOf(i); 2619 2620 $(this).attr({ 2621 'role': 'tabpanel', 2622 'id': 'slick-slide' + _.instanceUid + i, 2623 'tabindex': -1 2624 }); 2625 2626 if (slideControlIndex !== -1) { 2627 var ariaButtonControl = 'slick-slide-control' + _.instanceUid + slideControlIndex 2628 if ($('#' + ariaButtonControl).length) { 2629 $(this).attr({ 2630 'aria-describedby': ariaButtonControl 2631 }); 2632 } 2633 } 2634 }); 2635 2636 _.$dots.attr('role', 'tablist').find('li').each(function(i) { 2637 var mappedSlideIndex = tabControlIndexes[i]; 2638 2639 $(this).attr({ 2640 'role': 'presentation' 2641 }); 2642 2643 $(this).find('button').first().attr({ 2644 'role': 'tab', 2645 'id': 'slick-slide-control' + _.instanceUid + i, 2646 'aria-controls': 'slick-slide' + _.instanceUid + mappedSlideIndex, 2647 'aria-label': (i + 1) + ' of ' + numDotGroups, 2648 'aria-selected': null, 2649 'tabindex': '-1' 2650 }); 2651 2652 }).eq(_.currentSlide).find('button').attr({ 2653 'aria-selected': 'true', 2654 'tabindex': '0' 2655 }).end(); 2656 } 2657 2658 for (var i=_.currentSlide, max=i+_.options.slidesToShow; i < max; i++) { 2659 if (_.options.focusOnChange) { 2660 _.$slides.eq(i).attr({'tabindex': '0'}); 2661 } else { 2662 _.$slides.eq(i).removeAttr('tabindex'); 2663 } 2664 } 2665 2666 _.activateADA(); 2667 2668 }; 2669 2670 Slick.prototype.initArrowEvents = function() { 2671 2672 var _ = this; 2673 2674 if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) { 2675 _.$prevArrow 2676 .off('click.slick') 2677 .on('click.slick', { 2678 message: 'previous' 2679 }, _.changeSlide); 2680 _.$nextArrow 2681 .off('click.slick') 2682 .on('click.slick', { 2683 message: 'next' 2684 }, _.changeSlide); 2685 2686 if (_.options.accessibility === true) { 2687 _.$prevArrow.on('keydown.slick', _.keyHandler); 2688 _.$nextArrow.on('keydown.slick', _.keyHandler); 2689 } 2690 } 2691 2692 }; 2693 2694 Slick.prototype.initDotEvents = function() { 2695 2696 var _ = this; 2697 2698 if (_.options.dots === true && _.slideCount > _.options.slidesToShow) { 2699 $('li', _.$dots).on('click.slick', { 2700 message: 'index' 2701 }, _.changeSlide); 2702 2703 if (_.options.accessibility === true) { 2704 _.$dots.on('keydown.slick', _.keyHandler); 2705 } 2706 } 2707 2708 if (_.options.dots === true && _.options.pauseOnDotsHover === true && _.slideCount > _.options.slidesToShow) { 2709 2710 $('li', _.$dots) 2711 .on('mouseenter.slick', $.proxy(_.interrupt, _, true)) 2712 .on('mouseleave.slick', $.proxy(_.interrupt, _, false)); 2713 2714 } 2715 2716 }; 2717 2718 Slick.prototype.initSlideEvents = function() { 2719 2720 var _ = this; 2721 2722 if ( _.options.pauseOnHover ) { 2723 2724 _.$list.on('mouseenter.slick', $.proxy(_.interrupt, _, true)); 2725 _.$list.on('mouseleave.slick', $.proxy(_.interrupt, _, false)); 2726 2727 } 2728 2729 }; 2730 2731 Slick.prototype.initializeEvents = function() { 2732 2733 var _ = this; 2734 2735 _.initArrowEvents(); 2736 2737 _.initDotEvents(); 2738 _.initSlideEvents(); 2739 2740 _.$list.on('touchstart.slick mousedown.slick', { 2741 action: 'start' 2742 }, _.swipeHandler); 2743 _.$list.on('touchmove.slick mousemove.slick', { 2744 action: 'move' 2745 }, _.swipeHandler); 2746 _.$list.on('touchend.slick mouseup.slick', { 2747 action: 'end' 2748 }, _.swipeHandler); 2749 _.$list.on('touchcancel.slick mouseleave.slick', { 2750 action: 'end' 2751 }, _.swipeHandler); 2752 2753 _.$list.on('click.slick', _.clickHandler); 2754 2755 $(document).on(_.visibilityChange, $.proxy(_.visibility, _)); 2756 2757 if (_.options.accessibility === true) { 2758 _.$list.on('keydown.slick', _.keyHandler); 2759 } 2760 2761 if (_.options.focusOnSelect === true) { 2762 $(_.$slideTrack).children().on('click.slick', _.selectHandler); 2763 } 2764 2765 $(window).on('orientationchange.slick.slick-' + _.instanceUid, $.proxy(_.orientationChange, _)); 2766 2767 $(window).on('resize.slick.slick-' + _.instanceUid, $.proxy(_.resize, _)); 2768 2769 $('[draggable!=true]', _.$slideTrack).on('dragstart', _.preventDefault); 2770 2771 $(window).on('load.slick.slick-' + _.instanceUid, _.setPosition); 2772 $(_.setPosition); 2773 2774 }; 2775 2776 Slick.prototype.initUI = function() { 2777 2778 var _ = this; 2779 2780 if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) { 2781 2782 _.$prevArrow.show(); 2783 _.$nextArrow.show(); 2784 2785 } 2786 2787 if (_.options.dots === true && _.slideCount > _.options.slidesToShow) { 2788 2789 _.$dots.show(); 2790 2791 } 2792 2793 }; 2794 2795 Slick.prototype.keyHandler = function(event) { 2796 2797 var _ = this; 2798 //Dont slide if the cursor is inside the form fields and arrow keys are pressed 2799 if(!event.target.tagName.match('TEXTAREA|INPUT|SELECT')) { 2800 if (event.keyCode === 37 && _.options.accessibility === true) { 2801 _.changeSlide({ 2802 data: { 2803 message: _.options.rtl === true ? 'next' : 'previous' 2804 } 2805 }); 2806 } else if (event.keyCode === 39 && _.options.accessibility === true) { 2807 _.changeSlide({ 2808 data: { 2809 message: _.options.rtl === true ? 'previous' : 'next' 2810 } 2811 }); 2812 } 2813 } 2814 2815 }; 2816 2817 Slick.prototype.lazyLoad = function() { 2818 2819 var _ = this, 2820 loadRange, cloneRange, rangeStart, rangeEnd; 2821 2822 function loadImages(imagesScope) { 2823 2824 $('img[data-lazy]', imagesScope).each(function() { 2825 2826 var image = $(this), 2827 imageSource = $(this).attr('data-lazy'), 2828 imageSrcSet = $(this).attr('data-srcset'), 2829 imageSizes = $(this).attr('data-sizes') || _.$slider.attr('data-sizes'), 2830 imageToLoad = document.createElement('img'); 2831 2832 imageToLoad.onload = function() { 2833 2834 image 2835 .animate({ opacity: 0 }, 100, function() { 2836 2837 if (imageSrcSet) { 2838 image 2839 .attr('srcset', imageSrcSet ); 2840 2841 if (imageSizes) { 2842 image 2843 .attr('sizes', imageSizes ); 2844 } 2845 } 2846 2847 image 2848 .attr('src', imageSource) 2849 .animate({ opacity: 1 }, 200, function() { 2850 image 2851 .removeAttr('data-lazy data-srcset data-sizes') 2852 .removeClass('slick-loading'); 2853 }); 2854 _.$slider.trigger('lazyLoaded', [_, image, imageSource]); 2855 }); 2856 2857 }; 2858 2859 imageToLoad.onerror = function() { 2860 2861 image 2862 .removeAttr( 'data-lazy' ) 2863 .removeClass( 'slick-loading' ) 2864 .addClass( 'slick-lazyload-error' ); 2865 2866 _.$slider.trigger('lazyLoadError', [ _, image, imageSource ]); 2867 2868 }; 2869 2870 imageToLoad.src = imageSource; 2871 2872 }); 2873 2874 } 2875 2876 if (_.options.centerMode === true) { 2877 if (_.options.infinite === true) { 2878 rangeStart = _.currentSlide + (_.options.slidesToShow / 2 + 1); 2879 rangeEnd = rangeStart + _.options.slidesToShow + 2; 2880 } else { 2881 rangeStart = Math.max(0, _.currentSlide - (_.options.slidesToShow / 2 + 1)); 2882 rangeEnd = 2 + (_.options.slidesToShow / 2 + 1) + _.currentSlide; 2883 } 2884 } else { 2885 rangeStart = _.options.infinite ? _.options.slidesToShow + _.currentSlide : _.currentSlide; 2886 rangeEnd = Math.ceil(rangeStart + _.options.slidesToShow); 2887 if (_.options.fade === true) { 2888 if (rangeStart > 0) rangeStart--; 2889 if (rangeEnd <= _.slideCount) rangeEnd++; 2890 } 2891 } 2892 2893 loadRange = _.$slider.find('.slick-slide').slice(rangeStart, rangeEnd); 2894 2895 if (_.options.lazyLoad === 'anticipated') { 2896 var prevSlide = rangeStart - 1, 2897 nextSlide = rangeEnd, 2898 $slides = _.$slider.find('.slick-slide'); 2899 2900 for (var i = 0; i < _.options.slidesToScroll; i++) { 2901 if (prevSlide < 0) prevSlide = _.slideCount - 1; 2902 loadRange = loadRange.add($slides.eq(prevSlide)); 2903 loadRange = loadRange.add($slides.eq(nextSlide)); 2904 prevSlide--; 2905 nextSlide++; 2906 } 2907 } 2908 2909 loadImages(loadRange); 2910 2911 if (_.slideCount <= _.options.slidesToShow) { 2912 cloneRange = _.$slider.find('.slick-slide'); 2913 loadImages(cloneRange); 2914 } else 2915 if (_.currentSlide >= _.slideCount - _.options.slidesToShow) { 2916 cloneRange = _.$slider.find('.slick-cloned').slice(0, _.options.slidesToShow); 2917 loadImages(cloneRange); 2918 } else if (_.currentSlide === 0) { 2919 cloneRange = _.$slider.find('.slick-cloned').slice(_.options.slidesToShow * -1); 2920 loadImages(cloneRange); 2921 } 2922 2923 }; 2924 2925 Slick.prototype.loadSlider = function() { 2926 2927 var _ = this; 2928 2929 _.setPosition(); 2930 2931 _.$slideTrack.css({ 2932 opacity: 1 2933 }); 2934 2935 _.$slider.removeClass('slick-loading'); 2936 2937 _.initUI(); 2938 2939 if (_.options.lazyLoad === 'progressive') { 2940 _.progressiveLazyLoad(); 2941 } 2942 2943 }; 2944 2945 Slick.prototype.next = Slick.prototype.slickNext = function() { 2946 2947 var _ = this; 2948 2949 _.changeSlide({ 2950 data: { 2951 message: 'next' 2952 } 2953 }); 2954 2955 }; 2956 2957 Slick.prototype.orientationChange = function() { 2958 2959 var _ = this; 2960 2961 _.checkResponsive(); 2962 _.setPosition(); 2963 2964 }; 2965 2966 Slick.prototype.pause = Slick.prototype.slickPause = function() { 2967 2968 var _ = this; 2969 2970 _.autoPlayClear(); 2971 _.paused = true; 2972 2973 }; 2974 2975 Slick.prototype.play = Slick.prototype.slickPlay = function() { 2976 2977 var _ = this; 2978 2979 _.autoPlay(); 2980 _.options.autoplay = true; 2981 _.paused = false; 2982 _.focussed = false; 2983 _.interrupted = false; 2984 2985 }; 2986 2987 Slick.prototype.postSlide = function(index) { 2988 2989 var _ = this; 2990 2991 if( !_.unslicked ) { 2992 2993 _.$slider.trigger('afterChange', [_, index]); 2994 2995 _.animating = false; 2996 2997 if (_.slideCount > _.options.slidesToShow) { 2998 _.setPosition(); 2999 } 3000 3001 _.swipeLeft = null; 3002 3003 if ( _.options.autoplay ) { 3004 _.autoPlay(); 3005 } 3006 3007 if (_.options.accessibility === true) { 3008 _.initADA(); 3009 3010 if (_.options.focusOnChange) { 3011 var $currentSlide = $(_.$slides.get(_.currentSlide)); 3012 $currentSlide.attr('tabindex', 0).focus(); 3013 } 3014 } 3015 3016 } 3017 3018 }; 3019 3020 Slick.prototype.prev = Slick.prototype.slickPrev = function() { 3021 3022 var _ = this; 3023 3024 _.changeSlide({ 3025 data: { 3026 message: 'previous' 3027 } 3028 }); 3029 3030 }; 3031 3032 Slick.prototype.preventDefault = function(event) { 3033 3034 event.preventDefault(); 3035 3036 }; 3037 3038 Slick.prototype.progressiveLazyLoad = function( tryCount ) { 3039 3040 tryCount = tryCount || 1; 3041 3042 var _ = this, 3043 $imgsToLoad = $( 'img[data-lazy]', _.$slider ), 3044 image, 3045 imageSource, 3046 imageSrcSet, 3047 imageSizes, 3048 imageToLoad; 3049 3050 if ( $imgsToLoad.length ) { 3051 3052 image = $imgsToLoad.first(); 3053 imageSource = image.attr('data-lazy'); 3054 imageSrcSet = image.attr('data-srcset'); 3055 imageSizes = image.attr('data-sizes') || _.$slider.attr('data-sizes'); 3056 imageToLoad = document.createElement('img'); 3057 3058 imageToLoad.onload = function() { 3059 3060 if (imageSrcSet) { 3061 image 3062 .attr('srcset', imageSrcSet ); 3063 3064 if (imageSizes) { 3065 image 3066 .attr('sizes', imageSizes ); 3067 } 3068 } 3069 3070 image 3071 .attr( 'src', imageSource ) 3072 .removeAttr('data-lazy data-srcset data-sizes') 3073 .removeClass('slick-loading'); 3074 3075 if ( _.options.adaptiveHeight === true ) { 3076 _.setPosition(); 3077 } 3078 3079 _.$slider.trigger('lazyLoaded', [ _, image, imageSource ]); 3080 _.progressiveLazyLoad(); 3081 3082 }; 3083 3084 imageToLoad.onerror = function() { 3085 3086 if ( tryCount < 3 ) { 3087 3088 /** 3089 * try to load the image 3 times, 3090 * leave a slight delay so we don't get 3091 * servers blocking the request. 3092 */ 3093 setTimeout( function() { 3094 _.progressiveLazyLoad( tryCount + 1 ); 3095 }, 500 ); 3096 3097 } else { 3098 3099 image 3100 .removeAttr( 'data-lazy' ) 3101 .removeClass( 'slick-loading' ) 3102 .addClass( 'slick-lazyload-error' ); 3103 3104 _.$slider.trigger('lazyLoadError', [ _, image, imageSource ]); 3105 3106 _.progressiveLazyLoad(); 3107 3108 } 3109 3110 }; 3111 3112 imageToLoad.src = imageSource; 3113 3114 } else { 3115 3116 _.$slider.trigger('allImagesLoaded', [ _ ]); 3117 3118 } 3119 3120 }; 3121 3122 Slick.prototype.refresh = function( initializing ) { 3123 3124 var _ = this, currentSlide, lastVisibleIndex; 3125 3126 lastVisibleIndex = _.slideCount - _.options.slidesToShow; 3127 3128 // in non-infinite sliders, we don't want to go past the 3129 // last visible index. 3130 if( !_.options.infinite && ( _.currentSlide > lastVisibleIndex )) { 3131 _.currentSlide = lastVisibleIndex; 3132 } 3133 3134 // if less slides than to show, go to start. 3135 if ( _.slideCount <= _.options.slidesToShow ) { 3136 _.currentSlide = 0; 3137 3138 } 3139 3140 currentSlide = _.currentSlide; 3141 3142 _.destroy(true); 3143 3144 $.extend(_, _.initials, { currentSlide: currentSlide }); 3145 3146 _.init(); 3147 3148 if( !initializing ) { 3149 3150 _.changeSlide({ 3151 data: { 3152 message: 'index', 3153 index: currentSlide 3154 } 3155 }, false); 3156 3157 } 3158 3159 }; 3160 3161 Slick.prototype.registerBreakpoints = function() { 3162 3163 var _ = this, breakpoint, currentBreakpoint, l, 3164 responsiveSettings = _.options.responsive || null; 3165 3166 if ( $.type(responsiveSettings) === 'array' && responsiveSettings.length ) { 3167 3168 _.respondTo = _.options.respondTo || 'window'; 3169 3170 for ( breakpoint in responsiveSettings ) { 3171 3172 l = _.breakpoints.length-1; 3173 3174 if (responsiveSettings.hasOwnProperty(breakpoint)) { 3175 currentBreakpoint = responsiveSettings[breakpoint].breakpoint; 3176 3177 // loop through the breakpoints and cut out any existing 3178 // ones with the same breakpoint number, we don't want dupes. 3179 while( l >= 0 ) { 3180 if( _.breakpoints[l] && _.breakpoints[l] === currentBreakpoint ) { 3181 _.breakpoints.splice(l,1); 3182 } 3183 l--; 3184 } 3185 3186 _.breakpoints.push(currentBreakpoint); 3187 _.breakpointSettings[currentBreakpoint] = responsiveSettings[breakpoint].settings; 3188 3189 } 3190 3191 } 3192 3193 _.breakpoints.sort(function(a, b) { 3194 return ( _.options.mobileFirst ) ? a-b : b-a; 3195 }); 3196 3197 } 3198 3199 }; 3200 3201 Slick.prototype.reinit = function() { 3202 3203 var _ = this; 3204 3205 _.$slides = 3206 _.$slideTrack 3207 .children(_.options.slide) 3208 .addClass('slick-slide'); 3209 3210 _.slideCount = _.$slides.length; 3211 3212 if (_.currentSlide >= _.slideCount && _.currentSlide !== 0) { 3213 _.currentSlide = _.currentSlide - _.options.slidesToScroll; 3214 } 3215 3216 if (_.slideCount <= _.options.slidesToShow) { 3217 _.currentSlide = 0; 3218 } 3219 3220 _.registerBreakpoints(); 3221 3222 _.setProps(); 3223 _.setupInfinite(); 3224 _.buildArrows(); 3225 _.updateArrows(); 3226 _.initArrowEvents(); 3227 _.buildDots(); 3228 _.updateDots(); 3229 _.initDotEvents(); 3230 _.cleanUpSlideEvents(); 3231 _.initSlideEvents(); 3232 3233 _.checkResponsive(false, true); 3234 3235 if (_.options.focusOnSelect === true) { 3236 $(_.$slideTrack).children().on('click.slick', _.selectHandler); 3237 } 3238 3239 _.setSlideClasses(typeof _.currentSlide === 'number' ? _.currentSlide : 0); 3240 3241 _.setPosition(); 3242 _.focusHandler(); 3243 3244 _.paused = !_.options.autoplay; 3245 _.autoPlay(); 3246 3247 _.$slider.trigger('reInit', [_]); 3248 3249 }; 3250 3251 Slick.prototype.resize = function() { 3252 3253 var _ = this; 3254 3255 if ($(window).width() !== _.windowWidth) { 3256 clearTimeout(_.windowDelay); 3257 _.windowDelay = window.setTimeout(function() { 3258 _.windowWidth = $(window).width(); 3259 _.checkResponsive(); 3260 if( !_.unslicked ) { _.setPosition(); } 3261 }, 50); 3262 } 3263 }; 3264 3265 Slick.prototype.removeSlide = Slick.prototype.slickRemove = function(index, removeBefore, removeAll) { 3266 3267 var _ = this; 3268 3269 if (typeof(index) === 'boolean') { 3270 removeBefore = index; 3271 index = removeBefore === true ? 0 : _.slideCount - 1; 3272 } else { 3273 index = removeBefore === true ? --index : index; 3274 } 3275 3276 if (_.slideCount < 1 || index < 0 || index > _.slideCount - 1) { 3277 return false; 3278 } 3279 3280 _.unload(); 3281 3282 if (removeAll === true) { 3283 _.$slideTrack.children().remove(); 3284 } else { 3285 _.$slideTrack.children(this.options.slide).eq(index).remove(); 3286 } 3287 3288 _.$slides = _.$slideTrack.children(this.options.slide); 3289 3290 _.$slideTrack.children(this.options.slide).detach(); 3291 3292 _.$slideTrack.append(_.$slides); 3293 3294 _.$slidesCache = _.$slides; 3295 3296 _.reinit(); 3297 3298 }; 3299 3300 Slick.prototype.setCSS = function(position) { 3301 3302 var _ = this, 3303 positionProps = {}, 3304 x, y; 3305 3306 if (_.options.rtl === true) { 3307 position = -position; 3308 } 3309 x = _.positionProp == 'left' ? Math.ceil(position) + 'px' : '0px'; 3310 y = _.positionProp == 'top' ? Math.ceil(position) + 'px' : '0px'; 3311 3312 positionProps[_.positionProp] = position; 3313 3314 if (_.transformsEnabled === false) { 3315 _.$slideTrack.css(positionProps); 3316 } else { 3317 positionProps = {}; 3318 if (_.cssTransitions === false) { 3319 positionProps[_.animType] = 'translate(' + x + ', ' + y + ')'; 3320 _.$slideTrack.css(positionProps); 3321 } else { 3322 positionProps[_.animType] = 'translate3d(' + x + ', ' + y + ', 0px)'; 3323 _.$slideTrack.css(positionProps); 3324 } 3325 } 3326 3327 }; 3328 3329 Slick.prototype.setDimensions = function() { 3330 3331 var _ = this; 3332 3333 if (_.options.vertical === false) { 3334 if (_.options.centerMode === true) { 3335 _.$list.css({ 3336 padding: ('0px ' + _.options.centerPadding) 3337 }); 3338 } 3339 } else { 3340 _.$list.height(_.$slides.first().outerHeight(true) * _.options.slidesToShow); 3341 if (_.options.centerMode === true) { 3342 _.$list.css({ 3343 padding: (_.options.centerPadding + ' 0px') 3344 }); 3345 } 3346 } 3347 3348 _.listWidth = _.$list.width(); 3349 _.listHeight = _.$list.height(); 3350 3351 3352 if (_.options.vertical === false && _.options.variableWidth === false) { 3353 _.slideWidth = Math.ceil(_.listWidth / _.options.slidesToShow); 3354 _.$slideTrack.width(Math.ceil((_.slideWidth * _.$slideTrack.children('.slick-slide').length))); 3355 3356 } else if (_.options.variableWidth === true) { 3357 _.$slideTrack.width(5000 * _.slideCount); 3358 } else { 3359 _.slideWidth = Math.ceil(_.listWidth); 3360 _.$slideTrack.height(Math.ceil((_.$slides.first().outerHeight(true) * _.$slideTrack.children('.slick-slide').length))); 3361 } 3362 3363 var offset = _.$slides.first().outerWidth(true) - _.$slides.first().width(); 3364 if (_.options.variableWidth === false) _.$slideTrack.children('.slick-slide').width(_.slideWidth - offset); 3365 3366 }; 3367 3368 Slick.prototype.setFade = function() { 3369 3370 var _ = this, 3371 targetLeft; 3372 3373 _.$slides.each(function(index, element) { 3374 targetLeft = (_.slideWidth * index) * -1; 3375 if (_.options.rtl === true) { 3376 $(element).css({ 3377 position: 'relative', 3378 right: targetLeft, 3379 top: 0, 3380 zIndex: _.options.zIndex - 2, 3381 opacity: 0 3382 }); 3383 } else { 3384 $(element).css({ 3385 position: 'relative', 3386 left: targetLeft, 3387 top: 0, 3388 zIndex: _.options.zIndex - 2, 3389 opacity: 0 3390 }); 3391 } 3392 }); 3393 3394 _.$slides.eq(_.currentSlide).css({ 3395 zIndex: _.options.zIndex - 1, 3396 opacity: 1 3397 }); 3398 3399 }; 3400 3401 Slick.prototype.setHeight = function() { 3402 3403 var _ = this; 3404 3405 if (_.options.slidesToShow === 1 && _.options.adaptiveHeight === true && _.options.vertical === false) { 3406 var targetHeight = _.$slides.eq(_.currentSlide).outerHeight(true); 3407 _.$list.css('height', targetHeight); 3408 } 3409 3410 }; 3411 3412 Slick.prototype.setOption = 3413 Slick.prototype.slickSetOption = function() { 3414 3415 /** 3416 * accepts arguments in format of: 3417 * 3418 * - for changing a single option's value: 3419 * .slick("setOption", option, value, refresh ) 3420 * 3421 * - for changing a set of responsive options: 3422 * .slick("setOption", 'responsive', [{}, ...], refresh ) 3423 * 3424 * - for updating multiple values at once (not responsive) 3425 * .slick("setOption", { 'option': value, ... }, refresh ) 3426 */ 3427 3428 var _ = this, l, item, option, value, refresh = false, type; 3429 3430 if( $.type( arguments[0] ) === 'object' ) { 3431 3432 option = arguments[0]; 3433 refresh = arguments[1]; 3434 type = 'multiple'; 3435 3436 } else if ( $.type( arguments[0] ) === 'string' ) { 3437 3438 option = arguments[0]; 3439 value = arguments[1]; 3440 refresh = arguments[2]; 3441 3442 if ( arguments[0] === 'responsive' && $.type( arguments[1] ) === 'array' ) { 3443 3444 type = 'responsive'; 3445 3446 } else if ( typeof arguments[1] !== 'undefined' ) { 3447 3448 type = 'single'; 3449 3450 } 3451 3452 } 3453 3454 if ( type === 'single' ) { 3455 3456 _.options[option] = value; 3457 3458 3459 } else if ( type === 'multiple' ) { 3460 3461 $.each( option , function( opt, val ) { 3462 3463 _.options[opt] = val; 3464 3465 }); 3466 3467 3468 } else if ( type === 'responsive' ) { 3469 3470 for ( item in value ) { 3471 3472 if( $.type( _.options.responsive ) !== 'array' ) { 3473 3474 _.options.responsive = [ value[item] ]; 3475 3476 } else { 3477 3478 l = _.options.responsive.length-1; 3479 3480 // loop through the responsive object and splice out duplicates. 3481 while( l >= 0 ) { 3482 3483 if( _.options.responsive[l].breakpoint === value[item].breakpoint ) { 3484 3485 _.options.responsive.splice(l,1); 3486 3487 } 3488 3489 l--; 3490 3491 } 3492 3493 _.options.responsive.push( value[item] ); 3494 3495 } 3496 3497 } 3498 3499 } 3500 3501 if ( refresh ) { 3502 3503 _.unload(); 3504 _.reinit(); 3505 3506 } 3507 3508 }; 3509 3510 Slick.prototype.setPosition = function() { 3511 3512 var _ = this; 3513 3514 _.setDimensions(); 3515 3516 _.setHeight(); 3517 3518 if (_.options.fade === false) { 3519 _.setCSS(_.getLeft(_.currentSlide)); 3520 } else { 3521 _.setFade(); 3522 } 3523 3524 _.$slider.trigger('setPosition', [_]); 3525 3526 }; 3527 3528 Slick.prototype.setProps = function() { 3529 3530 var _ = this, 3531 bodyStyle = document.body.style; 3532 3533 _.positionProp = _.options.vertical === true ? 'top' : 'left'; 3534 3535 if (_.positionProp === 'top') { 3536 _.$slider.addClass('slick-vertical'); 3537 } else { 3538 _.$slider.removeClass('slick-vertical'); 3539 } 3540 3541 if (bodyStyle.WebkitTransition !== undefined || 3542 bodyStyle.MozTransition !== undefined || 3543 bodyStyle.msTransition !== undefined) { 3544 if (_.options.useCSS === true) { 3545 _.cssTransitions = true; 3546 } 3547 } 3548 3549 if ( _.options.fade ) { 3550 if ( typeof _.options.zIndex === 'number' ) { 3551 if( _.options.zIndex < 3 ) { 3552 _.options.zIndex = 3; 3553 } 3554 } else { 3555 _.options.zIndex = _.defaults.zIndex; 3556 } 3557 } 3558 3559 if (bodyStyle.OTransform !== undefined) { 3560 _.animType = 'OTransform'; 3561 _.transformType = '-o-transform'; 3562 _.transitionType = 'OTransition'; 3563 if (bodyStyle.perspectiveProperty === undefined && bodyStyle.webkitPerspective === undefined) _.animType = false; 3564 } 3565 if (bodyStyle.MozTransform !== undefined) { 3566 _.animType = 'MozTransform'; 3567 _.transformType = '-moz-transform'; 3568 _.transitionType = 'MozTransition'; 3569 if (bodyStyle.perspectiveProperty === undefined && bodyStyle.MozPerspective === undefined) _.animType = false; 3570 } 3571 if (bodyStyle.webkitTransform !== undefined) { 3572 _.animType = 'webkitTransform'; 3573 _.transformType = '-webkit-transform'; 3574 _.transitionType = 'webkitTransition'; 3575 if (bodyStyle.perspectiveProperty === undefined && bodyStyle.webkitPerspective === undefined) _.animType = false; 3576 } 3577 if (bodyStyle.msTransform !== undefined) { 3578 _.animType = 'msTransform'; 3579 _.transformType = '-ms-transform'; 3580 _.transitionType = 'msTransition'; 3581 if (bodyStyle.msTransform === undefined) _.animType = false; 3582 } 3583 if (bodyStyle.transform !== undefined && _.animType !== false) { 3584 _.animType = 'transform'; 3585 _.transformType = 'transform'; 3586 _.transitionType = 'transition'; 3587 } 3588 _.transformsEnabled = _.options.useTransform && (_.animType !== null && _.animType !== false); 3589 }; 3590 3591 3592 Slick.prototype.setSlideClasses = function(index) { 3593 3594 var _ = this, 3595 centerOffset, allSlides, indexOffset, remainder; 3596 3597 allSlides = _.$slider 3598 .find('.slick-slide') 3599 .removeClass('slick-active slick-center slick-current') 3600 .attr('aria-hidden', 'true'); 3601 3602 _.$slides 3603 .eq(index) 3604 .addClass('slick-current'); 3605 3606 if (_.options.centerMode === true) { 3607 3608 var evenCoef = _.options.slidesToShow % 2 === 0 ? 1 : 0; 3609 3610 centerOffset = Math.floor(_.options.slidesToShow / 2); 3611 3612 if (_.options.infinite === true) { 3613 3614 if (index >= centerOffset && index <= (_.slideCount - 1) - centerOffset) { 3615 _.$slides 3616 .slice(index - centerOffset + evenCoef, index + centerOffset + 1) 3617 .addClass('slick-active') 3618 .attr('aria-hidden', 'false'); 3619 3620 } else { 3621 3622 indexOffset = _.options.slidesToShow + index; 3623 allSlides 3624 .slice(indexOffset - centerOffset + 1 + evenCoef, indexOffset + centerOffset + 2) 3625 .addClass('slick-active') 3626 .attr('aria-hidden', 'false'); 3627 3628 } 3629 3630 if (index === 0) { 3631 3632 allSlides 3633 .eq(allSlides.length - 1 - _.options.slidesToShow) 3634 .addClass('slick-center'); 3635 3636 } else if (index === _.slideCount - 1) { 3637 3638 allSlides 3639 .eq(_.options.slidesToShow) 3640 .addClass('slick-center'); 3641 3642 } 3643 3644 } 3645 3646 _.$slides 3647 .eq(index) 3648 .addClass('slick-center'); 3649 3650 } else { 3651 3652 if (index >= 0 && index <= (_.slideCount - _.options.slidesToShow)) { 3653 3654 _.$slides 3655 .slice(index, index + _.options.slidesToShow) 3656 .addClass('slick-active') 3657 .attr('aria-hidden', 'false'); 3658 3659 } else if (allSlides.length <= _.options.slidesToShow) { 3660 3661 allSlides 3662 .addClass('slick-active') 3663 .attr('aria-hidden', 'false'); 3664 3665 } else { 3666 3667 remainder = _.slideCount % _.options.slidesToShow; 3668 indexOffset = _.options.infinite === true ? _.options.slidesToShow + index : index; 3669 3670 if (_.options.slidesToShow == _.options.slidesToScroll && (_.slideCount - index) < _.options.slidesToShow) { 3671 3672 allSlides 3673 .slice(indexOffset - (_.options.slidesToShow - remainder), indexOffset + remainder) 3674 .addClass('slick-active') 3675 .attr('aria-hidden', 'false'); 3676 3677 } else { 3678 3679 allSlides 3680 .slice(indexOffset, indexOffset + _.options.slidesToShow) 3681 .addClass('slick-active') 3682 .attr('aria-hidden', 'false'); 3683 3684 } 3685 3686 } 3687 3688 } 3689 3690 if (_.options.lazyLoad === 'ondemand' || _.options.lazyLoad === 'anticipated') { 3691 _.lazyLoad(); 3692 } 3693 }; 3694 3695 Slick.prototype.setupInfinite = function() { 3696 3697 var _ = this, 3698 i, slideIndex, infiniteCount; 3699 3700 if (_.options.fade === true) { 3701 _.options.centerMode = false; 3702 } 3703 3704 if (_.options.infinite === true && _.options.fade === false) { 3705 3706 slideIndex = null; 3707 3708 if (_.slideCount > _.options.slidesToShow) { 3709 3710 if (_.options.centerMode === true) { 3711 infiniteCount = _.options.slidesToShow + 1; 3712 } else { 3713 infiniteCount = _.options.slidesToShow; 3714 } 3715 3716 for (i = _.slideCount; i > (_.slideCount - 3717 infiniteCount); i -= 1) { 3718 slideIndex = i - 1; 3719 $(_.$slides[slideIndex]).clone(true).attr('id', '') 3720 .attr('data-slick-index', slideIndex - _.slideCount) 3721 .prependTo(_.$slideTrack).addClass('slick-cloned'); 3722 } 3723 for (i = 0; i < infiniteCount + _.slideCount; i += 1) { 3724 slideIndex = i; 3725 $(_.$slides[slideIndex]).clone(true).attr('id', '') 3726 .attr('data-slick-index', slideIndex + _.slideCount) 3727 .appendTo(_.$slideTrack).addClass('slick-cloned'); 3728 } 3729 _.$slideTrack.find('.slick-cloned').find('[id]').each(function() { 3730 $(this).attr('id', ''); 3731 }); 3732 3733 } 3734 3735 } 3736 3737 }; 3738 3739 Slick.prototype.interrupt = function( toggle ) { 3740 3741 var _ = this; 3742 3743 if( !toggle ) { 3744 _.autoPlay(); 3745 } 3746 _.interrupted = toggle; 3747 3748 }; 3749 3750 Slick.prototype.selectHandler = function(event) { 3751 3752 var _ = this; 3753 3754 var targetElement = 3755 $(event.target).is('.slick-slide') ? 3756 $(event.target) : 3757 $(event.target).parents('.slick-slide'); 3758 3759 var index = parseInt(targetElement.attr('data-slick-index')); 3760 3761 if (!index) index = 0; 3762 3763 if (_.slideCount <= _.options.slidesToShow) { 3764 3765 _.slideHandler(index, false, true); 3766 return; 3767 3768 } 3769 3770 _.slideHandler(index); 3771 3772 }; 3773 3774 Slick.prototype.slideHandler = function(index, sync, dontAnimate) { 3775 3776 var targetSlide, animSlide, oldSlide, slideLeft, targetLeft = null, 3777 _ = this, navTarget; 3778 3779 sync = sync || false; 3780 3781 if (_.animating === true && _.options.waitForAnimate === true) { 3782 return; 3783 } 3784 3785 if (_.options.fade === true && _.currentSlide === index) { 3786 return; 3787 } 3788 3789 if (sync === false) { 3790 _.asNavFor(index); 3791 } 3792 3793 targetSlide = index; 3794 targetLeft = _.getLeft(targetSlide); 3795 slideLeft = _.getLeft(_.currentSlide); 3796 3797 _.currentLeft = _.swipeLeft === null ? slideLeft : _.swipeLeft; 3798 3799 if (_.options.infinite === false && _.options.centerMode === false && (index < 0 || index > _.getDotCount() * _.options.slidesToScroll)) { 3800 if (_.options.fade === false) { 3801 targetSlide = _.currentSlide; 3802 if (dontAnimate !== true && _.slideCount > _.options.slidesToShow) { 3803 _.animateSlide(slideLeft, function() { 3804 _.postSlide(targetSlide); 3805 }); 3806 } else { 3807 _.postSlide(targetSlide); 3808 } 3809 } 3810 return; 3811 } else if (_.options.infinite === false && _.options.centerMode === true && (index < 0 || index > (_.slideCount - _.options.slidesToScroll))) { 3812 if (_.options.fade === false) { 3813 targetSlide = _.currentSlide; 3814 if (dontAnimate !== true && _.slideCount > _.options.slidesToShow) { 3815 _.animateSlide(slideLeft, function() { 3816 _.postSlide(targetSlide); 3817 }); 3818 } else { 3819 _.postSlide(targetSlide); 3820 } 3821 } 3822 return; 3823 } 3824 3825 if ( _.options.autoplay ) { 3826 clearInterval(_.autoPlayTimer); 3827 } 3828 3829 if (targetSlide < 0) { 3830 if (_.slideCount % _.options.slidesToScroll !== 0) { 3831 animSlide = _.slideCount - (_.slideCount % _.options.slidesToScroll); 3832 } else { 3833 animSlide = _.slideCount + targetSlide; 3834 } 3835 } else if (targetSlide >= _.slideCount) { 3836 if (_.slideCount % _.options.slidesToScroll !== 0) { 3837 animSlide = 0; 3838 } else { 3839 animSlide = targetSlide - _.slideCount; 3840 } 3841 } else { 3842 animSlide = targetSlide; 3843 } 3844 3845 _.animating = true; 3846 3847 _.$slider.trigger('beforeChange', [_, _.currentSlide, animSlide]); 3848 3849 oldSlide = _.currentSlide; 3850 _.currentSlide = animSlide; 3851 3852 _.setSlideClasses(_.currentSlide); 3853 3854 if ( _.options.asNavFor ) { 3855 3856 navTarget = _.getNavTarget(); 3857 navTarget = navTarget.slick('getSlick'); 3858 3859 if ( navTarget.slideCount <= navTarget.options.slidesToShow ) { 3860 navTarget.setSlideClasses(_.currentSlide); 3861 } 3862 3863 } 3864 3865 _.updateDots(); 3866 _.updateArrows(); 3867 3868 if (_.options.fade === true) { 3869 if (dontAnimate !== true) { 3870 3871 _.fadeSlideOut(oldSlide); 3872 3873 _.fadeSlide(animSlide, function() { 3874 _.postSlide(animSlide); 3875 }); 3876 3877 } else { 3878 _.postSlide(animSlide); 3879 } 3880 _.animateHeight(); 3881 return; 3882 } 3883 3884 if (dontAnimate !== true && _.slideCount > _.options.slidesToShow) { 3885 _.animateSlide(targetLeft, function() { 3886 _.postSlide(animSlide); 3887 }); 3888 } else { 3889 _.postSlide(animSlide); 3890 } 3891 3892 }; 3893 3894 Slick.prototype.startLoad = function() { 3895 3896 var _ = this; 3897 3898 if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) { 3899 3900 _.$prevArrow.hide(); 3901 _.$nextArrow.hide(); 3902 3903 } 3904 3905 if (_.options.dots === true && _.slideCount > _.options.slidesToShow) { 3906 3907 _.$dots.hide(); 3908 3909 } 3910 3911 _.$slider.addClass('slick-loading'); 3912 3913 }; 3914 3915 Slick.prototype.swipeDirection = function() { 3916 3917 var xDist, yDist, r, swipeAngle, _ = this; 3918 3919 xDist = _.touchObject.startX - _.touchObject.curX; 3920 yDist = _.touchObject.startY - _.touchObject.curY; 3921 r = Math.atan2(yDist, xDist); 3922 3923 swipeAngle = Math.round(r * 180 / Math.PI); 3924 if (swipeAngle < 0) { 3925 swipeAngle = 360 - Math.abs(swipeAngle); 3926 } 3927 3928 if ((swipeAngle <= 45) && (swipeAngle >= 0)) { 3929 return (_.options.rtl === false ? 'left' : 'right'); 3930 } 3931 if ((swipeAngle <= 360) && (swipeAngle >= 315)) { 3932 return (_.options.rtl === false ? 'left' : 'right'); 3933 } 3934 if ((swipeAngle >= 135) && (swipeAngle <= 225)) { 3935 return (_.options.rtl === false ? 'right' : 'left'); 3936 } 3937 if (_.options.verticalSwiping === true) { 3938 if ((swipeAngle >= 35) && (swipeAngle <= 135)) { 3939 return 'down'; 3940 } else { 3941 return 'up'; 3942 } 3943 } 3944 3945 return 'vertical'; 3946 3947 }; 3948 3949 Slick.prototype.swipeEnd = function(event) { 3950 3951 var _ = this, 3952 slideCount, 3953 direction; 3954 3955 _.dragging = false; 3956 _.swiping = false; 3957 3958 if (_.scrolling) { 3959 _.scrolling = false; 3960 return false; 3961 } 3962 3963 _.interrupted = false; 3964 _.shouldClick = ( _.touchObject.swipeLength > 10 ) ? false : true; 3965 3966 if ( _.touchObject.curX === undefined ) { 3967 return false; 3968 } 3969 3970 if ( _.touchObject.edgeHit === true ) { 3971 _.$slider.trigger('edge', [_, _.swipeDirection() ]); 3972 } 3973 3974 if ( _.touchObject.swipeLength >= _.touchObject.minSwipe ) { 3975 3976 direction = _.swipeDirection(); 3977 3978 switch ( direction ) { 3979 3980 case 'left': 3981 case 'down': 3982 3983 slideCount = 3984 _.options.swipeToSlide ? 3985 _.checkNavigable( _.currentSlide + _.getSlideCount() ) : 3986 _.currentSlide + _.getSlideCount(); 3987 3988 _.currentDirection = 0; 3989 3990 break; 3991 3992 case 'right': 3993 case 'up': 3994 3995 slideCount = 3996 _.options.swipeToSlide ? 3997 _.checkNavigable( _.currentSlide - _.getSlideCount() ) : 3998 _.currentSlide - _.getSlideCount(); 3999 4000 _.currentDirection = 1; 4001 4002 break; 4003 4004 default: 4005 4006 4007 } 4008 4009 if( direction != 'vertical' ) { 4010 4011 _.slideHandler( slideCount ); 4012 _.touchObject = {}; 4013 _.$slider.trigger('swipe', [_, direction ]); 4014 4015 } 4016 4017 } else { 4018 4019 if ( _.touchObject.startX !== _.touchObject.curX ) { 4020 4021 _.slideHandler( _.currentSlide ); 4022 _.touchObject = {}; 4023 4024 } 4025 4026 } 4027 4028 }; 4029 4030 Slick.prototype.swipeHandler = function(event) { 4031 4032 var _ = this; 4033 4034 if ((_.options.swipe === false) || ('ontouchend' in document && _.options.swipe === false)) { 4035 return; 4036 } else if (_.options.draggable === false && event.type.indexOf('mouse') !== -1) { 4037 return; 4038 } 4039 4040 _.touchObject.fingerCount = event.originalEvent && event.originalEvent.touches !== undefined ? 4041 event.originalEvent.touches.length : 1; 4042 4043 _.touchObject.minSwipe = _.listWidth / _.options 4044 .touchThreshold; 4045 4046 if (_.options.verticalSwiping === true) { 4047 _.touchObject.minSwipe = _.listHeight / _.options 4048 .touchThreshold; 4049 } 4050 4051 switch (event.data.action) { 4052 4053 case 'start': 4054 _.swipeStart(event); 4055 break; 4056 4057 case 'move': 4058 _.swipeMove(event); 4059 break; 4060 4061 case 'end': 4062 _.swipeEnd(event); 4063 break; 4064 4065 } 4066 4067 }; 4068 4069 Slick.prototype.swipeMove = function(event) { 4070 4071 var _ = this, 4072 edgeWasHit = false, 4073 curLeft, swipeDirection, swipeLength, positionOffset, touches, verticalSwipeLength; 4074 4075 touches = event.originalEvent !== undefined ? event.originalEvent.touches : null; 4076 4077 if (!_.dragging || _.scrolling || touches && touches.length !== 1) { 4078 return false; 4079 } 4080 4081 curLeft = _.getLeft(_.currentSlide); 4082 4083 _.touchObject.curX = touches !== undefined ? touches[0].pageX : event.clientX; 4084 _.touchObject.curY = touches !== undefined ? touches[0].pageY : event.clientY; 4085 4086 _.touchObject.swipeLength = Math.round(Math.sqrt( 4087 Math.pow(_.touchObject.curX - _.touchObject.startX, 2))); 4088 4089 verticalSwipeLength = Math.round(Math.sqrt( 4090 Math.pow(_.touchObject.curY - _.touchObject.startY, 2))); 4091 4092 if (!_.options.verticalSwiping && !_.swiping && verticalSwipeLength > 4) { 4093 _.scrolling = true; 4094 return false; 4095 } 4096 4097 if (_.options.verticalSwiping === true) { 4098 _.touchObject.swipeLength = verticalSwipeLength; 4099 } 4100 4101 swipeDirection = _.swipeDirection(); 4102 4103 if (event.originalEvent !== undefined && _.touchObject.swipeLength > 4) { 4104 _.swiping = true; 4105 event.preventDefault(); 4106 } 4107 4108 positionOffset = (_.options.rtl === false ? 1 : -1) * (_.touchObject.curX > _.touchObject.startX ? 1 : -1); 4109 if (_.options.verticalSwiping === true) { 4110 positionOffset = _.touchObject.curY > _.touchObject.startY ? 1 : -1; 4111 } 4112 4113 4114 swipeLength = _.touchObject.swipeLength; 4115 4116 _.touchObject.edgeHit = false; 4117 4118 if (_.options.infinite === false) { 4119 if ((_.currentSlide === 0 && swipeDirection === 'right') || (_.currentSlide >= _.getDotCount() && swipeDirection === 'left')) { 4120 swipeLength = _.touchObject.swipeLength * _.options.edgeFriction; 4121 _.touchObject.edgeHit = true; 4122 } 4123 } 4124 4125 if (_.options.vertical === false) { 4126 _.swipeLeft = curLeft + swipeLength * positionOffset; 4127 } else { 4128 _.swipeLeft = curLeft + (swipeLength * (_.$list.height() / _.listWidth)) * positionOffset; 4129 } 4130 if (_.options.verticalSwiping === true) { 4131 _.swipeLeft = curLeft + swipeLength * positionOffset; 4132 } 4133 4134 if (_.options.fade === true || _.options.touchMove === false) { 4135 return false; 4136 } 4137 4138 if (_.animating === true) { 4139 _.swipeLeft = null; 4140 return false; 4141 } 4142 4143 _.setCSS(_.swipeLeft); 4144 4145 }; 4146 4147 Slick.prototype.swipeStart = function(event) { 4148 4149 var _ = this, 4150 touches; 4151 4152 _.interrupted = true; 4153 4154 if (_.touchObject.fingerCount !== 1 || _.slideCount <= _.options.slidesToShow) { 4155 _.touchObject = {}; 4156 return false; 4157 } 4158 4159 if (event.originalEvent !== undefined && event.originalEvent.touches !== undefined) { 4160 touches = event.originalEvent.touches[0]; 4161 } 4162 4163 _.touchObject.startX = _.touchObject.curX = touches !== undefined ? touches.pageX : event.clientX; 4164 _.touchObject.startY = _.touchObject.curY = touches !== undefined ? touches.pageY : event.clientY; 4165 4166 _.dragging = true; 4167 4168 }; 4169 4170 Slick.prototype.unfilterSlides = Slick.prototype.slickUnfilter = function() { 4171 4172 var _ = this; 4173 4174 if (_.$slidesCache !== null) { 4175 4176 _.unload(); 4177 4178 _.$slideTrack.children(this.options.slide).detach(); 4179 4180 _.$slidesCache.appendTo(_.$slideTrack); 4181 4182 _.reinit(); 4183 4184 } 4185 4186 }; 4187 4188 Slick.prototype.unload = function() { 4189 4190 var _ = this; 4191 4192 $('.slick-cloned', _.$slider).remove(); 4193 4194 if (_.$dots) { 4195 _.$dots.remove(); 4196 } 4197 4198 if (_.$prevArrow && _.htmlExpr.test(_.options.prevArrow)) { 4199 _.$prevArrow.remove(); 4200 } 4201 4202 if (_.$nextArrow && _.htmlExpr.test(_.options.nextArrow)) { 4203 _.$nextArrow.remove(); 4204 } 4205 4206 _.$slides 4207 .removeClass('slick-slide slick-active slick-visible slick-current') 4208 .attr('aria-hidden', 'true') 4209 .css('width', ''); 4210 4211 }; 4212 4213 Slick.prototype.unslick = function(fromBreakpoint) { 4214 4215 var _ = this; 4216 _.$slider.trigger('unslick', [_, fromBreakpoint]); 4217 _.destroy(); 4218 4219 }; 4220 4221 Slick.prototype.updateArrows = function() { 4222 4223 var _ = this, 4224 centerOffset; 4225 4226 centerOffset = Math.floor(_.options.slidesToShow / 2); 4227 4228 if ( _.options.arrows === true && 4229 _.slideCount > _.options.slidesToShow && 4230 !_.options.infinite ) { 4231 4232 _.$prevArrow.removeClass('slick-disabled').attr('aria-disabled', 'false'); 4233 _.$nextArrow.removeClass('slick-disabled').attr('aria-disabled', 'false'); 4234 4235 if (_.currentSlide === 0) { 4236 4237 _.$prevArrow.addClass('slick-disabled').attr('aria-disabled', 'true'); 4238 _.$nextArrow.removeClass('slick-disabled').attr('aria-disabled', 'false'); 4239 4240 } else if (_.currentSlide >= _.slideCount - _.options.slidesToShow && _.options.centerMode === false) { 4241 4242 _.$nextArrow.addClass('slick-disabled').attr('aria-disabled', 'true'); 4243 _.$prevArrow.removeClass('slick-disabled').attr('aria-disabled', 'false'); 4244 4245 } else if (_.currentSlide >= _.slideCount - 1 && _.options.centerMode === true) { 4246 4247 _.$nextArrow.addClass('slick-disabled').attr('aria-disabled', 'true'); 4248 _.$prevArrow.removeClass('slick-disabled').attr('aria-disabled', 'false'); 4249 4250 } 4251 4252 } 4253 4254 }; 4255 4256 Slick.prototype.updateDots = function() { 4257 4258 var _ = this; 4259 4260 if (_.$dots !== null) { 4261 4262 _.$dots 4263 .find('li') 4264 .removeClass('slick-active') 4265 .end(); 4266 4267 _.$dots 4268 .find('li') 4269 .eq(Math.floor(_.currentSlide / _.options.slidesToScroll)) 4270 .addClass('slick-active'); 4271 4272 } 4273 4274 }; 4275 4276 Slick.prototype.visibility = function() { 4277 4278 var _ = this; 4279 4280 if ( _.options.autoplay ) { 4281 4282 if ( document[_.hidden] ) { 4283 4284 _.interrupted = true; 4285 4286 } else { 4287 4288 _.interrupted = false; 4289 4290 } 4291 4292 } 4293 4294 }; 4295 4296 $.fn.slick = function() { 4297 var _ = this, 4298 opt = arguments[0], 4299 args = Array.prototype.slice.call(arguments, 1), 4300 l = _.length, 4301 i, 4302 ret; 4303 for (i = 0; i < l; i++) { 4304 if (typeof opt == 'object' || typeof opt == 'undefined') 4305 _[i].slick = new Slick(_[i], opt); 4306 else 4307 ret = _[i].slick[opt].apply(_[i].slick, args); 4308 if (typeof ret != 'undefined') return ret; 4309 } 4310 return _; 4311 }; 4312 4313 })); 4314 4315 4316 /***/ }), 4317 4318
vendor: 10,250 bytes, lines 4318-4598
4318/***/ "./node_modules/sticky-kit/dist/sticky-kit.js": 4319 /*!****************************************************!*\ 4320 !*** ./node_modules/sticky-kit/dist/sticky-kit.js ***! 4321 \****************************************************/ 4322 /*! no static exports found */ 4323 /***/ (function(module, exports, __webpack_require__) { 4324 4325 /* WEBPACK VAR INJECTION */(function(__webpack_provided_window_dot_jQuery) {// Generated by CoffeeScript 1.6.2 4326 /** 4327 @license Sticky-kit v1.1.3 | WTFPL | Leaf Corcoran 2015 | http://leafo.net 4328 */ 4329 4330 4331 (function() { 4332 var $, win; 4333 4334 $ = this.jQuery || __webpack_provided_window_dot_jQuery; 4335 4336 win = $(window); 4337 4338 $.fn.stick_in_parent = function(opts) { 4339 var doc, elm, enable_bottoming, inner_scrolling, manual_spacer, offset_top, outer_width, parent_selector, recalc_every, sticky_class, _fn, _i, _len; 4340 4341 if (opts == null) { 4342 opts = {}; 4343 } 4344 sticky_class = opts.sticky_class, inner_scrolling = opts.inner_scrolling, recalc_every = opts.recalc_every, parent_selector = opts.parent, offset_top = opts.offset_top, manual_spacer = opts.spacer, enable_bottoming = opts.bottoming; 4345 if (offset_top == null) { 4346 offset_top = 0; 4347 } 4348 if (parent_selector == null) { 4349 parent_selector = void 0; 4350 } 4351 if (inner_scrolling == null) { 4352 inner_scrolling = true; 4353 } 4354 if (sticky_class == null) { 4355 sticky_class = "is_stuck"; 4356 } 4357 doc = $(document); 4358 if (enable_bottoming == null) { 4359 enable_bottoming = true; 4360 } 4361 outer_width = function(el) { 4362 var computed, w, _el; 4363 4364 if (window.getComputedStyle) { 4365 _el = el[0]; 4366 computed = window.getComputedStyle(el[0]); 4367 w = parseFloat(computed.getPropertyValue("width")) + parseFloat(computed.getPropertyValue("margin-left")) + parseFloat(computed.getPropertyValue("margin-right")); 4368 if (computed.getPropertyValue("box-sizing") !== "border-box") { 4369 w += parseFloat(computed.getPropertyValue("border-left-width")) + parseFloat(computed.getPropertyValue("border-right-width")) + parseFloat(computed.getPropertyValue("padding-left")) + parseFloat(computed.getPropertyValue("padding-right")); 4370 } 4371 return w; 4372 } else { 4373 return el.outerWidth(true); 4374 } 4375 }; 4376 _fn = function(elm, padding_bottom, parent_top, parent_height, top, height, el_float, detached) { 4377 var bottomed, detach, fixed, last_pos, last_scroll_height, offset, parent, recalc, recalc_and_tick, recalc_counter, spacer, tick; 4378 4379 if (elm.data("sticky_kit")) { 4380 return; 4381 } 4382 elm.data("sticky_kit", true); 4383 last_scroll_height = doc.height(); 4384 parent = elm.parent(); 4385 if (parent_selector != null) { 4386 parent = parent.closest(parent_selector); 4387 } 4388 if (!parent.length) { 4389 throw "failed to find stick parent"; 4390 } 4391 fixed = false; 4392 bottomed = false; 4393 spacer = manual_spacer != null ? manual_spacer && elm.closest(manual_spacer) : $("<div />"); 4394 if (spacer) { 4395 spacer.css('position', elm.css('position')); 4396 } 4397 recalc = function() { 4398 var border_top, padding_top, restore; 4399 4400 if (detached) { 4401 return; 4402 } 4403 last_scroll_height = doc.height(); 4404 border_top = parseInt(parent.css("border-top-width"), 10); 4405 padding_top = parseInt(parent.css("padding-top"), 10); 4406 padding_bottom = parseInt(parent.css("padding-bottom"), 10); 4407 parent_top = parent.offset().top + border_top + padding_top; 4408 parent_height = parent.height(); 4409 if (fixed) { 4410 fixed = false; 4411 bottomed = false; 4412 if (manual_spacer == null) { 4413 elm.insertAfter(spacer); 4414 spacer.detach(); 4415 } 4416 elm.css({ 4417 position: "", 4418 top: "", 4419 width: "", 4420 bottom: "" 4421 }).removeClass(sticky_class); 4422 restore = true; 4423 } 4424 top = elm.offset().top - (parseInt(elm.css("margin-top"), 10) || 0) - offset_top; 4425 height = elm.outerHeight(true); 4426 el_float = elm.css("float"); 4427 if (spacer) { 4428 spacer.css({ 4429 width: outer_width(elm), 4430 height: height, 4431 display: elm.css("display"), 4432 "vertical-align": elm.css("vertical-align"), 4433 "float": el_float 4434 }); 4435 } 4436 if (restore) { 4437 return tick(); 4438 } 4439 }; 4440 recalc(); 4441 if (height === parent_height) { 4442 return; 4443 } 4444 last_pos = void 0; 4445 offset = offset_top; 4446 recalc_counter = recalc_every; 4447 tick = function() { 4448 var css, delta, recalced, scroll, will_bottom, win_height; 4449 4450 if (detached) { 4451 return; 4452 } 4453 recalced = false; 4454 if (recalc_counter != null) { 4455 recalc_counter -= 1; 4456 if (recalc_counter <= 0) { 4457 recalc_counter = recalc_every; 4458 recalc(); 4459 recalced = true; 4460 } 4461 } 4462 if (!recalced && doc.height() !== last_scroll_height) { 4463 recalc(); 4464 recalced = true; 4465 } 4466 scroll = win.scrollTop(); 4467 if (last_pos != null) { 4468 delta = scroll - last_pos; 4469 } 4470 last_pos = scroll; 4471 if (fixed) { 4472 if (enable_bottoming) { 4473 will_bottom = scroll + height + offset > parent_height + parent_top; 4474 if (bottomed && !will_bottom) { 4475 bottomed = false; 4476 elm.css({ 4477 position: "fixed", 4478 bottom: "", 4479 top: offset 4480 }).trigger("sticky_kit:unbottom"); 4481 } 4482 } 4483 if (scroll < top) { 4484 fixed = false; 4485 offset = offset_top; 4486 if (manual_spacer == null) { 4487 if (el_float === "left" || el_float === "right") { 4488 elm.insertAfter(spacer); 4489 } 4490 spacer.detach(); 4491 } 4492 css = { 4493 position: "", 4494 width: "", 4495 top: "" 4496 }; 4497 elm.css(css).removeClass(sticky_class).trigger("sticky_kit:unstick"); 4498 } 4499 if (inner_scrolling) { 4500 win_height = win.height(); 4501 if (height + offset_top > win_height) { 4502 if (!bottomed) { 4503 offset -= delta; 4504 offset = Math.max(win_height - height, offset); 4505 offset = Math.min(offset_top, offset); 4506 if (fixed) { 4507 elm.css({ 4508 top: offset + "px" 4509 }); 4510 } 4511 } 4512 } 4513 } 4514 } else { 4515 if (scroll > top) { 4516 fixed = true; 4517 css = { 4518 position: "fixed", 4519 top: offset 4520 }; 4521 css.width = elm.css("box-sizing") === "border-box" ? elm.outerWidth() + "px" : elm.width() + "px"; 4522 elm.css(css).addClass(sticky_class); 4523 if (manual_spacer == null) { 4524 elm.after(spacer); 4525 if (el_float === "left" || el_float === "right") { 4526 spacer.append(elm); 4527 } 4528 } 4529 elm.trigger("sticky_kit:stick"); 4530 } 4531 } 4532 if (fixed && enable_bottoming) { 4533 if (will_bottom == null) { 4534 will_bottom = scroll + height + offset > parent_height + parent_top; 4535 } 4536 if (!bottomed && will_bottom) { 4537 bottomed = true; 4538 if (parent.css("position") === "static") { 4539 parent.css({ 4540 position: "relative" 4541 }); 4542 } 4543 return elm.css({ 4544 position: "absolute", 4545 bottom: padding_bottom, 4546 top: "auto" 4547 }).trigger("sticky_kit:bottom"); 4548 } 4549 } 4550 }; 4551 recalc_and_tick = function() { 4552 recalc(); 4553 return tick(); 4554 }; 4555 detach = function() { 4556 detached = true; 4557 win.off("touchmove", tick); 4558 win.off("scroll", tick); 4559 win.off("resize", recalc_and_tick); 4560 $(document.body).off("sticky_kit:recalc", recalc_and_tick); 4561 elm.off("sticky_kit:detach", detach); 4562 elm.removeData("sticky_kit"); 4563 elm.css({ 4564 position: "", 4565 bottom: "", 4566 top: "", 4567 width: "" 4568 }); 4569 parent.position("position", ""); 4570 if (fixed) { 4571 if (manual_spacer == null) { 4572 if (el_float === "left" || el_float === "right") { 4573 elm.insertAfter(spacer); 4574 } 4575 spacer.remove(); 4576 } 4577 return elm.removeClass(sticky_class); 4578 } 4579 }; 4580 win.on("touchmove", tick); 4581 win.on("scroll", tick); 4582 win.on("resize", recalc_and_tick); 4583 $(document.body).on("sticky_kit:recalc", recalc_and_tick); 4584 elm.on("sticky_kit:detach", detach); 4585 return setTimeout(tick, 0); 4586 }; 4587 for (_i = 0, _len = this.length; _i < _len; _i++) { 4588 elm = this[_i]; 4589 _fn($(elm)); 4590 } 4591 return this; 4592 }; 4593 4594 }).call(this); 4595 4596 /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! jquery */ "jquery"))) 4597 4598 /***/ })
4598, 4599 4600 /***/ 2: 4601 /*!**************************************!*\ 4602 !*** multi ./assets/scripts/main.js ***! 4603 \**************************************/ 4604 /*! no static exports found */ 4605 /***/ (function(module, exports, __webpack_require__) { 4606 4607 module.exports = __webpack_require__(/*! /var/www/staging.cimmyt.org/public/content/themes/cimmyt/assets/scripts/main.js */"./assets/scripts/main.js"); 4608 4609 4610 /***/ }), 4611 4612 /***/ "jquery": 4613 /*!*************************!*\ 4614 !*** external "jQuery" ***! 4615 \*************************/ 4616 /*! no static exports found */ 4617 /***/ (function(module, exports) { 4618 4619 module.exports = jQuery; 4620 4621 /***/ }) 4622 4623 /******/ }); 4624
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.