Skip to content

Commit

Permalink
4.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
imakewebthings committed Sep 3, 2016
1 parent 9122b72 commit 34d9f6d
Show file tree
Hide file tree
Showing 15 changed files with 84 additions and 39 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# 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)
Expand Down
23 changes: 18 additions & 5 deletions lib/jquery.waypoints.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!
Waypoints - 4.0.0
Copyright © 2011-2015 Caleb Troughton
Waypoints - 4.0.1
Copyright © 2011-2016 Caleb Troughton
Licensed under the MIT license.
https://github.com/imakewebthings/waypoints/blob/master/licenses.txt
*/
Expand Down Expand Up @@ -121,7 +121,11 @@ https://github.com/imakewebthings/waypoints/blob/master/licenses.txt
/* Public */
/* http://imakewebthings.com/waypoints/api/enable-all */
Waypoint.enableAll = function() {
Waypoint.invokeAll('enable')
Waypoint.Context.refreshAll()
for (var waypointKey in allWaypoints) {
allWaypoints[waypointKey].enabled = true
}
return this
}

/* Public */
Expand Down Expand Up @@ -196,6 +200,10 @@ https://github.com/imakewebthings/waypoints/blob/master/licenses.txt
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()
Expand All @@ -212,7 +220,8 @@ https://github.com/imakewebthings/waypoints/blob/master/licenses.txt
Context.prototype.checkEmpty = function() {
var horizontalEmpty = this.Adapter.isEmptyObject(this.waypoints.horizontal)
var verticalEmpty = this.Adapter.isEmptyObject(this.waypoints.vertical)
if (horizontalEmpty && verticalEmpty) {
var isWindow = this.element == this.element.window
if (horizontalEmpty && verticalEmpty && !isWindow) {
this.adapter.off('.waypoints')
delete contexts[this.key]
}
Expand Down Expand Up @@ -281,6 +290,9 @@ https://github.com/imakewebthings/waypoints/blob/master/licenses.txt

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
Expand Down Expand Up @@ -400,7 +412,7 @@ https://github.com/imakewebthings/waypoints/blob/master/licenses.txt
}

contextModifier = axis.contextScroll - axis.contextOffset
waypoint.triggerPoint = elementOffset + contextModifier - adjustment
waypoint.triggerPoint = Math.floor(elementOffset + contextModifier - adjustment)
wasBeforeScroll = oldTriggerPoint < axis.oldScroll
nowAfterScroll = waypoint.triggerPoint >= axis.oldScroll
triggeredBackward = wasBeforeScroll && nowAfterScroll
Expand Down Expand Up @@ -455,6 +467,7 @@ https://github.com/imakewebthings/waypoints/blob/master/licenses.txt
Context.refreshAll()
}


