vendor: 4,101 bytes, lines 1-94
1// ============================= 2// = PAGELINES DEFINED HELPERS = 3// ============================= 4 5function plIsset( variable ){ 6 if(typeof(variable) != "undefined" && variable !== null) 7 return true 8 else 9 return false 10} 11 12function plPrint(variable){ 13 if( plIsset(jQuery.pl) && plIsset(jQuery.pl.config) && true == jQuery.pl.config.devMode ) 14 console.log( variable ) 15} 16 17 18// ===================== 19// = Parallax Handling = 20// ===================== 21 22/* jQuery.enllax.js - v1.1.0 | copyright 2015, MMK Jony | https://github.com/mmkjony/enllax.js | released under the MIT license */ 23//!function(t){"use strict";t.fn.enllax=function(r){var a=t(window).height(),n=t(document).height(),o=t.extend({ratio:.5,type:"background",direction:"vertical"},r),e=t("[data-enllax-ratio]");e.each(function(){var r,e,s,i=t(this),c=i.offset().top,l=i.outerHeight(),p=i.data("enllax-ratio"),d=i.data("enllax-type"),x=i.data("enllax-direction");r=p?p:o.ratio,e=d?d:o.type,s=x?x:o.direction;var f=Math.round(c*r),u=Math.round((c-a/2+l)*r);"background"==e?"vertical"==s?i.css({"background-position":"center "+-f+"px"}):"horizontal"==s&&i.css({"background-position":-f+"px center"}):"foreground"==e&&("vertical"==s?i.css({"-webkit-transform":"translateY("+u+"px)","-moz-transform":"translateY("+u+"px)",transform:"translateY("+u+"px)"}):"horizontal"==s&&i.css({"-webkit-transform":"translateX("+u+"px)","-moz-transform":"translateX("+u+"px)",transform:"translateX("+u+"px)"})),t(window).on("scroll",function(){var o=t(this).scrollTop();f=Math.round((c-o)*r),u=Math.round((c-a/2+l-o)*r),"background"==e?"vertical"==s?i.css({"background-position":"center "+-f+"px"}):"horizontal"==s&&i.css({"background-position":-f+"px center"}):"foreground"==e&&n>o&&("vertical"==s?i.css({"-webkit-transform":"translateY("+u+"px)","-moz-transform":"translateY("+u+"px)",transform:"translateY("+u+"px)"}):"horizontal"==s&&i.css({"-webkit-transform":"translateX("+u+"px)","-moz-transform":"translateX("+u+"px)",transform:"translateX("+u+"px)"}))})})}}(jQuery); 24 25/** 26 * jQuery.enllax.js v1.1.0 27 * https://github.com/mmkjony/enllax.js 28 * demo: http://mmkjony.github.io/enllax.js/ 29 * 30 * Copyright 2015, MMK Jony 31 * This content is released under the MIT license 32 **/ 33 34(function($){ 35 'use strict'; 36 37 $.fn.enllax = function(opt){ 38 39 var winHeight = $(window).height(); 40 var docHeight = $(document).height(); 41 42 var options = $.extend({ 43 ratio: 0.5, 44 type: 'background', //foreground 45 direction: 'vertical' //horizontal 46 }, opt); 47 48 var elem = $('[data-enllax-ratio]'); 49 50 elem.each(function(){ 51 var ratio; 52 var type; 53 var dir; 54 var $this = $(this); 55 var offset = $this.offset().top; 56 var height = $this.outerHeight(); 57 var dataRat = $this.data('enllax-ratio'); 58 var dataType = $this.data('enllax-type'); 59 var dataDir = $this.data('enllax-direction'); 60 61 if(dataRat) { 62 ratio = dataRat; 63 } 64 else { ratio = options.ratio; } 65 66 if(dataType) { 67 type = dataType; 68 } 69 else { type = options.type; } 70 71 if(dataDir) { 72 dir = dataDir; 73 } 74 else { dir = options.direction; } 75 76 var bgY = Math.round(offset * ratio); 77 var transform = Math.round((offset - (winHeight / 2) + height) * ratio); 78 79 if(type == 'background') { 80 if(dir == 'vertical') { 81 $this.css({ 82 'background-position': 'center ' + -bgY + 'px' 83 }); 84 } 85 else if(dir == 'horizontal') { 86 $this.css({ 87 'background-position': -bgY + 'px' + ' center' 88 }); 89 } 90 } 91 else if(type == 'foreground') { 92 if(dir == 'vertical') { 93 $this.css({ 94 '-webkit-transform': 'translateY(' + transform + 'px)',
95 '-moz-transform': 'translateY(' + transform + 'px)', 96 'transform': 'translateY(' + transform + 'px)' 97 }); 98 } 99 else if(dir == 'horizontal') { 100 $this.css({ 101 '-webkit-transform': 'translateX(' + transform + 'px)', 102 '-moz-transform': 'translateX(' + transform + 'px)', 103 'transform': 'translateX(' + transform + 'px)' 104 }); 105 } 106 } 107 108 $(window).on('scroll', function(){ 109 var scrolling = $(this).scrollTop(); 110 111 bgY = Math.round((offset - scrolling) * ratio); 112 transform = Math.round(((offset - (winHeight / 2) + height) - scrolling) * ratio); 113 114 if(type == 'background') { 115 if(dir == 'vertical') { 116 $this.css({ 117 'background-position': 'center ' + -bgY + 'px' 118 }); 119 } 120 else if(dir == 'horizontal') { 121 $this.css({ 122 'background-position': -bgY + 'px' + ' center' 123 }); 124 } 125 } 126 else if((type == 'foreground') && (scrolling < docHeight)) { 127 if(dir == 'vertical') { 128 $this.css({ 129 '-webkit-transform': 'translateY(' + transform + 'px)', 130 '-moz-transform': 'translateY(' + transform + 'px)', 131 'transform': 'translateY(' + transform + 'px)' 132 }); 133 } 134 else if(dir == 'horizontal') { 135 $this.css({ 136 '-webkit-transform': 'translateX(' + transform + 'px)', 137 '-moz-transform': 'translateX(' + transform + 'px)', 138 'transform': 'translateX(' + transform + 'px)' 139 }); 140 } 141 } 142 }); 143 }); 144 145 }; 146 147})(jQuery); 148 149 150/* TODO DEPRECATED 151Plugin: jQuery Parallax 152Version 1.1.3 153Author: Ian Lunn 154Twitter: @IanLunn 155Author URL: http://www.ianlunn.co.uk/ 156Plugin URL: http://www.ianlunn.co.uk/plugins/jquery-parallax/ 157 158Dual licensed under the MIT and GPL licenses: 159http://www.opensource.org/licenses/mit-license.php 160http://www.gnu.org/licenses/gpl.html 161*/ 162 163(function( $ ){ 164 var $window = $(window); 165 var windowHeight = $window.height(); 166 167 $window.resize(function () { 168 windowHeight = $window.height(); 169 }); 170 171 $.fn.parallax = function(xpos, speedFactor, outerHeight, theMode) { 172 var $this = $(this); 173 var getHeight; 174 var firstTop; 175 var paddingTop = 0; 176 177 var theMode = theMode || 'background' 178 179 //get the starting position of each element to have parallax applied to it 180 $this.each(function(){ 181 firstTop = $this.offset().top; 182 }); 183 184 if (outerHeight) { 185 getHeight = function(jqo) { 186 return jqo.outerHeight(true); 187 }; 188 } else { 189 getHeight = function(jqo) { 190 return jqo.height(); 191 }; 192 } 193 194 // setup defaults if arguments aren't specified 195 if (arguments.length < 1 || xpos === null) xpos = "50%"; 196 if (arguments.length < 2 || speedFactor === null) speedFactor = 0.1; 197 if (arguments.length < 3 || outerHeight === null) outerHeight = true; 198 199 // function to be called whenever the window is scrolled or resized 200 function update(){ 201 var pos = $window.scrollTop(); 202 var wHeight = $window.height() 203 var wWidth = $window.width() 204 205 $this.each(function(){ 206 var $element = $(this); 207 208 var top = ( plIsset( $element.parent().offset() ) ) ? $element.parent().offset().top : 0 209 210 var height = getHeight($element); 211 var fixedHeight = $('.pl-fixed-top').height() 212 213 // Check if totally above or totally below viewport 214 if (top + height < pos || top > pos + windowHeight) { 215 return; 216 } 217 218 var trns = pos + fixedHeight - top 219 220 // for mobile set to 0 221 if( wWidth <= 767 ){ 222 223 if( theMode == 'translate' ){ 224 225 $this 226 .css('transform', 'translate(0, 0)' ) 227 .find('.pl-content') 228 .css('opacity', 1) 229 230 } else { 231 232 $this.css('backgroundPosition', '0px 0px'); 233 234 } 235 236 237 } else { 238 239 if( theMode == 'translate' && trns > 0){ 240
241 var diff = (trns + height) / (trns * 6); 242 243 244 if (diff > 1) 245 diff = 1; 246 else if (diff < 0) 247 diff = 0; 248 249 $this 250 .css('transform', 'translate(0, ' + Math.round( .6 * trns ) + 'px)' ) 251 .find('.pl-content') 252 .css('opacity', diff) 253 254 } else if( theMode == 'translate' ){ 255 $this 256 .css( 'transform', 'translate(0, 0)' ) 257 .find('.pl-content') 258 .css('opacity', 1) 259 } 260 261 262 if( theMode == 'background' ){ 263 264 $this.css('backgroundPosition', xpos + " " + Math.round((-100 - pos) * speedFactor) + "px"); 265 266 } 267 268 269 } 270 271 272 273 274 }); 275 } 276 277 $window.bind('scroll', update).resize(update); 278 update(); 279 }; 280})(jQuery); 281 282 283/* 284 * jQuery Superfish Menu Plugin 285 * Copyright (c) 2013 Joel Birch 286 * 287 * Dual licensed under the MIT and GPL licenses: 288 * http://www.opensource.org/licenses/mit-license.php 289 * http://www.gnu.org/licenses/gpl.html 290 */ 291 292(function ($) { 293 "use strict"; 294 295 var methods = (function () { 296 // private properties and methods go here 297 var c = { 298 bcClass: 'sf-breadcrumb', 299 menuClass: 'sf-js-enabled', 300 anchorClass: 'sf-with-ul', 301 menuArrowClass: 'sf-arrows' 302 }, 303 ios = (function () { 304 var ios = /iPhone|iPad|iPod/i.test(navigator.userAgent); 305 if (ios) { 306 // iOS clicks only bubble as far as body children 307 $(window).load(function () { 308 $('body').children().on('click', $.noop); 309 }); 310 } 311 return ios; 312 })(), 313 wp7 = (function () { 314 var style = document.documentElement.style; 315 return ('behavior' in style && 'fill' in style && /iemobile/i.test(navigator.userAgent)); 316 })(), 317 toggleMenuClasses = function ($menu, o) { 318 var classes = c.menuClass; 319 if (o.cssArrows) { 320 classes += ' ' + c.menuArrowClass; 321 } 322 $menu.toggleClass(classes); 323 }, 324 setPathToCurrent = function ($menu, o) { 325 return $menu.find('li.' + o.pathClass).slice(0, o.pathLevels) 326 .addClass(o.hoverClass + ' ' + c.bcClass) 327 .filter(function () { 328 return ($(this).children(o.popUpSelector).hide().show().length); 329 }).removeClass(o.pathClass); 330 }, 331 toggleAnchorClass = function ($li) { 332 $li.children('a').toggleClass(c.anchorClass); 333 }, 334 toggleTouchAction = function ($menu) { 335 var touchAction = $menu.css('ms-touch-action'); 336 touchAction = (touchAction === 'pan-y') ? 'auto' : 'pan-y'; 337 $menu.css('ms-touch-action', touchAction); 338 }, 339 applyHandlers = function ($menu, o) { 340 var targets = 'li:has(' + o.popUpSelector + ')'; 341 if ($.fn.hoverIntent && !o.disableHI) { 342 $menu.hoverIntent(over, out, targets); 343 } 344 else { 345 $menu 346 .on('mouseenter.superfish', targets, over) 347 .on('mouseleave.superfish', targets, out); 348 } 349 var touchevent = 'MSPointerDown.superfish'; 350 if (!ios) { 351 touchevent += ' touchend.superfish'; 352 } 353 if (wp7) { 354 touchevent += ' mousedown.superfish'; 355 } 356 $menu 357 .on('focusin.superfish', 'li', over) 358 .on('focusout.superfish', 'li', out) 359 .on(touchevent, 'a', o, touchHandler); 360 }, 361 touchHandler = function (e) { 362 var $this = $(this), 363 $ul = $this.siblings(e.data.popUpSelector); 364 365 if ($ul.length > 0 && $ul.is(':hidden')) { 366 $this.one('click.superfish', false); 367 if (e.type === 'MSPointerDown') { 368 $this.trigger('focus'); 369 } else { 370 $.proxy(over, $this.parent('li'))(); 371 } 372 } 373 }, 374 over = function () { 375 var $this = $(this), 376 o = getOptions($this); 377 clearTimeout(o.sfTimer); 378 $this.siblings().superfish('hide').end().superfish('show'); 379 }, 380 out = function () { 381 var $this = $(this), 382 o = getOptions($this); 383 if (ios) { 384 $.proxy(close, $this, o)(); 385 } 386 else { 387 clearTimeout(o.sfTimer); 388 o.sfTimer = setTimeout($.proxy(close, $this, o), o.delay); 389 } 390 }, 391 close = function (o) { 392 o.retainPath = ($.inArray(this[0], o.$path) > -1); 393 this.superfish('hide'); 394 395 if (!this.parents('.' + o.hoverClass).length) { 396 o.onIdle.call(getMenu(this)); 397 if (o.$path.length) { 398 $.proxy(over, o.$path)(); 399 } 400 } 401 }, 402 getMenu = function ($el) { 403 return $el.closest('.' + c.menuClass); 404 }, 405 getOptions = function ($el) { 406 return getMenu($el).data('sf-options'); 407 }; 408 409 return { 410 // public methods 411 hide: function (instant) { 412 if (this.length) { 413 var $this = this, 414 o = getOptions($this); 415 if (!o) { 416 return this; 417 } 418 var not = (o.retainPath === true) ? o.$path : '', 419 $ul = $this.find('li.' + o.hoverClass).add(this).not(not).removeClass(o.hoverClass).children(o.popUpSelector), 420 speed = o.speedOut; 421 422 if (instant) { 423 $ul.show(); 424 speed = 0; 425 } 426 o.retainPath = false;
427 o.onBeforeHide.call($ul); 428 $ul.stop(true, true).animate(o.animationOut, speed, function () { 429 var $this = $(this); 430 o.onHide.call($this); 431 }); 432 } 433 return this; 434 }, 435 show: function () { 436 var o = getOptions(this); 437 if (!o) { 438 return this; 439 } 440 var $this = this.addClass(o.hoverClass), 441 $ul = $this.children(o.popUpSelector); 442 443 o.onBeforeShow.call($ul); 444 $ul.stop(true, true).animate(o.animation, o.speed, function () { 445 o.onShow.call($ul); 446 }); 447 return this; 448 }, 449 destroy: function () { 450 return this.each(function () { 451 var $this = $(this), 452 o = $this.data('sf-options'), 453 $hasPopUp; 454 if (!o) { 455 return false; 456 } 457 $hasPopUp = $this.find(o.popUpSelector).parent('li'); 458 clearTimeout(o.sfTimer); 459 toggleMenuClasses($this, o); 460 toggleAnchorClass($hasPopUp); 461 toggleTouchAction($this); 462 // remove event handlers 463 $this.off('.superfish').off('.hoverIntent'); 464 // clear animation's inline display style 465 $hasPopUp.children(o.popUpSelector).attr('style', function (i, style) { 466 return style.replace(/display[^;]+;?/g, ''); 467 }); 468 // reset 'current' path classes 469 o.$path.removeClass(o.hoverClass + ' ' + c.bcClass).addClass(o.pathClass); 470 $this.find('.' + o.hoverClass).removeClass(o.hoverClass); 471 o.onDestroy.call($this); 472 $this.removeData('sf-options'); 473 }); 474 }, 475 init: function (op) { 476 return this.each(function () { 477 var $this = $(this); 478 if ($this.data('sf-options')) { 479 return false; 480 } 481 var o = $.extend({}, $.fn.superfish.defaults, op), 482 $hasPopUp = $this.find(o.popUpSelector).parent('li'); 483 o.$path = setPathToCurrent($this, o); 484 485 $this.data('sf-options', o); 486 487 toggleMenuClasses($this, o); 488 toggleAnchorClass($hasPopUp); 489 toggleTouchAction($this); 490 applyHandlers($this, o); 491 492 $hasPopUp.not('.' + c.bcClass).superfish('hide', true); 493 494 o.onInit.call(this); 495 }); 496 } 497 }; 498 })(); 499 500 $.fn.superfish = function (method, args) { 501 if (methods[method]) { 502 return methods[method].apply(this, Array.prototype.slice.call(arguments, 1)); 503 } 504 else if (typeof method === 'object' || ! method) { 505 return methods.init.apply(this, arguments); 506 } 507 else { 508 return $.error('Method ' + method + ' does not exist on jQuery.fn.superfish'); 509 } 510 }; 511 512 $.fn.superfish.defaults = { 513 popUpSelector: 'ul,.sf-mega', // within menu context 514 hoverClass: 'sfHover', 515 pathClass: 'overrideThisToUse', 516 pathLevels: 1, 517 delay: 800, 518 animation: {opacity: 'show'}, 519 animationOut: {opacity: 'hide'}, 520 speed: 'normal', 521 speedOut: 'fast', 522 cssArrows: true, 523 disableHI: false, 524 onInit: $.noop, 525 onBeforeShow: $.noop, 526 onShow: $.noop, 527 onBeforeHide: $.noop, 528 onHide: $.noop, 529 onIdle: $.noop, 530 onDestroy: $.noop 531 }; 532 533 // soon to be deprecated 534 $.fn.extend({ 535 hideSuperfishUl: methods.hide, 536 showSuperfishUl: methods.show 537 }); 538 539})(jQuery); 540 541/* 542 * Superclick v1.0.0 - jQuery menu widget 543 * Copyright (c) 2013 Joel Birch 544 * 545 * Dual licensed under the MIT and GPL licenses: 546 * http://www.opensource.org/licenses/mit-license.php 547 * http://www.gnu.org/licenses/gpl.html 548 */ 549 550;(function($) { 551 552 var methods = (function(){ 553 // private properties and methods go here 554 var c = { 555 bcClass: 'sf-breadcrumb', 556 menuClass: 'sf-js-enabled', 557 anchorClass: 'sf-with-ul', 558 menuArrowClass: 'sf-arrows' 559 }, 560 outerClick = (function() { 561 $(window).load(function() { 562 $('body').children().on('click.superclick', function() { 563 var $allMenus = $('.sf-js-enabled'); 564 $allMenus.superclick('reset'); 565 }); 566 }); 567 })(), 568 toggleMenuClasses = function($menu, o) { 569 var classes = c.menuClass; 570 if (o.cssArrows) { 571 classes += ' ' + c.menuArrowClass; 572 } 573 $menu.toggleClass(classes); 574 }, 575 setPathToCurrent = function($menu, o) { 576 return $menu.find('li.' + o.pathClass).slice(0, o.pathLevels) 577 .addClass(o.activeClass + ' ' + c.bcClass) 578 .filter(function() { 579 return ($(this).children('ul').hide().show().length); 580 }).removeClass(o.pathClass); 581 }, 582 toggleAnchorClass = function($li) { 583 $li.children('a').toggleClass(c.anchorClass); 584 }, 585 toggleTouchAction = function($menu) { 586 var touchAction = $menu.css('ms-touch-action'); 587 touchAction = (touchAction === 'pan-y') ? 'auto' : 'pan-y'; 588 $menu.css('ms-touch-action', touchAction); 589 }, 590 clickHandler = function(e) { 591 var $this = $(this), 592 $ul = $this.siblings('ul'), 593 func; 594 595 if ($ul.length) { 596 func = ($ul.is(':hidden')) ? over : out; 597 $.proxy(func, $this.parent('li'))(); 598 return false;
599 } 600 }, 601 over = function() { 602 var $this = $(this), 603 o = getOptions($this); 604 $this.siblings().superclick('hide').end().superclick('show'); 605 }, 606 out = function() { 607 var $this = $(this), 608 o = getOptions($this); 609 $.proxy(close, $this, o)(); 610 }, 611 close = function(o) { 612 o.retainPath = ( $.inArray(this[0], o.$path) > -1); 613 this.superclick('hide'); 614 615 if (!this.parents('.' + o.activeClass).length) { 616 o.onIdle.call(getMenu(this)); 617 if (o.$path.length) { 618 $.proxy(over, o.$path)(); 619 } 620 } 621 }, 622 getMenu = function($el) { 623 return $el.closest('.' + c.menuClass); 624 }, 625 getOptions = function($el) { 626 return getMenu($el).data('sf-options'); 627 }; 628 629 return { 630 // public methods 631 hide: function(instant) { 632 if (this.length) { 633 var $this = this, 634 o = getOptions($this); 635 if (!o) { 636 return this; 637 } 638 var not = (o.retainPath === true) ? o.$path : '', 639 $ul = $this.find('li.' + o.activeClass).add(this).not(not).removeClass(o.activeClass).children('ul'), 640 speed = o.speedOut; 641 642 if (instant) { 643 $ul.show(); 644 speed = 0; 645 } 646 o.retainPath = false; 647 o.onBeforeHide.call($ul); 648 $ul.stop(true, true).animate(o.animationOut, speed, function() { 649 var $this = $(this); 650 o.onHide.call($this); 651 }); 652 } 653 return this; 654 }, 655 show: function() { 656 var o = getOptions(this); 657 if (!o) { 658 return this; 659 } 660 var $this = this.addClass(o.activeClass), 661 $ul = $this.children('ul'); 662 663 o.onBeforeShow.call($ul); 664 $ul.stop(true, true).animate(o.animation, o.speed, function() { 665 o.onShow.call($ul); 666 }); 667 return this; 668 }, 669 destroy: function() { 670 return this.each(function(){ 671 var $this = $(this), 672 o = $this.data('sf-options'), 673 $liHasUl = $this.find('li:has(ul)'); 674 if (!o) { 675 return false; 676 } 677 toggleMenuClasses($this, o); 678 toggleAnchorClass($liHasUl); 679 toggleTouchAction($this); 680 // remove event handlers 681 $this.off('.superclick'); 682 // clear animation's inline display style 683 $liHasUl.children('ul').attr('style', function(i, style){ 684 return style.replace(/display[^;]+;?/g, ''); 685 }); 686 // reset 'current' path classes 687 o.$path.removeClass(o.activeClass + ' ' + c.bcClass).addClass(o.pathClass); 688 $this.find('.' + o.activeClass).removeClass(o.activeClass); 689 o.onDestroy.call($this); 690 $this.removeData('sf-options'); 691 }); 692 }, 693 reset: function() { 694 return this.each(function(){ 695 var $menu = $(this), 696 o = getOptions($menu), 697 $openLis = $( $menu.find('.' + o.activeClass).toArray().reverse() ); 698 $openLis.children('a').trigger('click'); 699 }); 700 }, 701 init: function(op){ 702 return this.each(function() { 703 var $this = $(this); 704 if ($this.data('sf-options')) { 705 return false; 706 } 707 var o = $.extend({}, $.fn.superclick.defaults, op), 708 $liHasUl = $this.find('li:has(ul)'); 709 o.$path = setPathToCurrent($this, o); 710 711 $this.data('sf-options', o); 712 713 toggleMenuClasses($this, o); 714 toggleAnchorClass($liHasUl); 715 toggleTouchAction($this); 716 $this.on('click.superclick', 'a', clickHandler); 717 718 $liHasUl.not('.' + c.bcClass).superclick('hide',true); 719 720 o.onInit.call(this); 721 }); 722 } 723 }; 724 })(); 725 726 $.fn.superclick = function(method, args) { 727 if (methods[method]) { 728 return methods[method].apply(this, Array.prototype.slice.call(arguments, 1)); 729 } 730 else if (typeof method === 'object' || ! method) { 731 return methods.init.apply(this, arguments); 732 } 733 else { 734 return $.error('Method ' + method + ' does not exist on jQuery.fn.superclick'); 735 } 736 }; 737 738 $.fn.superclick.defaults = { 739 activeClass: 'sfHover', // keep 'hover' in classname for compatibility reasons 740 pathClass: 'overrideThisToUse', 741 pathLevels: 1, 742 animation: {opacity:'show'}, 743 animationOut: {opacity:'hide'}, 744 speed: 'normal', 745 speedOut: 'fast', 746 cssArrows: true, 747 onInit: $.noop, 748 onBeforeShow: $.noop, 749 onShow: $.noop, 750 onBeforeHide: $.noop, 751 onHide: $.noop, 752 onIdle: $.noop, 753 onDestroy: $.noop 754 }; 755 756})(jQuery); 757 758 759// ======================== 760// = ImagesLoaded Checker = 761// ======================== 762(function(c,q){var m="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==";c.fn.imagesLoaded=function(f){function n(){var b=c(j),a=c(h);d&&(h.length?d.reject(e,b,a):d.resolve(e));c.isFunction(f)&&f.call(g,e,b,a)}function p(b){k(b.target,"error"===b.type)}function k(b,a){b.src===m||-1!==c.inArray(b,l)||(l.push(b),a?h.push(b):j.push(b),c.data(b,"imagesLoaded",{isBroken:a,src:b.src}),r&&d.notifyWith(c(b),[a,e,c(j),c(h)]),e.length===l.length&&(setTimeout(n),e.unbind(".imagesLoaded", 763p)))}var g=this,d=c.isFunction(c.Deferred)?c.Deferred():0,r=c.isFunction(d.notify),e=g.find("img").add(g.filter("img")),l=[],j=[],h=[];c.isPlainObject(f)&&c.each(f,function(b,a){if("callback"===b)f=a;else if(d)d[b](a)});e.length?e.bind("load.imagesLoaded error.imagesLoaded",p).each(function(b,a){var d=a.src,e=c.data(a,"imagesLoaded");
763if(e&&e.src===d)k(a,e.isBroken);else if(a.complete&&a.naturalWidth!==q)k(a,0===a.naturalWidth||0===a.naturalHeight);else if(a.readyState||a.complete)a.src=m,a.src=d}): 764n();return d?d.promise(g):g}})(jQuery); 765 766// ============================= 767// = Local Storage Abstraction = 768// ============================= 769 770/* Copyright (c) 2010-2012 Marcus Westin */ 771(function(e){function o(){try{return r in e&&e[r]}catch(t){return!1}}var t={},n=e.document,r="localStorage",i="script",s;t.disabled=!1,t.set=function(e,t){},t.get=function(e){},t.remove=function(e){},t.clear=function(){},t.transact=function(e,n,r){var i=t.get(e);r==null&&(r=n,n=null),typeof i=="undefined"&&(i=n||{}),r(i),t.set(e,i)},t.getAll=function(){},t.forEach=function(){},t.serialize=function(e){return JSON.stringify(e)},t.deserialize=function(e){if(typeof e!="string")return undefined;try{return JSON.parse(e)}catch(t){return e||undefined}};if(o())s=e[r],t.set=function(e,n){return n===undefined?t.remove(e):(s.setItem(e,t.serialize(n)),n)},t.get=function(e){return t.deserialize(s.getItem(e))},t.remove=function(e){s.removeItem(e)},t.clear=function(){s.clear()},t.getAll=function(){var e={};return t.forEach(function(t,n){e[t]=n}),e},t.forEach=function(e){for(var n=0;n<s.length;n++){var r=s.key(n);e(r,t.get(r))}};else if(n.documentElement.addBehavior){var u,a;try{a=new ActiveXObject("htmlfile"),a.open(),a.write("<"+i+">document.w=window</"+i+'><iframe src="/favicon.ico"></iframe>'),a.close(),u=a.w.frames[0].document,s=u.createElement("div")}catch(f){s=n.createElement("div"),u=n.body}function l(e){return function(){var n=Array.prototype.slice.call(arguments,0);n.unshift(s),u.appendChild(s),s.addBehavior("#default#userData"),s.load(r);var i=e.apply(t,n);return u.removeChild(s),i}}var c=new RegExp("[!\"#$%&'()*+,/\\\\:;<=>?@[\\]^`{|}~]","g");function h(e){return e.replace(/^d/,"___$&").replace(c,"___")}t.set=l(function(e,n,i){return n=h(n),i===undefined?t.remove(n):(e.setAttribute(n,t.serialize(i)),e.save(r),i)}),t.get=l(function(e,n){return n=h(n),t.deserialize(e.getAttribute(n))}),t.remove=l(function(e,t){t=h(t),e.removeAttribute(t),e.save(r)}),t.clear=l(function(e){var t=e.XMLDocument.documentElement.attributes;e.load(r);for(var n=0,i;i=t[n];n++)e.removeAttribute(i.name);e.save(r)}),t.getAll=function(e){var n={};return t.forEach(function(e,t){n[e]=t}),n},t.forEach=l(function(e,n){var r=e.XMLDocument.documentElement.attributes;for(var i=0,s;s=r[i];++i)n(s.name,t.deserialize(e.getAttribute(s.name)))})}try{var p="__storejs__";t.set(p,p),t.get(p)!=p&&(t.disabled=!0),t.remove(p)}catch(f){t.disabled=!0}t.enabled=!t.disabled,typeof module!="undefined"&&module.exports?module.exports=t:typeof define=="function"&&define.amd?define(t):e.store=t})(Function("return this")()) 772 773 774 775// ========== 776// = Easing = 777// ========== 778/* 779 * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/ 780 * 781 * Uses the built in easing capabilities added In jQuery 1.1 782 * to offer multiple easing options 783 * 784 * TERMS OF USE - jQuery Easing 785 * 786 * Open source under the BSD License. 787 * 788 * Copyright © 2008 George McGinley Smith 789 * All rights reserved. 790 * 791 * Redistribution and use in source and binary forms, with or without modification, 792 * are permitted provided that the following conditions are met: 793 * 794 * Redistributions of source code must retain the above copyright notice, this list of 795 * conditions and the following disclaimer. 796 * Redistributions in binary form must reproduce the above copyright notice, this list 797 * of conditions and the following disclaimer in the documentation and/or other materials 798 * provided with the distribution. 799 * 800 * Neither the name of the author nor the names of contributors may be used to endorse 801 * or promote products derived from this software without specific prior written permission. 802 * 803 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 804 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 805 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 806 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
vendor: 5,342 bytes, lines 807-962
807 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 808 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 809 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 810 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 811 * OF THE POSSIBILITY OF SUCH DAMAGE. 812 * 813*/ 814 815// t: current time, b: begInnIng value, c: change In value, d: duration 816jQuery.easing['jswing'] = jQuery.easing['swing']; 817 818jQuery.extend( jQuery.easing, 819{ 820 def: 'easeOutQuad', 821 swing: function (x, t, b, c, d) { 822 //alert(jQuery.easing.default); 823 return jQuery.easing[jQuery.easing.def](x, t, b, c, d); 824 }, 825 easeInQuad: function (x, t, b, c, d) { 826 return c*(t/=d)*t + b; 827 }, 828 easeOutQuad: function (x, t, b, c, d) { 829 return -c *(t/=d)*(t-2) + b; 830 }, 831 easeInOutQuad: function (x, t, b, c, d) { 832 if ((t/=d/2) < 1) return c/2*t*t + b; 833 return -c/2 * ((--t)*(t-2) - 1) + b; 834 }, 835 easeInCubic: function (x, t, b, c, d) { 836 return c*(t/=d)*t*t + b; 837 }, 838 easeOutCubic: function (x, t, b, c, d) { 839 return c*((t=t/d-1)*t*t + 1) + b; 840 }, 841 easeInOutCubic: function (x, t, b, c, d) { 842 if ((t/=d/2) < 1) return c/2*t*t*t + b; 843 return c/2*((t-=2)*t*t + 2) + b; 844 }, 845 easeInQuart: function (x, t, b, c, d) { 846 return c*(t/=d)*t*t*t + b; 847 }, 848 easeOutQuart: function (x, t, b, c, d) { 849 return -c * ((t=t/d-1)*t*t*t - 1) + b; 850 }, 851 easeInOutQuart: function (x, t, b, c, d) { 852 if ((t/=d/2) < 1) return c/2*t*t*t*t + b; 853 return -c/2 * ((t-=2)*t*t*t - 2) + b; 854 }, 855 easeInQuint: function (x, t, b, c, d) { 856 return c*(t/=d)*t*t*t*t + b; 857 }, 858 easeOutQuint: function (x, t, b, c, d) { 859 return c*((t=t/d-1)*t*t*t*t + 1) + b; 860 }, 861 easeInOutQuint: function (x, t, b, c, d) { 862 if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b; 863 return c/2*((t-=2)*t*t*t*t + 2) + b; 864 }, 865 easeInSine: function (x, t, b, c, d) { 866 return -c * Math.cos(t/d * (Math.PI/2)) + c + b; 867 }, 868 easeOutSine: function (x, t, b, c, d) { 869 return c * Math.sin(t/d * (Math.PI/2)) + b; 870 }, 871 easeInOutSine: function (x, t, b, c, d) { 872 return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b; 873 }, 874 easeInExpo: function (x, t, b, c, d) { 875 return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b; 876 }, 877 easeOutExpo: function (x, t, b, c, d) { 878 return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b; 879 }, 880 easeInOutExpo: function (x, t, b, c, d) { 881 if (t==0) return b; 882 if (t==d) return b+c; 883 if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b; 884 return c/2 * (-Math.pow(2, -10 * --t) + 2) + b; 885 }, 886 easeInCirc: function (x, t, b, c, d) { 887 return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b; 888 }, 889 easeOutCirc: function (x, t, b, c, d) { 890 return c * Math.sqrt(1 - (t=t/d-1)*t) + b; 891 }, 892 easeInOutCirc: function (x, t, b, c, d) { 893 if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b; 894 return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b; 895 }, 896 easeInElastic: function (x, t, b, c, d) { 897 var s=1.70158;var p=0;var a=c; 898 if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3; 899 if (a < Math.abs(c)) { a=c; var s=p/4; } 900 else var s = p/(2*Math.PI) * Math.asin (c/a); 901 return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b; 902 }, 903 easeOutElastic: function (x, t, b, c, d) { 904 var s=1.70158;var p=0;var a=c; 905 if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3; 906 if (a < Math.abs(c)) { a=c; var s=p/4; } 907 else var s = p/(2*Math.PI) * Math.asin (c/a); 908 return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b; 909 }, 910 easeInOutElastic: function (x, t, b, c, d) { 911 var s=1.70158;var p=0;var a=c; 912 if (t==0) return b; if ((t/=d/2)==2) return b+c; if (!p) p=d*(.3*1.5); 913 if (a < Math.abs(c)) { a=c; var s=p/4; } 914 else var s = p/(2*Math.PI) * Math.asin (c/a); 915 if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b; 916 return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b; 917 }, 918 easeInBack: function (x, t, b, c, d, s) { 919 if (s == undefined) s = 1.70158; 920 return c*(t/=d)*t*((s+1)*t - s) + b; 921 }, 922 easeOutBack: function (x, t, b, c, d, s) { 923 if (s == undefined) s = 1.70158; 924 return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b; 925 }, 926 easeInOutBack: function (x, t, b, c, d, s) { 927 if (s == undefined) s = 1.70158; 928 if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b; 929 return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b; 930 }, 931 easeInBounce: function (x, t, b, c, d) { 932 return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b; 933 }, 934 easeOutBounce: function (x, t, b, c, d) { 935 if ((t/=d) < (1/2.75)) { 936 return c*(7.5625*t*t) + b; 937 } else if (t < (2/2.75)) { 938 return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b; 939 } else if (t < (2.5/2.75)) { 940 return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b; 941 } else { 942 return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b; 943 } 944 }, 945 easeInOutBounce: function (x, t, b, c, d) { 946 if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b; 947 return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b; 948 } 949}); 950 951 952// ==================== 953// = Appear on Scroll = 954// ==================== 955 956/* 957 * jQuery.appear 958 * https://github.com/bas2k/jquery.appear/ 959 * http://code.google.com/p/jquery-appear/ 960 * 961 * Copyright (c) 2009 Michael Hixson 962 * Copyright (c) 2012 Alexander Brovikov
963 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php) 964 */ 965(function($) { 966 $.fn.appear = function(fn, options) { 967 968 var settings = $.extend({ 969 970 //arbitrary data to pass to fn 971 data: undefined, 972 973 //call fn only on the first appear? 974 one: true, 975 976 // X & Y accuracy 977 accX: 0, 978 accY: 0 979 980 }, options); 981 982 return this.each(function() { 983 984 var t = $(this); 985 986 //whether the element is currently visible 987 t.appeared = false; 988 989 if (!fn) { 990 991 //trigger the custom event 992 t.trigger('appear', settings.data); 993 return; 994 } 995 996 var w = $(window); 997 998 //fires the appear event when appropriate 999 var check = function() { 1000 1001 //is the element hidden? 1002 if (!t.is(':visible')) { 1003 1004 //it became hidden 1005 t.appeared = false; 1006 return; 1007 } 1008 1009 //is the element inside the visible window? 1010 var a = w.scrollLeft(); 1011 var b = w.scrollTop(); 1012 var o = t.offset(); 1013 var x = o.left; 1014 var y = o.top; 1015 1016 var ax = settings.accX; 1017 var ay = settings.accY; 1018 var th = t.height(); 1019 var wh = w.height(); 1020 var tw = t.width(); 1021 var ww = w.width(); 1022 1023 if (y + th + ay >= b && 1024 y <= b + wh + ay && 1025 x + tw + ax >= a && 1026 x <= a + ww + ax) { 1027 1028 //trigger the custom event 1029 if (!t.appeared) t.trigger('appear', settings.data); 1030 1031 } else { 1032 1033 //it scrolled out of view 1034 t.appeared = false; 1035 } 1036 }; 1037 1038 //create a modified fn with some additional logic 1039 var modifiedFn = function() { 1040 1041 //mark the element as visible 1042 t.appeared = true; 1043 1044 //is this supposed to happen only once? 1045 if (settings.one) { 1046 1047 //remove the check 1048 w.unbind('scroll', check); 1049 var i = $.inArray(check, $.fn.appear.checks); 1050 if (i >= 0) $.fn.appear.checks.splice(i, 1); 1051 } 1052 1053 //trigger the original fn 1054 fn.apply(this, arguments); 1055 }; 1056 1057 //bind the modified fn to the element 1058 if (settings.one) t.one('appear', settings.data, modifiedFn); 1059 else t.bind('appear', settings.data, modifiedFn); 1060 1061 //check whenever the window scrolls 1062 w.scroll(check); 1063 1064 //check whenever the dom changes 1065 $.fn.appear.checks.push(check); 1066 1067 //check now 1068 (check)(); 1069 }); 1070 }; 1071 1072 //keep a queue of appearance checks 1073 $.extend($.fn.appear, { 1074 1075 checks: [], 1076 timeout: null, 1077 1078 //process the queue 1079 checkAll: function() { 1080 var length = $.fn.appear.checks.length; 1081 if (length > 0) while (length--) ($.fn.appear.checks[length])(); 1082 }, 1083 1084 //check the queue asynchronously 1085 run: function() { 1086 if ($.fn.appear.timeout) clearTimeout($.fn.appear.timeout); 1087 $.fn.appear.timeout = setTimeout($.fn.appear.checkAll, 20); 1088 } 1089 }); 1090 1091 //run checks when these methods are called 1092 $.each(['append', 'prepend', 'after', 'before', 'attr', 1093 'removeAttr', 'addClass', 'removeClass', 'toggleClass', 1094 'remove', 'css', 'show', 'hide'], function(i, n) { 1095 var old = $.fn[n]; 1096 if (old) { 1097 $.fn[n] = function() { 1098 var r = old.apply(this, arguments); 1099 $.fn.appear.run(); 1100 return r; 1101 } 1102 } 1103 }); 1104 1105})(jQuery); 1106 1107// ========================== 1108// = SprintF for Javascript = 1109// ========================== 1110/** 1111sprintf() for JavaScript 0.7-beta1 1112http://www.diveintojavascript.com/projects/javascript-sprintf 1113 1114Copyright (c) Alexandru Marasteanu <alexaholic [at) gmail (dot] com> 1115All rights reserved. 1116 1117**/ 1118 1119var sprintf = (function() { 1120 function get_type(variable) { 1121 return Object.prototype.toString.call(variable).slice(8, -1).toLowerCase(); 1122 } 1123 function str_repeat(input, multiplier) { 1124 for (var output = []; multiplier > 0; output[--multiplier] = input) {/* do nothing */} 1125 return output.join(''); 1126 } 1127 1128 var str_format = function() { 1129 if (!str_format.cache.hasOwnProperty(arguments[0])) { 1130 str_format.cache[arguments[0]] = str_format.parse(arguments[0]); 1131 } 1132 return str_format.format.call(null, str_format.cache[arguments[0]], arguments); 1133 }; 1134 1135 str_format.format = function(parse_tree, argv) { 1136 var cursor = 1, tree_length = parse_tree.length, node_type = '', arg, output = [], i, k, match, pad, pad_character, pad_length; 1137 for (i = 0; i < tree_length; i++) {
1138 node_type = get_type(parse_tree[i]); 1139 if (node_type === 'string') { 1140 output.push(parse_tree[i]); 1141 } 1142 else if (node_type === 'array') { 1143 match = parse_tree[i]; // convenience purposes only 1144 if (match[2]) { // keyword argument 1145 arg = argv[cursor]; 1146 for (k = 0; k < match[2].length; k++) { 1147 if (!arg.hasOwnProperty(match[2][k])) { 1148 throw(sprintf('[sprintf] property "%s" does not exist', match[2][k])); 1149 } 1150 arg = arg[match[2][k]]; 1151 } 1152 } 1153 else if (match[1]) { // positional argument (explicit) 1154 arg = argv[match[1]]; 1155 } 1156 else { // positional argument (implicit) 1157 arg = argv[cursor++]; 1158 } 1159 1160 if (/[^s]/.test(match[8]) && (get_type(arg) != 'number')) { 1161 throw(sprintf('[sprintf] expecting number but found %s', get_type(arg))); 1162 } 1163 switch (match[8]) { 1164 case 'b': arg = arg.toString(2); break; 1165 case 'c': arg = String.fromCharCode(arg); break; 1166 case 'd': arg = parseInt(arg, 10); break; 1167 case 'e': arg = match[7] ? arg.toExponential(match[7]) : arg.toExponential(); break; 1168 case 'f': arg = match[7] ? parseFloat(arg).toFixed(match[7]) : parseFloat(arg); break; 1169 case 'o': arg = arg.toString(8); break; 1170 case 's': arg = ((arg = String(arg)) && match[7] ? arg.substring(0, match[7]) : arg); break; 1171 case 'u': arg = Math.abs(arg); break; 1172 case 'x': arg = arg.toString(16); break; 1173 case 'X': arg = arg.toString(16).toUpperCase(); break; 1174 } 1175 arg = (/[def]/.test(match[8]) && match[3] && arg >= 0 ? '+'+ arg : arg); 1176 pad_character = match[4] ? match[4] == '0' ? '0' : match[4].charAt(1) : ' '; 1177 pad_length = match[6] - String(arg).length; 1178 pad = match[6] ? str_repeat(pad_character, pad_length) : ''; 1179 output.push(match[5] ? arg + pad : pad + arg); 1180 } 1181 } 1182 return output.join(''); 1183 }; 1184 1185 str_format.cache = {}; 1186 1187 str_format.parse = function(fmt) { 1188 var _fmt = fmt, match = [], parse_tree = [], arg_names = 0; 1189 while (_fmt) { 1190 if ((match = /^[^\x25]+/.exec(_fmt)) !== null) { 1191 parse_tree.push(match[0]); 1192 } 1193 else if ((match = /^\x25{2}/.exec(_fmt)) !== null) { 1194 parse_tree.push('%'); 1195 } 1196 else if ((match = /^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-fosuxX])/.exec(_fmt)) !== null) { 1197 if (match[2]) { 1198 arg_names |= 1; 1199 var field_list = [], replacement_field = match[2], field_match = []; 1200 if ((field_match = /^([a-z_][a-z_\d]*)/i.exec(replacement_field)) !== null) { 1201 field_list.push(field_match[1]); 1202 while ((replacement_field = replacement_field.substring(field_match[0].length)) !== '') { 1203 if ((field_match = /^\.([a-z_][a-z_\d]*)/i.exec(replacement_field)) !== null) { 1204 field_list.push(field_match[1]); 1205 } 1206 else if ((field_match = /^\[(\d+)\]/.exec(replacement_field)) !== null) { 1207 field_list.push(field_match[1]); 1208 } 1209 else { 1210 throw('[sprintf] huh?'); 1211 } 1212 } 1213 } 1214 else { 1215 throw('[sprintf] huh?'); 1216 } 1217 match[2] = field_list; 1218 } 1219 else { 1220 arg_names |= 2; 1221 } 1222 if (arg_names === 3) { 1223 throw('[sprintf] mixing positional and named placeholders is not (yet) supported'); 1224 } 1225 parse_tree.push(match); 1226 } 1227 else { 1228 throw('[sprintf] huh?'); 1229 } 1230 _fmt = _fmt.substring(match[0].length); 1231 } 1232 return parse_tree; 1233 }; 1234 1235 return str_format; 1236})(); 1237 1238var vsprintf = function(fmt, argv) { 1239 argv.unshift(fmt); 1240 return sprintf.apply(null, argv); 1241}; 1242 1243 1244// =================== 1245// = CountTo Utility = 1246// =================== 1247 1248(function ($) { 1249 $.fn.countTo = function (options) { 1250 options = options || {}; 1251 1252 return $(this).each(function () { 1253 // set options for current element 1254 var settings = $.extend({}, $.fn.countTo.defaults, { 1255 from: $(this).data('from'), 1256 to: $(this).data('to'), 1257 speed: $(this).data('speed'), 1258 refreshInterval: $(this).data('refresh-interval'), 1259 decimals: $(this).data('decimals') 1260 }, options); 1261 1262 // how many times to update the value, and how much to increment the value on each update 1263 var loops = Math.ceil(settings.speed / settings.refreshInterval), 1264 increment = (settings.to - settings.from) / loops; 1265 1266 // references & variables that will change with each update 1267 var self = this, 1268 $self = $(this), 1269 loopCount = 0, 1270 value = settings.from, 1271 data = $self.data('countTo') || {}; 1272 1273 $self.data('countTo', data); 1274 1275 // if an existing interval can be found, clear it first 1276 if (data.interval) { 1277 clearInterval(data.interval); 1278 } 1279 data.interval = setInterval(updateTimer, settings.refreshInterval); 1280 1281 // initialize the element with the starting value 1282 render(value); 1283 1284 function updateTimer() { 1285 value += increment; 1286 loopCount++; 1287 1288 render(value); 1289
1290 if (typeof(settings.onUpdate) == 'function') { 1291 settings.onUpdate.call(self, value); 1292 } 1293 1294 if (loopCount >= loops) { 1295 // remove the interval 1296 $self.removeData('countTo'); 1297 clearInterval(data.interval); 1298 value = settings.to; 1299 1300 if (typeof(settings.onComplete) == 'function') { 1301 settings.onComplete.call(self, value); 1302 } 1303 } 1304 } 1305 1306 function render(value) { 1307 var formattedValue = settings.formatter.call(self, value, settings); 1308 $self.text(formattedValue); 1309 } 1310 }); 1311 }; 1312 1313 $.fn.countTo.defaults = { 1314 from: 0, // the number the element should start at 1315 to: 0, // the number the element should end at 1316 speed: 1000, // how long it should take to count between the target numbers 1317 refreshInterval: 100, // how often the element should be updated 1318 decimals: 0, // the number of decimal places to show 1319 formatter: formatter, // handler for formatting the value before rendering 1320 onUpdate: null, // callback method for every time the element is updated 1321 onComplete: null // callback method for when the element finishes updating 1322 }; 1323 1324 function formatter(value, settings) { 1325 return value.toFixed(settings.decimals); 1326 } 1327}(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.