1 | 1 |
deleted file mode 100644 |
... | ... |
@@ -1,84 +0,0 @@ |
1 |
-/*! |
|
2 |
-Waypoints Infinite Scroll Shortcut - 3.1.1 |
|
3 |
-Copyright © 2011-2015 Caleb Troughton |
|
4 |
-Licensed under the MIT license. |
|
5 |
-https://github.com/imakewebthings/waypoints/blog/master/licenses.txt |
|
6 |
-*/ |
|
7 |
-(function() { |
|
8 |
- 'use strict' |
|
9 |
- |
|
10 |
- var $ = window.jQuery |
|
11 |
- var Waypoint = window.Waypoint |
|
12 |
- |
|
13 |
- /* http://imakewebthings.com/waypoints/shortcuts/infinite-scroll */ |
|
14 |
- function Infinite(options) { |
|
15 |
- this.options = $.extend({}, Infinite.defaults, options) |
|
16 |
- this.container = this.options.element |
|
17 |
- if (this.options.container !== 'auto') { |
|
18 |
- this.container = this.options.container |
|
19 |
- } |
|
20 |
- this.$container = $(this.container) |
|
21 |
- this.$more = $(this.options.more) |
|
22 |
- |
|
23 |
- if (this.$more.length) { |
|
24 |
- this.setupHandler() |
|
25 |
- this.waypoint = new Waypoint(this.options) |
|
26 |
- } |
|
27 |
- } |
|
28 |
- |
|
29 |
- /* Private */ |
|
30 |
- Infinite.prototype.setupHandler = function() { |
|
31 |
- this.options.handler = $.proxy(function() { |
|
32 |
- this.options.onBeforePageLoad() |
|
33 |
- this.destroy() |
|
34 |
- this.$container.addClass(this.options.loadingClass) |
|
35 |
- |
|
36 |
- $.get($(this.options.more).attr('href'), $.proxy(function(data) { |
|
37 |
- var $data = $($.parseHTML(data)) |
|
38 |
- var $newMore = $data.find(this.options.more) |
|
39 |
- |
|
40 |
- var $items = $data.find(this.options.items) |
|
41 |
- if (!$items.length) { |
|
42 |
- $items = $data.filter(this.options.items) |
|
43 |
- } |
|
44 |
- |
|
45 |
- this.$container.append($items) |
|
46 |
- this.$container.removeClass(this.options.loadingClass) |
|
47 |
- |
|
48 |
- if (!$newMore.length) { |
|
49 |
- $newMore = $data.filter(this.options.more) |
|
50 |
- } |
|
51 |
- if ($newMore.length) { |
|
52 |
- this.$more.replaceWith($newMore) |
|
53 |
- this.$more = $newMore |
|
54 |
- this.waypoint = new Waypoint(this.options) |
|
55 |
- } |
|
56 |
- else { |
|
57 |
- this.$more.remove() |
|
58 |
- } |
|
59 |
- |
|
60 |
- this.options.onAfterPageLoad() |
|
61 |
- }, this)) |
|
62 |
- }, this) |
|
63 |
- } |
|
64 |
- |
|
65 |
- /* Public */ |
|
66 |
- Infinite.prototype.destroy = function() { |
|
67 |
- if (this.waypoint) { |
|
68 |
- this.waypoint.destroy() |
|
69 |
- } |
|
70 |
- } |
|
71 |
- |
|
72 |
- Infinite.defaults = { |
|
73 |
- container: 'auto', |
|
74 |
- items: '.infinite-item', |
|
75 |
- more: '.infinite-more-link', |
|
76 |
- offset: 'bottom-in-view', |
|
77 |
- loadingClass: 'infinite-loading', |
|
78 |
- onBeforePageLoad: $.noop, |
|
79 |
- onAfterPageLoad: $.noop |
|
80 |
- } |
|
81 |
- |
|
82 |
- Waypoint.Infinite = Infinite |
|
83 |
-}()) |
|
84 |
-; |
|
85 | 0 |
\ No newline at end of file |
1 | 1 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,84 @@ |
1 |
+/*! |
|
2 |
+Waypoints Infinite Scroll Shortcut - 3.1.1 |
|
3 |
+Copyright © 2011-2015 Caleb Troughton |
|
4 |
+Licensed under the MIT license. |
|
5 |
+https://github.com/imakewebthings/waypoints/blog/master/licenses.txt |
|
6 |
+*/ |
|
7 |
+(function() { |
|
8 |
+ 'use strict' |
|
9 |
+ |
|
10 |
+ var $ = window.jQuery |
|
11 |
+ var Waypoint = window.Waypoint |
|
12 |
+ |
|
13 |
+ /* http://imakewebthings.com/waypoints/shortcuts/infinite-scroll */ |
|
14 |
+ function Infinite(options) { |
|
15 |
+ this.options = $.extend({}, Infinite.defaults, options) |
|
16 |
+ this.container = this.options.element |
|
17 |
+ if (this.options.container !== 'auto') { |
|
18 |
+ this.container = this.options.container |
|
19 |
+ } |
|
20 |
+ this.$container = $(this.container) |
|
21 |
+ this.$more = $(this.options.more) |
|
22 |
+ |
|
23 |
+ if (this.$more.length) { |
|
24 |
+ this.setupHandler() |
|
25 |
+ this.waypoint = new Waypoint(this.options) |
|
26 |
+ } |
|
27 |
+ } |
|
28 |
+ |
|
29 |
+ /* Private */ |
|
30 |
+ Infinite.prototype.setupHandler = function() { |
|
31 |
+ this.options.handler = $.proxy(function() { |
|
32 |
+ this.options.onBeforePageLoad() |
|
33 |
+ this.destroy() |
|
34 |
+ this.$container.addClass(this.options.loadingClass) |
|
35 |
+ |
|
36 |
+ $.get($(this.options.more).attr('href'), $.proxy(function(data) { |
|
37 |
+ var $data = $($.parseHTML(data)) |
|
38 |
+ var $newMore = $data.find(this.options.more) |
|
39 |
+ |
|
40 |
+ var $items = $data.find(this.options.items) |
|
41 |
+ if (!$items.length) { |
|
42 |
+ $items = $data.filter(this.options.items) |
|
43 |
+ } |
|
44 |
+ |
|
45 |
+ this.$container.append($items) |
|
46 |
+ this.$container.removeClass(this.options.loadingClass) |
|
47 |
+ |
|
48 |
+ if (!$newMore.length) { |
|
49 |
+ $newMore = $data.filter(this.options.more) |
|
50 |
+ } |
|
51 |
+ if ($newMore.length) { |
|
52 |
+ this.$more.replaceWith($newMore) |
|
53 |
+ this.$more = $newMore |
|
54 |
+ this.waypoint = new Waypoint(this.options) |
|
55 |
+ } |
|
56 |
+ else { |
|
57 |
+ this.$more.remove() |
|
58 |
+ } |
|
59 |
+ |
|
60 |
+ this.options.onAfterPageLoad() |
|
61 |
+ }, this)) |
|
62 |
+ }, this) |
|
63 |
+ } |
|
64 |
+ |
|
65 |
+ /* Public */ |
|
66 |
+ Infinite.prototype.destroy = function() { |
|
67 |
+ if (this.waypoint) { |
|
68 |
+ this.waypoint.destroy() |
|
69 |
+ } |
|
70 |
+ } |
|
71 |
+ |
|
72 |
+ Infinite.defaults = { |
|
73 |
+ container: 'auto', |
|
74 |
+ items: '.infinite-item', |
|
75 |
+ more: '.infinite-more-link', |
|
76 |
+ offset: 'bottom-in-view', |
|
77 |
+ loadingClass: 'infinite-loading', |
|
78 |
+ onBeforePageLoad: $.noop, |
|
79 |
+ onAfterPageLoad: $.noop |
|
80 |
+ } |
|
81 |
+ |
|
82 |
+ Waypoint.Infinite = Infinite |
|
83 |
+}()) |
|
84 |
+; |
|
0 | 85 |
\ No newline at end of file |