Showing preview only (543K chars total). Download the full file or copy to clipboard to get everything.
Repository: imakewebthings/waypoints
Branch: master
Commit: 34d9f6d77016
Files: 48
Total size: 522.7 KB
Directory structure:
gitextract___33l_r6/
├── .eslintrc
├── .gitignore
├── .travis.yml
├── CHANGELOG.md
├── CONTRIBUTING.md
├── README.md
├── bower.json
├── gulpfile.js
├── lib/
│ ├── jquery.waypoints.js
│ ├── noframework.waypoints.js
│ ├── shortcuts/
│ │ ├── infinite.js
│ │ ├── inview.js
│ │ └── sticky.js
│ ├── waypoints.debug.js
│ └── zepto.waypoints.js
├── licenses.txt
├── package.json
├── src/
│ ├── adapters/
│ │ ├── jquery-zepto-fn-extension.js
│ │ ├── jquery.js
│ │ ├── noframework.js
│ │ └── zepto.js
│ ├── context.js
│ ├── debug.js
│ ├── group.js
│ ├── shortcuts/
│ │ ├── infinite.js
│ │ ├── inview.js
│ │ └── sticky.js
│ └── waypoint.js
├── test/
│ ├── adapter-fn-spec.js
│ ├── context-spec.js
│ ├── debug-spec.js
│ ├── fixtures/
│ │ ├── infinite.html
│ │ ├── standard.html
│ │ └── sticky.html
│ ├── group-spec.js
│ ├── infinite-spec.js
│ ├── inview-spec.js
│ ├── lib/
│ │ ├── coffee-script.js
│ │ ├── jasmine-html.js
│ │ ├── jasmine-jquery.js
│ │ ├── jasmine.css
│ │ ├── jasmine.js
│ │ ├── require.js
│ │ └── testloader.js
│ ├── settings.js
│ ├── sticky-spec.js
│ └── waypoint-spec.js
└── testem.json
================================================
FILE CONTENTS
================================================
================================================
FILE: .eslintrc
================================================
{
"env": {
"browser": true,
"node": true
},
"rules": {
"brace-style": [1, "stroustrup"],
"consistent-this": [1, "self"],
"eqeqeq": [1, "smart"],
"func-style": [1, "declaration"],
"no-else-return": 1,
"no-extra-parens": 1,
"no-floating-decimal": 1,
"no-nested-ternary": 1,
"no-lonely-if": 1,
"quotes": [1, "single", "avoid-escape"],
"radix": 1,
"semi": [1, "never"],
"space-after-keywords": [1, "always"],
"space-in-brackets": [1, "never"],
"space-unary-word-ops": 1,
"wrap-iife": 1
}
}
================================================
FILE: .gitignore
================================================
_site
.sass-cache
.DS_Store
/style.scss
*.gz
node_modules
bower_components
================================================
FILE: .travis.yml
================================================
language: node_js
sudo: false
node_js:
- "0.10"
before_script:
- npm install -g bower
- bower install
================================================
FILE: CHANGELOG.md
================================================
# Changelog
## v4.0.1
- Improve performance of `enableAll`. (Issue #454)
- Handle edge case bug where Waypoint initialization during a specific part of iOS scroll bounce would cause an immediate trigger of it. (Issue #499)
- Maintain `window` Context/resize-handler even when there are only non-window-context waypoints. (Issue #442)
## v4.0.0
- Allow Sticky option `wrapper` to accept false, which will not create a wrapper and instead use the preexisting parent element. (Pull #416)
- Waypoints that are immediately triggered on creation because they've already passed their trigger point now run their handlers on the next animation frame. This contains Zalgo. (Issue #384)
- Pass the jQuery object of items added during an Infinite page load to the `onAfterPageLoad` callback. (Pull #398)
- Add `enabled` option, `enable` and `disable` methods to the Inview shortcut (Pull #406)
- Make the Inview instance `this` within the callbacks, rather than the invdividual underlying waypoints. (Issue #412)
- Account for changes to jQuery 3 around calling `offset` on the window. (Pull #430)
- Add `context` option to Inview. (Issue #433)
## v3.1.1
- Fix bad `isWindow` checks causing errors in IE8-. (Issue #372)
## v3.1.0
- Add `Waypoint.disableAll` and `Waypoint.enableAll` methods.
- Fix Illegal Invocation errors stemming from non-window context use of `requestAnimationFrame`. (Pull #366)
- Keep disabled waypoints from triggering debug script errors. (Pull #365)
- Allow Infinite Scroll items to be root elements in the AJAX response. (Pull #361)
- In debug script, detect display none and fixed positioning defined in CSS.
## v3.0.1
- Add semicolons to the end of built files to aid in clean concatenation. (Issue #353)
## v3.0.0
- Remove hard jQuery dependency. Create builds for jQuery, Zepto, and no DOM framework. (Issue #282)
- Expose `Waypoint` and `Context` classes. (Issue #281)
- Add `Group` class and `group` option for grouping waypoints. Make `continuous` option work within these groups. (Issue #264)
- Add Inview shortcut. (Issue #131)
- Extend `continuous` option to cover refreshes. (Issue #166)
- Throttle resize and scroll handlers using `requestAnimationFrame` instead of a set millisecond timeout. Fallback to the old 60 FPS `setTimeout` throttle for unsupported browsers. (Issue #242)
- Add debugging script for diagnosing common problems.
- Remove `triggerOnce` option.
- Add `viewportWidth` utility method.
- Remove all traces of CoffeeScript.
## v2.0.5
- Allow sticky users to define which direction the stuck class shold be applied. (Issue #192)
- Fix bug where short content on a large screen could cause the infinite shortcut to stall after the first page load. (Issue #207)
- Make `unsticky` safe to use on any element. Previously it would unwrap the parent even if the element had never had `sticky` called on it or already had `unsticky` called previously. (Issue #225)
- Fix bug that would cause handlers to be overwritten when trying to reuse an options object. (Issue #253)
- Remove "More" link when infinite shortcut reaches last page. (Issue #260)
- Fix use of `this` instead of `window`, causing Browserify to fail. (Issue #262)
- Stop using deprecated jQuery `load` method. (Issue #283)
## v2.0.4
- Fix enable, disable, and destroys calls not chaining the jQuery object. (Issue #244) (Thanks [@robharper](https://github.com/robharper))
- Fix destroy not unregistering internal waypoint references if underlying node has been removed from the document, causing memory leaks. (Issue #243)
## v2.0.3
- Add "unsticky" function for sticky shortcut. (Issue #130)
- Exit early from Infinite shortcut if no "more" link exists. (Issue #140)
- Delay height evaluation of sticky shortcut wrapper. (Issue #151)
- Fix errors with Infinite shortcut's parsing of HTML with jQuery 1.9+. (Issue #163)
## v2.0.2
- Add AMD support. (Issue #116)
- Work around iOS issue with cancelled `setTimeout` timers by not using scroll throttling on touch devices. (Issue #120)
- If defined, execute `handler` option passed to sticky shortcut at the end of the stuck/unstuck change. (Issue #123)
## v2.0.1
- Lower default throttle values for `scrollThrottle` and `resizeThrottle`.
- Fix Issue #104: Pixel offsets written as strings are interpreted as %s.
- Fix Issue #100: Work around IE not firing scroll event on document shortening by forcing a scroll check on `refresh` calls.
## v2.0.0
- Rewrite Waypoints in CoffeeScript.
- Add Sticky and Infinite shortcut scripts.
- Allow multiple Waypoints on each element. (Issue #40)
- Allow horizontal scrolling Waypoints. (Issue #14)
- API additions: (#69, 83, 88)
- prev, next, above, below, left, right, extendFn, enable, disable
- API subtractions:
- remove
- Remove custom 'waypoint.reached' jQuery Event from powering the trigger.
- $.waypoints now returns object with vertical+horizontal properties and HTMLElement arrays instead of jQuery object (to preserve trigger order instead of jQuery's forced source order).
- Add enabled option.
## v1.1.7
- Actually fix the post-load bug in Issue #28 from v1.1.3.
## v1.1.6
- Fix potential memory leak by unbinding events on empty context elements.
## v1.1.5
- Make plugin compatible with Browserify/RequireJS. (Thanks [@cjroebuck](https://github.com/cjroebuck))
## v1.1.4
- Add handler option to give alternate binding method.
## v1.1.3
- Fix cases where waypoints are added post-load and should be triggered immediately.
## v1.1.2
- Fixed error thrown by waypoints with triggerOnce option that were triggered via resize refresh.
## v1.1.1
- Fixed bug in initialization where all offsets were being calculated as if set to 0 initially, causing unwarranted triggers during the subsequent refresh.
- Added `onlyOnScroll`, an option for individual waypoints that disables triggers due to an offset refresh that crosses the current scroll point. (All credit to [@knuton](https://github.com/knuton) on this one.)
## v1.1
- Moved the continuous option out of global settings and into the options
object for individual waypoints.
- Added the context option, which allows for using waypoints within any
scrollable element, not just the window.
## v1.0.2
- Moved scroll and resize handler bindings out of load. Should play nicer with async loaders like Head JS and LABjs.
- Fixed a 1px off error when using certain % offsets.
- Added unit tests.
## v1.0.1
- Added $.waypoints('viewportHeight').
- Fixed iOS bug (using the new viewportHeight method).
- Added offset function alias: 'bottom-in-view'.
## v1.0
- Initial release.
================================================
FILE: CONTRIBUTING.md
================================================
# Opening an Issue
The GitHub issue tracker is exclusively for opening demonstrable bugs with the library or for discussing/implementing enhancements. If you need general help with Waypoints try searching through existing closed tickets, searching through the [#jquery-waypoints](http://stackoverflow.com/questions/tagged/jquery-waypoints) tag on StackOverflow, or asking your question there using that tag. If you do ask a question on StackOverflow, please follow the guidelines for [asking a good question](http://stackoverflow.com/help/how-to-ask).
If you're opening a ticket for a bug:
- Give a clear explanation of the bug.
- Try to provide a link to a [JSFiddle](http://jsfiddle.net/) or [CodePen](http://codepen.io/) or similar reduced test case.
- If you cannot provide a reduced test case, please provide a link to a live site demonstrating your bug and include in the ticket the relevant Waypoints code.
If you're interested in discussing a possible new feature:
- Search closed tickets for discussions that may have already occurred.
- Open a ticket and let's talk!
# Pull Requests
- Please send the pull request against the master branch.
- Note any tickets that the pull request addresses.
- Add any necessary tests (see below).
- Follow the coding style of the current codebase.
# Tests
Tests are written in [Jasmine](http://jasmine.github.io/) and run through the [testem](https://github.com/airportyh/testem) test runner. To run them locally you'll need to:
- Install, if you haven't already: [PhantomJS](http://phantomjs.org/), node, and [Bower](bower.io).
- `npm install`
- `bower install`
You can then run the tests one time by running `npm test`, or enter TDD mode by running `npm run tdd`.
================================================
FILE: README.md
================================================
# Waypoints
Waypoints is a library that makes it easy to execute a function whenever you scroll to an element. 
```js
var waypoint = new Waypoint({
element: document.getElementById('thing'),
handler: function(direction) {
alert('You have scrolled to a thing')
}
})
```
If you're new to Waypoints, check out the [Getting Started](http://imakewebthings.com/waypoints/guides/getting-started) guide.
[Read the full documentation](http://imakewebthings.com/waypoints/api/waypoint) for more details on usage and customization.
## Shortcuts
In addition to the normal Waypoints script, extensions exist to make common UI patterns just a little easier to implement:
- [Infinite Scrolling](http://imakewebthings.com/waypoints/shortcuts/infinite-scroll)
- [Sticky Elements](http://imakewebthings.com/waypoints/shortcuts/sticky-elements)
- [Inview Detection](http://imakewebthings.com/waypoints/shortcuts/inview)
## Contributing
If you want to report a Waypoints bug or contribute code to the library, please read the [Contributing Guidelines](https://github.com/imakewebthings/waypoints/blob/master/CONTRIBUTING.md). If you need help *using* Waypoints, please do not open an issue. Instead, ask the question on [Stack Overflow](http://stackoverflow.com) and tag it with <code>#jquery-waypoints</code>. Be sure to follow the guidelines for [asking a good question](http://stackoverflow.com/help/how-to-ask).
## License
Copyright (c) 2011-2014 Caleb Troughton. Licensed under the [MIT license](https://github.com/imakewebthings/waypoints/blob/master/licenses.txt).
================================================
FILE: bower.json
================================================
{
"name": "waypoints",
"main": "lib/noframework.waypoints.js",
"description": "Easily execute a function when you scroll to an element.",
"ignore": [
"gulpfile.js",
"package.json",
"src",
"test",
"testem.json"
],
"devDependencies": {
"jquery": "~1.11.1",
"lodash": "~2.4.1",
"jasmine-jquery": "~1.7.0",
"zepto": "~1.1.3"
}
}
================================================
FILE: gulpfile.js
================================================
var gulp = require('gulp')
var eslint = require('gulp-eslint')
var concat = require('gulp-concat')
var uglify = require('gulp-uglify')
var rename = require('gulp-rename')
var header = require('gulp-header')
var footer = require('gulp-footer')
var tap = require('gulp-tap')
var merge = require('merge-stream')
var pkg = require('./package.json')
var path = require('path')
var jsFiles = ['src/**/*.js', 'test/**/*.js', '!test/lib/**/*.js']
var shortcutTitles = {
'infinite': 'Waypoints Infinite Scroll Shortcut',
'inview': 'Waypoints Inview Shortcut',
'sticky': 'Waypoints Sticky Element Shortcut'
}
function fileHeader(title) {
return [
'/*!',
title + ' - ' + pkg.version,
'Copyright © 2011-' + new Date().getFullYear() + ' Caleb Troughton',
'Licensed under the MIT license.',
'https://github.com/imakewebthings/waypoints/blob/master/licenses.txt',
'*/\n'
].join('\n')
}
gulp.task('lint', function() {
return gulp.src(jsFiles).pipe(eslint('.eslintrc')).pipe(eslint.format())
})
gulp.task('build-core', function() {
var streams = ['noframework', 'jquery', 'zepto'].map(function(adapter) {
var sources = [
'src/waypoint.js',
'src/context.js',
'src/group.js',
'src/adapters/' + adapter + '.js'
]
if (['jquery', 'zepto'].indexOf(adapter) > -1) {
sources.push('src/adapters/jquery-zepto-fn-extension.js')
}
return gulp.src(sources)
.pipe(concat(adapter + '.waypoints.js', { newLine: ';' }))
.pipe(header(fileHeader('Waypoints')))
.pipe(footer(';'))
.pipe(gulp.dest('lib/'))
.pipe(rename(adapter + '.waypoints.min.js'))
.pipe(uglify({
preserveComments: 'some'
}))
.pipe(gulp.dest('lib/'))
})
return merge.apply(null, streams)
})
gulp.task('build-shortcuts', function() {
return gulp.src([
'src/shortcuts/*.js'
])
.pipe(tap(function(file) {
var title = path.basename(file.path, '.js')
file.contents = Buffer.concat([
new Buffer(fileHeader(shortcutTitles[title])),
file.contents
])
}))
.pipe(footer(';'))
.pipe(gulp.dest('lib/shortcuts/'))
.pipe(rename(function(path) {
path.basename += '.min'
}))
.pipe(uglify({
preserveComments: 'some'
}))
.pipe(gulp.dest('lib/shortcuts/'))
})
gulp.task('build-debug', function() {
return gulp.src([
'src/debug.js'
])
.pipe(rename('waypoints.debug.js'))
.pipe(header(fileHeader('Waypoints Debug')))
.pipe(footer(';'))
.pipe(gulp.dest('lib/'))
})
gulp.task('build', ['build-core', 'build-shortcuts', 'build-debug'])
gulp.task('watch', function() {
gulp.watch(jsFiles, ['lint', 'build'])
})
gulp.task('default', ['lint', 'build', 'watch'])
================================================
FILE: lib/jquery.waypoints.js
================================================
/*!
Waypoints - 4.0.1
Copyright © 2011-2016 Caleb Troughton
Licensed under the MIT license.
https://github.com/imakewebthings/waypoints/blob/master/licenses.txt
*/
(function() {
'use strict'
var keyCounter = 0
var allWaypoints = {}
/* http://imakewebthings.com/waypoints/api/waypoint */
function Waypoint(options) {
if (!options) {
throw new Error('No options passed to Waypoint constructor')
}
if (!options.element) {
throw new Error('No element option passed to Waypoint constructor')
}
if (!options.handler) {
throw new Error('No handler option passed to Waypoint constructor')
}
this.key = 'waypoint-' + keyCounter
this.options = Waypoint.Adapter.extend({}, Waypoint.defaults, options)
this.element = this.options.element
this.adapter = new Waypoint.Adapter(this.element)
this.callback = options.handler
this.axis = this.options.horizontal ? 'horizontal' : 'vertical'
this.enabled = this.options.enabled
this.triggerPoint = null
this.group = Waypoint.Group.findOrCreate({
name: this.options.group,
axis: this.axis
})
this.context = Waypoint.Context.findOrCreateByElement(this.options.context)
if (Waypoint.offsetAliases[this.options.offset]) {
this.options.offset = Waypoint.offsetAliases[this.options.offset]
}
this.group.add(this)
this.context.add(this)
allWaypoints[this.key] = this
keyCounter += 1
}
/* Private */
Waypoint.prototype.queueTrigger = function(direction) {
this.group.queueTrigger(this, direction)
}
/* Private */
Waypoint.prototype.trigger = function(args) {
if (!this.enabled) {
return
}
if (this.callback) {
this.callback.apply(this, args)
}
}
/* Public */
/* http://imakewebthings.com/waypoints/api/destroy */
Waypoint.prototype.destroy = function() {
this.context.remove(this)
this.group.remove(this)
delete allWaypoints[this.key]
}
/* Public */
/* http://imakewebthings.com/waypoints/api/disable */
Waypoint.prototype.disable = function() {
this.enabled = false
return this
}
/* Public */
/* http://imakewebthings.com/waypoints/api/enable */
Waypoint.prototype.enable = function() {
this.context.refresh()
this.enabled = true
return this
}
/* Public */
/* http://imakewebthings.com/waypoints/api/next */
Waypoint.prototype.next = function() {
return this.group.next(this)
}
/* Public */
/* http://imakewebthings.com/waypoints/api/previous */
Waypoint.prototype.previous = function() {
return this.group.previous(this)
}
/* Private */
Waypoint.invokeAll = function(method) {
var allWaypointsArray = []
for (var waypointKey in allWaypoints) {
allWaypointsArray.push(allWaypoints[waypointKey])
}
for (var i = 0, end = allWaypointsArray.length; i < end; i++) {
allWaypointsArray[i][method]()
}
}
/* Public */
/* http://imakewebthings.com/waypoints/api/destroy-all */
Waypoint.destroyAll = function() {
Waypoint.invokeAll('destroy')
}
/* Public */
/* http://imakewebthings.com/waypoints/api/disable-all */
Waypoint.disableAll = function() {
Waypoint.invokeAll('disable')
}
/* Public */
/* http://imakewebthings.com/waypoints/api/enable-all */
Waypoint.enableAll = function() {
Waypoint.Context.refreshAll()
for (var waypointKey in allWaypoints) {
allWaypoints[waypointKey].enabled = true
}
return this
}
/* Public */
/* http://imakewebthings.com/waypoints/api/refresh-all */
Waypoint.refreshAll = function() {
Waypoint.Context.refreshAll()
}
/* Public */
/* http://imakewebthings.com/waypoints/api/viewport-height */
Waypoint.viewportHeight = function() {
return window.innerHeight || document.documentElement.clientHeight
}
/* Public */
/* http://imakewebthings.com/waypoints/api/viewport-width */
Waypoint.viewportWidth = function() {
return document.documentElement.clientWidth
}
Waypoint.adapters = []
Waypoint.defaults = {
context: window,
continuous: true,
enabled: true,
group: 'default',
horizontal: false,
offset: 0
}
Waypoint.offsetAliases = {
'bottom-in-view': function() {
return this.context.innerHeight() - this.adapter.outerHeight()
},
'right-in-view': function() {
return this.context.innerWidth() - this.adapter.outerWidth()
}
}
window.Waypoint = Waypoint
}())
;(function() {
'use strict'
function requestAnimationFrameShim(callback) {
window.setTimeout(callback, 1000 / 60)
}
var keyCounter = 0
var contexts = {}
var Waypoint = window.Waypoint
var oldWindowLoad = window.onload
/* http://imakewebthings.com/waypoints/api/context */
function Context(element) {
this.element = element
this.Adapter = Waypoint.Adapter
this.adapter = new this.Adapter(element)
this.key = 'waypoint-context-' + keyCounter
this.didScroll = false
this.didResize = false
this.oldScroll = {
x: this.adapter.scrollLeft(),
y: this.adapter.scrollTop()
}
this.waypoints = {
vertical: {},
horizontal: {}
}
element.waypointContextKey = this.key
contexts[element.waypointContextKey] = this
keyCounter += 1
if (!Waypoint.windowContext) {
Waypoint.windowContext = true
Waypoint.windowContext = new Context(window)
}
this.createThrottledScrollHandler()
this.createThrottledResizeHandler()
}
/* Private */
Context.prototype.add = function(waypoint) {
var axis = waypoint.options.horizontal ? 'horizontal' : 'vertical'
this.waypoints[axis][waypoint.key] = waypoint
this.refresh()
}
/* Private */
Context.prototype.checkEmpty = function() {
var horizontalEmpty = this.Adapter.isEmptyObject(this.waypoints.horizontal)
var verticalEmpty = this.Adapter.isEmptyObject(this.waypoints.vertical)
var isWindow = this.element == this.element.window
if (horizontalEmpty && verticalEmpty && !isWindow) {
this.adapter.off('.waypoints')
delete contexts[this.key]
}
}
/* Private */
Context.prototype.createThrottledResizeHandler = function() {
var self = this
function resizeHandler() {
self.handleResize()
self.didResize = false
}
this.adapter.on('resize.waypoints', function() {
if (!self.didResize) {
self.didResize = true
Waypoint.requestAnimationFrame(resizeHandler)
}
})
}
/* Private */
Context.prototype.createThrottledScrollHandler = function() {
var self = this
function scrollHandler() {
self.handleScroll()
self.didScroll = false
}
this.adapter.on('scroll.waypoints', function() {
if (!self.didScroll || Waypoint.isTouch) {
self.didScroll = true
Waypoint.requestAnimationFrame(scrollHandler)
}
})
}
/* Private */
Context.prototype.handleResize = function() {
Waypoint.Context.refreshAll()
}
/* Private */
Context.prototype.handleScroll = function() {
var triggeredGroups = {}
var axes = {
horizontal: {
newScroll: this.adapter.scrollLeft(),
oldScroll: this.oldScroll.x,
forward: 'right',
backward: 'left'
},
vertical: {
newScroll: this.adapter.scrollTop(),
oldScroll: this.oldScroll.y,
forward: 'down',
backward: 'up'
}
}
for (var axisKey in axes) {
var axis = axes[axisKey]
var isForward = axis.newScroll > axis.oldScroll
var direction = isForward ? axis.forward : axis.backward
for (var waypointKey in this.waypoints[axisKey]) {
var waypoint = this.waypoints[axisKey][waypointKey]
if (waypoint.triggerPoint === null) {
continue
}
var wasBeforeTriggerPoint = axis.oldScroll < waypoint.triggerPoint
var nowAfterTriggerPoint = axis.newScroll >= waypoint.triggerPoint
var crossedForward = wasBeforeTriggerPoint && nowAfterTriggerPoint
var crossedBackward = !wasBeforeTriggerPoint && !nowAfterTriggerPoint
if (crossedForward || crossedBackward) {
waypoint.queueTrigger(direction)
triggeredGroups[waypoint.group.id] = waypoint.group
}
}
}
for (var groupKey in triggeredGroups) {
triggeredGroups[groupKey].flushTriggers()
}
this.oldScroll = {
x: axes.horizontal.newScroll,
y: axes.vertical.newScroll
}
}
/* Private */
Context.prototype.innerHeight = function() {
/*eslint-disable eqeqeq */
if (this.element == this.element.window) {
return Waypoint.viewportHeight()
}
/*eslint-enable eqeqeq */
return this.adapter.innerHeight()
}
/* Private */
Context.prototype.remove = function(waypoint) {
delete this.waypoints[waypoint.axis][waypoint.key]
this.checkEmpty()
}
/* Private */
Context.prototype.innerWidth = function() {
/*eslint-disable eqeqeq */
if (this.element == this.element.window) {
return Waypoint.viewportWidth()
}
/*eslint-enable eqeqeq */
return this.adapter.innerWidth()
}
/* Public */
/* http://imakewebthings.com/waypoints/api/context-destroy */
Context.prototype.destroy = function() {
var allWaypoints = []
for (var axis in this.waypoints) {
for (var waypointKey in this.waypoints[axis]) {
allWaypoints.push(this.waypoints[axis][waypointKey])
}
}
for (var i = 0, end = allWaypoints.length; i < end; i++) {
allWaypoints[i].destroy()
}
}
/* Public */
/* http://imakewebthings.com/waypoints/api/context-refresh */
Context.prototype.refresh = function() {
/*eslint-disable eqeqeq */
var isWindow = this.element == this.element.window
/*eslint-enable eqeqeq */
var contextOffset = isWindow ? undefined : this.adapter.offset()
var triggeredGroups = {}
var axes
this.handleScroll()
axes = {
horizontal: {
contextOffset: isWindow ? 0 : contextOffset.left,
contextScroll: isWindow ? 0 : this.oldScroll.x,
contextDimension: this.innerWidth(),
oldScroll: this.oldScroll.x,
forward: 'right',
backward: 'left',
offsetProp: 'left'
},
vertical: {
contextOffset: isWindow ? 0 : contextOffset.top,
contextScroll: isWindow ? 0 : this.oldScroll.y,
contextDimension: this.innerHeight(),
oldScroll: this.oldScroll.y,
forward: 'down',
backward: 'up',
offsetProp: 'top'
}
}
for (var axisKey in axes) {
var axis = axes[axisKey]
for (var waypointKey in this.waypoints[axisKey]) {
var waypoint = this.waypoints[axisKey][waypointKey]
var adjustment = waypoint.options.offset
var oldTriggerPoint = waypoint.triggerPoint
var elementOffset = 0
var freshWaypoint = oldTriggerPoint == null
var contextModifier, wasBeforeScroll, nowAfterScroll
var triggeredBackward, triggeredForward
if (waypoint.element !== waypoint.element.window) {
elementOffset = waypoint.adapter.offset()[axis.offsetProp]
}
if (typeof adjustment === 'function') {
adjustment = adjustment.apply(waypoint)
}
else if (typeof adjustment === 'string') {
adjustment = parseFloat(adjustment)
if (waypoint.options.offset.indexOf('%') > - 1) {
adjustment = Math.ceil(axis.contextDimension * adjustment / 100)
}
}
contextModifier = axis.contextScroll - axis.contextOffset
waypoint.triggerPoint = Math.floor(elementOffset + contextModifier - adjustment)
wasBeforeScroll = oldTriggerPoint < axis.oldScroll
nowAfterScroll = waypoint.triggerPoint >= axis.oldScroll
triggeredBackward = wasBeforeScroll && nowAfterScroll
triggeredForward = !wasBeforeScroll && !nowAfterScroll
if (!freshWaypoint && triggeredBackward) {
waypoint.queueTrigger(axis.backward)
triggeredGroups[waypoint.group.id] = waypoint.group
}
else if (!freshWaypoint && triggeredForward) {
waypoint.queueTrigger(axis.forward)
triggeredGroups[waypoint.group.id] = waypoint.group
}
else if (freshWaypoint && axis.oldScroll >= waypoint.triggerPoint) {
waypoint.queueTrigger(axis.forward)
triggeredGroups[waypoint.group.id] = waypoint.group
}
}
}
Waypoint.requestAnimationFrame(function() {
for (var groupKey in triggeredGroups) {
triggeredGroups[groupKey].flushTriggers()
}
})
return this
}
/* Private */
Context.findOrCreateByElement = function(element) {
return Context.findByElement(element) || new Context(element)
}
/* Private */
Context.refreshAll = function() {
for (var contextId in contexts) {
contexts[contextId].refresh()
}
}
/* Public */
/* http://imakewebthings.com/waypoints/api/context-find-by-element */
Context.findByElement = function(element) {
return contexts[element.waypointContextKey]
}
window.onload = function() {
if (oldWindowLoad) {
oldWindowLoad()
}
Context.refreshAll()
}
Waypoint.requestAnimationFrame = function(callback) {
var requestFn = window.requestAnimationFrame ||
window.mozRequestAnimationFrame ||
window.webkitRequestAnimationFrame ||
requestAnimationFrameShim
requestFn.call(window, callback)
}
Waypoint.Context = Context
}())
;(function() {
'use strict'
function byTriggerPoint(a, b) {
return a.triggerPoint - b.triggerPoint
}
function byReverseTriggerPoint(a, b) {
return b.triggerPoint - a.triggerPoint
}
var groups = {
vertical: {},
horizontal: {}
}
var Waypoint = window.Waypoint
/* http://imakewebthings.com/waypoints/api/group */
function Group(options) {
this.name = options.name
this.axis = options.axis
this.id = this.name + '-' + this.axis
this.waypoints = []
this.clearTriggerQueues()
groups[this.axis][this.name] = this
}
/* Private */
Group.prototype.add = function(waypoint) {
this.waypoints.push(waypoint)
}
/* Private */
Group.prototype.clearTriggerQueues = function() {
this.triggerQueues = {
up: [],
down: [],
left: [],
right: []
}
}
/* Private */
Group.prototype.flushTriggers = function() {
for (var direction in this.triggerQueues) {
var waypoints = this.triggerQueues[direction]
var reverse = direction === 'up' || direction === 'left'
waypoints.sort(reverse ? byReverseTriggerPoint : byTriggerPoint)
for (var i = 0, end = waypoints.length; i < end; i += 1) {
var waypoint = waypoints[i]
if (waypoint.options.continuous || i === waypoints.length - 1) {
waypoint.trigger([direction])
}
}
}
this.clearTriggerQueues()
}
/* Private */
Group.prototype.next = function(waypoint) {
this.waypoints.sort(byTriggerPoint)
var index = Waypoint.Adapter.inArray(waypoint, this.waypoints)
var isLast = index === this.waypoints.length - 1
return isLast ? null : this.waypoints[index + 1]
}
/* Private */
Group.prototype.previous = function(waypoint) {
this.waypoints.sort(byTriggerPoint)
var index = Waypoint.Adapter.inArray(waypoint, this.waypoints)
return index ? this.waypoints[index - 1] : null
}
/* Private */
Group.prototype.queueTrigger = function(waypoint, direction) {
this.triggerQueues[direction].push(waypoint)
}
/* Private */
Group.prototype.remove = function(waypoint) {
var index = Waypoint.Adapter.inArray(waypoint, this.waypoints)
if (index > -1) {
this.waypoints.splice(index, 1)
}
}
/* Public */
/* http://imakewebthings.com/waypoints/api/first */
Group.prototype.first = function() {
return this.waypoints[0]
}
/* Public */
/* http://imakewebthings.com/waypoints/api/last */
Group.prototype.last = function() {
return this.waypoints[this.waypoints.length - 1]
}
/* Private */
Group.findOrCreate = function(options) {
return groups[options.axis][options.name] || new Group(options)
}
Waypoint.Group = Group
}())
;(function() {
'use strict'
var $ = window.jQuery
var Waypoint = window.Waypoint
function JQueryAdapter(element) {
this.$element = $(element)
}
$.each([
'innerHeight',
'innerWidth',
'off',
'offset',
'on',
'outerHeight',
'outerWidth',
'scrollLeft',
'scrollTop'
], function(i, method) {
JQueryAdapter.prototype[method] = function() {
var args = Array.prototype.slice.call(arguments)
return this.$element[method].apply(this.$element, args)
}
})
$.each([
'extend',
'inArray',
'isEmptyObject'
], function(i, method) {
JQueryAdapter[method] = $[method]
})
Waypoint.adapters.push({
name: 'jquery',
Adapter: JQueryAdapter
})
Waypoint.Adapter = JQueryAdapter
}())
;(function() {
'use strict'
var Waypoint = window.Waypoint
function createExtension(framework) {
return function() {
var waypoints = []
var overrides = arguments[0]
if (framework.isFunction(arguments[0])) {
overrides = framework.extend({}, arguments[1])
overrides.handler = arguments[0]
}
this.each(function() {
var options = framework.extend({}, overrides, {
element: this
})
if (typeof options.context === 'string') {
options.context = framework(this).closest(options.context)[0]
}
waypoints.push(new Waypoint(options))
})
return waypoints
}
}
if (window.jQuery) {
window.jQuery.fn.waypoint = createExtension(window.jQuery)
}
if (window.Zepto) {
window.Zepto.fn.waypoint = createExtension(window.Zepto)
}
}())
;
================================================
FILE: lib/noframework.waypoints.js
================================================
/*!
Waypoints - 4.0.1
Copyright © 2011-2016 Caleb Troughton
Licensed under the MIT license.
https://github.com/imakewebthings/waypoints/blob/master/licenses.txt
*/
(function() {
'use strict'
var keyCounter = 0
var allWaypoints = {}
/* http://imakewebthings.com/waypoints/api/waypoint */
function Waypoint(options) {
if (!options) {
throw new Error('No options passed to Waypoint constructor')
}
if (!options.element) {
throw new Error('No element option passed to Waypoint constructor')
}
if (!options.handler) {
throw new Error('No handler option passed to Waypoint constructor')
}
this.key = 'waypoint-' + keyCounter
this.options = Waypoint.Adapter.extend({}, Waypoint.defaults, options)
this.element = this.options.element
this.adapter = new Waypoint.Adapter(this.element)
this.callback = options.handler
this.axis = this.options.horizontal ? 'horizontal' : 'vertical'
this.enabled = this.options.enabled
this.triggerPoint = null
this.group = Waypoint.Group.findOrCreate({
name: this.options.group,
axis: this.axis
})
this.context = Waypoint.Context.findOrCreateByElement(this.options.context)
if (Waypoint.offsetAliases[this.options.offset]) {
this.options.offset = Waypoint.offsetAliases[this.options.offset]
}
this.group.add(this)
this.context.add(this)
allWaypoints[this.key] = this
keyCounter += 1
}
/* Private */
Waypoint.prototype.queueTrigger = function(direction) {
this.group.queueTrigger(this, direction)
}
/* Private */
Waypoint.prototype.trigger = function(args) {
if (!this.enabled) {
return
}
if (this.callback) {
this.callback.apply(this, args)
}
}
/* Public */
/* http://imakewebthings.com/waypoints/api/destroy */
Waypoint.prototype.destroy = function() {
this.context.remove(this)
this.group.remove(this)
delete allWaypoints[this.key]
}
/* Public */
/* http://imakewebthings.com/waypoints/api/disable */
Waypoint.prototype.disable = function() {
this.enabled = false
return this
}
/* Public */
/* http://imakewebthings.com/waypoints/api/enable */
Waypoint.prototype.enable = function() {
this.context.refresh()
this.enabled = true
return this
}
/* Public */
/* http://imakewebthings.com/waypoints/api/next */
Waypoint.prototype.next = function() {
return this.group.next(this)
}
/* Public */
/* http://imakewebthings.com/waypoints/api/previous */
Waypoint.prototype.previous = function() {
return this.group.previous(this)
}
/* Private */
Waypoint.invokeAll = function(method) {
var allWaypointsArray = []
for (var waypointKey in allWaypoints) {
allWaypointsArray.push(allWaypoints[waypointKey])
}
for (var i = 0, end = allWaypointsArray.length; i < end; i++) {
allWaypointsArray[i][method]()
}
}
/* Public */
/* http://imakewebthings.com/waypoints/api/destroy-all */
Waypoint.destroyAll = function() {
Waypoint.invokeAll('destroy')
}
/* Public */
/* http://imakewebthings.com/waypoints/api/disable-all */
Waypoint.disableAll = function() {
Waypoint.invokeAll('disable')
}
/* Public */
/* http://imakewebthings.com/waypoints/api/enable-all */
Waypoint.enableAll = function() {
Waypoint.Context.refreshAll()
for (var waypointKey in allWaypoints) {
allWaypoints[waypointKey].enabled = true
}
return this
}
/* Public */
/* http://imakewebthings.com/waypoints/api/refresh-all */
Waypoint.refreshAll = function() {
Waypoint.Context.refreshAll()
}
/* Public */
/* http://imakewebthings.com/waypoints/api/viewport-height */
Waypoint.viewportHeight = function() {
return window.innerHeight || document.documentElement.clientHeight
}
/* Public */
/* http://imakewebthings.com/waypoints/api/viewport-width */
Waypoint.viewportWidth = function() {
return document.documentElement.clientWidth
}
Waypoint.adapters = []
Waypoint.defaults = {
context: window,
continuous: true,
enabled: true,
group: 'default',
horizontal: false,
offset: 0
}
Waypoint.offsetAliases = {
'bottom-in-view': function() {
return this.context.innerHeight() - this.adapter.outerHeight()
},
'right-in-view': function() {
return this.context.innerWidth() - this.adapter.outerWidth()
}
}
window.Waypoint = Waypoint
}())
;(function() {
'use strict'
function requestAnimationFrameShim(callback) {
window.setTimeout(callback, 1000 / 60)
}
var keyCounter = 0
var contexts = {}
var Waypoint = window.Waypoint
var oldWindowLoad = window.onload
/* http://imakewebthings.com/waypoints/api/context */
function Context(element) {
this.element = element
this.Adapter = Waypoint.Adapter
this.adapter = new this.Adapter(element)
this.key = 'waypoint-context-' + keyCounter
this.didScroll = false
this.didResize = false
this.oldScroll = {
x: this.adapter.scrollLeft(),
y: this.adapter.scrollTop()
}
this.waypoints = {
vertical: {},
horizontal: {}
}
element.waypointContextKey = this.key
contexts[element.waypointContextKey] = this
keyCounter += 1
if (!Waypoint.windowContext) {
Waypoint.windowContext = true
Waypoint.windowContext = new Context(window)
}
this.createThrottledScrollHandler()
this.createThrottledResizeHandler()
}
/* Private */
Context.prototype.add = function(waypoint) {
var axis = waypoint.options.horizontal ? 'horizontal' : 'vertical'
this.waypoints[axis][waypoint.key] = waypoint
this.refresh()
}
/* Private */
Context.prototype.checkEmpty = function() {
var horizontalEmpty = this.Adapter.isEmptyObject(this.waypoints.horizontal)
var verticalEmpty = this.Adapter.isEmptyObject(this.waypoints.vertical)
var isWindow = this.element == this.element.window
if (horizontalEmpty && verticalEmpty && !isWindow) {
this.adapter.off('.waypoints')
delete contexts[this.key]
}
}
/* Private */
Context.prototype.createThrottledResizeHandler = function() {
var self = this
function resizeHandler() {
self.handleResize()
self.didResize = false
}
this.adapter.on('resize.waypoints', function() {
if (!self.didResize) {
self.didResize = true
Waypoint.requestAnimationFrame(resizeHandler)
}
})
}
/* Private */
Context.prototype.createThrottledScrollHandler = function() {
var self = this
function scrollHandler() {
self.handleScroll()
self.didScroll = false
}
this.adapter.on('scroll.waypoints', function() {
if (!self.didScroll || Waypoint.isTouch) {
self.didScroll = true
Waypoint.requestAnimationFrame(scrollHandler)
}
})
}
/* Private */
Context.prototype.handleResize = function() {
Waypoint.Context.refreshAll()
}
/* Private */
Context.prototype.handleScroll = function() {
var triggeredGroups = {}
var axes = {
horizontal: {
newScroll: this.adapter.scrollLeft(),
oldScroll: this.oldScroll.x,
forward: 'right',
backward: 'left'
},
vertical: {
newScroll: this.adapter.scrollTop(),
oldScroll: this.oldScroll.y,
forward: 'down',
backward: 'up'
}
}
for (var axisKey in axes) {
var axis = axes[axisKey]
var isForward = axis.newScroll > axis.oldScroll
var direction = isForward ? axis.forward : axis.backward
for (var waypointKey in this.waypoints[axisKey]) {
var waypoint = this.waypoints[axisKey][waypointKey]
if (waypoint.triggerPoint === null) {
continue
}
var wasBeforeTriggerPoint = axis.oldScroll < waypoint.triggerPoint
var nowAfterTriggerPoint = axis.newScroll >= waypoint.triggerPoint
var crossedForward = wasBeforeTriggerPoint && nowAfterTriggerPoint
var crossedBackward = !wasBeforeTriggerPoint && !nowAfterTriggerPoint
if (crossedForward || crossedBackward) {
waypoint.queueTrigger(direction)
triggeredGroups[waypoint.group.id] = waypoint.group
}
}
}
for (var groupKey in triggeredGroups) {
triggeredGroups[groupKey].flushTriggers()
}
this.oldScroll = {
x: axes.horizontal.newScroll,
y: axes.vertical.newScroll
}
}
/* Private */
Context.prototype.innerHeight = function() {
/*eslint-disable eqeqeq */
if (this.element == this.element.window) {
return Waypoint.viewportHeight()
}
/*eslint-enable eqeqeq */
return this.adapter.innerHeight()
}
/* Private */
Context.prototype.remove = function(waypoint) {
delete this.waypoints[waypoint.axis][waypoint.key]
this.checkEmpty()
}
/* Private */
Context.prototype.innerWidth = function() {
/*eslint-disable eqeqeq */
if (this.element == this.element.window) {
return Waypoint.viewportWidth()
}
/*eslint-enable eqeqeq */
return this.adapter.innerWidth()
}
/* Public */
/* http://imakewebthings.com/waypoints/api/context-destroy */
Context.prototype.destroy = function() {
var allWaypoints = []
for (var axis in this.waypoints) {
for (var waypointKey in this.waypoints[axis]) {
allWaypoints.push(this.waypoints[axis][waypointKey])
}
}
for (var i = 0, end = allWaypoints.length; i < end; i++) {
allWaypoints[i].destroy()
}
}
/* Public */
/* http://imakewebthings.com/waypoints/api/context-refresh */
Context.prototype.refresh = function() {
/*eslint-disable eqeqeq */
var isWindow = this.element == this.element.window
/*eslint-enable eqeqeq */
var contextOffset = isWindow ? undefined : this.adapter.offset()
var triggeredGroups = {}
var axes
this.handleScroll()
axes = {
horizontal: {
contextOffset: isWindow ? 0 : contextOffset.left,
contextScroll: isWindow ? 0 : this.oldScroll.x,
contextDimension: this.innerWidth(),
oldScroll: this.oldScroll.x,
forward: 'right',
backward: 'left',
offsetProp: 'left'
},
vertical: {
contextOffset: isWindow ? 0 : contextOffset.top,
contextScroll: isWindow ? 0 : this.oldScroll.y,
contextDimension: this.innerHeight(),
oldScroll: this.oldScroll.y,
forward: 'down',
backward: 'up',
offsetProp: 'top'
}
}
for (var axisKey in axes) {
var axis = axes[axisKey]
for (var waypointKey in this.waypoints[axisKey]) {
var waypoint = this.waypoints[axisKey][waypointKey]
var adjustment = waypoint.options.offset
var oldTriggerPoint = waypoint.triggerPoint
var elementOffset = 0
var freshWaypoint = oldTriggerPoint == null
var contextModifier, wasBeforeScroll, nowAfterScroll
var triggeredBackward, triggeredForward
if (waypoint.element !== waypoint.element.window) {
elementOffset = waypoint.adapter.offset()[axis.offsetProp]
}
if (typeof adjustment === 'function') {
adjustment = adjustment.apply(waypoint)
}
else if (typeof adjustment === 'string') {
adjustment = parseFloat(adjustment)
if (waypoint.options.offset.indexOf('%') > - 1) {
adjustment = Math.ceil(axis.contextDimension * adjustment / 100)
}
}
contextModifier = axis.contextScroll - axis.contextOffset
waypoint.triggerPoint = Math.floor(elementOffset + contextModifier - adjustment)
wasBeforeScroll = oldTriggerPoint < axis.oldScroll
nowAfterScroll = waypoint.triggerPoint >= axis.oldScroll
triggeredBackward = wasBeforeScroll && nowAfterScroll
triggeredForward = !wasBeforeScroll && !nowAfterScroll
if (!freshWaypoint && triggeredBackward) {
waypoint.queueTrigger(axis.backward)
triggeredGroups[waypoint.group.id] = waypoint.group
}
else if (!freshWaypoint && triggeredForward) {
waypoint.queueTrigger(axis.forward)
triggeredGroups[waypoint.group.id] = waypoint.group
}
else if (freshWaypoint && axis.oldScroll >= waypoint.triggerPoint) {
waypoint.queueTrigger(axis.forward)
triggeredGroups[waypoint.group.id] = waypoint.group
}
}
}
Waypoint.requestAnimationFrame(function() {
for (var groupKey in triggeredGroups) {
triggeredGroups[groupKey].flushTriggers()
}
})
return this
}
/* Private */
Context.findOrCreateByElement = function(element) {
return Context.findByElement(element) || new Context(element)
}
/* Private */
Context.refreshAll = function() {
for (var contextId in contexts) {
contexts[contextId].refresh()
}
}
/* Public */
/* http://imakewebthings.com/waypoints/api/context-find-by-element */
Context.findByElement = function(element) {
return contexts[element.waypointContextKey]
}
window.onload = function() {
if (oldWindowLoad) {
oldWindowLoad()
}
Context.refreshAll()
}
Waypoint.requestAnimationFrame = function(callback) {
var requestFn = window.requestAnimationFrame ||
window.mozRequestAnimationFrame ||
window.webkitRequestAnimationFrame ||
requestAnimationFrameShim
requestFn.call(window, callback)
}
Waypoint.Context = Context
}())
;(function() {
'use strict'
function byTriggerPoint(a, b) {
return a.triggerPoint - b.triggerPoint
}
function byReverseTriggerPoint(a, b) {
return b.triggerPoint - a.triggerPoint
}
var groups = {
vertical: {},
horizontal: {}
}
var Waypoint = window.Waypoint
/* http://imakewebthings.com/waypoints/api/group */
function Group(options) {
this.name = options.name
this.axis = options.axis
this.id = this.name + '-' + this.axis
this.waypoints = []
this.clearTriggerQueues()
groups[this.axis][this.name] = this
}
/* Private */
Group.prototype.add = function(waypoint) {
this.waypoints.push(waypoint)
}
/* Private */
Group.prototype.clearTriggerQueues = function() {
this.triggerQueues = {
up: [],
down: [],
left: [],
right: []
}
}
/* Private */
Group.prototype.flushTriggers = function() {
for (var direction in this.triggerQueues) {
var waypoints = this.triggerQueues[direction]
var reverse = direction === 'up' || direction === 'left'
waypoints.sort(reverse ? byReverseTriggerPoint : byTriggerPoint)
for (var i = 0, end = waypoints.length; i < end; i += 1) {
var waypoint = waypoints[i]
if (waypoint.options.continuous || i === waypoints.length - 1) {
waypoint.trigger([direction])
}
}
}
this.clearTriggerQueues()
}
/* Private */
Group.prototype.next = function(waypoint) {
this.waypoints.sort(byTriggerPoint)
var index = Waypoint.Adapter.inArray(waypoint, this.waypoints)
var isLast = index === this.waypoints.length - 1
return isLast ? null : this.waypoints[index + 1]
}
/* Private */
Group.prototype.previous = function(waypoint) {
this.waypoints.sort(byTriggerPoint)
var index = Waypoint.Adapter.inArray(waypoint, this.waypoints)
return index ? this.waypoints[index - 1] : null
}
/* Private */
Group.prototype.queueTrigger = function(waypoint, direction) {
this.triggerQueues[direction].push(waypoint)
}
/* Private */
Group.prototype.remove = function(waypoint) {
var index = Waypoint.Adapter.inArray(waypoint, this.waypoints)
if (index > -1) {
this.waypoints.splice(index, 1)
}
}
/* Public */
/* http://imakewebthings.com/waypoints/api/first */
Group.prototype.first = function() {
return this.waypoints[0]
}
/* Public */
/* http://imakewebthings.com/waypoints/api/last */
Group.prototype.last = function() {
return this.waypoints[this.waypoints.length - 1]
}
/* Private */
Group.findOrCreate = function(options) {
return groups[options.axis][options.name] || new Group(options)
}
Waypoint.Group = Group
}())
;(function() {
'use strict'
var Waypoint = window.Waypoint
function isWindow(element) {
return element === element.window
}
function getWindow(element) {
if (isWindow(element)) {
return element
}
return element.defaultView
}
function NoFrameworkAdapter(element) {
this.element = element
this.handlers = {}
}
NoFrameworkAdapter.prototype.innerHeight = function() {
var isWin = isWindow(this.element)
return isWin ? this.element.innerHeight : this.element.clientHeight
}
NoFrameworkAdapter.prototype.innerWidth = function() {
var isWin = isWindow(this.element)
return isWin ? this.element.innerWidth : this.element.clientWidth
}
NoFrameworkAdapter.prototype.off = function(event, handler) {
function removeListeners(element, listeners, handler) {
for (var i = 0, end = listeners.length - 1; i < end; i++) {
var listener = listeners[i]
if (!handler || handler === listener) {
element.removeEventListener(listener)
}
}
}
var eventParts = event.split('.')
var eventType = eventParts[0]
var namespace = eventParts[1]
var element = this.element
if (namespace && this.handlers[namespace] && eventType) {
removeListeners(element, this.handlers[namespace][eventType], handler)
this.handlers[namespace][eventType] = []
}
else if (eventType) {
for (var ns in this.handlers) {
removeListeners(element, this.handlers[ns][eventType] || [], handler)
this.handlers[ns][eventType] = []
}
}
else if (namespace && this.handlers[namespace]) {
for (var type in this.handlers[namespace]) {
removeListeners(element, this.handlers[namespace][type], handler)
}
this.handlers[namespace] = {}
}
}
/* Adapted from jQuery 1.x offset() */
NoFrameworkAdapter.prototype.offset = function() {
if (!this.element.ownerDocument) {
return null
}
var documentElement = this.element.ownerDocument.documentElement
var win = getWindow(this.element.ownerDocument)
var rect = {
top: 0,
left: 0
}
if (this.element.getBoundingClientRect) {
rect = this.element.getBoundingClientRect()
}
return {
top: rect.top + win.pageYOffset - documentElement.clientTop,
left: rect.left + win.pageXOffset - documentElement.clientLeft
}
}
NoFrameworkAdapter.prototype.on = function(event, handler) {
var eventParts = event.split('.')
var eventType = eventParts[0]
var namespace = eventParts[1] || '__default'
var nsHandlers = this.handlers[namespace] = this.handlers[namespace] || {}
var nsTypeList = nsHandlers[eventType] = nsHandlers[eventType] || []
nsTypeList.push(handler)
this.element.addEventListener(eventType, handler)
}
NoFrameworkAdapter.prototype.outerHeight = function(includeMargin) {
var height = this.innerHeight()
var computedStyle
if (includeMargin && !isWindow(this.element)) {
computedStyle = window.getComputedStyle(this.element)
height += parseInt(computedStyle.marginTop, 10)
height += parseInt(computedStyle.marginBottom, 10)
}
return height
}
NoFrameworkAdapter.prototype.outerWidth = function(includeMargin) {
var width = this.innerWidth()
var computedStyle
if (includeMargin && !isWindow(this.element)) {
computedStyle = window.getComputedStyle(this.element)
width += parseInt(computedStyle.marginLeft, 10)
width += parseInt(computedStyle.marginRight, 10)
}
return width
}
NoFrameworkAdapter.prototype.scrollLeft = function() {
var win = getWindow(this.element)
return win ? win.pageXOffset : this.element.scrollLeft
}
NoFrameworkAdapter.prototype.scrollTop = function() {
var win = getWindow(this.element)
return win ? win.pageYOffset : this.element.scrollTop
}
NoFrameworkAdapter.extend = function() {
var args = Array.prototype.slice.call(arguments)
function merge(target, obj) {
if (typeof target === 'object' && typeof obj === 'object') {
for (var key in obj) {
if (obj.hasOwnProperty(key)) {
target[key] = obj[key]
}
}
}
return target
}
for (var i = 1, end = args.length; i < end; i++) {
merge(args[0], args[i])
}
return args[0]
}
NoFrameworkAdapter.inArray = function(element, array, i) {
return array == null ? -1 : array.indexOf(element, i)
}
NoFrameworkAdapter.isEmptyObject = function(obj) {
/* eslint no-unused-vars: 0 */
for (var name in obj) {
return false
}
return true
}
Waypoint.adapters.push({
name: 'noframework',
Adapter: NoFrameworkAdapter
})
Waypoint.Adapter = NoFrameworkAdapter
}())
;
================================================
FILE: lib/shortcuts/infinite.js
================================================
/*!
Waypoints Infinite Scroll Shortcut - 4.0.1
Copyright © 2011-2016 Caleb Troughton
Licensed under the MIT license.
https://github.com/imakewebthings/waypoints/blob/master/licenses.txt
*/
(function() {
'use strict'
var $ = window.jQuery
var Waypoint = window.Waypoint
/* http://imakewebthings.com/waypoints/shortcuts/infinite-scroll */
function Infinite(options) {
this.options = $.extend({}, Infinite.defaults, options)
this.container = this.options.element
if (this.options.container !== 'auto') {
this.container = this.options.container
}
this.$container = $(this.container)
this.$more = $(this.options.more)
if (this.$more.length) {
this.setupHandler()
this.waypoint = new Waypoint(this.options)
}
}
/* Private */
Infinite.prototype.setupHandler = function() {
this.options.handler = $.proxy(function() {
this.options.onBeforePageLoad()
this.destroy()
this.$container.addClass(this.options.loadingClass)
$.get($(this.options.more).attr('href'), $.proxy(function(data) {
var $data = $($.parseHTML(data))
var $newMore = $data.find(this.options.more)
var $items = $data.find(this.options.items)
if (!$items.length) {
$items = $data.filter(this.options.items)
}
this.$container.append($items)
this.$container.removeClass(this.options.loadingClass)
if (!$newMore.length) {
$newMore = $data.filter(this.options.more)
}
if ($newMore.length) {
this.$more.replaceWith($newMore)
this.$more = $newMore
this.waypoint = new Waypoint(this.options)
}
else {
this.$more.remove()
}
this.options.onAfterPageLoad($items)
}, this))
}, this)
}
/* Public */
Infinite.prototype.destroy = function() {
if (this.waypoint) {
this.waypoint.destroy()
}
}
Infinite.defaults = {
container: 'auto',
items: '.infinite-item',
more: '.infinite-more-link',
offset: 'bottom-in-view',
loadingClass: 'infinite-loading',
onBeforePageLoad: $.noop,
onAfterPageLoad: $.noop
}
Waypoint.Infinite = Infinite
}())
;
================================================
FILE: lib/shortcuts/inview.js
================================================
/*!
Waypoints Inview Shortcut - 4.0.1
Copyright © 2011-2016 Caleb Troughton
Licensed under the MIT license.
https://github.com/imakewebthings/waypoints/blob/master/licenses.txt
*/
(function() {
'use strict'
function noop() {}
var Waypoint = window.Waypoint
/* http://imakewebthings.com/waypoints/shortcuts/inview */
function Inview(options) {
this.options = Waypoint.Adapter.extend({}, Inview.defaults, options)
this.axis = this.options.horizontal ? 'horizontal' : 'vertical'
this.waypoints = []
this.element = this.options.element
this.createWaypoints()
}
/* Private */
Inview.prototype.createWaypoints = function() {
var configs = {
vertical: [{
down: 'enter',
up: 'exited',
offset: '100%'
}, {
down: 'entered',
up: 'exit',
offset: 'bottom-in-view'
}, {
down: 'exit',
up: 'entered',
offset: 0
}, {
down: 'exited',
up: 'enter',
offset: function() {
return -this.adapter.outerHeight()
}
}],
horizontal: [{
right: 'enter',
left: 'exited',
offset: '100%'
}, {
right: 'entered',
left: 'exit',
offset: 'right-in-view'
}, {
right: 'exit',
left: 'entered',
offset: 0
}, {
right: 'exited',
left: 'enter',
offset: function() {
return -this.adapter.outerWidth()
}
}]
}
for (var i = 0, end = configs[this.axis].length; i < end; i++) {
var config = configs[this.axis][i]
this.createWaypoint(config)
}
}
/* Private */
Inview.prototype.createWaypoint = function(config) {
var self = this
this.waypoints.push(new Waypoint({
context: this.options.context,
element: this.options.element,
enabled: this.options.enabled,
handler: (function(config) {
return function(direction) {
self.options[config[direction]].call(self, direction)
}
}(config)),
offset: config.offset,
horizontal: this.options.horizontal
}))
}
/* Public */
Inview.prototype.destroy = function() {
for (var i = 0, end = this.waypoints.length; i < end; i++) {
this.waypoints[i].destroy()
}
this.waypoints = []
}
Inview.prototype.disable = function() {
for (var i = 0, end = this.waypoints.length; i < end; i++) {
this.waypoints[i].disable()
}
}
Inview.prototype.enable = function() {
for (var i = 0, end = this.waypoints.length; i < end; i++) {
this.waypoints[i].enable()
}
}
Inview.defaults = {
context: window,
enabled: true,
enter: noop,
entered: noop,
exit: noop,
exited: noop
}
Waypoint.Inview = Inview
}())
;
================================================
FILE: lib/shortcuts/sticky.js
================================================
/*!
Waypoints Sticky Element Shortcut - 4.0.1
Copyright © 2011-2016 Caleb Troughton
Licensed under the MIT license.
https://github.com/imakewebthings/waypoints/blob/master/licenses.txt
*/
(function() {
'use strict'
var $ = window.jQuery
var Waypoint = window.Waypoint
/* http://imakewebthings.com/waypoints/shortcuts/sticky-elements */
function Sticky(options) {
this.options = $.extend({}, Waypoint.defaults, Sticky.defaults, options)
this.element = this.options.element
this.$element = $(this.element)
this.createWrapper()
this.createWaypoint()
}
/* Private */
Sticky.prototype.createWaypoint = function() {
var originalHandler = this.options.handler
this.waypoint = new Waypoint($.extend({}, this.options, {
element: this.wrapper,
handler: $.proxy(function(direction) {
var shouldBeStuck = this.options.direction.indexOf(direction) > -1
var wrapperHeight = shouldBeStuck ? this.$element.outerHeight(true) : ''
this.$wrapper.height(wrapperHeight)
this.$element.toggleClass(this.options.stuckClass, shouldBeStuck)
if (originalHandler) {
originalHandler.call(this, direction)
}
}, this)
}))
}
/* Private */
Sticky.prototype.createWrapper = function() {
if (this.options.wrapper) {
this.$element.wrap(this.options.wrapper)
}
this.$wrapper = this.$element.parent()
this.wrapper = this.$wrapper[0]
}
/* Public */
Sticky.prototype.destroy = function() {
if (this.$element.parent()[0] === this.wrapper) {
this.waypoint.destroy()
this.$element.removeClass(this.options.stuckClass)
if (this.options.wrapper) {
this.$element.unwrap()
}
}
}
Sticky.defaults = {
wrapper: '<div class="sticky-wrapper" />',
stuckClass: 'stuck',
direction: 'down right'
}
Waypoint.Sticky = Sticky
}())
;
================================================
FILE: lib/waypoints.debug.js
================================================
/*!
Waypoints Debug - 4.0.1
Copyright © 2011-2016 Caleb Troughton
Licensed under the MIT license.
https://github.com/imakewebthings/waypoints/blob/master/licenses.txt
*/
(function() {
'use strict'
var displayNoneMessage = [
'You have a Waypoint element with display none. For more information on ',
'why this is a bad idea read ',
'http://imakewebthings.com/waypoints/guides/debugging/#display-none'
].join('')
var fixedMessage = [
'You have a Waypoint element with fixed positioning. For more ',
'information on why this is a bad idea read ',
'http://imakewebthings.com/waypoints/guides/debugging/#fixed-position'
].join('')
function checkWaypointStyles() {
var originalRefresh = window.Waypoint.Context.prototype.refresh
window.Waypoint.Context.prototype.refresh = function() {
for (var axis in this.waypoints) {
for (var key in this.waypoints[axis]) {
var waypoint = this.waypoints[axis][key]
var style = window.getComputedStyle(waypoint.element)
if (!waypoint.enabled) {
continue
}
if (style && style.display === 'none') {
console.error(displayNoneMessage)
}
if (style && style.position === 'fixed') {
console.error(fixedMessage)
}
}
}
return originalRefresh.call(this)
}
}
checkWaypointStyles()
}())
;
================================================
FILE: lib/zepto.waypoints.js
================================================
/*!
Waypoints - 4.0.1
Copyright © 2011-2016 Caleb Troughton
Licensed under the MIT license.
https://github.com/imakewebthings/waypoints/blob/master/licenses.txt
*/
(function() {
'use strict'
var keyCounter = 0
var allWaypoints = {}
/* http://imakewebthings.com/waypoints/api/waypoint */
function Waypoint(options) {
if (!options) {
throw new Error('No options passed to Waypoint constructor')
}
if (!options.element) {
throw new Error('No element option passed to Waypoint constructor')
}
if (!options.handler) {
throw new Error('No handler option passed to Waypoint constructor')
}
this.key = 'waypoint-' + keyCounter
this.options = Waypoint.Adapter.extend({}, Waypoint.defaults, options)
this.element = this.options.element
this.adapter = new Waypoint.Adapter(this.element)
this.callback = options.handler
this.axis = this.options.horizontal ? 'horizontal' : 'vertical'
this.enabled = this.options.enabled
this.triggerPoint = null
this.group = Waypoint.Group.findOrCreate({
name: this.options.group,
axis: this.axis
})
this.context = Waypoint.Context.findOrCreateByElement(this.options.context)
if (Waypoint.offsetAliases[this.options.offset]) {
this.options.offset = Waypoint.offsetAliases[this.options.offset]
}
this.group.add(this)
this.context.add(this)
allWaypoints[this.key] = this
keyCounter += 1
}
/* Private */
Waypoint.prototype.queueTrigger = function(direction) {
this.group.queueTrigger(this, direction)
}
/* Private */
Waypoint.prototype.trigger = function(args) {
if (!this.enabled) {
return
}
if (this.callback) {
this.callback.apply(this, args)
}
}
/* Public */
/* http://imakewebthings.com/waypoints/api/destroy */
Waypoint.prototype.destroy = function() {
this.context.remove(this)
this.group.remove(this)
delete allWaypoints[this.key]
}
/* Public */
/* http://imakewebthings.com/waypoints/api/disable */
Waypoint.prototype.disable = function() {
this.enabled = false
return this
}
/* Public */
/* http://imakewebthings.com/waypoints/api/enable */
Waypoint.prototype.enable = function() {
this.context.refresh()
this.enabled = true
return this
}
/* Public */
/* http://imakewebthings.com/waypoints/api/next */
Waypoint.prototype.next = function() {
return this.group.next(this)
}
/* Public */
/* http://imakewebthings.com/waypoints/api/previous */
Waypoint.prototype.previous = function() {
return this.group.previous(this)
}
/* Private */
Waypoint.invokeAll = function(method) {
var allWaypointsArray = []
for (var waypointKey in allWaypoints) {
allWaypointsArray.push(allWaypoints[waypointKey])
}
for (var i = 0, end = allWaypointsArray.length; i < end; i++) {
allWaypointsArray[i][method]()
}
}
/* Public */
/* http://imakewebthings.com/waypoints/api/destroy-all */
Waypoint.destroyAll = function() {
Waypoint.invokeAll('destroy')
}
/* Public */
/* http://imakewebthings.com/waypoints/api/disable-all */
Waypoint.disableAll = function() {
Waypoint.invokeAll('disable')
}
/* Public */
/* http://imakewebthings.com/waypoints/api/enable-all */
Waypoint.enableAll = function() {
Waypoint.Context.refreshAll()
for (var waypointKey in allWaypoints) {
allWaypoints[waypointKey].enabled = true
}
return this
}
/* Public */
/* http://imakewebthings.com/waypoints/api/refresh-all */
Waypoint.refreshAll = function() {
Waypoint.Context.refreshAll()
}
/* Public */
/* http://imakewebthings.com/waypoints/api/viewport-height */
Waypoint.viewportHeight = function() {
return window.innerHeight || document.documentElement.clientHeight
}
/* Public */
/* http://imakewebthings.com/waypoints/api/viewport-width */
Waypoint.viewportWidth = function() {
return document.documentElement.clientWidth
}
Waypoint.adapters = []
Waypoint.defaults = {
context: window,
continuous: true,
enabled: true,
group: 'default',
horizontal: false,
offset: 0
}
Waypoint.offsetAliases = {
'bottom-in-view': function() {
return this.context.innerHeight() - this.adapter.outerHeight()
},
'right-in-view': function() {
return this.context.innerWidth() - this.adapter.outerWidth()
}
}
window.Waypoint = Waypoint
}())
;(function() {
'use strict'
function requestAnimationFrameShim(callback) {
window.setTimeout(callback, 1000 / 60)
}
var keyCounter = 0
var contexts = {}
var Waypoint = window.Waypoint
var oldWindowLoad = window.onload
/* http://imakewebthings.com/waypoints/api/context */
function Context(element) {
this.element = element
this.Adapter = Waypoint.Adapter
this.adapter = new this.Adapter(element)
this.key = 'waypoint-context-' + keyCounter
this.didScroll = false
this.didResize = false
this.oldScroll = {
x: this.adapter.scrollLeft(),
y: this.adapter.scrollTop()
}
this.waypoints = {
vertical: {},
horizontal: {}
}
element.waypointContextKey = this.key
contexts[element.waypointContextKey] = this
keyCounter += 1
if (!Waypoint.windowContext) {
Waypoint.windowContext = true
Waypoint.windowContext = new Context(window)
}
this.createThrottledScrollHandler()
this.createThrottledResizeHandler()
}
/* Private */
Context.prototype.add = function(waypoint) {
var axis = waypoint.options.horizontal ? 'horizontal' : 'vertical'
this.waypoints[axis][waypoint.key] = waypoint
this.refresh()
}
/* Private */
Context.prototype.checkEmpty = function() {
var horizontalEmpty = this.Adapter.isEmptyObject(this.waypoints.horizontal)
var verticalEmpty = this.Adapter.isEmptyObject(this.waypoints.vertical)
var isWindow = this.element == this.element.window
if (horizontalEmpty && verticalEmpty && !isWindow) {
this.adapter.off('.waypoints')
delete contexts[this.key]
}
}
/* Private */
Context.prototype.createThrottledResizeHandler = function() {
var self = this
function resizeHandler() {
self.handleResize()
self.didResize = false
}
this.adapter.on('resize.waypoints', function() {
if (!self.didResize) {
self.didResize = true
Waypoint.requestAnimationFrame(resizeHandler)
}
})
}
/* Private */
Context.prototype.createThrottledScrollHandler = function() {
var self = this
function scrollHandler() {
self.handleScroll()
self.didScroll = false
}
this.adapter.on('scroll.waypoints', function() {
if (!self.didScroll || Waypoint.isTouch) {
self.didScroll = true
Waypoint.requestAnimationFrame(scrollHandler)
}
})
}
/* Private */
Context.prototype.handleResize = function() {
Waypoint.Context.refreshAll()
}
/* Private */
Context.prototype.handleScroll = function() {
var triggeredGroups = {}
var axes = {
horizontal: {
newScroll: this.adapter.scrollLeft(),
oldScroll: this.oldScroll.x,
forward: 'right',
backward: 'left'
},
vertical: {
newScroll: this.adapter.scrollTop(),
oldScroll: this.oldScroll.y,
forward: 'down',
backward: 'up'
}
}
for (var axisKey in axes) {
var axis = axes[axisKey]
var isForward = axis.newScroll > axis.oldScroll
var direction = isForward ? axis.forward : axis.backward
for (var waypointKey in this.waypoints[axisKey]) {
var waypoint = this.waypoints[axisKey][waypointKey]
if (waypoint.triggerPoint === null) {
continue
}
var wasBeforeTriggerPoint = axis.oldScroll < waypoint.triggerPoint
var nowAfterTriggerPoint = axis.newScroll >= waypoint.triggerPoint
var crossedForward = wasBeforeTriggerPoint && nowAfterTriggerPoint
var crossedBackward = !wasBeforeTriggerPoint && !nowAfterTriggerPoint
if (crossedForward || crossedBackward) {
waypoint.queueTrigger(direction)
triggeredGroups[waypoint.group.id] = waypoint.group
}
}
}
for (var groupKey in triggeredGroups) {
triggeredGroups[groupKey].flushTriggers()
}
this.oldScroll = {
x: axes.horizontal.newScroll,
y: axes.vertical.newScroll
}
}
/* Private */
Context.prototype.innerHeight = function() {
/*eslint-disable eqeqeq */
if (this.element == this.element.window) {
return Waypoint.viewportHeight()
}
/*eslint-enable eqeqeq */
return this.adapter.innerHeight()
}
/* Private */
Context.prototype.remove = function(waypoint) {
delete this.waypoints[waypoint.axis][waypoint.key]
this.checkEmpty()
}
/* Private */
Context.prototype.innerWidth = function() {
/*eslint-disable eqeqeq */
if (this.element == this.element.window) {
return Waypoint.viewportWidth()
}
/*eslint-enable eqeqeq */
return this.adapter.innerWidth()
}
/* Public */
/* http://imakewebthings.com/waypoints/api/context-destroy */
Context.prototype.destroy = function() {
var allWaypoints = []
for (var axis in this.waypoints) {
for (var waypointKey in this.waypoints[axis]) {
allWaypoints.push(this.waypoints[axis][waypointKey])
}
}
for (var i = 0, end = allWaypoints.length; i < end; i++) {
allWaypoints[i].destroy()
}
}
/* Public */
/* http://imakewebthings.com/waypoints/api/context-refresh */
Context.prototype.refresh = function() {
/*eslint-disable eqeqeq */
var isWindow = this.element == this.element.window
/*eslint-enable eqeqeq */
var contextOffset = isWindow ? undefined : this.adapter.offset()
var triggeredGroups = {}
var axes
this.handleScroll()
axes = {
horizontal: {
contextOffset: isWindow ? 0 : contextOffset.left,
contextScroll: isWindow ? 0 : this.oldScroll.x,
contextDimension: this.innerWidth(),
oldScroll: this.oldScroll.x,
forward: 'right',
backward: 'left',
offsetProp: 'left'
},
vertical: {
contextOffset: isWindow ? 0 : contextOffset.top,
contextScroll: isWindow ? 0 : this.oldScroll.y,
contextDimension: this.innerHeight(),
oldScroll: this.oldScroll.y,
forward: 'down',
backward: 'up',
offsetProp: 'top'
}
}
for (var axisKey in axes) {
var axis = axes[axisKey]
for (var waypointKey in this.waypoints[axisKey]) {
var waypoint = this.waypoints[axisKey][waypointKey]
var adjustment = waypoint.options.offset
var oldTriggerPoint = waypoint.triggerPoint
var elementOffset = 0
var freshWaypoint = oldTriggerPoint == null
var contextModifier, wasBeforeScroll, nowAfterScroll
var triggeredBackward, triggeredForward
if (waypoint.element !== waypoint.element.window) {
elementOffset = waypoint.adapter.offset()[axis.offsetProp]
}
if (typeof adjustment === 'function') {
adjustment = adjustment.apply(waypoint)
}
else if (typeof adjustment === 'string') {
adjustment = parseFloat(adjustment)
if (waypoint.options.offset.indexOf('%') > - 1) {
adjustment = Math.ceil(axis.contextDimension * adjustment / 100)
}
}
contextModifier = axis.contextScroll - axis.contextOffset
waypoint.triggerPoint = Math.floor(elementOffset + contextModifier - adjustment)
wasBeforeScroll = oldTriggerPoint < axis.oldScroll
nowAfterScroll = waypoint.triggerPoint >= axis.oldScroll
triggeredBackward = wasBeforeScroll && nowAfterScroll
triggeredForward = !wasBeforeScroll && !nowAfterScroll
if (!freshWaypoint && triggeredBackward) {
waypoint.queueTrigger(axis.backward)
triggeredGroups[waypoint.group.id] = waypoint.group
}
else if (!freshWaypoint && triggeredForward) {
waypoint.queueTrigger(axis.forward)
triggeredGroups[waypoint.group.id] = waypoint.group
}
else if (freshWaypoint && axis.oldScroll >= waypoint.triggerPoint) {
waypoint.queueTrigger(axis.forward)
triggeredGroups[waypoint.group.id] = waypoint.group
}
}
}
Waypoint.requestAnimationFrame(function() {
for (var groupKey in triggeredGroups) {
triggeredGroups[groupKey].flushTriggers()
}
})
return this
}
/* Private */
Context.findOrCreateByElement = function(element) {
return Context.findByElement(element) || new Context(element)
}
/* Private */
Context.refreshAll = function() {
for (var contextId in contexts) {
contexts[contextId].refresh()
}
}
/* Public */
/* http://imakewebthings.com/waypoints/api/context-find-by-element */
Context.findByElement = function(element) {
return contexts[element.waypointContextKey]
}
window.onload = function() {
if (oldWindowLoad) {
oldWindowLoad()
}
Context.refreshAll()
}
Waypoint.requestAnimationFrame = function(callback) {
var requestFn = window.requestAnimationFrame ||
window.mozRequestAnimationFrame ||
window.webkitRequestAnimationFrame ||
requestAnimationFrameShim
requestFn.call(window, callback)
}
Waypoint.Context = Context
}())
;(function() {
'use strict'
function byTriggerPoint(a, b) {
return a.triggerPoint - b.triggerPoint
}
function byReverseTriggerPoint(a, b) {
return b.triggerPoint - a.triggerPoint
}
var groups = {
vertical: {},
horizontal: {}
}
var Waypoint = window.Waypoint
/* http://imakewebthings.com/waypoints/api/group */
function Group(options) {
this.name = options.name
this.axis = options.axis
this.id = this.name + '-' + this.axis
this.waypoints = []
this.clearTriggerQueues()
groups[this.axis][this.name] = this
}
/* Private */
Group.prototype.add = function(waypoint) {
this.waypoints.push(waypoint)
}
/* Private */
Group.prototype.clearTriggerQueues = function() {
this.triggerQueues = {
up: [],
down: [],
left: [],
right: []
}
}
/* Private */
Group.prototype.flushTriggers = function() {
for (var direction in this.triggerQueues) {
var waypoints = this.triggerQueues[direction]
var reverse = direction === 'up' || direction === 'left'
waypoints.sort(reverse ? byReverseTriggerPoint : byTriggerPoint)
for (var i = 0, end = waypoints.length; i < end; i += 1) {
var waypoint = waypoints[i]
if (waypoint.options.continuous || i === waypoints.length - 1) {
waypoint.trigger([direction])
}
}
}
this.clearTriggerQueues()
}
/* Private */
Group.prototype.next = function(waypoint) {
this.waypoints.sort(byTriggerPoint)
var index = Waypoint.Adapter.inArray(waypoint, this.waypoints)
var isLast = index === this.waypoints.length - 1
return isLast ? null : this.waypoints[index + 1]
}
/* Private */
Group.prototype.previous = function(waypoint) {
this.waypoints.sort(byTriggerPoint)
var index = Waypoint.Adapter.inArray(waypoint, this.waypoints)
return index ? this.waypoints[index - 1] : null
}
/* Private */
Group.prototype.queueTrigger = function(waypoint, direction) {
this.triggerQueues[direction].push(waypoint)
}
/* Private */
Group.prototype.remove = function(waypoint) {
var index = Waypoint.Adapter.inArray(waypoint, this.waypoints)
if (index > -1) {
this.waypoints.splice(index, 1)
}
}
/* Public */
/* http://imakewebthings.com/waypoints/api/first */
Group.prototype.first = function() {
return this.waypoints[0]
}
/* Public */
/* http://imakewebthings.com/waypoints/api/last */
Group.prototype.last = function() {
return this.waypoints[this.waypoints.length - 1]
}
/* Private */
Group.findOrCreate = function(options) {
return groups[options.axis][options.name] || new Group(options)
}
Waypoint.Group = Group
}())
;(function() {
'use strict'
var $ = window.Zepto
var Waypoint = window.Waypoint
function ZeptoAdapter(element) {
this.element = element
this.$element = $(element)
}
$.each([
'off',
'on',
'scrollLeft',
'scrollTop'
], function(i, method) {
ZeptoAdapter.prototype[method] = function() {
var args = Array.prototype.slice.call(arguments)
return this.$element[method].apply(this.$element, args)
}
})
ZeptoAdapter.prototype.offset = function() {
if (this.element !== this.element.window) {
return this.$element.offset()
}
}
// Adapted from https://gist.github.com/wheresrhys/5823198
$.each([
'width',
'height'
], function(i, dimension) {
function createDimensionMethod($element, includeBorder) {
return function(includeMargin) {
var $element = this.$element
var size = $element[dimension]()
var sides = {
width: ['left', 'right'],
height: ['top', 'bottom']
}
$.each(sides[dimension], function(i, side) {
size += parseInt($element.css('padding-' + side), 10)
if (includeBorder) {
size += parseInt($element.css('border-' + side + '-width'), 10)
}
if (includeMargin) {
size += parseInt($element.css('margin-' + side), 10)
}
})
return size
}
}
var innerMethod = $.camelCase('inner-' + dimension)
var outerMethod = $.camelCase('outer-' + dimension)
ZeptoAdapter.prototype[innerMethod] = createDimensionMethod(false)
ZeptoAdapter.prototype[outerMethod] = createDimensionMethod(true)
})
$.each([
'extend',
'inArray'
], function(i, method) {
ZeptoAdapter[method] = $[method]
})
ZeptoAdapter.isEmptyObject = function(obj) {
/* eslint no-unused-vars: 0 */
for (var name in obj) {
return false
}
return true
}
Waypoint.adapters.push({
name: 'zepto',
Adapter: ZeptoAdapter
})
Waypoint.Adapter = ZeptoAdapter
}())
;(function() {
'use strict'
var Waypoint = window.Waypoint
function createExtension(framework) {
return function() {
var waypoints = []
var overrides = arguments[0]
if (framework.isFunction(arguments[0])) {
overrides = framework.extend({}, arguments[1])
overrides.handler = arguments[0]
}
this.each(function() {
var options = framework.extend({}, overrides, {
element: this
})
if (typeof options.context === 'string') {
options.context = framework(this).closest(options.context)[0]
}
waypoints.push(new Waypoint(options))
})
return waypoints
}
}
if (window.jQuery) {
window.jQuery.fn.waypoint = createExtension(window.jQuery)
}
if (window.Zepto) {
window.Zepto.fn.waypoint = createExtension(window.Zepto)
}
}())
;
================================================
FILE: licenses.txt
================================================
Copyright (c) 2011-2012 Caleb Troughton
-----------------------------------------------------------------------
The MIT License
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
================================================
FILE: package.json
================================================
{
"name": "waypoints",
"version": "4.0.1",
"author": "Caleb Troughton <caleb@imakewebthings.com> (http://imakewebthings.com)",
"description": "Easily execute a function when you scroll to an element",
"scripts": {
"build": "gulp build",
"start": "gulp",
"test": "testem ci",
"tdd": "testem",
"watch": "gulp watch"
},
"repository": {
"type": "git",
"url": "https://github.com/imakewebthings/waypoints.git"
},
"keywords": [
"scroll"
],
"devDependencies": {
"eslint": "^0.6.2",
"gulp": "^3.6.2",
"gulp-concat": "^2.2.0",
"gulp-eslint": "^0.1.7",
"gulp-footer": "^1.0.5",
"gulp-header": "^1.0.2",
"gulp-rename": "^1.2.0",
"gulp-tap": "^0.1.1",
"gulp-uglify": "^0.3.1",
"merge-stream": "^0.1.1",
"testem": "0.6.24"
},
"license": "MIT"
}
================================================
FILE: src/adapters/jquery-zepto-fn-extension.js
================================================
(function() {
'use strict'
var Waypoint = window.Waypoint
function createExtension(framework) {
return function() {
var waypoints = []
var overrides = arguments[0]
if (framework.isFunction(arguments[0])) {
overrides = framework.extend({}, arguments[1])
overrides.handler = arguments[0]
}
this.each(function() {
var options = framework.extend({}, overrides, {
element: this
})
if (typeof options.context === 'string') {
options.context = framework(this).closest(options.context)[0]
}
waypoints.push(new Waypoint(options))
})
return waypoints
}
}
if (window.jQuery) {
window.jQuery.fn.waypoint = createExtension(window.jQuery)
}
if (window.Zepto) {
window.Zepto.fn.waypoint = createExtension(window.Zepto)
}
}())
================================================
FILE: src/adapters/jquery.js
================================================
(function() {
'use strict'
var $ = window.jQuery
var Waypoint = window.Waypoint
function JQueryAdapter(element) {
this.$element = $(element)
}
$.each([
'innerHeight',
'innerWidth',
'off',
'offset',
'on',
'outerHeight',
'outerWidth',
'scrollLeft',
'scrollTop'
], function(i, method) {
JQueryAdapter.prototype[method] = function() {
var args = Array.prototype.slice.call(arguments)
return this.$element[method].apply(this.$element, args)
}
})
$.each([
'extend',
'inArray',
'isEmptyObject'
], function(i, method) {
JQueryAdapter[method] = $[method]
})
Waypoint.adapters.push({
name: 'jquery',
Adapter: JQueryAdapter
})
Waypoint.Adapter = JQueryAdapter
}())
================================================
FILE: src/adapters/noframework.js
================================================
(function() {
'use strict'
var Waypoint = window.Waypoint
function isWindow(element) {
return element === element.window
}
function getWindow(element) {
if (isWindow(element)) {
return element
}
return element.defaultView
}
function NoFrameworkAdapter(element) {
this.element = element
this.handlers = {}
}
NoFrameworkAdapter.prototype.innerHeight = function() {
var isWin = isWindow(this.element)
return isWin ? this.element.innerHeight : this.element.clientHeight
}
NoFrameworkAdapter.prototype.innerWidth = function() {
var isWin = isWindow(this.element)
return isWin ? this.element.innerWidth : this.element.clientWidth
}
NoFrameworkAdapter.prototype.off = function(event, handler) {
function removeListeners(element, listeners, handler) {
for (var i = 0, end = listeners.length - 1; i < end; i++) {
var listener = listeners[i]
if (!handler || handler === listener) {
element.removeEventListener(listener)
}
}
}
var eventParts = event.split('.')
var eventType = eventParts[0]
var namespace = eventParts[1]
var element = this.element
if (namespace && this.handlers[namespace] && eventType) {
removeListeners(element, this.handlers[namespace][eventType], handler)
this.handlers[namespace][eventType] = []
}
else if (eventType) {
for (var ns in this.handlers) {
removeListeners(element, this.handlers[ns][eventType] || [], handler)
this.handlers[ns][eventType] = []
}
}
else if (namespace && this.handlers[namespace]) {
for (var type in this.handlers[namespace]) {
removeListeners(element, this.handlers[namespace][type], handler)
}
this.handlers[namespace] = {}
}
}
/* Adapted from jQuery 1.x offset() */
NoFrameworkAdapter.prototype.offset = function() {
if (!this.element.ownerDocument) {
return null
}
var documentElement = this.element.ownerDocument.documentElement
var win = getWindow(this.element.ownerDocument)
var rect = {
top: 0,
left: 0
}
if (this.element.getBoundingClientRect) {
rect = this.element.getBoundingClientRect()
}
return {
top: rect.top + win.pageYOffset - documentElement.clientTop,
left: rect.left + win.pageXOffset - documentElement.clientLeft
}
}
NoFrameworkAdapter.prototype.on = function(event, handler) {
var eventParts = event.split('.')
var eventType = eventParts[0]
var namespace = eventParts[1] || '__default'
var nsHandlers = this.handlers[namespace] = this.handlers[namespace] || {}
var nsTypeList = nsHandlers[eventType] = nsHandlers[eventType] || []
nsTypeList.push(handler)
this.element.addEventListener(eventType, handler)
}
NoFrameworkAdapter.prototype.outerHeight = function(includeMargin) {
var height = this.innerHeight()
var computedStyle
if (includeMargin && !isWindow(this.element)) {
computedStyle = window.getComputedStyle(this.element)
height += parseInt(computedStyle.marginTop, 10)
height += parseInt(computedStyle.marginBottom, 10)
}
return height
}
NoFrameworkAdapter.prototype.outerWidth = function(includeMargin) {
var width = this.innerWidth()
var computedStyle
if (includeMargin && !isWindow(this.element)) {
computedStyle = window.getComputedStyle(this.element)
width += parseInt(computedStyle.marginLeft, 10)
width += parseInt(computedStyle.marginRight, 10)
}
return width
}
NoFrameworkAdapter.prototype.scrollLeft = function() {
var win = getWindow(this.element)
return win ? win.pageXOffset : this.element.scrollLeft
}
NoFrameworkAdapter.prototype.scrollTop = function() {
var win = getWindow(this.element)
return win ? win.pageYOffset : this.element.scrollTop
}
NoFrameworkAdapter.extend = function() {
var args = Array.prototype.slice.call(arguments)
function merge(target, obj) {
if (typeof target === 'object' && typeof obj === 'object') {
for (var key in obj) {
if (obj.hasOwnProperty(key)) {
target[key] = obj[key]
}
}
}
return target
}
for (var i = 1, end = args.length; i < end; i++) {
merge(args[0], args[i])
}
return args[0]
}
NoFrameworkAdapter.inArray = function(element, array, i) {
return array == null ? -1 : array.indexOf(element, i)
}
NoFrameworkAdapter.isEmptyObject = function(obj) {
/* eslint no-unused-vars: 0 */
for (var name in obj) {
return false
}
return true
}
Waypoint.adapters.push({
name: 'noframework',
Adapter: NoFrameworkAdapter
})
Waypoint.Adapter = NoFrameworkAdapter
}())
================================================
FILE: src/adapters/zepto.js
================================================
(function() {
'use strict'
var $ = window.Zepto
var Waypoint = window.Waypoint
function ZeptoAdapter(element) {
this.element = element
this.$element = $(element)
}
$.each([
'off',
'on',
'scrollLeft',
'scrollTop'
], function(i, method) {
ZeptoAdapter.prototype[method] = function() {
var args = Array.prototype.slice.call(arguments)
return this.$element[method].apply(this.$element, args)
}
})
ZeptoAdapter.prototype.offset = function() {
if (this.element !== this.element.window) {
return this.$element.offset()
}
}
// Adapted from https://gist.github.com/wheresrhys/5823198
$.each([
'width',
'height'
], function(i, dimension) {
function createDimensionMethod($element, includeBorder) {
return function(includeMargin) {
var $element = this.$element
var size = $element[dimension]()
var sides = {
width: ['left', 'right'],
height: ['top', 'bottom']
}
$.each(sides[dimension], function(i, side) {
size += parseInt($element.css('padding-' + side), 10)
if (includeBorder) {
size += parseInt($element.css('border-' + side + '-width'), 10)
}
if (includeMargin) {
size += parseInt($element.css('margin-' + side), 10)
}
})
return size
}
}
var innerMethod = $.camelCase('inner-' + dimension)
var outerMethod = $.camelCase('outer-' + dimension)
ZeptoAdapter.prototype[innerMethod] = createDimensionMethod(false)
ZeptoAdapter.prototype[outerMethod] = createDimensionMethod(true)
})
$.each([
'extend',
'inArray'
], function(i, method) {
ZeptoAdapter[method] = $[method]
})
ZeptoAdapter.isEmptyObject = function(obj) {
/* eslint no-unused-vars: 0 */
for (var name in obj) {
return false
}
return true
}
Waypoint.adapters.push({
name: 'zepto',
Adapter: ZeptoAdapter
})
Waypoint.Adapter = ZeptoAdapter
}())
================================================
FILE: src/context.js
================================================
(function() {
'use strict'
function requestAnimationFrameShim(callback) {
window.setTimeout(callback, 1000 / 60)
}
var keyCounter = 0
var contexts = {}
var Waypoint = window.Waypoint
var oldWindowLoad = window.onload
/* http://imakewebthings.com/waypoints/api/context */
function Context(element) {
this.element = element
this.Adapter = Waypoint.Adapter
this.adapter = new this.Adapter(element)
this.key = 'waypoint-context-' + keyCounter
this.didScroll = false
this.didResize = false
this.oldScroll = {
x: this.adapter.scrollLeft(),
y: this.adapter.scrollTop()
}
this.waypoints = {
vertical: {},
horizontal: {}
}
element.waypointContextKey = this.key
contexts[element.waypointContextKey] = this
keyCounter += 1
if (!Waypoint.windowContext) {
Waypoint.windowContext = true
Waypoint.windowContext = new Context(window)
}
this.createThrottledScrollHandler()
this.createThrottledResizeHandler()
}
/* Private */
Context.prototype.add = function(waypoint) {
var axis = waypoint.options.horizontal ? 'horizontal' : 'vertical'
this.waypoints[axis][waypoint.key] = waypoint
this.refresh()
}
/* Private */
Context.prototype.checkEmpty = function() {
var horizontalEmpty = this.Adapter.isEmptyObject(this.waypoints.horizontal)
var verticalEmpty = this.Adapter.isEmptyObject(this.waypoints.vertical)
var isWindow = this.element == this.element.window
if (horizontalEmpty && verticalEmpty && !isWindow) {
this.adapter.off('.waypoints')
delete contexts[this.key]
}
}
/* Private */
Context.prototype.createThrottledResizeHandler = function() {
var self = this
function resizeHandler() {
self.handleResize()
self.didResize = false
}
this.adapter.on('resize.waypoints', function() {
if (!self.didResize) {
self.didResize = true
Waypoint.requestAnimationFrame(resizeHandler)
}
})
}
/* Private */
Context.prototype.createThrottledScrollHandler = function() {
var self = this
function scrollHandler() {
self.handleScroll()
self.didScroll = false
}
this.adapter.on('scroll.waypoints', function() {
if (!self.didScroll || Waypoint.isTouch) {
self.didScroll = true
Waypoint.requestAnimationFrame(scrollHandler)
}
})
}
/* Private */
Context.prototype.handleResize = function() {
Waypoint.Context.refreshAll()
}
/* Private */
Context.prototype.handleScroll = function() {
var triggeredGroups = {}
var axes = {
horizontal: {
newScroll: this.adapter.scrollLeft(),
oldScroll: this.oldScroll.x,
forward: 'right',
backward: 'left'
},
vertical: {
newScroll: this.adapter.scrollTop(),
oldScroll: this.oldScroll.y,
forward: 'down',
backward: 'up'
}
}
for (var axisKey in axes) {
var axis = axes[axisKey]
var isForward = axis.newScroll > axis.oldScroll
var direction = isForward ? axis.forward : axis.backward
for (var waypointKey in this.waypoints[axisKey]) {
var waypoint = this.waypoints[axisKey][waypointKey]
if (waypoint.triggerPoint === null) {
continue
}
var wasBeforeTriggerPoint = axis.oldScroll < waypoint.triggerPoint
var nowAfterTriggerPoint = axis.newScroll >= waypoint.triggerPoint
var crossedForward = wasBeforeTriggerPoint && nowAfterTriggerPoint
var crossedBackward = !wasBeforeTriggerPoint && !nowAfterTriggerPoint
if (crossedForward || crossedBackward) {
waypoint.queueTrigger(direction)
triggeredGroups[waypoint.group.id] = waypoint.group
}
}
}
for (var groupKey in triggeredGroups) {
triggeredGroups[groupKey].flushTriggers()
}
this.oldScroll = {
x: axes.horizontal.newScroll,
y: axes.vertical.newScroll
}
}
/* Private */
Context.prototype.innerHeight = function() {
/*eslint-disable eqeqeq */
if (this.element == this.element.window) {
return Waypoint.viewportHeight()
}
/*eslint-enable eqeqeq */
return this.adapter.innerHeight()
}
/* Private */
Context.prototype.remove = function(waypoint) {
delete this.waypoints[waypoint.axis][waypoint.key]
this.checkEmpty()
}
/* Private */
Context.prototype.innerWidth = function() {
/*eslint-disable eqeqeq */
if (this.element == this.element.window) {
return Waypoint.viewportWidth()
}
/*eslint-enable eqeqeq */
return this.adapter.innerWidth()
}
/* Public */
/* http://imakewebthings.com/waypoints/api/context-destroy */
Context.prototype.destroy = function() {
var allWaypoints = []
for (var axis in this.waypoints) {
for (var waypointKey in this.waypoints[axis]) {
allWaypoints.push(this.waypoints[axis][waypointKey])
}
}
for (var i = 0, end = allWaypoints.length; i < end; i++) {
allWaypoints[i].destroy()
}
}
/* Public */
/* http://imakewebthings.com/waypoints/api/context-refresh */
Context.prototype.refresh = function() {
/*eslint-disable eqeqeq */
var isWindow = this.element == this.element.window
/*eslint-enable eqeqeq */
var contextOffset = isWindow ? undefined : this.adapter.offset()
var triggeredGroups = {}
var axes
this.handleScroll()
axes = {
horizontal: {
contextOffset: isWindow ? 0 : contextOffset.left,
contextScroll: isWindow ? 0 : this.oldScroll.x,
contextDimension: this.innerWidth(),
oldScroll: this.oldScroll.x,
forward: 'right',
backward: 'left',
offsetProp: 'left'
},
vertical: {
contextOffset: isWindow ? 0 : contextOffset.top,
contextScroll: isWindow ? 0 : this.oldScroll.y,
contextDimension: this.innerHeight(),
oldScroll: this.oldScroll.y,
forward: 'down',
backward: 'up',
offsetProp: 'top'
}
}
for (var axisKey in axes) {
var axis = axes[axisKey]
for (var waypointKey in this.waypoints[axisKey]) {
var waypoint = this.waypoints[axisKey][waypointKey]
var adjustment = waypoint.options.offset
var oldTriggerPoint = waypoint.triggerPoint
var elementOffset = 0
var freshWaypoint = oldTriggerPoint == null
var contextModifier, wasBeforeScroll, nowAfterScroll
var triggeredBackward, triggeredForward
if (waypoint.element !== waypoint.element.window) {
elementOffset = waypoint.adapter.offset()[axis.offsetProp]
}
if (typeof adjustment === 'function') {
adjustment = adjustment.apply(waypoint)
}
else if (typeof adjustment === 'string') {
adjustment = parseFloat(adjustment)
if (waypoint.options.offset.indexOf('%') > - 1) {
adjustment = Math.ceil(axis.contextDimension * adjustment / 100)
}
}
contextModifier = axis.contextScroll - axis.contextOffset
waypoint.triggerPoint = Math.floor(elementOffset + contextModifier - adjustment)
wasBeforeScroll = oldTriggerPoint < axis.oldScroll
nowAfterScroll = waypoint.triggerPoint >= axis.oldScroll
triggeredBackward = wasBeforeScroll && nowAfterScroll
triggeredForward = !wasBeforeScroll && !nowAfterScroll
if (!freshWaypoint && triggeredBackward) {
waypoint.queueTrigger(axis.backward)
triggeredGroups[waypoint.group.id] = waypoint.group
}
else if (!freshWaypoint && triggeredForward) {
waypoint.queueTrigger(axis.forward)
triggeredGroups[waypoint.group.id] = waypoint.group
}
else if (freshWaypoint && axis.oldScroll >= waypoint.triggerPoint) {
waypoint.queueTrigger(axis.forward)
triggeredGroups[waypoint.group.id] = waypoint.group
}
}
}
Waypoint.requestAnimationFrame(function() {
for (var groupKey in triggeredGroups) {
triggeredGroups[groupKey].flushTriggers()
}
})
return this
}
/* Private */
Context.findOrCreateByElement = function(element) {
return Context.findByElement(element) || new Context(element)
}
/* Private */
Context.refreshAll = function() {
for (var contextId in contexts) {
contexts[contextId].refresh()
}
}
/* Public */
/* http://imakewebthings.com/waypoints/api/context-find-by-element */
Context.findByElement = function(element) {
return contexts[element.waypointContextKey]
}
window.onload = function() {
if (oldWindowLoad) {
oldWindowLoad()
}
Context.refreshAll()
}
Waypoint.requestAnimationFrame = function(callback) {
var requestFn = window.requestAnimationFrame ||
window.mozRequestAnimationFrame ||
window.webkitRequestAnimationFrame ||
requestAnimationFrameShim
requestFn.call(window, callback)
}
Waypoint.Context = Context
}())
================================================
FILE: src/debug.js
================================================
(function() {
'use strict'
var displayNoneMessage = [
'You have a Waypoint element with display none. For more information on ',
'why this is a bad idea read ',
'http://imakewebthings.com/waypoints/guides/debugging/#display-none'
].join('')
var fixedMessage = [
'You have a Waypoint element with fixed positioning. For more ',
'information on why this is a bad idea read ',
'http://imakewebthings.com/waypoints/guides/debugging/#fixed-position'
].join('')
function checkWaypointStyles() {
var originalRefresh = window.Waypoint.Context.prototype.refresh
window.Waypoint.Context.prototype.refresh = function() {
for (var axis in this.waypoints) {
for (var key in this.waypoints[axis]) {
var waypoint = this.waypoints[axis][key]
var style = window.getComputedStyle(waypoint.element)
if (!waypoint.enabled) {
continue
}
if (style && style.display === 'none') {
console.error(displayNoneMessage)
}
if (style && style.position === 'fixed') {
console.error(fixedMessage)
}
}
}
return originalRefresh.call(this)
}
}
checkWaypointStyles()
}())
================================================
FILE: src/group.js
================================================
(function() {
'use strict'
function byTriggerPoint(a, b) {
return a.triggerPoint - b.triggerPoint
}
function byReverseTriggerPoint(a, b) {
return b.triggerPoint - a.triggerPoint
}
var groups = {
vertical: {},
horizontal: {}
}
var Waypoint = window.Waypoint
/* http://imakewebthings.com/waypoints/api/group */
function Group(options) {
this.name = options.name
this.axis = options.axis
this.id = this.name + '-' + this.axis
this.waypoints = []
this.clearTriggerQueues()
groups[this.axis][this.name] = this
}
/* Private */
Group.prototype.add = function(waypoint) {
this.waypoints.push(waypoint)
}
/* Private */
Group.prototype.clearTriggerQueues = function() {
this.triggerQueues = {
up: [],
down: [],
left: [],
right: []
}
}
/* Private */
Group.prototype.flushTriggers = function() {
for (var direction in this.triggerQueues) {
var waypoints = this.triggerQueues[direction]
var reverse = direction === 'up' || direction === 'left'
waypoints.sort(reverse ? byReverseTriggerPoint : byTriggerPoint)
for (var i = 0, end = waypoints.length; i < end; i += 1) {
var waypoint = waypoints[i]
if (waypoint.options.continuous || i === waypoints.length - 1) {
waypoint.trigger([direction])
}
}
}
this.clearTriggerQueues()
}
/* Private */
Group.prototype.next = function(waypoint) {
this.waypoints.sort(byTriggerPoint)
var index = Waypoint.Adapter.inArray(waypoint, this.waypoints)
var isLast = index === this.waypoints.length - 1
return isLast ? null : this.waypoints[index + 1]
}
/* Private */
Group.prototype.previous = function(waypoint) {
this.waypoints.sort(byTriggerPoint)
var index = Waypoint.Adapter.inArray(waypoint, this.waypoints)
return index ? this.waypoints[index - 1] : null
}
/* Private */
Group.prototype.queueTrigger = function(waypoint, direction) {
this.triggerQueues[direction].push(waypoint)
}
/* Private */
Group.prototype.remove = function(waypoint) {
var index = Waypoint.Adapter.inArray(waypoint, this.waypoints)
if (index > -1) {
this.waypoints.splice(index, 1)
}
}
/* Public */
/* http://imakewebthings.com/waypoints/api/first */
Group.prototype.first = function() {
return this.waypoints[0]
}
/* Public */
/* http://imakewebthings.com/waypoints/api/last */
Group.prototype.last = function() {
return this.waypoints[this.waypoints.length - 1]
}
/* Private */
Group.findOrCreate = function(options) {
return groups[options.axis][options.name] || new Group(options)
}
Waypoint.Group = Group
}())
================================================
FILE: src/shortcuts/infinite.js
================================================
(function() {
'use strict'
var $ = window.jQuery
var Waypoint = window.Waypoint
/* http://imakewebthings.com/waypoints/shortcuts/infinite-scroll */
function Infinite(options) {
this.options = $.extend({}, Infinite.defaults, options)
this.container = this.options.element
if (this.options.container !== 'auto') {
this.container = this.options.container
}
this.$container = $(this.container)
this.$more = $(this.options.more)
if (this.$more.length) {
this.setupHandler()
this.waypoint = new Waypoint(this.options)
}
}
/* Private */
Infinite.prototype.setupHandler = function() {
this.options.handler = $.proxy(function() {
this.options.onBeforePageLoad()
this.destroy()
this.$container.addClass(this.options.loadingClass)
$.get($(this.options.more).attr('href'), $.proxy(function(data) {
var $data = $($.parseHTML(data))
var $newMore = $data.find(this.options.more)
var $items = $data.find(this.options.items)
if (!$items.length) {
$items = $data.filter(this.options.items)
}
this.$container.append($items)
this.$container.removeClass(this.options.loadingClass)
if (!$newMore.length) {
$newMore = $data.filter(this.options.more)
}
if ($newMore.length) {
this.$more.replaceWith($newMore)
this.$more = $newMore
this.waypoint = new Waypoint(this.options)
}
else {
this.$more.remove()
}
this.options.onAfterPageLoad($items)
}, this))
}, this)
}
/* Public */
Infinite.prototype.destroy = function() {
if (this.waypoint) {
this.waypoint.destroy()
}
}
Infinite.defaults = {
container: 'auto',
items: '.infinite-item',
more: '.infinite-more-link',
offset: 'bottom-in-view',
loadingClass: 'infinite-loading',
onBeforePageLoad: $.noop,
onAfterPageLoad: $.noop
}
Waypoint.Infinite = Infinite
}())
================================================
FILE: src/shortcuts/inview.js
================================================
(function() {
'use strict'
function noop() {}
var Waypoint = window.Waypoint
/* http://imakewebthings.com/waypoints/shortcuts/inview */
function Inview(options) {
this.options = Waypoint.Adapter.extend({}, Inview.defaults, options)
this.axis = this.options.horizontal ? 'horizontal' : 'vertical'
this.waypoints = []
this.element = this.options.element
this.createWaypoints()
}
/* Private */
Inview.prototype.createWaypoints = function() {
var configs = {
vertical: [{
down: 'enter',
up: 'exited',
offset: '100%'
}, {
down: 'entered',
up: 'exit',
offset: 'bottom-in-view'
}, {
down: 'exit',
up: 'entered',
offset: 0
}, {
down: 'exited',
up: 'enter',
offset: function() {
return -this.adapter.outerHeight()
}
}],
horizontal: [{
right: 'enter',
left: 'exited',
offset: '100%'
}, {
right: 'entered',
left: 'exit',
offset: 'right-in-view'
}, {
right: 'exit',
left: 'entered',
offset: 0
}, {
right: 'exited',
left: 'enter',
offset: function() {
return -this.adapter.outerWidth()
}
}]
}
for (var i = 0, end = configs[this.axis].length; i < end; i++) {
var config = configs[this.axis][i]
this.createWaypoint(config)
}
}
/* Private */
Inview.prototype.createWaypoint = function(config) {
var self = this
this.waypoints.push(new Waypoint({
context: this.options.context,
element: this.options.element,
enabled: this.options.enabled,
handler: (function(config) {
return function(direction) {
self.options[config[direction]].call(self, direction)
}
}(config)),
offset: config.offset,
horizontal: this.options.horizontal
}))
}
/* Public */
Inview.prototype.destroy = function() {
for (var i = 0, end = this.waypoints.length; i < end; i++) {
this.waypoints[i].destroy()
}
this.waypoints = []
}
Inview.prototype.disable = function() {
for (var i = 0, end = this.waypoints.length; i < end; i++) {
this.waypoints[i].disable()
}
}
Inview.prototype.enable = function() {
for (var i = 0, end = this.waypoints.length; i < end; i++) {
this.waypoints[i].enable()
}
}
Inview.defaults = {
context: window,
enabled: true,
enter: noop,
entered: noop,
exit: noop,
exited: noop
}
Waypoint.Inview = Inview
}())
================================================
FILE: src/shortcuts/sticky.js
================================================
(function() {
'use strict'
var $ = window.jQuery
var Waypoint = window.Waypoint
/* http://imakewebthings.com/waypoints/shortcuts/sticky-elements */
function Sticky(options) {
this.options = $.extend({}, Waypoint.defaults, Sticky.defaults, options)
this.element = this.options.element
this.$element = $(this.element)
this.createWrapper()
this.createWaypoint()
}
/* Private */
Sticky.prototype.createWaypoint = function() {
var originalHandler = this.options.handler
this.waypoint = new Waypoint($.extend({}, this.options, {
element: this.wrapper,
handler: $.proxy(function(direction) {
var shouldBeStuck = this.options.direction.indexOf(direction) > -1
var wrapperHeight = shouldBeStuck ? this.$element.outerHeight(true) : ''
this.$wrapper.height(wrapperHeight)
this.$element.toggleClass(this.options.stuckClass, shouldBeStuck)
if (originalHandler) {
originalHandler.call(this, direction)
}
}, this)
}))
}
/* Private */
Sticky.prototype.createWrapper = function() {
if (this.options.wrapper) {
this.$element.wrap(this.options.wrapper)
}
this.$wrapper = this.$element.parent()
this.wrapper = this.$wrapper[0]
}
/* Public */
Sticky.prototype.destroy = function() {
if (this.$element.parent()[0] === this.wrapper) {
this.waypoint.destroy()
this.$element.removeClass(this.options.stuckClass)
if (this.options.wrapper) {
this.$element.unwrap()
}
}
}
Sticky.defaults = {
wrapper: '<div class="sticky-wrapper" />',
stuckClass: 'stuck',
direction: 'down right'
}
Waypoint.Sticky = Sticky
}())
================================================
FILE: src/waypoint.js
================================================
(function() {
'use strict'
var keyCounter = 0
var allWaypoints = {}
/* http://imakewebthings.com/waypoints/api/waypoint */
function Waypoint(options) {
if (!options) {
throw new Error('No options passed to Waypoint constructor')
}
if (!options.element) {
throw new Error('No element option passed to Waypoint constructor')
}
if (!options.handler) {
throw new Error('No handler option passed to Waypoint constructor')
}
this.key = 'waypoint-' + keyCounter
this.options = Waypoint.Adapter.extend({}, Waypoint.defaults, options)
this.element = this.options.element
this.adapter = new Waypoint.Adapter(this.element)
this.callback = options.handler
this.axis = this.options.horizontal ? 'horizontal' : 'vertical'
this.enabled = this.options.enabled
this.triggerPoint = null
this.group = Waypoint.Group.findOrCreate({
name: this.options.group,
axis: this.axis
})
this.context = Waypoint.Context.findOrCreateByElement(this.options.context)
if (Waypoint.offsetAliases[this.options.offset]) {
this.options.offset = Waypoint.offsetAliases[this.options.offset]
}
this.group.add(this)
this.context.add(this)
allWaypoints[this.key] = this
keyCounter += 1
}
/* Private */
Waypoint.prototype.queueTrigger = function(direction) {
this.group.queueTrigger(this, direction)
}
/* Private */
Waypoint.prototype.trigger = function(args) {
if (!this.enabled) {
return
}
if (this.callback) {
this.callback.apply(this, args)
}
}
/* Public */
/* http://imakewebthings.com/waypoints/api/destroy */
Waypoint.prototype.destroy = function() {
this.context.remove(this)
this.group.remove(this)
delete allWaypoints[this.key]
}
/* Public */
/* http://imakewebthings.com/waypoints/api/disable */
Waypoint.prototype.disable = function() {
this.enabled = false
return this
}
/* Public */
/* http://imakewebthings.com/waypoints/api/enable */
Waypoint.prototype.enable = function() {
this.context.refresh()
this.enabled = true
return this
}
/* Public */
/* http://imakewebthings.com/waypoints/api/next */
Waypoint.prototype.next = function() {
return this.group.next(this)
}
/* Public */
/* http://imakewebthings.com/waypoints/api/previous */
Waypoint.prototype.previous = function() {
return this.group.previous(this)
}
/* Private */
Waypoint.invokeAll = function(method) {
var allWaypointsArray = []
for (var waypointKey in allWaypoints) {
allWaypointsArray.push(allWaypoints[waypointKey])
}
for (var i = 0, end = allWaypointsArray.length; i < end; i++) {
allWaypointsArray[i][method]()
}
}
/* Public */
/* http://imakewebthings.com/waypoints/api/destroy-all */
Waypoint.destroyAll = function() {
Waypoint.invokeAll('destroy')
}
/* Public */
/* http://imakewebthings.com/waypoints/api/disable-all */
Waypoint.disableAll = function() {
Waypoint.invokeAll('disable')
}
/* Public */
/* http://imakewebthings.com/waypoints/api/enable-all */
Waypoint.enableAll = function() {
Waypoint.Context.refreshAll()
for (var waypointKey in allWaypoints) {
allWaypoints[waypointKey].enabled = true
}
return this
}
/* Public */
/* http://imakewebthings.com/waypoints/api/refresh-all */
Waypoint.refreshAll = function() {
Waypoint.Context.refreshAll()
}
/* Public */
/* http://imakewebthings.com/waypoints/api/viewport-height */
Waypoint.viewportHeight = function() {
return window.innerHeight || document.documentElement.clientHeight
}
/* Public */
/* http://imakewebthings.com/waypoints/api/viewport-width */
Waypoint.viewportWidth = function() {
return document.documentElement.clientWidth
}
Waypoint.adapters = []
Waypoint.defaults = {
context: window,
continuous: true,
enabled: true,
group: 'default',
horizontal: false,
offset: 0
}
Waypoint.offsetAliases = {
'bottom-in-view': function() {
return this.context.innerHeight() - this.adapter.outerHeight()
},
'right-in-view': function() {
return this.context.innerWidth() - this.adapter.outerWidth()
}
}
window.Waypoint = Waypoint
}())
================================================
FILE: test/adapter-fn-spec.js
================================================
'use strict'
/* global
* describe, it, beforeEach, afterEach, expect, spyOn, waits, runs,
* waitsFor, loadFixtures, Waypoint
*/
window.jQuery.each(window.jQuery.grep(Waypoint.adapters, function(adapter) {
return 'jquery zepto'.indexOf(adapter.name) > -1
}), function(i, adapter) {
describe('$.fn extension for ' + adapter.name + ':', function() {
var $, waypoints
beforeEach(function() {
$ = adapter.name === 'jquery' ? window.jQuery : window.Zepto
Waypoint.Adapter = adapter.Adapter
loadFixtures('standard.html')
})
afterEach(function() {
$.each(waypoints, function(i, waypoint) {
waypoint.destroy()
})
})
describe('waypoint initialization', function() {
it('uses the subject elements as the element option', function() {
waypoints = $('.nearsame').waypoint(function() {})
expect(waypoints[0].element.id).toEqual('near1')
expect(waypoints[1].element.id).toEqual('near2')
})
it('returns an array of Waypoint instances', function() {
waypoints = $('.nearsame').waypoint(function() {})
expect($.isArray(waypoints)).toBeTruthy()
expect(waypoints.length).toEqual(2)
})
it('can take the handler as the first parameter', function() {
function handler() {}
waypoints = $('#near1').waypoint(handler)
expect(waypoints[0].callback).toBe(handler)
})
})
describe('context option', function() {
it('can be given a string selector', function() {
waypoints = $('#inner3').waypoint({
context: '#bottom',
handler: function() {}
})
expect(waypoints[0].context.element).toBe($('#bottom')[0])
})
})
})
})
================================================
FILE: test/context-spec.js
================================================
'use strict'
/* global
* describe, it, beforeEach, afterEach, expect, spyOn, runs,
* loadFixtures, Waypoint
*/
window.jQuery.each(Waypoint.adapters, function(i, adapter) {
describe(adapter.name + ' adapter:', function() {
describe('Waypoint.Context', function() {
var $ = window.jQuery
var currentDirection, $scroller, waypoint, $target, context, skipDestroy
function setDirection(direction) {
currentDirection = direction
}
beforeEach(function() {
Waypoint.Adapter = adapter.Adapter
loadFixtures('standard.html')
$scroller = $(window)
currentDirection = null
skipDestroy = false
$target = $('#same1')
waypoint = new Waypoint({
element: $target[0],
handler: setDirection
})
context = waypoint.context
})
afterEach(function() {
if (!skipDestroy) {
waypoint.destroy()
}
$scroller.scrollTop(0).scrollLeft(0)
})
describe('#refresh', function() {
it('updates trigger point of waypoints', function() {
var top = $target.offset().top
$target.css({
top: top + 1
})
context.refresh()
expect(waypoint.triggerPoint).toEqual(top + 1)
})
it('triggers down direction if waypoint crosses upwards', function() {
$target.css('top', '-1px')
context.refresh()
expect(currentDirection).toEqual('down')
})
it('triggers up direction if waypoint crosses downwards', function() {
$target.css('top', '-1px')
context.refresh()
$target.css('top', '0px')
context.refresh()
expect(currentDirection).toEqual('up')
})
it('returns the same context instance for chaining', function() {
expect(context.refresh()).toEqual(context)
})
})
describe('#destroy', function() {
it('prevents further waypoint triggers', function() {
skipDestroy = true
context.destroy()
$scroller.scrollTop($target.offset().top)
expect(currentDirection).toBeNull()
})
})
describe('Waypoint.Context.refreshAll()', function() {
it('calls refresh on all contexts', function() {
var secondWaypoint = new Waypoint({
element: $('#inner3')[0],
context: $('#bottom')[0],
handler: function() {}
})
var secondContext = secondWaypoint.context
spyOn(context, 'refresh')
spyOn(secondContext, 'refresh')
Waypoint.Context.refreshAll()
expect(context.refresh).toHaveBeenCalled()
expect(secondContext.refresh).toHaveBeenCalled()
secondWaypoint.destroy()
})
})
})
})
})
================================================
FILE: test/debug-spec.js
================================================
'use strict'
/* global
* describe, it, beforeEach, afterEach, expect, spyOn,
* loadFixtures, Waypoint
*/
describe('Waypoints debug script', function() {
var waypoint, element
beforeEach(function() {
loadFixtures('standard.html')
})
afterEach(function() {
waypoint.destroy()
})
describe('display none detection', function() {
beforeEach(function() {
element = document.getElementById('same1')
waypoint = new Waypoint({
element: element,
handler: function() {}
})
element.style.display = 'none'
})
it('logs a console error', function() {
spyOn(console, 'error')
waypoint.context.refresh()
expect(console.error).toHaveBeenCalled()
})
})
describe('display fixed positioning detection', function() {
beforeEach(function() {
element = document.getElementById('same1')
waypoint = new Waypoint({
element: element,
handler: function() {}
})
element.style.position = 'fixed'
})
it('logs a console error', function() {
spyOn(console, 'error')
waypoint.context.refresh()
expect(console.error).toHaveBeenCalled()
})
})
describe('fixed position detection', function() {
})
describe('respect waypoint disabling', function() {
beforeEach(function() {
element = document.getElementById('same1')
waypoint = new Waypoint({
element: element,
handler: function() {}
})
element.style.display = 'none'
waypoint.disable()
})
it('does not log a console error', function() {
spyOn(console, 'error')
waypoint.context.refresh()
expect(console.error.calls.length).toEqual(0)
})
})
})
================================================
FILE: test/fixtures/infinite.html
================================================
<div class="wp-container">
<div class="infinite-container">
<div class="infinite-item"></div>
<div class="infinite-item"></div>
<div class="infinite-item"></div>
<div class="infinite-item"></div>
<div class="infinite-item"></div>
</div>
<a href="test/fixtures/infinite.html" class="infinite-more-link">More</a>
</div>
<style type="text/css">
.wp-container {
position:absolute;
top:0;
right:0;
left:0;
bottom:0;
}
.waypoints-infinite-item {
height:500px;
}
</style>
================================================
FILE: test/fixtures/standard.html
================================================
<div id="wp-container">
<div id="pretop"></div>
<div id="top"></div>
<div class="sameposition" id="same1"></div>
<div class="sameposition" id="same2"></div>
<div class="nearsame" id="near1"></div>
<div class="nearsame" id="near2"></div>
<div id="bottom">
<div id="inner1" class="inner"></div>
<div id="inner2" class="inner"></div>
<div id="inner3" class="inner"></div>
<div id="inner4" class="inner"></div>
</div>
<div id="postbottom"></div>
</div>
<style type="text/css">
body {
height:3000px;
margin:0;
padding:0;
}
#wp-container {
position:absolute;
top:0;
height:3000px;
width:9000px;
}
#wp-container div {
position:absolute;
height:50px;
width:50px;
background:red;
}
#pretop {
top:-100px;
left:-100px
}
#top {
top:0;
left:0;
}
.sameposition {
top:1000px;
left:1000px
}
#near1 {
top:1999px;
left:1999px
}
#near2 {
top:2000px;
left:2000px
}
#bottom {
top:2950px;
left:2950px;
overflow:hidden;
}
#wp-container .inner {
position:static;
width:100%;
height:100px;
background:blue;
}
#postbottom {
top:3100px;
left:3100px;
}
</style>
================================================
FILE: test/fixtures/sticky.html
================================================
<div class="wp-container">
<div class="before"></div>
<div class="sticky"></div>
</div>
<style type="text/css">
.wp-container {
height:3000px;
}
.before {
height:300px;
}
.sticky {
height:50px;
}
</style>
================================================
FILE: test/group-spec.js
================================================
'use strict'
/* global
* describe, it, beforeEach, afterEach, expect, spyOn,
* loadFixtures, Waypoint
*/
window.jQuery.each(Waypoint.adapters, function(i, adapter) {
describe(adapter.name + ' adapter:', function() {
describe('Waypoint.Group', function() {
var $ = window.jQuery
var firstWaypoint, secondWaypoint, customGroupWaypoint, defaultGroup
beforeEach(function() {
Waypoint.Adapter = adapter.Adapter
loadFixtures('standard.html')
firstWaypoint = new Waypoint({
element: $('#same1')[0],
handler: function() {}
})
secondWaypoint = new Waypoint({
element: $('#near1')[0],
handler: function() {}
})
customGroupWaypoint = new Waypoint({
element: $('#same2')[0],
group: 'custom',
handler: function() {}
})
defaultGroup = firstWaypoint.group
})
afterEach(function() {
firstWaypoint.destroy()
secondWaypoint.destroy()
customGroupWaypoint.destroy()
})
describe('#previous(waypoint)', function() {
it('returns previous waypoint based on trigger point', function() {
expect(defaultGroup.previous(secondWaypoint)).toEqual(firstWaypoint)
})
it('returns null if on the first waypoint in the group', function() {
expect(defaultGroup.previous(firstWaypoint)).toBeNull()
})
})
describe('#next(waypoint)', function() {
it('returns next waypoint based on trigger point', function() {
expect(defaultGroup.next(firstWaypoint)).toEqual(secondWaypoint)
})
it('returns null if on the last waypoint in the group', function() {
expect(defaultGroup.next(secondWaypoint)).toBeNull()
})
})
describe('#first()', function() {
it('returns the first waypoint based on trigger point', function() {
expect(defaultGroup.first()).toEqual(firstWaypoint)
})
})
describe('#last()', function() {
it('returns the first waypoint based on trigger point', function() {
expect(defaultGroup.last()).toEqual(secondWaypoint)
})
})
})
})
})
================================================
FILE: test/infinite-spec.js
================================================
'use strict'
/* global
* describe, it, beforeEach, afterEach, expect, spyOn, runs,
* waitsFor, loadFixtures, Waypoint, jasmine
*/
describe('Waypoint Sticky Shortcut', function() {
var $ = window.jQuery
var $scroller = $(window)
var $container, $items, $more, waypoint, beforeSpy, afterSpy
beforeEach(function() {
loadFixtures('infinite.html')
$items = $('.infinite-item')
$container = $('.infinite-container')
$more = $('.infinite-more-link')
beforeSpy = jasmine.createSpy('on before callback')
afterSpy = jasmine.createSpy('on after callback')
})
afterEach(function() {
waypoint.destroy()
$scroller.scrollTop(0)
})
it('returns an instance of the Waypoint.Infinite class', function() {
waypoint = new Waypoint.Infinite({
element: $container[0]
})
expect(waypoint instanceof Waypoint.Infinite).toBeTruthy()
})
describe('loading new pages', function() {
beforeEach(function() {
runs(function() {
waypoint = new Waypoint.Infinite({
element: $container[0],
onBeforePageLoad: beforeSpy,
onAfterPageLoad: afterSpy
})
$scroller.scrollTop(Waypoint.viewportHeight() - $container.height())
})
waitsFor(function() {
return $('.infinite-container > .infinite-item').length > $items.length
}, 'new items to load')
})
it('replaces the more link with the new more link', function() {
expect($more[0]).not.toEqual($('.infinite-more-link')[0])
})
it('fires the before callback', function() {
expect(beforeSpy.callCount).toBeTruthy()
})
it('fires the after callback', function() {
expect(afterSpy.callCount).toBeTruthy()
expect(afterSpy).toHaveBeenCalledWith(jasmine.any(Object))
})
})
describe('when there is no more link on initialization', function() {
beforeEach(function() {
$more.remove()
waypoint = new Waypoint.Infinite({
element: $container[0]
})
})
it('does not create the waypoint', function() {
expect(waypoint.waypoint).toBeFalsy()
})
})
})
================================================
FILE: test/inview-spec.js
================================================
'use strict'
/* global
* describe, it, beforeEach, afterEach, expect, spyOn, waits, runs,
* waitsFor, loadFixtures, Waypoint
*/
window.jQuery.each(Waypoint.adapters, function(i, adapter) {
describe(adapter.name + ' adapter:', function() {
describe('Waypoints Inview Shortcut', function() {
var $ = window.jQuery
var standard = 50
var $scroller = $(window)
var $target, waypoint, hits, callbackContext
function setsTrue(key) {
return function() {
callbackContext = this
hits[key] = true
}
}
function toBeTrue(key) {
return function() {
return hits[key]
}
}
beforeEach(function() {
Waypoint.Adapter = adapter.Adapter
loadFixtures('standard.html')
$target = $('#near2')
hits = {}
})
afterEach(function() {
waypoint.destroy()
$scroller.scrollTop(0).scrollLeft(0)
})
describe('vertical', function() {
beforeEach(function() {
waypoint = new Waypoint.Inview({
element: $target[0],
enter: setsTrue('enter'),
entered: setsTrue('entered'),
exit: setsTrue('exit'),
exited: setsTrue('exited')
})
})
describe('enter callback', function() {
it('triggers when element starts entering from below', function() {
runs(function() {
var top = $target.offset().top
$scroller.scrollTop(top - Waypoint.viewportHeight())
})
waitsFor(toBeTrue('enter'), 'enter to trigger')
runs(function() {
expect(callbackContext).toEqual(waypoint)
})
})
it('triggers when element starts entering from above', function() {
runs(function() {
$scroller.scrollTop($target.offset().top + $target.outerHeight())
})
waits(standard)
runs(function() {
hits.enter = false
$scroller.scrollTop($scroller.scrollTop() - 1)
})
waitsFor(toBeTrue('enter'), 'enter to trigger')
})
})
describe('entered callback', function() {
it('triggers when element finishes entering from below', function() {
runs(function() {
var top = $target.offset().top
var viewportHeight = Waypoint.viewportHeight()
var elementHeight = $target.outerHeight()
$scroller.scrollTop(top - viewportHeight + elementHeight)
})
waitsFor(toBeTrue('entered'), 'entered to trigger')
runs(function() {
expect(callbackContext).toEqual(waypoint)
})
})
it('triggers when element finishes entering from above', function() {
runs(function() {
$scroller.scrollTop($target.offset().top)
})
waits(standard)
runs(function() {
hits.entered = false
$scroller.scrollTop($scroller.scrollTop() - 1)
})
waitsFor(toBeTrue('entered'), 'entered to trigger')
})
})
describe('exit callback', function() {
it('triggers when element starts leaving below', function() {
runs(function() {
var top = $target.offset().top
var viewportHeight = Waypoint.viewportHeight()
var elementHeight = $target.outerHeight()
$scroller.scrollTop(top - viewportHeight + elementHeight)
})
waits(standard)
runs(function() {
expect(hits.exit).toBeFalsy()
$scroller.scrollTop($scroller.scrollTop() - 1)
})
waitsFor(toBeTrue('exit'), 'exit to trigger')
})
it('triggers when element starts leaving above', function() {
runs(function() {
$scroller.scrollTop($target.offset().top)
})
waitsFor(toBeTrue('exit'), 'exit to trigger')
runs(function() {
expect(callbackContext).toEqual(waypoint)
})
})
})
describe('exited callback', function() {
it('triggers when element finishes exiting below', function() {
runs(function() {
var top = $target.offset().top
$scroller.scrollTop(top - Waypoint.viewportHeight())
})
waits(standard)
runs(function() {
$scroller.scrollTop($scroller.scrollTop() - 1)
})
waitsFor(toBeTrue('exited'), 'exited to trigger')
})
it('triggers when element finishes exiting above', function() {
runs(function() {
$scroller.scrollTop($target.offset().top + $target.outerHeight())
})
waitsFor(toBeTrue('exited'), 'exited to trigger')
runs(function() {
expect(callbackContext).toEqual(waypoint)
})
})
})
})
describe('horizontal', function() {
beforeEach(function() {
waypoint = new Waypoint.Inview({
horizontal: true,
element: $target[0],
enter: setsTrue('enter'),
entered: setsTrue('entered'),
exit: setsTrue('exit'),
exited: setsTrue('exited')
})
})
describe('enter callback', function() {
it('triggers when element starts entering from right', function() {
runs(function() {
$scroller.scrollLeft($target.offset().left - $scroller.width())
})
waitsFor(toBeTrue('enter'), 'enter to trigger')
})
it('triggers when element starts entering from left', function() {
runs(function() {
var left = $target.offset().left
$scroller.scrollLeft(left + $target.outerWidth())
})
waits(standard)
runs(function() {
hits.enter = false
$scroller.scrollLeft($scroller.scrollLeft() - 1)
})
waitsFor(toBeTrue('enter'), 'enter to trigger')
})
})
describe('entered callback', function() {
it('triggers when element finishes entering from right', function() {
runs(function() {
var left = $target.offset().left
var viewportWidth = $scroller.width()
var elementWidth = $target.outerWidth()
$scroller.scrollLeft(left - viewportWidth + elementWidth)
})
waitsFor(toBeTrue('entered'), 'entered to trigger')
})
it('triggers when element finishes entering from left', function() {
runs(function() {
$scroller.scrollLeft($target.offset().left)
})
waits(standard)
runs(function() {
hits.entered = false
$scroller.scrollLeft($scroller.scrollLeft() - 1)
})
waitsFor(toBeTrue('entered'), 'entered to trigger')
})
})
describe('exit callback', function() {
it('triggers when element starts leaving on the right', function() {
runs(function() {
var left = $target.offset().left
var viewportWidth = $scroller.width()
var elementWidth = $target.outerWidth()
$scroller.scrollLeft(left - viewportWidth + elementWidth)
})
waits(standard)
runs(function() {
expect(hits.exit).toBeFalsy()
$scroller.scrollLeft($scroller.scrollLeft() - 1)
})
waitsFor(toBeTrue('exit'), 'exit to trigger')
})
it('triggers when element starts leaving on the left', function() {
runs(function() {
$scroller.scrollLeft($target.offset().left)
})
waitsFor(toBeTrue('exit'), 'exit to trigger')
})
})
describe('exited callback', function() {
it('triggers when element finishes exiting to the right', function() {
runs(function() {
var left = $target.offset().left
$scroller.scrollLeft(left - $scroller.width())
})
waitsFor(toBeTrue('enter'), 'enter to trigger')
runs(function() {
$scroller.scrollLeft($scroller.scrollLeft() - 1)
})
waitsFor(toBeTrue('exited'), 'exited to trigger')
})
it('triggers when element finishes exiting to the left', function() {
runs(function() {
var left = $target.offset().left
$scroller.scrollLeft(left + $target.outerWidth())
})
waitsFor(toBeTrue('exited'), 'exited to trigger')
})
})
})
describe('disabled', function() {
beforeEach(function() {
waypoint = new Waypoint.Inview({
element: $target[0],
enabled: false,
enter: setsTrue('enter'),
entered: setsTrue('entered'),
exit: setsTrue('exit'),
exited: setsTrue('exited')
})
})
it('starts disabled', function() {
$.each(waypoint.waypoints, function(i, wp) {
expect(wp.enabled).toEqual(false)
})
})
describe('#enable', function() {
it('enables all waypoints', function() {
waypoint.enable()
$.each(waypoint.waypoints, function(i, wp) {
expect(wp.enabled).toEqual(true)
})
})
})
describe('#disable', function() {
it('disables all waypoints', function() {
waypoint.enable()
waypoint.disable()
$.each(waypoint.waypoints, function(i, wp) {
expect(wp.enabled).toEqual(false)
})
})
})
})
})
})
})
================================================
FILE: test/lib/coffee-script.js
================================================
/**
* CoffeeScript Compiler v1.3.3
* http://coffeescript.org
*
* Copyright 2011, Jeremy Ashkenas
* Released under the MIT License
*/
(function(root){var CoffeeScript=function(){function require(a){return require[a]}require["./helpers"]=new function(){var a=this;(function(){var b,c;a.starts=function(a,b,c){return b===a.substr(c,b.length)},a.ends=function(a,b,c){var d;d=b.length;return b===a.substr(a.length-d-(c||0),d)},a.compact=function(a){var b,c,d,e;e=[];for(c=0,d=a.length;c<d;c++)b=a[c],b&&e.push(b);return e},a.count=function(a,b){var c,d;c=d=0;if(!b.length)return 1/0;while(d=1+a.indexOf(b,d))c++;return c},a.merge=function(a,c){return b(b({},a),c)},b=a.extend=function(a,b){var c,d;for(c in b)d=b[c],a[c]=d;return a},a.flatten=c=function(a){var b,d,e,f;d=[];for(e=0,f=a.length;e<f;e++)b=a[e],b instanceof Array?d=d.concat(c(b)):d.push(b);return d},a.del=function(a,b){var c;c=a[b],delete a[b];return c},a.last=function(a,b){return a[a.length-(b||0)-1]}}).call(this)},require["./rewriter"]=new function(){var a=this;(function(){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t=[].indexOf||function(a){for(var b=0,c=this.length;b<c;b++)if(b in this&&this[b]===a)return b;return-1},u=[].slice;a.Rewriter=function(){function a(){}a.prototype.rewrite=function(a){this.tokens=a,this.removeLeadingNewlines(),this.removeMidExpressionNewlines(),this.closeOpenCalls(),this.closeOpenIndexes(),this.addImplicitIndentation(),this.tagPostfixConditionals(),this.addImplicitBraces(),this.addImplicitParentheses();return this.tokens},a.prototype.scanTokens=function(a){var b,c,d;d=this.tokens,b=0;while(c=d[b])b+=a.call(this,c,b,d);return!0},a.prototype.detectEnd=function(a,b,c){var f,g,h,i,j;h=this.tokens,f=0;while(g=h[a]){if(f===0&&b.call(this,g,a))return c.call(this,g,a);if(!g||f<0)return c.call(this,g,a-1);if(i=g[0],t.call(e,i)>=0)f+=1;else if(j=g[0],t.call(d,j)>=0)f-=1;a+=1}return a-1},a.prototype.removeLeadingNewlines=function(){var a,b,c,d,e;e=this.tokens;for(a=c=0,d=e.length;c<d;a=++c){b=e[a][0];if(b!=="TERMINATOR")break}if(a)return this.tokens.splice(0,a)},a.prototype.removeMidExpressionNewlines=function(){return this.scanTokens(function(a,b,d){var e;if(!(a[0]==="TERMINATOR"&&(e=this.tag(b+1),t.call(c,e)>=0)))return 1;d.splice(b,1);return 0})},a.prototype.closeOpenCalls=function(){var a,b;b=function(a,b){var c;return(c=a[0])===")"||c==="CALL_END"||a[0]==="OUTDENT"&&this.tag(b-1)===")"},a=function(a,b){return this.tokens[a[0]==="OUTDENT"?b-1:b][0]="CALL_END"};return this.scanTokens(function(c,d){c[0]==="CALL_START"&&this.detectEnd(d+1,b,a);return 1})},a.prototype.closeOpenIndexes=function(){var a,b;b=function(a,b){var c;return(c=a[0])==="]"||c==="INDEX_END"},a=function(a,b){return a[0]="INDEX_END"};return this.scanTokens(function(c,d){c[0]==="INDEX_START"&&this.detectEnd(d+1,b,a);return 1})},a.prototype.addImplicitBraces=function(){var a,b,c,f,g,i,j,k;f=[],g=null,k=null,c=!0,i=0,j=0,b=function(a,b){var d,e,f,g,i,m;i=this.tokens.slice(b+1,b+3+1||9e9),d=i[0],g=i[1],f=i[2];if("HERECOMMENT"===(d!=null?d[0]:void 0))return!1;e=a[0],t.call(l,e)>=0&&(c=!1);return(e==="TERMINATOR"||e==="OUTDENT"||t.call(h,e)>=0&&c&&b-j!==1)&&(!k&&this.tag(b-1)!==","||(g!=null?g[0]:void 0)!==":"&&((d!=null?d[0]:void 0)!=="@"||(f!=null?f[0]:void 0)!==":"))||e===","&&d&&(m=d[0])!=="IDENTIFIER"&&m!=="NUMBER"&&m!=="STRING"&&m!=="@"&&m!=="TERMINATOR"&&m!=="OUTDENT"},a=function(a,b){var c;c=this.generate("}","}",a[2]);return this.tokens.splice(b,0,c)};return this.scanTokens(function(h,i,m){var n,o,p,q,r,s,u,v;if(u=q=h[0],t.call(e,u)>=0){f.push([q==="INDENT"&&this.tag(i-1)==="{"?"{":q,i]);return 1}if(t.call(d,q)>=0){g=f.pop();return 1}if(q!==":"||(n=this.tag(i-2))!==":"&&((v=f[f.length-1])!=null?v[0]:void 0)==="{")return 1;c=!0,j=i+1,f.push(["{"]),o=n==="@"?i-2:i-1;while(this.tag(o-2)==="HERECOMMENT")o-=2;p=this.tag(o-1),k=!p||t.call(l,p)>=0,s=new String("{"),s.generated=!0,r=this.generate("{",s,h[2]),m.splice(o,0,r),this.detectEnd(i+2,b,a);return 2})},a.prototype.addImplicitParentheses=function(){var a,b,c,d,e;c=e=d=!1,b=function(a,b){var c,g,i,j;g=a[0];if(!e&&a.fromThen)return!0;if(g==="IF"||g==="ELSE"||g==="CATCH"||g==="->"||g==="=>"||g==="CLASS")e=!0;if(g==="IF"||g==="ELSE"||g==="SWITCH"||g==="TRY"||g==="=")d=!0;if((g==="."||g==="?."||g==="::")&&this.tag(b-1)==="OUTDENT")return!0;return!a.generated&&this.tag(b-1)!==","&&(t.call(h,g)>=0||g==="INDENT"&&!d)&&(g!=="INDENT"||(i=this.tag(b-2))!=="CLASS"&&i!=="EXTENDS"&&(j=this.tag(b-1),t.call(f,j)<0)&&(!(c=this.tokens[b+1])||!c.generated||c[0]!=="{"))},a=function(a,b){return this.tokens.splice(b,0,this.generate("CALL_END",")",a[2]))};return this.scanTokens(function(f,h,k){var m,n,o,p,q,r,s,u;q=f[0];if(q==="CLASS"||q==="IF"||q==="FOR"||q==="WHILE")c=!0;r=k.slice(h-1,h+1+1||9e9),p=r[0],n=r[1],o=r[2],m=!c&&q==="INDENT"&&o&&o.generated&&o[0]==="{"&&p&&(s=p[0],t.call(i,s)>=0),e=!1,d=!1,t.call(l,q)>=0&&(c=!1),p&&!p.spaced&&q==="?"&&(f.call=!0);if(f.fromThen)return 1;if(!(m||(p!=null?p.spaced:void 0)&&(p.call||(u=p[0],t.call(i,u)>=0))&&(t.call(g,q)>=0||!f.spaced&&!f.newLine&&t.call(j,q)>=0)))return 1;k.splice(h,0,this.generate("CALL_START","(",f[2])),this.detectEnd(h+1,b,a),p[0]==="?"&&(p[0]="FUNC_EXIST");return 2})},a.prototype.addImplicitIndentation=function(){var a,b,c,d,e;e=c=d=null,b=function(a,b){var c;return a[1]!==";"&&(c=a[0],t.call(m,c)>=0)&&(a[0]!=="ELSE"||e==="IF"||e==="THEN")},a=function(a,b){return this.tokens.splice(this.tag(b-1)===","?b-1:b,0,d)};return this.scanTokens(function(f,g,h){var i,j,k;i=f[0];if(i==="TERMINATOR"&&this.tag(g+1)==="THEN"){h.splice(g,1);return 0}if(i==="ELSE"&&this.tag(g-1)!=="OUTDENT"){h.splice.apply(h,[g,0].concat(u.call(this.indentation(f))));return 2}if(i==="CATCH"&&((j=this.tag(g+2))==="OUTDENT"||j==="TERMINATOR"||j==="FINALLY")){h.splice.apply(h,[g+2,0].concat(u.call(this.indentation(f))));return 4}if(t.call(n,i)>=0&&this.tag(g+1)!=="INDENT"&&(i!=="ELSE"||this.tag(g+1)!=="IF")){e=i,k=this.indentation(f,!0),c=k[0],d=k[1],e==="THEN"&&(c.fromThen=!0),h.splice(g+1,0,c),this.detectEnd(g+2,b,a),i==="THEN"&&h.splice(g,1);return 1}return 1})},a.prototype.tagPostfixConditionals=function(){var a,b,c;c=null,b=function(a,b){var c;return(c=a[0])==="TERMINATOR"||c==="INDENT"},a=function(a,b){if(a[0]!=="INDENT"||a.generated&&!a.fromThen)return c[0]="POST_"+c[0]};return this.scanTokens(function(d,e){if(d[0]!=="IF")return 1;c=d,this.detectEnd(e+1,b,a);return 1})},a.prototype.indentation=function(a,b){var c,d;b==null&&(b=!1),c=["INDENT",2,a[2]],d=["OUTDENT",2,a[2]],b&&(c.generated=d.generated=!0);return[c,d]},a.prototype.generate=function(a,b,c){var d;d=[a,b,c],d.generated=!0;return d},a.prototype.tag=function(a){var b;return(b=this.tokens[a])!=null?b[0]:void 0};return a}(),b=[["(",")"],["[","]"],["{","}"],["INDENT","OUTDENT"],["CALL_START","CALL_END"],["PARAM_START","PARAM_END"],["INDEX_START","INDEX_END"]],a.INVERSES=k={},e=[],d=[];for(q=0,r=b.length;q<r;q++)s=b[q],o=s[0],p=s[1],e.push(k[p]=o),d.push(k[o]=p);c=["CATCH","WHEN","ELSE","FINALLY"].concat(d),i=["IDENTIFIER","SUPER",")","CALL_END","]","INDEX_END","@","THIS"],g=["IDENTIFIER","NUMBER","STRING","JS","REGEX","NEW","PARAM_START","CLASS","IF","TRY","SWITCH","THIS","BOOL","NULL","UNDEFINED","UNARY","SUPER","@","->","=>","[","(","{","--","++"],j=["+","-"],f=["->","=>","{","[",","],h=["POST_IF","FOR","WHILE","UNTIL","WHEN","BY","LOOP","TERMINATOR"],n=["ELSE","->","=>","TRY","FINALLY","THEN"],m=["TERMINATOR","CATCH","FINALLY","ELSE","OUTDENT","LEADING_WHEN"],l=["TERMINATOR","INDENT","OUTDENT"]}).call(this)},require["./lexer"]=new function(){var a=this;(function(){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X=[].indexOf||function(a){for(var b=0,c=this.length;b<c;b++)if(b in this&&this[b]===a)return b;return-1};V=require("./rewriter"),J=V.Rewriter,r=V.INVERSES,W=require("./helpers"),R=W.count,U=W.starts,Q=W.compact,T=W.last,a.Lexer=y=function(){function a(){}a.prototype.tokenize=function(a,b){var c,d;b==null&&(b={}),P.test(a)&&(a="\n"+a),a=a.replace(/\r/g,"").replace(N,""),this.code=a,this.line=b.line||0,this.indent=0,this.indebt=0,this.outdebt=0,this.indents=[],this.ends=[],this.tokens=[],c=0;while(this.chunk=a.slice(c))c+=this.identifierToken()||this.commentToken()||this.whitespaceToken()||this.lineToken()||this.heredocToken()||this.stringToken()||this.numberToken()||this.regexToken()||this.jsToken()||this.literalToken();this.closeIndentation(),(d=this.ends.pop())&&this.error("missing "+d);if(b.rewrite===!1)return this.tokens;return(new J).rewrite(this.tokens)},a.prototype.identifierToken=function(){var a,b,c,d,h,i,j,k,l;if(!(h=p.exec(this.chunk)))return 0;d=h[0],c=h[1],a=h[2];if(c==="own"&&this.tag()==="FOR"){this.token("OWN",c);return c.length}b=a||(i=T(this.tokens))&&((k=i[0])==="."||k==="?."||k==="::"||!i.spaced&&i[0]==="@"),j="IDENTIFIER",!b&&(X.call(u,c)>=0||X.call(g,c)>=0)&&(j=c.toUpperCase(),j==="WHEN"&&(l=this.tag(),X.call(v,l)>=0)?j="LEADING_WHEN":j==="FOR"?this.seenFor=!0:j==="UNLESS"?j="IF":X.call(O,j)>=0?j="UNARY":X.call(H,j)>=0&&(j!=="INSTANCEOF"&&this.seenFor?(j="FOR"+j,this.seenFor=!1):(j="RELATION",this.value()==="!"&&(this.tokens.pop(),c="!"+c)))),X.call(t,c)>=0&&(b?(j="IDENTIFIER",c=new String(c),c.reserved=!0):X.call(I,c)>=0&&this.error('reserved word "'+c+'"')),b||(X.call(e,c)>=0&&(c=f[c]),j=function(){switch(c){case"!":return"UNARY";case"==":case"!=":return"COMPARE";case"&&":case"||":return"LOGIC";case"true":case"false":return"BOOL";case"break":case"continue":return"STATEMENT";default:return j}}()),this.token(j,c),a&&this.token(":",":");return d.length},a.prototype.numberToken=function(){var a,b,c,d,e;if(!(c=E.exec(this.chunk)))return 0;d=c[0],/^0[BOX]/.test(d)?this.error("radix prefix '"+d+"' must be lowercase"):/E/.test(d)&&!/^0x/.test(d)?this.error("exponential notation '"+d+"' must be indicated with a lowercase 'e'"):/^0\d*[89]/.test(d)?this.error("decimal literal '"+d+"' must not be prefixed with '0'"):/^0\d+/.test(d)&&this.error("octal literal '"+d+"' must be prefixed with '0o'"),b=d.length;if(e=/^0o([0-7]+)/.exec(d))d="0x"+parseInt(e[1],8).toString(16);if(a=/^0b([01]+)/.exec(d))d="0x"+parseInt(a[1],2).toString(16);this.token("NUMBER",d);return b},a.prototype.stringToken=function(){var a,b,c;switch(this.chunk.charAt(0)){case"'":if(!(a=L.exec(this.chunk)))return 0;this.token("STRING",(c=a[0]).replace(A,"\\\n"));break;case'"':if(!(c=this.balancedString(this.chunk,'"')))return 0;0<c.indexOf("#{",1)?this.interpolateString(c.slice(1,-1)):this.token("STRING",this.escapeLines(c));break;default:return 0}(b=/^(?:\\.|[^\\])*\\(?:0[0-7]|[1-7])/.test(c))&&this.error("octal escape sequences "+c+" are not allowed"),this.line+=R(c,"\n");return c.length},a.prototype.heredocToken=function(){var a,b,c,d;if(!(c=k.exec(this.chunk)))return 0;b=c[0],d=b.charAt(0),a=this.sanitizeHeredoc(c[2],{quote:d,indent:null}),d==='"'&&0<=a.indexOf("#{")?this.interpolateString(a,{heredoc:!0}):this.token("STRING",this.makeString(a,d,!0)),this.line+=R(b,"\n");return b.length},a.prototype.commentToken=function(){var a,b,c;if(!(c=this.chunk.match(h)))return 0;a=c[0],b=c[1],b&&this.token("HERECOMMENT",this.sanitizeHeredoc(b,{herecomment:!0,indent:Array(this.indent+1).join(" ")})),this.line+=R(a,"\n");return a.length},a.prototype.jsToken=function(){var a,b;if(this.chunk.charAt(0)!=="`"||!(a=s.exec(this.chunk)))return 0;this.token("JS",(b=a[0]).slice(1,-1));return b.length},a.prototype.regexToken=function(){var a,b,c,d,e,f,g;if(this.chunk.charAt(0)!=="/")return 0;if(c=n.exec(this.chunk)){b=this.heregexToken(c),this.line+=R(c[0],"\n");return b}d=T(this.tokens);if(d&&(f=d[0],X.call(d.spaced?C:D,f)>=0))return 0;if(!(c=G.exec(this.chunk)))return 0;g=c,c=g[0],e=g[1],a=g[2],e.slice(0,2)==="/*"&&this.error("regular expressions cannot begin with `*`"),e==="//"&&(e="/(?:)/"),this.token("REGEX",""+e+a);return c.length},a.prototype.heregexToken=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n;d=a[0],b=a[1],c=a[2];if(0>b.indexOf("#{")){e=b.replace(o,"").replace(/\//g,"\\/"),e.match(/^\*/)&&this.error("regular expressions cannot begin with `*`"),this.token("REGEX","/"+(e||"(?:)")+"/"+c);return d.length}this.token("IDENTIFIER","RegExp"),this.tokens.push(["CALL_START","("]),g=[],k=this.interpolateString(b,{regex:!0});for(i=0,j=k.length;i<j;i++){l=k[i],f=l[0],h=l[1];if(f==="TOKENS")g.push.apply(g,h);else{if(!(h=h.replace(o,"")))continue;h=h.replace(/\\/g,"\\\\"),g.push(["STRING",this.makeString(h,'"',!0)])}g.push(["+","+"])}g.pop(),((m=g[0])!=null?m[0]:void 0)!=="STRING"&&this.tokens.push(["STRING",'""'],["+","+"]),(n=this.tokens).push.apply(n,g),c&&this.tokens.push([",",","],["STRING",'"'+c+'"']),this.token(")",")");return d.length},a.prototype.lineToken=function(){var a,b,c,d,e,f;if(!(c=B.exec(this.chunk)))return 0;b=c[0],this.line+=R(b,"\n"),this.seenFor=!1,e=T(this.tokens,1),f=b.length-1-b.lastIndexOf("\n"),d=this.unfinished();if(f-this.indebt===this.indent){d?this.suppressNewlines():this.newlineToken();return b.length}if(f>this.indent){if(d){this.indebt=f-this.indent,this.suppressNewlines();return b.length}a=f-this.indent+this.outdebt,this.token("INDENT",a),this.indents.push(a),this.ends.push("OUTDENT"),this.outdebt=this.indebt=0}else this.indebt=0,this.outdentToken(this.indent-f,d);this.indent=f;return b.length},a.prototype.outdentToken=function(a,b){var c,d;while(a>0)d=this.indents.length-1,this.indents[d]===void 0?a=0:this.indents[d]===this.outdebt?(a-=this.outdebt,this.outdebt=0):this.indents[d]<this.outdebt?(this.outdebt-=this.indents[d],a-=this.indents[d]):(c=this.indents.pop()-this.outdebt,a-=c,this.outdebt=0,this.pair("OUTDENT"),this.token("OUTDENT",c));c&&(this.outdebt-=a);while(this.value()===";")this.tokens.pop();this.tag()!=="TERMINATOR"&&!b&&this.token("TERMINATOR","\n");return this},a.prototype.whitespaceToken=function(){var a,b,c;if(!(a=P.exec(this.chunk))&&!(b=this.chunk.charAt(0)==="\n"))return 0;c=T(this.tokens),c&&(c[a?"spaced":"newLine"]=!0);return a?a[0].length:0},a.prototype.newlineToken=function(){while(this.value()===";")this.tokens.pop();this.tag()!=="TERMINATOR"&&this.token("TERMINATOR","\n");return this},a.prototype.suppressNewlines=function(){this.value()==="\\"&&this.tokens.pop();return this},a.prototype.literalToken=function(){var a,b,e,f,g,h,k,l;(a=F.exec(this.chunk))?(f=a[0],d.test(f)&&this.tagParameters()):f=this.chunk.charAt(0),e=f,b=T(this.tokens);if(f==="="&&b){!b[1].reserved&&(g=b[1],X.call(t,g)>=0)&&this.error('reserved word "'+this.value()+"\" can't be assigned");if((h=b[1])==="||"||h==="&&"){b[0]="COMPOUND_ASSIGN",b[1]+="=";return f.length}}if(f===";")this.seenFor=!1,e="TERMINATOR";else if(X.call(z,f)>=0)e="MATH";else if(X.call(i,f)>=0)e="COMPARE";else if(X.call(j,f)>=0)e="COMPOUND_ASSIGN";else if(X.call(O,f)>=0)e="UNARY";else if(X.call(K,f)>=0)e="SHIFT";else if(X.call(x,f)>=0||f==="?"&&(b!=null?b.spaced:void 0))e="LOGIC";else if(b&&!b.spaced)if(f==="("&&(k=b[0],X.call(c,k)>=0))b[0]==="?"&&(b[0]="FUNC_EXIST"),e="CALL_START";else if(f==="["&&(l=b[0],X.call(q,l)>=0)){e="INDEX_START";switch(b[0]){case"?":b[0]="INDEX_SOAK"}}switch(f){case"(":case"{":case"[":this.ends.push(r[f]);break;case")":case"}":case"]":this.pair(f)}this.token(e,f);return f.length},a.prototype.sanitizeHeredoc=function(a,b){var c,d,e,f,g;e=b.indent,d=b.herecomment;if(d){l.test(a)&&this.error('block comment cannot contain "*/", starting');if(a.indexOf("\n")<=0)return a}else while(f=m.exec(a)){c=f[1];if(e===null||0<(g=c.length)&&g<e.length)e=c}e&&(a=a.replace(RegExp("\\n"+e,"g"),"\n")),d||(a=a.replace(/^\n/,""));return a},a.prototype.tagParameters=function(){var a,b,c,d;if(this.tag()!==")")return this;b=[],d=this.tokens,a=d.length,d[--a][0]="PARAM_END";while(c=d[--a])switch(c[0]){case")":b.push(c);break;case"(":case"CALL_START":if(b.length)b.pop();else{if(c[0]==="("){c[0]="PARAM_START";return this}return this}}return this},a.prototype.closeIndentation=function(){return this.outdentToken(this.indent)},a.prototype.balancedString=function(a,b){var c,d,e,f,g,h,i,j;c=0,h=[b];for(d=i=1,j=a.length;1<=j?i<j:i>j;d=1<=j?++i:--i){if(c){--c;continue}switch(e=a.charAt(d)){case"\\":++c;continue;case b:h.pop();if(!h.length)return a.slice(0,d+1||9e9);b=h[h.length-1];continue}b!=="}"||e!=='"'&&e!=="'"?b==="}"&&e==="/"&&(f=n.exec(a.slice(d))||G.exec(a.slice(d)))?c+=f[0].length-1:b==="}"&&e==="{"?h.push(b="}"):b==='"'&&g==="#"&&e==="{"&&h.push(b="}"):h.push(b=e),g=e}return this.error("missing "+h.pop()+", starting")},a.prototype.interpolateString=function(b,c){var d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u;c==null&&(c={}),e=c.heredoc,m=c.regex,o=[],l=0,f=-1;while(j=b.charAt(f+=1)){if(j==="\\"){f+=1;continue}if(j!=="#"||b.charAt(f+1)!=="{"||!(d=this.balancedString(b.slice(f+1),"}")))continue;l<f&&o.push(["NEOSTRING",b.slice(l,f)]),g=d.slice(1,-1);if(g.length){k=(new a).tokenize(g,{line:this.line,rewrite:!1}),k.pop(),((s=k[0])!=null?s[0]:void 0)==="TERMINATOR"&&k.shift();if(i=k.length)i>1&&(k.unshift(["(","(",this.line]),k.push([")",")",this.line])),o.push(["TOKENS",k])}f+=d.length,l=f+1}f>l&&l<b.length&&o.push(["NEOSTRING",b.slice(l)]);if(m)return o;if(!o.length)return this.token("STRING",'""');o[0][0]!=="NEOSTRING"&&o.unshift(["",""]),(h=o.length>1)&&this.token("(","(");for(f=q=0,r=o.length;q<r;f=++q)t=o[f],n=t[0],p=t[1],f&&this.token("+","+"),n==="TOKENS"?(u=this.tokens).push.apply(u,p):this.token("STRING",this.makeString(p,'"',e));h&&this.token(")",")");return o},a.prototype.pair=function(a){var b,c;if(a!==(c=T(this.ends))){"OUTDENT"!==c&&this.error("unmatched "+a),this.indent-=b=T(this.indents),this.outdentToken(b,!0);return this.pair(a)}return this.ends.pop()},a.prototype.token=function(a,b){return this.tokens.push([a,b,this.line])},a.prototype.tag=function(a,b){var c;return(c=T(this.tokens,a))&&(b?c[0]=b:c[0])},a.prototype.value=function(a,b){var c;return(c=T(this.tokens,a))&&(b?c[1]=b:c[1])},a.prototype.unfinished=function(){var a;return w.test(this.chunk)||(a=this.tag())==="\\"||a==="."||a==="?."||a==="UNARY"||a==="MATH"||a==="+"||a==="-"||a==="SHIFT"||a==="RELATION"||a==="COMPARE"||a==="LOGIC"||a==="THROW"||a==="EXTENDS"},a.prototype.escapeLines=function(a,b){return a.replace(A,b?"\\n":"")},a.prototype.makeString=function(a,b,c){if(!a)return b+b;a=a.replace(/\\([\s\S])/g,function(a,c){return c==="\n"||c===b?c:a}),a=a.replace(RegExp(""+b,"g"),"\\$&");return b+this.escapeLines(a,c)+b},a.prototype.error=function(a){throw SyntaxError(""+a+" on line "+(this.line+1))};return a}(),u=["true","false","null","this","new","delete","typeof","in","instanceof","return","throw","break","continue","debugger","if","else","switch","for","while","do","try","catch","finally","class","extends","super"],g=["undefined","then","unless","until","loop","of","by","when"],f={and:"&&",or:"||",is:"==",isnt:"!=",not:"!",yes:"true",no:"false",on:"true",off:"false"},e=function(){var a;a=[];for(S in f)a.push(S);return a}(),g=g.concat(e),I=["case","default","function","var","void","with","const","let","enum","export","import","native","__hasProp","__extends","__slice","__bind","__indexOf","implements","interface","let","package","private","protected","public","static","yield"],M=["arguments","eval"],t=u.concat(I).concat(M),a.RESERVED=I.concat(u).concat(g).concat(M),a.STRICT_PROSCRIBED=M,p=/^([$A-Za-z_\x7f-\uffff][$\w\x7f-\uffff]*)([^\n\S]*:(?!:))?/,E=/^0b[01]+|^0o[0-7]+|^0x[\da-f]+|^\d*\.?\d+(?:e[+-]?\d+)?/i,k=/^("""|''')([\s\S]*?)(?:\n[^\n\S]*)?\1/,F=/^(?:[-=]>|[-+*\/%<>&|^!?=]=|>>>=?|([-+:])\1|([&|<>])\2=?|\?\.|\.{2,3})/,P=/^[^\n\S]+/,h=/^###([^#][\s\S]*?)(?:###[^\n\S]*|(?:###)?$)|^(?:\s*#(?!##[^#]).*)+/,d=/^[-=]>/,B=/^(?:\n[^\n\S]*)+/,L=/^'[^\\']*(?:\\.[^\\']*)*'/,s=/^`[^\\`]*(?:\\.[^\\`]*)*`/,G=/^(\/(?![\s=])[^[\/\n\\]*(?:(?:\\[\s\S]|\[[^\]\n\\]*(?:\\[\s\S][^\]\n\\]*)*])[^[\/\n\\]*)*\/)([imgy]{0,4})(?!\w)/,n=/^\/{3}([\s\S]+?)\/{3}([imgy]{0,4})(?!\w)/,o=/\s+(?:#.*)?/g,A=/\n/g,m=/\n+([^\n\S]*)/g,l=/\*\//,w=/^\s*(?:,|\??\.(?![.\d])|::)/,N=/\s+$/,j=["-=","+=","/=","*=","%=","||=","&&=","?=","<<=",">>=",">>>=","&=","^=","|="],O=["!","~","NEW","TYPEOF","DELETE","DO"],x=["&&","||","&","|","^"],K=["<<",">>",">>>"],i=["==","!=","<",">","<=",">="],z=["*","/","%"],H=["IN","OF","INSTANCEOF"],b=["TRUE","FALSE"],C=["NUMBER","REGEX","BOOL","NULL","UNDEFINED","++","--","]"],D=C.concat(")","}","THIS","IDENTIFIER","STRING"),c=["IDENTIFIER","STRING","REGEX",")","]","}","?","::","@","THIS","SUPER"],q=c.concat("NUMBER","BOOL","NULL","UNDEFINED"),v=["INDENT","OUTDENT","TERMINATOR"]}).call(this)},require["./parser"]=new function(){var a=this,b=function(){var a={trace:function(){},yy:{},symbols_:{error:2,Root:3,Body:4,Block:5,TERMINATOR:6,Line:7,Expression:8,Statement:9,Return:10,Comment:11,STATEMENT:12,Value:13,Invocation:14,Code:15,Operation:16,Assign:17,If:18,Try:19,While:20,For:21,Switch:22,Class:23,Throw:24,INDENT:25,OUTDENT:26,Identifier:27,IDENTIFIER:28,AlphaNumeric:29,NUMBER:30,STRING:31,Literal:32,JS:33,REGEX:34,DEBUGGER:35,UNDEFINED:36,NULL:37,BOOL:38,Assignable:39,"=":40,AssignObj:41,ObjAssignable:42,":":43,ThisProperty:44,RETURN:45,HERECOMMENT:46,PARAM_START:47,ParamList:48,PARAM_END:49,FuncGlyph:50,"->":51,"=>":52,OptComma:53,",":54,Param:55,ParamVar:56,"...":57,Array:58,Object:59,Splat:60,SimpleAssignable:61,Accessor:62,Parenthetical:63,Range:64,This:65,".":66,"?.":67,"::":68,Index:69,INDEX_START:70,IndexValue:71,INDEX_END:72,INDEX_SOAK:73,Slice:74,"{":75,AssignList:76,"}":77,CLASS:78,EXTENDS:79,OptFuncExist:80,Arguments:81,SUPER:82,FUNC_EXIST:83,CALL_START:84,CALL_END:85,ArgList:86,THIS:87,"@":88,"[":89,"]":90,RangeDots:91,"..":92,Arg:93,SimpleArgs:94,TRY:95,Catch:96,FINALLY:97,CATCH:98,THROW:99,"(":100,")":101,WhileSource:102,WHILE:103,WHEN:104,UNTIL:105,Loop:106,LOOP:107,ForBody:108,FOR:109,ForStart:110,ForSource:111,ForVariables:112,OWN:113,ForValue:114,FORIN:115,FOROF:116,BY:117,SWITCH:118,Whens:119,ELSE:120,When:121,LEADING_WHEN:122,IfBlock:123,IF:124,POST_IF:125,UNARY:126,"-":127,"+":128,"--":129,"++":130,"?":131,MATH:132,SHIFT:133,COMPARE:134,LOGIC:135,RELATION:136,COMPOUND_ASSIGN:137,$accept:0,$end:1},terminals_:{2:"error",6:"TERMINATOR",12:"STATEMENT",25:"INDENT",26:"OUTDENT",28:"IDENTIFIER",30:"NUMBER",31:"STRING",33:"JS",34:"REGEX",35:"DEBUGGER",36:"UNDEFINED",37:"NULL",38:"BOOL",40:"=",43:":",45:"RETURN",46:"HERECOMMENT",47:"PARAM_START",49:"PARAM_END",51:"->",52:"=>",54:",",57:"...",66:".",67:"?.",68:"::",70:"INDEX_START",72:"INDEX_END",73:"INDEX_SOAK",75:"{",77:"}",78:"CLASS",79:"EXTENDS",82:"SUPER",83:"FUNC_EXIST",84:"CALL_START",85:"CALL_END",87:"THIS",88:"@",89:"[",90:"]",92:"..",95:"TRY",97:"FINALLY",98:"CATCH",99:"THROW",100:"(",101:")",103:"WHILE",104:"WHEN",105:"UNTIL",107:"LOOP",109:"FOR",113:"OWN",115:"FORIN",116:"FOROF",117:"BY",118:"SWITCH",120:"ELSE",122:"LEADING_WHEN",124:"IF",125:"POST_IF",126:"UNARY",127:"-",128:"+",129:"--",130:"++",131:"?",132:"MATH",133:"SHIFT",134:"COMPARE",135:"LOGIC",136:"RELATION",137:"COMPOUND_ASSIGN"},productions_:[0,[3,0],[3,1],[3,2],[4,1],[4,3],[4,2],[7,1],[7,1],[9,1],[9,1],[9,1],[8,1],[8,1],[8,1],[8,1],[8,1],[8,1],[8,1],[8,1],[8,1],[8,1],[8,1],[8,1],[5,2],[5,3],[27,1],[29,1],[29,1],[32,1],[32,1],[32,1],[32,1],[32,1],[32,1],[32,1],[17,3],[17,4],[17,5],[41,1],[41,3],[41,5],[41,1],[42,1],[42,1],[42,1],[10,2],[10,1],[11,1],[15,5],[15,2],[50,1],[50,1],[53,0],[53,1],[48,0],[48,1],[48,3],[48,4],[48,6],[55,1],[55,2],[55,3],[56,1],[56,1],[56,1],[56,1],[60,2],[61,1],[61,2],[61,2],[61,1],[39,1],[39,1],[39,1],[13,1],[13,1],[13,1],[13,1],[13,1],[62,2],[62,2],[62,2],[62,1],[62,1],[69,3],[69,2],[71,1],[71,1],[59,4],[76,0],[76,1],[76,3],[76,4],[76,6],[23,1],[23,2],[23,3],[23,4],[23,2],[23,3],[23,4],[23,5],[14,3],[14,3],[14,1],[14,2],[80,0],[80,1],[81,2],[81,4],[65,1],[65,1],[44,2],[58,2],[58,4],[91,1],[91,1],[64,5],[74,3],[74,2],[74,2],[74,1],[86,1],[86,3],[86,4],[86,4],[86,6],[93,1],[93,1],[94,1],[94,3],[19,2],[19,3],[19,4],[19,5],[96,3],[24,2],[63,3],[63,5],[102,2],[102,4],[102,2],[102,4],[20,2],[20,2],[20,2],[20,1],[106,2],[106,2],[21,2],[21,2],[21,2],[108,2],[108,2],[110,2],[110,3],[114,1],[114,1],[114,1],[114,1],[112,1],[112,3],[111,2],[111,2],[111,4],[111,4],[111,4],[111,6],[111,6],[22,5],[22,7],[22,4],[22,6],[119,1],[119,2],[121,3],[121,4],[123,3],[123,5],[18,1],[18,3],[18,3],[18,3],[16,2],[16,2],[16,2],[16,2],[16,2],[16,2],[16,2],[16,2],[16,3],[16,3],[16,3],[16,3],[16,3],[16,3],[16,3],[16,3],[16,5],[16,3]],performAction:function(a,b,c,d,e,f,g){var h=f.length-1;switch(e){case 1:return this.$=new d.Block;case 2:return this.$=f[h];case 3:return this.$=f[h-1];case 4:this.$=d.Block.wrap([f[h]]);break;case 5:this.$=f[h-2].push(f[h]);break;case 6:this.$=f[h-1];break;case 7:this.$=f[h];break;case 8:this.$=f[h];break;case 9:this.$=f[h];break;case 10:this.$=f[h];break;case 11:this.$=new d.Literal(f[h]);break;case 12:this.$=f[h];break;case 13:this.$=f[h];break;case 14:this.$=f[h];break;case 15:this.$=f[h];break;case 16:this.$=f[h];break;case 17:this.$=f[h];break;case 18:this.$=f[h];break;case 19:this.$=f[h];break;case 20:this.$=f[h];break;case 21:this.$=f[h];break;case 22:this.$=f[h];break;case 23:this.$=f[h];break;case 24:this.$=new d.Block;break;case 25:this.$=f[h-1];break;case 26:this.$=new d.Literal(f[h]);break;case 27:this.$=new d.Literal(f[h]);break;case 28:this.$=new d.Literal(f[h]);break;case 29:this.$=f[h];break;case 30:this.$=new d.Literal(f[h]);break;case 31:this.$=new d.Literal(f[h]);break;case 32:this.$=new d.Literal(f[h]);break;case 33:this.$=new d.Undefined;break;case 34:this.$=new d.Null;break;case 35:this.$=new d.Bool(f[h]);break;case 36:this.$=new d.Assign(f[h-2],f[h]);break;case 37:this.$=new d.Assign(f[h-3],f[h]);break;case 38:this.$=new d.Assign(f[h-4],f[h-1]);break;case 39:this.$=new d.Value(f[h]);break;case 40:this.$=new d.Assign(new d.Value(f[h-2]),f[h],"object");break;case 41:this.$=new d.Assign(new d.Value(f[h-4]),f[h-1],"object");break;case 42:this.$=f[h];break;case 43:this.$=f[h];break;case 44:this.$=f[h];break;case 45:this.$=f[h];break;case 46:this.$=new d.Return(f[h]);break;case 47:this.$=new d.Return;break;case 48:this.$=new d.Comment(f[h]);break;case 49:this.$=new d.Code(f[h-3],f[h],f[h-1]);break;case 50:this.$=new d.Code([],f[h],f[h-1]);break;case 51:this.$="func";break;case 52:this.$="boundfunc";break;case 53:this.$=f[h];break;case 54:this.$=f[h];break;case 55:this.$=[];break;case 56:this.$=[f[h]];break;case 57:this.$=f[h-2].concat(f[h]);break;case 58:this.$=f[h-3].concat(f[h]);break;case 59:this.$=f[h-5].concat(f[h-2]);break;case 60:this.$=new d.Param(f[h]);break;case 61:this.$=new d.Param(f[h-1],null,!0);break;case 62:this.$=new d.Param(f[h-2],f[h]);break;case 63:this.$=f[h];break;case 64:this.$=f[h];break;case 65:this.$=f[h];break;case 66:this.$=f[h];break;case 67:this.$=new d.Splat(f[h-1]);break;case 68:this.$=new d.Value(f[h]);break;case 69:this.$=f[h-1].add(f[h]);break;case 70:this.$=new d.Value(f[h-1],[].concat(f[h]));break;case 71:this.$=f[h];break;case 72:this.$=f[h];break;case 73:this.$=new d.Value(f[h]);break;case 74:this.$=new d.Value(f[h]);break;case 75:this.$=f[h];break;case 76:this.$=new d.Value(f[h]);break;case 77:this.$=new d.Value(f[h]);break;case 78:this.$=new d.Value(f[h]);break;case 79:this.$=f[h];break;case 80:this.$=new d.Access(f[h]);break;case 81:this.$=new d.Access(f[h],"soak");break;case 82:this.$=[new d.Access(new d.Literal("prototype")),new d.Access(f[h])];break;case 83:this.$=new d.Access(new d.Literal("prototype"));break;case 84:this.$=f[h];break;case 85:this.$=f[h-1];break;case 86:this.$=d.extend(f[h],{soak:!0});break;case 87:this.$=new d.Index(f[h]);break;case 88:this.$=new d.Slice(f[h]);break;case 89:this.$=new d.Obj(f[h-2],f[h-3].generated);break;case 90:this.$=[];break;case 91:this.$=[f[h]];break;case 92:this.$=f[h-2].concat(f[h]);break;case 93:this.$=f[h-3].concat(f[h]);break;case 94:this.$=f[h-5].concat(f[h-2]);break;case 95:this.$=new d.Class;break;case 96:this.$=new d.Class(null,null,f[h]);break;case 97:this.$=new d.Class(null,f[h]);break;case 98:this.$=new d.Class(null,f[h-1],f[h]);break;case 99:this.$=new d.Class(f[h]);break;case 100:this.$=new d.Class(f[h-1],null,f[h]);break;case 101:this.$=new d.Class(f[h-2],f[h]);break;case 102:this.$=new d.Class(f[h-3],f[h-1],f[h]);break;case 103:this.$=new d.Call(f[h-2],f[h],f[h-1]);break;case 104:this.$=new d.Call(f[h-2],f[h],f[h-1]);break;case 105:this.$=new d.Call("super",[new d.Splat(new d.Literal("arguments"))]);break;case 106:this.$=new d.Call("super",f[h]);break;case 107:this.$=!1;break;case 108:this.$=!0;break;case 109:this.$=[];break;case 110:this.$=f[h-2];break;case 111:this.$=new d.Value(new d.Literal("this"));break;case 112:this.$=new d.Value(new d.Literal("this"));break;case 113:this.$=new d.Value(new d.Literal("this"),[new d.Access(f[h])],"this");break;case 114:this.$=new d.Arr([]);break;case 115:this.$=new d.Arr(f[h-2]);break;case 116:this.$="inclusive";break;case 117:this.$="exclusive";break;case 118:this.$=new d.Range(f[h-3],f[h-1],f[h-2]);break;case 119:this.$=new d.Range(f[h-2],f[h],f[h-1]);break;case 120:this.$=new d.Range(f[h-1],null,f[h]);break;case 121:this.$=new d.Range(null,f[h],f[h-1]);break;case 122:this.$=new d.Range(null,null,f[h]);break;case 123:this.$=[f[h]];break;case 124:this.$=f[h-2].concat(f[h]);break;case 125:this.$=f[h-3].concat(f[h]);break;case 126:this.$=f[h-2];break;case 127:this.$=f[h-5].concat(f[h-2]);break;case 128:this.$=f[h];break;case 129:this.$=f[h];break;case 130:this.$=f[h];break;case 131:this.$=[].concat(f[h-2],f[h]);break;case 132:this.$=new d.Try(f[h]);break;case 133:this.$=new d.Try(f[h-1],f[h][0],f[h][1]);break;case 134:this.$=new d.Try(f[h-2],null,null,f[h]);break;case 135:this.$=new d.Try(f[h-3],f[h-2][0],f[h-2][1],f[h]);break;case 136:this.$=[f[h-1],f[h]];break;case 137:this.$=new d.Throw(f[h]);break;case 138:this.$=new d.Parens(f[h-1]);break;case 139:this.$=new d.Parens(f[h-2]);break;case 140:this.$=new d.While(f[h]);break;case 141:this.$=new d.While(f[h-2],{guard:f[h]});break;case 142:this.$=new d.While(f[h],{invert:!0});break;case 143:this.$=new d.While(f[h-2],{invert:!0,guard:f[h]});break;case 144:this.$=f[h-1].addBody(f[h]);break;case 145:this.$=f[h].addBody(d.Block.wrap([f[h-1]]));break;case 146:this.$=f[h].addBody(d.Block.wrap([f[h-1]]));break;case 147:this.$=f[h];break;case 148:this.$=(new d.While(new d.Literal("true"))).addBody(f[h]);break;case 149:this.$=(new d.While(new d.Literal("true"))).addBody(d.Block.wrap([f[h]]));break;case 150:this.$=new d.For(f[h-1],f[h]);break;case 151:this.$=new d.For(f[h-1],f[h]);break;case 152:this.$=new d.For(f[h],f[h-1]);break;case 153:this.$={source:new d.Value(f[h])};break;case 154:this.$=function(){f[h].own=f[h-1].own,f[h].name=f[h-1][0],f[h].index=f[h-1][1];return f[h]}();break;case 155:this.$=f[h];break;case 156:this.$=function(){f[h].own=!0;return f[h]}();break;case 157:this.$=f[h];break;case 158:this.$=f[h];break;case 159:this.$=new d.Value(f[h]);break;case 160:this.$=new d.Value(f[h]);break;case 161:this.$=[f[h]];break;case 162:this.$=[f[h-2],f[h]];break;case 163:this.$={source:f[h]};break;case 164:this.$={source:f[h],object:!0};break;case 165:this.$={source:f[h-2],guard:f[h]};break;case 166:this.$={source:f[h-2],guard:f[h],object:!0};break;case 167:this.$={source:f[h-2],step:f[h]};break;case 168:this.$={source:f[h-4],guard:f[h-2],step:f[h]};break;case 169:this.$={source:f[h-4],step:f[h-2],guard:f[h]};break;case 170:this.$=new d.Switch(f[h-3],f[h-1]);break;case 171:this.$=new d.Switch(f[h-5],f[h-3],f[h-1]);break;case 172:this.$=new d.Switch(null,f[h-1]);break;case 173:this.$=new d.Switch(null,f[h-3],f[h-1]);break;case 174:this.$=f[h];break;case 175:this.$=f[h-1].concat(f[h]);break;case 176:this.$=[[f[h-1],f[h]]];break;case 177:this.$=[[f[h-2],f[h-1]]];break;case 178:this.$=new d.If(f[h-1],f[h],{type:f[h-2]});break;case 179:this.$=f[h-4].addElse(new d.If(f[h-1],f[h],{type:f[h-2]}));break;case 180:this.$=f[h];break;case 181:this.$=f[h-2].addElse(f[h]);break;case 182:this.$=new d.If(f[h],d.Block.wrap([f[h-2]]),{type:f[h-1],statement:!0});break;case 183:this.$=new d.If(f[h],d.Block.wrap([f[h-2]]),{type:f[h-1],statement:!0});break;case 184:this.$=new d.Op(f[h-1],f[h]);break;case 185:this.$=new d.Op("-",f[h]);break;case 186:this.$=new d.Op("+",f[h]);break;case 187:this.$=new d.Op("--",f[h]);break;case 188:this.$=new d.Op("++",f[h]);break;case 189:this.$=new d.Op("--",f[h-1],null,!0);break;case 190:this.$=new d.Op("++",f[h-1],null,!0);break;case 191:this.$=new d.Existence(f[h-1]);break;case 192:this.$=new d.Op("+",f[h-2],f[h]);break;case 193:this.$=new d.Op("-",f[h-2],f[h]);break;case 194:this.$=new d.Op(f[h-1],f[h-2],f[h]);break;case 195:this.$=new d.Op(f[h-1],f[h-2],f[h]);break;case 196:this.$=new d.Op(f[h-1],f[h-2],f[h]);break;case 197:this.$=new d.Op(f[h-1],f[h-2],f[h]);break;case 198:this.$=function(){return f[h-1].charAt(0)==="!"?(new d.Op(f[h-1].slice(1),f[h-2],f[h])).invert():new d.Op(f[h-1],f[h-2],f[h])}();break;case 199:this.$=new d.Assign(f[h-2],f[h],f[h-1]);break;case 200:this.$=new d.Assign(f[h-4],f[h-1],f[h-3]);break;case 201:this.$=new d.Extends(f[h-2],f[h])}},table:[{1:[2,1],3:1,4:2,5:3,7:4,8:6,9:7,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,25:[1,5],27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{1:[3]},{1:[2,2],6:[1,74]},{6:[1,75]},{1:[2,4],6:[2,4],26:[2,4],101:[2,4]},{4:77,7:4,8:6,9:7,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,26:[1,76],27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{1:[2,7],6:[2,7],26:[2,7],101:[2,7],102:87,103:[1,65],105:[1,66],108:88,109:[1,68],110:69,125:[1,86],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{1:[2,8],6:[2,8],26:[2,8],101:[2,8],102:90,103:[1,65],105:[1,66],108:91,109:[1,68],110:69,125:[1,89]},{1:[2,12],6:[2,12],25:[2,12],26:[2,12],49:[2,12],54:[2,12],57:[2,12],62:93,66:[1,95],67:[1,96],68:[1,97],69:98,70:[1,99],72:[2,12],73:[1,100],77:[2,12],80:92,83:[1,94],84:[2,107],85:[2,12],90:[2,12],92:[2,12],101:[2,12],103:[2,12],104:[2,12],105:[2,12],109:[2,12],117:[2,12],125:[2,12],127:[2,12],128:[2,12],131:[2,12],132:[2,12],133:[2,12],134:[2,12],135:[2,12],136:[2,12]},{1:[2,13],6:[2,13],25:[2,13],26:[2,13],49:[2,13],54:[2,13],57:[2,13],62:102,66:[1,95],67:[1,96],68:[1,97],69:98,70:[1,99],72:[2,13],73:[1,100],77:[2,13],80:101,83:[1,94],84:[2,107],85:[2,13],90:[2,13],92:[2,13],101:[2,13],103:[2,13],104:[2,13],105:[2,13],109:[2,13],117:[2,13],125:[2,13],127:[2,13],128:[2,13],131:[2,13],132:[2,13],133:[2,13],134:[2,13],135:[2,13],136:[2,13]},{1:[2,14],6:[2,14],25:[2,14],26:[2,14],49:[2,14],54:[2,14],57:[2,14],72:[2,14],77:[2,14],85:[2,14],90:[2,14],92:[2,14],101:[2,14],103:[2,14],104:[2,14],105:[2,14],109:[2,14],117:[2,14],125:[2,14],127:[2,14],128:[2,14],131:[2,14],132:[2,14],133:[2,14],134:[2,14],135:[2,14],136:[2,14]},{1:[2,15],6:[2,15],25:[2,15],26:[2,15],49:[2,15],54:[2,15],57:[2,15],72:[2,15],77:[2,15],85:[2,15],90:[2,15],92:[2,15],101:[2,15],103:[2,15],104:[2,15],105:[2,15],109:[2,15],117:[2,15],125:[2,15],127:[2,15],128:[2,15],131:[2,15],132:[2,15],133:[2,15],134:[2,15],135:[2,15],136:[2,15]},{1:[2,16],6:[2,16],25:[2,16],26:[2,16],49:[2,16],54:[2,16],57:[2,16],72:[2,16],77:[2,16],85:[2,16],90:[2,16],92:[2,16],101:[2,16],103:[2,16],104:[2,16],105:[2,16],109:[2,16],117:[2,16],125:[2,16],127:[2,16],128:[2,16],131:[2,16],132:[2,16],133:[2,16],134:[2,16],135:[2,16],136:[2,16]},{1:[2,17],6:[2,17],25:[2,17],26:[2,17],49:[2,17],54:[2,17],57:[2,17],72:[2,17],77:[2,17],85:[2,17],90:[2,17],92:[2,17],101:[2,17],103:[2,17],104:[2,17],105:[2,17],109:[2,17],117:[2,17],125:[2,17],127:[2,17],128:[2,17],131:[2,17],132:[2,17],133:[2,17],134:[2,17],135:[2,17],136:[2,17]},{1:[2,18],6:[2,18],25:[2,18],26:[2,18],49:[2,18],54:[2,18],57:[2,18],72:[2,18],77:[2,18],85:[2,18],90:[2,18],92:[2,18],101:[2,18],103:[2,18],104:[2,18],105:[2,18],109:[2,18],117:[2,18],125:[2,18],127:[2,18],128:[2,18],131:[2,18],132:[2,18],133:[2,18],134:[2,18],135:[2,18],136:[2,18]},{1:[2,19],6:[2,19],25:[2,19],26:[2,19],49:[2,19],54:[2,19],57:[2,19],72:[2,19],77:[2,19],85:[2,19],90:[2,19],92:[2,19],101:[2,19],103:[2,19],104:[2,19],105:[2,19],109:[2,19],117:[2,19],125:[2,19],127:[2,19],128:[2,19],131:[2,19],132:[2,19],133:[2,19],134:[2,19],135:[2,19],136:[2,19]},{1:[2,20],6:[2,20],25:[2,20],26:[2,20],49:[2,20],54:[2,20],57:[2,20],72:[2,20],77:[2,20],85:[2,20],90:[2,20],92:[2,20],101:[2,20],103:[2,20],104:[2,20],105:[2,20],109:[2,20],117:[2,20],125:[2,20],127:[2,20],128:[2,20],131:[2,20],132:[2,20],133:[2,20],134:[2,20],135:[2,20],136:[2,20]},{1:[2,21],6:[2,21],25:[2,21],26:[2,21],49:[2,21],54:[2,21],57:[2,21],72:[2,21],77:[2,21],85:[2,21],90:[2,21],92:[2,21],101:[2,21],103:[2,21],104:[2,21],105:[2,21],109:[2,21],117:[2,21],125:[2,21],127:[2,21],128:[2,21],131:[2,21],132:[2,21],133:[2,21],134:[2,21],135:[2,21],136:[2,21]},{1:[2,22],6:[2,22],25:[2,22],26:[2,22],49:[2,22],54:[2,22],57:[2,22],72:[2,22],77:[2,22],85:[2,22],90:[2,22],92:[2,22],101:[2,22],103:[2,22],104:[2,22],105:[2,22],109:[2,22],117:[2,22],125:[2,22],127:[2,22],128:[2,22],131:[2,22],132:[2,22],133:[2,22],134:[2,22],135:[2,22],136:[2,22]},{1:[2,23],6:[2,23],25:[2,23],26:[2,23],49:[2,23],54:[2,23],57:[2,23],72:[2,23],77:[2,23],85:[2,23],90:[2,23],92:[2,23],101:[2,23],103:[2,23],104:[2,23],105:[2,23],109:[2,23],117:[2,23],125:[2,23],127:[2,23],128:[2,23],131:[2,23],132:[2,23],133:[2,23],134:[2,23],135:[2,23],136:[2,23]},{1:[2,9],6:[2,9],26:[2,9],101:[2,9],103:[2,9],105:[2,9],109:[2,9],125:[2,9]},{1:[2,10],6:[2,10],26:[2,10],101:[2,10],103:[2,10],105:[2,10],109:[2,10],125:[2,10]},{1:[2,11],6:[2,11],26:[2,11],101:[2,11],103:[2,11],105:[2,11],109:[2,11],125:[2,11]},{1:[2,75],6:[2,75],25:[2,75],26:[2,75],40:[1,103],49:[2,75],54:[2,75],57:[2,75],66:[2,75],67:[2,75],68:[2,75],70:[2,75],72:[2,75],73:[2,75],77:[2,75],83:[2,75],84:[2,75],85:[2,75],90:[2,75],92:[2,75],101:[2,75],103:[2,75],104:[2,75],105:[2,75],109:[2,75],117:[2,75],125:[2,75],127:[2,75],128:[2,75],131:[2,75],132:[2,75],133:[2,75],134:[2,75],135:[2,75],136:[2,75]},{1:[2,76],6:[2,76],25:[2,76],26:[2,76],49:[2,76],54:[2,76],57:[2,76],66:[2,76],67:[2,76],68:[2,76],70:[2,76],72:[2,76],73:[2,76],77:[2,76],83:[2,76],84:[2,76],85:[2,76],90:[2,76],92:[2,76],101:[2,76],103:[2,76],104:[2,76],105:[2,76],109:[2,76],117:[2,76],125:[2,76],127:[2,76],128:[2,76],131:[2,76],132:[2,76],133:[2,76],134:[2,76],135:[2,76],136:[2,76]},{1:[2,77],6:[2,77],25:[2,77],26:[2,77],49:[2,77],54:[2,77],57:[2,77],66:[2,77],67:[2,77],68:[2,77],70:[2,77],72:[2,77],73:[2,77],77:[2,77],83:[2,77],84:[2,77],85:[2,77],90:[2,77],92:[2,77],101:[2,77],103:[2,77],104:[2,77],105:[2,77],109:[2,77],117:[2,77],125:[2,77],127:[2,77],128:[2,77],131:[2,77],132:[2,77],133:[2,77],134:[2,77],135:[2,77],136:[2,77]},{1:[2,78],6:[2,78],25:[2,78],26:[2,78],49:[2,78],54:[2,78],57:[2,78],66:[2,78],67:[2,78],68:[2,78],70:[2,78],72:[2,78],73:[2,78],77:[2,78],83:[2,78],84:[2,78],85:[2,78],90:[2,78],92:[2,78],101:[2,78],103:[2,78],104:[2,78],105:[2,78],109:[2,78],117:[2,78],125:[2,78],127:[2,78],128:[2,78],131:[2,78],132:[2,78],133:[2,78],134:[2,78],135:[2,78],136:[2,78]},{1:[2,79],6:[2,79],25:[2,79],26:[2,79],49:[2,79],54:[2,79],57:[2,79],66:[2,79],67:[2,79],68:[2,79],70:[2,79],72:[2,79],73:[2,79],77:[2,79],83:[2,79],84:[2,79],85:[2,79],90:[2,79],92:[2,79],101:[2,79],103:[2,79],104:[2,79],105:[2,79],109:[2,79],117:[2,79],125:[2,79],127:[2,79],128:[2,79],131:[2,79],132:[2,79],133:[2,79],134:[2,79],135:[2,79],136:[2,79]},{1:[2,105],6:[2,105],25:[2,105],26:[2,105],49:[2,105],54:[2,105],57:[2,105],66:[2,105],67:[2,105],68:[2,105],70:[2,105],72:[2,105],73:[2,105],77:[2,105],81:104,83:[2,105],84:[1,105],85:[2,105],90:[2,105],92:[2,105],101:[2,105],103:[2,105],104:[2,105],105:[2,105],109:[2,105],117:[2,105],125:[2,105],127:[2,105],128:[2,105],131:[2,105],132:[2,105],133:[2,105],134:[2,105],135:[2,105],136:[2,105]},{6:[2,55],25:[2,55],27:109,28:[1,73],44:110,48:106,49:[2,55],54:[2,55],55:107,56:108,58:111,59:112,75:[1,70],88:[1,113],89:[1,114]},{5:115,25:[1,5]},{8:116,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{8:118,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{8:119,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{13:121,14:122,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:123,44:63,58:47,59:48,61:120,63:25,64:26,65:27,75:[1,70],82:[1,28],87:[1,58],88:[1,59],89:[1,57],100:[1,56]},{13:121,14:122,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:123,44:63,58:47,59:48,61:124,63:25,64:26,65:27,75:[1,70],82:[1,28],87:[1,58],88:[1,59],89:[1,57],100:[1,56]},{1:[2,72],6:[2,72],25:[2,72],26:[2,72],40:[2,72],49:[2,72],54:[2,72],57:[2,72],66:[2,72],67:[2,72],68:[2,72],70:[2,72],72:[2,72],73:[2,72],77:[2,72],79:[1,128],83:[2,72],84:[2,72],85:[2,72],90:[2,72],92:[2,72],101:[2,72],103:[2,72],104:[2,72],105:[2,72],109:[2,72],117:[2,72],125:[2,72],127:[2,72],128:[2,72],129:[1,125],130:[1,126],131:[2,72],132:[2,72],133:[2,72],134:[2,72],135:[2,72],136:[2,72],137:[1,127]},{1:[2,180],6:[2,180],25:[2,180],26:[2,180],49:[2,180],54:[2,180],57:[2,180],72:[2,180],77:[2,180],85:[2,180],90:[2,180],92:[2,180],101:[2,180],103:[2,180],104:[2,180],105:[2,180],109:[2,180],117:[2,180],120:[1,129],125:[2,180],127:[2,180],128:[2,180],131:[2,180],132:[2,180],133:[2,180],134:[2,180],135:[2,180],136:[2,180]},{5:130,25:[1,5]},{5:131,25:[1,5]},{1:[2,147],6:[2,147],25:[2,147],26:[2,147],49:[2,147],54:[2,147],57:[2,147],72:[2,147],77:[2,147],85:[2,147],90:[2,147],92:[2,147],101:[2,147],103:[2,147],104:[2,147],105:[2,147],109:[2,147],117:[2,147],125:[2,147],127:[2,147],128:[2,147],131:[2,147],132:[2,147],133:[2,147],134:[2,147],135:[2,147],136:[2,147]},{5:132,25:[1,5]},{8:133,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,25:[1,134],27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{1:[2,95],5:135,6:[2,95],13:121,14:122,25:[1,5],26:[2,95],27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:123,44:63,49:[2,95],54:[2,95],57:[2,95],58:47,59:48,61:137,63:25,64:26,65:27,72:[2,95],75:[1,70],77:[2,95],79:[1,136],82:[1,28],85:[2,95],87:[1,58],88:[1,59],89:[1,57],90:[2,95],92:[2,95],100:[1,56],101:[2,95],103:[2,95],104:[2,95],105:[2,95],109:[2,95],117:[2,95],125:[2,95],127:[2,95],128:[2,95],131:[2,95],132:[2,95],133:[2,95],134:[2,95],135:[2,95],136:[2,95]},{8:138,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{1:[2,47],6:[2,47],8:139,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,26:[2,47],27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],101:[2,47],102:39,103:[2,47],105:[2,47],106:40,107:[1,67],108:41,109:[2,47],110:69,118:[1,42],123:37,124:[1,64],125:[2,47],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{1:[2,48],6:[2,48],25:[2,48],26:[2,48],54:[2,48],77:[2,48],101:[2,48],103:[2,48],105:[2,48],109:[2,48],125:[2,48]},{1:[2,73],6:[2,73],25:[2,73],26:[2,73],40:[2,73],49:[2,73],54:[2,73],57:[2,73],66:[2,73],67:[2,73],68:[2,73],70:[2,73],72:[2,73],73:[2,73],77:[2,73],83:[2,73],84:[2,73],85:[2,73],90:[2,73],92:[2,73],101:[2,73],103:[2,73],104:[2,73],105:[2,73],109:[2,73],117:[2,73],125:[2,73],127:[2,73],128:[2,73],131:[2,73],132:[2,73],133:[2,73],134:[2,73],135:[2,73],136:[2,73]},{1:[2,74],6:[2,74],25:[2,74],26:[2,74],40:[2,74],49:[2,74],54:[2,74],57:[2,74],66:[2,74],67:[2,74],68:[2,74],70:[2,74],72:[2,74],73:[2,74],77:[2,74],83:[2,74],84:[2,74],85:[2,74],90:[2,74],92:[2,74],101:[2,74],103:[2,74],104:[2,74],105:[2,74],109:[2,74],117:[2,74],125:[2,74],127:[2,74],128:[2,74],131:[2,74],132:[2,74],133:[2,74],134:[2,74],135:[2,74],136:[2,74]},{1:[2,29],6:[2,29],25:[2,29],26:[2,29],49:[2,29],54:[2,29],57:[2,29],66:[2,29],67:[2,29],68:[2,29],70:[2,29],72:[2,29],73:[2,29],77:[2,29],83:[2,29],84:[2,29],85:[2,29],90:[2,29],92:[2,29],101:[2,29],103:[2,29],104:[2,29],105:[2,29],109:[2,29],117:[2,29],125:[2,29],127:[2,29],128:[2,29],131:[2,29],132:[2,29],133:[2,29],134:[2,29],135:[2,29],136:[2,29]},{1:[2,30],6:[2,30],25:[2,30],26:[2,30],49:[2,30],54:[2,30],57:[2,30],66:[2,30],67:[2,30],68:[2,30],70:[2,30],72:[2,30],73:[2,30],77:[2,30],83:[2,30],84:[2,30],85:[2,30],90:[2,30],92:[2,30],101:[2,30],103:[2,30],104:[2,30],105:[2,30],109:[2,30],117:[2,30],125:[2,30],127:[2,30],128:[2,30],131:[2,30],132:[2,30],133:[2,30],134:[2,30],135:[2,30],136:[2,30]},{1:[2,31],6:[2,31],25:[2,31],26:[2,31],49:[2,31],54:[2,31],57:[2,31],66:[2,31],67:[2,31],68:[2,31],70:[2,31],72:[2,31],73:[2,31],77:[2,31],83:[2,31],84:[2,31],85:[2,31],90:[2,31],92:[2,31],101:[2,31],103:[2,31],104:[2,31],105:[2,31],109:[2,31],117:[2,31],125:[2,31],127:[2,31],128:[2,31],131:[2,31],132:[2,31],133:[2,31],134:[2,31],135:[2,31],136:[2,31]},{1:[2,32],6:[2,32],25:[2,32],26:[2,32],49:[2,32],54:[2,32],57:[2,32],66:[2,32],67:[2,32],68:[2,32],70:[2,32],72:[2,32],73:[2,32],77:[2,32],83:[2,32],84:[2,32],85:[2,32],90:[2,32],92:[2,32],101:[2,32],103:[2,32],104:[2,32],105:[2,32],109:[2,32],117:[2,32],125:[2,32],127:[2,32],128:[2,32],131:[2,32],132:[2,32],133:[2,32],134:[2,32],135:[2,32],136:[2,32]},{1:[2,33],6:[2,33],25:[2,33],26:[2,33],49:[2,33],54:[2,33],57:[2,33],66:[2,33],67:[2,33],68:[2,33],70:[2,33],72:[2,33],73:[2,33],77:[2,33],83:[2,33],84:[2,33],85:[2,33],90:[2,33],92:[2,33],101:[2,33],103:[2,33],104:[2,33],105:[2,33],109:[2,33],117:[2,33],125:[2,33],127:[2,33],128:[2,33],131:[2,33],132:[2,33],133:[2,33],134:[2,33],135:[2,33],136:[2,33]},{1:[2,34],6:[2,34],25:[2,34],26:[2,34],49:[2,34],54:[2,34],57:[2,34],66:[2,34],67:[2,34],68:[2,34],70:[2,34],72:[2,34],73:[2,34],77:[2,34],83:[2,34],84:[2,34],85:[2,34],90:[2,34],92:[2,34],101:[2,34],103:[2,34],104:[2,34],105:[2,34],109:[2,34],117:[2,34],125:[2,34],127:[2,34],128:[2,34],131:[2,34],132:[2,34],133:[2,34],134:[2,34],135:[2,34],136:[2,34]},{1:[2,35],6:[2,35],25:[2,35],26:[2,35],49:[2,35],54:[2,35],57:[2,35],66:[2,35],67:[2,35],68:[2,35],70:[2,35],72:[2,35],73:[2,35],77:[2,35],83:[2,35],84:[2,35],85:[2,35],90:[2,35],92:[2,35],101:[2,35],103:[2,35],104:[2,35],105:[2,35],109:[2,35],117:[2,35],125:[2,35],127:[2,35],128:[2,35],131:[2,35],132:[2,35],133:[2,35],134:[2,35],135:[2,35],136:[2,35]},{4:140,7:4,8:6,9:7,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,25:[1,141],27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{8:142,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,25:[1,146],27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,60:147,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],86:144,87:[1,58],88:[1,59],89:[1,57],90:[1,143],93:145,95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{1:[2,111],6:[2,111],25:[2,111],26:[2,111],49:[2,111],54:[2,111],57:[2,111],66:[2,111],67:[2,111],68:[2,111],70:[2,111],72:[2,111],73:[2,111],77:[2,111],83:[2,111],84:[2,111],85:[2,111],90:[2,111],92:[2,111],101:[2,111],103:[2,111],104:[2,111],105:[2,111],109:[2,111],117:[2,111],125:[2,111],127:[2,111],128:[2,111],131:[2,111],132:[2,111],133:[2,111],134:[2,111],135:[2,111],136:[2,111]},{1:[2,112],6:[2,112],25:[2,112],26:[2,112],27:148,28:[1,73],49:[2,112],54:[2,112],57:[2,112],66:[2,112],67:[2,112],68:[2,112],70:[2,112],72:[2,112],73:[2,112],77:[2,112],83:[2,112],84:[2,112],85:[2,112],90:[2,112],92:[2,112],101:[2,112],103:[2,112],104:[2,112],105:[2,112],109:[2,112],117:[2,112],125:[2,112],127:[2,112],128:[2,112],131:[2,112],132:[2,112],133:[2,112],134:[2,112],135:[2,112],136:[2,112]},{25:[2,51]},{25:[2,52]},{1:[2,68],6:[2,68],25:[2,68],26:[2,68],40:[2,68],49:[2,68],54:[2,68],57:[2,68],66:[2,68],67:[2,68],68:[2,68],70:[2,68],72:[2,68],73:[2,68],77:[2,68],79:[2,68],83:[2,68],84:[2,68],85:[2,68],90:[2,68],92:[2,68],101:[2,68],103:[2,68],104:[2,68],105:[2,68],109:[2,68],117:[2,68],125:[2,68],127:[2,68],128:[2,68],129:[2,68],130:[2,68],131:[2,68],132:[2,68],133:[2,68],134:[2,68],135:[2,68],136:[2,68],137:[2,68]},{1:[2,71],6:[2,71],25:[2,71],26:[2,71],40:[2,71],49:[2,71],54:[2,71],57:[2,71],66:[2,71],67:[2,71],68:[2,71],70:[2,71],72:[2,71],73:[2,71],77:[2,71],79:[2,71],83:[2,71],84:[2,71],85:[2,71],90:[2,71],92:[2,71],101:[2,71],103:[2,71],104:[2,71],105:[2,71],109:[2,71],117:[2,71],125:[2,71],127:[2,71],128:[2,71],129:[2,71],130:[2,71],131:[2,71],132:[2,71],133:[2,71],134:[2,71],135:[2,71],136:[2,71],137:[2,71]},{8:149,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{8:150,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{8:151,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{5:152,8:153,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,25:[1,5],27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{27:158,28:[1,73],44:159,58:160,59:161,64:154,75:[1,70],88:[1,113],89:[1,57],112:155,113:[1,156],114:157},{111:162,115:[1,163],116:[1,164]},{6:[2,90],11:168,25:[2,90],27:169,28:[1,73],29:170,30:[1,71],31:[1,72],41:166,42:167,44:171,46:[1,46],54:[2,90],76:165,77:[2,90],88:[1,113]},{1:[2,27],6:[2,27],25:[2,27],26:[2,27],43:[2,27],49:[2,27],54:[2,27],57:[2,27],66:[2,27],67:[2,27],68:[2,27],70:[2,27],72:[2,27],73:[2,27],77:[2,27],83:[2,27],84:[2,27],85:[2,27],90:[2,27],92:[2,27],101:[2,27],103:[2,27],104:[2,27],105:[2,27],109:[2,27],117:[2,27],125:[2,27],127:[2,27],128:[2,27],131:[2,27],132:[2,27],133:[2,27],134:[2,27],135:[2,27],136:[2,27]},{1:[2,28],6:[2,28],25:[2,28],26:[2,28],43:[2,28],49:[2,28],54:[2,28],57:[2,28],66:[2,28],67:[2,28],68:[2,28],70:[2,28],72:[2,28],73:[2,28],77:[2,28],83:[2,28],84:[2,28],85:[2,28],90:[2,28],92:[2,28],101:[2,28],103:[2,28],104:[2,28],105:[2,28],109:[2,28],117:[2,28],125:[2,28],127:[2,28],128:[2,28],131:[2,28],132:[2,28],133:[2,28],134:[2,28],135:[2,28],136:[2,28]},{1:[2,26],6:[2,26],25:[2,26],26:[2,26],40:[2,26],43:[2,26],49:[2,26],54:[2,26],57:[2,26],66:[2,26],67:[2,26],68:[2,26],70:[2,26],72:[2,26],73:[2,26],77:[2,26],79:[2,26],83:[2,26],84:[2,26],85:[2,26],90:[2,26],92:[2,26],101:[2,26],103:[2,26],104:[2,26],105:[2,26],109:[2,26],115:[2,26],116:[2,26],117:[2,26],125:[2,26],127:[2,26],128:[2,26],129:[2,26],130:[2,26],131:[2,26],132:[2,26],133:[2,26],134:[2,26],135:[2,26],136:[2,26],137:[2,26]},{1:[2,6],6:[2,6],7:172,8:6,9:7,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,26:[2,6],27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],101:[2,6],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{1:[2,3]},{1:[2,24],6:[2,24],25:[2,24],26:[2,24],49:[2,24],54:[2,24],57:[2,24],72:[2,24],77:[2,24],85:[2,24],90:[2,24],92:[2,24],97:[2,24],98:[2,24],101:[2,24],103:[2,24],104:[2,24],105:[2,24],109:[2,24],117:[2,24],120:[2,24],122:[2,24],125:[2,24],127:[2,24],128:[2,24],131:[2,24],132:[2,24],133:[2,24],134:[2,24],135:[2,24],136:[2,24]},{6:[1,74],26:[1,173]},{1:[2,191],6:[2,191],25:[2,191],26:[2,191],49:[2,191],54:[2,191],57:[2,191],72:[2,191],77:[2,191],85:[2,191],90:[2,191],92:[2,191],101:[2,191],103:[2,191],104:[2,191],105:[2,191],109:[2,191],117:[2,191],125:[2,191],127:[2,191],128:[2,191],131:[2,191],132:[2,191],133:[2,191],134:[2,191],135:[2,191],136:[2,191]},{8:174,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{8:175,9:117,10:20,11:21,12:[1,22],13:8,14
gitextract___33l_r6/ ├── .eslintrc ├── .gitignore ├── .travis.yml ├── CHANGELOG.md ├── CONTRIBUTING.md ├── README.md ├── bower.json ├── gulpfile.js ├── lib/ │ ├── jquery.waypoints.js │ ├── noframework.waypoints.js │ ├── shortcuts/ │ │ ├── infinite.js │ │ ├── inview.js │ │ └── sticky.js │ ├── waypoints.debug.js │ └── zepto.waypoints.js ├── licenses.txt ├── package.json ├── src/ │ ├── adapters/ │ │ ├── jquery-zepto-fn-extension.js │ │ ├── jquery.js │ │ ├── noframework.js │ │ └── zepto.js │ ├── context.js │ ├── debug.js │ ├── group.js │ ├── shortcuts/ │ │ ├── infinite.js │ │ ├── inview.js │ │ └── sticky.js │ └── waypoint.js ├── test/ │ ├── adapter-fn-spec.js │ ├── context-spec.js │ ├── debug-spec.js │ ├── fixtures/ │ │ ├── infinite.html │ │ ├── standard.html │ │ └── sticky.html │ ├── group-spec.js │ ├── infinite-spec.js │ ├── inview-spec.js │ ├── lib/ │ │ ├── coffee-script.js │ │ ├── jasmine-html.js │ │ ├── jasmine-jquery.js │ │ ├── jasmine.css │ │ ├── jasmine.js │ │ ├── require.js │ │ └── testloader.js │ ├── settings.js │ ├── sticky-spec.js │ └── waypoint-spec.js └── testem.json
SYMBOL INDEX (134 symbols across 28 files)
FILE: gulpfile.js
function fileHeader (line 20) | function fileHeader(title) {
FILE: lib/jquery.waypoints.js
function Waypoint (line 14) | function Waypoint(options) {
function requestAnimationFrameShim (line 174) | function requestAnimationFrameShim(callback) {
function Context (line 184) | function Context(element) {
function resizeHandler (line 234) | function resizeHandler() {
function scrollHandler (line 250) | function scrollHandler() {
function byTriggerPoint (line 483) | function byTriggerPoint(a, b) {
function byReverseTriggerPoint (line 487) | function byReverseTriggerPoint(a, b) {
function Group (line 498) | function Group(options) {
function JQueryAdapter (line 591) | function JQueryAdapter(element) {
function createExtension (line 631) | function createExtension(framework) {
FILE: lib/noframework.waypoints.js
function Waypoint (line 14) | function Waypoint(options) {
function requestAnimationFrameShim (line 174) | function requestAnimationFrameShim(callback) {
function Context (line 184) | function Context(element) {
function resizeHandler (line 234) | function resizeHandler() {
function scrollHandler (line 250) | function scrollHandler() {
function byTriggerPoint (line 483) | function byTriggerPoint(a, b) {
function byReverseTriggerPoint (line 487) | function byReverseTriggerPoint(a, b) {
function Group (line 498) | function Group(options) {
function isWindow (line 590) | function isWindow(element) {
function getWindow (line 594) | function getWindow(element) {
function NoFrameworkAdapter (line 601) | function NoFrameworkAdapter(element) {
function removeListeners (line 617) | function removeListeners(element, listeners, handler) {
function merge (line 722) | function merge(target, obj) {
FILE: lib/shortcuts/infinite.js
function Infinite (line 14) | function Infinite(options) {
FILE: lib/shortcuts/inview.js
function noop (line 10) | function noop() {}
function Inview (line 15) | function Inview(options) {
FILE: lib/shortcuts/sticky.js
function Sticky (line 14) | function Sticky(options) {
FILE: lib/waypoints.debug.js
function checkWaypointStyles (line 21) | function checkWaypointStyles() {
FILE: lib/zepto.waypoints.js
function Waypoint (line 14) | function Waypoint(options) {
function requestAnimationFrameShim (line 174) | function requestAnimationFrameShim(callback) {
function Context (line 184) | function Context(element) {
function resizeHandler (line 234) | function resizeHandler() {
function scrollHandler (line 250) | function scrollHandler() {
function byTriggerPoint (line 483) | function byTriggerPoint(a, b) {
function byReverseTriggerPoint (line 487) | function byReverseTriggerPoint(a, b) {
function Group (line 498) | function Group(options) {
function ZeptoAdapter (line 591) | function ZeptoAdapter(element) {
function createDimensionMethod (line 619) | function createDimensionMethod($element, includeBorder) {
function createExtension (line 674) | function createExtension(framework) {
FILE: src/adapters/jquery-zepto-fn-extension.js
function createExtension (line 6) | function createExtension(framework) {
FILE: src/adapters/jquery.js
function JQueryAdapter (line 7) | function JQueryAdapter(element) {
FILE: src/adapters/noframework.js
function isWindow (line 6) | function isWindow(element) {
function getWindow (line 10) | function getWindow(element) {
function NoFrameworkAdapter (line 17) | function NoFrameworkAdapter(element) {
function removeListeners (line 33) | function removeListeners(element, listeners, handler) {
function merge (line 138) | function merge(target, obj) {
FILE: src/adapters/zepto.js
function ZeptoAdapter (line 7) | function ZeptoAdapter(element) {
function createDimensionMethod (line 35) | function createDimensionMethod($element, includeBorder) {
FILE: src/context.js
function requestAnimationFrameShim (line 4) | function requestAnimationFrameShim(callback) {
function Context (line 14) | function Context(element) {
function resizeHandler (line 64) | function resizeHandler() {
function scrollHandler (line 80) | function scrollHandler() {
FILE: src/debug.js
function checkWaypointStyles (line 15) | function checkWaypointStyles() {
FILE: src/group.js
function byTriggerPoint (line 4) | function byTriggerPoint(a, b) {
function byReverseTriggerPoint (line 8) | function byReverseTriggerPoint(a, b) {
function Group (line 19) | function Group(options) {
FILE: src/shortcuts/infinite.js
function Infinite (line 8) | function Infinite(options) {
FILE: src/shortcuts/inview.js
function noop (line 4) | function noop() {}
function Inview (line 9) | function Inview(options) {
FILE: src/shortcuts/sticky.js
function Sticky (line 8) | function Sticky(options) {
FILE: src/waypoint.js
function Waypoint (line 8) | function Waypoint(options) {
FILE: test/adapter-fn-spec.js
function handler (line 39) | function handler() {}
FILE: test/context-spec.js
function setDirection (line 13) | function setDirection(direction) {
FILE: test/inview-spec.js
function setsTrue (line 15) | function setsTrue(key) {
function toBeTrue (line 22) | function toBeTrue(key) {
FILE: test/lib/coffee-script.js
function require (line 8) | function require(a){return require[a]}
function a (line 8) | function a(){}
function a (line 8) | function a(){}
function o (line 8) | function o(){var a;a=b.lexer.lex()||1,typeof a!="number"&&(a=b.symbols_[...
function n (line 8) | function n(a){c.length=c.length-2*a,d.length=d.length-a,e.length=e.lengt...
function a (line 8) | function a(b,c,d){this.parent=b,this.expressions=c,this.method=d,this.va...
function d (line 8) | function d(){this.constructor=a}
function a (line 8) | function a(){}
function b (line 8) | function b(a){this.expressions=Z(bb(a||[]))}
function b (line 8) | function b(a){this.value=a}
function b (line 8) | function b(){return b.__super__.constructor.apply(this,arguments)}
function b (line 8) | function b(){return b.__super__.constructor.apply(this,arguments)}
function b (line 8) | function b(a){this.val=a}
function b (line 8) | function b(a){a&&!a.unwrap().isUndefined&&(this.expression=a)}
function b (line 8) | function b(a,c,d){if(!c&&a instanceof b)return a;this.base=a,this.proper...
function b (line 8) | function b(a){this.comment=a}
function c (line 8) | function c(a,b,c){this.args=b!=null?b:[],this.soak=c,this.isNew=!1,this....
function b (line 8) | function b(a,b){this.child=a,this.parent=b}
function b (line 8) | function b(a,b){this.name=a,this.name.asKey=!0,this.soak=b==="soak"}
function b (line 8) | function b(a){this.index=a}
function b (line 8) | function b(a,b,c){this.from=a,this.to=b,this.exclusive=c==="exclusive",t...
function b (line 8) | function b(a){this.range=a,b.__super__.constructor.call(this)}
function b (line 8) | function b(a,b){this.generated=b!=null?b:!1,this.objects=this.properties...
function b (line 8) | function b(a){this.objects=a||[]}
function c (line 8) | function c(a,b,c){this.variable=a,this.parent=b,this.body=c!=null?c:new ...
function c (line 8) | function c(a,b,c,d){var e,f,g;this.variable=a,this.value=b,this.context=...
function b (line 8) | function b(a,b,c){this.params=a||[],this.body=b||new f,this.bound=c==="b...
function b (line 8) | function b(a,b,c){var d;this.name=a,this.value=b,this.splat=c;if(d=a=thi...
function b (line 8) | function b(a){this.name=a.compile?a:new A(a)}
function b (line 8) | function b(a,b){this.condition=(b!=null?b.invert:void 0)?a.invert():a,th...
function e (line 8) | function e(a,c,d,e){if(a==="in")return new s(c,d);if(a==="do")return thi...
function b (line 8) | function b(a,b){this.object=a,this.array=b}
function b (line 8) | function b(a,b,c,d){this.attempt=a,this.error=b,this.recovery=c,this.ens...
function b (line 8) | function b(a){this.expression=a}
function b (line 8) | function b(a){this.expression=a}
function b (line 8) | function b(a){this.body=a}
function b (line 8) | function b(a,b){var c;this.source=b.source,this.guard=b.guard,this.step=...
function b (line 8) | function b(a,b,c){this.subject=a,this.cases=b,this.otherwise=c}
function b (line 8) | function b(a,b,c){this.body=b,c==null&&(c={}),this.condition=c.type==="u...
FILE: test/lib/jasmine-html.js
function focusedSpecName (line 126) | function focusedSpecName() {
function createReporterDom (line 148) | function createReporterDom(version) {
function noTryCatch (line 165) | function noTryCatch() {
function searchWithCatch (line 169) | function searchWithCatch() {
function setExceptionHandling (line 188) | function setExceptionHandling() {
function showDetails (line 363) | function showDetails() {
function isUndefined (line 369) | function isUndefined(obj) {
function isDefined (line 373) | function isDefined(obj) {
function specPluralizedFor (line 377) | function specPluralizedFor(count) {
FILE: test/lib/jasmine.js
function getGlobal (line 55) | function getGlobal() {
function tryIt (line 621) | function tryIt(f) {
FILE: test/lib/require.js
function isFunction (line 42) | function isFunction(it) {
function isArray (line 46) | function isArray(it) {
function each (line 54) | function each(ary, func) {
function eachReverse (line 69) | function eachReverse(ary, func) {
function hasProp (line 80) | function hasProp(obj, prop) {
function getOwn (line 84) | function getOwn(obj, prop) {
function eachProp (line 93) | function eachProp(obj, func) {
function mixin (line 108) | function mixin(target, source, force, deepStringMixin) {
function bind (line 128) | function bind(obj, fn) {
function scripts (line 134) | function scripts() {
function getGlobal (line 140) | function getGlobal(value) {
function makeError (line 159) | function makeError(id, msg, err, requireModules) {
function newContext (line 191) | function newContext(contextName) {
function getInteractiveScript (line 1855) | function getInteractiveScript() {
FILE: test/lib/testloader.js
function testLoader (line 1) | function testLoader(){
FILE: test/waypoint-spec.js
function setHitTrue (line 14) | function setHitTrue() {
function hitToBeTrue (line 18) | function hitToBeTrue() {
function incrementHitCount (line 285) | function incrementHitCount() {
Condensed preview — 48 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (553K chars).
[
{
"path": ".eslintrc",
"chars": 567,
"preview": "{\n \"env\": {\n \"browser\": true,\n \"node\": true\n },\n\n \"rules\": {\n \"brace-style\": [1, \"stroustrup\"],\n \"consist"
},
{
"path": ".gitignore",
"chars": 75,
"preview": "_site\n.sass-cache\n.DS_Store\n/style.scss\n*.gz\nnode_modules\nbower_components\n"
},
{
"path": ".travis.yml",
"chars": 108,
"preview": "language: node_js\nsudo: false\nnode_js:\n - \"0.10\"\nbefore_script:\n - npm install -g bower\n - bower install\n"
},
{
"path": "CHANGELOG.md",
"chars": 6588,
"preview": "# Changelog\n\n## v4.0.1\n\n- Improve performance of `enableAll`. (Issue #454)\n- Handle edge case bug where Waypoint initial"
},
{
"path": "CONTRIBUTING.md",
"chars": 1722,
"preview": "# Opening an Issue\n\nThe GitHub issue tracker is exclusively for opening demonstrable bugs with the library or for discus"
},
{
"path": "README.md",
"chars": 1674,
"preview": "# Waypoints\r\n\r\nWaypoints is a library that makes it easy to execute a function whenever you scroll to an element. ![Buil"
},
{
"path": "bower.json",
"chars": 375,
"preview": "{\n \"name\": \"waypoints\",\n \"main\": \"lib/noframework.waypoints.js\",\n \"description\": \"Easily execute a function when you "
},
{
"path": "gulpfile.js",
"chars": 2681,
"preview": "var gulp = require('gulp')\nvar eslint = require('gulp-eslint')\nvar concat = require('gulp-concat')\nvar uglify = require("
},
{
"path": "lib/jquery.waypoints.js",
"chars": 17945,
"preview": "/*!\nWaypoints - 4.0.1\nCopyright © 2011-2016 Caleb Troughton\nLicensed under the MIT license.\nhttps://github.com/imakewebt"
},
{
"path": "lib/noframework.waypoints.js",
"chars": 21111,
"preview": "/*!\nWaypoints - 4.0.1\nCopyright © 2011-2016 Caleb Troughton\nLicensed under the MIT license.\nhttps://github.com/imakewebt"
},
{
"path": "lib/shortcuts/infinite.js",
"chars": 2218,
"preview": "/*!\nWaypoints Infinite Scroll Shortcut - 4.0.1\nCopyright © 2011-2016 Caleb Troughton\nLicensed under the MIT license.\nhtt"
},
{
"path": "lib/shortcuts/inview.js",
"chars": 2803,
"preview": "/*!\nWaypoints Inview Shortcut - 4.0.1\nCopyright © 2011-2016 Caleb Troughton\nLicensed under the MIT license.\nhttps://gith"
},
{
"path": "lib/shortcuts/sticky.js",
"chars": 1901,
"preview": "/*!\nWaypoints Sticky Element Shortcut - 4.0.1\nCopyright © 2011-2016 Caleb Troughton\nLicensed under the MIT license.\nhttp"
},
{
"path": "lib/waypoints.debug.js",
"chars": 1412,
"preview": "/*!\nWaypoints Debug - 4.0.1\nCopyright © 2011-2016 Caleb Troughton\nLicensed under the MIT license.\nhttps://github.com/ima"
},
{
"path": "lib/zepto.waypoints.js",
"chars": 19216,
"preview": "/*!\nWaypoints - 4.0.1\nCopyright © 2011-2016 Caleb Troughton\nLicensed under the MIT license.\nhttps://github.com/imakewebt"
},
{
"path": "licenses.txt",
"chars": 1153,
"preview": "Copyright (c) 2011-2012 Caleb Troughton\n\n-----------------------------------------------------------------------\n\nThe MI"
},
{
"path": "package.json",
"chars": 834,
"preview": "{\n \"name\": \"waypoints\",\n \"version\": \"4.0.1\",\n \"author\": \"Caleb Troughton <caleb@imakewebthings.com> (http://imakewebt"
},
{
"path": "src/adapters/jquery-zepto-fn-extension.js",
"chars": 867,
"preview": "(function() {\n 'use strict'\n\n var Waypoint = window.Waypoint\n\n function createExtension(framework) {\n return funct"
},
{
"path": "src/adapters/jquery.js",
"chars": 771,
"preview": "(function() {\n 'use strict'\n\n var $ = window.jQuery\n var Waypoint = window.Waypoint\n\n function JQueryAdapter(element"
},
{
"path": "src/adapters/noframework.js",
"chars": 4805,
"preview": "(function() {\n 'use strict'\n\n var Waypoint = window.Waypoint\n\n function isWindow(element) {\n return element === el"
},
{
"path": "src/adapters/zepto.js",
"chars": 2042,
"preview": "(function() {\n 'use strict'\n\n var $ = window.Zepto\n var Waypoint = window.Waypoint\n\n function ZeptoAdapter(element) "
},
{
"path": "src/context.js",
"chars": 9097,
"preview": "(function() {\n 'use strict'\n\n function requestAnimationFrameShim(callback) {\n window.setTimeout(callback, 1000 / 60"
},
{
"path": "src/debug.js",
"chars": 1241,
"preview": "(function() {\n 'use strict'\n\n var displayNoneMessage = [\n 'You have a Waypoint element with display none. For more "
},
{
"path": "src/group.js",
"chars": 2727,
"preview": "(function() {\n 'use strict'\n\n function byTriggerPoint(a, b) {\n return a.triggerPoint - b.triggerPoint\n }\n\n functi"
},
{
"path": "src/shortcuts/infinite.js",
"chars": 2028,
"preview": "(function() {\n 'use strict'\n\n var $ = window.jQuery\n var Waypoint = window.Waypoint\n\n /* http://imakewebthings.com/w"
},
{
"path": "src/shortcuts/inview.js",
"chars": 2622,
"preview": "(function() {\n 'use strict'\n\n function noop() {}\n\n var Waypoint = window.Waypoint\n\n /* http://imakewebthings.com/way"
},
{
"path": "src/shortcuts/sticky.js",
"chars": 1712,
"preview": "(function() {\n 'use strict'\n\n var $ = window.jQuery\n var Waypoint = window.Waypoint\n\n /* http://imakewebthings.com/w"
},
{
"path": "src/waypoint.js",
"chars": 4314,
"preview": "(function() {\n 'use strict'\n\n var keyCounter = 0\n var allWaypoints = {}\n\n /* http://imakewebthings.com/waypoints/api"
},
{
"path": "test/adapter-fn-spec.js",
"chars": 1739,
"preview": "'use strict'\n/* global\n * describe, it, beforeEach, afterEach, expect, spyOn, waits, runs,\n * waitsFor, loadFixtures, Wa"
},
{
"path": "test/context-spec.js",
"chars": 2849,
"preview": "'use strict'\n/* global\n * describe, it, beforeEach, afterEach, expect, spyOn, runs,\n * loadFixtures, Waypoint\n */\n\nwindo"
},
{
"path": "test/debug-spec.js",
"chars": 1733,
"preview": "'use strict'\n\n/* global\n * describe, it, beforeEach, afterEach, expect, spyOn,\n * loadFixtures, Waypoint\n */\n\ndescribe('"
},
{
"path": "test/fixtures/infinite.html",
"chars": 525,
"preview": "<div class=\"wp-container\">\n <div class=\"infinite-container\">\n <div class=\"infinite-item\"></div>\n <div class=\"infi"
},
{
"path": "test/fixtures/standard.html",
"chars": 1139,
"preview": "<div id=\"wp-container\">\n <div id=\"pretop\"></div>\n <div id=\"top\"></div>\n <div class=\"sameposition\" id=\"same1\"></div>\n "
},
{
"path": "test/fixtures/sticky.html",
"chars": 235,
"preview": "<div class=\"wp-container\">\n <div class=\"before\"></div>\n <div class=\"sticky\"></div>\n</div>\n\n<style type=\"text/css\">\n ."
},
{
"path": "test/group-spec.js",
"chars": 2227,
"preview": "'use strict'\n/* global\n * describe, it, beforeEach, afterEach, expect, spyOn,\n * loadFixtures, Waypoint\n */\n\nwindow.jQue"
},
{
"path": "test/infinite-spec.js",
"chars": 2115,
"preview": "'use strict'\n/* global\n * describe, it, beforeEach, afterEach, expect, spyOn, runs,\n * waitsFor, loadFixtures, Waypoint,"
},
{
"path": "test/inview-spec.js",
"chars": 10093,
"preview": "'use strict'\n/* global\n * describe, it, beforeEach, afterEach, expect, spyOn, waits, runs,\n * waitsFor, loadFixtures, Wa"
},
{
"path": "test/lib/coffee-script.js",
"chars": 177228,
"preview": "/**\n * CoffeeScript Compiler v1.3.3\n * http://coffeescript.org\n *\n * Copyright 2011, Jeremy Ashkenas\n * Released under t"
},
{
"path": "test/lib/jasmine-html.js",
"chars": 20765,
"preview": "jasmine.HtmlReporterHelpers = {};\n\njasmine.HtmlReporterHelpers.createDom = function(type, attrs, childrenVarArgs) {\n va"
},
{
"path": "test/lib/jasmine-jquery.js",
"chars": 21648,
"preview": "/*!\nJasmine-jQuery: a set of jQuery helpers for Jasmine tests.\n\nVersion 1.7.0\n\nhttps://github.com/velesin/jasmine-jquery"
},
{
"path": "test/lib/jasmine.css",
"chars": 6537,
"preview": "body { background-color: #eeeeee; padding: 0; margin: 5px; overflow-y: scroll; }\n\n#HTMLReporter { font-size: 11px; font-"
},
{
"path": "test/lib/jasmine.js",
"chars": 70892,
"preview": "var isCommonJS = typeof window == \"undefined\" && typeof exports == \"object\";\n\n/**\n * Top level namespace for Jasmine, a "
},
{
"path": "test/lib/require.js",
"chars": 79623,
"preview": "/** vim: et:ts=4:sw=4:sts=4\n * @license RequireJS 2.1.2 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved"
},
{
"path": "test/lib/testloader.js",
"chars": 915,
"preview": "function testLoader(){\n\tvar jasmineEnv = jasmine.getEnv();\n\tjasmineEnv.updateInterval = 1000;\n\n\tvar htmlReporter = new j"
},
{
"path": "test/settings.js",
"chars": 215,
"preview": "/* global jasmine, Waypoint */\n\n'use strict'\n\njasmine.getFixtures().fixturesPath = 'test/fixtures'\njasmine.getEnv().defa"
},
{
"path": "test/sticky-spec.js",
"chars": 3083,
"preview": "'use strict'\n/* global\n * describe, it, beforeEach, afterEach, expect, spyOn, waits, runs,\n * waitsFor, loadFixtures, Wa"
},
{
"path": "test/waypoint-spec.js",
"chars": 16582,
"preview": "'use strict'\n/* global\n * describe, it, beforeEach, afterEach, expect, spyOn, waits, runs,\n * waitsFor, loadFixtures, Wa"
},
{
"path": "testem.json",
"chars": 463,
"preview": "{\n \"framework\": \"jasmine\",\n \"launch_in_dev\": [\n \"PhantomJS\"\n ],\n \"launch_in_ci\": [\n \"PhantomJS\"\n ],\n \"src_fi"
}
]
About this extraction
This page contains the full source code of the imakewebthings/waypoints GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 48 files (522.7 KB), approximately 163.3k tokens, and a symbol index with 134 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.