PageSourceSearch

https://waterliniemuseum.nl/wp-content/cache/min/1/wp-content/plug…/assets/js/waypoint.js?ver=1768898940

js waterliniemuseum.nl collected 2026-10-04 15:12:24 UTC 12,312 bytes, 200 lines download raw bytes

1/*!
2Waypoints - 4.0.0
3Copyright © 2011-2015 Caleb Troughton
4Licensed under the MIT license.
5https://github.com/imakewebthings/waypoints/blog/master/licenses.txt
6*/
7(function(){'use strict'
8var keyCounter=0
9var allWaypoints={}
10function Waypoint(options){if(!options){throw new Error('No options passed to Waypoint constructor')}
11if(!options.element){throw new Error('No element option passed to Waypoint constructor')}
12if(!options.handler){throw new Error('No handler option passed to Waypoint constructor')}
13this.key='waypoint-'+keyCounter
14this.options=Waypoint.Adapter.extend({},Waypoint.defaults,options)
15this.element=this.options.element
16this.adapter=new Waypoint.Adapter(this.element)
17this.callback=options.handler
18this.axis=this.options.horizontal?'horizontal':'vertical'
19this.enabled=this.options.enabled
20this.triggerPoint=null
21this.group=Waypoint.Group.findOrCreate({name:this.options.group,axis:this.axis})
22this.context=Waypoint.Context.findOrCreateByElement(this.options.context)
23if(Waypoint.offsetAliases[this.options.offset]){this.options.offset=Waypoint.offsetAliases[this.options.offset]}
24this.group.add(this)
25this.context.add(this)
26allWaypoints[this.key]=this
27keyCounter+=1}
28Waypoint.prototype.queueTrigger=function(direction){this.group.queueTrigger(this,direction)}
29Waypoint.prototype.trigger=function(args){if(!this.enabled){return}
30if(this.callback){this.callback.apply(this,args)}}
31Waypoint.prototype.destroy=function(){this.context.remove(this)
32this.group.remove(this)
33delete allWaypoints[this.key]}
34Waypoint.prototype.disable=function(){this.enabled=!1
35return this}
36Waypoint.prototype.enable=function(){this.context.refresh()
37this.enabled=!0
38return this}
39Waypoint.prototype.next=function(){return this.group.next(this)}
40Waypoint.prototype.previous=function(){return this.group.previous(this)}
41Waypoint.invokeAll=function(method){var allWaypointsArray=[]
42for(var waypointKey in allWaypoints){allWaypointsArray.push(allWaypoints[waypointKey])}
43for(var i=0,end=allWaypointsArray.length;i<end;i++){allWaypointsArray[i][method]()}}
44Waypoint.destroyAll=function(){Waypoint.invokeAll('destroy')}
45Waypoint.disableAll=function(){Waypoint.invokeAll('disable')}
46Waypoint.enableAll=function(){Waypoint.invokeAll('enable')}
47Waypoint.refreshAll=function(){Waypoint.Context.refreshAll()}
48Waypoint.viewportHeight=function(){return window.innerHeight||document.documentElement.clientHeight}
49Waypoint.viewportWidth=function(){return document.documentElement.clientWidth}
50Waypoint.adapters=[]
51Waypoint.defaults={context:window,continuous:!0,enabled:!0,group:'default',horizontal:!1,offset:0}
52Waypoint.offsetAliases={'bottom-in-view':function(){return this.context.innerHeight()-this.adapter.outerHeight()},'right-in-view':function(){return this.context.innerWidth()-this.adapter.outerWidth()}}
53window.Waypoint=Waypoint}());(function(){'use strict'
54function requestAnimationFrameShim(callback){window.setTimeout(callback,1000/60)}
55var keyCounter=0
56var contexts={}
57var Waypoint=window.Waypoint
58var oldWindowLoad=window.onload
59function Context(element){this.element=element
60this.Adapter=Waypoint.Adapter
61this.adapter=new this.Adapter(element)
62this.key='waypoint-context-'+keyCounter
63this.didScroll=!1
64this.didResize=!1
65this.oldScroll={x:this.adapter.scrollLeft(),y:this.adapter.scrollTop()}
66this.waypoints={vertical:{},horizontal:{}}
67element.waypointContextKey=this.key
68contexts[element.waypointContextKey]=this
69keyCounter+=1
70this.createThrottledScrollHandler()
71this.createThrottledResizeHandler()}
72Context.prototype.add=function(waypoint){var axis=waypoint.options.horizontal?'horizontal':'vertical'
73this.waypoints[axis][waypoint.key]=waypoint
74this.refresh()}
75Context.prototype.checkEmpty=function(){var horizontalEmpty=this.Adapter.isEmptyObject(this.waypoints.horizontal)
76var verticalEmpty=this.Adapter.isEmptyObject(this.waypoints.vertical)
77if(horizontalEmpty&&verticalEmpty){this.adapter.off('.waypoints')
78delete contexts[this.key]}}
79Context.prototype.createThrottledResizeHandler=function(){var self=this
80function resizeHandler(){self.handleResize()
81self.didResize=!1}
82this.adapter.on('resize.waypoints',function(){if(!self.didResize){self.didResize=!0
83Waypoint.requestAnimationFrame(resizeHandler)}})}
84Context.prototype.createThrottledScrollHandler=function(){var self=this
85function scrollHandler(){self.handleScroll()
86self.didScroll=!1}
87this.adapter.on('scroll.waypoints',function(){if(!self.didScroll||Waypoint.isTouch){self.didScroll=!0
88Waypoint.requestAnimationFrame(scrollHandler)}})}
89Context.prototype.handleResize=function(){Waypoint.Context.refreshAll()}
90Context.prototype.handleScroll=function(){var triggeredGroups={}
91var 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'}}
92for(var axisKey in axes){var axis=axes[axisKey]
93var isForward=axis.newScroll>axis.oldScroll
94var direction=isForward?axis.forward:axis.backward
95for(var waypointKey in this.waypoints[axisKey]){var waypoint=this.waypoints[axisKey][waypointKey]
96var wasBeforeTriggerPoint=axis.oldScroll<waypoint.triggerPoint
97var nowAfterTriggerPoint=axis.newScroll>=waypoint.triggerPoint
98var crossedForward=wasBeforeTriggerPoint&&nowAfterTriggerPoint
99var crossedBackward=!wasBeforeTriggerPoint&&!nowAfterTriggerPoint
100if(crossedForward||crossedBackward){waypoint.queueTrigger(direction)
101triggeredGroups[waypoint.group.id]=waypoint.group}}}
102for(var groupKey in triggeredGroups){triggeredGroups[groupKey].flushTriggers()}
103this.oldScroll={x:axes.horizontal.newScroll,y:axes.vertical.newScroll}}
104Context.prototype.innerHeight=function(){if(this.element==this.element.window){return Waypoint.viewportHeight()}
105return this.adapter.innerHeight()}
106Context.prototype.remove=function(waypoint){delete this.waypoints[waypoint.axis][waypoint.key]
107this.checkEmpty()}
108Context.prototype.innerWidth=function(){if(this.element==this.element.window){return Waypoint.viewportWidth()}
109return this.adapter.innerWidth()}
110Context.prototype.destroy=function(){var allWaypoints=[]
111for(var axis in this.waypoints){for(var waypointKey in this.waypoints[axis]){allWaypoints.push(this.waypoints[axis][waypointKey])}}
112for(var i=0,end=allWaypoints.length;i<end;i++){allWaypoints[i].destroy()}}
113Context.prototype.refresh=function(){var isWindow=this.element==this.element.window
114var contextOffset=isWindow?undefined:this.adapter.offset()
115var triggeredGroups={}
116var axes
117this.handleScroll()
118axes={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'}}
119for(var axisKey in axes){var axis=axes[axisKey]
120for(var waypointKey in this.waypoints[axisKey]){var waypoint=this.waypoints[axisKey][waypointKey]
121var adjustment=waypoint.options.offset
122var oldTriggerPoint=waypoint.triggerPoint
123var elementOffset=0
124var freshWaypoint=oldTriggerPoint==null
125var contextModifier,wasBeforeScroll,nowAfterScroll
126var triggeredBackward,triggeredForward
127if(waypoint.element!==waypoint.element.window){elementOffset=waypoint.adapter.offset()[axis.offsetProp]}
128if(typeof adjustment==='function'){adjustment=adjustment.apply(waypoint)}else if(typeof adjustment==='string'){adjustment=parseFloat(adjustment)
129if(waypoint.options.offset.indexOf('%')>-1){adjustment=Math.ceil(axis.contextDimension*adjustment/100)}}
130contextModifier=axis.contextScroll-axis.contextOffset
131waypoint.triggerPoint=elementOffset+contextModifier-adjustment
132wasBeforeScroll=oldTriggerPoint<axis.oldScroll
133nowAfterScroll=waypoint.triggerPoint>=axis.oldScroll
134triggeredBackward=wasBeforeScroll&&nowAfterScroll
135triggeredForward=!wasBeforeScroll&&!nowAfterScroll
136if(!freshWaypoint&&triggeredBackward){waypoint.queueTrigger(axis.backward)
137triggeredGroups[waypoint.group.id]=waypoint.group}else if(!freshWaypoint&&triggeredForward){waypoint.queueTrigger(axis.forward)
138triggeredGroups[waypoint.group.id]=waypoint.group}else if(freshWaypoint&&axis.oldScroll>=waypoint.triggerPoint){waypoint.queueTrigger(axis.forward)
139triggeredGroups[waypoint.group.id]=waypoint.group}}}
140Waypoint.requestAnimationFrame(function(){for(var groupKey in triggeredGroups){triggeredGroups[groupKey].flushTriggers()}})
141return this}
142Context.findOrCreateByElement=function(element){return Context.findByElement(element)||new Context(element)}
143Context.refreshAll=function(){for(var contextId in contexts){contexts[contextId].refresh()}}
144Context.findByElement=function(element){return contexts[element.waypointContextKey]}
145window.onload=function(){if(oldWindowLoad){oldWindowLoad()}
146Context.refreshAll()}
147Waypoint.requestAnimationFrame=function(callback){var requestFn=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||requestAnimationFrameShim
148requestFn.call(window,callback)}
149Waypoint.Context=Context}());(function(){'use strict'
150function byTriggerPoint(a,b){return a.triggerPoint-b.triggerPoint}
151function byReverseTriggerPoint(a,b){return b.triggerPoint-a.triggerPoint}
152var groups={vertical:{},horizontal:{}}
153var Waypoint=window.Waypoint
154function Group(options){this.name=options.name
155this.axis=options.axis
156this.id=this.name+'-'+this.axis
157this.waypoints=[]
158this.clearTriggerQueues()
159groups[this.axis][this.name]=this}
160Group.prototype.add=function(waypoint){this.waypoints.push(waypoint)}
161Group.prototype.clearTriggerQueues=function(){this.triggerQueues={up:[],down:[],left:[],r
161ight:[]}}
162Group.prototype.flushTriggers=function(){for(var direction in this.triggerQueues){var waypoints=this.triggerQueues[direction]
163var reverse=direction==='up'||direction==='left'
164waypoints.sort(reverse?byReverseTriggerPoint:byTriggerPoint)
165for(var i=0,end=waypoints.length;i<end;i+=1){var waypoint=waypoints[i]
166if(waypoint.options.continuous||i===waypoints.length-1){waypoint.trigger([direction])}}}
167this.clearTriggerQueues()}
168Group.prototype.next=function(waypoint){this.waypoints.sort(byTriggerPoint)
169var index=Waypoint.Adapter.inArray(waypoint,this.waypoints)
170var isLast=index===this.waypoints.length-1
171return isLast?null:this.waypoints[index+1]}
172Group.prototype.previous=function(waypoint){this.waypoints.sort(byTriggerPoint)
173var index=Waypoint.Adapter.inArray(waypoint,this.waypoints)
174return index?this.waypoints[index-1]:null}
175Group.prototype.queueTrigger=function(waypoint,direction){this.triggerQueues[direction].push(waypoint)}
176Group.prototype.remove=function(waypoint){var index=Waypoint.Adapter.inArray(waypoint,this.waypoints)
177if(index>-1){this.waypoints.splice(index,1)}}
178Group.prototype.first=function(){return this.waypoints[0]}
179Group.prototype.last=function(){return this.waypoints[this.waypoints.length-1]}
180Group.findOrCreate=function(options){return groups[options.axis][options.name]||new Group(options)}
181Waypoint.Group=Group}());(function(){'use strict'
182var $=window.jQuery
183var Waypoint=window.Waypoint
184function JQueryAdapter(element){this.$element=$(element)}
185$.each(['innerHeight','innerWidth','off','offset','on','outerHeight','outerWidth','scrollLeft','scrollTop'],function(i,method){JQueryAdapter.prototype[method]=function(){var args=Array.prototype.slice.call(arguments)
186return this.$element[method].apply(this.$element,args)}})
187$.each(['extend','inArray','isEmptyObject'],function(i,method){JQueryAdapter[method]=$[method]})
188Waypoint.adapters.push({name:'jquery',Adapter:JQueryAdapter})
189Waypoint.Adapter=JQueryAdapter}());(function(){'use strict'
190var Waypoint=window.Waypoint
191function createExtension(framework){return function(){var waypoints=[]
192var overrides=arguments[0]
193if(framework.isFunction(arguments[0])){overrides=framework.extend({},arguments[1])
194overrides.handler=arguments[0]}
195this.each(function(){var options=framework.extend({},overrides,{element:this})
196if(typeof options.context==='string'){options.context=framework(this).closest(options.context)[0]}
197waypoints.push(new Waypoint(options))})
198return waypoints}}
199if(window.jQuery){window.jQuery.fn.waypoint=createExtension(window.jQuery)}
200if(window.Zepto){window.Zepto.fn.waypoint=createExtension(window.Zepto)}}())

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.