1/*global jQuery */ 2/*jshint browser:true */ 3/*! 4* FitVids 1.1 5* 6* Copyright 2013, Chris Coyier - http://css-tricks.com + Dave Rupert - http://daverupert.com 7* Credit to Thierry Koblentz - http://www.alistapart.com/articles/creating-intrinsic-ratios-for-video/ 8* Released under the WTFPL license - http://sam.zoy.org/wtfpl/ 9* 10*/ 11 12;(function( $ ){ 13 14 'use strict'; 15 16 $.fn.fitVids = function( options ) { 17 var settings = { 18 customSelector: null, 19 ignore: null 20 }; 21 22 if(!document.getElementById('fit-vids-style')) { 23 // appendStyles: https://github.com/toddmotto/fluidvids/blob/master/dist/fluidvids.js 24 var head = document.head || document.getElementsByTagName('head')[0]; 25 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%;}'; 26 var div = document.createElement("div"); 27 div.innerHTML = '<p>x</p><style id="fit-vids-style">' + css + '</style>'; 28 head.appendChild(div.childNodes[1]); 29 } 30 31 if ( options ) { 32 $.extend( settings, options ); 33 } 34 35 return this.each(function(){ 36 var selectors = [ 37 'iframe[src*="player.vimeo.com"]', 38 'iframe[src*="youtube.com"]', 39 'iframe[src*="youtube-nocookie.com"]', 40 'iframe[src*="kickstarter.com"][src*="video.html"]', 41 'object', 42 'embed' 43 ]; 44 45 if (settings.customSelector) { 46 selectors.push(settings.customSelector); 47 } 48 49 var ignoreList = '.fitvidsignore'; 50 51 if(settings.ignore) { 52 ignoreList = ignoreList + ', ' + settings.ignore; 53 } 54 55 var $allVideos = $(this).find(selectors.join(',')); 56 $allVideos = $allVideos.not('object object'); // SwfObj conflict patch 57 $allVideos = $allVideos.not(ignoreList); // Disable FitVids on this video. 58 59 $allVideos.each(function(count){ 60 var $this = $(this); 61 if($this.parents(ignoreList).length > 0) { 62 return; // Disable FitVids on this video. 63 } 64 if (this.tagName.toLowerCase() === 'embed' && $this.parent('object').length || $this.parent('.fluid-width-video-wrapper').length) { return; } 65 if ((!$this.css('height') && !$this.css('width')) && (isNaN($this.attr('height')) || isNaN($this.attr('width')))) 66 { 67 $this.attr('height', 9); 68 $this.attr('width', 16); 69 } 70 var height = ( this.tagName.toLowerCase() === 'object' || ($this.attr('height') && !isNaN(parseInt($this.attr('height'), 10))) ) ? parseInt($this.attr('height'), 10) : $this.height(), 71 width = !isNaN(parseInt($this.attr('width'), 10)) ? parseInt($this.attr('width'), 10) : $this.width(), 72 aspectRatio = height / width; 73 if(!$this.attr('id')){ 74 var videoID = 'fitvid' + count; 75 $this.attr('id', videoID); 76 } 77 $this.wrap('<div class="fluid-width-video-wrapper"></div>').parent('.fluid-width-video-wrapper').css('padding-top', (aspectRatio * 100)+'%'); 78 $this.removeAttr('height').removeAttr('width'); 79 }); 80 }); 81 }; 82})( window.jQuery || window.Zepto ); 83 84// Menu 85(function ($) { 86 "use strict"; 87 $.bombnav = function (selector, options) { 88 var settings = $.extend({ 89 indicator: true, 90 speed: 300, 91 delay: 0, 92 hideClickOut: true, 93 submenuTrigger: "hover", 94 responsiveHandle: false, 95 verticalHandle: false, 96 mainIndicator: "<i class='icon-indicator'></i>", 97 subIndicator: "<i class='icon-indicator'></i>" 98 }, options); 99 var menu = $(selector); 100 if (settings.indicator === true) { 101 if (settings.verticalHandle === true) { 102 $(menu).children("li").children("a").each(function () { 103 if ($(this).siblings(".sub-menu, .megamenu").length > 0) { 104 $(this).append("<span class='indicator'>" + settings.mainIndicator + "</span>"); 105 } 106 }); 107 } 108 $(menu).find(".sub-menu").children("li").children("a").each(function () { 109 if ($(this).siblings(".sub-menu").length > 0) { 110 $(this).append("<span class='indicator'>" + settings.subIndicator + "</span>"); 111 } 112 }); 113 } 114 start(); 115 $(window).resize(function () { 116 if (settings.verticalHandle === false) { 117 if (settings.responsiveHandle === true) { 118 if ($(window).width() < 943) { 119 unbindEvents(); 120 bindClick(); 121 $(menu).addClass("bombver"); 122 } else { 123 unbindEvents(); 124 bindHover(); 125 $(menu).removeClass("bombver"); 126 } 127 } else { 128 unbindEvents(); 129 bindHover(); 130 } 131 } else { 132 unbindEvents(); 133 bindClick(); 134 $(menu).addClass("bombver"); 135 } 136 }); 137 138 function start() { 139 if (settings.verticalHandle === false) { 140 if (settings.responsiveHandle === true) { 141 if ($(window).width() < 943) { 142 bindClick(); 143 $(menu).addClass("bombver"); 144 } else { 145 bindHover(); 146 $(menu).removeClass("bombver"); 147 } 148 } else { 149 bindHover(); 150 } 151 } else { 152 bindClick(); 153 $(menu).addClass("bombver"); 154 } 155 } 156 157 function unbindEvents() { 158 $(menu).find("li, a").unbind(); 159 $(document).unbind("click.menu touchstart.menu"); 160 $(menu).find(".sub-menu, .megamenu").hide(0); 161 } 162 163 function bindHover() { 164 if (navigator.userAgent.match(/Mobi/i) || window.navigator.msMaxTouchPoints > 0 || settings.submenuTrigger === "click") { 165 $(menu).find("a").on("click touchstart", function (e) { 166 e.stopPropagation(); 167 e.preventDefault(); 168 $(this).parent("li").siblings("li").find(".sub-menu, .megamenu").stop(true, true).fadeOut(settings.speed); 169 if ($(this).siblings(".sub-menu, .megamenu").css("display") === "none") { 170 $(this).siblings(".sub-menu, .megamenu").stop(true, true).delay(settings.delay).slideDown(settings.speed); 171 return false;
172 } else { 173 $(this).siblings(".sub-menu, .megamenu").stop(true, true).fadeOut(settings.speed); 174 $(this).siblings(".sub-menu").find(".sub-menu").stop(true, true).fadeOut(settings.speed); 175 } 176 window.location.href = $(this).attr("href"); 177 }); 178 $(menu).find("li").bind("mouseleave", function () { 179 $(this).children(".sub-menu, .megamenu").stop(true, true).fadeOut(settings.speed); 180 }); 181 if (settings.hideClickOut === true) { 182 $(document).bind("click.menu touchstart.menu", function (ev) { 183 if ($(ev.target).closest(menu).length === 0) { 184 $(menu).find(".sub-menu, .megamenu").fadeOut(settings.speed); 185 } 186 }); 187 } 188 } else { 189 $(menu).find("li").bind("mouseenter", function () { 190 $(this).children(".sub-menu, .megamenu").stop(true, true).delay(settings.delay).slideDown(settings.speed); 191 }).bind("mouseleave", function () { 192 $(this).children(".sub-menu, .megamenu").stop(true, true).fadeOut(settings.speed); 193 }); 194 } 195 } 196 197 function bindClick() { 198 $(menu).find(".indicator").each(function () { 199 if ($(this).parent("a").siblings(".sub-menu, .megamenu").length > 0) { 200 $(this).bind("click", function (e) { 201 if ($(this).parent().prop("tagName") === "A") { 202 e.preventDefault(); 203 } 204 if ($(this).parent("a").siblings(".sub-menu, .megamenu").css("display") === "none") { 205 $(this).parent("a").siblings(".sub-menu, .megamenu").delay(settings.delay).slideDown(settings.speed); 206 $(this).parent("a").parent("li").siblings("li").find(".sub-menu, .megamenu").slideUp(settings.speed); 207 } else { 208 $(this).parent("a").siblings(".sub-menu, .megamenu").slideUp(settings.speed); 209 } 210 }); 211 } 212 }); 213 } 214 }; 215})(jQuery); 216 217// ----------------------------------- 218// Slidebars 219// Version 0.10.2 220// http://plugins.adchsm.me/slidebars/ 221// 222// Written by Adam Smith 223// http://www.adchsm.me/ 224// 225// Released under MIT License 226// http://plugins.adchsm.me/slidebars/license.txt 227// 228// --------------------- 229(function ($) { 230 "use strict"; 231 $.slidebars = function (options) { 232 233 // ---------------------- 234 // 001 - Default Settings 235 236 var settings = $.extend({ 237 siteClose: true, // true or false - Enable closing of Slidebars by clicking on #sb-site. 238 scrollLock: false, // true or false - Prevent scrolling of site when a Slidebar is open. 239 disableOver: false, // integer or false - Hide Slidebars over a specific width. 240 hideControlClasses: false // true or false - Hide controls at same width as disableOver. 241 }, options); 242 243 // ----------------------- 244 // 002 - Feature Detection 245 246 var test = document.createElement('div').style, // Create element to test on. 247 supportTransition = false, // Variable for testing transitions. 248 supportTransform = false; // variable for testing transforms. 249 250 // Test for CSS Transitions 251 if (test.MozTransition === '' || test.WebkitTransition === '' || test.OTransition === '' || test.transition === '') supportTransition = true; 252 253 // Test for CSS Transforms 254 if (test.MozTransform === '' || test.WebkitTransform === '' || test.OTransform === '' || test.transform === '') supportTransform = true; 255 256 // ----------------- 257 // 003 - User Agents 258 259 var ua = navigator.userAgent, // Get user agent string. 260 android = false, // Variable for storing android version. 261 iOS = false; // Variable for storing iOS version. 262 263 if (/Android/.test(ua)) { // Detect Android in user agent string. 264 android = ua.substr(ua.indexOf('Android') + 8, 3); // Set version of Android. 265 } else if (/(iPhone|iPod|iPad)/.test(ua)) { // Detect iOS in user agent string. 266 iOS = ua.substr(ua.indexOf('OS ') + 3, 3).replace('_', '.'); // Set version of iOS. 267 } 268 269 if (android && android < 3 || iOS && iOS < 5) $('html').addClass('sb-static'); // Add helper class for older versions of Android & iOS. 270 271 // ----------- 272 // 004 - Setup 273 274 // Site container 275 var $site = $('#sb-site, .sb-site-container'); // Cache the selector. 276 277 // Left Slidebar 278 if ($('.sb-left').length) { // Check if the left Slidebar exists. 279 var $left = $('.sb-left'), // Cache the selector. 280 leftActive = false; // Used to check whether the left Slidebar is open or closed. 281 } 282 283 // Right Slidebar 284 if ($('.sb-right').length) { // Check if the right Slidebar exists. 285 var $right = $('.sb-right'), // Cache the selector. 286 rightActive = false; // Used to check whether the right Slidebar is open or closed. 287 } 288 289 var init = false, // Initialisation variable. 290 windowWidth = $(window).width(), // Get width of window. 291 $controls = $('.sb-toggle-left, .sb-toggle-right, .sb-open-left, .sb-open-right, .sb-close'), // Cache the control classes. 292 $slide = $('.sb-slide'); // Cache users elements to animate. 293 294 // Initailise Slidebars 295 function initialise() { 296 if (!settings.disableOver || (typeof settings.disableOver === 'number' && settings.disableOver >= windowWidth)) { // False or larger than window size. 297 init = true; // true enabled Slidebars to open. 298 $('html').addClass('sb-init'); // Add helper class. 299 if (settings.hideControlClasses) $controls.removeClass('sb-hide'); // Remove class just incase Slidebars was originally disabled. 300 css(); // Set required inline styles. 301 if (leftActive || rightActive) close(); // Close Slidebars if open. 302 } else if (typeof settings.disableOver === 'number' && settings.disableOver < windowWidth) { // Less than window size. 303 init = false; // false stop Slidebars from opening. 304 $('html').removeClass('sb-init'); // Remove helper class. 305 if (settings.hideControlClasses) $controls.addClass('sb-hide'); // Hide controls 306 $site.css('minHeight', ''); // Remove minimum height. 307 if (leftActive || rightActive) close(); // Close Slidebars if open. 308 } 309 } 310 initialise(); 311 312 // Inline CSS 313 function css() { 314 // Set minimum height. 315 $site.css('minHeight', ''); // Reset minimum height. 316 //$site.css('minHeight', $('html').height() + 'px'); // Set minimum height of the site to the minimum height of the html. 317 318 // Custom Slidebar widths. 319 if ($left && $left.hasClass('sb-width-custom')) $left.css('width', $left.attr('data-sb-width')); // Set user custom width. 320 if ($right && $right.hasClass('sb-width-custom')) $right.css('width', $right.attr('data-sb-width')); // Set user custom width. 321 322 // Set off-canvas margins for Slidebars with push and overlay animations. 323 if ($left && ($left.hasClass('sb-style-push') || $left.hasClass('sb-style-overlay'))) $left.css('marginLeft', '-' + $left.css('width')); 324 if ($right && ($right.hasClass('sb-style-push') || $right.hasClass('sb-style-overlay'))) $right.css('marginRight', '-' + $right.css('width')); 325 326 // Site scroll locking. 327 if (settings.scrollLock) $('html').addClass('sb-scroll-lock'); 328 } 329 330 // Resize Functions 331 $(window).resize(function () { 332 var resizedWindowWidth = $(window).width();
332 // Get resized window width. 333 if (windowWidth !== resizedWindowWidth) { // Slidebars is running and window was actually resized. 334 windowWidth = resizedWindowWidth; // Set the new window width. 335 initialise(); // Call initalise to see if Slidebars should still be running. 336 if (leftActive) open('left'); // If left Slidebar is open, calling open will ensure it is the correct size. 337 if (rightActive) open('right'); // If right Slidebar is open, calling open will ensure it is the correct size. 338 } 339 }); 340 // I may include a height check along side a width check here in future. 341 342 // --------------- 343 // 005 - Animation 344 345 var animation; // Animation type. 346 347 // Set animation type. 348 if (supportTransition && supportTransform) { // Browser supports css transitions and transforms. 349 animation = 'translate'; // Translate for browsers that support it. 350 if (android && android < 4.4) animation = 'side'; // Android supports both, but can't translate any fixed positions, so use left instead. 351 } else { 352 animation = 'jQuery'; // Browsers that don't support css transitions and transitions. 353 } 354 355 // Animate mixin. 356 function animate(object, amount, side) { 357 // Choose selectors depending on animation style. 358 var selector; 359 360 if (object.hasClass('sb-style-push')) { 361 selector = $site.add(object).add($slide); // Push - Animate site, Slidebar and user elements. 362 } else if (object.hasClass('sb-style-overlay')) { 363 selector = object; // Overlay - Animate Slidebar only. 364 } else { 365 selector = $site.add($slide); // Reveal - Animate site and user elements. 366 } 367 368 // Apply animation 369 if (animation === 'translate') { 370 selector.css('transform', 'translate(' + amount + ')'); // Apply the animation. 371 372 } else if (animation === 'side') { 373 if (amount[0] === '-') amount = amount.substr(1); // Remove the '-' from the passed amount for side animations. 374 if (amount !== '0px') selector.css(side, '0px'); // Add a 0 value so css transition works. 375 setTimeout(function () { // Set a timeout to allow the 0 value to be applied above. 376 selector.css(side, amount); // Apply the animation. 377 }, 1); 378 379 } else if (animation === 'jQuery') { 380 if (amount[0] === '-') amount = amount.substr(1); // Remove the '-' from the passed amount for jQuery animations. 381 var properties = {}; 382 properties[side] = amount; 383 selector.stop().animate(properties, 400); // Stop any current jQuery animation before starting another. 384 } 385 386 // If closed, remove the inline styling on completion of the animation. 387 setTimeout(function () { 388 if (amount === '0px') { 389 selector.removeAttr('style'); 390 css(); 391 } 392 }, 400); 393 } 394 395 // ---------------- 396 // 006 - Operations 397 398 // Open a Slidebar 399 function open(side) { 400 // Check to see if opposite Slidebar is open. 401 if (side === 'left' && $left && rightActive || side === 'right' && $right && leftActive) { // It's open, close it, then continue. 402 close(); 403 setTimeout(proceed, 400); 404 } else { // Its not open, continue. 405 proceed(); 406 } 407 408 // Open 409 function proceed() { 410 if (init && side === 'left' && $left) { // Slidebars is initiated, left is in use and called to open. 411 $('html').addClass('sb-active sb-active-left'); // Add active classes. 412 $left.addClass('sb-active'); 413 animate($left, $left.css('width'), 'left'); // Animation 414 setTimeout(function () { 415 leftActive = true; 416 }, 400); // Set active variables. 417 } else if (init && side === 'right' && $right) { // Slidebars is initiated, right is in use and called to open. 418 $('html').addClass('sb-active sb-active-right'); // Add active classes. 419 $right.addClass('sb-active'); 420 animate($right, '-' + $right.css('width'), 'right'); // Animation 421 setTimeout(function () { 422 rightActive = true; 423 }, 400); // Set active variables. 424 } 425 } 426 } 427 428 // Close either Slidebar 429 function close(link) { 430 if (leftActive || rightActive) { // If a Slidebar is open. 431 if (leftActive) { 432 animate($left, '0px', 'left'); // Animation 433 leftActive = false;
434 } 435 if (rightActive) { 436 animate($right, '0px', 'right'); // Animation 437 rightActive = false; 438 } 439 440 setTimeout(function () { // Wait for closing animation to finish. 441 $('html').removeClass('sb-active sb-active-left sb-active-right'); // Remove active classes. 442 if ($left) $left.removeClass('sb-active'); 443 if ($right) $right.removeClass('sb-active'); 444 if (typeof link !== 'undefined') window.location = link; // If a link has been passed to the function, go to it. 445 }, 400); 446 } 447 } 448 449 // Toggle either Slidebar 450 function toggle(side) { 451 if (side === 'left' && $left) { // If left Slidebar is called and in use. 452 if (!leftActive) { 453 open('left'); // Slidebar is closed, open it. 454 } else { 455 close(); // Slidebar is open, close it. 456 } 457 } 458 if (side === 'right' && $right) { // If right Slidebar is called and in use. 459 if (!rightActive) { 460 open('right'); // Slidebar is closed, open it. 461 } else { 462 close(); // Slidebar is open, close it. 463 } 464 } 465 } 466 467 // --------- 468 // 007 - API 469 470 this.slidebars = { 471 open: open, // Maps user variable name to the open method. 472 close: close, // Maps user variable name to the close method. 473 toggle: toggle, // Maps user variable name to the toggle method. 474 init: function () { // Returns true or false whether Slidebars are running or not. 475 return init; // Returns true or false whether Slidebars are running. 476 }, 477 active: function (side) { // Returns true or false whether Slidebar is open or closed. 478 if (side === 'left' && $left) return leftActive; 479 if (side === 'right' && $right) return rightActive; 480 }, 481 destroy: function (side) { // Removes the Slidebar from the DOM. 482 if (side === 'left' && $left) { 483 if (leftActive) close(); // Close if its open. 484 setTimeout(function () { 485 $left.remove(); // Remove it. 486 $left = false; // Set variable to false so it cannot be opened again. 487 }, 400); 488 } 489 if (side === 'right' && $right) { 490 if (rightActive) close(); // Close if its open. 491 setTimeout(function () { 492 $right.remove(); // Remove it. 493 $right = false; // Set variable to false so it cannot be opened again. 494 }, 400); 495 } 496 } 497 }; 498 499 // ---------------- 500 // 008 - User Input 501 502 function eventHandler(event, selector) { 503 event.stopPropagation(); // Stop event bubbling. 504 event.preventDefault(); // Prevent default behaviour. 505 //if (event.type === 'touchend') selector.off('click'); // If event type was touch, turn off clicks to prevent phantom clicks. 506 } 507 508 // Toggle left Slidebar 509 $('.sb-toggle-left').click(function(event) { 510 eventHandler(event, $(this)); // Handle the event. 511 toggle('left'); // Toggle the left Slidbar. 512 }); 513 514 // Toggle right Slidebar 515 $('.sb-toggle-right').click(function(event) { 516 eventHandler(event, $(this)); // Handle the event. 517 toggle('right'); // Toggle the right Slidbar. 518 }); 519 520 // Open left Slidebar 521 $('.sb-open-left').click(function(event) { 522 eventHandler(event, $(this)); // Handle the event. 523 open('left'); // Open the left Slidebar. 524 }); 525 526 // Open right Slidebar 527 $('.sb-open-right').click(function(event) { 528 eventHandler(event, $(this)); // Handle the event. 529 open('right'); // Open the right Slidebar. 530 }); 531 532 // Close Slidebar 533 $('.sb-close').on('touchend click', function (event) { 534 if ($(this).is('a') || $(this).children().is('a')) { // Is a link or contains a link. 535 if (event.type === 'click') { // Make sure the user wanted to follow the link. 536 event.preventDefault(); // Stop default behaviour. 537 var href = ($(this).is('a') ? $(this).attr('href') : $(this).find('a').attr('href')); // Get the href. 538 close(href); // Close Slidebar and pass link. 539 } 540 } else { // Just a normal control class. 541 eventHandler(event, $(this)); // Handle the event. 542 close(); // Close Slidebar. 543 } 544 }); 545 546 // Close Slidebar via site 547 $site.on('touchend click', function (event) { 548 if (settings.siteClose && (leftActive || rightActive)) { // If settings permit closing by site and left or right Slidebar is open. 549 eventHandler(event, $(this)); // Handle the event. 550 close(); // Close it. 551 } 552 }); 553 554 }; // End Slidebars function. 555 556})(jQuery); 557 558/* 559 A simple jQuery modal (http://github.com/kylefox/jquery-modal) 560 Version 0.5.5 561*/ 562(function ($) { 563 "use strict"; 564 var current = null; 565 566 $.modal = function (el, options) { 567 $.modal.close(); // Close any open modals. 568 var remove, target; 569 this.$body = $('body'); 570 this.options = $.extend({}, $.modal.defaults, options); 571 this.options.doFade = !isNaN(parseInt(this.options.fadeDuration, 10)); 572 if (el.is('a')) { 573 target = el.attr('href'); 574 //Select element by id from href 575 if (/^#/.test(target)) { 576 this.$elm = $(target); 577 if (this.$elm.length !== 1) return null; 578 this.open(); 579 //AJAX 580 } else { 581 this.$elm = $('<div>'); 582 this.$body.append(this.$elm); 583 remove = function (event, modal) { 584 modal.elm.remove(); 585 }; 586 this.showSpinner(); 587 el.trigger($.modal.AJAX_SEND); 588 $.get(target).done(function (html) { 589 if (!current) return; 590 el.trigger($.modal.AJAX_SUCCESS); 591 current.$elm.empty().append(html).on($.modal.CLOSE, remove); 592 current.hideSpinner(); 593 current.open(); 594 el.trigger($.modal.AJAX_COMPLETE); 595 }).fail(function () { 596 el.trigger($.modal.AJAX_FAIL); 597 current.hideSpinner(); 598 el.trigger($.modal.AJAX_COMPLETE); 599 }); 600 } 601 } else { 602 this.$elm = el; 603 this.open(); 604 } 605 }; 606 607 $.modal.prototype = { 608 constructor: $.modal, 609 open: function () { 610 var m = this; 611 if (this.options.doFade) { 612 this.block(); 613 setTimeout(function () { 614 m.show(); 615 }, this.options.fadeDuration * this.options.fadeDelay); 616 } else { 617 this.block(); 618 this.show(); 619 } 620 if (this.options.escapeClose) { 621 $(document).on('keydown.modal', function (event) { 622 if (event.which == 27) $.modal.close(); 623 }); 624 } 625 if (this.options.clickClose) this.blocker.click($.modal.close); 626 }, 627 628 close: function () { 629 this.unblock(); 630 this.hide(); 631 $(document).off('keydown.modal'); 632 }, 633 634 block: function () { 635 var initialOpacity = this.options.doFade ? 0 : this.options.opacity; 636 this.$elm.trigger($.modal.BEFORE_BLOCK, [this._ctx()]);
637 this.blocker = $('<div class="jquery-modal blocker"></div>').css({ 638 top: 0, 639 right: 0, 640 bottom: 0, 641 left: 0, 642 width: "100%", 643 height: "100%", 644 position: "fixed", 645 zIndex: this.options.zIndex, 646 background: this.options.overlay, 647 opacity: initialOpacity 648 }); 649 this.$body.append(this.blocker); 650 if (this.options.doFade) { 651 this.blocker.animate({ 652 opacity: this.options.opacity 653 }, this.options.fadeDuration); 654 } 655 this.$elm.trigger($.modal.BLOCK, [this._ctx()]); 656 }, 657 658 unblock: function () { 659 if (this.options.doFade) { 660 this.blocker.fadeOut(this.options.fadeDuration, function () { 661 $(this).remove(); 662 }); 663 } else { 664 this.blocker.remove(); 665 } 666 }, 667 668 show: function () { 669 this.$elm.trigger($.modal.BEFORE_OPEN, [this._ctx()]); 670 if (this.options.showClose) { 671 this.closeButton = $('<a href="#close-modal" rel="modal:close" class="close-modal ' + this.options.closeClass + '">' + this.options.closeText + '</a>'); 672 this.$elm.append(this.closeButton); 673 } 674 this.$elm.addClass(this.options.modalClass + ' current'); 675 this.center(); 676 if (this.options.doFade) { 677 this.$elm.fadeIn(this.options.fadeDuration); 678 } else { 679 this.$elm.show(); 680 } 681 this.$elm.trigger($.modal.OPEN, [this._ctx()]); 682 }, 683 684 hide: function () { 685 this.$elm.trigger($.modal.BEFORE_CLOSE, [this._ctx()]); 686 if (this.closeButton) this.closeButton.remove(); 687 this.$elm.removeClass('current'); 688 689 if (this.options.doFade) { 690 this.$elm.fadeOut(this.options.fadeDuration); 691 } else { 692 this.$elm.hide(); 693 } 694 this.$elm.trigger($.modal.CLOSE, [this._ctx()]); 695 }, 696 697 showSpinner: function () { 698 if (!this.options.showSpinner) return; 699 this.spinner = this.spinner || $('<div class="' + this.options.modalClass + '-spinner"></div>') 700 .append(this.options.spinnerHtml); 701 this.$body.append(this.spinner); 702 this.spinner.show(); 703 }, 704 705 hideSpinner: function () { 706 if (this.spinner) this.spinner.remove(); 707 }, 708 center: function () { 709 this.$elm.css({ 710 position: 'fixed', 711 top: "50%", 712 left: "50%", 713 marginTop: -(this.$elm.outerHeight() / 2), 714 marginLeft: -(this.$elm.outerWidth() / 2), 715 zIndex: this.options.zIndex + 1 716 }); 717 }, 718 719 //Return context for custom events 720 _ctx: function () { 721 return { 722 elm: this.$elm, 723 blocker: this.blocker, 724 options: this.options 725 }; 726 } 727 }; 728 729 //resize is alias for center for now 730 $.modal.prototype.resize = $.modal.prototype.center; 731 $.modal.close = function (event) { 732 if (!current) return; 733 if (event) event.preventDefault(); 734 current.close(); 735 var that = current.$elm; 736 current = null; 737 return that; 738 }; 739 740 $.modal.resize = function () { 741 if (!current) return; 742 current.resize(); 743 }; 744 745 // Returns if there currently is an active modal 746 $.modal.isActive = function () { 747 return current ? true : false; 748 }; 749 750 $.modal.defaults = { 751 overlay: "#000", 752 opacity: 0.5, 753 zIndex: 9999, 754 escapeClose: true, 755 clickClose: true, 756 closeText: '<i class="fa fa-remove"></i>', 757 closeClass: '', 758 modalClass: "modal", 759 spinnerHtml: null, 760 showSpinner: false, 761 showClose: true, 762 fadeDuration: 100, // Number of milliseconds the fade animation takes. 763 fadeDelay: 1.0 // Point during the overlay's fade-in that the modal begins to fade in (.5 = 50%, 1.5 = 150%, etc.) 764 }; 765 766 // Event constants 767 $.modal.BEFORE_BLOCK = 'modal:before-block'; 768 $.modal.BLOCK = 'modal:block'; 769 $.modal.BEFORE_OPEN = 'modal:before-open'; 770 $.modal.OPEN = 'modal:open'; 771 $.modal.BEFORE_CLOSE = 'modal:before-close'; 772 $.modal.CLOSE = 'modal:close'; 773 $.modal.AJAX_SEND = 'modal:ajax:send'; 774 $.modal.AJAX_SUCCESS = 'modal:ajax:success'; 775 $.modal.AJAX_FAIL = 'modal:ajax:fail'; 776 $.modal.AJAX_COMPLETE = 'modal:ajax:complete'; 777 778 $.fn.modal = function (options) { 779 if (this.length === 1) { 780 current = new $.modal(this, options); 781 } 782 return this; 783 }; 784 785 // Automatically bind links with rel="modal:close" to, well, close the modal. 786 $(document).on('click.modal', 'a[rel="modal:close"]', $.modal.close); 787 $(document).on('click.modal', 'a[rel="modal:open"]', function (event) { 788 event.preventDefault(); 789 $(this).modal(); 790 }); 791})(jQuery); 792 793/* 794 * jQuery OwlCarousel v1.31 795 * 796 * Copyright (c) 2013 Bartosz Wojciechowski 797 * http://www.owlgraphic.com/owlcarousel/ 798 * 799 * Licensed under MIT 800 * 801 */ 802if (typeof Object.create !== "function") { 803 Object.create = function (obj) { 804 function F() {} 805 F.prototype = obj; 806 return new F(); 807 }; 808} 809(function ($, window, document, undefined) { 810 811 var Carousel = { 812 init: function (options, el) { 813 var base = this; 814 815 base.$elem = $(el); 816 817 // options passed via js override options passed via data attributes 818 base.options = $.extend({}, $.fn.owlCarousel.options, base.$elem.data(), options); 819 820 base.userOptions = options; 821 base.loadContent(); 822 }, 823 824 loadContent: function () { 825 var base = this; 826 827 if (typeof base.options.beforeInit === "function") { 828 base.options.beforeInit.apply(this, [base.$elem]); 829 } 830 831 if (typeof base.options.jsonPath === "string") { 832 var url = base.options.jsonPath; 833 834 function getData(data) { 835 if (typeof base.options.jsonSuccess === "function") { 836 base.options.jsonSuccess.apply(this, [data]); 837 } else { 838 var content = ""; 839 for (var i in data["owl"]) { 840 content += data["owl"][i]["item"]; 841 } 842 base.$elem.html(content); 843 } 844 base.logIn(); 845 } 846 $.getJSON(url, getData); 847 } else { 848 base.logIn(); 849 } 850 }, 851 852 logIn: function (action) { 853 var base = this; 854 855 base.$elem.data("owl-originalStyles", base.$elem.attr("style")) 856 .data("owl-originalClasses", base.$elem.attr("class")); 857 858 base.$elem.css({ 859 opacity: 0 860 }); 861 base.orignalItems = base.options.items; 862 base.checkBrowser();
863 base.wrapperWidth = 0; 864 base.checkVisible; 865 base.setVars(); 866 }, 867 868 setVars: function () { 869 var base = this; 870 if (base.$elem.children().length === 0) { 871 return false; 872 } 873 base.baseClass(); 874 base.eventTypes(); 875 base.$userItems = base.$elem.children(); 876 base.itemsAmount = base.$userItems.length; 877 base.wrapItems(); 878 base.$owlItems = base.$elem.find(".owl-item"); 879 base.$owlWrapper = base.$elem.find(".owl-wrapper"); 880 base.playDirection = "next"; 881 base.prevItem = 0; 882 base.prevArr = [0]; 883 base.currentItem = 0; 884 base.customEvents(); 885 base.onStartup(); 886 }, 887 888 onStartup: function () { 889 var base = this; 890 base.updateItems(); 891 base.calculateAll(); 892 base.buildControls(); 893 base.updateControls(); 894 base.response(); 895 base.moveEvents(); 896 base.stopOnHover(); 897 base.owlStatus(); 898 899 if (base.options.transitionStyle !== false) { 900 base.transitionTypes(base.options.transitionStyle); 901 } 902 if (base.options.autoPlay === true) { 903 base.options.autoPlay = 5000; 904 } 905 base.play(); 906 907 base.$elem.find(".owl-wrapper").css("display", "block"); 908 909 if (!base.$elem.is(":visible")) { 910 base.watchVisibility(); 911 } else { 912 base.$elem.css("opacity", 1); 913 } 914 base.onstartup = false; 915 base.eachMoveUpdate(); 916 if (typeof base.options.afterInit === "function") { 917 base.options.afterInit.apply(this, [base.$elem]); 918 } 919 }, 920 921 eachMoveUpdate: function () { 922 var base = this; 923 924 if (base.options.lazyLoad === true) { 925 base.lazyLoad(); 926 } 927 if (base.options.autoHeight === true) { 928 base.autoHeight(); 929 } 930 base.onVisibleItems(); 931 932 if (typeof base.options.afterAction === "function") { 933 base.options.afterAction.apply(this, [base.$elem]); 934 } 935 }, 936 937 updateVars: function () { 938 var base = this; 939 if (typeof base.options.beforeUpdate === "function") { 940 base.options.beforeUpdate.apply(this, [base.$elem]); 941 } 942 base.watchVisibility(); 943 base.updateItems(); 944 base.calculateAll(); 945 base.updatePosition(); 946 base.updateControls(); 947 base.eachMoveUpdate(); 948 if (typeof base.options.afterUpdate === "function") { 949 base.options.afterUpdate.apply(this, [base.$elem]); 950 } 951 }, 952 953 reload: function (elements) { 954 var base = this; 955 setTimeout(function () { 956 base.updateVars(); 957 }, 0); 958 }, 959 960 watchVisibility: function () { 961 var base = this; 962 963 if (base.$elem.is(":visible") === false) { 964 base.$elem.css({ 965 opacity: 0 966 }); 967 clearInterval(base.autoPlayInterval); 968 clearInterval(base.checkVisible); 969 } else { 970 return false; 971 } 972 base.checkVisible = setInterval(function () { 973 if (base.$elem.is(":visible")) { 974 base.reload(); 975 base.$elem.animate({ 976 opacity: 1 977 }, 200); 978 clearInterval(base.checkVisible); 979 } 980 }, 500); 981 }, 982 983 wrapItems: function () { 984 var base = this; 985 base.$userItems.wrapAll("<div class=\"owl-wrapper\">").wrap("<div class=\"owl-item\"></div>"); 986 base.$elem.find(".owl-wrapper").wrap("<div class=\"owl-wrapper-outer\">"); 987 base.wrapperOuter = base.$elem.find(".owl-wrapper-outer"); 988 base.$elem.css("display", "block"); 989 }, 990 991 baseClass: function () { 992 var base = this; 993 var hasBaseClass = base.$elem.hasClass(base.options.baseClass); 994 var hasThemeClass = base.$elem.hasClass(base.options.theme); 995 996 if (!hasBaseClass) { 997 base.$elem.addClass(base.options.baseClass); 998 } 999 1000 if (!hasThemeClass) { 1001 base.$elem.addClass(base.options.theme); 1002 } 1003 }, 1004 1005 updateItems: function () { 1006 var base = this; 1007 1008 if (base.options.responsive === false) { 1009 return false;
1010 } 1011 if (base.options.singleItem === true) { 1012 base.options.items = base.orignalItems = 1; 1013 base.options.itemsCustom = false; 1014 base.options.itemsDesktop = false; 1015 base.options.itemsDesktopSmall = false; 1016 base.options.itemsTablet = false; 1017 base.options.itemsTabletSmall = false; 1018 base.options.itemsMobile = false; 1019 return false; 1020 } 1021 1022 var width = $(base.options.responsiveBaseWidth).width(); 1023 1024 if (width > (base.options.itemsDesktop[0] || base.orignalItems)) { 1025 base.options.items = base.orignalItems; 1026 } 1027 1028 if (typeof (base.options.itemsCustom) !== 'undefined' && base.options.itemsCustom !== false) { 1029 //Reorder array by screen size 1030 base.options.itemsCustom.sort(function (a, b) { 1031 return a[0] - b[0]; 1032 }); 1033 for (var i in base.options.itemsCustom) { 1034 if (typeof (base.options.itemsCustom[i]) !== 'undefined' && base.options.itemsCustom[i][0] <= width) { 1035 base.options.items = base.options.itemsCustom[i][1]; 1036 } 1037 } 1038 } else { 1039 1040 if (width <= base.options.itemsDesktop[0] && base.options.itemsDesktop !== false) { 1041 base.options.items = base.options.itemsDesktop[1]; 1042 } 1043 1044 if (width <= base.options.itemsDesktopSmall[0] && base.options.itemsDesktopSmall !== false) { 1045 base.options.items = base.options.itemsDesktopSmall[1]; 1046 } 1047 1048 if (width <= base.options.itemsTablet[0] && base.options.itemsTablet !== false) { 1049 base.options.items = base.options.itemsTablet[1]; 1050 } 1051 1052 if (width <= base.options.itemsTabletSmall[0] && base.options.itemsTabletSmall !== false) { 1053 base.options.items = base.options.itemsTabletSmall[1]; 1054 } 1055 1056 if (width <= base.options.itemsMobile[0] && base.options.itemsMobile !== false) { 1057 base.options.items = base.options.itemsMobile[1]; 1058 } 1059 } 1060 1061 //if number of items is less than declared 1062 if (base.options.items > base.itemsAmount && base.options.itemsScaleUp === true) { 1063 base.options.items = base.itemsAmount; 1064 } 1065 }, 1066 1067 response: function () { 1068 var base = this, 1069 smallDelay; 1070 if (base.options.responsive !== true) { 1071 return false; 1072 } 1073 var lastWindowWidth = $(window).width(); 1074 1075 base.resizer = function () { 1076 if ($(window).width() !== lastWindowWidth) { 1077 if (base.options.autoPlay !== false) { 1078 clearInterval(base.autoPlayInterval); 1079 } 1080 clearTimeout(smallDelay); 1081 smallDelay = setTimeout(function () { 1082 lastWindowWidth = $(window).width(); 1083 base.updateVars(); 1084 }, base.options.responsiveRefreshRate); 1085 } 1086 }; 1087 $(window).resize(base.resizer); 1088 }, 1089 1090 updatePosition: function () { 1091 var base = this; 1092 base.jumpTo(base.currentItem); 1093 if (base.options.autoPlay !== false) { 1094 base.checkAp(); 1095 } 1096 }, 1097 1098 appendItemsSizes: function () { 1099 var base = this; 1100 1101 var roundPages = 0; 1102 var lastItem = base.itemsAmount - base.options.items; 1103 1104 base.$owlItems.each(function (index) { 1105 var $this = $(this); 1106 $this 1107 .css({ 1108 "width": base.itemWidth 1109 }) 1110 .data("owl-item", Number(index)); 1111 1112 if (index % base.options.items === 0 || index === lastItem) { 1113 if (!(index > lastItem)) { 1114 roundPages += 1; 1115 } 1116 } 1117 $this.data("owl-roundPages", roundPages); 1118 }); 1119 }, 1120 1121 appendWrapperSizes: function () { 1122 var base = this, 1123 width = base.$owlItems.length * base.itemWidth, 1124 cssObj; 1125 1126 base.options['direction'] == "rtl" ? cssObj = { 1127 "right": 0, 1128 direction: "rtl" 1129 } : cssObj = { 1130 "left": 0 1131 }; 1132 base.$owlWrapper.css({ 1133 "width": width 1134 }); 1135 base.$owlWrapper.css(cssObj); 1136 1137 base.appendItemsSizes(); 1138 }, 1139 1140 calculateAll: function () { 1141 var base = this; 1142 base.calculateWidth(); 1143 base.appendWrapperSizes(); 1144 base.loops(); 1145 base.max(); 1146 }, 1147 1148 calculateWidth: function () { 1149 var base = this; 1150 base.itemWidth = Math.round(base.$elem.width() / base.options.items); 1151 }, 1152 1153 max: function () { 1154 var base = this; 1155 var maximum = ((base.itemsAmount * base.itemWidth) - base.options.items * base.itemWidth) * -1; 1156 if (base.options.items > base.itemsAmount) { 1157 base.maximumItem = 0; 1158 maximum = 0; 1159 base.maximumPixels = 0; 1160 } else { 1161 base.maximumItem = base.itemsAmount - base.options.items; 1162 base.maximumPixels = maximum; 1163 } 1164 return maximum; 1165 }, 1166 1167 min: function () { 1168 return 0; 1169 }, 1170 1171 loops: function () { 1172 var base = this; 1173 1174 base.positionsInArray = [0]; 1175 base.pagesInArray = []; 1176 var prev = 0; 1177 var elWidth = 0; 1178 1179 for (var i = 0; i < base.itemsAmount; i++) { 1180 elWidth += base.itemWidth; 1181 base.positionsInArray.push(-elWidth); 1182 1183 if (base.options.scrollPerPage === true) { 1184 var item = $(base.$owlItems[i]); 1185 var roundPageNum = item.data("owl-roundPages"); 1186 if (roundPageNum !== prev) { 1187 base.pagesInArray[prev] = base.positionsInArray[i]; 1188 prev = roundPageNum; 1189 } 1190 } 1191 } 1192 }, 1193 1194 buildControls: function () { 1195 var base = this; 1196 if (base.options.navigation === true || base.options.pagination === true) {
1197 base.owlControls = $("<div class=\"owl-controls\"/>").toggleClass("clickable", !base.browser.isTouch).appendTo(base.$elem); 1198 } 1199 if (base.options.pagination === true) { 1200 base.buildPagination(); 1201 } 1202 if (base.options.navigation === true) { 1203 base.buildButtons(); 1204 } 1205 }, 1206 1207 buildButtons: function () { 1208 var base = this; 1209 var buttonsWrapper = $("<div class=\"owl-buttons\"/>"); 1210 base.owlControls.append(buttonsWrapper); 1211 1212 base.buttonPrev = $("<div/>", { 1213 "class": "owl-prev", 1214 "html": base.options.navigationText[0] || "" 1215 }); 1216 1217 base.buttonNext = $("<div/>", { 1218 "class": "owl-next", 1219 "html": base.options.navigationText[1] || "" 1220 }); 1221 1222 buttonsWrapper 1223 .append(base.buttonPrev) 1224 .append(base.buttonNext); 1225 1226 buttonsWrapper.on("touchstart.owlControls mousedown.owlControls", "div[class^=\"owl\"]", function (event) { 1227 event.preventDefault(); 1228 }); 1229 1230 buttonsWrapper.on("touchend.owlControls mouseup.owlControls", "div[class^=\"owl\"]", function (event) { 1231 event.preventDefault(); 1232 if ($(this).hasClass("owl-next")) { 1233 base.next(); 1234 } else { 1235 base.prev(); 1236 } 1237 }); 1238 }, 1239 1240 buildPagination: function () { 1241 var base = this; 1242 1243 base.paginationWrapper = $("<div class=\"owl-pagination\"/>"); 1244 base.owlControls.append(base.paginationWrapper); 1245 1246 base.paginationWrapper.on("touchend.owlControls mouseup.owlControls", ".owl-page", function (event) { 1247 event.preventDefault(); 1248 if (Number($(this).data("owl-page")) !== base.currentItem) { 1249 base.goTo(Number($(this).data("owl-page")), true); 1250 } 1251 }); 1252 }, 1253 1254 updatePagination: function () { 1255 var base = this; 1256 if (base.options.pagination === false) { 1257 return false; 1258 } 1259 1260 base.paginationWrapper.html(""); 1261 1262 var counter = 0; 1263 var lastPage = base.itemsAmount - base.itemsAmount % base.options.items; 1264 1265 for (var i = 0; i < base.itemsAmount; i++) { 1266 if (i % base.options.items === 0) { 1267 counter += 1; 1268 if (lastPage === i) { 1269 var lastItem = base.itemsAmount - base.options.items; 1270 } 1271 var paginationButton = $("<div/>", { 1272 "class": "owl-page" 1273 }); 1274 var paginationButtonInner = $("<span></span>", { 1275 "text": base.options.paginationNumbers === true ? counter : "", 1276 "class": base.options.paginationNumbers === true ? "owl-numbers" : "" 1277 }); 1278 paginationButton.append(paginationButtonInner); 1279 1280 paginationButton.data("owl-page", lastPage === i ? lastItem : i); 1281 paginationButton.data("owl-roundPages", counter); 1282 1283 base.paginationWrapper.append(paginationButton); 1284 } 1285 } 1286 base.checkPagination(); 1287 }, 1288 checkPagination: function () { 1289 var base = this; 1290 if (base.options.pagination === false) { 1291 return false; 1292 } 1293 base.paginationWrapper.find(".owl-page").each(function (i, v) { 1294 if ($(this).data("owl-roundPages") === $(base.$owlItems[base.currentItem]).data("owl-roundPages")) { 1295 base.paginationWrapper 1296 .find(".owl-page") 1297 .removeClass("active"); 1298 $(this).addClass("active"); 1299 } 1300 }); 1301 }, 1302 1303 checkNavigation: function () { 1304 var base = this; 1305 1306 if (base.options.navigation === false) { 1307 return false;
1308 } 1309 if (base.options.rewindNav === false) { 1310 if (base.currentItem === 0 && base.maximumItem === 0) { 1311 base.buttonPrev.addClass("disabled"); 1312 base.buttonNext.addClass("disabled"); 1313 } else if (base.currentItem === 0 && base.maximumItem !== 0) { 1314 base.buttonPrev.addClass("disabled"); 1315 base.buttonNext.removeClass("disabled"); 1316 } else if (base.currentItem === base.maximumItem) { 1317 base.buttonPrev.removeClass("disabled"); 1318 base.buttonNext.addClass("disabled"); 1319 } else if (base.currentItem !== 0 && base.currentItem !== base.maximumItem) { 1320 base.buttonPrev.removeClass("disabled"); 1321 base.buttonNext.removeClass("disabled"); 1322 } 1323 } 1324 }, 1325 1326 updateControls: function () { 1327 var base = this; 1328 base.updatePagination(); 1329 base.checkNavigation(); 1330 if (base.owlControls) { 1331 if (base.options.items >= base.itemsAmount) { 1332 base.owlControls.hide(); 1333 } else { 1334 base.owlControls.show(); 1335 } 1336 } 1337 }, 1338 1339 destroyControls: function () { 1340 var base = this; 1341 if (base.owlControls) { 1342 base.owlControls.remove(); 1343 } 1344 }, 1345 1346 next: function (speed) { 1347 var base = this; 1348 1349 if (base.isTransition) { 1350 return false; 1351 } 1352 1353 base.currentItem += base.options.scrollPerPage === true ? base.options.items : 1; 1354 if (base.currentItem > base.maximumItem + (base.options.scrollPerPage === true ? (base.options.items - 1) : 0)) { 1355 if (base.options.rewindNav === true) { 1356 base.currentItem = 0; 1357 speed = "rewind"; 1358 } else { 1359 base.currentItem = base.maximumItem; 1360 return false; 1361 } 1362 } 1363 base.goTo(base.currentItem, speed); 1364 }, 1365 1366 prev: function (speed) { 1367 var base = this; 1368 1369 if (base.isTransition) { 1370 return false; 1371 } 1372 1373 if (base.options.scrollPerPage === true && base.currentItem > 0 && base.currentItem < base.options.items) { 1374 base.currentItem = 0; 1375 } else { 1376 base.currentItem -= base.options.scrollPerPage === true ? base.options.items : 1; 1377 } 1378 if (base.currentItem < 0) { 1379 if (base.options.rewindNav === true) { 1380 base.currentItem = base.maximumItem; 1381 speed = "rewind"; 1382 } else { 1383 base.currentItem = 0; 1384 return false; 1385 } 1386 } 1387 base.goTo(base.currentItem, speed); 1388 }, 1389 1390 goTo: function (position, speed, drag) { 1391 var base = this; 1392 1393 if (base.isTransition) { 1394 return false; 1395 } 1396 if (typeof base.options.beforeMove === "function") { 1397 base.options.beforeMove.apply(this, [base.$elem]); 1398 } 1399 if (position >= base.maximumItem) { 1400 position = base.maximumItem; 1401 } else if (position <= 0) { 1402 position = 0; 1403 } 1404 1405 base.currentItem = base.owl.currentItem = position; 1406 if (base.options.transitionStyle !== false && drag !== "drag" && base.options.items === 1 && base.browser.support3d === true) { 1407 base.swapSpeed(0); 1408 if (base.browser.support3d === true) { 1409 base.transition3d(base.positionsInArray[position]); 1410 } else { 1411 base.css2slide(base.positionsInArray[position], 1); 1412 } 1413 base.afterGo(); 1414 base.singleItemTransition(); 1415 1416 return false; 1417 } 1418 var goToPixel = base.positionsInArray[position]; 1419 1420 if (base.browser.support3d === true) { 1421 base.isCss3Finish = false;
1422 1423 if (speed === true) { 1424 base.swapSpeed("paginationSpeed"); 1425 setTimeout(function () { 1426 base.isCss3Finish = true; 1427 }, base.options.paginationSpeed); 1428 1429 } else if (speed === "rewind") { 1430 base.swapSpeed(base.options.rewindSpeed); 1431 setTimeout(function () { 1432 base.isCss3Finish = true; 1433 }, base.options.rewindSpeed); 1434 1435 } else { 1436 base.swapSpeed("slideSpeed"); 1437 setTimeout(function () { 1438 base.isCss3Finish = true; 1439 }, base.options.slideSpeed); 1440 } 1441 base.transition3d(goToPixel); 1442 } else { 1443 if (speed === true) { 1444 base.css2slide(goToPixel, base.options.paginationSpeed); 1445 } else if (speed === "rewind") { 1446 base.css2slide(goToPixel, base.options.rewindSpeed); 1447 } else { 1448 base.css2slide(goToPixel, base.options.slideSpeed); 1449 } 1450 } 1451 base.afterGo(); 1452 }, 1453 1454 jumpTo: function (position) { 1455 var base = this; 1456 if (typeof base.options.beforeMove === "function") { 1457 base.options.beforeMove.apply(this, [base.$elem]); 1458 } 1459 if (position >= base.maximumItem || position === -1) { 1460 position = base.maximumItem; 1461 } else if (position <= 0) { 1462 position = 0; 1463 } 1464 base.swapSpeed(0); 1465 if (base.browser.support3d === true) { 1466 base.transition3d(base.positionsInArray[position]); 1467 } else { 1468 base.css2slide(base.positionsInArray[position], 1); 1469 } 1470 base.currentItem = base.owl.currentItem = position; 1471 base.afterGo(); 1472 }, 1473 1474 afterGo: function () { 1475 var base = this; 1476 1477 base.prevArr.push(base.currentItem); 1478 base.prevItem = base.owl.prevItem = base.prevArr[base.prevArr.length - 2]; 1479 base.prevArr.shift(0); 1480 1481 if (base.prevItem !== base.currentItem) { 1482 base.checkPagination(); 1483 base.checkNavigation(); 1484 base.eachMoveUpdate(); 1485 1486 if (base.options.autoPlay !== false) { 1487 base.checkAp(); 1488 } 1489 } 1490 if (typeof base.options.afterMove === "function" && base.prevItem !== base.currentItem) { 1491 base.options.afterMove.apply(this, [base.$elem]); 1492 } 1493 }, 1494 1495 stop: function () { 1496 var base = this; 1497 base.apStatus = "stop"; 1498 clearInterval(base.autoPlayInterval); 1499 }, 1500 1501 checkAp: function () { 1502 var base = this; 1503 if (base.apStatus !== "stop") { 1504 base.play(); 1505 } 1506 }, 1507 1508 play: function () { 1509 var base = this; 1510 base.apStatus = "play"; 1511 if (base.options.autoPlay === false) { 1512 return false; 1513 } 1514 clearInterval(base.autoPlayInterval); 1515 base.autoPlayInterval = setInterval(function () { 1516 base.next(true); 1517 }, base.options.autoPlay); 1518 }, 1519 1520 swapSpeed: function (action) { 1521 var base = this; 1522 if (action === "slideSpeed") { 1523 base.$owlWrapper.css(base.addCssSpeed(base.options.slideSpeed)); 1524 } else if (action === "paginationSpeed") { 1525 base.$owlWrapper.css(base.addCssSpeed(base.options.paginationSpeed)); 1526 } else if (typeof action !== "string") { 1527 base.$owlWrapper.css(base.addCssSpeed(action)); 1528 } 1529 }, 1530 1531 addCssSpeed: function (speed) { 1532 var base = this; 1533 return { 1534 "-webkit-transition": "all " + speed + "ms ease", 1535 "-moz-transition": "all " + speed + "ms ease", 1536 "-o-transition": "all " + speed + "ms ease", 1537 "transition": "all " + speed + "ms ease" 1538 }; 1539 }, 1540 1541 removeTransition: function () { 1542 return { 1543 "-webkit-transition": "", 1544 "-moz-transition": "", 1545 "-o-transition": "", 1546 "transition": "" 1547 }; 1548 }, 1549 1550 doTranslate: function (pixels) { 1551 var base = this; 1552 base.options['direction'] == "rtl" ? pixels = -pixels : pixels = pixels; 1553 return { 1554 "-webkit-transform": "translate3d(" + pixels + "px, 0px, 0px)", 1555 "-moz-transform": "translate3d(" + pixels + "px, 0px, 0px)", 1556 "-o-transform": "translate3d(" + pixels + "px, 0px, 0px)", 1557 "-ms-transform": "translate3d(" + pixels + "px, 0px, 0px)", 1558 "transform": "translate3d(" + pixels + "px, 0px,0px)" 1559 }; 1560 }, 1561 1562 transition3d: function (value) { 1563 var base = this; 1564 base.$owlWrapper.css(base.doTranslate(value)); 1565 }, 1566 1567 css2move: function (value) { 1568 var base = this, 1569 cssObj; 1570 1571 base.options['direction'] == "rtl" ? cssObj = { 1572 "right": value 1573 } : cssObj = { 1574 "left": value 1575 }; 1576 base.$owlWrapper.css(cssObj); 1577 }, 1578 1579 css2slide: function (value, speed) { 1580 var base = this, 1581 cssObj; 1582 base.options['direction'] == "rtl" ? cssObj = { 1583 "right": value 1584 } : cssObj = { 1585 "left": value 1586 }; 1587 1588 base.isCssFinish = false;
1589 base.$owlWrapper.stop(true, true).animate(cssObj, { 1590 duration: speed || base.options.slideSpeed, 1591 complete: function () { 1592 base.isCssFinish = true; 1593 } 1594 }); 1595 }, 1596 1597 checkBrowser: function () { 1598 var base = this; 1599 1600 //Check 3d support 1601 var translate3D = "translate3d(0px, 0px, 0px)", 1602 tempElem = document.createElement("div"); 1603 1604 tempElem.style.cssText = " -moz-transform:" + translate3D + 1605 "; -ms-transform:" + translate3D + 1606 "; -o-transform:" + translate3D + 1607 "; -webkit-transform:" + translate3D + 1608 "; transform:" + translate3D; 1609 var regex = /translate3d\(0px, 0px, 0px\)/g, 1610 asSupport = tempElem.style.cssText.match(regex), 1611 support3d = (asSupport !== null && asSupport.length === 1); 1612 1613 var isTouch = "ontouchstart" in window || navigator.msMaxTouchPoints; 1614 1615 base.browser = { 1616 "support3d": support3d, 1617 "isTouch": isTouch 1618 }; 1619 }, 1620 1621 moveEvents: function () { 1622 var base = this; 1623 if (base.options.mouseDrag !== false || base.options.touchDrag !== false) { 1624 base.gestures(); 1625 base.disabledEvents(); 1626 } 1627 }, 1628 1629 eventTypes: function () { 1630 var base = this; 1631 var types = ["s", "e", "x"]; 1632 1633 base.ev_types = {}; 1634 1635 if (base.options.mouseDrag === true && base.options.touchDrag === true) { 1636 types = [ 1637 "touchstart.owl mousedown.owl", 1638 "touchmove.owl mousemove.owl", 1639 "touchend.owl touchcancel.owl mouseup.owl" 1640 ]; 1641 } else if (base.options.mouseDrag === false && base.options.touchDrag === true) { 1642 types = [ 1643 "touchstart.owl", 1644 "touchmove.owl", 1645 "touchend.owl touchcancel.owl" 1646 ]; 1647 } else if (base.options.mouseDrag === true && base.options.touchDrag === false) { 1648 types = [ 1649 "mousedown.owl", 1650 "mousemove.owl", 1651 "mouseup.owl" 1652 ]; 1653 } 1654 1655 base.ev_types["start"] = types[0]; 1656 base.ev_types["move"] = types[1]; 1657 base.ev_types["end"] = types[2]; 1658 }, 1659 1660 disabledEvents: function () { 1661 var base = this; 1662 base.$elem.on("dragstart.owl", function (event) { 1663 event.preventDefault(); 1664 }); 1665 base.$elem.on("mousedown.disableTextSelect", function (e) { 1666 return $(e.target).is('input, textarea, select, option'); 1667 }); 1668 }, 1669 1670 gestures: function () { 1671 var base = this; 1672 1673 var locals = { 1674 offsetX: 0, 1675 offsetY: 0, 1676 baseElWidth: 0, 1677 relativePos: 0, 1678 position: null, 1679 minSwipe: null, 1680 maxSwipe: null, 1681 sliding: null, 1682 dargging: null, 1683 targetElement: null 1684 }; 1685 1686 base.isCssFinish = true; 1687 1688 function getTouches(event) { 1689 if (event.touches) { 1690 return { 1691 x: event.touches[0].pageX, 1692 y: event.touches[0].pageY 1693 }; 1694 } else { 1695 if (event.pageX !== undefined) { 1696 return { 1697 x: event.pageX, 1698 y: event.pageY 1699 }; 1700 } else { 1701 return { 1702 x: event.clientX, 1703 y: event.clientY 1704 }; 1705 } 1706 } 1707 } 1708 1709 function swapEvents(type) { 1710 if (type === "on") { 1711 $(document).on(base.ev_types["move"], dragMove); 1712 $(document).on(base.ev_types["end"], dragEnd); 1713 } else if (type === "off") { 1714 $(document).off(base.ev_types["move"]); 1715 $(document).off(base.ev_types["end"]); 1716 } 1717 } 1718 1719 function dragStart(event) { 1720 var event = event.originalEvent || event || window.event; 1721 1722 if (event.which === 3) { 1723 return false;
1724 } 1725 if (base.itemsAmount <= base.options.items) { 1726 return; 1727 } 1728 if (base.isCssFinish === false && !base.options.dragBeforeAnimFinish) { 1729 return false; 1730 } 1731 if (base.isCss3Finish === false && !base.options.dragBeforeAnimFinish) { 1732 return false; 1733 } 1734 1735 if (base.options.autoPlay !== false) { 1736 clearInterval(base.autoPlayInterval); 1737 } 1738 1739 if (base.browser.isTouch !== true && !base.$owlWrapper.hasClass("grabbing")) { 1740 base.$owlWrapper.addClass("grabbing"); 1741 } 1742 1743 base.newPosX = 0; 1744 base.newRelativeX = 0; 1745 1746 $(this).css(base.removeTransition()); 1747 /*Bilal*/ 1748 var position = $(this).position(); 1749 1750 if (base.options['direction'] == "rtl") { 1751 positionRight = base.$owlItems.eq(0).width() * base.currentItem; 1752 locals.relativePos = positionRight; 1753 locals.offsetX = -getTouches(event).x + positionRight; 1754 } else { 1755 locals.relativePos = position.left; 1756 locals.offsetX = getTouches(event).x - position.left; 1757 } 1758 1759 locals.offsetY = getTouches(event).y - position.top; 1760 1761 swapEvents("on"); 1762 1763 locals.sliding = false; 1764 locals.targetElement = event.target || event.srcElement; 1765 } 1766 1767 function dragMove(event) { 1768 var event = event.originalEvent || event || window.event; 1769 1770 if (base.options['direction'] == "rtl") { 1771 base.newPosX = -getTouches(event).x - locals.offsetX; 1772 base.newPosY = getTouches(event).y - locals.offsetY; 1773 base.newRelativeX = base.newPosX + locals.relativePos; 1774 } else { 1775 base.newPosX = getTouches(event).x - locals.offsetX; 1776 base.newPosY = getTouches(event).y - locals.offsetY; 1777 base.newRelativeX = base.newPosX - locals.relativePos; 1778 } 1779 1780 if (typeof base.options.startDragging === "function" && locals.dragging !== true && base.newRelativeX !== 0) { 1781 locals.dragging = true; 1782 base.options.startDragging.apply(base, [base.$elem]); 1783 } 1784 1785 if (base.newRelativeX > 8 || base.newRelativeX < -8 && base.browser.isTouch === true) { 1786 event.preventDefault ? event.preventDefault() : event.returnValue = false; 1787 locals.sliding = true; 1788 } 1789 1790 if ((base.newPosY > 10 || base.newPosY < -10) && locals.sliding === false) { 1791 $(document).off("touchmove.owl"); 1792 } 1793 1794 var minSwipe = function () { 1795 return base.newRelativeX / 5; 1796 }; 1797 var maxSwipe = function () { 1798 return base.maximumPixels + base.newRelativeX / 5; 1799 }; 1800 1801 base.newPosX = Math.max(Math.min(base.newPosX, minSwipe()), maxSwipe()); 1802 if (base.browser.support3d === true) { 1803 base.transition3d(base.newPosX); 1804 } else { 1805 base.css2move(base.newPosX); 1806 } 1807 } 1808 1809 function dragEnd(event) { 1810 var event = event.originalEvent || event || window.event; 1811 event.target = event.target || event.srcElement; 1812 1813 locals.dragging = false; 1814 1815 if (base.browser.isTouch !== true) { 1816 base.$owlWrapper.removeClass("grabbing"); 1817 } 1818 1819 if (base.options['direction'] == "rtl") { 1820 if (base.newRelativeX < 0) { 1821 base.dragDirection = base.owl.dragDirection = "right"; 1822 } else { 1823 base.dragDirection = base.owl.dragDirection = "left"; 1824 } 1825 } else { 1826 if (base.newRelativeX < 0) { 1827 base.dragDirection = base.owl.dragDirection = "left"; 1828 } else { 1829 base.dragDirection = base.owl.dragDirection = "right"; 1830 } 1831 } 1832 1833 if (base.newRelativeX !== 0) { 1834 var newPosition = base.getNewPosition(); 1835 base.goTo(newPosition, false, "drag"); 1836 if (locals.targetElement === event.target && base.browser.isTouch !== true) { 1837 $(event.target).on("click.disable", function (ev) { 1838 ev.stopImmediatePropagation(); 1839 ev.stopPropagation(); 1840 ev.preventDefault(); 1841 $(event.target).off("click.disable"); 1842 }); 1843 var handlers = $._data(event.target, "events")["click"]; 1844 var owlStopEvent = handlers.pop(); 1845 handlers.splice(0, 0, owlStopEvent); 1846 } 1847 } 1848 swapEvents("off"); 1849 } 1850 base.$elem.on(base.ev_types["start"], ".owl-wrapper", dragStart); 1851 }, 1852 1853 getNewPosition: function () { 1854 var base = this, 1855 newPosition; 1856 1857 newPosition = base.closestItem(); 1858 1859 if (newPosition > base.maximumItem) { 1860 base.currentItem = base.maximumItem; 1861 newPosition = base.maximumItem; 1862 } else if (base.newPosX >= 0) { 1863 newPosition = 0; 1864 base.currentItem = 0; 1865 } 1866 return newPosition; 1867 }, 1868 closestItem: function () { 1869 var base = this, 1870 array = base.options.scrollPerPage === true ? base.pagesInArray : base.positionsInArray, 1871 goal = base.newPosX, 1872 closest = null; 1873 1874 $.each(array, function (i, v) { 1875 if (goal - (base.itemWidth / 20) > array[i + 1] && goal - (base.itemWidth / 20) < v && base.moveDirection() === "left") { 1876 closest = v; 1877 if (base.options.scrollPerPage === true) { 1878 base.currentItem = $.inArray(closest, base.positionsInArray); 1879 } else { 1880 base.currentItem = i; 1881 } 1882 } else if (goal + (base.itemWidth / 20) < v && goal + (base.itemWidth / 20) > (array[i + 1] || array[i] - base.itemWidth) && base.moveDirection() === "right") { 1883 if (base.options.scrollPerPage === true) { 1884 closest = array[i + 1] || array[array.length - 1]; 1885 base.currentItem = $.inArray(closest, base.positionsInArray); 1886 } else { 1887 closest = array[i + 1]; 1888 base.currentItem = i + 1; 1889 } 1890 } 1891 }); 1892 return base.currentItem; 1893 }, 1894 1895 moveDirection: function () { 1896 var base = this, 1897 direction; 1898 if (base.newRelativeX < 0) { 1899 direction = "right"; 1900 base.playDirection = "next"; 1901 } else { 1902 direction = "left"; 1903 base.playDirection = "prev"; 1904 } 1905 return direction; 1906 }, 1907 1908 customEvents: function () { 1909 var base = this; 1910 base.$elem.on("owl.next", function () { 1911 base.next(); 1912 }); 1913 base.$elem.on("owl.prev", function () { 1914 base.prev(); 1915 }); 1916 base.$elem.on("owl.play", function (event, speed) { 1917 base.options.autoPlay = speed; 1918 base.play(); 1919 base.hoverStatus = "play"; 1920 }); 1921 base.$elem.on("owl.stop", function () { 1922 base.stop(); 1923 base.hoverStatus = "stop"; 1924 }); 1925 base.$elem.on("owl.goTo", function (event, item) { 1926 base.goTo(item); 1927 }); 1928 base.$elem.on("owl.jumpTo", function (event, item) { 1929 base.jumpTo(item); 1930 }); 1931 }, 1932 1933 stopOnHover: function () { 1934 var base = this; 1935 if (base.options.stopOnHover === true && base.browser.isTouch !== true && base.options.autoPlay !== false) { 1936 base.$elem.on("mouseover", function () { 1937 base.stop(); 1938 }); 1939 base.$elem.on("mouseout", function () { 1940 if (base.hoverStatus !== "stop") { 1941 base.play(); 1942 } 1943 }); 1944 } 1945 }, 1946 1947 lazyLoad: function () { 1948 var base = this; 1949 1950 if (base.options.lazyLoad === false) { 1951 return false;
1952 } 1953 for (var i = 0; i < base.itemsAmount; i++) { 1954 var $item = $(base.$owlItems[i]); 1955 1956 if ($item.data("owl-loaded") === "loaded") { 1957 continue; 1958 } 1959 1960 var itemNumber = $item.data("owl-item"), 1961 $lazyImg = $item.find(".lazyOwl"), 1962 follow; 1963 1964 if (typeof $lazyImg.data("src") !== "string") { 1965 $item.data("owl-loaded", "loaded"); 1966 continue; 1967 } 1968 if ($item.data("owl-loaded") === undefined) { 1969 $lazyImg.hide(); 1970 $item.addClass("loading").data("owl-loaded", "checked"); 1971 } 1972 if (base.options.lazyFollow === true) { 1973 follow = itemNumber >= base.currentItem; 1974 } else { 1975 follow = true; 1976 } 1977 if (follow && itemNumber < base.currentItem + base.options.items && $lazyImg.length) { 1978 base.lazyPreload($item, $lazyImg); 1979 } 1980 } 1981 }, 1982 1983 lazyPreload: function ($item, $lazyImg) { 1984 var base = this, 1985 iterations = 0; 1986 if ($lazyImg.prop("tagName") === "DIV") { 1987 $lazyImg.css("background-image", "url(" + $lazyImg.data("src") + ")"); 1988 var isBackgroundImg = true; 1989 } else { 1990 $lazyImg[0].src = $lazyImg.data("src"); 1991 } 1992 checkLazyImage(); 1993 1994 function checkLazyImage() { 1995 iterations += 1; 1996 if (base.completeImg($lazyImg.get(0)) || isBackgroundImg === true) { 1997 showImage(); 1998 } else if (iterations <= 100) { //if image loads in less than 10 seconds 1999 setTimeout(checkLazyImage, 100); 2000 } else { 2001 showImage(); 2002 } 2003 } 2004 2005 function showImage() { 2006 $item.data("owl-loaded", "loaded").removeClass("loading"); 2007 $lazyImg.removeAttr("data-src"); 2008 base.options.lazyEffect === "fade" ? $lazyImg.fadeIn(400) : $lazyImg.show(); 2009 if (typeof base.options.afterLazyLoad === "function") { 2010 base.options.afterLazyLoad.apply(this, [base.$elem]); 2011 } 2012 } 2013 }, 2014 2015 autoHeight: function () { 2016 var base = this; 2017 var $currentimg = $(base.$owlItems[base.currentItem]).find("img"); 2018 2019 if ($currentimg.get(0) !== undefined) { 2020 var iterations = 0; 2021 checkImage(); 2022 } else { 2023 addHeight(); 2024 } 2025 2026 function checkImage() { 2027 iterations += 1; 2028 if (base.completeImg($currentimg.get(0))) { 2029 addHeight(); 2030 } else if (iterations <= 100) { //if image loads in less than 10 seconds 2031 setTimeout(checkImage, 100); 2032 } else { 2033 base.wrapperOuter.css("height", ""); //Else remove height attribute 2034 } 2035 } 2036 2037 function addHeight() { 2038 var $currentItem = $(base.$owlItems[base.currentItem]).height(); 2039 base.wrapperOuter.css("height", $currentItem + "px"); 2040 if (!base.wrapperOuter.hasClass("autoHeight")) { 2041 setTimeout(function () { 2042 base.wrapperOuter.addClass("autoHeight"); 2043 }, 0); 2044 } 2045 } 2046 }, 2047 2048 completeImg: function (img) { 2049 if (!img.complete) { 2050 return false; 2051 } 2052 if (typeof img.naturalWidth !== "undefined" && img.naturalWidth === 0) { 2053 return false; 2054 } 2055 return true; 2056 }, 2057 2058 onVisibleItems: function () { 2059 var base = this; 2060 2061 if (base.options.addClassActive === true) { 2062 base.$owlItems.removeClass("active"); 2063 } 2064 base.visibleItems = []; 2065 for (var i = base.currentItem; i < base.currentItem + base.options.items; i++) { 2066 base.visibleItems.push(i); 2067 2068 if (base.options.addClassActive === true) { 2069 $(base.$owlItems[i]).addClass("active"); 2070 } 2071 } 2072 base.owl.visibleItems = base.visibleItems; 2073 }, 2074 2075 transitionTypes: function (className) { 2076 var base = this; 2077 //Currently available: "fade","backSlide","goDown","fadeUp" 2078 base.outClass = "owl-" + className + "-out"; 2079 base.inClass = "owl-" + className + "-in"; 2080 }, 2081 2082 singleItemTransition: function () { 2083 var base = this; 2084 base.isTransition = true; 2085 2086 var outClass = base.outClass, 2087 inClass = base.inClass, 2088 $currentItem = base.$owlItems.eq(base.currentItem), 2089 $prevItem = base.$owlItems.eq(base.prevItem),
2090 prevPos = Math.abs(base.positionsInArray[base.currentItem]) + base.positionsInArray[base.prevItem], 2091 origin = Math.abs(base.positionsInArray[base.currentItem]) + base.itemWidth / 2; 2092 2093 base.$owlWrapper 2094 .addClass('owl-origin') 2095 .css({ 2096 "-webkit-transform-origin": origin + "px", 2097 "-moz-perspective-origin": origin + "px", 2098 "perspective-origin": origin + "px" 2099 }); 2100 2101 function transStyles(prevPos, zindex) { 2102 return { 2103 "position": "relative", 2104 "left": prevPos + "px" 2105 }; 2106 } 2107 2108 var animEnd = 'webkitAnimationEnd oAnimationEnd MSAnimationEnd animationend'; 2109 2110 $prevItem 2111 .css(transStyles(prevPos, 10)) 2112 .addClass(outClass) 2113 .on(animEnd, function () { 2114 base.endPrev = true; 2115 $prevItem.off(animEnd); 2116 base.clearTransStyle($prevItem, outClass); 2117 }); 2118 2119 $currentItem 2120 .addClass(inClass) 2121 .on(animEnd, function () { 2122 base.endCurrent = true; 2123 $currentItem.off(animEnd); 2124 base.clearTransStyle($currentItem, inClass); 2125 }); 2126 }, 2127 2128 clearTransStyle: function (item, classToRemove) { 2129 var base = this; 2130 item.css({ 2131 "position": "", 2132 "left": "" 2133 }) 2134 .removeClass(classToRemove); 2135 if (base.endPrev && base.endCurrent) { 2136 base.$owlWrapper.removeClass('owl-origin'); 2137 base.endPrev = false; 2138 base.endCurrent = false; 2139 base.isTransition = false; 2140 } 2141 }, 2142 2143 owlStatus: function () { 2144 var base = this; 2145 base.owl = { 2146 "userOptions": base.userOptions, 2147 "baseElement": base.$elem, 2148 "userItems": base.$userItems, 2149 "owlItems": base.$owlItems, 2150 "currentItem": base.currentItem, 2151 "prevItem": base.prevItem, 2152 "visibleItems": base.visibleItems, 2153 "isTouch": base.browser.isTouch, 2154 "browser": base.browser, 2155 "dragDirection": base.dragDirection 2156 }; 2157 }, 2158 2159 clearEvents: function () { 2160 var base = this; 2161 base.$elem.off(".owl owl mousedown.disableTextSelect"); 2162 $(document).off(".owl owl"); 2163 $(window).off("resize", base.resizer); 2164 }, 2165 2166 unWrap: function () { 2167 var base = this; 2168 if (base.$elem.children().length !== 0) { 2169 base.$owlWrapper.unwrap(); 2170 base.$userItems.unwrap().unwrap(); 2171 if (base.owlControls) { 2172 base.owlControls.remove(); 2173 } 2174 } 2175 base.clearEvents(); 2176 base.$elem 2177 .attr("style", base.$elem.data("owl-originalStyles") || "") 2178 .attr("class", base.$elem.data("owl-originalClasses")); 2179 }, 2180 2181 destroy: function () { 2182 var base = this; 2183 base.stop(); 2184 clearInterval(base.checkVisible); 2185 base.unWrap(); 2186 base.$elem.removeData(); 2187 }, 2188 2189 reinit: function (newOptions) { 2190 var base = this; 2191 var options = $.extend({}, base.userOptions, newOptions); 2192 base.unWrap(); 2193 base.init(options, base.$elem); 2194 }, 2195 2196 addItem: function (htmlString, targetPosition) { 2197 var base = this, 2198 position; 2199 2200 if (!htmlString) { 2201 return false; 2202 } 2203 2204 if (base.$elem.children().length === 0) { 2205 base.$elem.append(htmlString); 2206 base.setVars(); 2207 return false; 2208 } 2209 base.unWrap(); 2210 if (targetPosition === undefined || targetPosition === -1) { 2211 position = -1; 2212 } else { 2213 position = targetPosition; 2214 } 2215 if (position >= base.$userItems.length || position === -1) { 2216 base.$userItems.eq(-1).after(htmlString); 2217 } else { 2218 base.$userItems.eq(position).before(htmlString); 2219 } 2220 2221 base.setVars(); 2222 }, 2223 2224 removeItem: function (targetPosition) { 2225 var base = this, 2226 position; 2227 2228 if (base.$elem.children().length === 0) { 2229 return false;
2230 } 2231 2232 if (targetPosition === undefined || targetPosition === -1) { 2233 position = -1; 2234 } else { 2235 position = targetPosition; 2236 } 2237 2238 base.unWrap(); 2239 base.$userItems.eq(position).remove(); 2240 base.setVars(); 2241 } 2242 2243 }; 2244 2245 $.fn.owlCarousel = function (options) { 2246 return this.each(function () { 2247 if ($(this).data("owl-init") === true) { 2248 return false; 2249 } 2250 $(this).data("owl-init", true); 2251 var carousel = Object.create(Carousel); 2252 carousel.init(options, this); 2253 $.data(this, "owlCarousel", carousel); 2254 }); 2255 }; 2256 2257 $.fn.owlCarousel.options = { 2258 direction: 'ltr', 2259 2260 items: 5, 2261 itemsCustom: false, 2262 itemsDesktop: [1199, 4], 2263 itemsDesktopSmall: [979, 3], 2264 itemsTablet: [768, 2], 2265 itemsTabletSmall: false, 2266 itemsMobile: [479, 1], 2267 singleItem: false, 2268 itemsScaleUp: false, 2269 2270 slideSpeed: 200, 2271 paginationSpeed: 800, 2272 rewindSpeed: 1000, 2273 2274 autoPlay: false, 2275 stopOnHover: false, 2276 2277 navigation: false, 2278 navigationText: ["prev", "next"], 2279 rewindNav: true, 2280 scrollPerPage: false, 2281 2282 pagination: true, 2283 paginationNumbers: false, 2284 2285 responsive: true, 2286 responsiveRefreshRate: 200, 2287 responsiveBaseWidth: window, 2288 2289 2290 baseClass: "owl-carousel", 2291 theme: "owl-theme", 2292 2293 lazyLoad: false, 2294 lazyFollow: true, 2295 lazyEffect: "fade", 2296 2297 autoHeight: false, 2298 2299 jsonPath: false, 2300 jsonSuccess: false, 2301 2302 dragBeforeAnimFinish: true, 2303 mouseDrag: true, 2304 touchDrag: true, 2305 2306 addClassActive: false, 2307 transitionStyle: false, 2308 2309 beforeUpdate: false, 2310 afterUpdate: false, 2311 beforeInit: false, 2312 afterInit: false, 2313 beforeMove: false, 2314 afterMove: false, 2315 afterAction: false, 2316 startDragging: false, 2317 afterLazyLoad: false 2318 2319 }; 2320})(jQuery, window, document); 2321 2322/** 2323 * Tabslet | tabs jQuery plugin 2324 * 2325 * @copyright Copyright 2012, Dimitris Krestos 2326 * @license Apache License, Version 2.0 (http://www.opensource.org/licenses/apache2.0.php) 2327 * @link http://vdw.staytuned.gr 2328 * @version v1.4.4 2329 */ 2330 2331(function($, window, undefined) { 2332 "use strict"; 2333 2334 $.fn.tabslet = function(options) { 2335 2336 var defaults = { 2337 mouseevent: 'click', 2338 attribute: 'href', 2339 animation: false, 2340 autorotate: false, 2341 pauseonhover: true, 2342 delay: 2000, 2343 active: 1, 2344 controls: { 2345 prev: '.prev', 2346 next: '.next' 2347 } 2348 }; 2349 2350 var options = $.extend(defaults, options); 2351 2352 return this.each(function() { 2353 2354 var $this = $(this); 2355 2356 // Autorotate 2357 var elements = $this.find('> ul li'), i = options.active - 1; // ungly 2358 2359 if ( !$this.data( 'tabslet-init' ) ) { 2360 2361 $this.data( 'tabslet-init', true ); 2362 2363 // Ungly overwrite 2364 options.mouseevent = $this.data('mouseevent') || options.mouseevent; 2365 options.attribute = $this.data('attribute') || options.attribute; 2366 options.animation = $this.data('animation') || options.animation; 2367 options.autorotate = $this.data('autorotate') || options.autorotate; 2368 options.pauseonhover = $this.data('pauseonhover') || options.pauseonhover; 2369 options.delay = $this.data('delay') || options.delay; 2370 options.active = $this.data('active') || options.active; 2371 2372 $this.find('> div').hide(); 2373 $this.find('> div').eq(options.active - 1).show(); 2374 $this.find('> ul li').eq(options.active - 1).addClass('active'); 2375 2376 var fn = eval( 2377 2378 function() { 2379 2380 $(this).trigger('_before'); 2381 2382 $this.find('> ul li').removeClass('active'); 2383 $(this).addClass('active'); 2384 $this.find('> div').hide(); 2385 2386 i = elements.index($(this)); 2387 2388 var currentTab = $(this).find('a').attr(options.attribute); 2389 2390 if (options.animation) { 2391 2392 $this.find(currentTab).animate( { opacity: 'show' }, 'slow', function() { 2393 $(this).trigger('_after'); 2394 }); 2395 2396 } else { 2397 2398 $this.find(currentTab).show(); 2399 $(this).trigger('_after'); 2400 2401 } 2402 2403 return false;
2404 2405 } 2406 2407 ); 2408 2409 var init = eval("$this.find('> ul li')." + options.mouseevent + "(fn)"); 2410 2411 init; 2412 2413 var forward = function() { 2414 2415 i = ++i % elements.length; // wrap around 2416 2417 options.mouseevent == 'hover' ? elements.eq(i).trigger('mouseover') : elements.eq(i).click(); 2418 2419 var t = setTimeout(forward, options.delay); 2420 2421 $this.mouseover(function () { 2422 2423 if (options.pauseonhover) clearTimeout(t); 2424 2425 }); 2426 2427 } 2428 2429 if (options.autorotate) { 2430 2431 setTimeout(forward, 0); 2432 2433 if (options.pauseonhover) $this.on( "mouseleave", function() { setTimeout(forward, 1000); }); 2434 2435 } 2436 2437 var move = function(direction) { 2438 2439 if (direction == 'forward') i = ++i % elements.length; // wrap around 2440 2441 if (direction == 'backward') i = --i % elements.length; // wrap around 2442 2443 elements.eq(i).click(); 2444 2445 } 2446 2447 $this.find(options.controls.next).click(function() { 2448 move('forward'); 2449 }); 2450 2451 $this.find(options.controls.prev).click(function() { 2452 move('backward'); 2453 }); 2454 2455 $this.on ('destroy', function() { 2456 $(this).removeData(); 2457 }); 2458 2459 } 2460 2461 }); 2462 2463 }; 2464 2465 $(document).ready(function () { $('[data-toggle="tabslet"]').tabslet(); }); 2466 2467})(jQuery); 2468 2469/*! Magnific Popup - v0.9.9 - 2014-09-06 2470* http://dimsemenov.com/plugins/magnific-popup/ 2471* Copyright (c) 2014 Dmitry Semenov; */ 2472(function(e){var t,n,i,o,r,a,s,l="Close",c="BeforeClose",d="AfterClose",u="BeforeAppend",p="MarkupParse",f="Open",m="Change",g="mfp",h="."+g,v="mfp-ready",C="mfp-removing",y="mfp-prevent-close",w=function(){},b=!!window.jQuery,I=e(window),x=function(e,n){t.ev.on(g+e+h,n)},k=function(t,n,i,o){var r=document.createElement("div");return r.className="mfp-"+t,i&&(r.innerHTML=i),o?n&&n.appendChild(r):(r=e(r),n&&r.appendTo(n)),r},T=function(n,i){t.ev.triggerHandler(g+n,i),t.st.callbacks&&(n=n.charAt(0).toLowerCase()+n.slice(1),t.st.callbacks[n]&&t.st.callbacks[n].apply(t,e.isArray(i)?i:[i]))},E=function(n){return n===s&&t.currTemplate.closeBtn||(t.currTemplate.closeBtn=e(t.st.closeMarkup.replace("%title%",t.st.tClose)),s=n),t.currTemplate.closeBtn},_=function(){e.magnificPopup.instance||(t=new w,t.init(),e.magnificPopup.instance=t)},S=function(){var e=document.createElement("p").style,t=["ms","O","Moz","Webkit"];if(void 0!==e.transition)return!0;for(;t.length;)if(t.pop()+"Transition"in e)return!0;return!1};w.prototype={constructor:w,init:function(){var n=navigator.appVersion;t.isIE7=-1!==n.indexOf("MSIE 7."),t.isIE8=-1!==n.indexOf("MSIE 8."),t.isLowIE=t.isIE7||t.isIE8,t.isAndroid=/android/gi.test(n),t.isIOS=/iphone|ipad|ipod/gi.test(n),t.supportsTransition=S(),t.probablyMobile=t.isAndroid||t.isIOS||/(Opera Mini)|Kindle|webOS|BlackBerry|(Opera Mobi)|(Windows Phone)|IEMobile/i.test(navigator.userAgent),o=e(document),t.popupsCache={}},open:function(n){i||(i=e(document.body));var r;if(n.isObj===!1){t.items=n.items.toArray(),t.index=0;var s,l=n.items;for(r=0;l.length>r;r++)if(s=l[r],s.parsed&&(s=s.el[0]),s===n.el[0]){t.index=r;break}}else t.items=e.isArray(n.items)?n.items:[n.items],t.index=n.index||0;if(t.isOpen)return t.updateItemHTML(),void 0;t.types=[],a="",t.ev=n.mainEl&&n.mainEl.length?n.mainEl.eq(0):o,n.key?(t.popupsCache[n.key]||(t.popupsCache[n.key]={}),t.currTemplate=t.popupsCache[n.key]):t.currTemplate={},t.st=e.extend(!0,{},e.magnificPopup.defaults,n),t.fixedContentPos="auto"===t.st.fixedContentPos?!t.probablyMobile:t.st.fixedContentPos,t.st.modal&&(t.st.closeOnContentClick=!1,t.st.closeOnBgClick=!1,t.st.showCloseBtn=!1,t.st.enableEscapeKey=!1),t.bgOverlay||(t.bgOverlay=k("bg").on("click"+h,function(){t.close()}),t.wrap=k("wrap").attr("tabindex",-1).on("click"+h,function(e){t._checkIfClose(e.target)&&t.close()}),t.container=k("container",t.wrap)),t.contentContainer=k("content"),t.st.preloader&&(t.preloader=k("preloader",t.container,t.st.tLoading));var c=e.magnificPopup.modules;for(r=0;c.length>r;r++){var d=c[r];d=d.charAt(0).toUpperCase()+d.slice(1),t["init"+d].call(t)}T("BeforeOpen"),t.st.showCloseBtn&&(t.st.closeBtnInside?(x(p,function(e,t,n,i){n.close_replaceWith=E(i.type)}),a+=" mfp-close-btn-in"):t.wrap.append(E())),t.st.alignTop&&(a+=" mfp-align-top"),t.fixedContentPos?t.wrap.css({overflow:t.st.overflowY,overflowX:"hidden",overflowY:t.st.overflowY}):t.wrap.css({top:I.scrollTop(),position:"absolute"}),(t.st.fixedBgPos===!1||"auto"===t.st.fixedBgPos&&!t.fixedContentPos)&&t.bgOverlay.css({height:o.height(),position:"absolute"}
2472),t.st.enableEscapeKey&&o.on("keyup"+h,function(e){27===e.keyCode&&t.close()}),I.on("resize"+h,function(){t.updateSize()}),t.st.closeOnContentClick||(a+=" mfp-auto-cursor"),a&&t.wrap.addClass(a);var u=t.wH=I.height(),m={};if(t.fixedContentPos&&t._hasScrollBar(u)){var g=t._getScrollbarSize();g&&(m.marginRight=g)}t.fixedContentPos&&(t.isIE7?e("body, html").css("overflow","hidden"):m.overflow="hidden");var C=t.st.mainClass;return t.isIE7&&(C+=" mfp-ie7"),C&&t._addClassToMFP(C),t.updateItemHTML(),T("BuildControls"),e("html").css(m),t.bgOverlay.add(t.wrap).prependTo(t.st.prependTo||i),t._lastFocusedEl=document.activeElement,setTimeout(function(){t.content?(t._addClassToMFP(v),t._setFocus()):t.bgOverlay.addClass(v),o.on("focusin"+h,t._onFocusIn)},16),t.isOpen=!0,t.updateSize(u),T(f),n},close:function(){t.isOpen&&(T(c),t.isOpen=!1,t.st.removalDelay&&!t.isLowIE&&t.supportsTransition?(t._addClassToMFP(C),setTimeout(function(){t._close()},t.st.removalDelay)):t._close())},_close:function(){T(l);var n=C+" "+v+" ";if(t.bgOverlay.detach(),t.wrap.detach(),t.container.empty(),t.st.mainClass&&(n+=t.st.mainClass+" "),t._removeClassFromMFP(n),t.fixedContentPos){var i={marginRight:""};t.isIE7?e("body, html").css("overflow",""):i.overflow="",e("html").css(i)}o.off("keyup"+h+" focusin"+h),t.ev.off(h),t.wrap.attr("class","mfp-wrap").removeAttr("style"),t.bgOverlay.attr("class","mfp-bg"),t.container.attr("class","mfp-container"),!t.st.showCloseBtn||t.st.closeBtnInside&&t.currTemplate[t.currItem.type]!==!0||t.currTemplate.closeBtn&&t.currTemplate.closeBtn.detach(),t._lastFocusedEl&&e(t._lastFocusedEl).focus(),t.currItem=null,t.content=null,t.currTemplate=null,t.prevHeight=0,T(d)},updateSize:function(e){if(t.isIOS){var n=document.documentElement.clientWidth/window.innerWidth,i=window.innerHeight*n;t.wrap.css("height",i),t.wH=i}else t.wH=e||I.height();t.fixedContentPos||t.wrap.css("height",t.wH),T("Resize")},updateItemHTML:function(){var n=t.items[t.index];t.contentContainer.detach(),t.content&&t.content.detach(),n.parsed||(n=t.parseEl(t.index));var i=n.type;if(T("BeforeChange",[t.currItem?t.currItem.type:"",i]),t.currItem=n,!t.currTemplate[i]){var o=t.st[i]?t.st[i].markup:!1;T("FirstMarkupParse",o),t.currTemplate[i]=o?e(o):!0}r&&r!==n.type&&t.container.removeClass("mfp-"+r+"-holder");var a=t["get"+i.charAt(0).toUpperCase()+i.slice(1)](n,t.currTemplate[i]);t.appendContent(a,i),n.preloaded=!0,T(m,n),r=n.type,t.container.prepend(t.contentContainer),T("AfterChange")},appendContent:function(e,n){t.content=e,e?t.st.showCloseBtn&&t.st.closeBtnInside&&t.currTemplate[n]===!0?t.content.find(".mfp-close").length||t.content.append(E()):t.content=e:t.content="",T(u),t.container.addClass("mfp-"+n+"-holder"),t.contentContainer.append(t.content)},parseEl:function(n){var i,o=t.items[n];if(o.tagName?o={el:e(o)}:(i=o.type,o={data:o,src:o.src}),o.el){for(var r=t.types,a=0;r.length>a;a++)if(o.el.hasClass("mfp-"+r[a])){i=r[a];break}o.src=o.el.attr("data-mfp-src"),o.src||(o.src=o.el.attr("href"))}return o.type=i||t.st.type||"inline",o.index=n,o.parsed=!0,t.items[n]=o,T("ElementParse",o),t.items[n]},addGroup:function(e,n){var i=function(i){i.mfpEl=this,t._openClick(i,e,n)};n||(n={});var o="click.magnificPopup";n.mainEl=e,n.items?(n.isObj=!0,e.off(o).on(o,i)):(n.isObj=!1,n.delegate?e.off(o).on(o,n.delegate,i):(n.items=e,e.off(o).on(o,i)))},_openClick:function(n,i,o){var r=void 0!==o.midClick?o.midClick:e.magnificPopup.defaults.midClick;if(r||2!==n.which&&!n.ctrlKey&&!n.metaKey){var a=void 0!==o.disableOn?o.disableOn:e.magnificPopup.defaults.disableOn;if(a)if(e.isFunction(a)){if(!a.call(t))return!0}else if(a>I.width())return!0;n.type&&(n.preventDefault(),t.isOpen&&n.stopPropagation()),o.el=e(n.mfpEl),o.delegate&&(o.items=i.find(o.delegate)),t.open(o)}},updateStatus:function(e,i){if(t.preloader){n!==e&&t.container.removeClass("mfp-s-"+n),i||"loading"!==e||(i=t.st.tLoading);var o={status:e,text:i};T("UpdateStatus",o),e=o.status,i=o.text,t.preloader.html(i),t.preloader.find("a").on("click",function(e){e.stopImmediatePropagation()}),t.container.addClass("mfp-s-"+e),n=e}},_checkIfClose:function(n){if(!e(n).hasClass(y)){var i=t.st.closeOnContentClick,o=t.st.closeOnBgClick;if(i&&o)return!0;
2472if(!t.content||e(n).hasClass("mfp-close")||t.preloader&&n===t.preloader[0])return!0;if(n===t.content[0]||e.contains(t.content[0],n)){if(i)return!0}else if(o&&e.contains(document,n))return!0;return!1}},_addClassToMFP:function(e){t.bgOverlay.addClass(e),t.wrap.addClass(e)},_removeClassFromMFP:function(e){this.bgOverlay.removeClass(e),t.wrap.removeClass(e)},_hasScrollBar:function(e){return(t.isIE7?o.height():document.body.scrollHeight)>(e||I.height())},_setFocus:function(){(t.st.focus?t.content.find(t.st.focus).eq(0):t.wrap).focus()},_onFocusIn:function(n){return n.target===t.wrap[0]||e.contains(t.wrap[0],n.target)?void 0:(t._setFocus(),!1)},_parseMarkup:function(t,n,i){var o;i.data&&(n=e.extend(i.data,n)),T(p,[t,n,i]),e.each(n,function(e,n){if(void 0===n||n===!1)return!0;if(o=e.split("_"),o.length>1){var i=t.find(h+"-"+o[0]);if(i.length>0){var r=o[1];"replaceWith"===r?i[0]!==n[0]&&i.replaceWith(n):"img"===r?i.is("img")?i.attr("src",n):i.replaceWith('<img src="'+n+'" class="'+i.attr("class")+'" />'):i.attr(o[1],n)}}else t.find(h+"-"+e).html(n)})},_getScrollbarSize:function(){if(void 0===t.scrollbarSize){var e=document.createElement("div");e.style.cssText="width: 99px; height: 99px; overflow: scroll; position: absolute; top: -9999px;",document.body.appendChild(e),t.scrollbarSize=e.offsetWidth-e.clientWidth,document.body.removeChild(e)}return t.scrollbarSize}},e.magnificPopup={instance:null,proto:w.prototype,modules:[],open:function(t,n){return _(),t=t?e.extend(!0,{},t):{},t.isObj=!0,t.index=n||0,this.instance.open(t)},close:function(){return e.magnificPopup.instance&&e.magnificPopup.instance.close()},registerModule:function(t,n){n.options&&(e.magnificPopup.defaults[t]=n.options),e.extend(this.proto,n.proto),this.modules.push(t)},defaults:{disableOn:0,key:null,midClick:!1,mainClass:"",preloader:!0,focus:"",closeOnContentClick:!1,closeOnBgClick:!0,closeBtnInside:!0,showCloseBtn:!0,enableEscapeKey:!0,modal:!1,alignTop:!1,removalDelay:0,prependTo:null,fixedContentPos:"auto",fixedBgPos:"auto",overflowY:"auto",closeMarkup:'<button title="%title%" type="button" class="mfp-close">×</button>',tClose:"Close (Esc)",tLoading:"Loading..."}},e.fn.magnificPopup=function(n){_();var i=e(this);if("string"==typeof n)if("open"===n){var o,r=b?i.data("magnificPopup"):i[0].magnificPopup,a=parseInt(arguments[1],10)||0;r.items?o=r.items[a]:(o=i,r.delegate&&(o=o.find(r.delegate)),o=o.eq(a)),t._openClick({mfpEl:o},i,r)}else t.isOpen&&t[n].apply(t,Array.prototype.slice.call(arguments,1));else n=e.extend(!0,{},n),b?i.data("magnificPopup",n):i[0].magnificPopup=n,t.addGroup(i,n);return i};var P,O,z,M="inline",B=function(){z&&(O.after(z.addClass(P)).detach(),z=null)};e.magnificPopup.registerModule(M,{options:{hiddenClass:"hide",markup:"",tNotFound:"Content not found"},proto:{initInline:function(){t.types.push(M),x(l+"."+M,function(){B()})},getInline:function(n,i){if(B(),n.src){var o=t.st.inline,r=e(n.src);if(r.length){var a=r[0].parentNode;a&&a.tagName&&(O||(P=o.hiddenClass,O=k(P),P="mfp-"+P),z=r.after(O).detach().removeClass(P)),t.updateStatus("ready")}else t.updateStatus("error",o.tNotFound),r=e("<div>");return n.inlineElement=r,r}return t.updateStatus("ready"),t._parseMarkup(i,{},n),i}}});var F,H="ajax",L=function(){F&&i.removeClass(F)},A=function(){L(),t.req&&t.req.abort()};e.magnificPopup.registerModule(H,{options:{settings:null,cursor:"mfp-ajax-cur",tError:'<a href="%url%">The content</a> could not be loaded.'},proto:{initAjax:function(){t.types.push(H),F=t.st.ajax.cursor,x(l+"."+H,A),x("BeforeChange."+H,A)},getAjax:function(n){F&&i.addClass(F),t.updateStatus("loading");var o=e.extend({url:n.src,success:function(i,o,r){var a={data:i,xhr:r};T("ParseAjax",a),t.appendContent(e(a.data),H),n.finished=!0,L(),t._setFocus(),setTimeout(function(){t.wrap.addClass(v)},16),t.updateStatus("ready"),T("AjaxContentAdded")},error:function(){L(),n.finished=n.loadError=!0,t.updateStatus("error",t.st.ajax.tError.replace("%url%",n.src))}},t.st.ajax.settings);return t.req=e.ajax(o),""}}});var j,N=function(n){if(n.data&&void 0!==n.data.title)return n.data.title;
2472var i=t.st.image.titleSrc;if(i){if(e.isFunction(i))return i.call(t,n);if(n.el)return n.el.attr(i)||""}return""};e.magnificPopup.registerModule("image",{options:{markup:'<div class="mfp-figure"><div class="mfp-close"></div><figure><div class="mfp-img"></div><figcaption><div class="mfp-bottom-bar"><div class="mfp-title"></div><div class="mfp-counter"></div></div></figcaption></figure></div>',cursor:"mfp-zoom-out-cur",titleSrc:"title",verticalFit:!0,tError:'<a href="%url%">The image</a> could not be loaded.'},proto:{initImage:function(){var e=t.st.image,n=".image";t.types.push("image"),x(f+n,function(){"image"===t.currItem.type&&e.cursor&&i.addClass(e.cursor)}),x(l+n,function(){e.cursor&&i.removeClass(e.cursor),I.off("resize"+h)}),x("Resize"+n,t.resizeImage),t.isLowIE&&x("AfterChange",t.resizeImage)},resizeImage:function(){var e=t.currItem;if(e&&e.img&&t.st.image.verticalFit){var n=0;t.isLowIE&&(n=parseInt(e.img.css("padding-top"),10)+parseInt(e.img.css("padding-bottom"),10)),e.img.css("max-height",t.wH-n)}},_onImageHasSize:function(e){e.img&&(e.hasSize=!0,j&&clearInterval(j),e.isCheckingImgSize=!1,T("ImageHasSize",e),e.imgHidden&&(t.content&&t.content.removeClass("mfp-loading"),e.imgHidden=!1))},findImageSize:function(e){var n=0,i=e.img[0],o=function(r){j&&clearInterval(j),j=setInterval(function(){return i.naturalWidth>0?(t._onImageHasSize(e),void 0):(n>200&&clearInterval(j),n++,3===n?o(10):40===n?o(50):100===n&&o(500),void 0)},r)};o(1)},getImage:function(n,i){var o=0,r=function(){n&&(n.img[0].complete?(n.img.off(".mfploader"),n===t.currItem&&(t._onImageHasSize(n),t.updateStatus("ready")),n.hasSize=!0,n.loaded=!0,T("ImageLoadComplete")):(o++,200>o?setTimeout(r,100):a()))},a=function(){n&&(n.img.off(".mfploader"),n===t.currItem&&(t._onImageHasSize(n),t.updateStatus("error",s.tError.replace("%url%",n.src))),n.hasSize=!0,n.loaded=!0,n.loadError=!0)},s=t.st.image,l=i.find(".mfp-img");if(l.length){var c=document.createElement("img");c.className="mfp-img",n.img=e(c).on("load.mfploader",r).on("error.mfploader",a),c.src=n.src,l.is("img")&&(n.img=n.img.clone()),c=n.img[0],c.naturalWidth>0?n.hasSize=!0:c.width||(n.hasSize=!1)}return t._parseMarkup(i,{title:N(n),img_replaceWith:n.img},n),t.resizeImage(),n.hasSize?(j&&clearInterval(j),n.loadError?(i.addClass("mfp-loading"),t.updateStatus("error",s.tError.replace("%url%",n.src))):(i.removeClass("mfp-loading"),t.updateStatus("ready")),i):(t.updateStatus("loading"),n.loading=!0,n.hasSize||(n.imgHidden=!0,i.addClass("mfp-loading"),t.findImageSize(n)),i)}}});var W,R=function(){return void 0===W&&(W=void 0!==document.createElement("p").style.MozTransform),W};e.magnificPopup.registerModule("zoom",{options:{enabled:!1,easing:"ease-in-out",duration:300,opener:function(e){return e.is("img")?e:e.find("img")}},proto:{initZoom:function(){var e,n=t.st.zoom,i=".zoom";if(n.enabled&&t.supportsTransition){var o,r,a=n.duration,s=function(e){var t=e.clone().removeAttr("style").removeAttr("class").addClass("mfp-animated-image"),i="all "+n.duration/1e3+"s "+n.easing,o={position:"fixed",zIndex:9999,left:0,top:0,"-webkit-backface-visibility":"hidden"},r="transition";return o["-webkit-"+r]=o["-moz-"+r]=o["-o-"+r]=o[r]=i,t.css(o),t},d=function(){t.content.css("visibility","visible")};x("BuildControls"+i,function(){if(t._allowZoom()){if(clearTimeout(o),t.content.css("visibility","hidden"),e=t._getItemToZoom(),!e)return d(),void 0;r=s(e),r.css(t._getOffset()),t.wrap.append(r),o=setTimeout(function(){r.css(t._getOffset(!0)),o=setTimeout(function(){d(),setTimeout(function(){r.remove(),e=r=null,T("ZoomAnimationEnded")},16)},a)},16)}}),x(c+i,function(){if(t._allowZoom()){if(clearTimeout(o),t.st.removalDelay=a,!e){if(e=t._getItemToZoom(),!e)return;r=s(e)}r.css(t._getOffset(!0)),t.wrap.append(r),t.content.css("visibility","hidden"),setTimeout(function(){r.css(t._getOffset())},16)}}),x(l+i,function(){t._allowZoom()&&(d(),r&&r.remove(),e=null)})}},_allowZoom:function(){return"image"===t.currItem.type},_getItemToZoom:function(){return t.currItem.hasSize?t.currItem.img:!1},_getOffset:function(n){var i;i=n?t.currItem.img:t.st.zoom.opener(t.currItem.el||t.currItem);var o=i.offset(),r=parseInt(i.css("padding-top"),10),a=parseInt(i.css("padding-bottom"),10);o.top-=e(window).scrollTop()-r;var s={width:i.width(),height:(b?i.innerHeight():i[0].offsetHeight)-a-r};return R()?s["-moz-transform"]=s.transform="translate("+o.left+"px,"+o.top+"px)":(s.left=o.left,s.top=o.top),s}}});var Z="iframe",q="//about:blank",D=function(e){if(t.currTemplate[Z]){var n=t.currTemplate[Z].find("iframe");n.length&&(e||(n[0].src=q),t.isIE8&&n.css("display",e?"block":"none"))}};e.magnificPopup.registerModule(Z,{options:{markup:'<div class="mfp-iframe-scaler"><div class="mfp-close"></div><iframe class="mfp-iframe" src="//about:blank" frameborder="0" allowfullscreen></iframe></div>',srcAction:"iframe_src",patterns:{youtube:{index:"youtube.com",id:"v=",src:"//www.youtube.com/embed/%id%?autoplay=1"},vimeo:{index:"vimeo.com/",id:"/",src:"//player.vimeo.com/video/%id%?autoplay=1"},gmaps:{index:"//maps.google.",src:"%id%&output=embed"}}},proto:{initIframe:function(){t.types.push(Z),x("BeforeChange",function(e,t,n){t!==n&&(t===Z?D():n===Z&&D(!0))}),x(l+"."+Z,function(){D()})},getIframe:function(n,i){var o=n.src,r=t.st.iframe;e.each(r.patterns,function(){return o.indexOf(this.index)>-1?(this.id&&(o="string"==typeof this.id?o.substr(o.lastIndexOf(this.id
2472)+this.id.length,o.length):this.id.call(this,o)),o=this.src.replace("%id%",o),!1):void 0});var a={};return r.srcAction&&(a[r.srcAction]=o),t._parseMarkup(i,a,n),t.updateStatus("ready"),i}}});var K=function(e){var n=t.items.length;return e>n-1?e-n:0>e?n+e:e},Y=function(e,t,n){return e.replace(/%curr%/gi,t+1).replace(/%total%/gi,n)};e.magnificPopup.registerModule("gallery",{options:{enabled:!1,arrowMarkup:'<button title="%title%" type="button" class="mfp-arrow mfp-arrow-%dir%"></button>',preload:[0,2],navigateByImgClick:!0,arrows:!0,tPrev:"Previous (Left arrow key)",tNext:"Next (Right arrow key)",tCounter:"%curr% of %total%"},proto:{initGallery:function(){var n=t.st.gallery,i=".mfp-gallery",r=Boolean(e.fn.mfpFastClick);return t.direction=!0,n&&n.enabled?(a+=" mfp-gallery",x(f+i,function(){n.navigateByImgClick&&t.wrap.on("click"+i,".mfp-img",function(){return t.items.length>1?(t.next(),!1):void 0}),o.on("keydown"+i,function(e){37===e.keyCode?t.prev():39===e.keyCode&&t.next()})}),x("UpdateStatus"+i,function(e,n){n.text&&(n.text=Y(n.text,t.currItem.index,t.items.length))}),x(p+i,function(e,i,o,r){var a=t.items.length;o.counter=a>1?Y(n.tCounter,r.index,a):""}),x("BuildControls"+i,function(){if(t.items.length>1&&n.arrows&&!t.arrowLeft){var i=n.arrowMarkup,o=t.arrowLeft=e(i.replace(/%title%/gi,n.tPrev).replace(/%dir%/gi,"left")).addClass(y),a=t.arrowRight=e(i.replace(/%title%/gi,n.tNext).replace(/%dir%/gi,"right")).addClass(y),s=r?"mfpFastClick":"click";o[s](function(){t.prev()}),a[s](function(){t.next()}),t.isIE7&&(k("b",o[0],!1,!0),k("a",o[0],!1,!0),k("b",a[0],!1,!0),k("a",a[0],!1,!0)),t.container.append(o.add(a))}}),x(m+i,function(){t._preloadTimeout&&clearTimeout(t._preloadTimeout),t._preloadTimeout=setTimeout(function(){t.preloadNearbyImages(),t._preloadTimeout=null},16)}),x(l+i,function(){o.off(i),t.wrap.off("click"+i),t.arrowLeft&&r&&t.arrowLeft.add(t.arrowRight).destroyMfpFastClick(),t.arrowRight=t.arrowLeft=null}),void 0):!1},next:function(){t.direction=!0,t.index=K(t.index+1),t.updateItemHTML()},prev:function(){t.direction=!1,t.index=K(t.index-1),t.updateItemHTML()},goTo:function(e){t.direction=e>=t.index,t.index=e,t.updateItemHTML()},preloadNearbyImages:function(){var e,n=t.st.gallery.preload,i=Math.min(n[0],t.items.length),o=Math.min(n[1],t.items.length);for(e=1;(t.direction?o:i)>=e;e++)t._preloadItem(t.index+e);for(e=1;(t.direction?i:o)>=e;e++)t._preloadItem(t.index-e)},_preloadItem:function(n){if(n=K(n),!t.items[n].preloaded){var i=t.items[n];i.parsed||(i=t.parseEl(n)),T("LazyLoad",i),"image"===i.type&&(i.img=e('<img class="mfp-img" />').on("load.mfploader",function(){i.hasSize=!0}).on("error.mfploader",function(){i.hasSize=!0,i.loadError=!0,T("LazyLoadError",i)}).attr("src",i.src)),i.preloaded=!0}}}});var U="retina";e.magnificPopup.registerModule(U,{options:{replaceSrc:function(e){return e.src.replace(/\.\w+$/,function(e){return"@2x"+e})},ratio:1},proto:{initRetina:function(){if(window.devicePixelRatio>1){var e=t.st.retina,n=e.ratio;n=isNaN(n)?n():n,n>1&&(x("ImageHasSize."+U,function(e,t){t.img.css({"max-width":t.img[0].naturalWidth/n,width:"100%"})}),x("ElementParse."+U,function(t,i){i.src=e.replaceSrc(i,n)}))}}}}),function(){var t=1e3,n="ontouchstart"in window,i=function(){I.off("touchmove"+r+" touchend"+r)},o="mfpFastClick",r="."+o;e.fn.mfpFastClick=function(o){return e(this).each(function(){var a,s=e(this);if(n){var l,c,d,u,p,f;s.on("touchstart"+r,function(e){u=!1,f=1,p=e.originalEvent?e.originalEvent.touches[0]:e.touches[0],c=p.clientX,d=p.clientY,I.on("touchmove"+r,function(e){p=e.originalEvent?e.originalEvent.touches:e.touches,f=p.length,p=p[0],(Math.abs(p.clientX-c)>10||Math.abs(p.clientY-d)>10)&&(u=!0,i())}).on("touchend"+r,function(e){i(),u||f>1||(a=!0,e.preventDefault(),clearTimeout(l),l=setTimeout(function(){a=!1},t),o())})})}s.on("click"+r,function(){a||o()})})},e.fn.destroyMfpFastClick=function(){e(this).off("touchstart"+r+" click"+r),n&&I.off("touchmove"+r+" touchend"+r)}}(),_()})(window.jQuery||window.Zepto); 2473 2474 // ----------------------------------------------------------------------------
2475 // Vegas - Fullscreen Backgrounds and Slideshows with jQuery. 2476 // v1.3.5 - released 2014-10-13 19:56 2477 // Licensed under the MIT license. 2478 // http://vegas.jaysalvat.com/ 2479 // ---------------------------------------------------------------------------- 2480 // Copyright (C) 2010-2014 Jay Salvat 2481 // http://jaysalvat.com/ 2482 // ---------------------------------------------------------------------------- 2483 2484(function($) { 2485 var $background = $("<img />").addClass("vegas-background"), $overlay = $("<div />").addClass("vegas-overlay"), $loading = $("<div />").addClass("vegas-loading"), $current = $(), paused = null, backgrounds = [], step = 0, delay = 5e3, walk = function() {}, timer, methods = { 2486 init: function(settings) { 2487 var options = { 2488 src: getBackground(), 2489 align: "center", 2490 valign: "center", 2491 fade: 0, 2492 loading: true, 2493 load: function() {}, 2494 complete: function() {} 2495 }; 2496 $.extend(options, $.vegas.defaults.background, settings); 2497 if (options.loading) { 2498 loading(); 2499 } 2500 var $new = $background.clone(); 2501 $new.css({ 2502 position: "fixed", 2503 left: "0px", 2504 top: "0px" 2505 }).bind("load", function() { 2506 if ($new == $current) { 2507 return; 2508 } 2509 $(window).bind("load resize.vegas", function(e) { 2510 resize($new, options); 2511 }); 2512 if ($current.is("img")) { 2513 $current.stop(); 2514 $new.hide().insertAfter($current).fadeIn(options.fade, function() { 2515 $(".vegas-background").not(this).remove(); 2516 $("body").trigger("vegascomplete", [ this, step - 1 ]); 2517 options.complete.apply($new, [ step - 1 ]); 2518 }); 2519 } else { 2520 $new.hide().prependTo("body").fadeIn(options.fade, function() { 2521 $("body").trigger("vegascomplete", [ this, step - 1 ]); 2522 options.complete.apply(this, [ step - 1 ]); 2523 }); 2524 } 2525 $current = $new; 2526 resize($current, options); 2527 if (options.loading) { 2528 loaded(); 2529 } 2530 $("body").trigger("vegasload", [ $current.get(0), step - 1 ]); 2531 options.load.apply($current.get(0), [ step - 1 ]); 2532 if (step) { 2533 $("body").trigger("vegaswalk", [ $current.get(0), step - 1 ]); 2534 options.walk.apply($current.get(0), [ step - 1 ]); 2535 } 2536 }).attr("src", options.src); 2537 return $.vegas; 2538 }, 2539 destroy: function(what) { 2540 if (!what || what == "background") { 2541 $(".vegas-background, .vegas-loading").remove(); 2542 $(window).unbind("*.vegas"); 2543 $current = $(); 2544 } 2545 if (!what || what == "overlay") { 2546 $(".vegas-overlay").remove(); 2547 } 2548 clearInterval(timer); 2549 return $.vegas; 2550 }, 2551 overlay: function(settings) { 2552 var options = { 2553 src: null, 2554 opacity: null 2555 }; 2556 $.extend(options, $.vegas.defaults.overlay, settings); 2557 $overlay.remove(); 2558 $overlay.css({ 2559 margin: "0", 2560 padding: "0", 2561 position: "fixed", 2562 left: "0px", 2563 top: "0px", 2564 width: "100%", 2565 height: "100%" 2566 }); 2567 if (options.src === false) { 2568 $overlay.css("backgroundImage", "none"); 2569 } 2570 if (options.src) { 2571 $overlay.css("backgroundImage", "url(" + options.src + ")"); 2572 } 2573 if (options.opacity) { 2574 $overlay.css("opacity", options.opacity); 2575 } 2576 $overlay.prependTo("body"); 2577 return $.vegas; 2578 }, 2579 slideshow: function(settings, keepPause) { 2580 var options = { 2581 step: step, 2582 delay: delay, 2583 preload: false, 2584 loading: true, 2585 backgrounds: backgrounds, 2586 walk: walk 2587 }; 2588 $.extend(options, $.vegas.defaults.slideshow, settings); 2589 if (options.backgrounds != backgrounds) { 2590 if (!settings.step) { 2591 options.step = 0; 2592 } 2593 if (!settings.walk) { 2594 options.walk = function() {}; 2595 } 2596 if (options.preload) { 2597 $.vegas("preload", options.backgrounds); 2598 } 2599 } 2600 backgrounds = options.backgrounds;
2601 delay = options.delay; 2602 step = options.step; 2603 walk = options.walk; 2604 clearInterval(timer); 2605 if (!backgrounds.length) { 2606 return $.vegas; 2607 } 2608 var doSlideshow = function() { 2609 if (step < 0) { 2610 step = backgrounds.length - 1; 2611 } 2612 if (step >= backgrounds.length || !backgrounds[step - 1]) { 2613 step = 0; 2614 } 2615 var settings = backgrounds[step++]; 2616 settings.walk = options.walk; 2617 settings.loading = options.loading; 2618 if (typeof settings.fade == "undefined") { 2619 settings.fade = options.fade; 2620 } 2621 if (settings.fade > options.delay) { 2622 settings.fade = options.delay; 2623 } 2624 $.vegas(settings); 2625 }; 2626 doSlideshow(); 2627 if (!keepPause) { 2628 paused = false; 2629 $("body").trigger("vegasstart", [ $current.get(0), step - 1 ]); 2630 } 2631 if (!paused) { 2632 timer = setInterval(doSlideshow, options.delay); 2633 } 2634 return $.vegas; 2635 }, 2636 next: function() { 2637 var from = step; 2638 if (step) { 2639 $.vegas("slideshow", { 2640 step: step 2641 }, true); 2642 $("body").trigger("vegasnext", [ $current.get(0), step - 1, from - 1 ]); 2643 } 2644 return $.vegas; 2645 }, 2646 previous: function() { 2647 var from = step; 2648 if (step) { 2649 $.vegas("slideshow", { 2650 step: step - 2 2651 }, true); 2652 $("body").trigger("vegasprevious", [ $current.get(0), step - 1, from - 1 ]); 2653 } 2654 return $.vegas; 2655 }, 2656 jump: function(s) { 2657 var from = step; 2658 if (step) { 2659 $.vegas("slideshow", { 2660 step: s 2661 }, true); 2662 $("body").trigger("vegasjump", [ $current.get(0), step - 1, from - 1 ]); 2663 } 2664 return $.vegas; 2665 }, 2666 stop: function() { 2667 var from = step; 2668 step = 0; 2669 paused = null; 2670 clearInterval(timer); 2671 $("body").trigger("vegasstop", [ $current.get(0), from - 1 ]); 2672 return $.vegas; 2673 }, 2674 pause: function() { 2675 paused = true; 2676 clearInterval(timer); 2677 $("body").trigger("vegaspause", [ $current.get(0), step - 1 ]); 2678 return $.vegas; 2679 }, 2680 get: function(what) { 2681 if (what === null || what == "background") { 2682 return $current.get(0); 2683 } 2684 if (what == "overlay") { 2685 return $overlay.get(0); 2686 } 2687 if (what == "step") { 2688 return step - 1; 2689 } 2690 if (what == "paused") { 2691 return paused; 2692 } 2693 }, 2694 preload: function(backgrounds) { 2695 var cache = []; 2696 for (var i in backgrounds) { 2697 if (backgrounds[i].src) { 2698 var cacheImage = document.createElement("img"); 2699 cacheImage.src = backgrounds[i].src; 2700 cache.push(cacheImage); 2701 } 2702 } 2703 return $.vegas; 2704 } 2705 }; 2706 function resize($img, settings) { 2707 var options = { 2708 align: "center", 2709 valign: "center" 2710 }; 2711 $.extend(options, settings); 2712 if ($img.height() === 0) { 2713 $img.load(function() { 2714 resize($(this), settings); 2715 }); 2716 return; 2717 } 2718 var vp = getViewportSize(), ww = vp.width, wh = vp.height, iw = $img.width(), ih = $img.height(), rw = wh / ww, ri = ih / iw, newWidth, newHeight, newLeft, newTop, properties; 2719 if (rw > ri) { 2720 newWidth = wh / ri; 2721 newHeight = wh; 2722 } else { 2723 newWidth = ww; 2724 newHeight = ww * ri; 2725 } 2726 properties = { 2727 width: newWidth + "px", 2728 height: newHeight + "px", 2729 top: "auto", 2730 bottom: "auto", 2731 left: "auto", 2732 right: "auto" 2733 }; 2734 if (!isNaN(parseInt(options.valign, 10))) { 2735 properties.top = 0 - (newHeight - wh) / 100 * parseInt(options.valign, 10) + "px"; 2736 } else if (options.valign == "top") { 2737 properties.top = 0; 2738 } else if (options.valign == "bottom") { 2739 properties.bottom = 0; 2740 } else { 2741 properties.top = (wh - newHeight) / 2; 2742 } 2743 if (!isNaN(parseInt(options.align, 10))) { 2744 properties.left = 0 - (newWidth - ww) / 100 * parseInt(options.align, 10) + "px"; 2745 } else if (options.align == "left") { 2746 properties.left = 0; 2747 } else if (options.align == "right") { 2748 properties.right = 0; 2749 } else { 2750 properties.left = (ww - newWidth) / 2; 2751 } 2752 $img.css(properties); 2753 } 2754 function loading() { 2755 $loading.prependTo("body").fadeIn(); 2756 } 2757 function loaded() { 2758 $loading.fadeOut("fast", function() { 2759 $(this).remove(); 2760 }); 2761 }
2762 function getBackground() { 2763 if ($("body").css("backgroundImage")) { 2764 return $("body").css("backgroundImage").replace(/url\("?(.*?)"?\)/i, "$1"); 2765 } 2766 } 2767 function getViewportSize() { 2768 var elmt = window, prop = "inner"; 2769 if (!("innerWidth" in window)) { 2770 elmt = document.documentElement || document.body; 2771 prop = "client"; 2772 } 2773 return { 2774 width: elmt[prop + "Width"], 2775 height: elmt[prop + "Height"] 2776 }; 2777 } 2778 $.vegas = function(method) { 2779 if (methods[method]) { 2780 return methods[method].apply(this, Array.prototype.slice.call(arguments, 1)); 2781 } else if (typeof method === "object" || !method) { 2782 return methods.init.apply(this, arguments); 2783 } else { 2784 $.error("Method " + method + " does not exist"); 2785 } 2786 }; 2787 $.vegas.defaults = { 2788 background: {}, 2789 slideshow: {}, 2790 overlay: {} 2791 }; 2792})(jQuery); 2793 2794/* 2795 Vertical News Ticker 1.15 2796 2797 Original by: Tadas Juozapaitis ( kasp3rito [eta] gmail (dot) com ) 2798 http://www.jugbit.com/jquery-vticker-vertical-news-ticker/ 2799 2800 Forked/Modified by: Richard Hollis @richhollis - richhollis.co.uk 2801*/ 2802 2803(function($){ 2804 var defaults = { 2805 speed: 700, 2806 pause: 4000, 2807 showItems: 1, 2808 mousePause: true, 2809 height: 0, 2810 animate: true, 2811 margin: 0, 2812 padding: 0, 2813 startPaused: false 2814 }; 2815 2816 var internal = { 2817 2818 moveUp: function(state, attribs) { 2819 internal.animate(state, attribs, 'up'); 2820 }, 2821 2822 moveDown: function(state, attribs){ 2823 internal.animate(state, attribs, 'down'); 2824 }, 2825 2826 animate: function(state, attribs, dir) { 2827 var height = state.itemHeight; 2828 var options = state.options; 2829 var el = state.element; 2830 var obj = el.children('ul'); 2831 var selector = (dir === 'up') ? 'li:first' : 'li:last'; 2832 2833 el.trigger("vticker.beforeTick"); 2834 2835 var clone = obj.children(selector).clone(true); 2836 2837 if(options.height > 0) height = obj.children('li:first').height(); 2838 height += (options.margin) + (options.padding*2); // adjust for margins & padding 2839 2840 if(dir==='down') obj.css('top', '-' + height + 'px').prepend(clone); 2841 2842 if(attribs && attribs.animate) { 2843 if(state.animating) return; 2844 state.animating = true; 2845 var opts = (dir === 'up') ? {top: '-=' + height + 'px'} : {top: 0}; 2846 obj.animate(opts, options.speed, function() { 2847 $(obj).children(selector).remove(); 2848 $(obj).css('top', '0px'); 2849 state.animating = false; 2850 el.trigger("vticker.afterTick"); 2851 }); 2852 } else { 2853 obj.children(selector).remove(); 2854 obj.css('top', '0px'); 2855 el.trigger("vticker.afterTick"); 2856 } 2857 if(dir==='up') clone.appendTo(obj); 2858 }, 2859 2860 nextUsePause: function() { 2861 var state = $(this).data('state'); 2862 var options = state.options; 2863 if(state.isPaused || state.itemCount < 2) return; 2864 methods.next.call( this, {animate:options.animate} ); 2865 }, 2866 2867 startInterval: function() { 2868 var state = $(this).data('state'); 2869 var options = state.options; 2870 var initThis = this; 2871 state.intervalId = setInterval(function(){ 2872 internal.nextUsePause.call( initThis ); 2873 }, options.pause); 2874 }, 2875 2876 stopInterval: function() { 2877 var state = $(this).data('state'); 2878 if(!state) return; 2879 if(state.intervalId) clearInterval(state.intervalId); 2880 state.intervalId = undefined; 2881 }, 2882 2883 restartInterval: function() { 2884 internal.stopInterval.call(this); 2885 internal.startInterval.call(this); 2886 } 2887 }; 2888 2889 var methods = { 2890 2891 init: function(options) { 2892 // if init called second time then stop first, then re-init 2893 methods.stop.call(this); 2894 // init 2895 var defaultsClone = jQuery.extend({}, defaults); 2896 var options = $.extend(defaultsClone, options); 2897 var el = $(this); 2898 var state = { 2899 itemCount: el.children('ul').children('li').length, 2900 itemHeight: 0, 2901 itemMargin: 0, 2902 element: el, 2903 animating: false, 2904 options: options, 2905 isPaused: (options.startPaused) ? true : false, 2906 pausedByCode: false 2907 }; 2908 $(this).data('state', state); 2909 2910 el.css({overflow: 'hidden', position: 'relative'}) 2911 .children('ul').css({position: 'absolute', margin: 0, padding: 0}) 2912 .children('li').css({margin: options.margin, padding: options.padding}); 2913 2914 if(isNaN(options.height) || options.height === 0) 2915 { 2916 el.children('ul').children('li').each(function(){ 2917 var current = $(this); 2918 if(current.height() > state.itemHeight) 2919 state.itemHeight = current.height(); 2920 }); 2921 // set the same height on all child elements 2922 el.children('ul').children('li').each(function(){ 2923 var current = $(this); 2924 current.height(state.itemHeight); 2925 }); 2926 // set element to total height 2927 var box = (options.margin) + (options.padding * 2); 2928 el.height(((state.itemHeight + box) * options.showItems) + options.margin); 2929 } 2930 else 2931 { 2932 // set the preferred height 2933 el.height(options.height); 2934 } 2935 2936 var initThis = this; 2937 if(!options.startPaused) { 2938 internal.startInterval.call( initThis ); 2939 } 2940 2941 if(options.mousePause) 2942 { 2943 el.bind("mouseenter", function () { 2944 //if the automatic scroll is paused, don't change that.
2945 if (state.isPaused === true) return; 2946 state.pausedByCode = true; 2947 // stop interval 2948 internal.stopInterval.call( initThis ); 2949 methods.pause.call( initThis, true ); 2950 }).bind("mouseleave", function () { 2951 //if the automatic scroll is paused, don't change that. 2952 if (state.isPaused === true && !state.pausedByCode) return; 2953 state.pausedByCode = false; 2954 methods.pause.call(initThis, false); 2955 // restart interval 2956 internal.startInterval.call( initThis ); 2957 }); 2958 } 2959 }, 2960 2961 pause: function(pauseState) { 2962 var state = $(this).data('state'); 2963 if(!state) return undefined; 2964 if(state.itemCount < 2) return false; 2965 state.isPaused = pauseState; 2966 var el = state.element; 2967 if(pauseState) { 2968 $(this).addClass('paused'); 2969 el.trigger("vticker.pause"); 2970 } 2971 else { 2972 $(this).removeClass('paused'); 2973 el.trigger("vticker.resume"); 2974 } 2975 }, 2976 2977 next: function(attribs) { 2978 var state = $(this).data('state'); 2979 if(!state) return undefined; 2980 if(state.animating || state.itemCount < 2) return false; 2981 internal.restartInterval.call( this ); 2982 internal.moveUp(state, attribs); 2983 }, 2984 2985 prev: function(attribs) { 2986 var state = $(this).data('state'); 2987 if(!state) return undefined; 2988 if(state.animating || state.itemCount < 2) return false; 2989 internal.restartInterval.call( this ); 2990 internal.moveDown(state, attribs); 2991 }, 2992 2993 stop: function() { 2994 var state = $(this).data('state'); 2995 if(!state) return undefined; 2996 internal.stopInterval.call( this ); 2997 }, 2998 2999 remove: function() { 3000 var state = $(this).data('state'); 3001 if(!state) return undefined; 3002 internal.stopInterval.call( this ); 3003 var el = state.element; 3004 el.unbind(); 3005 el.remove(); 3006 } 3007 }; 3008 3009 $.fn.vTicker = function( method ) { 3010 if ( methods[method] ) { 3011 return methods[method].apply( this, Array.prototype.slice.call( arguments, 1 )); 3012 } else if ( typeof method === 'object' || ! method ) { 3013 return methods.init.apply( this, arguments ); 3014 } else { 3015 $.error( 'Method ' + method + ' does not exist on jQuery.vTicker' ); 3016 } 3017 }; 3018})(jQuery); 3019 3020/*! 3021 * Theia Sticky Sidebar v1.2.2 3022 * https://github.com/WeCodePixels/theia-sticky-sidebar 3023 * 3024 * Glues your website's sidebars, making them permanently visible while scrolling. 3025 * 3026 * Copyright 2013-2014 WeCodePixels and other contributors 3027 * Released under the MIT license 3028 */ 3029 3030(function($) { 3031 $.fn.theiaStickySidebar = function(options) { 3032 var defaults = { 3033 'containerSelector': '', 3034 'additionalMarginTop': 0, 3035 'additionalMarginBottom': 0, 3036 'updateSidebarHeight': true, 3037 'minWidth': 0 3038 }; 3039 options = $.extend(defaults, options); 3040 3041 // Validate options 3042 options.additionalMarginTop = parseInt(options.additionalMarginTop) || 0; 3043 options.additionalMarginBottom = parseInt(options.additionalMarginBottom) || 0; 3044 3045 // Add CSS 3046 //$('head').append($('<style>.theiaStickySidebar:after {content: ""; display: table; clear: both;}</style>')); 3047 3048 this.each(function() { 3049 var o = {}; 3050 o.sidebar = $(this); 3051 3052 // Save options 3053 o.options = options || {}; 3054 3055 // Get container 3056 o.container = $(o.options.containerSelector); 3057 if (o.container.size() == 0) { 3058 o.container = o.sidebar.parent(); 3059 } 3060 3061 // Create sticky sidebar 3062 o.sidebar.parents().css('-webkit-transform', 'none'); // Fix for WebKit bug - https://code.google.com/p/chromium/issues/detail?id=20574 3063 o.sidebar.css({ 3064 'position': 'relative', 3065 'overflow': 'visible', 3066 // The "box-sizing" must be set to "content-box" because we set a fixed height to this element when the sticky
3066sidebar has a fixed position. 3067 '-webkit-box-sizing': 'border-box', 3068 '-moz-box-sizing': 'border-box', 3069 'box-sizing': 'border-box' 3070 }); 3071 3072 // Get the sticky sidebar element. If none has been found, then create one. 3073 o.stickySidebar = o.sidebar.find('.theiaStickySidebar'); 3074 if (o.stickySidebar.length == 0) { 3075 o.sidebar.find('script').remove(); // Remove <script> tags, otherwise they will be run again on the next line. 3076 o.stickySidebar = $('<div>').addClass('theiaStickySidebar').append(o.sidebar.children()); 3077 o.sidebar.append(o.stickySidebar); 3078 } 3079 3080 // Get existing top and bottom margins and paddings 3081 o.marginTop = parseInt(o.sidebar.css('margin-top')); 3082 o.marginBottom = parseInt(o.sidebar.css('margin-bottom')); 3083 o.paddingTop = parseInt(o.sidebar.css('padding-top')); 3084 o.paddingBottom = parseInt(o.sidebar.css('padding-bottom')); 3085 3086 // Add a temporary padding rule to check for collapsable margins. 3087 var collapsedTopHeight = o.stickySidebar.offset().top; 3088 var collapsedBottomHeight = o.stickySidebar.outerHeight(); 3089 o.stickySidebar.css('padding-top', 1); 3090 o.stickySidebar.css('padding-bottom', 1); 3091 collapsedTopHeight -= o.stickySidebar.offset().top; 3092 collapsedBottomHeight = o.stickySidebar.outerHeight() - collapsedBottomHeight - collapsedTopHeight; 3093 if (collapsedTopHeight == 0) { 3094 o.stickySidebar.css('padding-top', 0); 3095 o.stickySidebarPaddingTop = 0; 3096 } 3097 else { 3098 o.stickySidebarPaddingTop = 1; 3099 } 3100 3101 if (collapsedBottomHeight == 0) { 3102 o.stickySidebar.css('padding-bottom', 0); 3103 o.stickySidebarPaddingBottom = 0; 3104 } 3105 else { 3106 o.stickySidebarPaddingBottom = 1; 3107 } 3108 3109 // We use this to know whether the user is scrolling up or down. 3110 o.previousScrollTop = null; 3111 3112 // Scroll top (value) when the sidebar has fixed position. 3113 o.fixedScrollTop = 0; 3114 3115 // Set sidebar to default values. 3116 resetSidebar(); 3117 3118 o.onScroll = function(o) { 3119 // Stop if the sidebar isn't visible. 3120 if (!o.stickySidebar.is(":visible")) { 3121 return; 3122 } 3123 3124 // Stop if the window is too small. 3125 if ($('body').width() < o.options.minWidth) { 3126 resetSidebar(); 3127 return; 3128 } 3129 3130 // Stop if the sidebar width is larger than the container width (e.g. the theme is responsive and the sidebar is now below the content) 3131 if (o.sidebar.outerWidth(true) + 50 > o.container.width()) { 3132 resetSidebar(); 3133 return; 3134 } 3135 3136 var scrollTop = $(document).scrollTop(); 3137 3138 var position = 'static'; 3139 3140 // If the user has scrolled down enough for the sidebar to be clipped at the top, then we can consider changing its position. 3141 if (scrollTop >= o.container.offset().top + (o.paddingTop + o.marginTop - o.options.additionalMarginTop)) { 3142 // The top and bottom offsets, used in various calculations. 3143 var offsetTop = o.paddingTop + o.marginTop + options.additionalMarginTop; 3144 3145 var offsetBottom = o.paddingBottom + o.marginBottom + options.additionalMarginBottom; 3146 3147 // All top and bottom positions are relative to the window, not to the parent elemnts. 3148 var containerTop = o.container.offset().top + 270; 3149 var containerBottom = o.container.offset().top + getClearedHeight(o.container); 3150 3151 // The top and bottom offsets relative to the window screen top (zero) and bottom (window height). 3152 var windowOffsetTop = 0 + options.additionalMarginTop; 3153 var windowOffsetBottom; 3154 3155 var sidebarSmallerThanWindow = (o.stickySidebar.outerHeight() + offsetTop + offsetBottom) < $(window).height(); 3156 if (sidebarSmallerThanWindow) { 3157 windowOffsetBottom = windowOffsetTop + o.stickySidebar.outerHeight(); 3158 } 3159 else { 3160 windowOffsetBottom = $(window).height() - o.marginBottom - o.paddingBottom - options.additionalMarginBottom; 3161 } 3162 3163 var staticLimitTop = containerTop - scrollTop + o.paddingTop + o.marginTop; 3164 var staticLimitBottom = containerBottom - scrollTop - o.paddingBottom - o.marginBottom; 3165 3166 var top = o.stickySidebar.offset().top - scrollTop; 3167 var scrollTopDiff = o.previousScrollTop - scrollTop; 3168 3169 // If the sidebar position is fixed, then it won't move up or down by itself. So, we manually adjust the top coordinate. 3170 if (o.stickySidebar.css('position') == 'fixed') { 3171 top += scrollTopDiff; 3172 } 3173 3174 if (scrollTopDiff > 0) { // If the user is scrolling up. 3175 top = Math.min(top, windowOffsetTop); 3176 } 3177 else { // If the user is scrolling down. 3178 top = Math.max(top, windowOffsetBottom - o.stickySidebar.outerHeight()); 3179 } 3180 3181 top = Math.max(top, staticLimitTop); 3182 3183 top = Math.min(top, staticLimitBottom - o.stickySidebar.outerHeight()); 3184 3185 // If the sidebar is the same height as the container, we won't use fixed positioning. 3186 var sidebarSameHeightAsContainer = o.container.height() == o.stickySidebar.outerHeight(); 3187 3188 if (!sidebarSameHeightAsContainer && top == windowOffsetTop) { 3189 position = 'fixed'; 3190 } 3191 else if (!sidebarSameHeightAsContainer && top == windowOffsetBottom - o.stickySidebar.outerHeight()) { 3192 position = 'fixed'; 3193 } 3194 else if (scrollTop + top - o.sidebar.offset().top - o.paddingTop <= options.additionalMarginTop) { 3195 position = 'static'; 3196 } 3197 else { 3198 position = 'absolute'; 3199 } 3200 } 3201 3202 /*
3203 * Performance notice: It's OK to set these CSS values at each resize/scroll, even if they don't change. 3204 * It's way slower to first check if the values have changed. 3205 */ 3206 if (position == 'fixed') { 3207 o.stickySidebar.css({ 3208 'position': 'fixed', 3209 'width': o.sidebar.width(), 3210 'top': top, 3211 'left': o.sidebar.offset().left + parseInt(o.sidebar.css('padding-left')) 3212 }); 3213 } 3214 else if (position == 'absolute') { 3215 var css = {}; 3216 3217 if (o.stickySidebar.css('position') != 'absolute') { 3218 css.position = 'absolute'; 3219 css.top = scrollTop + top - o.sidebar.offset().top - o.stickySidebarPaddingTop - o.stickySidebarPaddingBottom; 3220 } 3221 3222 css.width = o.sidebar.width(); 3223 css.left = ''; 3224 3225 o.stickySidebar.css(css); 3226 } 3227 else if (position == 'static') { 3228 resetSidebar(); 3229 } 3230 3231 if (position != 'static') { 3232 if (o.options.updateSidebarHeight == true) { 3233 o.sidebar.css({ 3234 'min-height': o.stickySidebar.outerHeight() + o.stickySidebar.offset().top - o.sidebar.offset().top + o.paddingBottom 3235 }); 3236 } 3237 } 3238 3239 o.previousScrollTop = scrollTop; 3240 }; 3241 3242 // Initialize the sidebar's position. 3243 o.onScroll(o); 3244 3245 // Recalculate the sidebar's position on every scroll and resize. 3246 $(document).scroll(function(o) { 3247 return function() { 3248 o.onScroll(o); 3249 }; 3250 }(o)); 3251 $(window).resize(function(o) { 3252 return function() { 3253 o.stickySidebar.css({'position': 'static'}); 3254 o.onScroll(o); 3255 }; 3256 }(o)); 3257 3258 // Reset the sidebar to its default state 3259 function resetSidebar() { 3260 o.fixedScrollTop = 0; 3261 o.sidebar.css({ 3262 'min-height': '1px' 3263 }); 3264 o.stickySidebar.css({ 3265 'position': 'static', 3266 'width': '' 3267 }); 3268 } 3269 3270 // Get the height of a div as if its floated children were cleared. Note that this function fails if the floats are more than one level deep. 3271 function getClearedHeight(e) { 3272 var height = e.height(); 3273 3274 e.children().each(function() { 3275 height = Math.max(height, $(this).height()); 3276 }); 3277 3278 return height; 3279 } 3280 }); 3281 } 3282})(jQuery); 3283 3284 3285(function( $ ) { 3286 3287 $.fn.offcanvas = function( options ) { 3288 3289 // Default settings 3290 var settings = $.extend({ 3291 hasSidebarLeft : true, 3292 hasSidebarRight : false, 3293 animated : true, 3294 oldPhones : true, 3295 enableTouch : true, 3296 enableKeys : true 3297 }, options); 3298 3299 // Default element names 3300 var sections = $.extend({ 3301 sidebarLeft : '#sidebarLeft', 3302 sidebarRight : '#sidebarRight', 3303 mainPage : '#page', 3304 leftBurger : '#leftBurger', 3305 rightBurger : '#rightBurger' 3306 }, options); 3307 3308 return this.each( function() { 3309 3310 // Add offcanvas class for setting layout specific css 3311 $(this).addClass('offcanvas'); 3312 3313 $.each(sections, function(index, element) { 3314 // Add animation class if option is enabled 3315 if ( settings.animated ) { 3316 $(element).addClass('animatedSlide'); 3317 } 3318 }); 3319 3320 // Add overthrow polyfill if option is enabled 3321 if ( settings.oldPhones ) { 3322 $('.scrollableArea').addClass('overthrow'); 3323 } 3324 3325 var slidRight = 0; 3326 var slidLeft = 0; 3327 3328 var timeout = setTimeout(function(sidebar) { 3329 $(sidebar).removeClass('show'); 3330 }, 400); 3331 3332 // Function that performs the sliding by adding classes to the relavent elements 3333 function slide( direction, settings ) { 3334 switch (direction) { 3335 case'right': 3336 $(sections.sidebarRight).removeClass('show'); 3337 $(sections.mainPage).addClass('slidRight'); 3338 $(sections.sidebarLeft).addClass('slidRight show'); 3339 $(sections.leftBurger).addClass('pressed'); 3340 3341 slidRight = 1; 3342 break; 3343 3344 case 'left': 3345 $(sections.sidebarLeft).removeClass('show'); 3346 $(sections.mainPage).addClass('slidLeft'); 3347 $(sections.sidebarRight).addClass('slidLeft show'); 3348 $(sections.rightBurger).addClass('pressed'); 3349 3350 slidLeft = 1; 3351 break; 3352 3353 case 'shutLeft': 3354 $(sections.leftBurger).removeClass('pressed'); 3355 $(sections.mainPage).removeClass('slidRight'); 3356 $(sections.sidebarLeft).removeClass('slidRight'); 3357 3358 var timeout = setTimeout(function() { 3359 $(sections.sidebarLeft).removeClass('show'); 3360 }, 300); 3361 clearTimeout(timeout); 3362 3363 slidRight = 0; 3364 break; 3365 3366 case 'shutRight': 3367 $(sections.rightBurger).removeClass('pressed'); 3368 $(sections.mainPage).removeClass('slidLeft'); 3369 $(sections.sidebarRight).removeClass('slidLeft'); 3370 3371 var timeout = setTimeout(function() { 3372 $(sections.sidebarRight).removeClass('show'); 3373 }, 300); 3374 clearTimeout(timeout); 3375 3376 slidLeft = 0; 3377 break; 3378 } 3379 } 3380 3381 if (settings.hasSidebarLeft) { 3382 $('.slideRight').on('click', function(event) { 3383 if (!slidRight) { 3384 slide('right'); 3385 } else { 3386 slide('shutLeft'); 3387 } 3388 3389 return false;
3390 }); 3391 } 3392 if (settings.hasSidebarRight) { 3393 $('.slideLeft').on('click', function(event) { 3394 if (!slidLeft) { 3395 slide('left'); 3396 } else { 3397 slide('shutRight'); 3398 } 3399 3400 return false; 3401 }); 3402 } 3403 if (settings.hasSidebarLeft) { 3404 $('.shutLeft').on('click', function(event) { 3405 slide('shutLeft'); 3406 3407 return false; 3408 }); 3409 } 3410 if (settings.hasSidebarRight) { 3411 $('.shutRight').on('click', function(event) { 3412 slide('shutRight'); 3413 3414 return false; 3415 }); 3416 } 3417 3418 if (settings.enableKeys) { 3419 $(this).keydown(function(e) { 3420 if (e.keyCode === 39) { 3421 if (!slidRight && !slidLeft && settings.hasSidebarLeft) { 3422 slide('right'); 3423 } else { 3424 slide('shutRight'); 3425 } 3426 3427 return false; 3428 } 3429 3430 if (e.keyCode === 37) { 3431 if (!slidRight && !slidLeft && settings.hasSidebarRight) { 3432 slide('left'); 3433 } else { 3434 slide('shutLeft'); 3435 } 3436 3437 return false; 3438 } 3439 }); 3440 } 3441 3442 if (settings.enableTouch) { 3443 $(this).hammer({drag:false, prevent_default:false, css_hacks:false}).on('swipe', function (event) { 3444 if (event.direction === 'right') { 3445 if (!slidRight && !slidLeft && settings.hasSidebarLeft) { 3446 slide('right'); 3447 } else { 3448 slide('shutRight'); 3449 } 3450 3451 return false; 3452 } else if (event.direction === 'left') { 3453 if (!slidRight && !slidLeft && settings.hasSidebarRight) { 3454 slide('left'); 3455 } else { 3456 slide('shutLeft'); 3457 } 3458 3459 return false; 3460 } 3461 }); 3462 } 3463 3464 }); 3465 3466 }; 3467 3468})( jQuery );
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.