1/* 2Plugin Name: scrollToTop for jQuery. 3Written by: Okler Themes - (http://www.okler.net) 4Version: 3.1.0 5*/ 6 7(function($) { 8 $.extend({ 9 10 scrollToTop: function() { 11 12 var _isScrolling = false; 13 14 // Append Button 15 $("body").append($("<a />") 16 .addClass("scroll-to-top") 17 .attr({ 18 "href": "#", 19 "id": "scrollToTop" 20 }) 21 .append( 22 $("<i />") 23 .addClass("icon icon-chevron-up icon-white") 24 )); 25 26 $("#scrollToTop").click(function(e) { 27 28 e.preventDefault(); 29 $("body, html").animate({scrollTop : 0}, 500); 30 return false; 31 32 }); 33 34 // Show/Hide Button on Window Scroll event. 35 $(window).scroll(function() { 36 37 if(!_isScrolling) { 38 39 _isScrolling = true; 40 41 if($(window).scrollTop() > 150) { 42 43 $("#scrollToTop").stop(true, true).addClass("visible"); 44 _isScrolling = false; 45 46 } else { 47 48 $("#scrollToTop").stop(true, true).removeClass("visible"); 49 _isScrolling = false; 50 51 } 52 53 } 54 55 }); 56 57 } 58 59 }); 60})(jQuery); 61 62/* 63Plugin Name: BrowserSelector 64Written by: Okler Themes - (http://www.okler.net) 65*/ 66 67(function($) { 68 $.extend({ 69 70 browserSelector: function() { 71 72 var u = navigator.userAgent, 73 ua = u.toLowerCase(), 74 is = function (t) { 75 return ua.indexOf(t) > -1; 76 }, 77 g = 'gecko', 78 w = 'webkit', 79 s = 'safari', 80 o = 'opera', 81 h = document.documentElement, 82 b = [(!(/opera|webtv/i.test(ua)) && /msie\s(\d)/.test(ua)) ? ('ie ie' + parseFloat(navigator.appVersion.split("MSIE")[1])) : is('firefox/2') ? g + ' ff2' : is('firefox/3.5') ? g + ' ff3 ff3_5' : is('firefox/3') ? g + ' ff3' : is('gecko/') ? g : is('opera') ? o + (/version\/(\d+)/.test(ua) ? ' ' + o + RegExp.jQuery1 : (/opera(\s|\/)(\d+)/.test(ua) ? ' ' + o + RegExp.jQuery2 : '')) : is('konqueror') ? 'konqueror' : is('chrome') ? w + ' chrome' : is('iron') ? w + ' iron' : is('applewebkit/') ? w + ' ' + s + (/version\/(\d+)/.test(ua) ? ' ' + s + RegExp.jQuery1 : '') : is('mozilla/') ? g : '', is('j2me') ? 'mobile' : is('iphone') ? 'iphone' : is('ipod') ? 'ipod' : is('mac') ? 'mac' : is('darwin') ? 'mac' : is('webtv') ? 'webtv' : is('win') ? 'win' : is('freebsd') ? 'freebsd' : (is('x11') || is('linux')) ? 'linux' : '', 'js']; 83 84 c = b.join(' '); 85 h.className += ' ' + c; 86 87 var isIE11 = !(window.ActiveXObject) && "ActiveXObject" in window; 88 89 if (isIE11) { 90 $('html').removeClass('gecko').addClass('ie ie11'); 91 return; 92 } 93 94 } 95 96 }); 97})(jQuery); 98 99/* 100Plugin Name: waitForImages jQuery Plugin - v1.5.0 - 2013-07-20 101Written by: https://github.com/alexanderdickson/waitForImages 102 103*/ 104 105;(function ($) { 106 // Namespace all events. 107 var eventNamespace = 'waitForImages'; 108 109 // CSS properties which contain references to images. 110 $.waitForImages = { 111 hasImageProperties: ['backgroundImage', 'listStyleImage', 'borderImage', 'borderCornerImage', 'cursor'] 112 }; 113 114 // Custom selector to find `img` elements that have a valid `src` attribute and have not already loaded. 115 $.expr[':'].uncached = function (obj) { 116 // Ensure we are dealing with an `img` element with a valid `src` attribute. 117 if (!$(obj).is('img[src!=""]')) { 118 return false; 119 } 120 121 // Firefox's `complete` property will always be `true` even if the image has not been downloaded. 122 // Doing it this way works in Firefox. 123 var img = new Image(); 124 img.src = obj.src; 125 return !img.complete; 126 }; 127 128 $.fn.waitForImages = function (finishedCallback, eachCallback, waitForAll) { 129 130 var allImgsLength = 0; 131 var allImgsLoaded = 0; 132 133 // Handle options object. 134 if ($.isPlainObject(arguments[0])) { 135 waitForAll = arguments[0].waitForAll; 136 eachCallback = arguments[0].each; 137 // This must be last as arguments[0] 138 // is aliased with finishedCallback. 139 finishedCallback = arguments[0].finished; 140 } 141 142 // Handle missing callbacks. 143 finishedCallback = finishedCallback || $.noop; 144 eachCallback = eachCallback || $.noop; 145 146 // Convert waitForAll to Boolean 147 waitForAll = !! waitForAll; 148 149 // Ensure callbacks are functions. 150 if (!$.isFunction(finishedCallback) || !$.isFunction(eachCallback)) { 151 throw new TypeError('An invalid callback was supplied.'); 152 } 153 154 return this.each(function () { 155 // Build a list of all imgs, dependent on what images will be considered. 156 var obj = $(this); 157 var allImgs = []; 158 // CSS properties which may contain an image. 159 var hasImgProperties = $.waitForImages.hasImageProperties || []; 160 // To match `url()` references. 161 // Spec: http://www.w3.org/TR/CSS2/syndata.html#value-def-uri 162 var matchUrl = /url\(\s*(['"]?)(.*?)\1\s*\)/g; 163 164 if (waitForAll) { 165 166 // Get all elements (including the original), as any one of them could have a background image. 167 obj.find('*').addBack().each(function () { 168 var element = $(this); 169 170 // If an `img` element, add it. But keep iterating in case it has a background image too. 171 if (element.is('img:uncached')) { 172 allImgs.push({ 173 src: element.attr('src'), 174 element: element[0] 175 }); 176 } 177 178 $.each(hasImgProperties, function (i, property) { 179 var propertyValue = element.css(property); 180 var match; 181 182 // If it doesn't contain this property, skip. 183 if (!propertyValue) { 184 return true; 185 } 186 187 // Get all url() of this element. 188 while (match = matchUrl.exec(propertyValue)) { 189 allImgs.push({ 190 src: match[2], 191 element: element[0] 192 }); 193 } 194 }); 195 }); 196 } else { 197 // For images only, the task is simpler. 198 obj.find('img:uncached') 199 .each(function () { 200 allImgs.push({ 201 src: this.src, 202 element: this 203 }); 204 }); 205 } 206 207 allImgsLength = allImgs.length; 208 allImgsLoaded = 0; 209 210 // If no images found, don't bother. 211 if (allImgsLength === 0) { 212 finishedCallback.call(obj[0]); 213 } 214 215 $.each(allImgs, function (i, img) { 216 217 var image = new Image(); 218 219 // Handle the image loading and error with the same callback. 220 $(image).on('load.' + eventNamespace + ' error.' + eventNamespace, function (event) { 221 allImgsLoaded++; 222 223 // If an error occurred with loading the image, set the third argument accordingly. 224 eachCallback.call(img.element, allImgsLoaded, allImgsLength, event.type == 'load'); 225 226 if (allImgsLoaded == allImgsLength) { 227 finishedCallback.call(obj[0]); 228 return false; 229 } 230 231 }); 232 233 image.src = img.src; 234 }); 235 }); 236 }; 237}(jQuery)); 238 239/* 240Plugin Name: Count To 241Written by: Matt Huggins - https://github.com/mhuggins/jquery-countTo 242 243*/ 244 245(function ($) { 246 $.fn.countTo = function (options) { 247 options = options || {}; 248 249 return $(this).each(function () { 250 // set options for current element 251 var settings = $.extend({}, $.fn.countTo.defaults, { 252 from: $(this).data('from'), 253 to: $(this).data('to'), 254 speed: $(this).data('speed'), 255 refreshInterval: $(this).data('refresh-interval'), 256 decimals: $(this).data('decimals') 257 }, options); 258 259 // how many times to update the value, and how much to increment the value on each update 260 var loops = Math.ceil(settings.speed / settings.refreshInterval), 261 increment = (settings.to - settings.from) / loops; 262 263 // references & variables that will change with each update 264 var self = this, 265 $self = $(this), 266 loopCount = 0, 267 value = settings.from, 268 data = $self.data('countTo') || {}; 269 270 $self.data('countTo', data); 271 272 // if an existing interval can be found, clear it first 273 if (data.interval) { 274 clearInterval(data.interval); 275 } 276 data.interval = setInterval(updateTimer, settings.refreshInterval); 277 278 // initialize the element with the starting value 279 render(value); 280 281 function updateTimer() { 282 value += increment; 283 loopCount++; 284 285 render(value); 286
287 if (typeof(settings.onUpdate) == 'function') { 288 settings.onUpdate.call(self, value); 289 } 290 291 if (loopCount >= loops) { 292 // remove the interval 293 $self.removeData('countTo'); 294 clearInterval(data.interval); 295 value = settings.to; 296 297 if (typeof(settings.onComplete) == 'function') { 298 settings.onComplete.call(self, value); 299 } 300 } 301 } 302 303 function render(value) { 304 var formattedValue = settings.formatter.call(self, value, settings); 305 $self.html(formattedValue); 306 } 307 }); 308 }; 309 310 $.fn.countTo.defaults = { 311 from: 0, // the number the element should start at 312 to: 0, // the number the element should end at 313 speed: 1000, // how long it should take to count between the target numbers 314 refreshInterval: 100, // how often the element should be updated 315 decimals: 0, // the number of decimal places to show 316 formatter: formatter, // handler for formatting the value before rendering 317 onUpdate: null, // callback method for every time the element is updated 318 onComplete: null // callback method for when the element finishes updating 319 }; 320 321 function formatter(value, settings) { 322 return value.toFixed(settings.decimals); 323 } 324}(jQuery)); 325 326/* 327Plugin Name: afterResize.js 328Written by: https://github.com/mcshaman/afterResize.js 329Description: Simple jQuery plugin designed to emulate an 'after resize' event. 330 331*/ 332 333( function( $ ) { 334 "use strict"; 335 336 // Define default settings 337 var defaults = { 338 action: function() {}, 339 runOnLoad: false, 340 duration: 500 341 }; 342 343 // Define global variables 344 var settings = defaults, 345 running = false, 346 start; 347 348 var methods = {}; 349 350 // Initial plugin configuration 351 methods.init = function() { 352 353 // Allocate passed arguments to settings based on type 354 for( var i = 0; i <= arguments.length; i++ ) { 355 var arg = arguments[i]; 356 switch ( typeof arg ) { 357 case "function": 358 settings.action = arg; 359 break; 360 case "boolean": 361 settings.runOnLoad = arg; 362 break; 363 case "number": 364 settings.duration = arg; 365 break; 366 } 367 } 368 369 // Process each matching jQuery object 370 return this.each(function() { 371 372 if( settings.runOnLoad ) { settings.action(); } 373 374 $(this).resize( function() { 375 376 methods.timedAction.call( this ); 377 378 } ); 379 380 } ); 381 }; 382 383 methods.timedAction = function( code, millisec ) { 384 385 var doAction = function() { 386 var remaining = settings.duration; 387 388 if( running ) { 389 var elapse = new Date() - start; 390 remaining = settings.duration - elapse; 391 if( remaining <= 0 ) { 392 // Clear timeout and reset running variable 393 clearTimeout(running); 394 running = false; 395 // Perform user defined function 396 settings.action(); 397 398 return; 399 } 400 } 401 wait( remaining ); 402 }; 403 404 var wait = function( time ) { 405 running = setTimeout( doAction, time ); 406 }; 407 408 // Define new action starting time 409 start = new Date(); 410 411 // Define runtime settings if function is run directly 412 if( typeof millisec === 'number' ) { settings.duration = millisec; } 413 if( typeof code === 'function' ) { settings.action = code; } 414 415 // Only run timed loop if not already running 416 if( !running ) { doAction(); } 417 418 }; 419 420 421 $.fn.afterResize = function( method ) { 422 423 if( methods[method] ) { 424 return methods[method].apply( this, Array.prototype.slice.call( arguments, 1 ) ); 425 } else { 426 return methods.init.apply( this, arguments ); 427 } 428 429 }; 430 431})(jQuery); 432 433/* 434Plugin Name: smoothScroll for jQuery. 435Written by: Okler Themes - (http://www.okler.net) 436Version: 3.1.0 437 438Based on: 439 440 SmoothScroll v1.2.1 441 Licensed under the terms of the MIT license. 442 443 People involved 444 - Balazs Galambosi (maintainer) 445 - Patrick Brunner (original idea) 446 - Michael Herf (Pulse Algorithm) 447 448*/ 449 450(function($) { 451 $.extend({ 452 453 smoothScroll: function() { 454 455 // Scroll Variables (tweakable) 456 var defaultOptions = { 457 458 // Scrolling Core 459 frameRate : 60, // [Hz] 460 animationTime : 700, // [px] 461 stepSize : 120, // [px] 462 463 // Pulse (less tweakable) 464 // ratio of "tail" to "acceleration" 465 pulseAlgorithm : true, 466 pulseScale : 10, 467 pulseNormalize : 1, 468 469 // Acceleration 470 accelerationDelta : 20, // 20 471 accelerationMax : 1, // 1 472 473 // Keyboard Settings 474 keyboardSupport : true, // option 475 arrowScroll : 50, // [px] 476 477 // Other 478 touchpadSupport : true,
479 fixedBackground : true, 480 excluded : "" 481 }; 482 483 var options = defaultOptions; 484 485 // Other Variables 486 var isExcluded = false; 487 var isFrame = false; 488 var direction = { x: 0, y: 0 }; 489 var initDone = false; 490 var root = document.documentElement; 491 var activeElement; 492 var observer; 493 var deltaBuffer = [ 120, 120, 120 ]; 494 495 var key = { left: 37, up: 38, right: 39, down: 40, spacebar: 32, 496 pageup: 33, pagedown: 34, end: 35, home: 36 }; 497 498 499 /*********************************************** 500 * INITIALIZE 501 ***********************************************/ 502 503 /** 504 * Tests if smooth scrolling is allowed. Shuts down everything if not. 505 */ 506 function initTest() { 507 508 var disableKeyboard = false; 509 510 // disable keys for google reader (spacebar conflict) 511 if (document.URL.indexOf("google.com/reader/view") > -1) { 512 disableKeyboard = true; 513 } 514 515 // disable everything if the page is blacklisted 516 if (options.excluded) { 517 var domains = options.excluded.split(/[,\n] ?/); 518 domains.push("mail.google.com"); // exclude Gmail for now 519 for (var i = domains.length; i--;) { 520 if (document.URL.indexOf(domains[i]) > -1) { 521 observer && observer.disconnect(); 522 removeEvent("mousewheel", wheel); 523 disableKeyboard = true; 524 isExcluded = true; 525 break; 526 } 527 } 528 } 529 530 // disable keyboard support if anything above requested it 531 if (disableKeyboard) { 532 removeEvent("keydown", keydown); 533 } 534 535 if (options.keyboardSupport && !disableKeyboard) { 536 addEvent("keydown", keydown); 537 } 538 } 539 540 /** 541 * Sets up scrolls array, determines if frames are involved. 542 */ 543 function init() { 544 545 if (!document.body) return; 546 547 var body = document.body; 548 var html = document.documentElement; 549 var windowHeight = window.innerHeight; 550 var scrollHeight = body.scrollHeight; 551 552 // check compat mode for root element 553 root = (document.compatMode.indexOf('CSS') >= 0) ? html : body; 554 activeElement = body; 555 556 initTest(); 557 initDone = true; 558 559 // Checks if this script is running in a frame 560 if (top != self) { 561 isFrame = true; 562 } 563 564 /** 565 * This fixes a bug where the areas left and right to 566 * the content does not trigger the onmousewheel event 567 * on some pages. e.g.: html, body { height: 100% } 568 */ 569 else if (scrollHeight > windowHeight && 570 (body.offsetHeight <= windowHeight || 571 html.offsetHeight <= windowHeight)) { 572 573 // DOMChange (throttle): fix height 574 var pending = false; 575 var refresh = function () { 576 if (!pending && html.scrollHeight != document.height) { 577 pending = true; // add a new pending action 578 setTimeout(function () { 579 html.style.height = document.height + 'px'; 580 pending = false; 581 }, 500); // act rarely to stay fast 582 } 583 }; 584 html.style.height = 'auto'; 585 setTimeout(refresh, 10); 586 587 var config = { 588 attributes: true, 589 childList: true, 590 characterData: false 591 }; 592 593 observer = new MutationObserver(refresh); 594 observer.observe(body, config); 595 596 // clearfix 597 if (root.offsetHeight <= windowHeight) { 598 var underlay = document.createElement("div"); 599 underlay.style.clear = "both"; 600 body.appendChild(underlay); 601 } 602 } 603 604 // gmail performance fix 605 if (document.URL.indexOf("mail.google.com") > -1) { 606 var s = document.createElement("style"); 607 s.innerHTML = ".iu { visibility: hidden }"; 608 (document.getElementsByTagName("head")[0] || html).appendChild(s); 609 } 610 // facebook better home timeline performance 611 // all the HTML resized images make rendering CPU intensive 612 else if (document.URL.indexOf("www.facebook.com") > -1) { 613 var home_stream = document.getElementById("home_stream"); 614 home_stream && (home_stream.style.webkitTransform = "translateZ(0)"); 615 } 616 // disable fixed background
617 if (!options.fixedBackground && !isExcluded) { 618 body.style.backgroundAttachment = "scroll"; 619 html.style.backgroundAttachment = "scroll"; 620 } 621 } 622 623 624 /************************************************ 625 * SCROLLING 626 ************************************************/ 627 628 var que = []; 629 var pending = false; 630 var lastScroll = +new Date; 631 632 /** 633 * Pushes scroll actions to the scrolling queue. 634 */ 635 function scrollArray(elem, left, top, delay) { 636 637 delay || (delay = 1000); 638 directionCheck(left, top); 639 640 if (options.accelerationMax != 1) { 641 var now = +new Date; 642 var elapsed = now - lastScroll; 643 if (elapsed < options.accelerationDelta) { 644 var factor = (1 + (30 / elapsed)) / 2; 645 if (factor > 1) { 646 factor = Math.min(factor, options.accelerationMax); 647 left *= factor; 648 top *= factor; 649 } 650 } 651 lastScroll = +new Date; 652 } 653 654 // push a scroll command 655 que.push({ 656 x: left, 657 y: top, 658 lastX: (left < 0) ? 0.99 : -0.99, 659 lastY: (top < 0) ? 0.99 : -0.99, 660 start: +new Date 661 }); 662 663 // don't act if there's a pending queue 664 if (pending) { 665 return; 666 } 667 668 var scrollWindow = (elem === document.body); 669 670 var step = function (time) { 671 672 var now = +new Date; 673 var scrollX = 0; 674 var scrollY = 0; 675 676 for (var i = 0; i < que.length; i++) { 677 678 var item = que[i]; 679 var elapsed = now - item.start; 680 var finished = (elapsed >= options.animationTime); 681 682 // scroll position: [0, 1] 683 var position = (finished) ? 1 : elapsed / options.animationTime; 684 685 // easing [optional] 686 if (options.pulseAlgorithm) { 687 position = pulse(position); 688 } 689 690 // only need the difference 691 var x = (item.x * position - item.lastX) >> 0; 692 var y = (item.y * position - item.lastY) >> 0; 693 694 // add this to the total scrolling 695 scrollX += x; 696 scrollY += y; 697 698 // update last values 699 item.lastX += x; 700 item.lastY += y; 701 702 // delete and step back if it's over 703 if (finished) { 704 que.splice(i, 1); i--; 705 } 706 } 707 708 // scroll left and top 709 if (scrollWindow) { 710 window.scrollBy(scrollX, scrollY); 711 } 712 else { 713 if (scrollX) elem.scrollLeft += scrollX; 714 if (scrollY) elem.scrollTop += scrollY; 715 } 716 717 // clean up if there's nothing left to do 718 if (!left && !top) { 719 que = []; 720 } 721 722 if (que.length) { 723 requestFrame(step, elem, (delay / options.frameRate + 1)); 724 } else { 725 pending = false; 726 } 727 }; 728 729 // start a new queue of actions 730 requestFrame(step, elem, 0); 731 pending = true; 732 } 733 734 735 /*********************************************** 736 * EVENTS 737 ***********************************************/ 738 739 /** 740 * Mouse wheel handler. 741 * @param {Object} event 742 */ 743 function wheel(event) { 744 745 if (!initDone) { 746 init(); 747 } 748 749 var target = event.target; 750 var overflowing = overflowingAncestor(target); 751 752 // use default if there's no overflowing 753 // element or default action is prevented 754 if (!overflowing || event.defaultPrevented || 755 isNodeName(activeElement, "embed") || 756 (isNodeName(target, "embed") && /\.pdf/i.test(target.src))) { 757 return true; 758 } 759 760 var deltaX = event.wheelDeltaX || 0; 761 var deltaY = event.wheelDeltaY || 0; 762 763 // use wheelDelta if deltaX/Y is not available 764 if (!deltaX && !deltaY) { 765 deltaY = event.wheelDelta || 0; 766 } 767 768 // check if it's a touchpad scroll that should be ignored 769 if (!options.touchpadSupport && isTouchpad(deltaY)) { 770 return true; 771 } 772 773 // scale by step size 774 // delta is 120 most of the time 775 // synaptics seems to send 1 sometimes 776 if (Math.abs(deltaX) > 1.2) { 777 deltaX *= options.stepSize / 120; 778 } 779 if (Math.abs(deltaY) > 1.2) { 780 deltaY *= options.stepSize / 120; 781 } 782 783 scrollArray(overflowing, -deltaX, -deltaY); 784 event.preventDefault(); 785 } 786 787 /** 788 * Keydown event handler. 789 * @param {Object} event 790 */ 791 function keydown(event) { 792 793 var target = event.target; 794 var modifier = event.ctrlKey || event.altKey || event.metaKey || 795 (event.shiftKey && event.keyCode !== key.spacebar); 796 797 // do nothing if user is editing text 798 // or using a modifier key (except shift) 799 // or in a dropdown
800 if ( /input|textarea|select|embed/i.test(target.nodeName) || 801 target.isContentEditable || 802 event.defaultPrevented || 803 modifier ) { 804 return true; 805 } 806 // spacebar should trigger button press 807 if (isNodeName(target, "button") && 808 event.keyCode === key.spacebar) { 809 return true; 810 } 811 812 var shift, x = 0, y = 0; 813 var elem = overflowingAncestor(activeElement); 814 var clientHeight = elem.clientHeight; 815 816 if (elem == document.body) { 817 clientHeight = window.innerHeight; 818 } 819 820 switch (event.keyCode) { 821 case key.up: 822 y = -options.arrowScroll; 823 break; 824 case key.down: 825 y = options.arrowScroll; 826 break; 827 case key.spacebar: // (+ shift) 828 shift = event.shiftKey ? 1 : -1; 829 y = -shift * clientHeight * 0.9; 830 break; 831 case key.pageup: 832 y = -clientHeight * 0.9; 833 break; 834 case key.pagedown: 835 y = clientHeight * 0.9; 836 break; 837 case key.home: 838 y = -elem.scrollTop; 839 break; 840 case key.end: 841 var damt = elem.scrollHeight - elem.scrollTop - clientHeight; 842 y = (damt > 0) ? damt+10 : 0; 843 break; 844 case key.left: 845 x = -options.arrowScroll; 846 break; 847 case key.right: 848 x = options.arrowScroll; 849 break; 850 default: 851 return true; // a key we don't care about 852 } 853 854 scrollArray(elem, x, y); 855 event.preventDefault(); 856 } 857 858 /** 859 * Mousedown event only for updating activeElement 860 */ 861 function mousedown(event) { 862 activeElement = event.target; 863 } 864 865 866 /*********************************************** 867 * OVERFLOW 868 ***********************************************/ 869 870 var cache = {}; // cleared out every once in while 871 setInterval(function () { cache = {}; }, 10 * 1000); 872 873 var uniqueID = (function () { 874 var i = 0; 875 return function (el) { 876 return el.uniqueID || (el.uniqueID = i++); 877 }; 878 })(); 879 880 function setCache(elems, overflowing) { 881 for (var i = elems.length; i--;) 882 cache[uniqueID(elems[i])] = overflowing; 883 return overflowing; 884 } 885 886 function overflowingAncestor(el) { 887 var elems = []; 888 var rootScrollHeight = root.scrollHeight; 889 do { 890 var cached = cache[uniqueID(el)]; 891 if (cached) { 892 return setCache(elems, cached); 893 } 894 elems.push(el); 895 if (rootScrollHeight === el.scrollHeight) { 896 if (!isFrame || root.clientHeight + 10 < rootScrollHeight) { 897 return setCache(elems, document.body); // scrolling root in WebKit 898 } 899 } else if (el.clientHeight + 10 < el.scrollHeight) { 900 overflow = getComputedStyle(el, "").getPropertyValue("overflow-y"); 901 if (overflow === "scroll" || overflow === "auto") { 902 return setCache(elems, el); 903 } 904 } 905 } while (el = el.parentNode); 906 } 907 908 909 /*********************************************** 910 * HELPERS 911 ***********************************************/ 912 913 function addEvent(type, fn, bubble) { 914 window.addEventListener(type, fn, (bubble||false)); 915 } 916 917 function removeEvent(type, fn, bubble) { 918 window.removeEventListener(type, fn, (bubble||false)); 919 } 920 921 function isNodeName(el, tag) { 922 return (el.nodeName||"").toLowerCase() === tag.toLowerCase(); 923 } 924 925 function directionCheck(x, y) { 926 x = (x > 0) ? 1 : -1; 927 y = (y > 0) ? 1 : -1; 928 if (direction.x !== x || direction.y !== y) { 929 direction.x = x; 930 direction.y = y; 931 que = []; 932 lastScroll = 0; 933 } 934 } 935 936 var deltaBufferTimer; 937 938 function isTouchpad(deltaY) { 939 if (!deltaY) return; 940 deltaY = Math.abs(deltaY) 941 deltaBuffer.push(deltaY); 942 deltaBuffer.shift(); 943 clearTimeout(deltaBufferTimer); 944 var allEquals = (deltaBuffer[0] == deltaBuffer[1] && 945 deltaBuffer[1] == deltaBuffer[2]); 946 var allDivisable = (isDivisible(deltaBuffer[0], 120) && 947 isDivisible(deltaBuffer[1], 120) && 948 isDivisible(deltaBuffer[2], 120)); 949 return !(allEquals || allDivisable); 950 } 951 952 function isDivisible(n, divisor) { 953 return (Math.floor(n / divisor) == n / divisor); 954 } 955 956 var requestFrame = (function () { 957 return window.requestAnimationFrame || 958 window.webkitRequestAnimationFrame || 959 function (callback, element, delay) { 960 window.setTimeout(callback, delay || (1000/60)); 961 }; 962 })(); 963 964 var MutationObserver = window.MutationObserver || window.WebKitMutationObserver; 965 966 967 /*********************************************** 968 * PULSE 969 ***********************************************/ 970 971 /** 972 * Viscous fluid with a pulse for part and decay for the rest. 973 * - Applies a fixed force over an interval (a damped acceleration), and 974 * - Lets the exponential bleed away the velocity over a longer interval 975 * - Michael Herf, http://stereopsis.com/stopping/ 976 */ 977 function pulse_(x) { 978 var val, start, expx; 979 // test 980 x = x * options.pulseScale; 981 if (x < 1) { // acceleartion 982 val = x - (1 - Math.exp(-x)); 983 } else { // tail 984 // the previous animation ended here: 985 start = Math.exp(-1); 986 // simple viscous drag 987 x -= 1; 988 expx = 1 - Math.exp(-x); 989 val = start + (expx * (1 - start)); 990 }
991 return val * options.pulseNormalize; 992 } 993 994 function pulse(x) { 995 if (x >= 1) return 1; 996 if (x <= 0) return 0; 997 998 if (options.pulseNormalize == 1) { 999 options.pulseNormalize /= pulse_(1); 1000 } 1001 return pulse_(x); 1002 } 1003 1004 addEvent("mousedown", mousedown); 1005 addEvent("mousewheel", wheel); 1006 addEvent("load", init); 1007 1008 } 1009 1010 }); 1011})(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.