first commit
This commit is contained in:
7
public/wri/js/bootstrap.min.js
vendored
Normal file
7
public/wri/js/bootstrap.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
157
public/wri/js/custom.js
vendored
Normal file
157
public/wri/js/custom.js
vendored
Normal file
@ -0,0 +1,157 @@
|
||||
$(window).on('load', function(){
|
||||
|
||||
"use strict";
|
||||
|
||||
|
||||
/* ========================================================== */
|
||||
/* Navigation Background Color */
|
||||
/* ========================================================== */
|
||||
|
||||
$(window).on('scroll', function() {
|
||||
if($(this).scrollTop() > 450) {
|
||||
$('.navbar-fixed-top').addClass('opaque');
|
||||
} else {
|
||||
$('.navbar-fixed-top').removeClass('opaque');
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
/* ========================================================== */
|
||||
/* Hide Responsive Navigation On-Click */
|
||||
/* ========================================================== */
|
||||
|
||||
$(".navbar-nav li a").on('click', function(event) {
|
||||
$(".navbar-collapse").collapse('hide');
|
||||
});
|
||||
|
||||
|
||||
/* ========================================================== */
|
||||
/* Navigation Color */
|
||||
/* ========================================================== */
|
||||
|
||||
$('#navbarCollapse').onePageNav({
|
||||
filter: ':not(.external)'
|
||||
});
|
||||
|
||||
|
||||
/* ========================================================== */
|
||||
/* SmoothScroll */
|
||||
/* ========================================================== */
|
||||
|
||||
$(".navbar-nav li a, a.scrool").on('click', function(e) {
|
||||
|
||||
var full_url = this.href;
|
||||
var parts = full_url.split("#");
|
||||
var trgt = parts[1];
|
||||
var target_offset = $("#"+trgt).offset();
|
||||
var target_top = target_offset.top;
|
||||
|
||||
$('html,body').animate({scrollTop:target_top -70}, 1000);
|
||||
return false;
|
||||
|
||||
});
|
||||
|
||||
|
||||
/* ========================================================== */
|
||||
/* Newsletter */
|
||||
/* ========================================================== */
|
||||
|
||||
$('.newsletter-form').each( function(){
|
||||
var form = $(this);
|
||||
//form.validate();
|
||||
form.submit(function(e) {
|
||||
if (!e.isDefaultPrevented()) {
|
||||
jQuery.post(this.action,{
|
||||
'email':$('input[name="nf_email"]').val(),
|
||||
},function(data){
|
||||
form.fadeOut('fast', function() {
|
||||
$(this).siblings('p.newsletter_success_box').show();
|
||||
});
|
||||
});
|
||||
e.preventDefault();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
/* ========================================================== */
|
||||
/* Register */
|
||||
/* ========================================================== */
|
||||
|
||||
$('#register-form').each( function(){
|
||||
var form = $(this);
|
||||
//form.validate();
|
||||
form.submit(function(e) {
|
||||
if (!e.isDefaultPrevented()) {
|
||||
jQuery.post(this.action,{
|
||||
'names':$('input[name="register_names"]').val(),
|
||||
'email':$('input[name="register_email"]').val(),
|
||||
'phone':$('input[name="register_phone"]').val(),
|
||||
'ticket':$('select[name="register_ticket"]').val(),
|
||||
},function(data){
|
||||
form.fadeOut('fast', function() {
|
||||
$(this).siblings('p.register_success_box').show();
|
||||
});
|
||||
});
|
||||
e.preventDefault();
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
|
||||
/* ========================================================== */
|
||||
/* Contact */
|
||||
/* ========================================================== */
|
||||
$('#contact-form').each( function(){
|
||||
var form = $(this);
|
||||
//form.validate();
|
||||
form.submit(function(e) {
|
||||
if (!e.isDefaultPrevented()) {
|
||||
jQuery.post(this.action,{
|
||||
'names':$('input[name="contact_names"]').val(),
|
||||
'subject':$('input[name="contact_subject"]').val(),
|
||||
'email':$('input[name="contact_email"]').val(),
|
||||
'phone':$('input[name="contact_phone"]').val(),
|
||||
'message':$('textarea[name="contact_message"]').val(),
|
||||
},function(data){
|
||||
form.fadeOut('fast', function() {
|
||||
$(this).siblings('p').show();
|
||||
});
|
||||
});
|
||||
e.preventDefault();
|
||||
}
|
||||
});
|
||||
})
|
||||
});
|
||||
|
||||
/* ========================================================== */
|
||||
/* Popup-Gallery */
|
||||
/* ========================================================== */
|
||||
$('.popup-gallery').find('a.popup1').magnificPopup({
|
||||
type: 'image',
|
||||
gallery: {
|
||||
enabled:true
|
||||
}
|
||||
});
|
||||
|
||||
$('.popup-gallery').find('a.popup2').magnificPopup({
|
||||
type: 'image',
|
||||
gallery: {
|
||||
enabled:true
|
||||
}
|
||||
});
|
||||
|
||||
$('.popup-gallery').find('a.popup3').magnificPopup({
|
||||
type: 'image',
|
||||
gallery: {
|
||||
enabled:true
|
||||
}
|
||||
});
|
||||
|
||||
$('.popup-gallery').find('a.popup4').magnificPopup({
|
||||
type: 'iframe',
|
||||
gallery: {
|
||||
enabled:false
|
||||
}
|
||||
});
|
||||
|
2
public/wri/js/jquery-3.3.1.min.js
vendored
Normal file
2
public/wri/js/jquery-3.3.1.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
4
public/wri/js/jquery.magnific-popup.min.js
vendored
Normal file
4
public/wri/js/jquery.magnific-popup.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
223
public/wri/js/jquery.nav.js
vendored
Normal file
223
public/wri/js/jquery.nav.js
vendored
Normal file
@ -0,0 +1,223 @@
|
||||
/*
|
||||
* jQuery One Page Nav Plugin
|
||||
* http://github.com/davist11/jQuery-One-Page-Nav
|
||||
*
|
||||
* Copyright (c) 2010 Trevor Davis (http://trevordavis.net)
|
||||
* Dual licensed under the MIT and GPL licenses.
|
||||
* Uses the same license as jQuery, see:
|
||||
* http://jquery.org/license
|
||||
*
|
||||
* @version 2.2.0
|
||||
*
|
||||
* Example usage:
|
||||
* $('#nav').onePageNav({
|
||||
* currentClass: 'current',
|
||||
* changeHash: false,
|
||||
* scrollSpeed: 750
|
||||
* });
|
||||
*/
|
||||
|
||||
;(function($, window, document, undefined){
|
||||
|
||||
// our plugin constructor
|
||||
var OnePageNav = function(elem, options){
|
||||
this.elem = elem;
|
||||
this.$elem = $(elem);
|
||||
this.options = options;
|
||||
this.metadata = this.$elem.data('plugin-options');
|
||||
this.$nav = this.$elem.find('a');
|
||||
this.$win = $(window);
|
||||
this.sections = {};
|
||||
this.didScroll = false;
|
||||
this.$doc = $(document);
|
||||
this.docHeight = this.$doc.height();
|
||||
};
|
||||
|
||||
// the plugin prototype
|
||||
OnePageNav.prototype = {
|
||||
defaults: {
|
||||
currentClass: 'current',
|
||||
changeHash: false,
|
||||
easing: 'swing',
|
||||
filter: '',
|
||||
scrollSpeed: 750,
|
||||
scrollOffset: 0,
|
||||
scrollThreshold: 0.5,
|
||||
begin: false,
|
||||
end: false,
|
||||
scrollChange: false
|
||||
},
|
||||
|
||||
init: function() {
|
||||
var self = this;
|
||||
|
||||
// Introduce defaults that can be extended either
|
||||
// globally or using an object literal.
|
||||
self.config = $.extend({}, self.defaults, self.options, self.metadata);
|
||||
|
||||
//Filter any links out of the nav
|
||||
if(self.config.filter !== '') {
|
||||
self.$nav = self.$nav.filter(self.config.filter);
|
||||
}
|
||||
|
||||
//Handle clicks on the nav
|
||||
self.$nav.on('click.onePageNav', $.proxy(self.handleClick, self));
|
||||
|
||||
//Get the section positions
|
||||
self.getPositions();
|
||||
|
||||
//Handle scroll changes
|
||||
self.bindInterval();
|
||||
|
||||
//Update the positions on resize too
|
||||
self.$win.on('resize.onePageNav', $.proxy(self.getPositions, self));
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
adjustNav: function(self, $parent) {
|
||||
self.$elem.find('.' + self.config.currentClass).removeClass(self.config.currentClass);
|
||||
$parent.addClass(self.config.currentClass);
|
||||
},
|
||||
|
||||
bindInterval: function() {
|
||||
var self = this;
|
||||
var docHeight;
|
||||
|
||||
self.$win.on('scroll.onePageNav', function() {
|
||||
self.didScroll = true;
|
||||
});
|
||||
|
||||
self.t = setInterval(function() {
|
||||
docHeight = self.$doc.height();
|
||||
|
||||
//If it was scrolled
|
||||
if(self.didScroll) {
|
||||
self.didScroll = false;
|
||||
self.scrollChange();
|
||||
}
|
||||
|
||||
//If the document height changes
|
||||
if(docHeight !== self.docHeight) {
|
||||
self.docHeight = docHeight;
|
||||
self.getPositions();
|
||||
}
|
||||
}, 250);
|
||||
},
|
||||
|
||||
getHash: function($link) {
|
||||
return $link.attr('href').split('#')[1];
|
||||
},
|
||||
|
||||
getPositions: function() {
|
||||
var self = this;
|
||||
var linkHref;
|
||||
var topPos;
|
||||
var $target;
|
||||
|
||||
self.$nav.each(function() {
|
||||
linkHref = self.getHash($(this));
|
||||
$target = $('#' + linkHref);
|
||||
|
||||
if($target.length) {
|
||||
topPos = $target.offset().top;
|
||||
self.sections[linkHref] = Math.round(topPos) - self.config.scrollOffset;
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
getSection: function(windowPos) {
|
||||
var returnValue = null;
|
||||
var windowHeight = Math.round(this.$win.height() * this.config.scrollThreshold);
|
||||
|
||||
for(var section in this.sections) {
|
||||
if((this.sections[section] - windowHeight) < windowPos) {
|
||||
returnValue = section;
|
||||
}
|
||||
}
|
||||
|
||||
return returnValue;
|
||||
},
|
||||
|
||||
handleClick: function(e) {
|
||||
var self = this;
|
||||
var $link = $(e.currentTarget);
|
||||
var $parent = $link.parent();
|
||||
var newLoc = '#' + self.getHash($link);
|
||||
|
||||
if(!$parent.hasClass(self.config.currentClass)) {
|
||||
//Start callback
|
||||
if(self.config.begin) {
|
||||
self.config.begin();
|
||||
}
|
||||
|
||||
//Change the highlighted nav item
|
||||
self.adjustNav(self, $parent);
|
||||
|
||||
//Removing the auto-adjust on scroll
|
||||
self.unbindInterval();
|
||||
|
||||
//Scroll to the correct position
|
||||
$.scrollTo(newLoc, self.config.scrollSpeed, {
|
||||
axis: 'y',
|
||||
easing: self.config.easing,
|
||||
offset: {
|
||||
top: -self.config.scrollOffset
|
||||
},
|
||||
onAfter: function() {
|
||||
//Do we need to change the hash?
|
||||
if(self.config.changeHash) {
|
||||
window.location.hash = newLoc;
|
||||
}
|
||||
|
||||
//Add the auto-adjust on scroll back in
|
||||
self.bindInterval();
|
||||
|
||||
//End callback
|
||||
if(self.config.end) {
|
||||
self.config.end();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
e.preventDefault();
|
||||
},
|
||||
|
||||
scrollChange: function() {
|
||||
var windowTop = this.$win.scrollTop();
|
||||
var position = this.getSection(windowTop);
|
||||
var $parent;
|
||||
|
||||
//If the position is set
|
||||
if(position !== null) {
|
||||
$parent = this.$elem.find('a[href$="#' + position + '"]').parent();
|
||||
|
||||
//If it's not already the current section
|
||||
if(!$parent.hasClass(this.config.currentClass)) {
|
||||
//Change the highlighted nav item
|
||||
this.adjustNav(this, $parent);
|
||||
|
||||
//If there is a scrollChange callback
|
||||
if(this.config.scrollChange) {
|
||||
this.config.scrollChange($parent);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
unbindInterval: function() {
|
||||
clearInterval(this.t);
|
||||
this.$win.unbind('scroll.onePageNav');
|
||||
}
|
||||
};
|
||||
|
||||
OnePageNav.defaults = OnePageNav.prototype.defaults;
|
||||
|
||||
$.fn.onePageNav = function(options) {
|
||||
return this.each(function() {
|
||||
new OnePageNav(this, options).init();
|
||||
});
|
||||
};
|
||||
|
||||
})( jQuery, window , document );
|
7
public/wri/js/jquery.scrollTo-min.js
vendored
Normal file
7
public/wri/js/jquery.scrollTo-min.js
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
/**
|
||||
* Copyright (c) 2007-2015 Ariel Flesler - aflesler<a>gmail<d>com | http://flesler.blogspot.com
|
||||
* Licensed under MIT
|
||||
* @author Ariel Flesler
|
||||
* @version 2.1.1
|
||||
*/
|
||||
;(function(f){"use strict";"function"===typeof define&&define.amd?define(["jquery"],f):"undefined"!==typeof module&&module.exports?module.exports=f(require("jquery")):f(jQuery)})(function($){"use strict";function n(a){return!a.nodeName||-1!==$.inArray(a.nodeName.toLowerCase(),["iframe","#document","html","body"])}function h(a){return $.isFunction(a)||$.isPlainObject(a)?a:{top:a,left:a}}var p=$.scrollTo=function(a,d,b){return $(window).scrollTo(a,d,b)};p.defaults={axis:"xy",duration:0,limit:!0};$.fn.scrollTo=function(a,d,b){"object"=== typeof d&&(b=d,d=0);"function"===typeof b&&(b={onAfter:b});"max"===a&&(a=9E9);b=$.extend({},p.defaults,b);d=d||b.duration;var u=b.queue&&1<b.axis.length;u&&(d/=2);b.offset=h(b.offset);b.over=h(b.over);return this.each(function(){function k(a){var k=$.extend({},b,{queue:!0,duration:d,complete:a&&function(){a.call(q,e,b)}});r.animate(f,k)}if(null!==a){var l=n(this),q=l?this.contentWindow||window:this,r=$(q),e=a,f={},t;switch(typeof e){case "number":case "string":if(/^([+-]=?)?\d+(\.\d+)?(px|%)?$/.test(e)){e= h(e);break}e=l?$(e):$(e,q);if(!e.length)return;case "object":if(e.is||e.style)t=(e=$(e)).offset()}var v=$.isFunction(b.offset)&&b.offset(q,e)||b.offset;$.each(b.axis.split(""),function(a,c){var d="x"===c?"Left":"Top",m=d.toLowerCase(),g="scroll"+d,h=r[g](),n=p.max(q,c);t?(f[g]=t[m]+(l?0:h-r.offset()[m]),b.margin&&(f[g]-=parseInt(e.css("margin"+d),10)||0,f[g]-=parseInt(e.css("border"+d+"Width"),10)||0),f[g]+=v[m]||0,b.over[m]&&(f[g]+=e["x"===c?"width":"height"]()*b.over[m])):(d=e[m],f[g]=d.slice&& "%"===d.slice(-1)?parseFloat(d)/100*n:d);b.limit&&/^\d+$/.test(f[g])&&(f[g]=0>=f[g]?0:Math.min(f[g],n));!a&&1<b.axis.length&&(h===f[g]?f={}:u&&(k(b.onAfterFirst),f={}))});k(b.onAfter)}})};p.max=function(a,d){var b="x"===d?"Width":"Height",h="scroll"+b;if(!n(a))return a[h]-$(a)[b.toLowerCase()]();var b="client"+b,k=a.ownerDocument||a.document,l=k.documentElement,k=k.body;return Math.max(l[h],k[h])-Math.min(l[b],k[b])};$.Tween.propHooks.scrollLeft=$.Tween.propHooks.scrollTop={get:function(a){return $(a.elem)[a.prop]()}, set:function(a){var d=this.get(a);if(a.options.interrupt&&a._last&&a._last!==d)return $(a.elem).stop();var b=Math.round(a.now);d!==b&&($(a.elem)[a.prop](b),a._last=this.get(a))}};return p});
|
22
public/wri/js/plugins.js
vendored
Normal file
22
public/wri/js/plugins.js
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
/**
|
||||
* WOW.js Reveal CSS animation as you scroll down a page
|
||||
**/
|
||||
wow = new WOW(
|
||||
{
|
||||
animateClass: 'animated',
|
||||
offset: 100,
|
||||
mobile: false, // trigger animations on mobile devices (default is true)
|
||||
|
||||
}
|
||||
);
|
||||
wow.init();
|
||||
|
||||
/**
|
||||
* jQuery.LocalScroll - Animated scrolling navigation, using anchors.
|
||||
* Copyright (c) 2007-2009 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
|
||||
* Dual licensed under MIT and GPL.
|
||||
* Date: 3/11/2009
|
||||
* @author Ariel Flesler
|
||||
* @version 1.2.7
|
||||
**/
|
||||
;(function($){var l=location.href.replace(/#.*/,'');var g=$.localScroll=function(a){$('body').localScroll(a)};g.defaults={duration:1e3,axis:'y',event:'click',stop:true,target:window,reset:true};g.hash=function(a){if(location.hash){a=$.extend({},g.defaults,a);a.hash=false;if(a.reset){var e=a.duration;delete a.duration;$(a.target).scrollTo(0,a);a.duration=e}i(0,location,a)}};$.fn.localScroll=function(b){b=$.extend({},g.defaults,b);return b.lazy?this.bind(b.event,function(a){var e=$([a.target,a.target.parentNode]).filter(d)[0];if(e)i(a,e,b)}):this.find('a,area').filter(d).bind(b.event,function(a){i(a,this,b)}).end().end();function d(){return!!this.href&&!!this.hash&&this.href.replace(this.hash,'')==l&&(!b.filter||$(this).is(b.filter))}};function i(a,e,b){var d=e.hash.slice(1),f=document.getElementById(d)||document.getElementsByName(d)[0];if(!f)return;if(a)a.preventDefault();var h=$(b.target);if(b.lock&&h.is(':animated')||b.onBefore&&b.onBefore.call(b,a,f,h)===false)return;if(b.stop)h.stop(true);if(b.hash){var j=f.id==d?'id':'name',k=$('<a> </a>').attr(j,d).css({position:'absolute',top:$(window).scrollTop(),left:$(window).scrollLeft()});f[j]='';$('body').prepend(k);location=e.hash;k.remove();f[j]=d}h.scrollTo(f,b).trigger('notify.serialScroll',[f])}})(jQuery);
|
514
public/wri/js/wow.js
vendored
Normal file
514
public/wri/js/wow.js
vendored
Normal file
@ -0,0 +1,514 @@
|
||||
(function() {
|
||||
var MutationObserver, Util, WeakMap, getComputedStyle, getComputedStyleRX,
|
||||
bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
|
||||
indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
|
||||
|
||||
Util = (function() {
|
||||
function Util() {}
|
||||
|
||||
Util.prototype.extend = function(custom, defaults) {
|
||||
var key, value;
|
||||
for (key in defaults) {
|
||||
value = defaults[key];
|
||||
if (custom[key] == null) {
|
||||
custom[key] = value;
|
||||
}
|
||||
}
|
||||
return custom;
|
||||
};
|
||||
|
||||
Util.prototype.isMobile = function(agent) {
|
||||
return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(agent);
|
||||
};
|
||||
|
||||
Util.prototype.createEvent = function(event, bubble, cancel, detail) {
|
||||
var customEvent;
|
||||
if (bubble == null) {
|
||||
bubble = false;
|
||||
}
|
||||
if (cancel == null) {
|
||||
cancel = false;
|
||||
}
|
||||
if (detail == null) {
|
||||
detail = null;
|
||||
}
|
||||
if (document.createEvent != null) {
|
||||
customEvent = document.createEvent('CustomEvent');
|
||||
customEvent.initCustomEvent(event, bubble, cancel, detail);
|
||||
} else if (document.createEventObject != null) {
|
||||
customEvent = document.createEventObject();
|
||||
customEvent.eventType = event;
|
||||
} else {
|
||||
customEvent.eventName = event;
|
||||
}
|
||||
return customEvent;
|
||||
};
|
||||
|
||||
Util.prototype.emitEvent = function(elem, event) {
|
||||
if (elem.dispatchEvent != null) {
|
||||
return elem.dispatchEvent(event);
|
||||
} else if (event in (elem != null)) {
|
||||
return elem[event]();
|
||||
} else if (("on" + event) in (elem != null)) {
|
||||
return elem["on" + event]();
|
||||
}
|
||||
};
|
||||
|
||||
Util.prototype.addEvent = function(elem, event, fn) {
|
||||
if (elem.addEventListener != null) {
|
||||
return elem.addEventListener(event, fn, false);
|
||||
} else if (elem.attachEvent != null) {
|
||||
return elem.attachEvent("on" + event, fn);
|
||||
} else {
|
||||
return elem[event] = fn;
|
||||
}
|
||||
};
|
||||
|
||||
Util.prototype.removeEvent = function(elem, event, fn) {
|
||||
if (elem.removeEventListener != null) {
|
||||
return elem.removeEventListener(event, fn, false);
|
||||
} else if (elem.detachEvent != null) {
|
||||
return elem.detachEvent("on" + event, fn);
|
||||
} else {
|
||||
return delete elem[event];
|
||||
}
|
||||
};
|
||||
|
||||
Util.prototype.innerHeight = function() {
|
||||
if ('innerHeight' in window) {
|
||||
return window.innerHeight;
|
||||
} else {
|
||||
return document.documentElement.clientHeight;
|
||||
}
|
||||
};
|
||||
|
||||
return Util;
|
||||
|
||||
})();
|
||||
|
||||
WeakMap = this.WeakMap || this.MozWeakMap || (WeakMap = (function() {
|
||||
function WeakMap() {
|
||||
this.keys = [];
|
||||
this.values = [];
|
||||
}
|
||||
|
||||
WeakMap.prototype.get = function(key) {
|
||||
var i, item, j, len, ref;
|
||||
ref = this.keys;
|
||||
for (i = j = 0, len = ref.length; j < len; i = ++j) {
|
||||
item = ref[i];
|
||||
if (item === key) {
|
||||
return this.values[i];
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
WeakMap.prototype.set = function(key, value) {
|
||||
var i, item, j, len, ref;
|
||||
ref = this.keys;
|
||||
for (i = j = 0, len = ref.length; j < len; i = ++j) {
|
||||
item = ref[i];
|
||||
if (item === key) {
|
||||
this.values[i] = value;
|
||||
return;
|
||||
}
|
||||
}
|
||||
this.keys.push(key);
|
||||
return this.values.push(value);
|
||||
};
|
||||
|
||||
return WeakMap;
|
||||
|
||||
})());
|
||||
|
||||
MutationObserver = this.MutationObserver || this.WebkitMutationObserver || this.MozMutationObserver || (MutationObserver = (function() {
|
||||
function MutationObserver() {
|
||||
if (typeof console !== "undefined" && console !== null) {
|
||||
console.warn('MutationObserver is not supported by your browser.');
|
||||
}
|
||||
if (typeof console !== "undefined" && console !== null) {
|
||||
console.warn('WOW.js cannot detect dom mutations, please call .sync() after loading new content.');
|
||||
}
|
||||
}
|
||||
|
||||
MutationObserver.notSupported = true;
|
||||
|
||||
MutationObserver.prototype.observe = function() {};
|
||||
|
||||
return MutationObserver;
|
||||
|
||||
})());
|
||||
|
||||
getComputedStyle = this.getComputedStyle || function(el, pseudo) {
|
||||
this.getPropertyValue = function(prop) {
|
||||
var ref;
|
||||
if (prop === 'float') {
|
||||
prop = 'styleFloat';
|
||||
}
|
||||
if (getComputedStyleRX.test(prop)) {
|
||||
prop.replace(getComputedStyleRX, function(_, _char) {
|
||||
return _char.toUpperCase();
|
||||
});
|
||||
}
|
||||
return ((ref = el.currentStyle) != null ? ref[prop] : void 0) || null;
|
||||
};
|
||||
return this;
|
||||
};
|
||||
|
||||
getComputedStyleRX = /(\-([a-z]){1})/g;
|
||||
|
||||
this.WOW = (function() {
|
||||
WOW.prototype.defaults = {
|
||||
boxClass: 'wow',
|
||||
animateClass: 'animated',
|
||||
offset: 0,
|
||||
mobile: true,
|
||||
live: true,
|
||||
callback: null,
|
||||
scrollContainer: null
|
||||
};
|
||||
|
||||
function WOW(options) {
|
||||
if (options == null) {
|
||||
options = {};
|
||||
}
|
||||
this.scrollCallback = bind(this.scrollCallback, this);
|
||||
this.scrollHandler = bind(this.scrollHandler, this);
|
||||
this.resetAnimation = bind(this.resetAnimation, this);
|
||||
this.start = bind(this.start, this);
|
||||
this.scrolled = true;
|
||||
this.config = this.util().extend(options, this.defaults);
|
||||
if (options.scrollContainer != null) {
|
||||
this.config.scrollContainer = document.querySelector(options.scrollContainer);
|
||||
}
|
||||
this.animationNameCache = new WeakMap();
|
||||
this.wowEvent = this.util().createEvent(this.config.boxClass);
|
||||
}
|
||||
|
||||
WOW.prototype.init = function() {
|
||||
var ref;
|
||||
this.element = window.document.documentElement;
|
||||
if ((ref = document.readyState) === "interactive" || ref === "complete") {
|
||||
this.start();
|
||||
} else {
|
||||
this.util().addEvent(document, 'DOMContentLoaded', this.start);
|
||||
}
|
||||
return this.finished = [];
|
||||
};
|
||||
|
||||
WOW.prototype.start = function() {
|
||||
var box, j, len, ref;
|
||||
this.stopped = false;
|
||||
this.boxes = (function() {
|
||||
var j, len, ref, results;
|
||||
ref = this.element.querySelectorAll("." + this.config.boxClass);
|
||||
results = [];
|
||||
for (j = 0, len = ref.length; j < len; j++) {
|
||||
box = ref[j];
|
||||
results.push(box);
|
||||
}
|
||||
return results;
|
||||
}).call(this);
|
||||
this.all = (function() {
|
||||
var j, len, ref, results;
|
||||
ref = this.boxes;
|
||||
results = [];
|
||||
for (j = 0, len = ref.length; j < len; j++) {
|
||||
box = ref[j];
|
||||
results.push(box);
|
||||
}
|
||||
return results;
|
||||
}).call(this);
|
||||
if (this.boxes.length) {
|
||||
if (this.disabled()) {
|
||||
this.resetStyle();
|
||||
} else {
|
||||
ref = this.boxes;
|
||||
for (j = 0, len = ref.length; j < len; j++) {
|
||||
box = ref[j];
|
||||
this.applyStyle(box, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!this.disabled()) {
|
||||
this.util().addEvent(this.config.scrollContainer || window, 'scroll', this.scrollHandler);
|
||||
this.util().addEvent(window, 'resize', this.scrollHandler);
|
||||
this.interval = setInterval(this.scrollCallback, 50);
|
||||
}
|
||||
if (this.config.live) {
|
||||
return new MutationObserver((function(_this) {
|
||||
return function(records) {
|
||||
var k, len1, node, record, results;
|
||||
results = [];
|
||||
for (k = 0, len1 = records.length; k < len1; k++) {
|
||||
record = records[k];
|
||||
results.push((function() {
|
||||
var l, len2, ref1, results1;
|
||||
ref1 = record.addedNodes || [];
|
||||
results1 = [];
|
||||
for (l = 0, len2 = ref1.length; l < len2; l++) {
|
||||
node = ref1[l];
|
||||
results1.push(this.doSync(node));
|
||||
}
|
||||
return results1;
|
||||
}).call(_this));
|
||||
}
|
||||
return results;
|
||||
};
|
||||
})(this)).observe(document.body, {
|
||||
childList: true,
|
||||
subtree: true
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
WOW.prototype.stop = function() {
|
||||
this.stopped = true;
|
||||
this.util().removeEvent(this.config.scrollContainer || window, 'scroll', this.scrollHandler);
|
||||
this.util().removeEvent(window, 'resize', this.scrollHandler);
|
||||
if (this.interval != null) {
|
||||
return clearInterval(this.interval);
|
||||
}
|
||||
};
|
||||
|
||||
WOW.prototype.sync = function(element) {
|
||||
if (MutationObserver.notSupported) {
|
||||
return this.doSync(this.element);
|
||||
}
|
||||
};
|
||||
|
||||
WOW.prototype.doSync = function(element) {
|
||||
var box, j, len, ref, results;
|
||||
if (element == null) {
|
||||
element = this.element;
|
||||
}
|
||||
if (element.nodeType !== 1) {
|
||||
return;
|
||||
}
|
||||
element = element.parentNode || element;
|
||||
ref = element.querySelectorAll("." + this.config.boxClass);
|
||||
results = [];
|
||||
for (j = 0, len = ref.length; j < len; j++) {
|
||||
box = ref[j];
|
||||
if (indexOf.call(this.all, box) < 0) {
|
||||
this.boxes.push(box);
|
||||
this.all.push(box);
|
||||
if (this.stopped || this.disabled()) {
|
||||
this.resetStyle();
|
||||
} else {
|
||||
this.applyStyle(box, true);
|
||||
}
|
||||
results.push(this.scrolled = true);
|
||||
} else {
|
||||
results.push(void 0);
|
||||
}
|
||||
}
|
||||
return results;
|
||||
};
|
||||
|
||||
WOW.prototype.show = function(box) {
|
||||
this.applyStyle(box);
|
||||
box.className = box.className + " " + this.config.animateClass;
|
||||
if (this.config.callback != null) {
|
||||
this.config.callback(box);
|
||||
}
|
||||
this.util().emitEvent(box, this.wowEvent);
|
||||
this.util().addEvent(box, 'animationend', this.resetAnimation);
|
||||
this.util().addEvent(box, 'oanimationend', this.resetAnimation);
|
||||
this.util().addEvent(box, 'webkitAnimationEnd', this.resetAnimation);
|
||||
this.util().addEvent(box, 'MSAnimationEnd', this.resetAnimation);
|
||||
return box;
|
||||
};
|
||||
|
||||
WOW.prototype.applyStyle = function(box, hidden) {
|
||||
var delay, duration, iteration;
|
||||
duration = box.getAttribute('data-wow-duration');
|
||||
delay = box.getAttribute('data-wow-delay');
|
||||
iteration = box.getAttribute('data-wow-iteration');
|
||||
return this.animate((function(_this) {
|
||||
return function() {
|
||||
return _this.customStyle(box, hidden, duration, delay, iteration);
|
||||
};
|
||||
})(this));
|
||||
};
|
||||
|
||||
WOW.prototype.animate = (function() {
|
||||
if ('requestAnimationFrame' in window) {
|
||||
return function(callback) {
|
||||
return window.requestAnimationFrame(callback);
|
||||
};
|
||||
} else {
|
||||
return function(callback) {
|
||||
return callback();
|
||||
};
|
||||
}
|
||||
})();
|
||||
|
||||
WOW.prototype.resetStyle = function() {
|
||||
var box, j, len, ref, results;
|
||||
ref = this.boxes;
|
||||
results = [];
|
||||
for (j = 0, len = ref.length; j < len; j++) {
|
||||
box = ref[j];
|
||||
results.push(box.style.visibility = 'visible');
|
||||
}
|
||||
return results;
|
||||
};
|
||||
|
||||
WOW.prototype.resetAnimation = function(event) {
|
||||
var target;
|
||||
if (event.type.toLowerCase().indexOf('animationend') >= 0) {
|
||||
target = event.target || event.srcElement;
|
||||
return target.className = target.className.replace(this.config.animateClass, '').trim();
|
||||
}
|
||||
};
|
||||
|
||||
WOW.prototype.customStyle = function(box, hidden, duration, delay, iteration) {
|
||||
if (hidden) {
|
||||
this.cacheAnimationName(box);
|
||||
}
|
||||
box.style.visibility = hidden ? 'hidden' : 'visible';
|
||||
if (duration) {
|
||||
this.vendorSet(box.style, {
|
||||
animationDuration: duration
|
||||
});
|
||||
}
|
||||
if (delay) {
|
||||
this.vendorSet(box.style, {
|
||||
animationDelay: delay
|
||||
});
|
||||
}
|
||||
if (iteration) {
|
||||
this.vendorSet(box.style, {
|
||||
animationIterationCount: iteration
|
||||
});
|
||||
}
|
||||
this.vendorSet(box.style, {
|
||||
animationName: hidden ? 'none' : this.cachedAnimationName(box)
|
||||
});
|
||||
return box;
|
||||
|
||||
};
|
||||
|
||||
WOW.prototype.vendors = ["moz", "webkit"];
|
||||
|
||||
WOW.prototype.vendorSet = function(elem, properties) {
|
||||
var name, results, value, vendor;
|
||||
results = [];
|
||||
for (name in properties) {
|
||||
value = properties[name];
|
||||
elem["" + name] = value;
|
||||
results.push((function() {
|
||||
var j, len, ref, results1;
|
||||
ref = this.vendors;
|
||||
results1 = [];
|
||||
for (j = 0, len = ref.length; j < len; j++) {
|
||||
vendor = ref[j];
|
||||
results1.push(elem["" + vendor + (name.charAt(0).toUpperCase()) + (name.substr(1))] = value);
|
||||
}
|
||||
return results1;
|
||||
}).call(this));
|
||||
}
|
||||
return results;
|
||||
};
|
||||
|
||||
WOW.prototype.vendorCSS = function(elem, property) {
|
||||
var j, len, ref, result, style, vendor;
|
||||
style = getComputedStyle(elem);
|
||||
result = style.getPropertyCSSValue(property);
|
||||
ref = this.vendors;
|
||||
for (j = 0, len = ref.length; j < len; j++) {
|
||||
vendor = ref[j];
|
||||
result = result || style.getPropertyCSSValue("-" + vendor + "-" + property);
|
||||
}
|
||||
return result;
|
||||
};
|
||||
|
||||
WOW.prototype.animationName = function(box) {
|
||||
var animationName;
|
||||
try {
|
||||
animationName = this.vendorCSS(box, 'animation-name').cssText;
|
||||
} catch (_error) {
|
||||
animationName = getComputedStyle(box).getPropertyValue('animation-name');
|
||||
}
|
||||
if (animationName === 'none') {
|
||||
return '';
|
||||
} else {
|
||||
return animationName;
|
||||
}
|
||||
};
|
||||
|
||||
WOW.prototype.cacheAnimationName = function(box) {
|
||||
return this.animationNameCache.set(box, this.animationName(box));
|
||||
};
|
||||
|
||||
WOW.prototype.cachedAnimationName = function(box) {
|
||||
return this.animationNameCache.get(box);
|
||||
};
|
||||
|
||||
WOW.prototype.scrollHandler = function() {
|
||||
return this.scrolled = true;
|
||||
};
|
||||
|
||||
WOW.prototype.scrollCallback = function() {
|
||||
var box;
|
||||
if (this.scrolled) {
|
||||
this.scrolled = false;
|
||||
this.boxes = (function() {
|
||||
var j, len, ref, results;
|
||||
ref = this.boxes;
|
||||
results = [];
|
||||
for (j = 0, len = ref.length; j < len; j++) {
|
||||
box = ref[j];
|
||||
if (!(box)) {
|
||||
continue;
|
||||
}
|
||||
if (this.isVisible(box)) {
|
||||
this.show(box);
|
||||
continue;
|
||||
}
|
||||
results.push(box);
|
||||
}
|
||||
return results;
|
||||
}).call(this);
|
||||
if (!(this.boxes.length || this.config.live)) {
|
||||
return this.stop();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
WOW.prototype.offsetTop = function(element) {
|
||||
var top;
|
||||
while (element.offsetTop === void 0) {
|
||||
element = element.parentNode;
|
||||
}
|
||||
top = element.offsetTop;
|
||||
while (element = element.offsetParent) {
|
||||
top += element.offsetTop;
|
||||
}
|
||||
return top;
|
||||
};
|
||||
|
||||
WOW.prototype.isVisible = function(box) {
|
||||
var bottom, offset, top, viewBottom, viewTop;
|
||||
offset = box.getAttribute('data-wow-offset') || this.config.offset;
|
||||
viewTop = (this.config.scrollContainer && this.config.scrollContainer.scrollTop) || window.pageYOffset;
|
||||
viewBottom = viewTop + Math.min(this.element.clientHeight, this.util().innerHeight()) - offset;
|
||||
top = this.offsetTop(box);
|
||||
bottom = top + box.clientHeight;
|
||||
return top <= viewBottom && bottom >= viewTop;
|
||||
};
|
||||
|
||||
WOW.prototype.util = function() {
|
||||
return this._util != null ? this._util : this._util = new Util();
|
||||
};
|
||||
|
||||
WOW.prototype.disabled = function() {
|
||||
return !this.config.mobile && this.util().isMobile(navigator.userAgent);
|
||||
};
|
||||
|
||||
return WOW;
|
||||
|
||||
})();
|
||||
|
||||
}).call(this);
|
Reference in New Issue
Block a user