PageSourceSearch

https://munksjo.com/wp-content/themes/uncode/library/js/lib/inview.js?ver=1061000167

js munksjo.com collected 2026-10-02 11:11:15 UTC 2,805 bytes, 120 lines download raw bytes

1/*!
2Waypoints Inview Shortcut - 4.0.1
3Copyright © 2011-2016 Caleb Troughton
4Licensed under the MIT license.
5https://github.com/imakewebthings/waypoints/blob/master/licenses.txt
6*/
7(function() {
8  'use strict'
9
10  function noop() {}
11
12  var Waypoint = window.Waypoint
13
14  /* http://imakewebthings.com/waypoints/shortcuts/inview */
15  function Inview(options) {
16    this.options = Waypoint.Adapter.extend({}, Inview.defaults, options)
17    this.axis = this.options.horizontal ? 'horizontal' : 'vertical'
18    this.waypoints = []
19    this.element = this.options.element
20    this.createWaypoints()
21  }
22
23  /* Private */
24  Inview.prototype.createWaypoints = function() {
25    var configs = {
26      vertical: [{
27        down: 'enter',
28        up: 'exited',
29        offset: '100%'
30      }, {
31        down: 'entered',
32        up: 'exit',
33        offset: 'bottom-in-view'
34      }, {
35        down: 'exit',
36        up: 'entered',
37        offset: 0
38      }, {
39        down: 'exited',
40        up: 'enter',
41        offset: function() {
42          return -this.adapter.outerHeight()
43        }
44      }],
45      horizontal: [{
46        right: 'enter',
47        left: 'exited',
48        offset: '100%'
49      }, {
50        right: 'entered',
51        left: 'exit',
52        offset: 'right-in-view'
53      }, {
54        right: 'exit',
55        left: 'entered',
56        offset: 0
57      }, {
58        right: 'exited',
59        left: 'enter',
60        offset: function() {
61          return -this.adapter.outerWidth()
62        }
63      }]
64    }
65
66    for (var i = 0, end = configs[this.axis].length; i < end; i++) {
67      var config = configs[this.axis][i]
68      this.createWaypoint(config)
69    }
70  }
71
72  /* Private */
73  Inview.prototype.createWaypoint = function(config) {
74    var self = this
75    this.waypoints.push(new Waypoint({
76      context: this.options.context,
77      element: this.options.element,
78      enabled: this.options.enabled,
79      handler: (function(config) {
80        return function(direction) {
81          self.options[config[direction]].call(self, direction)
82        }
83      }(config)),
84      offset: config.offset,
85      horizontal: this.options.horizontal
86    }))
87  }
88
89  /* Public */
90  Inview.prototype.destroy = function() {
91    for (var i = 0, end = this.waypoints.length; i < end; i++) {
92      this.waypoints[i].destroy()
93    }
94    this.waypoints = []
95  }
96
97  Inview.prototype.disable = function() {
98    for (var i = 0, end = this.waypoints.length; i < end; i++) {
99      this.waypoints[i].disable()
100    }
101  }
102
103  Inview.prototype.enable = function() {
104    for (var i = 0, end = this.waypoints.length; i < end; i++) {
105      this.waypoints[i].enable()
106    }
107  }
108
109  Inview.defaults = {
110    context: window,
111    enabled: true,
112    enter: noop,
113    entered: noop,
114    exit: noop,
115    exited: noop
116  }
117
118  Waypoint.Inview = Inview
119}())
120;

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.