Add JS files
This commit is contained in:
84
port/js/shortcuts/infinite.js
Executable file
84
port/js/shortcuts/infinite.js
Executable file
@@ -0,0 +1,84 @@
|
||||
/*!
|
||||
Waypoints Infinite Scroll Shortcut - 3.1.1
|
||||
Copyright © 2011-2015 Caleb Troughton
|
||||
Licensed under the MIT license.
|
||||
https://github.com/imakewebthings/waypoints/blog/master/licenses.txt
|
||||
*/
|
||||
(function() {
|
||||
'use strict'
|
||||
|
||||
var $ = window.jQuery
|
||||
var Waypoint = window.Waypoint
|
||||
|
||||
/* http://imakewebthings.com/waypoints/shortcuts/infinite-scroll */
|
||||
function Infinite(options) {
|
||||
this.options = $.extend({}, Infinite.defaults, options)
|
||||
this.container = this.options.element
|
||||
if (this.options.container !== 'auto') {
|
||||
this.container = this.options.container
|
||||
}
|
||||
this.$container = $(this.container)
|
||||
this.$more = $(this.options.more)
|
||||
|
||||
if (this.$more.length) {
|
||||
this.setupHandler()
|
||||
this.waypoint = new Waypoint(this.options)
|
||||
}
|
||||
}
|
||||
|
||||
/* Private */
|
||||
Infinite.prototype.setupHandler = function() {
|
||||
this.options.handler = $.proxy(function() {
|
||||
this.options.onBeforePageLoad()
|
||||
this.destroy()
|
||||
this.$container.addClass(this.options.loadingClass)
|
||||
|
||||
$.get($(this.options.more).attr('href'), $.proxy(function(data) {
|
||||
var $data = $($.parseHTML(data))
|
||||
var $newMore = $data.find(this.options.more)
|
||||
|
||||
var $items = $data.find(this.options.items)
|
||||
if (!$items.length) {
|
||||
$items = $data.filter(this.options.items)
|
||||
}
|
||||
|
||||
this.$container.append($items)
|
||||
this.$container.removeClass(this.options.loadingClass)
|
||||
|
||||
if (!$newMore.length) {
|
||||
$newMore = $data.filter(this.options.more)
|
||||
}
|
||||
if ($newMore.length) {
|
||||
this.$more.replaceWith($newMore)
|
||||
this.$more = $newMore
|
||||
this.waypoint = new Waypoint(this.options)
|
||||
}
|
||||
else {
|
||||
this.$more.remove()
|
||||
}
|
||||
|
||||
this.options.onAfterPageLoad()
|
||||
}, this))
|
||||
}, this)
|
||||
}
|
||||
|
||||
/* Public */
|
||||
Infinite.prototype.destroy = function() {
|
||||
if (this.waypoint) {
|
||||
this.waypoint.destroy()
|
||||
}
|
||||
}
|
||||
|
||||
Infinite.defaults = {
|
||||
container: 'auto',
|
||||
items: '.infinite-item',
|
||||
more: '.infinite-more-link',
|
||||
offset: 'bottom-in-view',
|
||||
loadingClass: 'infinite-loading',
|
||||
onBeforePageLoad: $.noop,
|
||||
onAfterPageLoad: $.noop
|
||||
}
|
||||
|
||||
Waypoint.Infinite = Infinite
|
||||
}())
|
||||
;
|
||||
7
port/js/shortcuts/infinite.min.js
vendored
Executable file
7
port/js/shortcuts/infinite.min.js
vendored
Executable file
@@ -0,0 +1,7 @@
|
||||
/*!
|
||||
Waypoints Infinite Scroll Shortcut - 3.1.1
|
||||
Copyright © 2011-2015 Caleb Troughton
|
||||
Licensed under the MIT license.
|
||||
https://github.com/imakewebthings/waypoints/blog/master/licenses.txt
|
||||
*/
|
||||
!function(){"use strict";function t(n){this.options=i.extend({},t.defaults,n),this.container=this.options.element,"auto"!==this.options.container&&(this.container=this.options.container),this.$container=i(this.container),this.$more=i(this.options.more),this.$more.length&&(this.setupHandler(),this.waypoint=new o(this.options))}var i=window.jQuery,o=window.Waypoint;t.prototype.setupHandler=function(){this.options.handler=i.proxy(function(){this.options.onBeforePageLoad(),this.destroy(),this.$container.addClass(this.options.loadingClass),i.get(i(this.options.more).attr("href"),i.proxy(function(t){var n=i(i.parseHTML(t)),e=n.find(this.options.more),s=n.find(this.options.items);s.length||(s=n.filter(this.options.items)),this.$container.append(s),this.$container.removeClass(this.options.loadingClass),e.length||(e=n.filter(this.options.more)),e.length?(this.$more.replaceWith(e),this.$more=e,this.waypoint=new o(this.options)):this.$more.remove(),this.options.onAfterPageLoad()},this))},this)},t.prototype.destroy=function(){this.waypoint&&this.waypoint.destroy()},t.defaults={container:"auto",items:".infinite-item",more:".infinite-more-link",offset:"bottom-in-view",loadingClass:"infinite-loading",onBeforePageLoad:i.noop,onAfterPageLoad:i.noop},o.Infinite=t}();
|
||||
103
port/js/shortcuts/inview.js
Executable file
103
port/js/shortcuts/inview.js
Executable file
@@ -0,0 +1,103 @@
|
||||
/*!
|
||||
Waypoints Inview Shortcut - 3.1.1
|
||||
Copyright © 2011-2015 Caleb Troughton
|
||||
Licensed under the MIT license.
|
||||
https://github.com/imakewebthings/waypoints/blog/master/licenses.txt
|
||||
*/
|
||||
(function() {
|
||||
'use strict'
|
||||
|
||||
function noop() {}
|
||||
|
||||
var Waypoint = window.Waypoint
|
||||
|
||||
/* http://imakewebthings.com/waypoints/shortcuts/inview */
|
||||
function Inview(options) {
|
||||
this.options = Waypoint.Adapter.extend({}, Inview.defaults, options)
|
||||
this.axis = this.options.horizontal ? 'horizontal' : 'vertical'
|
||||
this.waypoints = []
|
||||
this.createWaypoints()
|
||||
}
|
||||
|
||||
/* Private */
|
||||
Inview.prototype.createWaypoints = function() {
|
||||
var configs = {
|
||||
vertical: [{
|
||||
down: 'enter',
|
||||
up: 'exited',
|
||||
offset: '100%'
|
||||
}, {
|
||||
down: 'entered',
|
||||
up: 'exit',
|
||||
offset: 'bottom-in-view'
|
||||
}, {
|
||||
down: 'exit',
|
||||
up: 'entered',
|
||||
offset: 0
|
||||
}, {
|
||||
down: 'exited',
|
||||
up: 'enter',
|
||||
offset: function() {
|
||||
return -this.adapter.outerHeight()
|
||||
}
|
||||
}],
|
||||
horizontal: [{
|
||||
right: 'enter',
|
||||
left: 'exited',
|
||||
offset: '100%'
|
||||
}, {
|
||||
right: 'entered',
|
||||
left: 'exit',
|
||||
offset: 'right-in-view'
|
||||
}, {
|
||||
right: 'exit',
|
||||
left: 'entered',
|
||||
offset: 0
|
||||
}, {
|
||||
right: 'exited',
|
||||
left: 'enter',
|
||||
offset: function() {
|
||||
return -this.adapter.outerWidth()
|
||||
}
|
||||
}]
|
||||
}
|
||||
|
||||
for (var i = 0, end = configs[this.axis].length; i < end; i++) {
|
||||
var config = configs[this.axis][i]
|
||||
this.createWaypoint(config)
|
||||
}
|
||||
}
|
||||
|
||||
/* Private */
|
||||
Inview.prototype.createWaypoint = function(config) {
|
||||
var self = this
|
||||
this.waypoints.push(new Waypoint({
|
||||
element: this.options.element,
|
||||
handler: (function(config) {
|
||||
return function(direction) {
|
||||
self.options[config[direction]].call(this, direction)
|
||||
}
|
||||
}(config)),
|
||||
offset: config.offset,
|
||||
horizontal: this.options.horizontal
|
||||
}))
|
||||
}
|
||||
|
||||
/* Public */
|
||||
Inview.prototype.destroy = function() {
|
||||
for (var i = 0, end = this.waypoints.length; i < end; i++) {
|
||||
this.waypoints[i].destroy()
|
||||
}
|
||||
this.waypoints = []
|
||||
}
|
||||
|
||||
Inview.defaults = {
|
||||
enter: noop,
|
||||
entered: noop,
|
||||
exit: noop,
|
||||
exited: noop
|
||||
}
|
||||
|
||||
Waypoint.Inview = Inview
|
||||
}())
|
||||
;
|
||||
7
port/js/shortcuts/inview.min.js
vendored
Executable file
7
port/js/shortcuts/inview.min.js
vendored
Executable file
@@ -0,0 +1,7 @@
|
||||
/*!
|
||||
Waypoints Inview Shortcut - 3.1.1
|
||||
Copyright © 2011-2015 Caleb Troughton
|
||||
Licensed under the MIT license.
|
||||
https://github.com/imakewebthings/waypoints/blog/master/licenses.txt
|
||||
*/
|
||||
!function(){"use strict";function t(){}function e(t){this.options=i.Adapter.extend({},e.defaults,t),this.axis=this.options.horizontal?"horizontal":"vertical",this.waypoints=[],this.createWaypoints()}var i=window.Waypoint;e.prototype.createWaypoints=function(){for(var t={vertical:[{down:"enter",up:"exited",offset:"100%"},{down:"entered",up:"exit",offset:"bottom-in-view"},{down:"exit",up:"entered",offset:0},{down:"exited",up:"enter",offset:function(){return-this.adapter.outerHeight()}}],horizontal:[{right:"enter",left:"exited",offset:"100%"},{right:"entered",left:"exit",offset:"right-in-view"},{right:"exit",left:"entered",offset:0},{right:"exited",left:"enter",offset:function(){return-this.adapter.outerWidth()}}]},e=0,i=t[this.axis].length;i>e;e++){var o=t[this.axis][e];this.createWaypoint(o)}},e.prototype.createWaypoint=function(t){var e=this;this.waypoints.push(new i({element:this.options.element,handler:function(t){return function(i){e.options[t[i]].call(this,i)}}(t),offset:t.offset,horizontal:this.options.horizontal}))},e.prototype.destroy=function(){for(var t=0,e=this.waypoints.length;e>t;t++)this.waypoints[t].destroy();this.waypoints=[]},e.defaults={enter:t,entered:t,exit:t,exited:t},i.Inview=e}();
|
||||
65
port/js/shortcuts/sticky.js
Executable file
65
port/js/shortcuts/sticky.js
Executable file
@@ -0,0 +1,65 @@
|
||||
/*!
|
||||
Waypoints Sticky Element Shortcut - 3.1.1
|
||||
Copyright © 2011-2015 Caleb Troughton
|
||||
Licensed under the MIT license.
|
||||
https://github.com/imakewebthings/waypoints/blog/master/licenses.txt
|
||||
*/
|
||||
(function() {
|
||||
'use strict'
|
||||
|
||||
var $ = window.jQuery
|
||||
var Waypoint = window.Waypoint
|
||||
|
||||
/* http://imakewebthings.com/waypoints/shortcuts/sticky-elements */
|
||||
function Sticky(options) {
|
||||
this.options = $.extend({}, Waypoint.defaults, Sticky.defaults, options)
|
||||
this.element = this.options.element
|
||||
this.$element = $(this.element)
|
||||
this.createWrapper()
|
||||
this.createWaypoint()
|
||||
}
|
||||
|
||||
/* Private */
|
||||
Sticky.prototype.createWaypoint = function() {
|
||||
var originalHandler = this.options.handler
|
||||
|
||||
this.waypoint = new Waypoint($.extend({}, this.options, {
|
||||
element: this.wrapper,
|
||||
handler: $.proxy(function(direction) {
|
||||
var shouldBeStuck = this.options.direction.indexOf(direction) > -1
|
||||
var wrapperHeight = shouldBeStuck ? this.$element.outerHeight(true) : ''
|
||||
|
||||
this.$wrapper.height(wrapperHeight)
|
||||
this.$element.toggleClass(this.options.stuckClass, shouldBeStuck)
|
||||
|
||||
if (originalHandler) {
|
||||
originalHandler.call(this, direction)
|
||||
}
|
||||
}, this)
|
||||
}))
|
||||
}
|
||||
|
||||
/* Private */
|
||||
Sticky.prototype.createWrapper = function() {
|
||||
this.$element.wrap(this.options.wrapper)
|
||||
this.$wrapper = this.$element.parent()
|
||||
this.wrapper = this.$wrapper[0]
|
||||
}
|
||||
|
||||
/* Public */
|
||||
Sticky.prototype.destroy = function() {
|
||||
if (this.$element.parent()[0] === this.wrapper) {
|
||||
this.waypoint.destroy()
|
||||
this.$element.removeClass(this.options.stuckClass).unwrap()
|
||||
}
|
||||
}
|
||||
|
||||
Sticky.defaults = {
|
||||
wrapper: '<div class="sticky-wrapper" />',
|
||||
stuckClass: 'stuck',
|
||||
direction: 'down right'
|
||||
}
|
||||
|
||||
Waypoint.Sticky = Sticky
|
||||
}())
|
||||
;
|
||||
7
port/js/shortcuts/sticky.min.js
vendored
Executable file
7
port/js/shortcuts/sticky.min.js
vendored
Executable file
@@ -0,0 +1,7 @@
|
||||
/*!
|
||||
Waypoints Sticky Element Shortcut - 3.1.1
|
||||
Copyright © 2011-2015 Caleb Troughton
|
||||
Licensed under the MIT license.
|
||||
https://github.com/imakewebthings/waypoints/blog/master/licenses.txt
|
||||
*/
|
||||
!function(){"use strict";function t(s){this.options=e.extend({},i.defaults,t.defaults,s),this.element=this.options.element,this.$element=e(this.element),this.createWrapper(),this.createWaypoint()}var e=window.jQuery,i=window.Waypoint;t.prototype.createWaypoint=function(){var t=this.options.handler;this.waypoint=new i(e.extend({},this.options,{element:this.wrapper,handler:e.proxy(function(e){var i=this.options.direction.indexOf(e)>-1,s=i?this.$element.outerHeight(!0):"";this.$wrapper.height(s),this.$element.toggleClass(this.options.stuckClass,i),t&&t.call(this,e)},this)}))},t.prototype.createWrapper=function(){this.$element.wrap(this.options.wrapper),this.$wrapper=this.$element.parent(),this.wrapper=this.$wrapper[0]},t.prototype.destroy=function(){this.$element.parent()[0]===this.wrapper&&(this.waypoint.destroy(),this.$element.removeClass(this.options.stuckClass).unwrap())},t.defaults={wrapper:'<div class="sticky-wrapper" />',stuckClass:"stuck",direction:"down right"},i.Sticky=t}();
|
||||
Reference in New Issue
Block a user