Waypoint.requestAnimationFrame = function(callback) {
var requestFn = window.requestAnimationFrame ||
window.mozRequestAnimationFrame ||
Expand Down
6 changes: 3 additions & 3 deletions lib/jquery.waypoints.min.js

Large diffs are not rendered by default.

23 changes: 18 additions & 5 deletions lib/noframework.waypoints.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!
Waypoints - 4.0.0
Copyright © 2011-2015 Caleb Troughton
Waypoints - 4.0.1
Copyright © 2011-2016 Caleb Troughton
Licensed under the MIT license.
https://github.com/imakewebthings/waypoints/blob/master/licenses.txt
*/
Expand Down Expand Up @@ -121,7 +121,11 @@ https://github.com/imakewebthings/waypoints/blob/master/licenses.txt
/* Public */
/* http://imakewebthings.com/waypoints/api/enable-all */
Waypoint.enableAll = function() {
Waypoint.invokeAll('enable')
Waypoint.Context.refreshAll()
for (var waypointKey in allWaypoints) {
allWaypoints[waypointKey].enabled = true
}
return this
}

/* Public */
Expand Down Expand Up @@ -196,6 +200,10 @@ https://github.com/imakewebthings/waypoints/blob/master/licenses.txt
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()
Expand All @@ -212,7 +220,8 @@ https://github.com/imakewebthings/waypoints/blob/master/licenses.txt
Context.prototype.checkEmpty = function() {
var horizontalEmpty = this.Adapter.isEmptyObject(this.waypoints.horizontal)
var verticalEmpty = this.Adapter.isEmptyObject(this.waypoints.vertical)
if (horizontalEmpty && verticalEmpty) {
var isWindow = this.element == this.element.window
if (horizontalEmpty && verticalEmpty && !isWindow) {
this.adapter.off('.waypoints')
delete contexts[this.key]
}
Expand Down Expand Up @@ -281,6 +290,9 @@ https://github.com/imakewebthings/waypoints/blob/master/licenses.txt

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
Expand Down Expand Up @@ -400,7 +412,7 @@ https://github.com/imakewebthings/waypoints/blob/master/licenses.txt
}

contextModifier = axis.contextScroll - axis.contextOffset
waypoint.triggerPoint = elementOffset + contextModifier - adjustment
waypoint.triggerPoint = Math.floor(elementOffset + contextModifier - adjustment)
wasBeforeScroll = oldTriggerPoint < axis.oldScroll
nowAfterScroll = waypoint.triggerPoint >= axis.oldScroll
triggeredBackward = wasBeforeScroll && nowAfterScroll
Expand Down Expand Up @@ -455,6 +467,7 @@ https://github.com/imakewebthings/waypoints/blob/master/licenses.txt
Context.refreshAll()
}


Waypoint.requestAnimationFrame = function(callback) {
var requestFn = window.requestAnimationFrame ||
window.mozRequestAnimationFrame ||
Expand Down
6 changes: 3 additions & 3 deletions lib/noframework.waypoints.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions lib/shortcuts/infinite.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!
Waypoints Infinite Scroll Shortcut - 4.0.0
Copyright © 2011-2015 Caleb Troughton
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
*/
Expand Down
4 changes: 2 additions & 2 deletions lib/shortcuts/infinite.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions lib/shortcuts/inview.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!
Waypoints Inview Shortcut - 4.0.0
Copyright © 2011-2015 Caleb Troughton
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
*/
Expand Down
4 changes: 2 additions & 2 deletions lib/shortcuts/inview.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions lib/shortcuts/sticky.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!
Waypoints Sticky Element Shortcut - 4.0.0
Copyright © 2011-2015 Caleb Troughton
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
*/
Expand Down
4 changes: 2 additions & 2 deletions lib/shortcuts/sticky.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions lib/waypoints.debug.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!
Waypoints Debug - 4.0.0
Copyright © 2011-2015 Caleb Troughton
Waypoints Debug - 4.0.1
Copyright © 2011-2016 Caleb Troughton
Licensed under the MIT license.
https://github.com/imakewebthings/waypoints/blob/master/licenses.txt
*/
Expand Down
23 changes: 18 additions & 5 deletions lib/zepto.waypoints.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!
Waypoints - 4.0.0
Copyright © 2011-2015 Caleb Troughton
Waypoints - 4.0.1
Copyright © 2011-2016 Caleb Troughton
Licensed under the MIT license.
https://github.com/imakewebthings/waypoints/blob/master/licenses.txt
*/
Expand Down Expand Up @@ -121,7 +121,11 @@ https://github.com/imakewebthings/waypoints/blob/master/licenses.txt
/* Public */
/* http://imakewebthings.com/waypoints/api/enable-all */
Waypoint.enableAll = function() {
Waypoint.invokeAll('enable')
Waypoint.Context.refreshAll()
for (var waypointKey in allWaypoints) {
allWaypoints[waypointKey].enabled = true
}
return this
}

/* Public */
Expand Down Expand Up @@ -196,6 +200,10 @@ https://github.com/imakewebthings/waypoints/blob/master/licenses.txt
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()
Expand All @@ -212,7 +220,8 @@ https://github.com/imakewebthings/waypoints/blob/master/licenses.txt
Context.prototype.checkEmpty = function() {
var horizontalEmpty = this.Adapter.isEmptyObject(this.waypoints.horizontal)
var verticalEmpty = this.Adapter.isEmptyObject(this.waypoints.vertical)
if (horizontalEmpty && verticalEmpty) {
var isWindow = this.element == this.element.window
if (horizontalEmpty && verticalEmpty && !isWindow) {
this.adapter.off('.waypoints')
delete contexts[this.key]
}
Expand Down Expand Up @@ -281,6 +290,9 @@ https://github.com/imakewebthings/waypoints/blob/master/licenses.txt

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
Expand Down Expand Up @@ -400,7 +412,7 @@ https://github.com/imakewebthings/waypoints/blob/master/licenses.txt
}

contextModifier = axis.contextScroll - axis.contextOffset
waypoint.triggerPoint = elementOffset + contextModifier - adjustment
waypoint.triggerPoint = Math.floor(elementOffset + contextModifier - adjustment)
wasBeforeScroll = oldTriggerPoint < axis.oldScroll
nowAfterScroll = waypoint.triggerPoint >= axis.oldScroll
triggeredBackward = wasBeforeScroll && nowAfterScroll
Expand Down Expand Up @@ -455,6 +467,7 @@ https://github.com/imakewebthings/waypoints/blob/master/licenses.txt
Context.refreshAll()
}


Waypoint.requestAnimationFrame = function(callback) {
var requestFn = window.requestAnimationFrame ||
window.mozRequestAnimationFrame ||
Expand Down
Loading

0 comments on commit 34d9f6d

Please sign in to comment.