1(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){ 2"use strict"; 3 4var ready = require('domready'), 5 menu = require('./menu'), 6 offcanvas = require('./offcanvas'), 7 totop = require('./totop'), 8 $ = require('./utils/dollar-extras'), 9 10 instances = {}; 11 12ready(function() { 13 instances = { 14 offcanvas: new offcanvas(), 15 menu: new menu(), 16 $: $, 17 ready: ready 18 }; 19 20 module.exports = window.G5 = instances; 21}); 22 23module.exports = window.G5 = instances; 24 25},{"./menu":2,"./offcanvas":3,"./totop":4,"./utils/dollar-extras":6,"domready":7}],2:[function(require,module,exports){ 26(function (global){(function (){ 27"use strict"; 28 29var ready = require('domready'), 30 prime = require('prime'), 31 $ = require('../utils/dollar-extras'), 32 zen = require('elements/zen'), 33 bind = require('mout/function/bind'), 34 timeout = require('mout/function/timeout'), 35 Bound = require('prime-util/prime/bound'), 36 Options = require('prime-util/prime/options'); 37 38 39var hasTouchEvents = ('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch; 40 41var Menu = new prime({ 42 43 mixin: [Bound, Options], 44 45 options: { 46 selectors: { 47 mainContainer: '.g-main-nav', 48 mobileContainer: '#g-mobilemenu-container', 49 topLevel: '.g-toplevel', 50 rootItems: '> ul > li', 51 parent: '.g-parent', 52 item: '.g-menu-item', 53 dropdown: '.g-dropdown', 54 overlay: '.g-menu-overlay', 55 touchIndicator: '.g-menu-parent-indicator', 56 linkedParent: '[data-g-menuparent]', 57 mobileTarget: '[data-g-mobile-target]' 58 }, 59 60 states: { 61 active: 'g-active', 62 inactive: 'g-inactive', 63 selected: 'g-selected', 64 touchEvents: 'g-menu-hastouch' 65 } 66 }, 67 68 constructor: function(options) { 69 this.setOptions(options); 70 71 this.selectors = this.options.selectors; 72 this.states = this.options.states; 73 this.overlay = zen('div' + this.selectors.overlay); 74 this.active = null; 75 this.location = []; 76 77 var pageSurround = $('#g-page-surround'); 78 if (pageSurround) { 79 this.overlay.top(pageSurround); 80 } 81 82 var mainContainer = $(this.selectors.mainContainer); 83 if (!mainContainer) { return; } 84 85 var gHoverExpand = mainContainer.data('g-hover-expand'); 86 87 this.hoverExpand = gHoverExpand === null || gHoverExpand === 'true'; 88 if (hasTouchEvents || !this.hoverExpand) { 89 mainContainer.addClass(this.states.touchEvents); 90 } 91 92 this.attach(); 93 }, 94 95 attach: function() { 96 var selectors = this.selectors, 97 main = $(selectors.mainContainer + ' ' + selectors.item), 98 mobileContainer = $(selectors.mobileContainer), 99 body = $('body'); 100 101 if (!main) { return; } 102 if (this.hoverExpand) { 103 main.on('mouseenter', this.bound('mouseenter')); 104 main.on('mouseleave', this.bound('mouseleave')); 105 } 106 107 body.delegate('click', ':not(' + selectors.mainContainer + ') ' + selectors.linkedParent + ', .g-fullwidth .g-sublevel ' + selectors.linkedParent, this.bound('click')); 108 body.delegate('click', ':not(' + selectors.mainContainer + ') a[href]', this.bound('resetAfterClick')); 109 110 if (hasTouchEvents || !this.hoverExpand) { 111 var linkedParent = $(selectors.linkedParent); 112 if (linkedParent) { 113 linkedParent.on('touchmove', this.bound('touchmove')); 114 linkedParent.on('touchend', this.bound('touchend')); 115 } 116 this.overlay.on('touchend', this.bound('closeAllDropdowns')); 117 } 118 119 if (mobileContainer) { 120 var query = 'only all and (max-width: ' + this._calculateBreakpoint((mobileContainer.data('g-menu-breakpoint') || '48rem')) + ')', 121 match = matchMedia(query); 122 match.addListener(this.bound('_checkQuery')); 123 this._checkQuery(match); 124 } 125 }, 126 127 detach: function() {}, 128 129 click: function(event) { 130 this.touchend(event); 131 }, 132 133 resetAfterClick: function(event) { 134 var target = $(event.target); 135 136 if (target.data('g-menuparent') !== null) { 137 return true; 138 } 139 140 this.closeDropdown(event); 141 if (global.G5 && global.G5.offcanvas) { 142 G5.offcanvas.close(); 143 } 144 }, 145 146 mouseenter: function(event) { 147 var element = $(event.target); 148 if (!element.parent(this.options.selectors.mainContainer)) { return; } 149 if (element.parent(this.options.selectors.item) && !element.parent('.g-standard')) { return; } 150 151 this.openDropdown(element); 152 }, 153 154 mouseleave: function(event) { 155 var element = $(event.target); 156 if (!element.parent(this.options.selectors.mainContainer)) { return; } 157 if (element.parent(this.options.selectors.item) && !element.parent('.g-standard')) { return; } 158 159 this.closeDropdown(element); 160 }, 161 162 touchmove: function(event) { 163 var target = $(event.target); 164 target.isMoving = true; 165 }, 166 167 touchend: function(event) { 168 var selectors = this.selectors, 169 states = this.states; 170 171 var target = $(event.target), 172 indicator = target.parent(selectors.item).find(selectors.touchIndicator), 173 menuType = target.parent('.g-standard') ? 'standard' : 'megamenu', 174 isGoingBack = target.parent('.g-go-back'), 175 parent, isSelected; 176 177 if (target.isMoving) { 178 target.isMoving = false;
179 return false; 180 } 181 182 target.off('touchmove', this.bound('touchmove')); 183 target.isMoving = false; 184 185 if (indicator) { 186 target = indicator; 187 } 188 189 parent = target.matches(selectors.item) ? target : target.parent(selectors.item); 190 isSelected = parent.hasClass(states.selected); 191 192 if (!parent.find(selectors.dropdown) && !indicator) { return true; } 193 194 event.stopPropagation(); 195 if (!indicator || target.matches(selectors.touchIndicator)) { 196 event.preventDefault(); 197 } 198 199 if (!isSelected) { 200 var siblings = parent.siblings(); 201 if (siblings) { 202 var currentlyOpen = siblings.search(selectors.touchIndicator + ' !> * !> ' + selectors.item + '.' + states.selected); 203 (currentlyOpen || []).forEach(bind(function(open) { 204 this.closeDropdown(open); 205 }, this)); 206 } 207 } 208 209 if ((menuType == 'megamenu' || !parent.parent(selectors.mainContainer)) && (parent.find(' > ' + selectors.dropdown + ', > * > ' + selectors.dropdown) || isGoingBack)) { 210 var sublevel = target.parent('.g-sublevel') || target.parent('.g-toplevel'), 211 slideout = parent.find('.g-sublevel'), 212 columns = parent.parent('.g-dropdown-column'), 213 blocks; 214 215 if (sublevel) { 216 var isNavMenu = target.parent(selectors.mainContainer); 217 if (!isNavMenu || (isNavMenu && !sublevel.matches('.g-toplevel'))) { this._fixHeights(sublevel, slideout, isGoingBack, isNavMenu); } 218 if (!isNavMenu && columns && (blocks = columns.search('> .g-grid > .g-block'))) { 219 if (blocks.length > 1) { sublevel = blocks.search('> .g-sublevel'); } 220 } 221 222 sublevel[!isSelected ? 'addClass' : 'removeClass']('g-slide-out'); 223 } 224 } 225 226 this[!isSelected ? 'openDropdown' : 'closeDropdown'](parent); 227 if (event.type !== 'click') { this.toggleOverlay(target.parent(selectors.mainContainer)); } 228 }, 229 230 openDropdown: function(element) { 231 element = $(element.target || element); 232 var dropdown = element.find(this.selectors.dropdown); 233 234 element.addClass(this.states.selected); 235 236 if (dropdown) { 237 dropdown.removeClass(this.states.inactive).addClass(this.states.active); 238 } 239 }, 240 241 closeDropdown: function(element) { 242 element = $(element.target || element); 243 var dropdown = element.find(this.selectors.dropdown); 244 245 element.removeClass(this.states.selected); 246 247 if (dropdown) { 248 var sublevels = dropdown.search('.g-sublevel'), 249 slideouts = dropdown.search('.g-slide-out, .' + this.states.selected), 250 actives = dropdown.search('.' + this.states.active); 251 252 if (sublevels) { sublevels.attribute('style', null); } 253 if (slideouts) { slideouts.removeClass('g-slide-out').removeClass(this.states.selected); } 254 if (actives) { actives.removeClass(this.states.active).addClass(this.states.inactive); } 255 256 dropdown.removeClass(this.states.active).addClass(this.states.inactive); 257 } 258 }, 259 260 closeAllDropdowns: function() { 261 var selectors = this.selectors, 262 states = this.states, 263 topLevel = $(selectors.mainContainer + ' > .g-toplevel'), 264 roots = topLevel.search(' >' + selectors.item); 265 266 if (roots) { roots.removeClass(states.selected); } 267 if (topLevel) { 268 var allRoots = topLevel.search('> ' + this.options.selectors.item); 269 if (allRoots) { allRoots.forEach(this.closeDropdown.bind(this)); } 270 this.closeDropdown(topLevel); 271 } 272 273 this.toggleOverlay(topLevel); 274 }, 275 276 resetStates: function(menu) { 277 if (!menu) { return; } 278 var items = menu.search('.g-toplevel, .g-dropdown-column, .g-dropdown, .g-selected, .g-active, .g-slide-out'), 279 actives = menu.search('.g-active'); 280 if (!items) { return; } 281 282 menu.attribute('style', null).removeClass('g-selected').removeClass('g-slide-out'); 283 items.attribute('style', null).removeClass('g-selected').removeClass('g-slide-out'); 284 if (actives) { actives.removeClass('g-active').addClass('g-inactive'); } 285 }, 286 287 toggleOverlay: function(menu) { 288 if (!menu) { return; } 289 var shouldOpen = !!menu.find('.g-active, .g-selected'); 290 291 this.overlay[shouldOpen ? 'addClass' : 'removeClass']('g-menu-overlay-open'); 292 this.overlay[0].style.opacity = shouldOpen ? 1 : 0; 293 }, 294 295 _fixHeights: function(parent, sublevel, isGoingBack, isNavMenu) { 296 if (parent == sublevel) { return; } 297 if (isGoingBack) { 298 parent.attribute('style', null); 299 } 300 301 var parents, heights = { 302 from: parent[0].getBoundingClientRect(), 303 to: (!isNavMenu ? sublevel.parent('.g-dropdown')[0] : sublevel[0]).getBoundingClientRect() 304 }, 305 height = Math.max(heights.from.height, heights.to.height); 306 307 if (isGoingBack) { 308 parents = parent.parents('[style^="height"]');
309 (parents || []).forEach(function(element) { 310 element = $(element); 311 if (element.parent('.g-toplevel')) { 312 element[0].style.height = heights.from.height + 'px'; 313 } 314 }); 315 } 316 317 if (!isGoingBack) { 318 // if from height is < than to height set the parent height else, set the target 319 if (heights.from.height < heights.to.height) { 320 parent[0].style.height = height + 'px'; 321 322 parents = parent.parents('[style^="height"]'); 323 (parents || []).forEach(function(element) { 324 element = $(element); 325 if (element.parent('.g-toplevel')) { 326 element[0].style.height = height + 'px'; 327 } 328 }); 329 } else if (isNavMenu) { 330 sublevel[0].style.height = height + 'px'; 331 } 332 333 // fix sublevels heights in side menu (offcanvas etc) 334 if (!isNavMenu) { 335 var maxHeight = height, 336 block = $(sublevel).parent('.g-block:not(.size-100)'), 337 column = block ? block.parent('.g-dropdown-column') : null; 338 (sublevel.parents('.g-slide-out, .g-dropdown-column') || parent).forEach(function(slideout) { 339 maxHeight = Math.max(height, parseInt(slideout.style.height || 0, 10)); 340 }); 341 342 if (column) { 343 column[0].style.height = maxHeight + 'px'; 344 345 var blocks = column.search('> .g-grid > .g-block'), 346 diff = maxHeight; 347 348 blocks.forEach(function(block, i) { 349 if ((i + 1) != blocks.length) { 350 diff -= block.getBoundingClientRect().height; 351 } else { 352 $(block).find('.g-sublevel')[0].style.height = diff + 'px'; 353 } 354 }); 355 356 357 } else { 358 sublevel[0].style.height = maxHeight + 'px'; 359 } 360 } 361 } 362 }, 363 364 _calculateBreakpoint: function(value) { 365 var digit = parseFloat(value.match(/^\d{1,}/).shift()), 366 unit = value.match(/[a-z]{1,}$/i).shift(), 367 tolerance = unit.match(/r?em/) ? -0.062 : -1; 368 369 return (digit + tolerance) + unit; 370 }, 371 372 _checkQuery: function(mq) { 373 var selectors = this.options.selectors, 374 mobileContainer = $(selectors.mobileContainer), 375 mainContainer = $(selectors.mainContainer + selectors.mobileTarget) || $(selectors.mainContainer), 376 find, dropdowns; 377 378 if (mq.matches) { 379 // move to Mobile Container 380 find = mainContainer.find(selectors.topLevel); 381 if (find) { 382 mainContainer.parent('.g-block').addClass('hidden'); 383 mobileContainer.parent('.g-block').removeClass('hidden'); 384 find.top(mobileContainer); 385 } 386 } else { 387 // move back to Original Location 388 find = mobileContainer.find(selectors.topLevel); 389 if (find) { 390 mobileContainer.parent('.g-block').addClass('hidden'); 391 mainContainer.parent('.g-block').removeClass('hidden'); 392 find.top(mainContainer); 393 } 394 } 395 396 this.resetStates(find); 397 398 // we need to reintroduce fixed widths for those dropdowns that come with it 399 if (!mq.matches && (find && (dropdowns = find.search('[data-g-item-width]')))) { 400 dropdowns.forEach(function(dropdown) { 401 dropdown = $(dropdown); 402 dropdown[0].style.width = dropdown.data('g-item-width'); 403 }); 404 } 405 }, 406 407 _debug: function() {} 408}); 409 410module.exports = Menu; 411 412}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) 413 414},{"../utils/dollar-extras":6,"domready":7,"elements/zen":36,"mout/function/bind":40,"mout/function/timeout":44,"prime":85,"prime-util/prime/bound":81,"prime-util/prime/options":82}],3:[function(require,module,exports){ 415// Offcanvas slide with desktop, touch and all-in-one touch devices support that supports both left and right placement. 416// Fast and optimized using CSS3 transitions 417// Based on the awesome Slideout.js <https://mango.github.io/slideout/> 418 419"use strict"; 420 421var ready = require('domready'), 422 prime = require('prime'), 423 bind = require('mout/function/bind'),
424 forEach = require('mout/array/forEach'), 425 mapNumber = require('mout/math/map'), 426 clamp = require('mout/math/clamp'), 427 timeout = require('mout/function/timeout'), 428 trim = require('mout/string/trim'), 429 decouple = require('../utils/decouple'), 430 Bound = require('prime-util/prime/bound'), 431 Options = require('prime-util/prime/options'), 432 $ = require('elements'), 433 zen = require('elements/zen'); 434 435// thanks David Walsh 436var prefix = (function() { 437 var styles = window.getComputedStyle(document.documentElement, ''), 438 pre = (Array.prototype.slice.call(styles).join('') 439 .match(/-(moz|webkit|ms)-/) || (styles.OLink === '' && ['', 'o']) 440 )[1], 441 dom = ('WebKit|Moz|MS|O').match(new RegExp('(' + pre + ')', 'i'))[1]; 442 return { 443 dom: dom, 444 lowercase: pre, 445 css: '-' + pre + '-', 446 js: pre[0].toUpperCase() + pre.substr(1) 447 }; 448})(); 449 450var hasTouchEvents = ('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch, 451 isScrolling = false, scrollTimeout; 452 453var Offcanvas = new prime({ 454 455 mixin: [Bound, Options], 456 457 options: { 458 effect: 'ease', 459 duration: 300, 460 tolerance: function(padding) { // tolerance can also be just an integer value 461 return padding / 3; 462 }, 463 padding: 0, 464 touch: true, 465 css3: true, 466 467 openClass: 'g-offcanvas-open', 468 openingClass: 'g-offcanvas-opening', 469 closingClass: 'g-offcanvas-closing', 470 overlayClass: 'g-nav-overlay' 471 }, 472 473 constructor: function(options) { 474 this.setOptions(options); 475 476 this.attached = false; 477 this.opening = false; 478 this.moved = false; 479 this.dragging = false; 480 this.opened = false; 481 this.preventOpen = false; 482 this.offset = { 483 x: { 484 start: 0, 485 current: 0 486 }, 487 y: { 488 start: 0, 489 current: 0 490 } 491 }; 492 493 this.bodyEl = $('body'); 494 this.htmlEl = $('html'); 495 496 this.panel = $('#g-page-surround'); 497 this.offcanvas = $('#g-offcanvas'); 498 499 if (!this.panel || !this.offcanvas) { return false; } 500 501 var swipe = this.offcanvas.data('g-offcanvas-swipe'), 502 css3 = this.offcanvas.data('g-offcanvas-css3'); 503 this.setOptions({ touch: !!(swipe !== null ? parseInt(swipe) : 1), css3: !!(css3 !== null ? parseInt(css3) : 1) }); 504 505 if (!this.options.padding) { 506 this.offcanvas[0].style.display = 'block'; 507 var width = this.offcanvas[0].getBoundingClientRect().width; 508 this.offcanvas[0].style.removeProperty('display'); 509 510 this.setOptions({ padding: width }); 511 } 512 513 this.tolerance = typeof this.options.tolerance == 'function' ? this.options.tolerance.call(this, this.options.padding) : this.options.tolerance; 514 515 this.htmlEl.addClass('g-offcanvas-' + (this.options.css3 ? 'css3' : 'css2')); 516 517 this.attach(); 518 this._checkTogglers(); 519 520 return this; 521 }, 522 523 attach: function() { 524 this.attached = true; 525 526 if (this.options.touch && hasTouchEvents) { 527 this.attachTouchEvents(); 528 } 529 530 forEach(['toggle', 'open', 'close'], bind(function(mode) { 531 this.bodyEl.delegate('click', '[data-offcanvas-' + mode + ']', this.bound(mode)); 532 if (hasTouchEvents) { this.bodyEl.delegate('touchend', '[data-offcanvas-' + mode + ']', this.bound(mode)); } 533 }, this)); 534 535 this.attachMutationEvent(); 536 537 this.overlay = zen('div[data-offcanvas-close].' + this.options.overlayClass).top(this.panel); 538 539 return this; 540 }, 541 542 attachMutationEvent: function () { 543 this.observer = new MutationObserver(() => { 544 this._checkTogglers(); 545 }); 546 this.observer.observe(this.offcanvas[0], { 547 childList: true, 548 subtree: true, 549 }); 550 }, 551 552 attachTouchEvents: function() { 553 var msPointerSupported = window.navigator.msPointerEnabled, 554 touch = { 555 start: msPointerSupported ? 'MSPointerDown' : 'touchstart', 556 move: msPointerSupported ? 'MSPointerMove' : 'touchmove', 557 end: msPointerSupported ? 'MSPointerUp' : 'touchend' 558 }; 559 560 this._scrollBound = decouple(window, 'scroll', this.bound('_bodyScroll')); 561 this.bodyEl.on(touch.move, this.bound('_bodyMove')); 562 this.panel.on(touch.start, this.bound('_touchStart')); 563 this.panel.on('touchcancel', this.bound('_touchCancel')); 564 this.panel.on(touch.end, this.bound('_touchEnd')); 565 this.panel.on(touch.move, this.bound('_touchMove')); 566 }, 567 568 detach: function() { 569 this.attached = false;
570 571 if (this.options.touch && hasTouchEvents) { 572 this.detachTouchEvents(); 573 } 574 575 forEach(['toggle', 'open', 'close'], bind(function(mode) { 576 this.bodyEl.undelegate('click', '[data-offcanvas-' + mode + ']', this.bound(mode)); 577 if (hasTouchEvents) { this.bodyEl.undelegate('touchend', '[data-offcanvas-' + mode + ']', this.bound(mode)); } 578 }, this)); 579 580 this.detachMutationEvent(); 581 this.overlay.remove(); 582 583 return this; 584 }, 585 586 detachMutationEvent: function () { 587 this.observer.disconnect(); 588 }, 589 590 detachTouchEvents: function() { 591 var msPointerSupported = window.navigator.msPointerEnabled, 592 touch = { 593 start: msPointerSupported ? 'MSPointerDown' : 'touchstart', 594 move: msPointerSupported ? 'MSPointerMove' : 'touchmove', 595 end: msPointerSupported ? 'MSPointerUp' : 'touchend' 596 }; 597 598 window.removeEventListener('scroll', this._scrollBound); 599 this.bodyEl.off(touch.move, this.bound('_bodyMove')); 600 this.panel.off(touch.start, this.bound('_touchStart')); 601 this.panel.off('touchcancel', this.bound('_touchCancel')); 602 this.panel.off(touch.end, this.bound('_touchEnd')); 603 this.panel.off(touch.move, this.bound('_touchMove')); 604 }, 605 606 607 open: function(event) { 608 if (event && event.type.match(/^touch/i)) { event.preventDefault(); } 609 else { this.dragging = false; } 610 611 if (this.opened) { return this; } 612 613 this.htmlEl.addClass(this.options.openClass); 614 this.htmlEl.addClass(this.options.openingClass); 615 616 this.overlay[0].style.opacity = 1; 617 618 if (this.options.css3) { 619 // for translate3d 620 this.panel[0].style[this.getOffcanvasPosition()] = 'inherit'; 621 } 622 623 this._setTransition(); 624 this._translateXTo((this.bodyEl.hasClass('g-offcanvas-right') ? -1 : 1) * this.options.padding); 625 this.opened = true; 626 627 setTimeout(bind(function() { 628 var panel = this.panel[0]; 629 630 this.htmlEl.removeClass(this.options.openingClass); 631 this.offcanvas.attribute('aria-expanded', true); 632 $('[data-offcanvas-toggle]').attribute('aria-expanded', true); 633 panel.style.transition = panel.style[prefix.css + 'transition'] = ''; 634 }, this), this.options.duration); 635 636 return this; 637 }, 638 639 close: function(event, element) { 640 if (event && event.type.match(/^touch/i)) { event.preventDefault(); } 641 else { this.dragging = false; } 642 643 element = element || window; 644 645 if (!this.opened && !this.opening) { return this; } 646 if (this.panel !== element && this.dragging) { return false; } 647 648 this.htmlEl.addClass(this.options.closingClass); 649 650 this.overlay[0].style.opacity = 0; 651 652 this._setTransition(); 653 this._translateXTo(0); 654 this.opened = false; 655 this.offcanvas.attribute('aria-expanded', false); 656 $('[data-offcanvas-toggle]').attribute('aria-expanded', false); 657 658 setTimeout(bind(function() { 659 var panel = this.panel[0]; 660 661 this.htmlEl.removeClass(this.options.openClass); 662 this.htmlEl.removeClass(this.options.closingClass); 663 panel.style.transition = panel.style[prefix.css + 'transition'] = ''; 664 panel.style.transform = panel.style[prefix.css + 'transform'] = ''; 665 panel.style[this.getOffcanvasPosition()] = ''; 666 }, this), this.options.duration); 667 668 669 return this; 670 }, 671 672 toggle: function(event, element) { 673 if (event && event.type.match(/^touch/i)) { event.preventDefault(); } 674 else { this.dragging = false; } 675 676 return this[this.opened ? 'close' : 'open'](event, element); 677 }, 678 679 getOffcanvasPosition: function() { 680 return this.bodyEl.hasClass('g-offcanvas-right') ? 'right' : 'left'; 681 }, 682 683 _setTransition: function() { 684 var panel = this.panel[0]; 685 686 if (this.options.css3) { 687 // for translate3d 688 panel.style[prefix.css + 'transition'] = panel.style.transition = prefix.css + 'transform ' + this.options.duration + 'ms ' + this.options.effect; 689 } else { 690 // left/right transition 691 panel.style[prefix.css + 'transition'] = panel.style.transition = 'left ' + this.options.duration + 'ms ' + this.options.effect + ', right ' + this.options.duration + 'ms ' + this.options.effect; 692 } 693 }, 694 695 _translateXTo: function(x) { 696 var panel = this.panel[0], 697 placement = this.getOffcanvasPosition(); 698 699 this.offset.x.current = x; 700 701 if (this.options.css3) { 702 // for translate3d 703 panel.style[prefix.css + 'transform'] = panel.style.transform = 'translate3d(' + x + 'px, 0, 0)'; 704 } else { 705 // left/right transition 706 panel.style[placement] = Math.abs(x) + 'px'; 707 } 708 }, 709 710 _bodyScroll: function() { 711 if (!this.moved) { 712 clearTimeout(scrollTimeout); 713 isScrolling = true; 714 scrollTimeout = setTimeout(function() { 715 isScrolling = false;
716 }, 250); 717 } 718 }, 719 720 _bodyMove: function() { 721 if (this.moved) { event.preventDefault(); } 722 this.dragging = true; 723 724 return false; 725 }, 726 727 _touchStart: function(event) { 728 if (!event.touches) { return; } 729 730 this.moved = false; 731 this.opening = false; 732 this.dragging = false; 733 this.offset.x.start = event.touches[0].pageX; 734 this.offset.y.start = event.touches[0].pageY; 735 this.preventOpen = (!this.opened && this.offcanvas[0].clientWidth !== 0); 736 }, 737 738 _touchCancel: function() { 739 this.moved = false; 740 this.opening = false; 741 }, 742 743 _touchMove: function(event) { 744 if (isScrolling || this.preventOpen || !event.touches) { return; } 745 if (this.options.css3) { 746 this.panel[0].style[this.getOffcanvasPosition()] = 'inherit'; 747 } 748 749 var placement = this.getOffcanvasPosition(), 750 diffX = clamp(event.touches[0].clientX - this.offset.x.start, -this.options.padding, this.options.padding), 751 translateX = this.offset.x.current = diffX, 752 diffY = Math.abs(event.touches[0].pageY - this.offset.y.start), 753 offset = placement == 'right' ? -1 : 1, 754 overlayOpacity; 755 756 if (Math.abs(translateX) > this.options.padding) { return; } 757 if (diffY > 5 && !this.moved) { return; } 758 759 if (Math.abs(diffX) > 0) { 760 this.opening = true; 761 762 // offcanvas on left 763 if (placement == 'left' && (this.opened && diffX > 0 || !this.opened && diffX < 0)) { return; } 764 765 // offcanvas on right 766 if (placement == 'right' && (this.opened && diffX < 0 || !this.opened && diffX > 0)) { return; } 767 768 if (!this.moved && !this.htmlEl.hasClass(this.options.openClass)) { 769 this.htmlEl.addClass(this.options.openClass); 770 } 771 772 if ((placement == 'left' && diffX <= 0) || (placement == 'right' && diffX >= 0)) { 773 translateX = diffX + (offset * this.options.padding); 774 this.opening = false; 775 } 776 777 overlayOpacity = mapNumber(Math.abs(translateX), 0, this.options.padding, 0, 1); 778 this.overlay[0].style.opacity = overlayOpacity; 779 780 if (this.options.css3) { 781 // for translate3d 782 this.panel[0].style[prefix.css + 'transform'] = this.panel[0].style.transform = 'translate3d(' + translateX + 'px, 0, 0)'; 783 } else { 784 // left/right transition 785 this.panel[0].style[placement] = Math.abs(translateX) + 'px'; 786 } 787 788 this.moved = true; 789 } 790 }, 791 792 _touchEnd: function(event) { 793 if (this.moved) { 794 var tolerance = Math.abs(this.offset.x.current) > this.tolerance, 795 placement = this.bodyEl.hasClass('g-offcanvas-right') ? true : false, 796 direction = !placement ? (this.offset.x.current < 0) : (this.offset.x.current > 0); 797 798 this.opening = tolerance ? !direction : direction; 799 this.opened = !this.opening; 800 this[this.opening ? 'open' : 'close'](event, this.panel); 801 } 802 803 this.moved = false; 804 805 return true; 806 }, 807 808 _checkTogglers: function(mutator) { 809 var togglers = $('[data-offcanvas-toggle], [data-offcanvas-open], [data-offcanvas-close]'), 810 mobileContainer = $('#g-mobilemenu-container'), 811 blocks, mCtext; 812 813 if (!togglers || (mutator && ((mutator.target || mutator.srcElement) !== mobileContainer[0]))) { return; } 814 if (this.opened) { this.close(); } 815 816 timeout(function() { 817 blocks = this.offcanvas.search('.g-block'); 818 mCtext = mobileContainer ? mobileContainer.text().length : 0; 819 var shouldCollapse = (blocks && blocks.length === 1) && mobileContainer && (!trim(this.offcanvas.text()).length && !blocks.find('.g-menu-item')); 820 821 togglers[shouldCollapse ? 'addClass' : 'removeClass']('g-offcanvas-hide'); 822 if (mobileContainer) { 823 mobileContainer.parent('.g-block')[!mCtext ? 'addClass' : 'removeClass']('hidden'); 824 } 825 826 if (!shouldCollapse && !this.attached) { this.attach(); } 827 else if (shouldCollapse && this.attached) { 828 this.detach(); 829 this.attachMutationEvent(); 830 } 831 }, 0, this); 832 } 833}); 834 835module.exports = Offcanvas; 836 837},{"../utils/decouple":5,"domready":7,"elements":12,"elements/zen":36,"mout/array/forEach":37,"mout/function/bind":40,"mout/function/timeout":44,"mout/math/clamp":49,"mout/math/map":51,"mout/string/trim":60,"prime":85,"prime-util/prime/bound":81,"prime-util/prime/options":82}],4:[function(require,module,exports){ 838"use strict"; 839 840var ready = require('domready'), 841 $ = require('../utils/dollar-extras'); 842 843var timeOut, 844 scrollToTop = function() { 845 if (document.body.scrollTop != 0 || document.documentElement.scrollTop != 0) { 846 window.scrollBy(0, -50); 847 timeOut = setTimeout(scrollToTop, 10); 848 } else { 849 clearTimeout(timeOut); 850 } 851 }; 852 853ready(function() { 854 var totop = $('#g-totop'); 855 if (!totop) { return; } 856 857 totop.on('click', function(e) { 858 e.preventDefault(); 859 scrollToTop(); 860 }); 861}); 862 863module.exports = {}; 864 865},{"../utils/dollar-extras":6,"domready":7}],5:[function(require,module,exports){ 866'use strict'; 867 868var rAF = (function() { 869 return window.requestAnimationFrame || 870 window.webkitRequestAnimationFrame || 871 function(callback) { window.setTimeout(callback, 1000 / 60); }; 872}()); 873 874var decouple = function(element, event, callback) { 875 var evt, tracking = false;
876 element = element[0] || element; 877 878 var capture = function(e) { 879 evt = e; 880 track(); 881 }; 882 883 var track = function() { 884 if (!tracking) { 885 rAF(update); 886 tracking = true; 887 } 888 }; 889 890 var update = function() { 891 callback.call(element, evt); 892 tracking = false; 893 }; 894 895 try { 896 element.addEventListener(event, capture, false); 897 } catch (e) {} 898 899 return capture; 900}; 901 902module.exports = decouple; 903},{}],6:[function(require,module,exports){ 904"use strict"; 905var $ = require('elements'), 906 map = require('mout/array/map'), 907 slick = require('slick'); 908 909var walk = function(combinator, method) { 910 911 return function(expression) { 912 var parts = slick.parse(expression || "*"); 913 914 expression = map(parts, function(part) { 915 return combinator + " " + part; 916 }).join(', '); 917 918 return this[method](expression); 919 }; 920 921}; 922 923 924$.implement({ 925 sibling: walk('++', 'find'), 926 siblings: walk('~~', 'search') 927}); 928 929 930module.exports = $; 931 932},{"elements":12,"mout/array/map":38,"slick":97}],7:[function(require,module,exports){ 933/*! 934 * domready (c) Dustin Diaz 2014 - License MIT 935 */ 936!function (name, definition) { 937 938 if (typeof module != 'undefined') module.exports = definition() 939 else if (typeof define == 'function' && typeof define.amd == 'object') define(definition) 940 else this[name] = definition() 941 942}('domready', function () { 943 944 var fns = [], listener 945 , doc = document 946 , hack = doc.documentElement.doScroll 947 , domContentLoaded = 'DOMContentLoaded' 948 , loaded = (hack ? /^loaded|^c/ : /^loaded|^i|^c/).test(doc.readyState) 949 950 951 if (!loaded) 952 doc.addEventListener(domContentLoaded, listener = function () { 953 doc.removeEventListener(domContentLoaded, listener) 954 loaded = 1 955 while (listener = fns.shift()) listener() 956 }) 957 958 return function (fn) { 959 loaded ? setTimeout(fn, 0) : fns.push(fn) 960 } 961 962}); 963 964},{}],8:[function(require,module,exports){ 965/* 966attributes 967*/"use strict" 968 969var $ = require("./base") 970 971var trim = require("mout/string/trim"), 972 forEach = require("mout/array/forEach"), 973 filter = require("mout/array/filter"), 974 indexOf = require("mout/array/indexOf") 975 976// attributes 977 978$.implement({ 979 980 setAttribute: function(name, value){ 981 return this.forEach(function(node){ 982 node.setAttribute(name, value) 983 }) 984 }, 985 986 getAttribute: function(name){ 987 var attr = this[0].getAttributeNode(name) 988 return (attr && attr.specified) ? attr.value : null 989 }, 990 991 hasAttribute: function(name){ 992 var node = this[0] 993 if (node.hasAttribute) return node.hasAttribute(name) 994 var attr = node.getAttributeNode(name) 995 return !!(attr && attr.specified) 996 }, 997 998 removeAttribute: function(name){ 999 return this.forEach(function(node){ 1000 var attr = node.getAttributeNode(name) 1001 if (attr) node.removeAttributeNode(attr) 1002 }) 1003 } 1004 1005}) 1006 1007var accessors = {} 1008 1009forEach(["type", "value", "name", "href", "title", "id"], function(name){ 1010 1011 accessors[name] = function(value){ 1012 return (value !== undefined) ? this.forEach(function(node){ 1013 node[name] = value 1014 }) : this[0][name] 1015 } 1016 1017}) 1018 1019// booleans 1020 1021forEach(["checked", "disabled", "selected"], function(name){ 1022 1023 accessors[name] = function(value){ 1024 return (value !== undefined) ? this.forEach(function(node){ 1025 node[name] = !!value 1026 }) : !!this[0][name] 1027 } 1028 1029}) 1030 1031// className 1032 1033var classes = function(className){ 1034 var classNames = trim(className).replace(/\s+/g, " ").split(" "), 1035 uniques = {} 1036 1037 return filter(classNames, function(className){ 1038 if (className !== "" && !uniques[className]) return uniques[className] = className 1039 }).sort() 1040} 1041 1042accessors.className = function(className){ 1043 return (className !== undefined) ? this.forEach(function(node){ 1044 node.className = classes(className).join(" ") 1045 }) : classes(this[0].className).join(" ") 1046} 1047 1048// attribute 1049 1050$.implement({ 1051 1052 attribute: function(name, value){ 1053 var accessor = accessors[name] 1054 if (accessor) return accessor.call(this, value) 1055 if (value != null) return this.setAttribute(name, value) 1056 if (value === null) return this.removeAttribute(name) 1057 if (value === undefined) return this.getAttribute(name) 1058 } 1059 1060}) 1061 1062$.implement(accessors) 1063 1064// shortcuts 1065 1066$.implement({ 1067 1068 check: function(){ 1069 return this.checked(true) 1070 }, 1071 1072 uncheck: function(){ 1073 return this.checked(false) 1074 }, 1075 1076 disable: function(){ 1077 return this.disabled(true) 1078 }, 1079 1080 enable: function(){ 1081 return this.disabled(false) 1082 }, 1083 1084 select: function(){ 1085 return this.selected(true) 1086 }, 1087 1088 deselect: function(){ 1089 return this.selected(false) 1090 } 1091 1092}) 1093 1094// classNames, has / add / remove Class 1095
1096$.implement({ 1097 1098 classNames: function(){ 1099 return classes(this[0].className) 1100 }, 1101 1102 hasClass: function(className){ 1103 return indexOf(this.classNames(), className) > -1 1104 }, 1105 1106 addClass: function(className){ 1107 return this.forEach(function(node){ 1108 var nodeClassName = node.className 1109 var classNames = classes(nodeClassName + " " + className).join(" ") 1110 if (nodeClassName !== classNames) node.className = classNames 1111 }) 1112 }, 1113 1114 removeClass: function(className){ 1115 return this.forEach(function(node){ 1116 var classNames = classes(node.className) 1117 forEach(classes(className), function(className){ 1118 var index = indexOf(classNames, className) 1119 if (index > -1) classNames.splice(index, 1) 1120 }) 1121 node.className = classNames.join(" ") 1122 }) 1123 }, 1124 1125 toggleClass: function(className, force){ 1126 var add = force !== undefined ? force : !this.hasClass(className) 1127 if (add) 1128 this.addClass(className) 1129 else 1130 this.removeClass(className) 1131 return !!add 1132 } 1133 1134}) 1135 1136// toString 1137 1138$.prototype.toString = function(){ 1139 var tag = this.tag(), 1140 id = this.id(), 1141 classes = this.classNames() 1142 1143 var str = tag 1144 if (id) str += '#' + id 1145 if (classes.length) str += '.' + classes.join(".") 1146 return str 1147} 1148 1149var textProperty = (document.createElement('div').textContent == null) ? 'innerText' : 'textContent' 1150 1151// tag, html, text, data 1152 1153$.implement({ 1154 1155 tag: function(){ 1156 return this[0].tagName.toLowerCase() 1157 }, 1158 1159 html: function(html){ 1160 return (html !== undefined) ? this.forEach(function(node){ 1161 node.innerHTML = html 1162 }) : this[0].innerHTML 1163 }, 1164 1165 text: function(text){ 1166 return (text !== undefined) ? this.forEach(function(node){ 1167 node[textProperty] = text 1168 }) : this[0][textProperty] 1169 }, 1170 1171 data: function(key, value){ 1172 switch(value) { 1173 case undefined: return this.getAttribute("data-" + key) 1174 case null: return this.removeAttribute("data-" + key) 1175 default: return this.setAttribute("data-" + key, value) 1176 } 1177 } 1178 1179}) 1180 1181module.exports = $ 1182 1183},{"./base":9,"mout/array/filter":15,"mout/array/forEach":16,"mout/array/indexOf":17,"mout/string/trim":34}],9:[function(require,module,exports){ 1184/* 1185elements 1186*/"use strict" 1187 1188var prime = require("prime") 1189 1190var forEach = require("mout/array/forEach"), 1191 map = require("mout/array/map"), 1192 filter = require("mout/array/filter"), 1193 every = require("mout/array/every"), 1194 some = require("mout/array/some") 1195 1196// uniqueID 1197 1198var index = 0, 1199 __dc = document.__counter, 1200 counter = document.__counter = (__dc ? parseInt(__dc, 36) + 1 : 0).toString(36), 1201 key = "uid:" + counter 1202 1203var uniqueID = function(n){ 1204 if (n === window) return "window" 1205 if (n === document) return "document" 1206 if (n === document.documentElement) return "html" 1207 return n[key] || (n[key] = (index++).toString(36)) 1208} 1209 1210var instances = {} 1211 1212// elements prime 1213 1214var $ = prime({constructor: function $(n, context){ 1215 1216 if (n == null) return (this && this.constructor === $) ? new Elements : null 1217 1218 var self, uid 1219 1220 if (n.constructor !== Elements){ 1221 1222 self = new Elements 1223 1224 if (typeof n === "string"){ 1225 if (!self.search) return null 1226 self[self.length++] = context || document 1227 return self.search(n) 1228 } 1229 1230 if (n.nodeType || n === window){ 1231 1232 self[self.length++] = n 1233 1234 } else if (n.length){ 1235 1236 // this could be an array, or any object with a length attribute, 1237 // including another instance of elements from another interface. 1238 1239 var uniques = {} 1240 1241 for (var i = 0, l = n.length; i < l; i++){ // perform elements flattening 1242 var nodes = $(n[i], context) 1243 if (nodes && nodes.length) for (var j = 0, k = nodes.length; j < k; j++){ 1244 var node = nodes[j] 1245 uid = uniqueID(node) 1246 if (!uniques[uid]){ 1247 self[self.length++] = node 1248 uniques[uid] = true 1249 } 1250 } 1251 } 1252 1253 } 1254 1255 } else { 1256 self = n 1257 } 1258 1259 if (!self.length) return null 1260 1261 // when length is 1 always use the same elements instance 1262 1263 if (self.length === 1){ 1264 uid = uniqueID(self[0]) 1265 return instances[uid] || (instances[uid] = self) 1266 } 1267 1268 return self 1269 1270}}) 1271 1272var Elements = prime({ 1273 1274 inherits: $, 1275 1276 constructor: function Elements(){ 1277 this.length = 0 1278 }, 1279 1280 unlink: function(){ 1281 return this.map(function(node){ 1282 delete instances[uniqueID(node)] 1283 return node 1284 }) 1285 }, 1286 1287 // methods 1288
1289 forEach: function(method, context){ 1290 forEach(this, method, context) 1291 return this 1292 }, 1293 1294 map: function(method, context){ 1295 return map(this, method, context) 1296 }, 1297 1298 filter: function(method, context){ 1299 return filter(this, method, context) 1300 }, 1301 1302 every: function(method, context){ 1303 return every(this, method, context) 1304 }, 1305 1306 some: function(method, context){ 1307 return some(this, method, context) 1308 } 1309 1310}) 1311 1312module.exports = $ 1313 1314},{"mout/array/every":14,"mout/array/filter":15,"mout/array/forEach":16,"mout/array/map":18,"mout/array/some":19,"prime":85}],10:[function(require,module,exports){ 1315/* 1316delegation 1317*/"use strict" 1318 1319var Map = require("prime/map") 1320 1321var $ = require("./events") 1322 require('./traversal') 1323 1324$.implement({ 1325 1326 delegate: function(event, selector, handle, useCapture){ 1327 1328 return this.forEach(function(node){ 1329 1330 var self = $(node) 1331 1332 var delegation = self._delegation || (self._delegation = {}), 1333 events = delegation[event] || (delegation[event] = {}), 1334 map = (events[selector] || (events[selector] = new Map)) 1335 1336 if (map.get(handle)) return 1337 1338 var action = function(e){ 1339 var target = $(e.target || e.srcElement), 1340 match = target.matches(selector) ? target : target.parent(selector) 1341 1342 var res 1343 1344 if (match) res = handle.call(self, e, match) 1345 1346 return res 1347 } 1348 1349 map.set(handle, action) 1350 1351 self.on(event, action, useCapture) 1352 1353 }) 1354 1355 }, 1356 1357 undelegate: function(event, selector, handle, useCapture){ 1358 1359 return this.forEach(function(node){ 1360 1361 var self = $(node), delegation, events, map 1362 1363 if (!(delegation = self._delegation) || !(events = delegation[event]) || !(map = events[selector])) return; 1364 1365 var action = map.get(handle) 1366 1367 if (action){ 1368 self.off(event, action, useCapture) 1369 map.remove(action) 1370 1371 // if there are no more handles in a given selector, delete it 1372 if (!map.count()) delete events[selector] 1373 // var evc = evd = 0, x 1374 var e1 = true, e2 = true, x 1375 for (x in events){ 1376 e1 = false 1377 break 1378 } 1379 // if no more selectors in a given event type, delete it 1380 if (e1) delete delegation[event] 1381 for (x in delegation){ 1382 e2 = false 1383 break 1384 } 1385 // if there are no more delegation events in the element, delete the _delegation object 1386 if (e2) delete self._delegation 1387 } 1388 1389 }) 1390 1391 } 1392 1393}) 1394 1395module.exports = $ 1396 1397},{"./events":11,"./traversal":35,"prime/map":86}],11:[function(require,module,exports){ 1398/* 1399events 1400*/"use strict" 1401 1402var Emitter = require("prime/emitter") 1403 1404var $ = require("./base") 1405 1406var html = document.documentElement 1407 1408var addEventListener = html.addEventListener ? function(node, event, handle, useCapture){ 1409 node.addEventListener(event, handle, useCapture || false) 1410 return handle 1411} : function(node, event, handle){ 1412 node.attachEvent('on' + event, handle) 1413 return handle 1414} 1415 1416var removeEventListener = html.removeEventListener ? function(node, event, handle, useCapture){ 1417 node.removeEventListener(event, handle, useCapture || false) 1418} : function(node, event, handle){ 1419 node.detachEvent("on" + event, handle) 1420} 1421 1422$.implement({ 1423 1424 on: function(event, handle, useCapture){ 1425 1426 return this.forEach(function(node){ 1427 var self = $(node) 1428 1429 var internalEvent = event + (useCapture ? ":capture" : "") 1430 1431 Emitter.prototype.on.call(self, internalEvent, handle) 1432 1433 var domListeners = self._domListeners || (self._domListeners = {}) 1434 if (!domListeners[internalEvent]) domListeners[internalEvent] = addEventListener(node, event, function(e){ 1435 Emitter.prototype.emit.call(self, internalEvent, e || window.event, Emitter.EMIT_SYNC) 1436 }, useCapture) 1437 }) 1438 }, 1439 1440 off: function(event, handle, useCapture){ 1441 1442 return this.forEach(function(node){ 1443 1444 var self = $(node) 1445 1446 var internalEvent = event + (useCapture ? ":capture" : "") 1447 1448 var domListeners = self._domListeners, domEvent, listeners = self._listeners, events 1449 1450 if (domListeners && (domEvent = domListeners[internalEvent]) && listeners && (events = listeners[internalEvent])){ 1451 1452 Emitter.prototype.off.call(self, internalEvent, handle) 1453 1454 if (!self._listeners || !self._listeners[event]){ 1455 removeEventListener(node, event, domEvent) 1456 delete domListeners[event] 1457 1458 for (var l in domListeners) return 1459 delete self._domListeners 1460 } 1461 1462 } 1463 }) 1464 }, 1465 1466 emit: function(){ 1467 var args = arguments 1468 return this.forEach(function(node){ 1469 Emitter.prototype.emit.apply($(node), args) 1470 }) 1471 } 1472 1473}) 1474 1475module.exports = $ 1476 1477},{"./base":9,"prime/emitter":84}],12:[function(require,module,exports){ 1478/* 1479elements 1480*/"use strict" 1481 1482var $ = require("./base") 1483 require("./attributes") 1484 require("./events") 1485 require("./insertion") 1486 require("./traversal") 1487 require("./delegation") 1488 1489module.exports = $ 1490 1491},{"./attributes":8,"./base":9,"./delegation":10,"./events":11,"./insertion":13,"./traversal":35}],13:[function(require,module,exports){ 1492/* 1493insertion 1494*/"use strict" 1495 1496var $ = require("./base") 1497 1498// base insertion 1499 1500$.implement({ 1501 1502 appendChild: function(child){ 1503 this[0].appendChild($(child)[0]) 1504 return this 1505 }, 1506 1507 insertBefore: function(child, ref){ 1508 this[0].insertBefore($(child)[0], $(ref)[0]) 1509 return this 1510 }, 1511 1512 removeChild: function(child){ 1513 this[0].removeChild($(child)[0]) 1514 return this 1515 }, 1516 1517 replaceChild: function(child, ref){ 1518 this[0].replaceChild($(child)[0], $(ref)[0]) 1519 return this 1520 } 1521 1522}) 1523 1524// before, after, bottom, top 1525 1526$.implement({ 1527 1528 before: function(element){ 1529 element = $(element)[0] 1530 var parent = element.parentNode 1531 if (parent) this.forEach(function(node){ 1532 parent.insertBefore(node, element) 1533 }) 1534 return this 1535 }, 1536 1537 after: function(element){ 1538 element = $(element)[0] 1539 var parent = element.parentNode 1540 if (parent) this.forEach(function(node){ 1541 parent.insertBefore(node, element.nextSibling) 1542 }) 1543 return this 1544 }, 1545 1546 bottom: function(element){ 1547 element = $(element)[0] 1548 return this.forEach(function(node){ 1549 element.appendChild(node) 1550 }) 1551 }, 1552 1553 top: function(element){ 1554 element = $(element)[0] 1555 return this.forEach(function(node){ 1556 element.insertBefore(node, element.firstChild) 1557 }) 1558 } 1559 1560}) 1561 1562// insert, replace 1563 1564$.implement({ 1565 1566 insert: $.prototype.bottom, 1567 1568 remove: function(){ 1569 return this.forEach(function(node){ 1570 var parent = node.parentNode 1571 if (parent) parent.removeChild(node) 1572 }) 1573 }, 1574 1575 replace: function(element){ 1576 element = $(element)[0] 1577 element.parentNode.replaceChild(this[0], element) 1578 return this 1579 } 1580 1581}) 1582 1583module.exports = $ 1584 1585},{"./base":9}],14:[function(require,module,exports){ 1586var makeIterator = require('../function/makeIterator_'); 1587 1588 /** 1589 * Array every 1590 */ 1591 function every(arr, callback, thisObj) { 1592 callback = makeIterator(callback, thisObj); 1593 var result = true; 1594 if (arr == null) { 1595 return result; 1596 } 1597 1598 var i = -1, len = arr.length; 1599 while (++i < len) { 1600 // we iterate over sparse items since there is no way to make it 1601 // work properly on IE 7-8. see #64 1602 if (!callback(arr[i], i, arr) ) { 1603 result = false;
1604 break; 1605 } 1606 } 1607 1608 return result; 1609 } 1610 1611 module.exports = every; 1612 1613 1614},{"../function/makeIterator_":21}],15:[function(require,module,exports){ 1615var makeIterator = require('../function/makeIterator_'); 1616 1617 /** 1618 * Array filter 1619 */ 1620 function filter(arr, callback, thisObj) { 1621 callback = makeIterator(callback, thisObj); 1622 var results = []; 1623 if (arr == null) { 1624 return results; 1625 } 1626 1627 var i = -1, len = arr.length, value; 1628 while (++i < len) { 1629 value = arr[i]; 1630 if (callback(value, i, arr)) { 1631 results.push(value); 1632 } 1633 } 1634 1635 return results; 1636 } 1637 1638 module.exports = filter; 1639 1640 1641 1642},{"../function/makeIterator_":21}],16:[function(require,module,exports){ 1643 1644 1645 /** 1646 * Array forEach 1647 */ 1648 function forEach(arr, callback, thisObj) { 1649 if (arr == null) { 1650 return; 1651 } 1652 var i = -1, 1653 len = arr.length; 1654 while (++i < len) { 1655 // we iterate over sparse items since there is no way to make it 1656 // work properly on IE 7-8. see #64 1657 if ( callback.call(thisObj, arr[i], i, arr) === false ) { 1658 break; 1659 } 1660 } 1661 } 1662 1663 module.exports = forEach; 1664 1665 1666 1667},{}],17:[function(require,module,exports){ 1668 1669 1670 /** 1671 * Array.indexOf 1672 */ 1673 function indexOf(arr, item, fromIndex) { 1674 fromIndex = fromIndex || 0; 1675 if (arr == null) { 1676 return -1; 1677 } 1678 1679 var len = arr.length, 1680 i = fromIndex < 0 ? len + fromIndex : fromIndex; 1681 while (i < len) { 1682 // we iterate over sparse items since there is no way to make it 1683 // work properly on IE 7-8. see #64 1684 if (arr[i] === item) { 1685 return i; 1686 } 1687 1688 i++; 1689 } 1690 1691 return -1; 1692 } 1693 1694 module.exports = indexOf; 1695 1696 1697},{}],18:[function(require,module,exports){ 1698var makeIterator = require('../function/makeIterator_'); 1699 1700 /** 1701 * Array map 1702 */ 1703 function map(arr, callback, thisObj) { 1704 callback = makeIterator(callback, thisObj); 1705 var results = []; 1706 if (arr == null){ 1707 return results; 1708 } 1709 1710 var i = -1, len = arr.length; 1711 while (++i < len) { 1712 results[i] = callback(arr[i], i, arr); 1713 } 1714 1715 return results; 1716 } 1717 1718 module.exports = map; 1719 1720 1721},{"../function/makeIterator_":21}],19:[function(require,module,exports){ 1722var makeIterator = require('../function/makeIterator_'); 1723 1724 /** 1725 * Array some 1726 */ 1727 function some(arr, callback, thisObj) { 1728 callback = makeIterator(callback, thisObj); 1729 var result = false;
1730 if (arr == null) { 1731 return result; 1732 } 1733 1734 var i = -1, len = arr.length; 1735 while (++i < len) { 1736 // we iterate over sparse items since there is no way to make it 1737 // work properly on IE 7-8. see #64 1738 if ( callback(arr[i], i, arr) ) { 1739 result = true; 1740 break; 1741 } 1742 } 1743 1744 return result; 1745 } 1746 1747 module.exports = some; 1748 1749 1750},{"../function/makeIterator_":21}],20:[function(require,module,exports){ 1751 1752 1753 /** 1754 * Returns the first argument provided to it. 1755 */ 1756 function identity(val){ 1757 return val; 1758 } 1759 1760 module.exports = identity; 1761 1762 1763 1764},{}],21:[function(require,module,exports){ 1765var identity = require('./identity'); 1766var prop = require('./prop'); 1767var deepMatches = require('../object/deepMatches'); 1768 1769 /** 1770 * Converts argument into a valid iterator. 1771 * Used internally on most array/object/collection methods that receives a 1772 * callback/iterator providing a shortcut syntax. 1773 */ 1774 function makeIterator(src, thisObj){ 1775 if (src == null) { 1776 return identity; 1777 } 1778 switch(typeof src) { 1779 case 'function': 1780 // function is the first to improve perf (most common case) 1781 // also avoid using `Function#call` if not needed, which boosts 1782 // perf a lot in some cases 1783 return (typeof thisObj !== 'undefined')? function(val, i, arr){ 1784 return src.call(thisObj, val, i, arr); 1785 } : src; 1786 case 'object': 1787 return function(val){ 1788 return deepMatches(val, src); 1789 }; 1790 case 'string': 1791 case 'number': 1792 return prop(src); 1793 } 1794 } 1795 1796 module.exports = makeIterator; 1797 1798 1799 1800},{"../object/deepMatches":27,"./identity":20,"./prop":22}],22:[function(require,module,exports){ 1801 1802 1803 /** 1804 * Returns a function that gets a property of the passed object 1805 */ 1806 function prop(name){ 1807 return function(obj){ 1808 return obj[name]; 1809 }; 1810 } 1811 1812 module.exports = prop; 1813 1814 1815 1816},{}],23:[function(require,module,exports){ 1817var isKind = require('./isKind'); 1818 /** 1819 */ 1820 var isArray = Array.isArray || function (val) { 1821 return isKind(val, 'Array'); 1822 }; 1823 module.exports = isArray; 1824 1825 1826},{"./isKind":24}],24:[function(require,module,exports){ 1827var kindOf = require('./kindOf'); 1828 /** 1829 * Check if value is from a specific "kind". 1830 */ 1831 function isKind(val, kind){ 1832 return kindOf(val) === kind; 1833 } 1834 module.exports = isKind; 1835 1836 1837},{"./kindOf":25}],25:[function(require,module,exports){ 1838 1839 1840 var _rKind = /^\[object (.*)\]$/, 1841 _toString = Object.prototype.toString, 1842 UNDEF; 1843 1844 /** 1845 * Gets the "kind" of value. (e.g. "String", "Number", etc) 1846 */ 1847 function kindOf(val) { 1848 if (val === null) { 1849 return 'Null'; 1850 } else if (val === UNDEF) { 1851 return 'Undefined'; 1852 } else { 1853 return _rKind.exec( _toString.call(val) )[1]; 1854 } 1855 } 1856 module.exports = kindOf; 1857 1858 1859},{}],26:[function(require,module,exports){ 1860 1861 1862 /** 1863 * Typecast a value to a String, using an empty string value for null or 1864 * undefined. 1865 */ 1866 function toString(val){ 1867 return val == null ? '' : val.toString(); 1868 } 1869 1870 module.exports = toString; 1871 1872 1873 1874},{}],27:[function(require,module,exports){ 1875var forOwn = require('./forOwn'); 1876var isArray = require('../lang/isArray'); 1877 1878 function containsMatch(array, pattern) { 1879 var i = -1, length = array.length; 1880 while (++i < length) { 1881 if (deepMatches(array[i], pattern)) { 1882 return true; 1883 } 1884 } 1885 1886 return false; 1887 } 1888 1889 function matchArray(target, pattern) { 1890 var i = -1, patternLength = pattern.length; 1891 while (++i < patternLength) { 1892 if (!containsMatch(target, pattern[i])) { 1893 return false; 1894 } 1895 } 1896 1897 return true; 1898 } 1899 1900 function matchObject(target, pattern) { 1901 var result = true; 1902 forOwn(pattern, function(val, key) { 1903 if (!deepMatches(target[key], val)) { 1904 // Return false to break out of forOwn early 1905 return (result = false); 1906 } 1907 }); 1908 1909 return result; 1910 } 1911 1912 /** 1913 * Recursively check if the objects match. 1914 */ 1915 function deepMatches(target, pattern){ 1916 if (target && typeof target === 'object') { 1917 if (isArray(target) && isArray(pattern)) { 1918 return matchArray(target, pattern); 1919 } else { 1920 return matchObject(target, pattern); 1921 } 1922 } else { 1923 return target === pattern; 1924 } 1925 } 1926 1927 module.exports = deepMatches; 1928 1929 1930 1931},{"../lang/isArray":23,"./forOwn":29}],28:[function(require,module,exports){ 1932var hasOwn = require('./hasOwn'); 1933 1934 var _hasDontEnumBug, 1935 _dontEnums; 1936 1937 function checkDontEnum(){ 1938 _dontEnums = [ 1939 'toString',
1940 'toLocaleString', 1941 'valueOf', 1942 'hasOwnProperty', 1943 'isPrototypeOf', 1944 'propertyIsEnumerable', 1945 'constructor' 1946 ]; 1947 1948 _hasDontEnumBug = true; 1949 1950 for (var key in {'toString': null}) { 1951 _hasDontEnumBug = false; 1952 } 1953 } 1954 1955 /** 1956 * Similar to Array/forEach but works over object properties and fixes Don't 1957 * Enum bug on IE. 1958 * based on: http://whattheheadsaid.com/2010/10/a-safer-object-keys-compatibility-implementation 1959 */ 1960 function forIn(obj, fn, thisObj){ 1961 var key, i = 0; 1962 // no need to check if argument is a real object that way we can use 1963 // it for arrays, functions, date, etc. 1964 1965 //post-pone check till needed 1966 if (_hasDontEnumBug == null) checkDontEnum(); 1967 1968 for (key in obj) { 1969 if (exec(fn, obj, key, thisObj) === false) { 1970 break; 1971 } 1972 } 1973 1974 1975 if (_hasDontEnumBug) { 1976 var ctor = obj.constructor, 1977 isProto = !!ctor && obj === ctor.prototype; 1978 1979 while (key = _dontEnums[i++]) { 1980 // For constructor, if it is a prototype object the constructor 1981 // is always non-enumerable unless defined otherwise (and 1982 // enumerated above). For non-prototype objects, it will have 1983 // to be defined on this object, since it cannot be defined on 1984 // any prototype objects. 1985 // 1986 // For other [[DontEnum]] properties, check if the value is 1987 // different than Object prototype value. 1988 if ( 1989 (key !== 'constructor' || 1990 (!isProto && hasOwn(obj, key))) && 1991 obj[key] !== Object.prototype[key] 1992 ) { 1993 if (exec(fn, obj, key, thisObj) === false) { 1994 break; 1995 } 1996 } 1997 } 1998 } 1999 } 2000 2001 function exec(fn, obj, key, thisObj){ 2002 return fn.call(thisObj, obj[key], key, obj); 2003 } 2004 2005 module.exports = forIn; 2006 2007 2008 2009},{"./hasOwn":30}],29:[function(require,module,exports){ 2010var hasOwn = require('./hasOwn'); 2011var forIn = require('./forIn'); 2012 2013 /** 2014 * Similar to Array/forEach but works over object properties and fixes Don't 2015 * Enum bug on IE. 2016 * based on: http://whattheheadsaid.com/2010/10/a-safer-object-keys-compatibility-implementation 2017 */ 2018 function forOwn(obj, fn, thisObj){ 2019 forIn(obj, function(val, key){ 2020 if (hasOwn(obj, key)) { 2021 return fn.call(thisObj, obj[key], key, obj); 2022 } 2023 }); 2024 } 2025 2026 module.exports = forOwn; 2027 2028 2029 2030},{"./forIn":28,"./hasOwn":30}],30:[function(require,module,exports){ 2031 2032 2033 /** 2034 * Safer Object.hasOwnProperty 2035 */ 2036 function hasOwn(obj, prop){ 2037 return Object.prototype.hasOwnProperty.call(obj, prop); 2038 } 2039 2040 module.exports = hasOwn; 2041 2042 2043 2044},{}],31:[function(require,module,exports){ 2045 2046 /** 2047 * Contains all Unicode white-spaces. Taken from 2048 * http://en.wikipedia.org/wiki/Whitespace_character. 2049 */ 2050 module.exports = [ 2051 ' ', '\n', '\r', '\t', '\f', '\v', '\u00A0', '\u1680', '\u180E', 2052 '\u2000', '\u2001', '\u2002', '\u2003', '\u2004', '\u2005', '\u2006', 2053 '\u2007', '\u2008', '\u2009', '\u200A', '\u2028', '\u2029', '\u202F', 2054 '\u205F', '\u3000' 2055 ]; 2056 2057 2058},{}],32:[function(require,module,exports){ 2059var toString = require('../lang/toString'); 2060var WHITE_SPACES = require('./WHITE_SPACES'); 2061 /** 2062 * Remove chars from beginning of string. 2063 */ 2064 function ltrim(str, chars) { 2065 str = toString(str); 2066 chars = chars || WHITE_SPACES; 2067 2068 var start = 0, 2069 len = str.length, 2070 charLen = chars.length, 2071 found = true, 2072 i, c; 2073 2074 while (found && start < len) { 2075 found = false; 2076 i = -1; 2077 c = str.charAt(start); 2078 2079 while (++i < charLen) { 2080 if (c === chars[i]) { 2081 found = true; 2082 start++; 2083 break; 2084 } 2085 } 2086 } 2087 2088 return (start >= len) ? '' : str.substr(start, len); 2089 } 2090 2091 module.exports = ltrim; 2092 2093 2094},{"../lang/toString":26,"./WHITE_SPACES":31}],33:[function(require,module,exports){ 2095var toString = require('../lang/toString'); 2096var WHITE_SPACES = require('./WHITE_SPACES'); 2097 /** 2098 * Remove chars from end of string. 2099 */ 2100 function rtrim(str, chars) { 2101 str = toString(str); 2102 chars = chars || WHITE_SPACES; 2103 2104 var end = str.length - 1, 2105 charLen = chars.length, 2106 found = true, 2107 i, c; 2108 2109 while (found && end >= 0) { 2110 found = false;
2111 i = -1; 2112 c = str.charAt(end); 2113 2114 while (++i < charLen) { 2115 if (c === chars[i]) { 2116 found = true; 2117 end--; 2118 break; 2119 } 2120 } 2121 } 2122 2123 return (end >= 0) ? str.substring(0, end + 1) : ''; 2124 } 2125 2126 module.exports = rtrim; 2127 2128 2129},{"../lang/toString":26,"./WHITE_SPACES":31}],34:[function(require,module,exports){ 2130var toString = require('../lang/toString'); 2131var WHITE_SPACES = require('./WHITE_SPACES'); 2132var ltrim = require('./ltrim'); 2133var rtrim = require('./rtrim'); 2134 /** 2135 * Remove white-spaces from beginning and end of string. 2136 */ 2137 function trim(str, chars) { 2138 str = toString(str); 2139 chars = chars || WHITE_SPACES; 2140 return ltrim(rtrim(str, chars), chars); 2141 } 2142 2143 module.exports = trim; 2144 2145 2146},{"../lang/toString":26,"./WHITE_SPACES":31,"./ltrim":32,"./rtrim":33}],35:[function(require,module,exports){ 2147/* 2148traversal 2149*/"use strict" 2150 2151var map = require("mout/array/map") 2152 2153var slick = require("slick") 2154 2155var $ = require("./base") 2156 2157var gen = function(combinator, expression){ 2158 return map(slick.parse(expression || "*"), function(part){ 2159 return combinator + " " + part 2160 }).join(", ") 2161} 2162 2163var push_ = Array.prototype.push 2164 2165$.implement({ 2166 2167 search: function(expression){ 2168 if (this.length === 1) return $(slick.search(expression, this[0], new $)) 2169 2170 var buffer = [] 2171 for (var i = 0, node; node = this[i]; i++) push_.apply(buffer, slick.search(expression, node)) 2172 buffer = $(buffer) 2173 return buffer && buffer.sort() 2174 }, 2175 2176 find: function(expression){ 2177 if (this.length === 1) return $(slick.find(expression, this[0])) 2178 2179 for (var i = 0, node; node = this[i]; i++) { 2180 var found = slick.find(expression, node) 2181 if (found) return $(found) 2182 } 2183 2184 return null 2185 }, 2186 2187 sort: function(){ 2188 return slick.sort(this) 2189 }, 2190 2191 matches: function(expression){ 2192 return slick.matches(this[0], expression) 2193 }, 2194 2195 contains: function(node){ 2196 return slick.contains(this[0], node) 2197 }, 2198 2199 nextSiblings: function(expression){ 2200 return this.search(gen('~', expression)) 2201 }, 2202 2203 nextSibling: function(expression){ 2204 return this.find(gen('+', expression)) 2205 }, 2206 2207 previousSiblings: function(expression){ 2208 return this.search(gen('!~', expression)) 2209 }, 2210 2211 previousSibling: function(expression){ 2212 return this.find(gen('!+', expression)) 2213 }, 2214 2215 children: function(expression){ 2216 return this.search(gen('>', expression)) 2217 }, 2218 2219 firstChild: function(expression){ 2220 return this.find(gen('^', expression)) 2221 }, 2222 2223 lastChild: function(expression){ 2224 return this.find(gen('!^', expression)) 2225 }, 2226 2227 parent: function(expression){ 2228 var buffer = [] 2229 loop: for (var i = 0, node; node = this[i]; i++) while ((node = node.parentNode) && (node !== document)){ 2230 if (!expression || slick.matches(node, expression)){ 2231 buffer.push(node) 2232 break loop 2233 break 2234 } 2235 } 2236 return $(buffer) 2237 }, 2238 2239 parents: function(expression){ 2240 var buffer = [] 2241 for (var i = 0, node; node = this[i]; i++) while ((node = node.parentNode) && (node !== document)){ 2242 if (!expression || slick.matches(node, expression)) buffer.push(node) 2243 } 2244 return $(buffer) 2245 } 2246 2247}) 2248 2249module.exports = $ 2250 2251},{"./base":9,"mout/array/map":18,"slick":97}],36:[function(require,module,exports){ 2252/* 2253zen 2254*/"use strict" 2255 2256var forEach = require("mout/array/forEach"), 2257 map = require("mout/array/map") 2258 2259var parse = require("slick/parser") 2260 2261var $ = require("./base") 2262 2263module.exports = function(expression, doc){ 2264 2265 return $(map(parse(expression), function(expression){ 2266 2267 var previous, result 2268 2269 forEach(expression, function(part, i){ 2270 2271 var node = (doc || document).createElement(part.tag) 2272 2273 if (part.id) node.id = part.id 2274 2275 if (part.classList) node.className = part.classList.join(" ") 2276 2277 if (part.attributes) forEach(part.attributes, function(attribute){ 2278 node.setAttribute(attribute.name, attribute.value || "") 2279 }) 2280 2281 if (part.pseudos) forEach(part.pseudos, function(pseudo){ 2282 var n = $(node), method = n[pseudo.name] 2283 if (method) method.call(n, pseudo.value) 2284 }) 2285 2286 if (i === 0){ 2287 2288 result = node 2289 2290 } else if (part.combinator === " "){ 2291 2292 previous.appendChild(node) 2293 2294 } else if (part.combinator === "+"){ 2295 var parentNode = previous.parentNode 2296 if (parentNode) parentNode.appendChild(node) 2297 } 2298 2299 previous = node 2300 2301 }) 2302 2303 return result 2304 2305 })) 2306 2307} 2308 2309},{"./base":9,"mout/array/forEach":16,"mout/array/map":18,"slick/parser":98}],37:[function(require,module,exports){ 2310 2311 2312 /** 2313 * Array forEach 2314 */ 2315 function forEach(arr, callback, thisObj) { 2316 if (arr == null) { 2317 return; 2318 } 2319 var i = -1, 2320 len = arr.length; 2321 while (++i < len) { 2322 // we iterate over sparse items since there is no way to make it 2323 // work properly on IE 7-8. see #64 2324 if ( callback.call(thisObj, arr[i], i, arr) === false ) { 2325 break; 2326 } 2327 } 2328 } 2329 2330 module.exports = forEach; 2331 2332 2333 2334},{}],38:[function(require,module,exports){ 2335var makeIterator = require('../function/makeIterator_'); 2336 2337 /** 2338 * Array map 2339 */ 2340 function map(arr, callback, thisObj) { 2341 callback = makeIterator(callback, thisObj); 2342 var results = []; 2343 if (arr == null){ 2344 return results; 2345 } 2346 2347 var i = -1, len = arr.length; 2348 while (++i < len) { 2349 results[i] = callback(arr[i], i, arr); 2350 } 2351 2352 return results; 2353 } 2354 2355 module.exports = map; 2356 2357 2358},{"../function/makeIterator_":42}],39:[function(require,module,exports){ 2359 2360 2361 /** 2362 * Create slice of source array or array-like object 2363 */ 2364 function slice(arr, start, end){ 2365 var len = arr.length; 2366 2367 if (start == null) { 2368 start = 0; 2369 } else if (start < 0) { 2370 start = Math.max(len + start, 0); 2371 } else { 2372 start = Math.min(start, len); 2373 } 2374 2375 if (end == null) { 2376 end = len; 2377 } else if (end < 0) { 2378 end = Math.max(len + end, 0); 2379 } else { 2380 end = Math.min(end, len); 2381 } 2382 2383 var result = []; 2384 while (start < end) { 2385 result.push(arr[start++]); 2386 } 2387 2388 return result; 2389 } 2390 2391 module.exports = slice; 2392 2393 2394 2395},{}],40:[function(require,module,exports){ 2396var slice = require('../array/slice'); 2397 2398 /** 2399 * Return a function that will execute in the given context, optionally adding any additional supplied parameters to the beginning of the arguments collection. 2400 * @param {Function} fn Function. 2401 * @param {object} context Execution context. 2402 * @param {rest} args Arguments (0...n arguments). 2403 * @return {Function} Wrapped Function. 2404 */
2405 function bind(fn, context, args){ 2406 var argsArr = slice(arguments, 2); //curried args 2407 return function(){ 2408 return fn.apply(context, argsArr.concat(slice(arguments))); 2409 }; 2410 } 2411 2412 module.exports = bind; 2413 2414 2415 2416},{"../array/slice":39}],41:[function(require,module,exports){ 2417 2418 2419 /** 2420 * Returns the first argument provided to it. 2421 */ 2422 function identity(val){ 2423 return val; 2424 } 2425 2426 module.exports = identity; 2427 2428 2429 2430},{}],42:[function(require,module,exports){ 2431var identity = require('./identity'); 2432var prop = require('./prop'); 2433var deepMatches = require('../object/deepMatches'); 2434 2435 /** 2436 * Converts argument into a valid iterator. 2437 * Used internally on most array/object/collection methods that receives a 2438 * callback/iterator providing a shortcut syntax. 2439 */ 2440 function makeIterator(src, thisObj){ 2441 if (src == null) { 2442 return identity; 2443 } 2444 switch(typeof src) { 2445 case 'function': 2446 // function is the first to improve perf (most common case) 2447 // also avoid using `Function#call` if not needed, which boosts 2448 // perf a lot in some cases 2449 return (typeof thisObj !== 'undefined')? function(val, i, arr){ 2450 return src.call(thisObj, val, i, arr); 2451 } : src; 2452 case 'object': 2453 return function(val){ 2454 return deepMatches(val, src); 2455 }; 2456 case 'string': 2457 case 'number': 2458 return prop(src); 2459 } 2460 } 2461 2462 module.exports = makeIterator; 2463 2464 2465 2466},{"../object/deepMatches":53,"./identity":41,"./prop":43}],43:[function(require,module,exports){ 2467 2468 2469 /** 2470 * Returns a function that gets a property of the passed object 2471 */ 2472 function prop(name){ 2473 return function(obj){ 2474 return obj[name]; 2475 }; 2476 } 2477 2478 module.exports = prop; 2479 2480 2481 2482},{}],44:[function(require,module,exports){ 2483var slice = require('../array/slice'); 2484 2485 /** 2486 * Delays the call of a function within a given context. 2487 */ 2488 function timeout(fn, millis, context){ 2489 2490 var args = slice(arguments, 3); 2491 2492 return setTimeout(function() { 2493 fn.apply(context, args); 2494 }, millis); 2495 } 2496 2497 module.exports = timeout; 2498 2499 2500 2501},{"../array/slice":39}],45:[function(require,module,exports){ 2502var isKind = require('./isKind'); 2503 /** 2504 */ 2505 var isArray = Array.isArray || function (val) { 2506 return isKind(val, 'Array'); 2507 }; 2508 module.exports = isArray; 2509 2510 2511},{"./isKind":46}],46:[function(require,module,exports){ 2512var kindOf = require('./kindOf'); 2513 /** 2514 * Check if value is from a specific "kind". 2515 */ 2516 function isKind(val, kind){ 2517 return kindOf(val) === kind; 2518 } 2519 module.exports = isKind; 2520 2521 2522},{"./kindOf":47}],47:[function(require,module,exports){ 2523 2524 /** 2525 * Gets the "kind" of value. (e.g. "String", "Number", etc) 2526 */ 2527 function kindOf(val) { 2528 return Object.prototype.toString.call(val).slice(8, -1); 2529 } 2530 module.exports = kindOf; 2531 2532 2533},{}],48:[function(require,module,exports){ 2534 2535 2536 /** 2537 * Typecast a value to a String, using an empty string value for null or 2538 * undefined. 2539 */ 2540 function toString(val){ 2541 return val == null ? '' : val.toString(); 2542 } 2543 2544 module.exports = toString; 2545 2546 2547 2548},{}],49:[function(require,module,exports){ 2549 2550 /** 2551 * Clamps value inside range. 2552 */ 2553 function clamp(val, min, max){ 2554 return val < min? min : (val > max? max : val); 2555 } 2556 module.exports = clamp; 2557 2558 2559},{}],50:[function(require,module,exports){ 2560 2561 /** 2562 * Linear interpolation. 2563 * IMPORTANT:will return `Infinity` if numbers overflow Number.MAX_VALUE 2564 */ 2565 function lerp(ratio, start, end){ 2566 return start + (end - start) * ratio; 2567 } 2568 2569 module.exports = lerp; 2570 2571 2572},{}],51:[function(require,module,exports){ 2573var lerp = require('./lerp'); 2574var norm = require('./norm'); 2575 /** 2576 * Maps a number from one scale to another. 2577 * @example map(3, 0, 4, -1, 1) -> 0.5 2578 */ 2579 function map(val, min1, max1, min2, max2){ 2580 return lerp( norm(val, min1, max1), min2, max2 ); 2581 } 2582 module.exports = map; 2583 2584 2585},{"./lerp":50,"./norm":52}],52:[function(require,module,exports){ 2586 2587 /** 2588 * Gets normalized ratio of value inside range. 2589 */ 2590 function norm(val, min, max){ 2591 if (val < min || val > max) { 2592 throw new RangeError('value (' + val + ') must be between ' + min + ' and ' + max); 2593 } 2594 2595 return val === max ? 1 : (val - min) / (max - min); 2596 } 2597 module.exports = norm; 2598 2599 2600},{}],53:[function(require,module,exports){ 2601var forOwn = require('./forOwn'); 2602var isArray = require('../lang/isArray'); 2603 2604 function containsMatch(array, pattern) { 2605 var i = -1, length = array.length; 2606 while (++i < length) { 2607 if (deepMatches(array[i], pattern)) { 2608 return true; 2609 } 2610 } 2611 2612 return false; 2613 } 2614 2615 function matchArray(target, pattern) { 2616 var i = -1, patternLength = pattern.length; 2617 while (++i < patternLength) { 2618 if (!containsMatch(target, pattern[i])) { 2619 return false; 2620 } 2621 } 2622 2623 return true; 2624 } 2625 2626 function matchObject(target, pattern) { 2627 var result = true; 2628 forOwn(pattern, function(val, key) { 2629 if (!deepMatches(target[key], val)) { 2630 // Return false to break out of forOwn early 2631 return (result = false); 2632 } 2633 }); 2634 2635 return result; 2636 } 2637 2638 /** 2639 * Recursively check if the objects match. 2640 */ 2641 function deepMatches(target, pattern){ 2642 if (target && typeof target === 'object' && 2643 pattern && typeof pattern === 'object') { 2644 if (isArray(target) && isArray(pattern)) { 2645 return matchArray(target, pattern); 2646 } else { 2647 return matchObject(target, pattern); 2648 } 2649 } else { 2650 return target === pattern; 2651 } 2652 } 2653 2654 module.exports = deepMatches; 2655 2656 2657 2658},{"../lang/isArray":45,"./forOwn":55}],54:[function(require,module,exports){ 2659var hasOwn = require('./hasOwn'); 2660 2661 var _hasDontEnumBug, 2662 _dontEnums; 2663 2664 function checkDontEnum(){ 2665 _dontEnums = [ 2666 'toString',
2667 'toLocaleString', 2668 'valueOf', 2669 'hasOwnProperty', 2670 'isPrototypeOf', 2671 'propertyIsEnumerable', 2672 'constructor' 2673 ]; 2674 2675 _hasDontEnumBug = true; 2676 2677 for (var key in {'toString': null}) { 2678 _hasDontEnumBug = false; 2679 } 2680 } 2681 2682 /** 2683 * Similar to Array/forEach but works over object properties and fixes Don't 2684 * Enum bug on IE. 2685 * based on: http://whattheheadsaid.com/2010/10/a-safer-object-keys-compatibility-implementation 2686 */ 2687 function forIn(obj, fn, thisObj){ 2688 var key, i = 0; 2689 // no need to check if argument is a real object that way we can use 2690 // it for arrays, functions, date, etc. 2691 2692 //post-pone check till needed 2693 if (_hasDontEnumBug == null) checkDontEnum(); 2694 2695 for (key in obj) { 2696 if (exec(fn, obj, key, thisObj) === false) { 2697 break; 2698 } 2699 } 2700 2701 2702 if (_hasDontEnumBug) { 2703 var ctor = obj.constructor, 2704 isProto = !!ctor && obj === ctor.prototype; 2705 2706 while (key = _dontEnums[i++]) { 2707 // For constructor, if it is a prototype object the constructor 2708 // is always non-enumerable unless defined otherwise (and 2709 // enumerated above). For non-prototype objects, it will have 2710 // to be defined on this object, since it cannot be defined on 2711 // any prototype objects. 2712 // 2713 // For other [[DontEnum]] properties, check if the value is 2714 // different than Object prototype value. 2715 if ( 2716 (key !== 'constructor' || 2717 (!isProto && hasOwn(obj, key))) && 2718 obj[key] !== Object.prototype[key] 2719 ) { 2720 if (exec(fn, obj, key, thisObj) === false) { 2721 break; 2722 } 2723 } 2724 } 2725 } 2726 } 2727 2728 function exec(fn, obj, key, thisObj){ 2729 return fn.call(thisObj, obj[key], key, obj); 2730 } 2731 2732 module.exports = forIn; 2733 2734 2735 2736},{"./hasOwn":56}],55:[function(require,module,exports){ 2737var hasOwn = require('./hasOwn'); 2738var forIn = require('./forIn'); 2739 2740 /** 2741 * Similar to Array/forEach but works over object properties and fixes Don't 2742 * Enum bug on IE. 2743 * based on: http://whattheheadsaid.com/2010/10/a-safer-object-keys-compatibility-implementation 2744 */ 2745 function forOwn(obj, fn, thisObj){ 2746 forIn(obj, function(val, key){ 2747 if (hasOwn(obj, key)) { 2748 return fn.call(thisObj, obj[key], key, obj); 2749 } 2750 }); 2751 } 2752 2753 module.exports = forOwn; 2754 2755 2756 2757},{"./forIn":54,"./hasOwn":56}],56:[function(require,module,exports){ 2758 2759 2760 /** 2761 * Safer Object.hasOwnProperty 2762 */ 2763 function hasOwn(obj, prop){ 2764 return Object.prototype.hasOwnProperty.call(obj, prop); 2765 } 2766 2767 module.exports = hasOwn; 2768 2769 2770 2771},{}],57:[function(require,module,exports){ 2772 2773 /** 2774 * Contains all Unicode white-spaces. Taken from 2775 * http://en.wikipedia.org/wiki/Whitespace_character. 2776 */ 2777 module.exports = [ 2778 ' ', '\n', '\r', '\t', '\f', '\v', '\u00A0', '\u1680', '\u180E', 2779 '\u2000', '\u2001', '\u2002', '\u2003', '\u2004', '\u2005', '\u2006', 2780 '\u2007', '\u2008', '\u2009', '\u200A', '\u2028', '\u2029', '\u202F', 2781 '\u205F', '\u3000' 2782 ]; 2783 2784 2785},{}],58:[function(require,module,exports){ 2786var toString = require('../lang/toString'); 2787var WHITE_SPACES = require('./WHITE_SPACES'); 2788 /** 2789 * Remove chars from beginning of string. 2790 */ 2791 function ltrim(str, chars) { 2792 str = toString(str); 2793 chars = chars || WHITE_SPACES; 2794 2795 var start = 0, 2796 len = str.length, 2797 charLen = chars.length, 2798 found = true, 2799 i, c; 2800 2801 while (found && start < len) { 2802 found = false; 2803 i = -1; 2804 c = str.charAt(start); 2805 2806 while (++i < charLen) { 2807 if (c === chars[i]) { 2808 found = true; 2809 start++; 2810 break; 2811 } 2812 } 2813 } 2814 2815 return (start >= len) ? '' : str.substr(start, len); 2816 } 2817 2818 module.exports = ltrim; 2819 2820 2821},{"../lang/toString":48,"./WHITE_SPACES":57}],59:[function(require,module,exports){ 2822var toString = require('../lang/toString'); 2823var WHITE_SPACES = require('./WHITE_SPACES'); 2824 /** 2825 * Remove chars from end of string. 2826 */ 2827 function rtrim(str, chars) { 2828 str = toString(str); 2829 chars = chars || WHITE_SPACES; 2830 2831 var end = str.length - 1, 2832 charLen = chars.length, 2833 found = true, 2834 i, c; 2835 2836 while (found && end >= 0) { 2837 found = false; 2838 i = -1; 2839 c = str.charAt(end); 2840 2841 while (++i < charLen) { 2842 if (c === chars[i]) { 2843 found = true; 2844 end--; 2845 break; 2846 } 2847 } 2848 } 2849 2850 return (end >= 0) ? str.substring(0, end + 1) : ''; 2851 } 2852 2853 module.exports = rtrim; 2854 2855 2856},{"../lang/toString":48,"./WHITE_SPACES":57}],60:[function(require,module,exports){ 2857var toString = require('../lang/toString'); 2858var WHITE_SPACES = require('./WHITE_SPACES'); 2859var ltrim = require('./ltrim'); 2860var rtrim = require('./rtrim'); 2861 /** 2862 * Remove white-spaces from beginning and end of string. 2863 */ 2864 function trim(str, chars) { 2865 str = toString(str); 2866 chars = chars || WHITE_SPACES; 2867 return ltrim(rtrim(str, chars), chars); 2868 } 2869 2870 module.exports = trim; 2871 2872 2873},{"../lang/toString":48,"./WHITE_SPACES":57,"./ltrim":58,"./rtrim":59}],61:[function(require,module,exports){ 2874 2875 2876 /** 2877 * Create slice of source array or array-like object 2878 */ 2879 function slice(arr, start, end){ 2880 var len = arr.length; 2881 2882 if (start == null) { 2883 start = 0; 2884 } else if (start < 0) { 2885 start = Math.max(len + start, 0); 2886 } else { 2887 start = Math.min(start, len); 2888 } 2889 2890 if (end == null) { 2891 end = len; 2892 } else if (end < 0) { 2893 end = Math.max(len + end, 0); 2894 } else { 2895 end = Math.min(end, len); 2896 } 2897 2898 var result = []; 2899 while (start < end) { 2900 result.push(arr[start++]); 2901 } 2902 2903 return result; 2904 } 2905 2906 module.exports = slice; 2907 2908 2909 2910},{}],62:[function(require,module,exports){ 2911var slice = require('../array/slice'); 2912 2913 /** 2914 * Return a function that will execute in the given context, optionally adding any additional supplied parameters to the beginning of the arguments collection. 2915 * @param {Function} fn Function. 2916 * @param {object} context Execution context. 2917 * @param {rest} args Arguments (0...n arguments). 2918 * @return {Function} Wrapped Function. 2919 */
2920 function bind(fn, context, args){ 2921 var argsArr = slice(arguments, 2); //curried args 2922 return function(){ 2923 return fn.apply(context, argsArr.concat(slice(arguments))); 2924 }; 2925 } 2926 2927 module.exports = bind; 2928 2929 2930 2931},{"../array/slice":61}],63:[function(require,module,exports){ 2932var kindOf = require('./kindOf'); 2933var isPlainObject = require('./isPlainObject'); 2934var mixIn = require('../object/mixIn'); 2935 2936 /** 2937 * Clone native types. 2938 */ 2939 function clone(val){ 2940 switch (kindOf(val)) { 2941 case 'Object': 2942 return cloneObject(val); 2943 case 'Array': 2944 return cloneArray(val); 2945 case 'RegExp': 2946 return cloneRegExp(val); 2947 case 'Date': 2948 return cloneDate(val); 2949 default: 2950 return val; 2951 } 2952 } 2953 2954 function cloneObject(source) { 2955 if (isPlainObject(source)) { 2956 return mixIn({}, source); 2957 } else { 2958 return source; 2959 } 2960 } 2961 2962 function cloneRegExp(r) { 2963 var flags = ''; 2964 flags += r.multiline ? 'm' : ''; 2965 flags += r.global ? 'g' : ''; 2966 flags += r.ignorecase ? 'i' : ''; 2967 return new RegExp(r.source, flags); 2968 } 2969 2970 function cloneDate(date) { 2971 return new Date(+date); 2972 } 2973 2974 function cloneArray(arr) { 2975 return arr.slice(); 2976 } 2977 2978 module.exports = clone; 2979 2980 2981 2982},{"../object/mixIn":73,"./isPlainObject":67,"./kindOf":68}],64:[function(require,module,exports){ 2983var clone = require('./clone'); 2984var forOwn = require('../object/forOwn'); 2985var kindOf = require('./kindOf'); 2986var isPlainObject = require('./isPlainObject'); 2987 2988 /** 2989 * Recursively clone native types. 2990 */ 2991 function deepClone(val, instanceClone) { 2992 switch ( kindOf(val) ) { 2993 case 'Object': 2994 return cloneObject(val, instanceClone); 2995 case 'Array': 2996 return cloneArray(val, instanceClone); 2997 default: 2998 return clone(val); 2999 } 3000 } 3001 3002 function cloneObject(source, instanceClone) { 3003 if (isPlainObject(source)) { 3004 var out = {}; 3005 forOwn(source, function(val, key) { 3006 this[key] = deepClone(val, instanceClone); 3007 }, out); 3008 return out; 3009 } else if (instanceClone) { 3010 return instanceClone(source); 3011 } else { 3012 return source; 3013 } 3014 } 3015 3016 function cloneArray(arr, instanceClone) { 3017 var out = [], 3018 i = -1, 3019 n = arr.length, 3020 val; 3021 while (++i < n) { 3022 out[i] = deepClone(arr[i], instanceClone); 3023 } 3024 return out; 3025 } 3026 3027 module.exports = deepClone; 3028 3029 3030 3031 3032},{"../object/forOwn":70,"./clone":63,"./isPlainObject":67,"./kindOf":68}],65:[function(require,module,exports){ 3033arguments[4][24][0].apply(exports,arguments) 3034},{"./kindOf":68,"dup":24}],66:[function(require,module,exports){ 3035var isKind = require('./isKind'); 3036 /** 3037 */ 3038 function isObject(val) { 3039 return isKind(val, 'Object'); 3040 } 3041 module.exports = isObject; 3042 3043 3044},{"./isKind":65}],67:[function(require,module,exports){ 3045 3046 3047 /** 3048 * Checks if the value is created by the `Object` constructor. 3049 */ 3050 function isPlainObject(value) { 3051 return (!!value && typeof value === 'object' && 3052 value.constructor === Object); 3053 } 3054 3055 module.exports = isPlainObject; 3056 3057 3058 3059},{}],68:[function(require,module,exports){ 3060arguments[4][25][0].apply(exports,arguments) 3061},{"dup":25}],69:[function(require,module,exports){ 3062arguments[4][28][0].apply(exports,arguments) 3063},{"./hasOwn":71,"dup":28}],70:[function(require,module,exports){ 3064arguments[4][29][0].apply(exports,arguments) 3065},{"./forIn":69,"./hasOwn":71,"dup":29}],71:[function(require,module,exports){ 3066arguments[4][30][0].apply(exports,arguments) 3067},{"dup":30}],72:[function(require,module,exports){ 3068var hasOwn = require('./hasOwn'); 3069var deepClone = require('../lang/deepClone'); 3070var isObject = require('../lang/isObject'); 3071 3072 /** 3073 * Deep merge objects. 3074 */ 3075 function merge() { 3076 var i = 1, 3077 key, val, obj, target; 3078 3079 // make sure we don't modify source element and it's properties 3080 // objects are passed by reference 3081 target = deepClone( arguments[0] ); 3082 3083 while (obj = arguments[i++]) { 3084 for (key in obj) { 3085 if ( ! hasOwn(obj, key) ) { 3086 continue; 3087 } 3088 3089 val = obj[key]; 3090 3091 if ( isObject(val) && isObject(target[key]) ){ 3092 // inception, deep merge objects 3093 target[key] = merge(target[key], val); 3094 } else { 3095 // make sure arrays, regexp, date, objects are cloned 3096 target[key] = deepClone(val); 3097 } 3098 3099 } 3100 } 3101 3102 return target; 3103 } 3104 3105 module.exports = merge; 3106 3107 3108 3109},{"../lang/deepClone":64,"../lang/isObject":66,"./hasOwn":71}],73:[function(require,module,exports){ 3110var forOwn = require('./forOwn'); 3111 3112 /** 3113 * Combine properties from all the objects into first one. 3114 * - This method affects target object in place, if you want to create a new Object pass an empty object as first param. 3115 * @param {object} target Target Object 3116 * @param {...object}
3116 objects Objects to be combined (0...n objects). 3117 * @return {object} Target Object. 3118 */ 3119 function mixIn(target, objects){ 3120 var i = 0, 3121 n = arguments.length, 3122 obj; 3123 while(++i < n){ 3124 obj = arguments[i]; 3125 if (obj != null) { 3126 forOwn(obj, copyProp, target); 3127 } 3128 } 3129 return target; 3130 } 3131 3132 function copyProp(val, key){ 3133 this[key] = val; 3134 } 3135 3136 module.exports = mixIn; 3137 3138 3139},{"./forOwn":70}],74:[function(require,module,exports){ 3140/* 3141prime 3142 - prototypal inheritance 3143*/"use strict" 3144 3145var hasOwn = require("mout/object/hasOwn"), 3146 mixIn = require("mout/object/mixIn"), 3147 create = require("mout/lang/createObject"), 3148 kindOf = require("mout/lang/kindOf") 3149 3150var hasDescriptors = true 3151 3152try { 3153 Object.defineProperty({}, "~", {}) 3154 Object.getOwnPropertyDescriptor({}, "~") 3155} catch (e){ 3156 hasDescriptors = false 3157} 3158 3159// we only need to be able to implement "toString" and "valueOf" in IE < 9 3160var hasEnumBug = !({valueOf: 0}).propertyIsEnumerable("valueOf"), 3161 buggy = ["toString", "valueOf"] 3162 3163var verbs = /^constructor|inherits|mixin$/ 3164 3165var implement = function(proto){ 3166 var prototype = this.prototype 3167 3168 for (var key in proto){ 3169 if (key.match(verbs)) continue 3170 if (hasDescriptors){ 3171 var descriptor = Object.getOwnPropertyDescriptor(proto, key) 3172 if (descriptor){ 3173 Object.defineProperty(prototype, key, descriptor) 3174 continue 3175 } 3176 } 3177 prototype[key] = proto[key] 3178 } 3179 3180 if (hasEnumBug) for (var i = 0; (key = buggy[i]); i++){ 3181 var value = proto[key] 3182 if (value !== Object.prototype[key]) prototype[key] = value 3183 } 3184 3185 return this 3186} 3187 3188var prime = function(proto){ 3189 3190 if (kindOf(proto) === "Function") proto = {constructor: proto} 3191 3192 var superprime = proto.inherits 3193 3194 // if our nice proto object has no own constructor property 3195 // then we proceed using a ghosting constructor that all it does is 3196 // call the parent's constructor if it has a superprime, else an empty constructor 3197 // proto.constructor becomes the effective constructor 3198 var constructor = (hasOwn(proto, "constructor")) ? proto.constructor : (superprime) ? function(){ 3199 return superprime.apply(this, arguments) 3200 } : function(){} 3201 3202 if (superprime){ 3203 3204 mixIn(constructor, superprime) 3205 3206 var superproto = superprime.prototype 3207 // inherit from superprime 3208 var cproto = constructor.prototype = create(superproto) 3209 3210 // setting constructor.parent to superprime.prototype 3211 // because it's the shortest possible absolute reference 3212 constructor.parent = superproto 3213 cproto.constructor = constructor 3214 } 3215 3216 if (!constructor.implement) constructor.implement = implement 3217 3218 var mixins = proto.mixin 3219 if (mixins){ 3220 if (kindOf(mixins) !== "Array") mixins = [mixins] 3221 for (var i = 0; i < mixins.length; i++) constructor.implement(create(mixins[i].prototype)) 3222 } 3223 3224 // implement proto and return constructor 3225 return constructor.implement(proto) 3226 3227} 3228 3229module.exports = prime 3230 3231},{"mout/lang/createObject":75,"mout/lang/kindOf":76,"mout/object/hasOwn":79,"mout/object/mixIn":80}],75:[function(require,module,exports){ 3232var mixIn = require('../object/mixIn'); 3233 3234 /** 3235 * Create Object using prototypal inheritance and setting custom properties. 3236 * - Mix between Douglas Crockford Prototypal Inheritance <http://javascript.crockford.com/prototypal.html> and the EcmaScript 5 `Object.create()` method. 3237 * @param {object} parent Parent Object. 3238 * @param {object} [props] Object properties. 3239 * @return {object} Created object. 3240 */ 3241 function createObject(parent, props){ 3242 function F(){} 3243 F.prototype = parent; 3244 return mixIn(new F(), props); 3245 3246 } 3247 module.exports = createObject; 3248 3249 3250 3251},{"../object/mixIn":80}],76:[function(require,module,exports){ 3252arguments[4][25][0].apply(exports,arguments) 3253},{"dup":25}],77:[function(require,module,exports){ 3254arguments[4][28][0].apply(exports,arguments) 3255},{"./hasOwn":79,"dup":28}],78:[function(require,module,exports){ 3256arguments[4][29][0].apply(exports,arguments) 3257},{"./forIn":77,"./hasOwn":79,"dup":29}],79:[function(require,module,exports){ 3258arguments[4][30][0].apply(exports,arguments) 3259},{"dup":30}],80:[function(require,module,exports){ 3260arguments[4][73][0].apply(exports,arguments) 3261},{"./forOwn":78,"dup":73}],81:[function(require,module,exports){ 3262"use strict"; 3263 3264// credits to @cpojer's Class.Binds, released under the MIT license 3265// https://github.com/cpojer/mootools-class-extras/blob/master/Source/Class.Binds.js 3266 3267var prime = require("prime") 3268var bind = require("mout/function/bind") 3269 3270var bound = prime({ 3271 3272 bound: function(name){ 3273 var bound = this._bound || (this._bound = {}) 3274 return bound[name] || (bound[name] = bind(this[name], this)) 3275 } 3276 3277}) 3278 3279module.exports = bound 3280 3281},{"mout/function/bind":62,"prime":74}],82:[function(require,module,exports){ 3282"use strict"; 3283 3284var prime = require("prime") 3285var merge = require("mout/object/merge") 3286 3287var Options = prime({ 3288 3289 setOptions: function(options){ 3290 var args = [{}, this.options] 3291 args.push.apply(args, arguments)
3292 this.options = merge.apply(null, args) 3293 return this 3294 } 3295 3296}) 3297 3298module.exports = Options 3299 3300},{"mout/object/merge":72,"prime":74}],83:[function(require,module,exports){ 3301(function (process,global,setImmediate){(function (){ 3302/* 3303defer 3304*/"use strict" 3305 3306var kindOf = require("mout/lang/kindOf"), 3307 now = require("mout/time/now"), 3308 forEach = require("mout/array/forEach"), 3309 indexOf = require("mout/array/indexOf") 3310 3311var callbacks = { 3312 timeout: {}, 3313 frame: [], 3314 immediate: [] 3315} 3316 3317var push = function(collection, callback, context, defer){ 3318 3319 var iterator = function(){ 3320 iterate(collection) 3321 } 3322 3323 if (!collection.length) defer(iterator) 3324 3325 var entry = { 3326 callback: callback, 3327 context: context 3328 } 3329 3330 collection.push(entry) 3331 3332 return function(){ 3333 var io = indexOf(collection, entry) 3334 if (io > -1) collection.splice(io, 1) 3335 } 3336} 3337 3338var iterate = function(collection){ 3339 var time = now() 3340 3341 forEach(collection.splice(0), function(entry) { 3342 entry.callback.call(entry.context, time) 3343 }) 3344} 3345 3346var defer = function(callback, argument, context){ 3347 return (kindOf(argument) === "Number") ? defer.timeout(callback, argument, context) : defer.immediate(callback, argument) 3348} 3349 3350if (global.process && process.nextTick){ 3351 3352 defer.immediate = function(callback, context){ 3353 return push(callbacks.immediate, callback, context, process.nextTick) 3354 } 3355 3356} else if (global.setImmediate){ 3357 3358 defer.immediate = function(callback, context){ 3359 return push(callbacks.immediate, callback, context, setImmediate) 3360 } 3361 3362} else if (global.postMessage && global.addEventListener){ 3363 3364 addEventListener("message", function(event){ 3365 if (event.source === global && event.data === "@deferred"){ 3366 event.stopPropagation() 3367 iterate(callbacks.immediate) 3368 } 3369 }, true) 3370 3371 defer.immediate = function(callback, context){ 3372 return push(callbacks.immediate, callback, context, function(){ 3373 postMessage("@deferred", "*") 3374 }) 3375 } 3376 3377} else { 3378 3379 defer.immediate = function(callback, context){ 3380 return push(callbacks.immediate, callback, context, function(iterator){ 3381 setTimeout(iterator, 0) 3382 }) 3383 } 3384 3385} 3386 3387var requestAnimationFrame = global.requestAnimationFrame || 3388 global.webkitRequestAnimationFrame || 3389 global.mozRequestAnimationFrame || 3390 global.oRequestAnimationFrame || 3391 global.msRequestAnimationFrame || 3392 function(callback) { 3393 setTimeout(callback, 1e3 / 60) 3394 } 3395 3396defer.frame = function(callback, context){ 3397 return push(callbacks.frame, callback, context, requestAnimationFrame) 3398} 3399 3400var clear 3401 3402defer.timeout = function(callback, ms, context){ 3403 var ct = callbacks.timeout 3404 3405 if (!clear) clear = defer.immediate(function(){ 3406 clear = null 3407 callbacks.timeout = {} 3408 }) 3409 3410 return push(ct[ms] || (ct[ms] = []), callback, context, function(iterator){ 3411 setTimeout(iterator, ms) 3412 }) 3413} 3414 3415module.exports = defer 3416 3417}).call(this)}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("timers").setImmediate) 3418 3419},{"_process":99,"mout/array/forEach":87,"mout/array/indexOf":88,"mout/lang/kindOf":90,"mout/time/now":95,"timers":100}],84:[function(require,module,exports){ 3420/* 3421Emitter 3422*/"use strict" 3423 3424var indexOf = require("mout/array/indexOf"), 3425 forEach = require("mout/array/forEach") 3426 3427var prime = require("./index"), 3428 defer = require("./defer") 3429 3430var slice = Array.prototype.slice; 3431 3432var Emitter = prime({ 3433 3434 constructor: function(stoppable){ 3435 this._stoppable = stoppable 3436 }, 3437 3438 on: function(event, fn){ 3439 var listeners = this._listeners || (this._listeners = {}), 3440 events = listeners[event] || (listeners[event] = []) 3441 3442 if (indexOf(events, fn) === -1) events.push(fn) 3443 3444 return this 3445 }, 3446 3447 off: function(event, fn){ 3448 var listeners = this._listeners, events 3449 if (listeners && (events = listeners[event])){ 3450 3451 var io = indexOf(events, fn) 3452 if (io > -1) events.splice(io, 1) 3453 if (!events.length) delete listeners[event]; 3454 for (var l in listeners) return this 3455 delete this._listeners 3456 } 3457 return this 3458 }, 3459 3460 emit: function(event){ 3461 var self = this, 3462 args = slice.call(arguments, 1) 3463 3464 var emit = function(){ 3465 var listeners = self._listeners, events 3466 if (listeners && (events = listeners[event])){
3467 forEach(events.slice(0), function(event){ 3468 var result = event.apply(self, args) 3469 if (self._stoppable) return result 3470 }) 3471 } 3472 } 3473 3474 if (args[args.length - 1] === Emitter.EMIT_SYNC){ 3475 args.pop() 3476 emit() 3477 } else { 3478 defer(emit) 3479 } 3480 3481 return this 3482 } 3483 3484}) 3485 3486Emitter.EMIT_SYNC = {} 3487 3488module.exports = Emitter 3489 3490},{"./defer":83,"./index":85,"mout/array/forEach":87,"mout/array/indexOf":88}],85:[function(require,module,exports){ 3491/* 3492prime 3493 - prototypal inheritance 3494*/"use strict" 3495 3496var hasOwn = require("mout/object/hasOwn"), 3497 mixIn = require("mout/object/mixIn"), 3498 create = require("mout/lang/createObject"), 3499 kindOf = require("mout/lang/kindOf") 3500 3501var hasDescriptors = true 3502 3503try { 3504 Object.defineProperty({}, "~", {}) 3505 Object.getOwnPropertyDescriptor({}, "~") 3506} catch (e){ 3507 hasDescriptors = false 3508} 3509 3510// we only need to be able to implement "toString" and "valueOf" in IE < 9 3511var hasEnumBug = !({valueOf: 0}).propertyIsEnumerable("valueOf"), 3512 buggy = ["toString", "valueOf"] 3513 3514var verbs = /^constructor|inherits|mixin$/ 3515 3516var implement = function(proto){ 3517 var prototype = this.prototype 3518 3519 for (var key in proto){ 3520 if (key.match(verbs)) continue 3521 if (hasDescriptors){ 3522 var descriptor = Object.getOwnPropertyDescriptor(proto, key) 3523 if (descriptor){ 3524 Object.defineProperty(prototype, key, descriptor) 3525 continue 3526 } 3527 } 3528 prototype[key] = proto[key] 3529 } 3530 3531 if (hasEnumBug) for (var i = 0; (key = buggy[i]); i++){ 3532 var value = proto[key] 3533 if (value !== Object.prototype[key]) prototype[key] = value 3534 } 3535 3536 return this 3537} 3538 3539var prime = function(proto){ 3540 3541 if (kindOf(proto) === "Function") proto = {constructor: proto} 3542 3543 var superprime = proto.inherits 3544 3545 // if our nice proto object has no own constructor property 3546 // then we proceed using a ghosting constructor that all it does is 3547 // call the parent's constructor if it has a superprime, else an empty constructor 3548 // proto.constructor becomes the effective constructor 3549 var constructor = (hasOwn(proto, "constructor")) ? proto.constructor : (superprime) ? function(){ 3550 return superprime.apply(this, arguments) 3551 } : function(){} 3552 3553 if (superprime){ 3554 3555 mixIn(constructor, superprime) 3556 3557 var superproto = superprime.prototype 3558 // inherit from superprime 3559 var cproto = constructor.prototype = create(superproto) 3560 3561 // setting constructor.parent to superprime.prototype 3562 // because it's the shortest possible absolute reference 3563 constructor.parent = superproto 3564 cproto.constructor = constructor 3565 } 3566 3567 if (!constructor.implement) constructor.implement = implement 3568 3569 var mixins = proto.mixin 3570 if (mixins){ 3571 if (kindOf(mixins) !== "Array") mixins = [mixins] 3572 for (var i = 0; i < mixins.length; i++) constructor.implement(create(mixins[i].prototype)) 3573 } 3574 3575 // implement proto and return constructor 3576 return constructor.implement(proto) 3577 3578} 3579 3580module.exports = prime 3581 3582},{"mout/lang/createObject":89,"mout/lang/kindOf":90,"mout/object/hasOwn":93,"mout/object/mixIn":94}],86:[function(require,module,exports){ 3583/* 3584Map 3585*/"use strict" 3586 3587var indexOf = require("mout/array/indexOf") 3588 3589var prime = require("./index") 3590 3591var Map = prime({ 3592 3593 constructor: function Map(){ 3594 this.length = 0 3595 this._values = [] 3596 this._keys = [] 3597 }, 3598 3599 set: function(key, value){ 3600 var index = indexOf(this._keys, key) 3601 3602 if (index === -1){ 3603 this._keys.push(key) 3604 this._values.push(value) 3605 this.length++ 3606 } else { 3607 this._values[index] = value 3608 } 3609 3610 return this 3611 }, 3612 3613 get: function(key){ 3614 var index = indexOf(this._keys, key) 3615 return (index === -1) ? null : this._values[index] 3616 }, 3617 3618 count: function(){ 3619 return this.length 3620 }, 3621
3622 forEach: function(method, context){ 3623 for (var i = 0, l = this.length; i < l; i++){ 3624 if (method.call(context, this._values[i], this._keys[i], this) === false) break 3625 } 3626 return this 3627 }, 3628 3629 map: function(method, context){ 3630 var results = new Map 3631 this.forEach(function(value, key){ 3632 results.set(key, method.call(context, value, key, this)) 3633 }, this) 3634 return results 3635 }, 3636 3637 filter: function(method, context){ 3638 var results = new Map 3639 this.forEach(function(value, key){ 3640 if (method.call(context, value, key, this)) results.set(key, value) 3641 }, this) 3642 return results 3643 }, 3644 3645 every: function(method, context){ 3646 var every = true 3647 this.forEach(function(value, key){ 3648 if (!method.call(context, value, key, this)) return (every = false) 3649 }, this) 3650 return every 3651 }, 3652 3653 some: function(method, context){ 3654 var some = false 3655 this.forEach(function(value, key){ 3656 if (method.call(context, value, key, this)) return !(some = true) 3657 }, this) 3658 return some 3659 }, 3660 3661 indexOf: function(value){ 3662 var index = indexOf(this._values, value) 3663 return (index > -1) ? this._keys[index] : null 3664 }, 3665 3666 remove: function(value){ 3667 var index = indexOf(this._values, value) 3668 3669 if (index !== -1){ 3670 this._values.splice(index, 1) 3671 this.length-- 3672 return this._keys.splice(index, 1)[0] 3673 } 3674 3675 return null 3676 }, 3677 3678 unset: function(key){ 3679 var index = indexOf(this._keys, key) 3680 3681 if (index !== -1){ 3682 this._keys.splice(index, 1) 3683 this.length-- 3684 return this._values.splice(index, 1)[0] 3685 } 3686 3687 return null 3688 }, 3689 3690 keys: function(){ 3691 return this._keys.slice() 3692 }, 3693 3694 values: function(){ 3695 return this._values.slice() 3696 } 3697 3698}) 3699 3700var map = function(){ 3701 return new Map 3702} 3703 3704map.prototype = Map.prototype 3705 3706module.exports = map 3707 3708},{"./index":85,"mout/array/indexOf":88}],87:[function(require,module,exports){ 3709arguments[4][16][0].apply(exports,arguments) 3710},{"dup":16}],88:[function(require,module,exports){ 3711arguments[4][17][0].apply(exports,arguments) 3712},{"dup":17}],89:[function(require,module,exports){ 3713arguments[4][75][0].apply(exports,arguments) 3714},{"../object/mixIn":94,"dup":75}],90:[function(require,module,exports){ 3715arguments[4][25][0].apply(exports,arguments) 3716},{"dup":25}],91:[function(require,module,exports){ 3717arguments[4][28][0].apply(exports,arguments) 3718},{"./hasOwn":93,"dup":28}],92:[function(require,module,exports){ 3719arguments[4][29][0].apply(exports,arguments) 3720},{"./forIn":91,"./hasOwn":93,"dup":29}],93:[function(require,module,exports){ 3721arguments[4][30][0].apply(exports,arguments) 3722},{"dup":30}],94:[function(require,module,exports){ 3723arguments[4][73][0].apply(exports,arguments) 3724},{"./forOwn":92,"dup":73}],95:[function(require,module,exports){ 3725 3726 3727 /** 3728 * Get current time in miliseconds 3729 */ 3730 function now(){ 3731 // yes, we defer the work to another function to allow mocking it 3732 // during the tests 3733 return now.get(); 3734 } 3735 3736 now.get = (typeof Date.now === 'function')? Date.now : function(){ 3737 return +(new Date()); 3738 }; 3739 3740 module.exports = now; 3741 3742 3743 3744},{}],96:[function(require,module,exports){ 3745/* 3746Slick Finder 3747*/"use strict" 3748 3749// Notable changes from Slick.Finder 1.0.x 3750 3751// faster bottom -> up expression matching 3752// prefers mental sanity over *obsessive compulsive* milliseconds savings 3753// uses prototypes instead of objects 3754// tries to use matchesSelector smartly, whenever available 3755// can populate objects as well as arrays 3756// lots of stuff is broken or not implemented 3757 3758var parse = require("./parser") 3759 3760// utilities 3761 3762var index = 0, 3763 counter = document.__counter = (parseInt(document.__counter || -1, 36) + 1).toString(36), 3764 key = "uid:" + counter 3765 3766var uniqueID = function(n, xml){ 3767 if (n === window) return "window" 3768 if (n === document) return "document" 3769 if (n === document.documentElement) return "html" 3770 3771 if (xml) { 3772 var uid = n.getAttribute(key) 3773 if (!uid) { 3774 uid = (index++).toString(36) 3775 n.setAttribute(key, uid) 3776 } 3777 return uid 3778 } else { 3779 return n[key] || (n[key] = (index++).toString(36)) 3780 } 3781} 3782 3783var uniqueIDXML = function(n) { 3784 return uniqueID(n, true) 3785} 3786 3787var isArray = Array.isArray || function(object){ 3788 return Object.prototype.toString.call(object) === "[object Array]" 3789} 3790 3791// tests 3792 3793var uniqueIndex = 0; 3794 3795var HAS = { 3796 3797 GET_ELEMENT_BY_ID: function(test, id){ 3798 id = "slick_" + (uniqueIndex++); 3799 // checks if the document has getElementById, and it works 3800 test.innerHTML = '<a id="' + id + '"></a>' 3801 return !!this.getElementById(id) 3802 }, 3803 3804 QUERY_SELECTOR: function(test){ 3805 // this supposedly fixes a webkit bug with matchesSelector / querySelector & nth-child 3806 test.innerHTML = '_<style>:nth-child(2){}</style>' 3807 3808 // checks if the document has querySelectorAll, and it works 3809 test.innerHTML = '<a class="MiX"></a>' 3810 3811 return test.querySelectorAll('.MiX').length === 1 3812 }, 3813 3814 EXPANDOS: function(test, id){ 3815 id = "slick_" + (uniqueIndex++); 3816 // checks if the document has elements that support expandos 3817 test._custom_property_ = id 3818 return test._custom_property_ === id 3819 }, 3820 3821 // TODO: use this ? 3822 3823 // CHECKED_QUERY_SELECTOR: function(test){ 3824 // 3825 // // checks if the document supports the checked query selector 3826 // test.innerHTML = '<select><option selected="selected">a</option></select>' 3827 // return test.querySelectorAll(':checked').length === 1 3828 // }, 3829 3830 // TODO: use this ? 3831 3832 // EMPTY_ATTRIBUTE_QUERY_SELECTOR: function(test){ 3833 // 3834 // // checks if the document supports the empty attribute query selector 3835 // test.innerHTML = '<a class=""></a>' 3836 // return test.querySelectorAll('[class*=""]').length === 1 3837 // }, 3838 3839 MATCHES_SELECTOR: function(test){ 3840 3841 test.className = "MiX" 3842 3843 // checks if the document has matchesSelector, and we can use it. 3844 3845 var matches = test.matchesSelector || test.mozMatchesSelector || test.webkitMatchesSelector 3846 3847 // if matchesSelector trows errors on incorrect syntax we can use it 3848 if (matches) try { 3849 matches.call(test, ':slick') 3850 } catch(e){ 3851 // just as a safety precaution, also test if it works on mixedcase (like querySelectorAll) 3852 return matches.call(test, ".MiX") ? matches : false 3853 } 3854 3855 return false 3856 }, 3857 3858 GET_ELEMENTS_BY_CLASS_NAME: function(test){ 3859 test.innerHTML = '<a class="f"></a><a class="b"></a>' 3860 if (test.getElementsByClassName('b').length !== 1) return false 3861 3862 test.firstChild.className = 'b' 3863 if (test.getElementsByClassName('b').length !== 2) return false 3864 3865 // Opera 9.6 getElementsByClassName doesnt detects the class if its not the first one 3866 test.innerHTML = '<a class="a"></a><a class="f b a"></a>' 3867 if (test.getElementsByClassName('a').length !== 2) return false 3868 3869 // tests passed 3870 return true 3871 }, 3872 3873 // no need to know 3874 3875 // GET_ELEMENT_BY_ID_NOT_NAME: function(test, id){ 3876 // test.innerHTML = '<a name="'+ id +'"></a><b id="'+ id +'"></b>' 3877 // return this.getElementById(id) !== test.firstChild 3878 // }, 3879 3880 // this is always checked for and fixed 3881 3882 // STAR_GET_ELEMENTS_BY_TAG_NAME: function(test){ 3883 // 3884 // // IE returns comment nodes for getElementsByTagName('*') for some documents 3885 // test.appendChild(this.createComment('')) 3886 // if (test.getElementsByTagName('*').length > 0) return false 3887 // 3888 // // IE returns closed nodes (EG:"</foo>") for getElementsByTagName('*') for some documents 3889 // test.innerHTML = 'foo</foo>' 3890 // if (test.getElementsByTagName('*').length) return false 3891 // 3892 // // tests passed 3893 // return true 3894 // }, 3895 3896 // this is always checked for and fixed 3897 3898 // STAR_QUERY_SELECTOR: function(test){ 3899 // 3900 // // returns closed nodes (EG:"</foo>") for querySelector('*') for some documents 3901 // test.innerHTML = 'foo</foo>' 3902 // return !!(test.querySelectorAll('*').length) 3903 // }, 3904 3905 GET_ATTRIBUTE: function(test){ 3906 // tests for working getAttribute implementation 3907 var shout = "fus ro dah" 3908 test.innerHTML = '<a class="' + shout + '"></a>' 3909 return test.firstChild.getAttribute('class') === shout 3910 } 3911 3912} 3913 3914// Finder 3915 3916var Finder = function Finder(document){ 3917 3918 this.document = document 3919 var root = this.root = document.documentElement 3920 this.tested = {} 3921 3922 // uniqueID 3923 3924 this.uniqueID = this.has("EXPANDOS") ? uniqueID : uniqueIDXML 3925 3926 // getAttribute 3927 3928 this.getAttribute = (this.has("GET_ATTRIBUTE")) ? function(node, name){ 3929 3930 return node.getAttribute(name) 3931 3932 } : function(node, name){ 3933 3934 node = node.getAttributeNode(name) 3935 return (node && node.specified) ? node.value : null 3936 3937 } 3938 3939 // hasAttribute 3940 3941 this.hasAttribute = (root.hasAttribute) ? function(node, attribute){ 3942 3943 return node.hasAttribute(attribute) 3944 3945 } : function(node, attribute) { 3946 3947 node = node.getAttributeNode(attribute) 3948 return !!(node && node.specified) 3949 3950 } 3951 3952 // contains 3953 3954 this.contains = (document.contains && root.contains) ? function(context, node){ 3955 3956 return context.contains(node) 3957 3958 } : (root.compareDocumentPosition) ? function(context, node){ 3959 3960 return context === node || !!(context.compareDocumentPosition(node) & 16) 3961 3962 } : function(context, node){ 3963 3964 do { 3965 if (node === context) return true 3966 } while ((node = node.parentNode)) 3967 3968 return false 3969 } 3970 3971 // sort 3972 // credits to Sizzle (http://sizzlejs.com/) 3973 3974 this.sorter = (root.compareDocumentPosition) ? function(a, b){ 3975 3976 if (!a.compareDocumentPosition || !b.compareDocumentPosition) return 0 3977 return a.compareDocumentPosition(b) & 4 ? -1 : a === b ? 0 : 1 3978 3979 } : ('sourceIndex' in root) ? function(a, b){ 3980 3981 if (!a.sourceIndex || !b.sourceIndex) return 0 3982 return a.sourceIndex - b.sourceIndex 3983 3984 } : (document.createRange) ? function(a, b){ 3985 3986 if (!a.ownerDocument || !b.ownerDocument) return 0 3987 var aRange = a.ownerDocument.createRange(), 3988 bRange = b.ownerDocument.createRange() 3989 3990 aRange.setStart(a, 0) 3991 aRange.setEnd(a, 0) 3992 bRange.setStart(b, 0) 3993 bRange.setEnd(b, 0) 3994 return aRange.compareBoundaryPoints(Range.START_TO_END, bRange) 3995 3996 } : null 3997 3998 this.failed = {} 3999 4000 var nativeMatches = this.has("MATCHES_SELECTOR") 4001 4002 if (nativeMatches) this.matchesSelector = function(node, expression){ 4003 4004 if (this.failed[expression]) return null 4005 4006 try { 4007 return nativeMatches.call(node, expression) 4008 } catch(e){ 4009 if (slick.debug) console.warn("matchesSelector failed on " + expression) 4010 this.failed[expression] = true 4011 return null 4012 } 4013 4014 } 4015 4016 if (this.has("QUERY_SELECTOR")){ 4017 4018 this.querySelectorAll = function(node, expression){ 4019 4020 if (this.failed[expression]) return true 4021 4022 var result, _id, _expression, _combinator, _node 4023 4024 4025 // non-document rooted QSA 4026 // credits to Andrew Dupont 4027 4028 if (node !== this.document){ 4029 4030 _combinator = expression[0].combinator 4031 4032 _id = node.getAttribute("id") 4033 _expression = expression 4034
4035 if (!_id){ 4036 _node = node 4037 _id = "__slick__" 4038 _node.setAttribute("id", _id) 4039 } 4040 4041 expression = "#" + _id + " " + _expression 4042 4043 4044 // these combinators need a parentNode due to how querySelectorAll works, which is: 4045 // finding all the elements that match the given selector 4046 // then filtering by the ones that have the specified element as an ancestor 4047 if (_combinator.indexOf("~") > -1 || _combinator.indexOf("+") > -1){ 4048 4049 node = node.parentNode 4050 if (!node) result = true 4051 // if node has no parentNode, we return "true" as if it failed, without polluting the failed cache 4052 4053 } 4054 4055 } 4056 4057 if (!result) try { 4058 result = node.querySelectorAll(expression.toString()) 4059 } catch(e){ 4060 if (slick.debug) console.warn("querySelectorAll failed on " + (_expression || expression)) 4061 result = this.failed[_expression || expression] = true 4062 } 4063 4064 if (_node) _node.removeAttribute("id") 4065 4066 return result 4067 4068 } 4069 4070 } 4071 4072} 4073 4074Finder.prototype.has = function(FEATURE){ 4075 4076 var tested = this.tested, 4077 testedFEATURE = tested[FEATURE] 4078 4079 if (testedFEATURE != null) return testedFEATURE 4080 4081 var root = this.root, 4082 document = this.document, 4083 testNode = document.createElement("div") 4084 4085 testNode.setAttribute("style", "display: none;") 4086 4087 root.appendChild(testNode) 4088 4089 var TEST = HAS[FEATURE], result = false 4090 4091 if (TEST) try { 4092 result = TEST.call(document, testNode) 4093 } catch(e){} 4094 4095 if (slick.debug && !result) console.warn("document has no " + FEATURE) 4096 4097 root.removeChild(testNode) 4098 4099 return tested[FEATURE] = result 4100 4101} 4102 4103var combinators = { 4104 4105 " ": function(node, part, push){ 4106 4107 var item, items 4108 4109 var noId = !part.id, noTag = !part.tag, noClass = !part.classes 4110 4111 if (part.id && node.getElementById && this.has("GET_ELEMENT_BY_ID")){ 4112 item = node.getElementById(part.id) 4113 4114 // return only if id is found, else keep checking 4115 // might be a tad slower on non-existing ids, but less insane 4116 4117 if (item && item.getAttribute('id') === part.id){ 4118 items = [item] 4119 noId = true 4120 // if tag is star, no need to check it in match() 4121 if (part.tag === "*") noTag = true 4122 } 4123 } 4124 4125 if (!items){ 4126 4127 if (part.classes && node.getElementsByClassName && this.has("GET_ELEMENTS_BY_CLASS_NAME")){ 4128 items = node.getElementsByClassName(part.classList) 4129 noClass = true 4130 // if tag is star, no need to check it in match() 4131 if (part.tag === "*") noTag = true 4132 } else { 4133 items = node.getElementsByTagName(part.tag) 4134 // if tag is star, need to check it in match because it could select junk, boho 4135 if (part.tag !== "*") noTag = true 4136 } 4137 4138 if (!items || !items.length) return false 4139 4140 } 4141 4142 for (var i = 0; item = items[i++];) 4143 if ((noTag && noId && noClass && !part.attributes && !part.pseudos) || this.match(item, part, noTag, noId, noClass)) 4144 push(item) 4145 4146 return true 4147 4148 }, 4149 4150 ">": function(node, part, push){ // direct children 4151 if ((node = node.firstChild)) do { 4152 if (node.nodeType == 1 && this.match(node, part)) push(node) 4153 } while ((node = node.nextSibling)) 4154 }, 4155 4156 "+": function(node, part, push){ // next sibling 4157 while ((node = node.nextSibling)) if (node.nodeType == 1){ 4158 if (this.match(node, part)) push(node) 4159 break 4160 } 4161 }, 4162 4163 "^": function(node, part, push){ // first child 4164 node = node.firstChild 4165 if (node){ 4166 if (node.nodeType === 1){ 4167 if (this.match(node, part)) push(node) 4168 } else { 4169 combinators['+'].call(this, node, part, push) 4170 } 4171 } 4172 }, 4173 4174 "~": function(node, part, push){ // next siblings 4175 while ((node = node.nextSibling)){ 4176 if (node.nodeType === 1 && this.match(node, part)) push(node) 4177 } 4178 }, 4179 4180 "++": function(node, part, push){ // next sibling and previous sibling 4181 combinators['+'].call(this, node, part, push) 4182 combinators['!+'].call(this, node, part, push) 4183 }, 4184 4185 "~~": function(node, part, push){ // next siblings and previous siblings 4186 combinators['~'].call(this, node, part, push) 4187 combinators['!~'].call(this, node, part, push) 4188 }, 4189 4190 "!": function(node, part, push){ // all parent nodes up to document 4191 while ((node = node.parentNode)) if (node !== this.document && this.match(node, part)) push(node) 4192 }, 4193 4194 "!>": function(node, part, push){ // direct parent (one level) 4195 node = node.parentNode 4196 if (node !== this.document && this.match(node, part)) push(node) 4197 }, 4198 4199 "!+": function(node, part, push){ // previous sibling 4200 while ((node = node.previousSibling)) if (node.nodeType == 1){ 4201 if (this.match(node, part)) push(node) 4202 break 4203 } 4204 }, 4205 4206 "!^": function(node, part, push){ // last child 4207 node = node.lastChild 4208 if (node){ 4209 if (node.nodeType == 1){ 4210 if (this.match(node, part)) push(node) 4211 } else { 4212 combinators['!+'].call(this, node, part, push) 4213 } 4214 } 4215 }, 4216 4217 "!~": function(node, part, push){ // previous siblings 4218 while ((node = node.previousSibling)){ 4219 if (node.nodeType === 1 && this.match(node, part)) push(node) 4220 } 4221 } 4222 4223} 4224 4225Finder.prototype.search = function(context, expression, found){ 4226 4227 if (!context) context = this.document 4228 else if (!context.nodeType && context.document) context = context.document 4229 4230 var expressions = parse(expression) 4231 4232 // no expressions were parsed. todo: is this really necessary? 4233 if (!expressions || !expressions.length) throw new Error("invalid expression") 4234 4235 if (!found) found = [] 4236 4237 var uniques, push = isArray(found) ? function(node){ 4238 found[found.length] = node 4239 } : function(node){ 4240 found[found.length++] = node 4241 } 4242 4243 // if there is more than one expression we need to check for duplicates when we push to found 4244 // this simply saves the old push and wraps it around an uid dupe check. 4245 if (expressions.length > 1){ 4246 uniques = {} 4247 var plush = push 4248 push = function(node){ 4249 var uid = uniqueID(node) 4250 if (!uniques[uid]){ 4251 uniques[uid] = true 4252 plush(node) 4253 } 4254 } 4255 } 4256 4257 // walker 4258 4259 var node, nodes, part 4260 4261 main: for (var i = 0; expression = expressions[i++];){ 4262 4263 // querySelector 4264 4265 // TODO: more functional tests 4266 4267 // if there is querySelectorAll (and the expression does not fail) use it. 4268 if (!slick.noQSA && this.querySelectorAll){ 4269 4270 nodes = this.querySelectorAll(context, expression) 4271 if (nodes !== true){ 4272 if (nodes && nodes.length) for (var j = 0; node = nodes[j++];) if (node.nodeName > '@'){ 4273 push(node) 4274 } 4275 continue main 4276 } 4277 } 4278 4279 // if there is only one part in the expression we don't need to check each part for duplicates. 4280 // todo: this might be too naive. while solid, there can be expression sequences that do not 4281 // produce duplicates. "body div" for instance, can never give you each div more than once. 4282 // "body div a" on the other hand might. 4283 if (expression.length === 1){ 4284 4285 part = expression[0] 4286 combinators[part.combinator].call(this, context, part, push) 4287 4288 } else { 4289 4290 var cs = [context], c, f, u, p = function(node){ 4291 var uid = uniqueID(node) 4292 if (!u[uid]){ 4293 u[uid] = true 4294 f[f.length] = node 4295 } 4296 } 4297 4298 // loop the expression parts 4299 for (var j = 0; part = expression[j++];){ 4300 f = []; u = {} 4301 // loop the contexts 4302 for (var k = 0; c = cs[k++];) combinators[part.combinator].call(this, c, part, p) 4303 // nothing was found, the expression failed, continue to the next expression. 4304 if (!f.length) continue main 4305 cs = f // set the contexts for future parts (if any) 4306 } 4307 4308 if (i === 0) found = f // first expression. directly set found. 4309 else for (var l = 0; l < f.length; l++) push(f[l]) // any other expression needs to push to found. 4310 } 4311 4312 } 4313 4314 if (uniques && found && found.length > 1) this.sort(found) 4315 4316 return found 4317 4318} 4319 4320Finder.prototype.sort = function(nodes){ 4321 return this.sorter ? Array.prototype.sort.call(nodes, this.sorter) : nodes 4322} 4323 4324// TODO: most of these pseudo selectors include <html> and qsa doesnt. fixme. 4325 4326var pseudos = { 4327 4328 4329 // TODO: returns different results than qsa empty. 4330 4331 'empty': function(){ 4332 return !(this && this.nodeType === 1) && !(this.innerText || this.textContent || '').length 4333 }, 4334 4335 'not': function(expression){
4336 return !slick.matches(this, expression) 4337 }, 4338 4339 'contains': function(text){ 4340 return (this.innerText || this.textContent || '').indexOf(text) > -1 4341 }, 4342 4343 'first-child': function(){ 4344 var node = this 4345 while ((node = node.previousSibling)) if (node.nodeType == 1) return false 4346 return true 4347 }, 4348 4349 'last-child': function(){ 4350 var node = this 4351 while ((node = node.nextSibling)) if (node.nodeType == 1) return false 4352 return true 4353 }, 4354 4355 'only-child': function(){ 4356 var prev = this 4357 while ((prev = prev.previousSibling)) if (prev.nodeType == 1) return false 4358 4359 var next = this 4360 while ((next = next.nextSibling)) if (next.nodeType == 1) return false 4361 4362 return true 4363 }, 4364 4365 'first-of-type': function(){ 4366 var node = this, nodeName = node.nodeName 4367 while ((node = node.previousSibling)) if (node.nodeName == nodeName) return false 4368 return true 4369 }, 4370 4371 'last-of-type': function(){ 4372 var node = this, nodeName = node.nodeName 4373 while ((node = node.nextSibling)) if (node.nodeName == nodeName) return false 4374 return true 4375 }, 4376 4377 'only-of-type': function(){ 4378 var prev = this, nodeName = this.nodeName 4379 while ((prev = prev.previousSibling)) if (prev.nodeName == nodeName) return false 4380 var next = this 4381 while ((next = next.nextSibling)) if (next.nodeName == nodeName) return false 4382 return true 4383 }, 4384 4385 'enabled': function(){ 4386 return !this.disabled 4387 }, 4388 4389 'disabled': function(){ 4390 return this.disabled 4391 }, 4392 4393 'checked': function(){ 4394 return this.checked || this.selected 4395 }, 4396 4397 'selected': function(){ 4398 return this.selected 4399 }, 4400 4401 'focus': function(){ 4402 var doc = this.ownerDocument 4403 return doc.activeElement === this && (this.href || this.type || slick.hasAttribute(this, 'tabindex')) 4404 }, 4405 4406 'root': function(){ 4407 return (this === this.ownerDocument.documentElement) 4408 } 4409 4410} 4411 4412Finder.prototype.match = function(node, bit, noTag, noId, noClass){ 4413 4414 // TODO: more functional tests ? 4415 4416 if (!slick.noQSA && this.matchesSelector){ 4417 var matches = this.matchesSelector(node, bit) 4418 if (matches !== null) return matches 4419 } 4420 4421 // normal matching 4422 4423 if (!noTag && bit.tag){ 4424 4425 var nodeName = node.nodeName.toLowerCase() 4426 if (bit.tag === "*"){ 4427 if (nodeName < "@") return false 4428 } else if (nodeName != bit.tag){ 4429 return false 4430 } 4431 4432 } 4433 4434 if (!noId && bit.id && node.getAttribute('id') !== bit.id) return false 4435 4436 var i, part 4437 4438 if (!noClass && bit.classes){ 4439 4440 var className = this.getAttribute(node, "class") 4441 if (!className) return false 4442 4443 for (part in bit.classes) if (!RegExp('(^|\\s)' + bit.classes[part] + '(\\s|$)').test(className)) return false 4444 } 4445 4446 var name, value 4447 4448 if (bit.attributes) for (i = 0; part = bit.attributes[i++];){ 4449 4450 var operator = part.operator, 4451 escaped = part.escapedValue 4452 4453 name = part.name 4454 value = part.value 4455 4456 if (!operator){ 4457 4458 if (!this.hasAttribute(node, name)) return false 4459 4460 } else { 4461 4462 var actual = this.getAttribute(node, name) 4463 if (actual == null) return false 4464 4465 switch (operator){ 4466 case '^=' : if (!RegExp( '^' + escaped ).test(actual)) return false; break 4467 case '$=' : if (!RegExp( escaped + '$' ).test(actual)) return false; break 4468 case '~=' : if (!RegExp('(^|\\s)' + escaped + '(\\s|$)').test(actual)) return false; break 4469 case '|=' : if (!RegExp( '^' + escaped + '(-|$)' ).test(actual)) return false; break 4470 4471 case '=' : if (actual !== value) return false; break 4472 case '*=' : if (actual.indexOf(value) === -1) return false; break 4473 default : return false 4474 } 4475 4476 } 4477 } 4478 4479 if (bit.pseudos) for (i = 0; part = bit.pseudos[i++];){ 4480 4481 name = part.name 4482 value = part.value 4483 4484 if (pseudos[name]) return pseudos[name].call(node, value) 4485 4486 if (value != null){ 4487 if (this.getAttribute(node, name) !== value) return false 4488 } else { 4489 if (!this.hasAttribute(node, name)) return false 4490 } 4491 4492 } 4493 4494 return true 4495 4496} 4497 4498Finder.prototype.matches = function(node, expression){ 4499 4500 var expressions = parse(expression) 4501 4502 if (expressions.length === 1 && expressions[0].length === 1){ // simplest match 4503 return this.match(node, expressions[0][0]) 4504 } 4505 4506 // TODO: more functional tests ? 4507 4508 if (!slick.noQSA && this.matchesSelector){ 4509 var matches = this.matchesSelector(node, expressions) 4510 if (matches !== null) return matches 4511 } 4512 4513 var nodes = this.search(this.document, expression, {length: 0}) 4514 4515 for (var i = 0, res; res = nodes[i++];) if (node === res) return true 4516 return false 4517 4518} 4519 4520var finders = {} 4521 4522var finder = function(context){ 4523 var doc = context || document 4524 if (doc.ownerDocument) doc = doc.ownerDocument 4525 else if (doc.document) doc = doc.document 4526 4527 if (doc.nodeType !== 9) throw new TypeError("invalid document") 4528 4529 var uid = uniqueID(doc) 4530 return finders[uid] || (finders[uid] = new Finder(doc)) 4531} 4532 4533// ... API ... 4534 4535var slick = function(expression, context){ 4536 return slick.search(expression, context) 4537} 4538 4539slick.search = function(expression, context, found){ 4540 return finder(context).search(context, expression, found) 4541} 4542 4543slick.find = function(expression, context){ 4544 return finder(context).search(context, expression)[0] || null 4545} 4546 4547slick.getAttribute = function(node, name){ 4548 return finder(node).getAttribute(node, name) 4549} 4550 4551slick.hasAttribute = function(node, name){ 4552 return finder(node).hasAttribute(node, name) 4553} 4554 4555slick.contains = function(context, node){ 4556 return finder(context).contains(context, node) 4557} 4558 4559slick.matches = function(node, expression){ 4560 return finder(node).matches(node, expression) 4561} 4562 4563slick.sort = function(nodes){ 4564 if (nodes && nodes.length > 1) finder(nodes[0]).sort(nodes) 4565 return nodes 4566} 4567 4568slick.parse = parse; 4569 4570// slick.debug = true 4571// slick.noQSA = true 4572 4573module.exports = slick 4574 4575},{"./parser":98}],97:[function(require,module,exports){ 4576(function (global){(function (){ 4577/* 4578slick 4579*/"use strict" 4580 4581module.exports = "document" in global ? require("./finder") : { parse: require("./parser") } 4582 4583}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) 4584 4585},{"./finder":96,"./parser":98}],98:[function(require,module,exports){ 4586/* 4587Slick Parser 4588 - originally created by the almighty Thomas Aylott <@subtlegradient> (http://subtlegradient.com) 4589*/"use strict" 4590 4591// Notable changes from Slick.Parser 1.0.x 4592 4593// The parser now uses 2 classes: Expressions and Expression
4594// `new Expressions` produces an array-like object containing a list of Expression objects 4595// - Expressions::toString() produces a cleaned up expressions string 4596// `new Expression` produces an array-like object 4597// - Expression::toString() produces a cleaned up expression string 4598// The only exposed method is parse, which produces a (cached) `new Expressions` instance 4599// parsed.raw is no longer present, use .toString() 4600// parsed.expression is now useless, just use the indices 4601// parsed.reverse() has been removed for now, due to its apparent uselessness 4602// Other changes in the Expressions object: 4603// - classNames are now unique, and save both escaped and unescaped values 4604// - attributes now save both escaped and unescaped values 4605// - pseudos now save both escaped and unescaped values 4606 4607var escapeRe = /([-.*+?^${}()|[\]\/\\])/g, 4608 unescapeRe = /\\/g 4609 4610var escape = function(string){ 4611 // XRegExp v2.0.0-beta-3 4612 // « https://github.com/slevithan/XRegExp/blob/master/src/xregexp.js 4613 return (string + "").replace(escapeRe, '\\$1') 4614} 4615 4616var unescape = function(string){ 4617 return (string + "").replace(unescapeRe, '') 4618} 4619 4620var slickRe = RegExp( 4621/* 4622#!/usr/bin/env ruby 4623puts "\t\t" + DATA.read.gsub(/\(\?x\)|\s+#.*$|\s+|\\$|\\n/,'') 4624__END__ 4625 "(?x)^(?:\ 4626 \\s* ( , ) \\s* # Separator \n\ 4627 | \\s* ( <combinator>+ ) \\s* # Combinator \n\ 4628 | ( \\s+ ) # CombinatorChildren \n\ 4629 | ( <unicode>+ | \\* ) # Tag \n\ 4630 | \\# ( <unicode>+ ) # ID \n\ 4631 | \\. ( <unicode>+ ) # ClassName \n\ 4632 | # Attribute \n\ 4633 \\[ \ 4634 \\s* (<unicode1>+) (?: \ 4635 \\s* ([*^$!~|]?=) (?: \ 4636 \\s* (?:\ 4637 ([\"']?)(.*?)\\9 \ 4638 )\ 4639 ) \ 4640 )? \\s* \ 4641 \\](?!\\]) \n\ 4642 | :+ ( <unicode>+ )(?:\ 4643 \\( (?:\ 4644 (?:([\"'])([^\\12]*)\\12)|((?:\\([^)]+\\)|[^()]*)+)\ 4645 ) \\)\ 4646 )?\ 4647 )" 4648*/ 4649"^(?:\\s*(,)\\s*|\\s*(<combinator>+)\\s*|(\\s+)|(<unicode>+|\\*)|\\#(<unicode>+)|\\.(<unicode>+)|\\[\\s*(<unicode1>+)(?:\\s*([*^$!~|]?=)(?:\\s*(?:([\"']?)(.*?)\\9)))?\\s*\\](?!\\])|(:+)(<unicode>+)(?:\\((?:(?:([\"'])([^\\13]*)\\13)|((?:\\([^)]+\\)|[^()]*)+))\\))?)" 4650 .replace(/<combinator>/, '[' + escape(">+~`!@$%^&={}\\;</") + ']') 4651 .replace(/<unicode>/g, '(?:[\\w\\u00a1-\\uFFFF-]|\\\\[^\\s0-9a-f])') 4652 .replace(/<unicode1>/g, '(?:[:\\w\\u00a1-\\uFFFF-]|\\\\[^\\s0-9a-f])') 4653) 4654 4655// Part 4656 4657var Part = function Part(combinator){ 4658 this.combinator = combinator || " " 4659 this.tag = "*" 4660} 4661 4662Part.prototype.toString = function(){ 4663 4664 if (!this.raw){ 4665 4666 var xpr = "", k, part 4667 4668 xpr += this.tag || "*" 4669 if (this.id) xpr += "#" + this.id 4670 if (this.classes) xpr += "." + this.classList.join(".") 4671 if (this.attributes) for (k = 0; part = this.attributes[k++];){ 4672 xpr += "[" + part.name + (part.operator ? part.operator + '"' + part.value + '"' : '') + "]" 4673 } 4674 if (this.pseudos) for (k = 0; part = this.pseudos[k++];){ 4675 xpr += ":" + part.name 4676 if (part.value) xpr += "(" + part.value + ")" 4677 } 4678 4679 this.raw = xpr 4680 4681 } 4682 4683 return this.raw 4684} 4685 4686// Expression 4687 4688var Expression = function Expression(){ 4689 this.length = 0 4690} 4691 4692Expression.prototype.toString = function(){ 4693 4694 if (!this.raw){ 4695 4696 var xpr = "" 4697 4698 for (var j = 0, bit; bit = this[j++];){ 4699 if (j !== 1) xpr += " " 4700 if (bit.combinator !== " ") xpr += bit.combinator + " " 4701 xpr += bit 4702 } 4703 4704 this.raw = xpr 4705 4706 } 4707 4708 return this.raw 4709} 4710 4711var replacer = function( 4712 rawMatch, 4713 4714 separator, 4715 combinator, 4716 combinatorChildren, 4717 4718 tagName, 4719 id, 4720 className, 4721 4722 attributeKey, 4723 attributeOperator, 4724 attributeQuote, 4725 attributeValue, 4726 4727 pseudoMarker, 4728 pseudoClass, 4729 pseudoQuote, 4730 pseudoClassQuotedValue, 4731 pseudoClassValue 4732){ 4733 4734 var expression, current 4735 4736 if (separator || !this.length){ 4737 expression = this[this.length++] = new Expression 4738 if (separator) return '' 4739 } 4740 4741 if (!expression) expression = this[this.length - 1] 4742 4743 if (combinator || combinatorChildren || !expression.length){ 4744 current = expression[expression.length++] = new Part(combinator) 4745 } 4746 4747 if (!current) current = expression[expression.length - 1] 4748 4749 if (tagName){ 4750 4751 current.tag = unescape(tagName) 4752 4753 } else if (id){ 4754 4755 current.id = unescape(id) 4756 4757 } else if (className){ 4758 4759 var unescaped = unescape(className) 4760 4761 var classes = current.classes || (current.classes = {}) 4762 if (!classes[unescaped]){ 4763 classes[unescaped] = escape(className) 4764 var classList = current.classList || (current.classList = []) 4765 classList.push(unescaped) 4766 classList.sort() 4767 } 4768 4769 } else if (pseudoClass){ 4770 4771 pseudoClassValue = pseudoClassValue || pseudoClassQuotedValue 4772 4773 ;(current.pseudos || (current.pseudos = [])).push({ 4774 type : pseudoMarker.length == 1 ? 'class' : 'element', 4775 name : unescape(pseudoClass), 4776 escapedName : escape(pseudoClass), 4777 value : pseudoClassValue ? unescape(pseudoClassValue) : null, 4778 escapedValue : pseudoClassValue ? escape(pseudoClassValue) : null 4779 }) 4780 4781 } else if (attributeKey){ 4782 4783 attributeValue = attributeValue ? escape(attributeValue) : null 4784 4785 ;(current.attributes || (current.attributes = [])).push({ 4786 operator : attributeOperator, 4787 name : unescape(attributeKey), 4788 escapedName : escape(attributeKey), 4789 value : attributeValue ? unescape(attributeValue) : null, 4790 escapedValue : attributeValue ? escape(attributeValue) : null 4791 }) 4792 4793 } 4794 4795 return '' 4796 4797} 4798 4799// Expressions 4800 4801var Expressions = function Expressions(expression){ 4802 this.length = 0 4803 4804 var self = this 4805 4806 var original = expression, replaced 4807 4808 while (expression){ 4809 replaced = expression.replace(slickRe, function(){ 4810 return replacer.apply(self, arguments) 4811 }) 4812 if (replaced === expression) throw new Error(original + ' is an invali
4812d expression') 4813 expression = replaced 4814 } 4815} 4816 4817Expressions.prototype.toString = function(){ 4818 if (!this.raw){ 4819 var expressions = [] 4820 for (var i = 0, expression; expression = this[i++];) expressions.push(expression) 4821 this.raw = expressions.join(", ") 4822 } 4823 4824 return this.raw 4825} 4826 4827var cache = {} 4828 4829var parse = function(expression){ 4830 if (expression == null) return null 4831 expression = ('' + expression).replace(/^\s+|\s+$/g, '') 4832 return cache[expression] || (cache[expression] = new Expressions(expression)) 4833} 4834 4835module.exports = parse 4836 4837},{}],99:[function(require,module,exports){ 4838// shim for using process in browser 4839var process = module.exports = {}; 4840 4841// cached from whatever global is present so that test runners that stub it 4842// don't break things. But we need to wrap it in a try catch in case it is 4843// wrapped in strict mode code which doesn't define any globals. It's inside a 4844// function because try/catches deoptimize in certain engines. 4845 4846var cachedSetTimeout; 4847var cachedClearTimeout; 4848 4849function defaultSetTimout() { 4850 throw new Error('setTimeout has not been defined'); 4851} 4852function defaultClearTimeout () { 4853 throw new Error('clearTimeout has not been defined'); 4854} 4855(function () { 4856 try { 4857 if (typeof setTimeout === 'function') { 4858 cachedSetTimeout = setTimeout; 4859 } else { 4860 cachedSetTimeout = defaultSetTimout; 4861 } 4862 } catch (e) { 4863 cachedSetTimeout = defaultSetTimout; 4864 } 4865 try { 4866 if (typeof clearTimeout === 'function') { 4867 cachedClearTimeout = clearTimeout; 4868 } else { 4869 cachedClearTimeout = defaultClearTimeout; 4870 } 4871 } catch (e) { 4872 cachedClearTimeout = defaultClearTimeout; 4873 } 4874} ()) 4875function runTimeout(fun) { 4876 if (cachedSetTimeout === setTimeout) { 4877 //normal enviroments in sane situations 4878 return setTimeout(fun, 0); 4879 } 4880 // if setTimeout wasn't available but was latter defined 4881 if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { 4882 cachedSetTimeout = setTimeout; 4883 return setTimeout(fun, 0); 4884 } 4885 try { 4886 // when when somebody has screwed with setTimeout but no I.E. maddness 4887 return cachedSetTimeout(fun, 0); 4888 } catch(e){ 4889 try { 4890 // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally 4891 return cachedSetTimeout.call(null, fun, 0); 4892 } catch(e){ 4893 // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error 4894 return cachedSetTimeout.call(this, fun, 0); 4895 } 4896 } 4897 4898 4899} 4900function runClearTimeout(marker) { 4901 if (cachedClearTimeout === clearTimeout) { 4902 //normal enviroments in sane situations 4903 return clearTimeout(marker); 4904 } 4905 // if clearTimeout wasn't available but was latter defined 4906 if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { 4907 cachedClearTimeout = clearTimeout; 4908 return clearTimeout(marker); 4909 } 4910 try { 4911 // when when somebody has screwed with setTimeout but no I.E. maddness 4912 return cachedClearTimeout(marker); 4913 } catch (e){ 4914 try { 4915 // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally 4916 return cachedClearTimeout.call(null, marker); 4917 } catch (e){ 4918 // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. 4919 // Some versions of I.E. have different rules for clearTimeout vs setTimeout 4920 return cachedClearTimeout.call(this, marker); 4921 } 4922 } 4923 4924 4925 4926} 4927var queue = []; 4928var draining = false; 4929var currentQueue; 4930var queueIndex = -1; 4931 4932function cleanUpNextTick() { 4933 if (!draining || !currentQueue) { 4934 return; 4935 } 4936 draining = false; 4937 if (currentQueue.length) { 4938 queue = currentQueue.concat(queue); 4939 } else { 4940 queueIndex = -1; 4941 } 4942 if (queue.length) { 4943 drainQueue(); 4944 } 4945} 4946 4947function drainQueue() { 4948 if (draining) { 4949 return; 4950 } 4951 var timeout = runTimeout(cleanUpNextTick); 4952 draining = true; 4953 4954 var len = queue.length; 4955 while(len) { 4956 currentQueue = queue; 4957 queue = []; 4958 while (++queueIndex < len) { 4959 if (currentQueue) { 4960 currentQueue[queueIndex].run(); 4961 } 4962 } 4963 queueIndex = -1; 4964 len = queue.length; 4965 } 4966 currentQueue = null; 4967 draining = false;
vendor: 3,705 bytes, lines 4968-5105
4968 runClearTimeout(timeout); 4969} 4970 4971process.nextTick = function (fun) { 4972 var args = new Array(arguments.length - 1); 4973 if (arguments.length > 1) { 4974 for (var i = 1; i < arguments.length; i++) { 4975 args[i - 1] = arguments[i]; 4976 } 4977 } 4978 queue.push(new Item(fun, args)); 4979 if (queue.length === 1 && !draining) { 4980 runTimeout(drainQueue); 4981 } 4982}; 4983 4984// v8 likes predictible objects 4985function Item(fun, array) { 4986 this.fun = fun; 4987 this.array = array; 4988} 4989Item.prototype.run = function () { 4990 this.fun.apply(null, this.array); 4991}; 4992process.title = 'browser'; 4993process.browser = true; 4994process.env = {}; 4995process.argv = []; 4996process.version = ''; // empty string to avoid regexp issues 4997process.versions = {}; 4998 4999function noop() {} 5000 5001process.on = noop; 5002process.addListener = noop; 5003process.once = noop; 5004process.off = noop; 5005process.removeListener = noop; 5006process.removeAllListeners = noop; 5007process.emit = noop; 5008process.prependListener = noop; 5009process.prependOnceListener = noop; 5010 5011process.listeners = function (name) { return [] } 5012 5013process.binding = function (name) { 5014 throw new Error('process.binding is not supported'); 5015}; 5016 5017process.cwd = function () { return '/' }; 5018process.chdir = function (dir) { 5019 throw new Error('process.chdir is not supported'); 5020}; 5021process.umask = function() { return 0; }; 5022 5023},{}],100:[function(require,module,exports){ 5024(function (setImmediate,clearImmediate){(function (){ 5025var nextTick = require('process/browser.js').nextTick; 5026var apply = Function.prototype.apply; 5027var slice = Array.prototype.slice; 5028var immediateIds = {}; 5029var nextImmediateId = 0; 5030 5031// DOM APIs, for completeness 5032 5033exports.setTimeout = function() { 5034 return new Timeout(apply.call(setTimeout, window, arguments), clearTimeout); 5035}; 5036exports.setInterval = function() { 5037 return new Timeout(apply.call(setInterval, window, arguments), clearInterval); 5038}; 5039exports.clearTimeout = 5040exports.clearInterval = function(timeout) { timeout.close(); }; 5041 5042function Timeout(id, clearFn) { 5043 this._id = id; 5044 this._clearFn = clearFn; 5045} 5046Timeout.prototype.unref = Timeout.prototype.ref = function() {}; 5047Timeout.prototype.close = function() { 5048 this._clearFn.call(window, this._id); 5049}; 5050 5051// Does not start the time, just sets up the members needed. 5052exports.enroll = function(item, msecs) { 5053 clearTimeout(item._idleTimeoutId); 5054 item._idleTimeout = msecs; 5055}; 5056 5057exports.unenroll = function(item) { 5058 clearTimeout(item._idleTimeoutId); 5059 item._idleTimeout = -1; 5060}; 5061 5062exports._unrefActive = exports.active = function(item) { 5063 clearTimeout(item._idleTimeoutId); 5064 5065 var msecs = item._idleTimeout; 5066 if (msecs >= 0) { 5067 item._idleTimeoutId = setTimeout(function onTimeout() { 5068 if (item._onTimeout) 5069 item._onTimeout(); 5070 }, msecs); 5071 } 5072}; 5073 5074// That's not how node.js implements it but the exposed api is the same. 5075exports.setImmediate = typeof setImmediate === "function" ? setImmediate : function(fn) { 5076 var id = nextImmediateId++; 5077 var args = arguments.length < 2 ? false : slice.call(arguments, 1); 5078 5079 immediateIds[id] = true; 5080 5081 nextTick(function onNextTick() { 5082 if (immediateIds[id]) { 5083 // fn.call() is faster so we optimize for the common use-case 5084 // @see http://jsperf.com/call-apply-segu 5085 if (args) { 5086 fn.apply(null, args); 5087 } else { 5088 fn.call(null); 5089 } 5090 // Prevent ids from leaking 5091 exports.clearImmediate(id); 5092 } 5093 }); 5094 5095 return id; 5096}; 5097 5098exports.clearImmediate = typeof clearImmediate === "function" ? clearImmediate : function(id) { 5099 delete immediateIds[id]; 5100}; 5101}).call(this)}).call(this,require("timers").setImmediate,require("timers").clearImmediate) 5102 5103},{"process/browser.js":99,"timers":100}]},{},[1]) 5104 5105//# sourceMappingURL=main.js.map
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.