Version Description
Download this release
Release Info
Developer | shazahm1@hotmail.com |
Plugin | Easy Table of Contents |
Version | 2.0-rc2 |
Comparing to | |
See all releases |
Code changes from version 2.0-rc1 to 2.0-rc2
- assets/css/screen.css +16 -9
- assets/css/screen.min.css +1 -1
- assets/js/front.js +127 -51
- assets/js/front.min.js +1 -6
- easy-table-of-contents.php +10 -6
- includes/class.post.php +5 -1
- vendor/waypoints/jquery.waypoints.js +0 -662
- vendor/waypoints/jquery.waypoints.min.js +0 -7
assets/css/screen.css
CHANGED
@@ -12,10 +12,9 @@
|
|
12 |
width: auto;
|
13 |
}
|
14 |
|
15 |
-
.ez-toc-widget-container {
|
16 |
-
|
17 |
position: relative;
|
18 |
-
white-space: nowrap;
|
19 |
}
|
20 |
|
21 |
#ez-toc-container.ez-toc-light-blue {
|
@@ -34,8 +33,17 @@
|
|
34 |
background: none transparent;
|
35 |
}
|
36 |
|
37 |
-
.ez-toc-widget-container ul
|
38 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
}
|
40 |
|
41 |
#ez-toc-container ul ul,
|
@@ -52,11 +60,10 @@
|
|
52 |
#ez-toc-container ul,
|
53 |
#ez-toc-container li,
|
54 |
#ez-toc-container ul li,
|
55 |
-
.ez-toc-widget-container,
|
56 |
-
.ez-toc-widget-container li {
|
57 |
background: none;
|
58 |
-
list-style
|
59 |
-
list-style: none;
|
60 |
line-height: 1.6;
|
61 |
margin: 0;
|
62 |
overflow: hidden;
|
12 |
width: auto;
|
13 |
}
|
14 |
|
15 |
+
div.ez-toc-widget-container {
|
16 |
+
padding: 0;
|
17 |
position: relative;
|
|
|
18 |
}
|
19 |
|
20 |
#ez-toc-container.ez-toc-light-blue {
|
33 |
background: none transparent;
|
34 |
}
|
35 |
|
36 |
+
div.ez-toc-widget-container ul {
|
37 |
+
display: block;
|
38 |
+
}
|
39 |
+
|
40 |
+
div.ez-toc-widget-container li {
|
41 |
+
border: none;
|
42 |
+
padding: 0;
|
43 |
+
}
|
44 |
+
|
45 |
+
div.ez-toc-widget-container ul.ez-toc-list {
|
46 |
+
padding: 10px;
|
47 |
}
|
48 |
|
49 |
#ez-toc-container ul ul,
|
60 |
#ez-toc-container ul,
|
61 |
#ez-toc-container li,
|
62 |
#ez-toc-container ul li,
|
63 |
+
div.ez-toc-widget-container,
|
64 |
+
div.ez-toc-widget-container li {
|
65 |
background: none;
|
66 |
+
list-style: none none;
|
|
|
67 |
line-height: 1.6;
|
68 |
margin: 0;
|
69 |
overflow: hidden;
|
assets/css/screen.min.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
#ez-toc-container{background:#F9F9F9;border:1px solid #AAA;border-radius:4px;-webkit-box-shadow:0 1px 1px rgba(0,0,0,.05);box-shadow:0 1px 1px rgba(0,0,0,.05);display:table;margin-bottom:1em;padding:10px;position:relative;width:auto}.ez-toc-widget-container{position:relative;
|
1 |
+
#ez-toc-container{background:#F9F9F9;border:1px solid #AAA;border-radius:4px;-webkit-box-shadow:0 1px 1px rgba(0,0,0,.05);box-shadow:0 1px 1px rgba(0,0,0,.05);display:table;margin-bottom:1em;padding:10px;position:relative;width:auto}div.ez-toc-widget-container{padding:0;position:relative;}#ez-toc-container.ez-toc-light-blue{background:#EDF6FF}#ez-toc-container.ez-toc-white{background:#FFF}#ez-toc-container.ez-toc-black{background:#000}#ez-toc-container.ez-toc-transparent{background:none}div.ez-toc-widget-container ul{display:block}div.ez-toc-widget-container li{border:none;padding:0}div.ez-toc-widget-container ul.ez-toc-list{padding:10px}#ez-toc-container ul ul,.ez-toc div.ez-toc-widget-container ul ul{margin-left:1.5em}#ez-toc-container li,#ez-toc-container ul{padding:0}#ez-toc-container li,#ez-toc-container ul,#ez-toc-container ul li,div.ez-toc-widget-container,div.ez-toc-widget-container li{background:0 0;list-style:none;line-height:1.6;margin:0;overflow:hidden;z-index:1}.btn.active,.ez-toc-btn,.ez-toc-btn-default.active,.ez-toc-btn-default:active,.ez-toc-btn:active{background-image:none}#ez-toc-container p.ez-toc-title{text-align:left;line-height:1.45;margin:0;padding:0}.ez-toc-title-container{display:table;width:100%}.ez-toc-title,.ez-toc-title-toggle{display:table-cell;text-align:left;vertical-align:middle}#ez-toc-container.ez-toc-black p.ez-toc-title{color:#FFF}#ez-toc-container div.ez-toc-title-container+ul.ez-toc-list{margin-top:1em}.ez-toc-wrap-left{float:left;margin-right:10px}.ez-toc-wrap-right{float:right;margin-left:10px}#ez-toc-container a{color:#444;text-decoration:none;text-shadow:none}#ez-toc-container a:visited{color:#9f9f9f}#ez-toc-container a:hover{text-decoration:underline}#ez-toc-container.ez-toc-black a,#ez-toc-container.ez-toc-black a:visited{color:#FFF}#ez-toc-container a.ez-toc-toggle{color:#444}#ez-toc-container.counter-flat ul,#ez-toc-container.counter-hierarchy ul,.ez-toc-widget-container.counter-flat ul,.ez-toc-widget-container.counter-hierarchy ul{counter-reset:item}#ez-toc-container.counter-numeric li,.ez-toc-widget-container.counter-numeric li{list-style-type:decimal;list-style-position:inside}#ez-toc-container.counter-decimal ul.ez-toc-list li a::before,.ez-toc-widget-container.counter-decimal ul.ez-toc-list li a::before{content:counters(item,".") ". ";counter-increment:item}#ez-toc-container.counter-roman li a::before,.ez-toc-widget-container.counter-roman ul.ez-toc-list li a::before{content:counters(item,".",upper-roman) ". ";counter-increment:item}.ez-toc-widget-container ul.ez-toc-list li::before{content:' ';position:absolute;left:0;right:0;height:30px;line-height:30px;z-index:-1}.ez-toc-widget-container ul.ez-toc-list li.active::before{background-color:#EDEDED}.ez-toc-widget-container li.active>a{font-weight:900}.ez-toc-btn{display:inline-block;padding:6px 12px;margin-bottom:0;font-size:14px;font-weight:400;line-height:1.428571429;text-align:center;white-space:nowrap;vertical-align:middle;cursor:pointer;border:1px solid transparent;border-radius:4px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;-o-user-select:none;user-select:none}.ez-toc-btn:focus{outline:#333 dotted thin;outline:-webkit-focus-ring-color auto 5px;outline-offset:-2px}.ez-toc-btn:focus,.ez-toc-btn:hover{color:#333;text-decoration:none}.ez-toc-btn.active,.ez-toc-btn:active{background-image:none;outline:0;-webkit-box-shadow:inset 0 3px 5px rgba(0,0,0,.125);box-shadow:inset 0 3px 5px rgba(0,0,0,.125)}.ez-toc-btn-default{color:#333;background-color:#fff;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.15),0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 0 rgba(255,255,255,.15),0 1px 1px rgba(0,0,0,.075)}.ez-toc-btn-default.active,.ez-toc-btn-default:active,.ez-toc-btn-default:focus,.ez-toc-btn-default:hover{color:#333;background-color:#ebebeb;border-color:#adadad}.ez-toc-btn-sm,.ez-toc-btn-xs{padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}.ez-toc-glyphicon,[class*=ez-toc-icon-]{font-style:normal;font-weight:400;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.ez-toc-btn-xs{padding:1px 5px}.ez-toc-btn-default:active{-webkit-box-shadow:inset 0 3px 5px rgba(0,0,0,.125);box-shadow:inset 0 3px 5px rgba(0,0,0,.125)}.ez-toc-btn-default{text-shadow:0 1px 0 #fff;background-image:-webkit-gradient(linear,left 0,left 100%,from(#fff),to(#e0e0e0));background-image:-webkit-linear-gradient(top,#fff 0,#e0e0e0 100%);background-image:-moz-linear-gradient(top,#fff 0,#e0e0e0 100%);background-image:linear-gradient(to bottom,#fff 0,#e0e0e0 100%);background-repeat:repeat-x;border-color:#ccc;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#ffe0e0e0', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.ez-toc-btn-default:focus,.ez-toc-btn-default:hover{background-color:#e0e0e0;background-position:0 -15px}.ez-toc-btn-default.active,.ez-toc-btn-default:active{background-color:#e0e0e0;border-color:#dbdbdb}.ez-toc-pull-right{float:right!important;margin-left:10px}.ez-toc-glyphicon{position:relative;top:1px;display:inline-block;font-family:'Glyphicons Halflings'}.ez-toc-glyphicon:empty{width:1em}.ez-toc-toggle i.ez-toc-glyphicon{font-size:16px;margin-left:2px}[class*=ez-toc-icon-]{font-family:ez-toc-icomoon!important;speak:none;font-variant:normal;text-transform:none}.ez-toc-icon-toggle:before{content:"\e87a"}
|
assets/js/front.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
jQuery(
|
2 |
|
3 |
if ( typeof ezTOC != 'undefined' ) {
|
4 |
|
@@ -99,8 +99,11 @@ jQuery( document ).ready( function( $ ) {
|
|
99 |
if ( target ) {
|
100 |
$.smoothScroll( {
|
101 |
scrollTarget: target,
|
102 |
-
offset: offset
|
|
|
|
|
103 |
} );
|
|
|
104 |
}
|
105 |
}
|
106 |
} );
|
@@ -167,54 +170,127 @@ jQuery( document ).ready( function( $ ) {
|
|
167 |
} );
|
168 |
}
|
169 |
|
170 |
-
// ======================================
|
171 |
-
// Waypoints helper functions
|
172 |
-
// ======================================
|
173 |
-
|
174 |
-
// Get link by section or article id
|
175 |
-
function getRelatedNavigation( element ) {
|
176 |
-
return $( '.ez-toc-widget-container .ez-toc-list a[href="#' + $( element ).attr( 'id' ) + '"]' );
|
177 |
-
}
|
178 |
-
|
179 |
-
function getScrollOffset( element ) {
|
180 |
-
|
181 |
-
var scrollOffset = ( typeof ezTOC.scroll_offset != 'undefined' ) ? parseInt( ezTOC.scroll_offset ) : 30;
|
182 |
-
var offset = $( element ).height() + scrollOffset;
|
183 |
-
|
184 |
-
var adminbar = $( '#wpadminbar' );
|
185 |
-
|
186 |
-
if ( 0 === adminbar.length ) {
|
187 |
-
|
188 |
-
offset = offset-30;
|
189 |
-
}
|
190 |
-
|
191 |
-
return parseInt( offset );
|
192 |
-
}
|
193 |
-
|
194 |
-
// ======================================
|
195 |
-
// Waypoints
|
196 |
-
// ======================================
|
197 |
-
|
198 |
-
$('span.ez-toc-section')
|
199 |
-
.waypoint( function( direction ) {
|
200 |
-
// Highlight element when related content is 10% percent from the bottom - remove if below.
|
201 |
-
var item = getRelatedNavigation( this.element ).toggleClass( 'active', direction === 'down' );
|
202 |
-
item.toggleClass( 'active', direction === 'down' ).parent().toggleClass( 'active', direction === 'down' );
|
203 |
-
}, {
|
204 |
-
offset: '90%' //
|
205 |
-
});
|
206 |
-
$('span.ez-toc-section')
|
207 |
-
.waypoint( function( direction ) {
|
208 |
-
// Highlight element when bottom of related content is 30px from the top - remove if less.
|
209 |
-
var item = getRelatedNavigation( this.element ).toggleClass( 'active', direction === 'up' );
|
210 |
-
item.toggleClass( 'active', direction === 'up' ).parent().toggleClass( 'active', direction === 'up' );
|
211 |
-
}, {
|
212 |
-
offset: getScrollOffset( this.element )
|
213 |
-
});
|
214 |
-
|
215 |
-
|
216 |
-
var div_height = $('.ez-toc-widget-container ul.ez-toc-list li').css('line-height');
|
217 |
|
218 |
-
|
219 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
220 |
} );
|
1 |
+
jQuery( function( $ ) {
|
2 |
|
3 |
if ( typeof ezTOC != 'undefined' ) {
|
4 |
|
99 |
if ( target ) {
|
100 |
$.smoothScroll( {
|
101 |
scrollTarget: target,
|
102 |
+
offset: offset,
|
103 |
+
beforeScroll: deactivateSetActiveEzTocListElement,
|
104 |
+
afterScroll: function() { setActiveEzTocListElement(); activateSetActiveEzTocListElement(); }
|
105 |
} );
|
106 |
+
|
107 |
}
|
108 |
}
|
109 |
} );
|
170 |
} );
|
171 |
}
|
172 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
173 |
|
174 |
+
// ======================================
|
175 |
+
// Set active heading in ez-toc-widget list
|
176 |
+
// ======================================
|
177 |
+
|
178 |
+
var headings = $( 'span.ez-toc-section' ).toArray();
|
179 |
+
var headingToListElementLinkMap = getHeadingToListElementLinkMap( headings );
|
180 |
+
var listElementLinks = $.map( headingToListElementLinkMap, function ( value, key ) {
|
181 |
+
return value
|
182 |
+
} );
|
183 |
+
var scrollOffset = getScrollOffset();
|
184 |
+
|
185 |
+
activateSetActiveEzTocListElement();
|
186 |
+
|
187 |
+
function setActiveEzTocListElement() {
|
188 |
+
var activeHeading = getActiveHeading( scrollOffset, headings );
|
189 |
+
if ( activeHeading ) {
|
190 |
+
var activeListElementLink = headingToListElementLinkMap[ activeHeading.id ];
|
191 |
+
removeStyleFromNonActiveListElement( activeListElementLink, listElementLinks );
|
192 |
+
setStyleForActiveListElementElement( activeListElementLink );
|
193 |
+
}
|
194 |
+
};
|
195 |
+
|
196 |
+
function activateSetActiveEzTocListElement() {
|
197 |
+
if ( headings.length > 0 && $('.ez-toc-widget-container').length) {
|
198 |
+
$( window ).on( 'load resize scroll', setActiveEzTocListElement );
|
199 |
+
}
|
200 |
+
}
|
201 |
+
|
202 |
+
function deactivateSetActiveEzTocListElement() {
|
203 |
+
$( window ).off( 'load resize scroll', setActiveEzTocListElement );
|
204 |
+
}
|
205 |
+
|
206 |
+
function getEzTocListElementLinkByHeading( heading ) {
|
207 |
+
return $( '.ez-toc-widget-container .ez-toc-list a[href="#' + $( heading ).attr( 'id' ) + '"]' );
|
208 |
+
}
|
209 |
+
|
210 |
+
function getHeadingToListElementLinkMap( headings ) {
|
211 |
+
return headings.reduce( function ( map, heading ) {
|
212 |
+
map[ heading.id ] = getEzTocListElementLinkByHeading( heading );
|
213 |
+
return map;
|
214 |
+
}, {} );
|
215 |
+
}
|
216 |
+
|
217 |
+
function getScrollOffset() {
|
218 |
+
var scrollOffset = 5; // so if smooth offset is off, the correct title is set as active
|
219 |
+
if ( typeof ezTOC.smooth_scroll != 'undefined' && parseInt( ezTOC.smooth_scroll ) === 1 ) {
|
220 |
+
scrollOffset = ( typeof ezTOC.scroll_offset != 'undefined' ) ? parseInt( ezTOC.scroll_offset ) : 30;
|
221 |
+
}
|
222 |
+
|
223 |
+
var adminbar = $( '#wpadminbar' );
|
224 |
+
|
225 |
+
if ( adminbar.length ) {
|
226 |
+
scrollOffset += adminbar.height();
|
227 |
+
}
|
228 |
+
return scrollOffset;
|
229 |
+
}
|
230 |
+
|
231 |
+
function getActiveHeading( topOffset, headings ) {
|
232 |
+
var scrollTop = $( window ).scrollTop();
|
233 |
+
var relevantOffset = scrollTop + topOffset + 1;
|
234 |
+
var activeHeading = headings[ 0 ];
|
235 |
+
var closestHeadingAboveOffset = relevantOffset - $( activeHeading ).offset().top;
|
236 |
+
headings.forEach( function ( section ) {
|
237 |
+
var topOffset = relevantOffset - $( section ).offset().top;
|
238 |
+
if ( topOffset > 0 && topOffset < closestHeadingAboveOffset ) {
|
239 |
+
closestHeadingAboveOffset = topOffset;
|
240 |
+
activeHeading = section;
|
241 |
+
}
|
242 |
+
} );
|
243 |
+
return activeHeading;
|
244 |
+
}
|
245 |
+
|
246 |
+
function removeStyleFromNonActiveListElement( activeListElementLink, listElementLinks ) {
|
247 |
+
listElementLinks.forEach( function ( listElementLink ) {
|
248 |
+
if ( activeListElementLink !== listElementLink && listElementLink.parent().hasClass( 'active' ) ) {
|
249 |
+
listElementLink.parent().removeClass( 'active' );
|
250 |
+
}
|
251 |
+
} );
|
252 |
+
}
|
253 |
+
|
254 |
+
function correctActiveListElementBackgroundColorHeight( activeListElement ) {
|
255 |
+
var listElementHeight = getListElementHeightWithoutUlChildren( activeListElement );
|
256 |
+
addListElementBackgroundColorHeightStyleToHead( listElementHeight );
|
257 |
+
}
|
258 |
+
|
259 |
+
function getListElementHeightWithoutUlChildren( listElement ) {
|
260 |
+
var $listElement = $( listElement );
|
261 |
+
var content = $listElement.html();
|
262 |
+
// Adding list item with class '.active' to get the real height.
|
263 |
+
// When adding a class to an existing element and using jQuery(..).height() directly afterwards,
|
264 |
+
// the height is the 'old' height. The height might change due to text-wraps when setting the text-weight bold for example
|
265 |
+
// When adding a new item, the height is calculated correctly.
|
266 |
+
// But only when it might be visible (so display:none; is not possible...)
|
267 |
+
// But because it get's directly removed afterwards it never will be rendered by the browser
|
268 |
+
// (at least in my tests in FF, Chrome, IE11 and Edge)
|
269 |
+
$listElement.parent().append( '<li id="ez-toc-height-test" class="active">' + content + '</li>' );
|
270 |
+
var height = jQuery( '#ez-toc-height-test' ).height();
|
271 |
+
jQuery( '#ez-toc-height-test' ).remove();
|
272 |
+
return height - $listElement.children( 'ul' ).first().height();
|
273 |
+
}
|
274 |
+
|
275 |
+
function addListElementBackgroundColorHeightStyleToHead( listElementHeight ) {
|
276 |
+
// Remove existing
|
277 |
+
$( '#ez-toc-active-height' ).remove();
|
278 |
+
// jQuery(..).css(..) doesn't work, because ::before is a pseudo element and not part of the DOM
|
279 |
+
// Workaround is to add it to head
|
280 |
+
$( '<style id="ez-toc-active-height">' +
|
281 |
+
'.ez-toc-widget-container ul.ez-toc-list li.active::before {' +
|
282 |
+
// 'line-heigh:' + listElementHeight + 'px; ' +
|
283 |
+
'height:' + listElementHeight + 'px;' +
|
284 |
+
'} </style>' )
|
285 |
+
.appendTo( 'head' );
|
286 |
+
}
|
287 |
+
|
288 |
+
function setStyleForActiveListElementElement( activeListElementLink ) {
|
289 |
+
var activeListElement = activeListElementLink.parent();
|
290 |
+
if ( !activeListElement.hasClass( 'active' ) ) {
|
291 |
+
activeListElement.addClass( 'active' );
|
292 |
+
}
|
293 |
+
correctActiveListElementBackgroundColorHeight( activeListElement );
|
294 |
+
}
|
295 |
+
}
|
296 |
} );
|
assets/js/front.min.js
CHANGED
@@ -1,6 +1 @@
|
|
1 |
-
jQuery(
|
2 |
-
"")};if(1==ezTOC.smooth_scroll){var d=hostname=pathname=qs=hash=null;a("body a").click(function(b){hostname=a(this).prop("hostname");pathname=a(this).prop("pathname");qs=a(this).prop("search");hash=a(this).prop("hash");0<pathname.length&&"/"!=pathname.charAt(0)&&(pathname="/"+pathname);window.location.hostname==hostname&&window.location.pathname==pathname&&window.location.search==qs&&""!==hash&&(b=hash.replace(/([ !"$%&'()*+,.\/:;<=>?@[\]^`{|}~])/g,"\\$1"),0<a(b).length?d=hash:(anchor=hash,anchor=
|
3 |
-
anchor.replace("#",""),d='a[name="'+anchor+'"]',0==a(d).length&&(d="")),"undefined"!=typeof ezTOC.scroll_offset?b=-1*ezTOC.scroll_offset:(b=a("#wpadminbar"),b=0<b.length?b.is(":visible")?-30:0:0),d&&a.smoothScroll({scrollTarget:d,offset:b}))})}if("undefined"!=typeof ezTOC.visibility_hide_by_default){c=a("a.ez-toc-toggle");var e=ezTOC.visibility_hide_by_default;Cookies?1==Cookies.get("ezTOC_hidetoc")?c.data("visible",!1):c.data("visible",!0):c.data("visible",!0);e&&c.data("visible",!1);c.data("visible")||
|
4 |
-
a("ul.ez-toc-list").hide();c.click(function(b){b.preventDefault();a(this).data("visible")?(a(this).data("visible",!1),Cookies&&(e?Cookies.set("ezTOC_hidetoc",null,{path:"/"}):Cookies.set("ezTOC_hidetoc","1",{expires:30,path:"/"})),a("ul.ez-toc-list").hide("fast")):(a(this).data("visible",!0),Cookies&&(e?Cookies.set("ezTOC_hidetoc","1",{expires:30,path:"/"}):Cookies.set("ezTOC_hidetoc",null,{path:"/"})),a("ul.ez-toc-list").show("fast"))})}a("span.ez-toc-section").waypoint(function(a){f(this.element).toggleClass("active",
|
5 |
-
"down"===a).toggleClass("active","down"===a).parent().toggleClass("active","down"===a)},{offset:"90%"});a("span.ez-toc-section").waypoint(function(a){f(this.element).toggleClass("active","up"===a).toggleClass("active","up"===a).parent().toggleClass("active","up"===a)},{offset:function(b){var c="undefined"!=typeof ezTOC.scroll_offset?parseInt(ezTOC.scroll_offset):30;b=a(b).height()+c;0===a("#wpadminbar").length&&(b-=30);return parseInt(b)}(this.element)});c=a(".ez-toc-widget-container ul.ez-toc-list li").css("line-height");
|
6 |
-
a("<style>.ez-toc-widget-container ul.ez-toc-list li::before{line-height:"+c+";height:"+c+"}</style>").appendTo("head")}});
|
1 |
+
jQuery(function(l){if("undefined"!=typeof ezTOC){if(0!==l(".ez-toc-widget-container.ez-toc-affix").length){var e=30;void 0!==ezTOC.scroll_offset&&(e=ezTOC.scroll_offset),l(ezTOC.affixSelector).stick_in_parent({inner_scrolling:!1,offset_top:parseInt(e)})}if(l.fn.shrinkTOCWidth=function(){l(this).css({width:"auto",display:"table"}),/MSIE 7\./.test(navigator.userAgent)&&l(this).css("width","")},1==ezTOC.smooth_scroll){var a=hostname=pathname=qs=hash=null;l("body a").click(function(e){if(hostname=l(this).prop("hostname"),pathname=l(this).prop("pathname"),qs=l(this).prop("search"),hash=l(this).prop("hash"),0<pathname.length&&"/"!=pathname.charAt(0)&&(pathname="/"+pathname),window.location.hostname==hostname&&window.location.pathname==pathname&&window.location.search==qs&&""!==hash){var t=hash.replace(/([ !"$%&'()*+,.\/:;<=>?@[\]^`{|}~])/g,"\\$1");if(0<l(t).length?a=hash:(anchor=hash,anchor=anchor.replace("#",""),a='a[name="'+anchor+'"]',0==l(a).length&&(a="")),void 0!==ezTOC.scroll_offset)var i=-1*ezTOC.scroll_offset;else{var o=l("#wpadminbar");i=0<o.length&&o.is(":visible")?-30:0}a&&l.smoothScroll({scrollTarget:a,offset:i,beforeScroll:h,afterScroll:function(){s(),n()}})}})}if(void 0!==ezTOC.visibility_hide_by_default){var t=l("a.ez-toc-toggle"),i=ezTOC.visibility_hide_by_default;Cookies&&1==Cookies.get("ezTOC_hidetoc")?t.data("visible",!1):t.data("visible",!0),i&&t.data("visible",!1),t.data("visible")||l("ul.ez-toc-list").hide(),t.click(function(e){e.preventDefault(),l(this).data("visible")?(l(this).data("visible",!1),Cookies&&(i?Cookies.set("ezTOC_hidetoc",null,{path:"/"}):Cookies.set("ezTOC_hidetoc","1",{expires:30,path:"/"})),l("ul.ez-toc-list").hide("fast")):(l(this).data("visible",!0),Cookies&&(i?Cookies.set("ezTOC_hidetoc","1",{expires:30,path:"/"}):Cookies.set("ezTOC_hidetoc",null,{path:"/"})),l("ul.ez-toc-list").show("fast"))})}var r=l("span.ez-toc-section").toArray(),c=r.reduce(function(e,t){return e[t.id]=l('.ez-toc-widget-container .ez-toc-list a[href="#'+l(t).attr("id")+'"]'),e},{}),f=l.map(c,function(e,t){return e}),d=function(){var e=5;void 0!==ezTOC.smooth_scroll&&1===parseInt(ezTOC.smooth_scroll)&&(e=void 0!==ezTOC.scroll_offset?parseInt(ezTOC.scroll_offset):30);var t=l("#wpadminbar");t.length&&(e+=t.height());return e}();function s(){var e,t,i,o,a,s,n=(e=d,t=r,i=l(window).scrollTop()+e+1,o=t[0],a=i-l(o).offset().top,t.forEach(function(e){var t=i-l(e).offset().top;0<t&&t<a&&(a=t,o=e)}),o);if(n){var h=c[n.id];s=h,f.forEach(function(e){s!==e&&e.parent().hasClass("active")&&e.parent().removeClass("active")}),function(e){var t=e.parent();t.hasClass("active")||t.addClass("active");i=t,o=function(e){var t=l(e),i=t.html();t.parent().append('<li id="ez-toc-height-test" class="active">'+i+"</li>");var o=jQuery("#ez-toc-height-test").height();return jQuery("#ez-toc-height-test").remove(),o-t.children("ul").first().height()}(i),l("#ez-toc-active-height").remove(),l('<style id="ez-toc-active-height">.ez-toc-widget-container ul.ez-toc-list li.active::before {height:'+o+"px;} </style>").appendTo("head");var i,o}(h)}}function n(){0<r.length&&l(".ez-toc-widget-container").length&&l(window).on("load resize scroll",s)}function h(){l(window).off("load resize scroll",s)}n()}});
|
|
|
|
|
|
|
|
|
|
easy-table-of-contents.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: Easy Table of Contents
|
4 |
* Plugin URI: http://connections-pro.com/
|
5 |
* Description: Adds a user friendly and fully automatic way to create and display a table of contents generated from the page content.
|
6 |
-
* Version: 2.0-
|
7 |
* Author: Steven A. Zahm
|
8 |
* Author URI: http://connections-pro.com/
|
9 |
* Text Domain: easy-table-of-contents
|
@@ -26,7 +26,7 @@
|
|
26 |
* @package Easy Table of Contents
|
27 |
* @category Plugin
|
28 |
* @author Steven A. Zahm
|
29 |
-
* @version 2.0-
|
30 |
*/
|
31 |
|
32 |
// Exit if accessed directly
|
@@ -45,7 +45,7 @@ if ( ! class_exists( 'ezTOC' ) ) {
|
|
45 |
* @since 1.0
|
46 |
* @var string
|
47 |
*/
|
48 |
-
const VERSION = '2.0-
|
49 |
|
50 |
/**
|
51 |
* Stores the instance of this class.
|
@@ -224,8 +224,7 @@ if ( ! class_exists( 'ezTOC' ) ) {
|
|
224 |
wp_register_script( 'js-cookie', EZ_TOC_URL . "vendor/js-cookie/js.cookie$min.js", array(), '2.0.3', TRUE );
|
225 |
wp_register_script( 'jquery-smooth-scroll', EZ_TOC_URL . "vendor/smooth-scroll/jquery.smooth-scroll$min.js", array( 'jquery' ), '1.5.5', TRUE );
|
226 |
wp_register_script( 'jquery-sticky-kit', EZ_TOC_URL . "vendor/sticky-kit/jquery.sticky-kit$min.js", array( 'jquery' ), '1.9.2', TRUE );
|
227 |
-
wp_register_script( '
|
228 |
-
wp_register_script( 'ez-toc-js', EZ_TOC_URL . "assets/js/front$min.js", array( 'jquery-smooth-scroll', 'js-cookie', 'jquery-sticky-kit', 'jquery-waypoints' ), ezTOC::VERSION, TRUE );
|
229 |
|
230 |
if ( ! ezTOC_Option::get( 'exclude_css' ) ) {
|
231 |
|
@@ -542,7 +541,12 @@ if ( ! class_exists( 'ezTOC' ) ) {
|
|
542 |
return $content;
|
543 |
}
|
544 |
|
545 |
-
$post = ezTOC_Post::get( get_the_ID() )
|
|
|
|
|
|
|
|
|
|
|
546 |
|
547 |
$find = $post->getHeadings();
|
548 |
$replace = $post->getHeadingsWithAnchors();
|
3 |
* Plugin Name: Easy Table of Contents
|
4 |
* Plugin URI: http://connections-pro.com/
|
5 |
* Description: Adds a user friendly and fully automatic way to create and display a table of contents generated from the page content.
|
6 |
+
* Version: 2.0-rc2
|
7 |
* Author: Steven A. Zahm
|
8 |
* Author URI: http://connections-pro.com/
|
9 |
* Text Domain: easy-table-of-contents
|
26 |
* @package Easy Table of Contents
|
27 |
* @category Plugin
|
28 |
* @author Steven A. Zahm
|
29 |
+
* @version 2.0-rc2
|
30 |
*/
|
31 |
|
32 |
// Exit if accessed directly
|
45 |
* @since 1.0
|
46 |
* @var string
|
47 |
*/
|
48 |
+
const VERSION = '2.0-rc2';
|
49 |
|
50 |
/**
|
51 |
* Stores the instance of this class.
|
224 |
wp_register_script( 'js-cookie', EZ_TOC_URL . "vendor/js-cookie/js.cookie$min.js", array(), '2.0.3', TRUE );
|
225 |
wp_register_script( 'jquery-smooth-scroll', EZ_TOC_URL . "vendor/smooth-scroll/jquery.smooth-scroll$min.js", array( 'jquery' ), '1.5.5', TRUE );
|
226 |
wp_register_script( 'jquery-sticky-kit', EZ_TOC_URL . "vendor/sticky-kit/jquery.sticky-kit$min.js", array( 'jquery' ), '1.9.2', TRUE );
|
227 |
+
wp_register_script( 'ez-toc-js', EZ_TOC_URL . "assets/js/front$min.js", array( 'jquery-smooth-scroll', 'js-cookie', 'jquery-sticky-kit'), ezTOC::VERSION, TRUE );
|
|
|
228 |
|
229 |
if ( ! ezTOC_Option::get( 'exclude_css' ) ) {
|
230 |
|
541 |
return $content;
|
542 |
}
|
543 |
|
544 |
+
if ( is_null( $post = ezTOC_Post::get( get_the_ID() ) ) ) {
|
545 |
+
|
546 |
+
return $content;
|
547 |
+
}
|
548 |
+
|
549 |
+
$post->applyContentFilter()->process();
|
550 |
|
551 |
$find = $post->getHeadings();
|
552 |
$replace = $post->getHeadingsWithAnchors();
|
includes/class.post.php
CHANGED
@@ -120,7 +120,7 @@ class ezTOC_Post {
|
|
120 |
* Ensure the ezTOC shortcodes are not processed when applying `the_content` filter
|
121 |
* otherwise an infinite loop may occur.
|
122 |
*/
|
123 |
-
remove_shortcode( 'ez-toc' )
|
124 |
remove_shortcode( 'toc' );
|
125 |
|
126 |
$this->post->post_content = apply_filters( 'the_content', $this->post->post_content );
|
@@ -282,6 +282,10 @@ class ezTOC_Post {
|
|
282 |
$this->alternateHeadings( $matches );
|
283 |
$this->headingIDs( $matches );
|
284 |
$this->hasTOCItems = TRUE;
|
|
|
|
|
|
|
|
|
285 |
}
|
286 |
|
287 |
}
|
120 |
* Ensure the ezTOC shortcodes are not processed when applying `the_content` filter
|
121 |
* otherwise an infinite loop may occur.
|
122 |
*/
|
123 |
+
remove_shortcode( 'ez-toc' );
|
124 |
remove_shortcode( 'toc' );
|
125 |
|
126 |
$this->post->post_content = apply_filters( 'the_content', $this->post->post_content );
|
282 |
$this->alternateHeadings( $matches );
|
283 |
$this->headingIDs( $matches );
|
284 |
$this->hasTOCItems = TRUE;
|
285 |
+
|
286 |
+
} else {
|
287 |
+
|
288 |
+
return array();
|
289 |
}
|
290 |
|
291 |
}
|
vendor/waypoints/jquery.waypoints.js
DELETED
@@ -1,662 +0,0 @@
|
|
1 |
-
/*!
|
2 |
-
Waypoints - 4.0.1
|
3 |
-
Copyright © 2011-2016 Caleb Troughton
|
4 |
-
Licensed under the MIT license.
|
5 |
-
https://github.com/imakewebthings/waypoints/blob/master/licenses.txt
|
6 |
-
*/
|
7 |
-
(function() {
|
8 |
-
'use strict'
|
9 |
-
|
10 |
-
var keyCounter = 0
|
11 |
-
var allWaypoints = {}
|
12 |
-
|
13 |
-
/* http://imakewebthings.com/waypoints/api/waypoint */
|
14 |
-
function Waypoint(options) {
|
15 |
-
if (!options) {
|
16 |
-
throw new Error('No options passed to Waypoint constructor')
|
17 |
-
}
|
18 |
-
if (!options.element) {
|
19 |
-
throw new Error('No element option passed to Waypoint constructor')
|
20 |
-
}
|
21 |
-
if (!options.handler) {
|
22 |
-
throw new Error('No handler option passed to Waypoint constructor')
|
23 |
-
}
|
24 |
-
|
25 |
-
this.key = 'waypoint-' + keyCounter
|
26 |
-
this.options = Waypoint.Adapter.extend({}, Waypoint.defaults, options)
|
27 |
-
this.element = this.options.element
|
28 |
-
this.adapter = new Waypoint.Adapter(this.element)
|
29 |
-
this.callback = options.handler
|
30 |
-
this.axis = this.options.horizontal ? 'horizontal' : 'vertical'
|
31 |
-
this.enabled = this.options.enabled
|
32 |
-
this.triggerPoint = null
|
33 |
-
this.group = Waypoint.Group.findOrCreate({
|
34 |
-
name: this.options.group,
|
35 |
-
axis: this.axis
|
36 |
-
})
|
37 |
-
this.context = Waypoint.Context.findOrCreateByElement(this.options.context)
|
38 |
-
|
39 |
-
if (Waypoint.offsetAliases[this.options.offset]) {
|
40 |
-
this.options.offset = Waypoint.offsetAliases[this.options.offset]
|
41 |
-
}
|
42 |
-
this.group.add(this)
|
43 |
-
this.context.add(this)
|
44 |
-
allWaypoints[this.key] = this
|
45 |
-
keyCounter += 1
|
46 |
-
}
|
47 |
-
|
48 |
-
/* Private */
|
49 |
-
Waypoint.prototype.queueTrigger = function(direction) {
|
50 |
-
this.group.queueTrigger(this, direction)
|
51 |
-
}
|
52 |
-
|
53 |
-
/* Private */
|
54 |
-
Waypoint.prototype.trigger = function(args) {
|
55 |
-
if (!this.enabled) {
|
56 |
-
return
|
57 |
-
}
|
58 |
-
if (this.callback) {
|
59 |
-
this.callback.apply(this, args)
|
60 |
-
}
|
61 |
-
}
|
62 |
-
|
63 |
-
/* Public */
|
64 |
-
/* http://imakewebthings.com/waypoints/api/destroy */
|
65 |
-
Waypoint.prototype.destroy = function() {
|
66 |
-
this.context.remove(this)
|
67 |
-
this.group.remove(this)
|
68 |
-
delete allWaypoints[this.key]
|
69 |
-
}
|
70 |
-
|
71 |
-
/* Public */
|
72 |
-
/* http://imakewebthings.com/waypoints/api/disable */
|
73 |
-
Waypoint.prototype.disable = function() {
|
74 |
-
this.enabled = false
|
75 |
-
return this
|
76 |
-
}
|
77 |
-
|
78 |
-
/* Public */
|
79 |
-
/* http://imakewebthings.com/waypoints/api/enable */
|
80 |
-
Waypoint.prototype.enable = function() {
|
81 |
-
this.context.refresh()
|
82 |
-
this.enabled = true
|
83 |
-
return this
|
84 |
-
}
|
85 |
-
|
86 |
-
/* Public */
|
87 |
-
/* http://imakewebthings.com/waypoints/api/next */
|
88 |
-
Waypoint.prototype.next = function() {
|
89 |
-
return this.group.next(this)
|
90 |
-
}
|
91 |
-
|
92 |
-
/* Public */
|
93 |
-
/* http://imakewebthings.com/waypoints/api/previous */
|
94 |
-
Waypoint.prototype.previous = function() {
|
95 |
-
return this.group.previous(this)
|
96 |
-
}
|
97 |
-
|
98 |
-
/* Private */
|
99 |
-
Waypoint.invokeAll = function(method) {
|
100 |
-
var allWaypointsArray = []
|
101 |
-
for (var waypointKey in allWaypoints) {
|
102 |
-
allWaypointsArray.push(allWaypoints[waypointKey])
|
103 |
-
}
|
104 |
-
for (var i = 0, end = allWaypointsArray.length; i < end; i++) {
|
105 |
-
allWaypointsArray[i][method]()
|
106 |
-
}
|
107 |
-
}
|
108 |
-
|
109 |
-
/* Public */
|
110 |
-
/* http://imakewebthings.com/waypoints/api/destroy-all */
|
111 |
-
Waypoint.destroyAll = function() {
|
112 |
-
Waypoint.invokeAll('destroy')
|
113 |
-
}
|
114 |
-
|
115 |
-
/* Public */
|
116 |
-
/* http://imakewebthings.com/waypoints/api/disable-all */
|
117 |
-
Waypoint.disableAll = function() {
|
118 |
-
Waypoint.invokeAll('disable')
|
119 |
-
}
|
120 |
-
|
121 |
-
/* Public */
|
122 |
-
/* http://imakewebthings.com/waypoints/api/enable-all */
|
123 |
-
Waypoint.enableAll = function() {
|
124 |
-
Waypoint.Context.refreshAll()
|
125 |
-
for (var waypointKey in allWaypoints) {
|
126 |
-
allWaypoints[waypointKey].enabled = true
|
127 |
-
}
|
128 |
-
return this
|
129 |
-
}
|
130 |
-
|
131 |
-
/* Public */
|
132 |
-
/* http://imakewebthings.com/waypoints/api/refresh-all */
|
133 |
-
Waypoint.refreshAll = function() {
|
134 |
-
Waypoint.Context.refreshAll()
|
135 |
-
}
|
136 |
-
|
137 |
-
/* Public */
|
138 |
-
/* http://imakewebthings.com/waypoints/api/viewport-height */
|
139 |
-
Waypoint.viewportHeight = function() {
|
140 |
-
return window.innerHeight || document.documentElement.clientHeight
|
141 |
-
}
|
142 |
-
|
143 |
-
/* Public */
|
144 |
-
/* http://imakewebthings.com/waypoints/api/viewport-width */
|
145 |
-
Waypoint.viewportWidth = function() {
|
146 |
-
return document.documentElement.clientWidth
|
147 |
-
}
|
148 |
-
|
149 |
-
Waypoint.adapters = []
|
150 |
-
|
151 |
-
Waypoint.defaults = {
|
152 |
-
context: window,
|
153 |
-
continuous: true,
|
154 |
-
enabled: true,
|
155 |
-
group: 'default',
|
156 |
-
horizontal: false,
|
157 |
-
offset: 0
|
158 |
-
}
|
159 |
-
|
160 |
-
Waypoint.offsetAliases = {
|
161 |
-
'bottom-in-view': function() {
|
162 |
-
return this.context.innerHeight() - this.adapter.outerHeight()
|
163 |
-
},
|
164 |
-
'right-in-view': function() {
|
165 |
-
return this.context.innerWidth() - this.adapter.outerWidth()
|
166 |
-
}
|
167 |
-
}
|
168 |
-
|
169 |
-
window.Waypoint = Waypoint
|
170 |
-
}())
|
171 |
-
;(function() {
|
172 |
-
'use strict'
|
173 |
-
|
174 |
-
function requestAnimationFrameShim(callback) {
|
175 |
-
window.setTimeout(callback, 1000 / 60)
|
176 |
-
}
|
177 |
-
|
178 |
-
var keyCounter = 0
|
179 |
-
var contexts = {}
|
180 |
-
var Waypoint = window.Waypoint
|
181 |
-
var oldWindowLoad = window.onload
|
182 |
-
|
183 |
-
/* http://imakewebthings.com/waypoints/api/context */
|
184 |
-
function Context(element) {
|
185 |
-
this.element = element
|
186 |
-
this.Adapter = Waypoint.Adapter
|
187 |
-
this.adapter = new this.Adapter(element)
|
188 |
-
this.key = 'waypoint-context-' + keyCounter
|
189 |
-
this.didScroll = false
|
190 |
-
this.didResize = false
|
191 |
-
this.oldScroll = {
|
192 |
-
x: this.adapter.scrollLeft(),
|
193 |
-
y: this.adapter.scrollTop()
|
194 |
-
}
|
195 |
-
this.waypoints = {
|
196 |
-
vertical: {},
|
197 |
-
horizontal: {}
|
198 |
-
}
|
199 |
-
|
200 |
-
element.waypointContextKey = this.key
|
201 |
-
contexts[element.waypointContextKey] = this
|
202 |
-
keyCounter += 1
|
203 |
-
if (!Waypoint.windowContext) {
|
204 |
-
Waypoint.windowContext = true
|
205 |
-
Waypoint.windowContext = new Context(window)
|
206 |
-
}
|
207 |
-
|
208 |
-
this.createThrottledScrollHandler()
|
209 |
-
this.createThrottledResizeHandler()
|
210 |
-
}
|
211 |
-
|
212 |
-
/* Private */
|
213 |
-
Context.prototype.add = function(waypoint) {
|
214 |
-
var axis = waypoint.options.horizontal ? 'horizontal' : 'vertical'
|
215 |
-
this.waypoints[axis][waypoint.key] = waypoint
|
216 |
-
this.refresh()
|
217 |
-
}
|
218 |
-
|
219 |
-
/* Private */
|
220 |
-
Context.prototype.checkEmpty = function() {
|
221 |
-
var horizontalEmpty = this.Adapter.isEmptyObject(this.waypoints.horizontal)
|
222 |
-
var verticalEmpty = this.Adapter.isEmptyObject(this.waypoints.vertical)
|
223 |
-
var isWindow = this.element == this.element.window
|
224 |
-
if (horizontalEmpty && verticalEmpty && !isWindow) {
|
225 |
-
this.adapter.off('.waypoints')
|
226 |
-
delete contexts[this.key]
|
227 |
-
}
|
228 |
-
}
|
229 |
-
|
230 |
-
/* Private */
|
231 |
-
Context.prototype.createThrottledResizeHandler = function() {
|
232 |
-
var self = this
|
233 |
-
|
234 |
-
function resizeHandler() {
|
235 |
-
self.handleResize()
|
236 |
-
self.didResize = false
|
237 |
-
}
|
238 |
-
|
239 |
-
this.adapter.on('resize.waypoints', function() {
|
240 |
-
if (!self.didResize) {
|
241 |
-
self.didResize = true
|
242 |
-
Waypoint.requestAnimationFrame(resizeHandler)
|
243 |
-
}
|
244 |
-
})
|
245 |
-
}
|
246 |
-
|
247 |
-
/* Private */
|
248 |
-
Context.prototype.createThrottledScrollHandler = function() {
|
249 |
-
var self = this
|
250 |
-
function scrollHandler() {
|
251 |
-
self.handleScroll()
|
252 |
-
self.didScroll = false
|
253 |
-
}
|
254 |
-
|
255 |
-
this.adapter.on('scroll.waypoints', function() {
|
256 |
-
if (!self.didScroll || Waypoint.isTouch) {
|
257 |
-
self.didScroll = true
|
258 |
-
Waypoint.requestAnimationFrame(scrollHandler)
|
259 |
-
}
|
260 |
-
})
|
261 |
-
}
|
262 |
-
|
263 |
-
/* Private */
|
264 |
-
Context.prototype.handleResize = function() {
|
265 |
-
Waypoint.Context.refreshAll()
|
266 |
-
}
|
267 |
-
|
268 |
-
/* Private */
|
269 |
-
Context.prototype.handleScroll = function() {
|
270 |
-
var triggeredGroups = {}
|
271 |
-
var axes = {
|
272 |
-
horizontal: {
|
273 |
-
newScroll: this.adapter.scrollLeft(),
|
274 |
-
oldScroll: this.oldScroll.x,
|
275 |
-
forward: 'right',
|
276 |
-
backward: 'left'
|
277 |
-
},
|
278 |
-
vertical: {
|
279 |
-
newScroll: this.adapter.scrollTop(),
|
280 |
-
oldScroll: this.oldScroll.y,
|
281 |
-
forward: 'down',
|
282 |
-
backward: 'up'
|
283 |
-
}
|
284 |
-
}
|
285 |
-
|
286 |
-
for (var axisKey in axes) {
|
287 |
-
var axis = axes[axisKey]
|
288 |
-
var isForward = axis.newScroll > axis.oldScroll
|
289 |
-
var direction = isForward ? axis.forward : axis.backward
|
290 |
-
|
291 |
-
for (var waypointKey in this.waypoints[axisKey]) {
|
292 |
-
var waypoint = this.waypoints[axisKey][waypointKey]
|
293 |
-
if (waypoint.triggerPoint === null) {
|
294 |
-
continue
|
295 |
-
}
|
296 |
-
var wasBeforeTriggerPoint = axis.oldScroll < waypoint.triggerPoint
|
297 |
-
var nowAfterTriggerPoint = axis.newScroll >= waypoint.triggerPoint
|
298 |
-
var crossedForward = wasBeforeTriggerPoint && nowAfterTriggerPoint
|
299 |
-
var crossedBackward = !wasBeforeTriggerPoint && !nowAfterTriggerPoint
|
300 |
-
if (crossedForward || crossedBackward) {
|
301 |
-
waypoint.queueTrigger(direction)
|
302 |
-
triggeredGroups[waypoint.group.id] = waypoint.group
|
303 |
-
}
|
304 |
-
}
|
305 |
-
}
|
306 |
-
|
307 |
-
for (var groupKey in triggeredGroups) {
|
308 |
-
triggeredGroups[groupKey].flushTriggers()
|
309 |
-
}
|
310 |
-
|
311 |
-
this.oldScroll = {
|
312 |
-
x: axes.horizontal.newScroll,
|
313 |
-
y: axes.vertical.newScroll
|
314 |
-
}
|
315 |
-
}
|
316 |
-
|
317 |
-
/* Private */
|
318 |
-
Context.prototype.innerHeight = function() {
|
319 |
-
/*eslint-disable eqeqeq */
|
320 |
-
if (this.element == this.element.window) {
|
321 |
-
return Waypoint.viewportHeight()
|
322 |
-
}
|
323 |
-
/*eslint-enable eqeqeq */
|
324 |
-
return this.adapter.innerHeight()
|
325 |
-
}
|
326 |
-
|
327 |
-
/* Private */
|
328 |
-
Context.prototype.remove = function(waypoint) {
|
329 |
-
delete this.waypoints[waypoint.axis][waypoint.key]
|
330 |
-
this.checkEmpty()
|
331 |
-
}
|
332 |
-
|
333 |
-
/* Private */
|
334 |
-
Context.prototype.innerWidth = function() {
|
335 |
-
/*eslint-disable eqeqeq */
|
336 |
-
if (this.element == this.element.window) {
|
337 |
-
return Waypoint.viewportWidth()
|
338 |
-
}
|
339 |
-
/*eslint-enable eqeqeq */
|
340 |
-
return this.adapter.innerWidth()
|
341 |
-
}
|
342 |
-
|
343 |
-
/* Public */
|
344 |
-
/* http://imakewebthings.com/waypoints/api/context-destroy */
|
345 |
-
Context.prototype.destroy = function() {
|
346 |
-
var allWaypoints = []
|
347 |
-
for (var axis in this.waypoints) {
|
348 |
-
for (var waypointKey in this.waypoints[axis]) {
|
349 |
-
allWaypoints.push(this.waypoints[axis][waypointKey])
|
350 |
-
}
|
351 |
-
}
|
352 |
-
for (var i = 0, end = allWaypoints.length; i < end; i++) {
|
353 |
-
allWaypoints[i].destroy()
|
354 |
-
}
|
355 |
-
}
|
356 |
-
|
357 |
-
/* Public */
|
358 |
-
/* http://imakewebthings.com/waypoints/api/context-refresh */
|
359 |
-
Context.prototype.refresh = function() {
|
360 |
-
/*eslint-disable eqeqeq */
|
361 |
-
var isWindow = this.element == this.element.window
|
362 |
-
/*eslint-enable eqeqeq */
|
363 |
-
var contextOffset = isWindow ? undefined : this.adapter.offset()
|
364 |
-
var triggeredGroups = {}
|
365 |
-
var axes
|
366 |
-
|
367 |
-
this.handleScroll()
|
368 |
-
axes = {
|
369 |
-
horizontal: {
|
370 |
-
contextOffset: isWindow ? 0 : contextOffset.left,
|
371 |
-
contextScroll: isWindow ? 0 : this.oldScroll.x,
|
372 |
-
contextDimension: this.innerWidth(),
|
373 |
-
oldScroll: this.oldScroll.x,
|
374 |
-
forward: 'right',
|
375 |
-
backward: 'left',
|
376 |
-
offsetProp: 'left'
|
377 |
-
},
|
378 |
-
vertical: {
|
379 |
-
contextOffset: isWindow ? 0 : contextOffset.top,
|
380 |
-
contextScroll: isWindow ? 0 : this.oldScroll.y,
|
381 |
-
contextDimension: this.innerHeight(),
|
382 |
-
oldScroll: this.oldScroll.y,
|
383 |
-
forward: 'down',
|
384 |
-
backward: 'up',
|
385 |
-
offsetProp: 'top'
|
386 |
-
}
|
387 |
-
}
|
388 |
-
|
389 |
-
for (var axisKey in axes) {
|
390 |
-
var axis = axes[axisKey]
|
391 |
-
for (var waypointKey in this.waypoints[axisKey]) {
|
392 |
-
var waypoint = this.waypoints[axisKey][waypointKey]
|
393 |
-
var adjustment = waypoint.options.offset
|
394 |
-
var oldTriggerPoint = waypoint.triggerPoint
|
395 |
-
var elementOffset = 0
|
396 |
-
var freshWaypoint = oldTriggerPoint == null
|
397 |
-
var contextModifier, wasBeforeScroll, nowAfterScroll
|
398 |
-
var triggeredBackward, triggeredForward
|
399 |
-
|
400 |
-
if (waypoint.element !== waypoint.element.window) {
|
401 |
-
elementOffset = waypoint.adapter.offset()[axis.offsetProp]
|
402 |
-
}
|
403 |
-
|
404 |
-
if (typeof adjustment === 'function') {
|
405 |
-
adjustment = adjustment.apply(waypoint)
|
406 |
-
}
|
407 |
-
else if (typeof adjustment === 'string') {
|
408 |
-
adjustment = parseFloat(adjustment)
|
409 |
-
if (waypoint.options.offset.indexOf('%') > - 1) {
|
410 |
-
adjustment = Math.ceil(axis.contextDimension * adjustment / 100)
|
411 |
-
}
|
412 |
-
}
|
413 |
-
|
414 |
-
contextModifier = axis.contextScroll - axis.contextOffset
|
415 |
-
waypoint.triggerPoint = Math.floor(elementOffset + contextModifier - adjustment)
|
416 |
-
wasBeforeScroll = oldTriggerPoint < axis.oldScroll
|
417 |
-
nowAfterScroll = waypoint.triggerPoint >= axis.oldScroll
|
418 |
-
triggeredBackward = wasBeforeScroll && nowAfterScroll
|
419 |
-
triggeredForward = !wasBeforeScroll && !nowAfterScroll
|
420 |
-
|
421 |
-
if (!freshWaypoint && triggeredBackward) {
|
422 |
-
waypoint.queueTrigger(axis.backward)
|
423 |
-
triggeredGroups[waypoint.group.id] = waypoint.group
|
424 |
-
}
|
425 |
-
else if (!freshWaypoint && triggeredForward) {
|
426 |
-
waypoint.queueTrigger(axis.forward)
|
427 |
-
triggeredGroups[waypoint.group.id] = waypoint.group
|
428 |
-
}
|
429 |
-
else if (freshWaypoint && axis.oldScroll >= waypoint.triggerPoint) {
|
430 |
-
waypoint.queueTrigger(axis.forward)
|
431 |
-
triggeredGroups[waypoint.group.id] = waypoint.group
|
432 |
-
}
|
433 |
-
}
|
434 |
-
}
|
435 |
-
|
436 |
-
Waypoint.requestAnimationFrame(function() {
|
437 |
-
for (var groupKey in triggeredGroups) {
|
438 |
-
triggeredGroups[groupKey].flushTriggers()
|
439 |
-
}
|
440 |
-
})
|
441 |
-
|
442 |
-
return this
|
443 |
-
}
|
444 |
-
|
445 |
-
/* Private */
|
446 |
-
Context.findOrCreateByElement = function(element) {
|
447 |
-
return Context.findByElement(element) || new Context(element)
|
448 |
-
}
|
449 |
-
|
450 |
-
/* Private */
|
451 |
-
Context.refreshAll = function() {
|
452 |
-
for (var contextId in contexts) {
|
453 |
-
contexts[contextId].refresh()
|
454 |
-
}
|
455 |
-
}
|
456 |
-
|
457 |
-
/* Public */
|
458 |
-
/* http://imakewebthings.com/waypoints/api/context-find-by-element */
|
459 |
-
Context.findByElement = function(element) {
|
460 |
-
return contexts[element.waypointContextKey]
|
461 |
-
}
|
462 |
-
|
463 |
-
window.onload = function() {
|
464 |
-
if (oldWindowLoad) {
|
465 |
-
oldWindowLoad()
|
466 |
-
}
|
467 |
-
Context.refreshAll()
|
468 |
-
}
|
469 |
-
|
470 |
-
|
471 |
-
Waypoint.requestAnimationFrame = function(callback) {
|
472 |
-
var requestFn = window.requestAnimationFrame ||
|
473 |
-
window.mozRequestAnimationFrame ||
|
474 |
-
window.webkitRequestAnimationFrame ||
|
475 |
-
requestAnimationFrameShim
|
476 |
-
requestFn.call(window, callback)
|
477 |
-
}
|
478 |
-
Waypoint.Context = Context
|
479 |
-
}())
|
480 |
-
;(function() {
|
481 |
-
'use strict'
|
482 |
-
|
483 |
-
function byTriggerPoint(a, b) {
|
484 |
-
return a.triggerPoint - b.triggerPoint
|
485 |
-
}
|
486 |
-
|
487 |
-
function byReverseTriggerPoint(a, b) {
|
488 |
-
return b.triggerPoint - a.triggerPoint
|
489 |
-
}
|
490 |
-
|
491 |
-
var groups = {
|
492 |
-
vertical: {},
|
493 |
-
horizontal: {}
|
494 |
-
}
|
495 |
-
var Waypoint = window.Waypoint
|
496 |
-
|
497 |
-
/* http://imakewebthings.com/waypoints/api/group */
|
498 |
-
function Group(options) {
|
499 |
-
this.name = options.name
|
500 |
-
this.axis = options.axis
|
501 |
-
this.id = this.name + '-' + this.axis
|
502 |
-
this.waypoints = []
|
503 |
-
this.clearTriggerQueues()
|
504 |
-
groups[this.axis][this.name] = this
|
505 |
-
}
|
506 |
-
|
507 |
-
/* Private */
|
508 |
-
Group.prototype.add = function(waypoint) {
|
509 |
-
this.waypoints.push(waypoint)
|
510 |
-
}
|
511 |
-
|
512 |
-
/* Private */
|
513 |
-
Group.prototype.clearTriggerQueues = function() {
|
514 |
-
this.triggerQueues = {
|
515 |
-
up: [],
|
516 |
-
down: [],
|
517 |
-
left: [],
|
518 |
-
right: []
|
519 |
-
}
|
520 |
-
}
|
521 |
-
|
522 |
-
/* Private */
|
523 |
-
Group.prototype.flushTriggers = function() {
|
524 |
-
for (var direction in this.triggerQueues) {
|
525 |
-
var waypoints = this.triggerQueues[direction]
|
526 |
-
var reverse = direction === 'up' || direction === 'left'
|
527 |
-
waypoints.sort(reverse ? byReverseTriggerPoint : byTriggerPoint)
|
528 |
-
for (var i = 0, end = waypoints.length; i < end; i += 1) {
|
529 |
-
var waypoint = waypoints[i]
|
530 |
-
if (waypoint.options.continuous || i === waypoints.length - 1) {
|
531 |
-
waypoint.trigger([direction])
|
532 |
-
}
|
533 |
-
}
|
534 |
-
}
|
535 |
-
this.clearTriggerQueues()
|
536 |
-
}
|
537 |
-
|
538 |
-
/* Private */
|
539 |
-
Group.prototype.next = function(waypoint) {
|
540 |
-
this.waypoints.sort(byTriggerPoint)
|
541 |
-
var index = Waypoint.Adapter.inArray(waypoint, this.waypoints)
|
542 |
-
var isLast = index === this.waypoints.length - 1
|
543 |
-
return isLast ? null : this.waypoints[index + 1]
|
544 |
-
}
|
545 |
-
|
546 |
-
/* Private */
|
547 |
-
Group.prototype.previous = function(waypoint) {
|
548 |
-
this.waypoints.sort(byTriggerPoint)
|
549 |
-
var index = Waypoint.Adapter.inArray(waypoint, this.waypoints)
|
550 |
-
return index ? this.waypoints[index - 1] : null
|
551 |
-
}
|
552 |
-
|
553 |
-
/* Private */
|
554 |
-
Group.prototype.queueTrigger = function(waypoint, direction) {
|
555 |
-
this.triggerQueues[direction].push(waypoint)
|
556 |
-
}
|
557 |
-
|
558 |
-
/* Private */
|
559 |
-
Group.prototype.remove = function(waypoint) {
|
560 |
-
var index = Waypoint.Adapter.inArray(waypoint, this.waypoints)
|
561 |
-
if (index > -1) {
|
562 |
-
this.waypoints.splice(index, 1)
|
563 |
-
}
|
564 |
-
}
|
565 |
-
|
566 |
-
/* Public */
|
567 |
-
/* http://imakewebthings.com/waypoints/api/first */
|
568 |
-
Group.prototype.first = function() {
|
569 |
-
return this.waypoints[0]
|
570 |
-
}
|
571 |
-
|
572 |
-
/* Public */
|
573 |
-
/* http://imakewebthings.com/waypoints/api/last */
|
574 |
-
Group.prototype.last = function() {
|
575 |
-
return this.waypoints[this.waypoints.length - 1]
|
576 |
-
}
|
577 |
-
|
578 |
-
/* Private */
|
579 |
-
Group.findOrCreate = function(options) {
|
580 |
-
return groups[options.axis][options.name] || new Group(options)
|
581 |
-
}
|
582 |
-
|
583 |
-
Waypoint.Group = Group
|
584 |
-
}())
|
585 |
-
;(function() {
|
586 |
-
'use strict'
|
587 |
-
|
588 |
-
var $ = window.jQuery
|
589 |
-
var Waypoint = window.Waypoint
|
590 |
-
|
591 |
-
function JQueryAdapter(element) {
|
592 |
-
this.$element = $(element)
|
593 |
-
}
|
594 |
-
|
595 |
-
$.each([
|
596 |
-
'innerHeight',
|
597 |
-
'innerWidth',
|
598 |
-
'off',
|
599 |
-
'offset',
|
600 |
-
'on',
|
601 |
-
'outerHeight',
|
602 |
-
'outerWidth',
|
603 |
-
'scrollLeft',
|
604 |
-
'scrollTop'
|
605 |
-
], function(i, method) {
|
606 |
-
JQueryAdapter.prototype[method] = function() {
|
607 |
-
var args = Array.prototype.slice.call(arguments)
|
608 |
-
return this.$element[method].apply(this.$element, args)
|
609 |
-
}
|
610 |
-
})
|
611 |
-
|
612 |
-
$.each([
|
613 |
-
'extend',
|
614 |
-
'inArray',
|
615 |
-
'isEmptyObject'
|
616 |
-
], function(i, method) {
|
617 |
-
JQueryAdapter[method] = $[method]
|
618 |
-
})
|
619 |
-
|
620 |
-
Waypoint.adapters.push({
|
621 |
-
name: 'jquery',
|
622 |
-
Adapter: JQueryAdapter
|
623 |
-
})
|
624 |
-
Waypoint.Adapter = JQueryAdapter
|
625 |
-
}())
|
626 |
-
;(function() {
|
627 |
-
'use strict'
|
628 |
-
|
629 |
-
var Waypoint = window.Waypoint
|
630 |
-
|
631 |
-
function createExtension(framework) {
|
632 |
-
return function() {
|
633 |
-
var waypoints = []
|
634 |
-
var overrides = arguments[0]
|
635 |
-
|
636 |
-
if (framework.isFunction(arguments[0])) {
|
637 |
-
overrides = framework.extend({}, arguments[1])
|
638 |
-
overrides.handler = arguments[0]
|
639 |
-
}
|
640 |
-
|
641 |
-
this.each(function() {
|
642 |
-
var options = framework.extend({}, overrides, {
|
643 |
-
element: this
|
644 |
-
})
|
645 |
-
if (typeof options.context === 'string') {
|
646 |
-
options.context = framework(this).closest(options.context)[0]
|
647 |
-
}
|
648 |
-
waypoints.push(new Waypoint(options))
|
649 |
-
})
|
650 |
-
|
651 |
-
return waypoints
|
652 |
-
}
|
653 |
-
}
|
654 |
-
|
655 |
-
if (window.jQuery) {
|
656 |
-
window.jQuery.fn.waypoint = createExtension(window.jQuery)
|
657 |
-
}
|
658 |
-
if (window.Zepto) {
|
659 |
-
window.Zepto.fn.waypoint = createExtension(window.Zepto)
|
660 |
-
}
|
661 |
-
}())
|
662 |
-
;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/waypoints/jquery.waypoints.min.js
DELETED
@@ -1,7 +0,0 @@
|
|
1 |
-
/*!
|
2 |
-
Waypoints - 4.0.1
|
3 |
-
Copyright © 2011-2016 Caleb Troughton
|
4 |
-
Licensed under the MIT license.
|
5 |
-
https://github.com/imakewebthings/waypoints/blob/master/licenses.txt
|
6 |
-
*/
|
7 |
-
!function(){"use strict";function t(o){if(!o)throw new Error("No options passed to Waypoint constructor");if(!o.element)throw new Error("No element option passed to Waypoint constructor");if(!o.handler)throw new Error("No handler option passed to Waypoint constructor");this.key="waypoint-"+e,this.options=t.Adapter.extend({},t.defaults,o),this.element=this.options.element,this.adapter=new t.Adapter(this.element),this.callback=o.handler,this.axis=this.options.horizontal?"horizontal":"vertical",this.enabled=this.options.enabled,this.triggerPoint=null,this.group=t.Group.findOrCreate({name:this.options.group,axis:this.axis}),this.context=t.Context.findOrCreateByElement(this.options.context),t.offsetAliases[this.options.offset]&&(this.options.offset=t.offsetAliases[this.options.offset]),this.group.add(this),this.context.add(this),i[this.key]=this,e+=1}var e=0,i={};t.prototype.queueTrigger=function(t){this.group.queueTrigger(this,t)},t.prototype.trigger=function(t){this.enabled&&this.callback&&this.callback.apply(this,t)},t.prototype.destroy=function(){this.context.remove(this),this.group.remove(this),delete i[this.key]},t.prototype.disable=function(){return this.enabled=!1,this},t.prototype.enable=function(){return this.context.refresh(),this.enabled=!0,this},t.prototype.next=function(){return this.group.next(this)},t.prototype.previous=function(){return this.group.previous(this)},t.invokeAll=function(t){var e=[];for(var o in i)e.push(i[o]);for(var n=0,r=e.length;r>n;n++)e[n][t]()},t.destroyAll=function(){t.invokeAll("destroy")},t.disableAll=function(){t.invokeAll("disable")},t.enableAll=function(){t.Context.refreshAll();for(var e in i)i[e].enabled=!0;return this},t.refreshAll=function(){t.Context.refreshAll()},t.viewportHeight=function(){return window.innerHeight||document.documentElement.clientHeight},t.viewportWidth=function(){return document.documentElement.clientWidth},t.adapters=[],t.defaults={context:window,continuous:!0,enabled:!0,group:"default",horizontal:!1,offset:0},t.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=t}(),function(){"use strict";function t(t){window.setTimeout(t,1e3/60)}function e(t){this.element=t,this.Adapter=n.Adapter,this.adapter=new this.Adapter(t),this.key="waypoint-context-"+i,this.didScroll=!1,this.didResize=!1,this.oldScroll={x:this.adapter.scrollLeft(),y:this.adapter.scrollTop()},this.waypoints={vertical:{},horizontal:{}},t.waypointContextKey=this.key,o[t.waypointContextKey]=this,i+=1,n.windowContext||(n.windowContext=!0,n.windowContext=new e(window)),this.createThrottledScrollHandler(),this.createThrottledResizeHandler()}var i=0,o={},n=window.Waypoint,r=window.onload;e.prototype.add=function(t){var e=t.options.horizontal?"horizontal":"vertical";this.waypoints[e][t.key]=t,this.refresh()},e.prototype.checkEmpty=function(){var t=this.Adapter.isEmptyObject(this.waypoints.horizontal),e=this.Adapter.isEmptyObject(this.waypoints.vertical),i=this.element==this.element.window;t&&e&&!i&&(this.adapter.off(".waypoints"),delete o[this.key])},e.prototype.createThrottledResizeHandler=function(){function t(){e.handleResize(),e.didResize=!1}var e=this;this.adapter.on("resize.waypoints",function(){e.didResize||(e.didResize=!0,n.requestAnimationFrame(t))})},e.prototype.createThrottledScrollHandler=function(){function t(){e.handleScroll(),e.didScroll=!1}var e=this;this.adapter.on("scroll.waypoints",function(){(!e.didScroll||n.isTouch)&&(e.didScroll=!0,n.requestAnimationFrame(t))})},e.prototype.handleResize=function(){n.Context.refreshAll()},e.prototype.handleScroll=function(){var t={},e={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 i in e){var o=e[i],n=o.newScroll>o.oldScroll,r=n?o.forward:o.backward;for(var s in this.waypoints[i]){var a=this.waypoints[i][s];if(null!==a.triggerPoint){var l=o.oldScroll<a.triggerPoint,h=o.newScroll>=a.triggerPoint,p=l&&h,u=!l&&!h;(p||u)&&(a.queueTrigger(r),t[a.group.id]=a.group)}}}for(var c in t)t[c].flushTriggers();this.oldScroll={x:e.horizontal.newScroll,y:e.vertical.newScroll}},e.prototype.innerHeight=function(){return this.element==this.element.window?n.viewportHeight():this.adapter.innerHeight()},e.prototype.remove=function(t){delete this.waypoints[t.axis][t.key],this.checkEmpty()},e.prototype.innerWidth=function(){return this.element==this.element.window?n.viewportWidth():this.adapter.innerWidth()},e.prototype.destroy=function(){var t=[];for(var e in this.waypoints)for(var i in this.waypoints[e])t.push(this.waypoints[e][i]);for(var o=0,n=t.length;n>o;o++)t[o].destroy()},e.prototype.refresh=function(){var t,e=this.element==this.element.window,i=e?void 0:this.adapter.offset(),o={};this.handleScroll(),t={horizontal:{contextOffset:e?0:i.left,contextScroll:e?0:this.oldScroll.x,contextDimension:this.innerWidth(),oldScroll:this.oldScroll.x,forward:"right",backward:"left",offsetProp:"left"},vertical:{contextOffset:e?0:i.top,contextScroll:e?0:this.oldScroll.y,contextDimension:this.innerHeight(),oldScroll:this.oldScroll.y,forward:"down",backward:"up",offsetProp:"top"}};for(var r in t){var s=t[r];for(var a in this.waypoints[r]){var l,h,p,u,c,d=this.waypoints[r][a],f=d.options.offset,w=d.triggerPoint,y=0,g=null==w;d.element!==d.element.window&&(y=d.adapter.offset()[s.offsetProp]),"function"==typeof f?f=f.apply(d):"string"==typeof f&&(f=parseFloat(f),d.options.offset.indexOf("%")>-1&&(f=Math.ceil(s.contextDimension*f/100))),l=s.contextScroll-s.contextOffset,d.triggerPoint=Math.floor(y+l-f),h=w<s.oldScroll,p=d.triggerPoint>=s.oldScroll,u=h&&p,c=!h&&!p,!g&&u?(d.queueTrigger(s.backward),o[d.group.id]=d.group):!g&&c?(d.queueTrigger(s.forward),o[d.group.id]=d.group):g&&s.oldScroll>=d.triggerPoint&&(d.queueTrigger(s.forward),o[d.group.id]=d.group)}}return n.requestAnimationFrame(function(){for(var t in o)o[t].flushTriggers()}),this},e.findOrCreateByElement=function(t){return e.findByElement(t)||new e(t)},e.refreshAll=function(){for(var t in o)o[t].refresh()},e.findByElement=function(t){return o[t.waypointContextKey]},window.onload=function(){r&&r(),e.refreshAll()},n.requestAnimationFrame=function(e){var i=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||t;i.call(window,e)},n.Context=e}(),function(){"use strict";function t(t,e){return t.triggerPoint-e.triggerPoint}function e(t,e){return e.triggerPoint-t.triggerPoint}function i(t){this.name=t.name,this.axis=t.axis,this.id=this.name+"-"+this.axis,this.waypoints=[],this.clearTriggerQueues(),o[this.axis][this.name]=this}var o={vertical:{},horizontal:{}},n=window.Waypoint;i.prototype.add=function(t){this.waypoints.push(t)},i.prototype.clearTriggerQueues=function(){this.triggerQueues={up:[],down:[],left:[],right:[]}},i.prototype.flushTriggers=function(){for(var i in this.triggerQueues){var o=this.triggerQueues[i],n="up"===i||"left"===i;o.sort(n?e:t);for(var r=0,s=o.length;s>r;r+=1){var a=o[r];(a.options.continuous||r===o.length-1)&&a.trigger([i])}}this.clearTriggerQueues()},i.prototype.next=function(e){this.waypoints.sort(t);var i=n.Adapter.inArray(e,this.waypoints),o=i===this.waypoints.length-1;return o?null:this.waypoints[i+1]},i.prototype.previous=function(e){this.waypoints.sort(t);var i=n.Adapter.inArray(e,this.waypoints);return i?this.waypoints[i-1]:null},i.prototype.queueTrigger=function(t,e){this.triggerQueues[e].push(t)},i.prototype.remove=function(t){var e=n.Adapter.inArray(t,this.waypoints);e>-1&&this.waypoints.splice(e,1)},i.prototype.first=function(){return this.waypoints[0]},i.prototype.last=function(){return this.waypoints[this.waypoints.length-1]},i.findOrCreate=function(t){return o[t.axis][t.name]||new i(t)},n.Group=i}(),function(){"use strict";function t(t){this.$element=e(t)}var e=window.jQuery,i=window.Waypoint;e.each(["innerHeight","innerWidth","off","offset","on","outerHeight","outerWidth","scrollLeft","scrollTop"],function(e,i){t.prototype[i]=function(){var t=Array.prototype.slice.call(arguments);return this.$element[i].apply(this.$element,t)}}),e.each(["extend","inArray","isEmptyObject"],function(i,o){t[o]=e[o]}),i.adapters.push({name:"jquery",Adapter:t}),i.Adapter=t}(),function(){"use strict";function t(t){return function(){var i=[],o=arguments[0];return t.isFunction(arguments[0])&&(o=t.extend({},arguments[1]),o.handler=arguments[0]),this.each(function(){var n=t.extend({},o,{element:this});"string"==typeof n.context&&(n.context=t(this).closest(n.context)[0]),i.push(new e(n))}),i}}var e=window.Waypoint;window.jQuery&&(window.jQuery.fn.waypoint=t(window.jQuery)),window.Zepto&&(window.Zepto.fn.waypoint=t(window.Zepto))}();
|
|
|
|
|
|
|
|
|
|
|
|
|
|