First commit.
This commit is contained in:
commit
9679384794
45 changed files with 25197 additions and 0 deletions
10
js/circle-progress.min.js
vendored
Normal file
10
js/circle-progress.min.js
vendored
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
/**
|
||||
* jquery-circle-progress - jQuery Plugin to draw animated circular progress bars:
|
||||
* {@link http://kottenator.github.io/jquery-circle-progress/}
|
||||
*
|
||||
* @author Rostyslav Bryzgunov <kottenator@gmail.com>
|
||||
* @version 1.2.2
|
||||
* @licence MIT
|
||||
* @preserve
|
||||
*/
|
||||
!function(i){if("function"==typeof define&&define.amd)define(["jquery"],i);else if("object"==typeof module&&module.exports){var t=require("jquery");i(t),module.exports=t}else i(jQuery)}(function(i){function t(i){this.init(i)}t.prototype={value:0,size:100,startAngle:-Math.PI,thickness:"auto",fill:{gradient:["#3aeabb","#fdd250"]},emptyFill:"rgba(0, 0, 0, .1)",animation:{duration:1200,easing:"circleProgressEasing"},animationStartValue:0,reverse:!1,lineCap:"butt",insertMode:"prepend",constructor:t,el:null,canvas:null,ctx:null,radius:0,arcFill:null,lastFrameValue:0,init:function(t){i.extend(this,t),this.radius=this.size/2,this.initWidget(),this.initFill(),this.draw(),this.el.trigger("circle-inited")},initWidget:function(){this.canvas||(this.canvas=i("<canvas>")["prepend"==this.insertMode?"prependTo":"appendTo"](this.el)[0]);var t=this.canvas;if(t.width=this.size,t.height=this.size,this.ctx=t.getContext("2d"),window.devicePixelRatio>1){var e=window.devicePixelRatio;t.style.width=t.style.height=this.size+"px",t.width=t.height=this.size*e,this.ctx.scale(e,e)}},initFill:function(){function t(){var t=i("<canvas>")[0];t.width=e.size,t.height=e.size,t.getContext("2d").drawImage(g,0,0,r,r),e.arcFill=e.ctx.createPattern(t,"no-repeat"),e.drawFrame(e.lastFrameValue)}var e=this,a=this.fill,n=this.ctx,r=this.size;if(!a)throw Error("The fill is not specified!");if("string"==typeof a&&(a={color:a}),a.color&&(this.arcFill=a.color),a.gradient){var s=a.gradient;if(1==s.length)this.arcFill=s[0];else if(s.length>1){for(var l=a.gradientAngle||0,o=a.gradientDirection||[r/2*(1-Math.cos(l)),r/2*(1+Math.sin(l)),r/2*(1+Math.cos(l)),r/2*(1-Math.sin(l))],h=n.createLinearGradient.apply(n,o),c=0;c<s.length;c++){var d=s[c],u=c/(s.length-1);i.isArray(d)&&(u=d[1],d=d[0]),h.addColorStop(u,d)}this.arcFill=h}}if(a.image){var g;a.image instanceof Image?g=a.image:(g=new Image,g.src=a.image),g.complete?t():g.onload=t}},draw:function(){this.animation?this.drawAnimated(this.value):this.drawFrame(this.value)},drawFrame:function(i){this.lastFrameValue=i,this.ctx.clearRect(0,0,this.size,this.size),this.drawEmptyArc(i),this.drawArc(i)},drawArc:function(i){if(0!==i){var t=this.ctx,e=this.radius,a=this.getThickness(),n=this.startAngle;t.save(),t.beginPath(),this.reverse?t.arc(e,e,e-a/2,n-2*Math.PI*i,n):t.arc(e,e,e-a/2,n,n+2*Math.PI*i),t.lineWidth=a,t.lineCap=this.lineCap,t.strokeStyle=this.arcFill,t.stroke(),t.restore()}},drawEmptyArc:function(i){var t=this.ctx,e=this.radius,a=this.getThickness(),n=this.startAngle;i<1&&(t.save(),t.beginPath(),i<=0?t.arc(e,e,e-a/2,0,2*Math.PI):this.reverse?t.arc(e,e,e-a/2,n,n-2*Math.PI*i):t.arc(e,e,e-a/2,n+2*Math.PI*i,n),t.lineWidth=a,t.strokeStyle=this.emptyFill,t.stroke(),t.restore())},drawAnimated:function(t){var e=this,a=this.el,n=i(this.canvas);n.stop(!0,!1),a.trigger("circle-animation-start"),n.css({animationProgress:0}).animate({animationProgress:1},i.extend({},this.animation,{step:function(i){var n=e.animationStartValue*(1-i)+t*i;e.drawFrame(n),a.trigger("circle-animation-progress",[i,n])}})).promise().always(function(){a.trigger("circle-animation-end")})},getThickness:function(){return i.isNumeric(this.thickness)?this.thickness:this.size/14},getValue:function(){return this.value},setValue:function(i){this.animation&&(this.animationStartValue=this.lastFrameValue),this.value=i,this.draw()}},i.circleProgress={defaults:t.prototype},i.easing.circleProgressEasing=function(i){return i<.5?(i=2*i,.5*i*i*i):(i=2-2*i,1-.5*i*i*i)},i.fn.circleProgress=function(e,a){var n="circle-progress",r=this.data(n);if("widget"==e){if(!r)throw Error('Calling "widget" method on not initialized instance is forbidden');return r.canvas}if("value"==e){if(!r)throw Error('Calling "value" method on not initialized instance is forbidden');if("undefined"==typeof a)return r.getValue();var s=arguments[1];return this.each(function(){i(this).data(n).setValue(s)})}return this.each(function(){var a=i(this),r=a.data(n),s=i.isPlainObject(e)?e:{};if(r)r.init(s);else{var l=i.extend({},a.data());"string"==typeof l.fill&&(l.fill=JSON.parse(l.fill)),"string"==typeof l.animation&&(l.animation=JSON.parse(l.animation)),s=i.extend(l,s),s.el=a,r=new t(s),a.data(n,r)}})}});
|
||||
212
js/custom.js
Normal file
212
js/custom.js
Normal file
|
|
@ -0,0 +1,212 @@
|
|||
|
||||
(function($) {
|
||||
// 'use strict';
|
||||
|
||||
// Main Navigation
|
||||
$( '.hamburger-menu' ).on( 'click', function() {
|
||||
$(this).toggleClass('open');
|
||||
$('.site-navigation').toggleClass('show');
|
||||
});
|
||||
|
||||
var countdown_date = $('.countdown').data("date");
|
||||
|
||||
$('.countdown').countdown(countdown_date, function(event) {
|
||||
$('.dday').html(event.strftime('%-D'));
|
||||
$('.dhour').html(event.strftime('%-H'));
|
||||
$('.dmin').html(event.strftime('%-M'));
|
||||
$('.dsec').html(event.strftime('%-S'));
|
||||
});
|
||||
|
||||
// Events Slider
|
||||
var next_event_slider = new Swiper('.next-event-slider', {
|
||||
slidesPerView: 4,
|
||||
spaceBetween: 20,
|
||||
loop: true,
|
||||
centeredSlides: true,
|
||||
breakpoints: {
|
||||
// when window width is <= 320px
|
||||
576: {
|
||||
slidesPerView: 1
|
||||
},
|
||||
// when window width is <= 480px
|
||||
768: {
|
||||
slidesPerView: 2
|
||||
},
|
||||
// when window width is <= 640px
|
||||
1200: {
|
||||
slidesPerView: 3
|
||||
}
|
||||
},
|
||||
navigation: {
|
||||
nextEl: '.next-event-slider-wrap .swiper-button-next'
|
||||
}
|
||||
});
|
||||
|
||||
// Testimonial slider
|
||||
var testimonialsSlider = new Swiper('.testimonials-slider', {
|
||||
slidesPerView: 1,
|
||||
spaceBetween: 0,
|
||||
loop: true,
|
||||
pagination: {
|
||||
el: '.swiper-pagination',
|
||||
clickable: true,
|
||||
},
|
||||
navigation: {
|
||||
nextEl: '.testimonials-container .swiper-button-next'
|
||||
}
|
||||
});
|
||||
|
||||
// Buy Tickets Form
|
||||
$(".increase-ticket").click(function() {
|
||||
var $n = $(this)
|
||||
.parent(".number-of-tickets")
|
||||
.parent(".flex")
|
||||
.parent(".ticket-row")
|
||||
.find(".ticket-count");
|
||||
$n.val(Number($n.val())+1 );
|
||||
});
|
||||
|
||||
$(".decrease-ticket").click(function() {
|
||||
var $n = $(this)
|
||||
.parent(".number-of-tickets")
|
||||
.parent(".flex")
|
||||
.parent(".ticket-row")
|
||||
.find(".ticket-count");
|
||||
var amount = Number($n.val());
|
||||
if (amount > 0) {
|
||||
$n.val(amount-1);
|
||||
}
|
||||
});
|
||||
|
||||
$(".clear-ticket-count").on( 'click', function() {
|
||||
var $count = $('.ticket-count');
|
||||
$count.val('1');
|
||||
});
|
||||
|
||||
// Tabs
|
||||
$(function() {
|
||||
$('.tab-content:first-child').show();
|
||||
|
||||
$('.tab-nav').bind('click', function(e) {
|
||||
$this = $(this);
|
||||
$tabs = $this.parent().parent().next();
|
||||
$target = $($this.data("target"));
|
||||
$this.siblings().removeClass('active');
|
||||
$target.siblings().css("display", "none");
|
||||
$this.addClass('active');
|
||||
$target.fadeIn("slow");
|
||||
});
|
||||
|
||||
$('.tab-nav:first-child').trigger('click');
|
||||
});
|
||||
|
||||
// Accordion & Toggle
|
||||
$('.accordion-wrap.type-accordion').collapsible({
|
||||
accordion: true,
|
||||
contentOpen: 0,
|
||||
arrowRclass: 'arrow-r',
|
||||
arrowDclass: 'arrow-d'
|
||||
});
|
||||
|
||||
$('.accordion-wrap .entry-title').on('click', function() {
|
||||
$('.accordion-wrap .entry-title').removeClass('active');
|
||||
$(this).addClass('active');
|
||||
});
|
||||
|
||||
// Circular Progress Bar
|
||||
$('#hard_work').circleProgress({
|
||||
startAngle: -Math.PI / 4 * 2,
|
||||
value: 0.75,
|
||||
size: 220,
|
||||
thickness: 3,
|
||||
fill: {
|
||||
gradient: ["#00d1ff", "#1effc5"]
|
||||
}
|
||||
}).on('circle-animation-progress', function(event, progress) {
|
||||
$(this).find('strong').html(Math.round(75 * progress) + '<span>%</span>');
|
||||
});
|
||||
|
||||
$('#good_music').circleProgress({
|
||||
startAngle: -Math.PI / 4 * 2,
|
||||
value: 0.83,
|
||||
size: 220,
|
||||
thickness: 3,
|
||||
fill: {
|
||||
gradient: ["#00d1ff", "#1effc5"]
|
||||
}
|
||||
}).on('circle-animation-progress', function(event, progress) {
|
||||
$(this).find('strong').html(Math.round(83 * progress) + '<span>%</span>');
|
||||
});
|
||||
|
||||
$('#power').circleProgress({
|
||||
startAngle: -Math.PI / 4 * 2,
|
||||
value: 0.65,
|
||||
size: 220,
|
||||
thickness: 3,
|
||||
fill: {
|
||||
gradient: ["#00d1ff", "#1effc5"]
|
||||
}
|
||||
}).on('circle-animation-progress', function(event, progress) {
|
||||
$(this).find('strong').html(Math.round(65 * progress) + '<span>%</span>');
|
||||
});
|
||||
|
||||
$('#fun_time').circleProgress({
|
||||
startAngle: -Math.PI / 4 * 2,
|
||||
value: 1,
|
||||
size: 220,
|
||||
thickness: 3,
|
||||
fill: {
|
||||
gradient: ["#00d1ff", "#1effc5"]
|
||||
}
|
||||
}).on('circle-animation-progress', function(event, progress) {
|
||||
$(this).find('strong').html(Math.round(100 * progress) + '<span>%</span>');
|
||||
});
|
||||
|
||||
// Counter
|
||||
$(".start-counter").each(function () {
|
||||
var counter = $(this);
|
||||
|
||||
counter.countTo({
|
||||
formatter: function (value, options) {
|
||||
return value.toFixed(options.decimals).replace(/\B(?=(?:\d{3})+(?!\d))/g, ',');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Load more events
|
||||
var $container = $('.blog-list-page');
|
||||
var $item = $('.single-blog-content');
|
||||
|
||||
$item.slice(0, 6).addClass('visible');
|
||||
|
||||
$('.load-more .btn').on('click', function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
$('.single-blog-content:hidden').slice(0, 6).addClass('visible');
|
||||
$container.masonry();
|
||||
});
|
||||
|
||||
// Back to Top
|
||||
if ( $( '.back-to-top' ).length) {
|
||||
var scrollTrigger = 500, // px
|
||||
backToTop = function () {
|
||||
var scrollTop = $(window).scrollTop();
|
||||
if (scrollTop > scrollTrigger) {
|
||||
$('.back-to-top').addClass('show');
|
||||
} else {
|
||||
$('.back-to-top').removeClass('show');
|
||||
}
|
||||
};
|
||||
backToTop();
|
||||
$(window).on('scroll', function () {
|
||||
backToTop();
|
||||
});
|
||||
$('.back-to-top').on('click', function (e) {
|
||||
e.preventDefault();
|
||||
$('html,body').animate({
|
||||
scrollTop: 0
|
||||
}, 800);
|
||||
});
|
||||
}
|
||||
|
||||
})(jQuery);
|
||||
9
js/jquery.collapsible.min.js
vendored
Normal file
9
js/jquery.collapsible.min.js
vendored
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
/*!
|
||||
* Collapsible.js v1.2.0
|
||||
* https://github.com/jordnkr/collapsible
|
||||
*
|
||||
* Copyright 2017, Jordan Ruedy
|
||||
* This content is released under the MIT license
|
||||
* http://opensource.org/licenses/MIT
|
||||
*/
|
||||
!function(e,s){e.fn.collapsible=function(s){var n={accordion:!1,accordionUpSpeed:400,accordionDownSpeed:400,collapseSpeed:400,contentOpen:null,arrowRclass:"arrow-r",arrowDclass:"arrow-d",animate:!0},c=e.extend(n,s);return this.each(function(){!1===c.animate&&(c.accordionUpSpeed=0,c.accordionDownSpeed=0,c.collapseSpeed=0);var s=e(this).children(":even"),n=e(this).children(":odd"),r="accordion-active";if(e(this).children(":nth-child(even)").css("display","none"),!0===c.accordion)null!==c.contentOpen&&(e(s[c.contentOpen]).children(":first-child").toggleClass(c.arrowRclass+" "+c.arrowDclass),e(n[c.contentOpen]).show().addClass(r)),e(s).click(function(){e(this).next().attr("class")===r?(e(this).next().slideUp(c.accordionUpSpeed).removeClass(r),e(this).children(":first-child").toggleClass(c.arrowRclass+" "+c.arrowDclass)):(e(s).children().removeClass(c.arrowDclass).addClass(c.arrowRclass),e(n).slideUp(c.accordionUpSpeed).removeClass(r),e(this).next().slideDown(c.accordionDownSpeed).addClass(r),e(this).children(":first-child").toggleClass(c.arrowRclass+" "+c.arrowDclass))});else{if(null!==c.contentOpen)if(Array.isArray(c.contentOpen))for(var a=0;a<c.contentOpen.length;a++){var l=c.contentOpen[a];e(s[l]).children(":first-child").toggleClass(c.arrowRclass+" "+c.arrowDclass),e(n[l]).show()}else e(s[c.contentOpen]).children(":first-child").toggleClass(c.arrowRclass+" "+c.arrowDclass),e(n[c.contentOpen]).show();e(s).click(function(){e(this).children(":first-child").toggleClass(c.arrowRclass+" "+c.arrowDclass),e(this).next().slideToggle(c.collapseSpeed)})}})}}(jQuery);
|
||||
1
js/jquery.countTo.min.js
vendored
Normal file
1
js/jquery.countTo.min.js
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
!function(t){"function"==typeof define&&define.amd?define(["jquery"],t):t("object"==typeof exports?require("jquery"):jQuery)}(function(t){function e(t,e){return t.toFixed(e.decimals)}var o=function(e,i){this.$element=t(e),this.options=t.extend({},o.DEFAULTS,this.dataOptions(),i),this.init()};o.DEFAULTS={from:0,to:0,speed:1e3,refreshInterval:100,decimals:0,formatter:e,onUpdate:null,onComplete:null},o.prototype.init=function(){this.value=this.options.from,this.loops=Math.ceil(this.options.speed/this.options.refreshInterval),this.loopCount=0,this.increment=(this.options.to-this.options.from)/this.loops},o.prototype.dataOptions=function(){var t={from:this.$element.data("from"),to:this.$element.data("to"),speed:this.$element.data("speed"),refreshInterval:this.$element.data("refresh-interval"),decimals:this.$element.data("decimals")},e=Object.keys(t);for(var o in e){var i=e[o];"undefined"==typeof t[i]&&delete t[i]}return t},o.prototype.update=function(){this.value+=this.increment,this.loopCount++,this.render(),"function"==typeof this.options.onUpdate&&this.options.onUpdate.call(this.$element,this.value),this.loopCount>=this.loops&&(clearInterval(this.interval),this.value=this.options.to,"function"==typeof this.options.onComplete&&this.options.onComplete.call(this.$element,this.value))},o.prototype.render=function(){var t=this.options.formatter.call(this.$element,this.value,this.options);this.$element.text(t)},o.prototype.restart=function(){this.stop(),this.init(),this.start()},o.prototype.start=function(){this.stop(),this.render(),this.interval=setInterval(this.update.bind(this),this.options.refreshInterval)},o.prototype.stop=function(){this.interval&&clearInterval(this.interval)},o.prototype.toggle=function(){this.interval?this.stop():this.start()},t.fn.countTo=function(e){return this.each(function(){var i=t(this),n=i.data("countTo"),s=!n||"object"==typeof e,r="object"==typeof e?e:{},a="string"==typeof e?e:"start";s&&(n&&n.stop(),i.data("countTo",n=new o(this,r))),n[a].call(n)})}});
|
||||
235
js/jquery.countdown.js
Normal file
235
js/jquery.countdown.js
Normal file
|
|
@ -0,0 +1,235 @@
|
|||
/*!
|
||||
* The Final Countdown for jQuery v2.1.0 (http://hilios.github.io/jQuery.countdown/)
|
||||
* Copyright (c) 2015 Edson Hilios
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
(function(factory) {
|
||||
"use strict";
|
||||
if (typeof define === "function" && define.amd) {
|
||||
define([ "jquery" ], factory);
|
||||
} else {
|
||||
factory(jQuery);
|
||||
}
|
||||
})(function($) {
|
||||
"use strict";
|
||||
var instances = [], matchers = [], defaultOptions = {
|
||||
precision: 100,
|
||||
elapse: false
|
||||
};
|
||||
matchers.push(/^[0-9]*$/.source);
|
||||
matchers.push(/([0-9]{1,2}\/){2}[0-9]{4}( [0-9]{1,2}(:[0-9]{2}){2})?/.source);
|
||||
matchers.push(/[0-9]{4}([\/\-][0-9]{1,2}){2}( [0-9]{1,2}(:[0-9]{2}){2})?/.source);
|
||||
matchers = new RegExp(matchers.join("|"));
|
||||
function parseDateString(dateString) {
|
||||
if (dateString instanceof Date) {
|
||||
return dateString;
|
||||
}
|
||||
if (String(dateString).match(matchers)) {
|
||||
if (String(dateString).match(/^[0-9]*$/)) {
|
||||
dateString = Number(dateString);
|
||||
}
|
||||
if (String(dateString).match(/\-/)) {
|
||||
dateString = String(dateString).replace(/\-/g, "/");
|
||||
}
|
||||
return new Date(dateString);
|
||||
} else {
|
||||
throw new Error("Couldn't cast `" + dateString + "` to a date object.");
|
||||
}
|
||||
}
|
||||
var DIRECTIVE_KEY_MAP = {
|
||||
Y: "years",
|
||||
m: "months",
|
||||
n: "daysToMonth",
|
||||
w: "weeks",
|
||||
d: "daysToWeek",
|
||||
D: "totalDays",
|
||||
H: "hours",
|
||||
M: "minutes",
|
||||
S: "seconds"
|
||||
};
|
||||
function escapedRegExp(str) {
|
||||
var sanitize = str.toString().replace(/([.?*+^$[\]\\(){}|-])/g, "\\$1");
|
||||
return new RegExp(sanitize);
|
||||
}
|
||||
function strftime(offsetObject) {
|
||||
return function(format) {
|
||||
var directives = format.match(/%(-|!)?[A-Z]{1}(:[^;]+;)?/gi);
|
||||
if (directives) {
|
||||
for (var i = 0, len = directives.length; i < len; ++i) {
|
||||
var directive = directives[i].match(/%(-|!)?([a-zA-Z]{1})(:[^;]+;)?/), regexp = escapedRegExp(directive[0]), modifier = directive[1] || "", plural = directive[3] || "", value = null;
|
||||
directive = directive[2];
|
||||
if (DIRECTIVE_KEY_MAP.hasOwnProperty(directive)) {
|
||||
value = DIRECTIVE_KEY_MAP[directive];
|
||||
value = Number(offsetObject[value]);
|
||||
}
|
||||
if (value !== null) {
|
||||
if (modifier === "!") {
|
||||
value = pluralize(plural, value);
|
||||
}
|
||||
if (modifier === "") {
|
||||
if (value < 10) {
|
||||
value = "0" + value.toString();
|
||||
}
|
||||
}
|
||||
format = format.replace(regexp, value.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
format = format.replace(/%%/, "%");
|
||||
return format;
|
||||
};
|
||||
}
|
||||
function pluralize(format, count) {
|
||||
var plural = "s", singular = "";
|
||||
if (format) {
|
||||
format = format.replace(/(:|;|\s)/gi, "").split(/\,/);
|
||||
if (format.length === 1) {
|
||||
plural = format[0];
|
||||
} else {
|
||||
singular = format[0];
|
||||
plural = format[1];
|
||||
}
|
||||
}
|
||||
if (Math.abs(count) === 1) {
|
||||
return singular;
|
||||
} else {
|
||||
return plural;
|
||||
}
|
||||
}
|
||||
var Countdown = function(el, finalDate, options) {
|
||||
this.el = el;
|
||||
this.$el = $(el);
|
||||
this.interval = null;
|
||||
this.offset = {};
|
||||
this.options = $.extend({}, defaultOptions);
|
||||
this.instanceNumber = instances.length;
|
||||
instances.push(this);
|
||||
this.$el.data("countdown-instance", this.instanceNumber);
|
||||
if (options) {
|
||||
if (typeof options === "function") {
|
||||
this.$el.on("update.countdown", options);
|
||||
this.$el.on("stoped.countdown", options);
|
||||
this.$el.on("finish.countdown", options);
|
||||
} else {
|
||||
this.options = $.extend({}, defaultOptions, options);
|
||||
}
|
||||
}
|
||||
this.setFinalDate(finalDate);
|
||||
this.start();
|
||||
};
|
||||
$.extend(Countdown.prototype, {
|
||||
start: function() {
|
||||
if (this.interval !== null) {
|
||||
clearInterval(this.interval);
|
||||
}
|
||||
var self = this;
|
||||
this.update();
|
||||
this.interval = setInterval(function() {
|
||||
self.update.call(self);
|
||||
}, this.options.precision);
|
||||
},
|
||||
stop: function() {
|
||||
clearInterval(this.interval);
|
||||
this.interval = null;
|
||||
this.dispatchEvent("stoped");
|
||||
},
|
||||
toggle: function() {
|
||||
if (this.interval) {
|
||||
this.stop();
|
||||
} else {
|
||||
this.start();
|
||||
}
|
||||
},
|
||||
pause: function() {
|
||||
this.stop();
|
||||
},
|
||||
resume: function() {
|
||||
this.start();
|
||||
},
|
||||
remove: function() {
|
||||
this.stop.call(this);
|
||||
instances[this.instanceNumber] = null;
|
||||
delete this.$el.data().countdownInstance;
|
||||
},
|
||||
setFinalDate: function(value) {
|
||||
this.finalDate = parseDateString(value);
|
||||
},
|
||||
update: function() {
|
||||
if (this.$el.closest("html").length === 0) {
|
||||
this.remove();
|
||||
return;
|
||||
}
|
||||
var hasEventsAttached = $._data(this.el, "events") !== undefined, now = new Date(), newTotalSecsLeft;
|
||||
newTotalSecsLeft = this.finalDate.getTime() - now.getTime();
|
||||
newTotalSecsLeft = Math.ceil(newTotalSecsLeft / 1e3);
|
||||
newTotalSecsLeft = !this.options.elapse && newTotalSecsLeft < 0 ? 0 : Math.abs(newTotalSecsLeft);
|
||||
if (this.totalSecsLeft === newTotalSecsLeft || !hasEventsAttached) {
|
||||
return;
|
||||
} else {
|
||||
this.totalSecsLeft = newTotalSecsLeft;
|
||||
}
|
||||
this.elapsed = now >= this.finalDate;
|
||||
this.offset = {
|
||||
seconds: this.totalSecsLeft % 60,
|
||||
minutes: Math.floor(this.totalSecsLeft / 60) % 60,
|
||||
hours: Math.floor(this.totalSecsLeft / 60 / 60) % 24,
|
||||
days: Math.floor(this.totalSecsLeft / 60 / 60 / 24) % 7,
|
||||
daysToWeek: Math.floor(this.totalSecsLeft / 60 / 60 / 24) % 7,
|
||||
daysToMonth: Math.floor(this.totalSecsLeft / 60 / 60 / 24 % 30.4368),
|
||||
totalDays: Math.floor(this.totalSecsLeft / 60 / 60 / 24),
|
||||
weeks: Math.floor(this.totalSecsLeft / 60 / 60 / 24 / 7),
|
||||
months: Math.floor(this.totalSecsLeft / 60 / 60 / 24 / 30.4368),
|
||||
years: Math.abs(this.finalDate.getFullYear() - now.getFullYear())
|
||||
};
|
||||
if (!this.options.elapse && this.totalSecsLeft === 0) {
|
||||
this.stop();
|
||||
this.dispatchEvent("finish");
|
||||
} else {
|
||||
this.dispatchEvent("update");
|
||||
}
|
||||
},
|
||||
dispatchEvent: function(eventName) {
|
||||
var event = $.Event(eventName + ".countdown");
|
||||
event.finalDate = this.finalDate;
|
||||
event.elapsed = this.elapsed;
|
||||
event.offset = $.extend({}, this.offset);
|
||||
event.strftime = strftime(this.offset);
|
||||
this.$el.trigger(event);
|
||||
}
|
||||
});
|
||||
$.fn.countdown = function() {
|
||||
var argumentsArray = Array.prototype.slice.call(arguments, 0);
|
||||
return this.each(function() {
|
||||
var instanceNumber = $(this).data("countdown-instance");
|
||||
if (instanceNumber !== undefined) {
|
||||
var instance = instances[instanceNumber], method = argumentsArray[0];
|
||||
if (Countdown.prototype.hasOwnProperty(method)) {
|
||||
instance[method].apply(instance, argumentsArray.slice(1));
|
||||
} else if (String(method).match(/^[$A-Z_][0-9A-Z_$]*$/i) === null) {
|
||||
instance.setFinalDate.call(instance, method);
|
||||
instance.start();
|
||||
} else {
|
||||
$.error("Method %s does not exist on jQuery.countdown".replace(/\%s/gi, method));
|
||||
}
|
||||
} else {
|
||||
new Countdown(this, argumentsArray[0], argumentsArray[1]);
|
||||
}
|
||||
});
|
||||
};
|
||||
});
|
||||
1
js/jquery.countdown.min.js
vendored
Normal file
1
js/jquery.countdown.min.js
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
!function(a){"use strict";"function"==typeof define&&define.amd?define(["jquery"],a):a(jQuery)}(function(a){"use strict";function b(a){if(a instanceof Date)return a;if(String(a).match(g))return String(a).match(/^[0-9]*$/)&&(a=Number(a)),String(a).match(/\-/)&&(a=String(a).replace(/\-/g,"/")),new Date(a);throw new Error("Couldn't cast `"+a+"` to a date object.")}function c(a){var b=a.toString().replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1");return new RegExp(b)}function d(a){return function(b){var d=b.match(/%(-|!)?[A-Z]{1}(:[^;]+;)?/gi);if(d)for(var f=0,g=d.length;g>f;++f){var h=d[f].match(/%(-|!)?([a-zA-Z]{1})(:[^;]+;)?/),j=c(h[0]),k=h[1]||"",l=h[3]||"",m=null;h=h[2],i.hasOwnProperty(h)&&(m=i[h],m=Number(a[m])),null!==m&&("!"===k&&(m=e(l,m)),""===k&&10>m&&(m="0"+m.toString()),b=b.replace(j,m.toString()))}return b=b.replace(/%%/,"%")}}function e(a,b){var c="s",d="";return a&&(a=a.replace(/(:|;|\s)/gi,"").split(/\,/),1===a.length?c=a[0]:(d=a[0],c=a[1])),1===Math.abs(b)?d:c}var f=[],g=[],h={precision:100,elapse:!1};g.push(/^[0-9]*$/.source),g.push(/([0-9]{1,2}\/){2}[0-9]{4}( [0-9]{1,2}(:[0-9]{2}){2})?/.source),g.push(/[0-9]{4}([\/\-][0-9]{1,2}){2}( [0-9]{1,2}(:[0-9]{2}){2})?/.source),g=new RegExp(g.join("|"));var i={Y:"years",m:"months",n:"daysToMonth",w:"weeks",d:"daysToWeek",D:"totalDays",H:"hours",M:"minutes",S:"seconds"},j=function(b,c,d){this.el=b,this.$el=a(b),this.interval=null,this.offset={},this.options=a.extend({},h),this.instanceNumber=f.length,f.push(this),this.$el.data("countdown-instance",this.instanceNumber),d&&("function"==typeof d?(this.$el.on("update.countdown",d),this.$el.on("stoped.countdown",d),this.$el.on("finish.countdown",d)):this.options=a.extend({},h,d)),this.setFinalDate(c),this.start()};a.extend(j.prototype,{start:function(){null!==this.interval&&clearInterval(this.interval);var a=this;this.update(),this.interval=setInterval(function(){a.update.call(a)},this.options.precision)},stop:function(){clearInterval(this.interval),this.interval=null,this.dispatchEvent("stoped")},toggle:function(){this.interval?this.stop():this.start()},pause:function(){this.stop()},resume:function(){this.start()},remove:function(){this.stop.call(this),f[this.instanceNumber]=null,delete this.$el.data().countdownInstance},setFinalDate:function(a){this.finalDate=b(a)},update:function(){if(0===this.$el.closest("html").length)return void this.remove();var b,c=void 0!==a._data(this.el,"events"),d=new Date;b=this.finalDate.getTime()-d.getTime(),b=Math.ceil(b/1e3),b=!this.options.elapse&&0>b?0:Math.abs(b),this.totalSecsLeft!==b&&c&&(this.totalSecsLeft=b,this.elapsed=d>=this.finalDate,this.offset={seconds:this.totalSecsLeft%60,minutes:Math.floor(this.totalSecsLeft/60)%60,hours:Math.floor(this.totalSecsLeft/60/60)%24,days:Math.floor(this.totalSecsLeft/60/60/24)%7,daysToWeek:Math.floor(this.totalSecsLeft/60/60/24)%7,daysToMonth:Math.floor(this.totalSecsLeft/60/60/24%30.4368),totalDays:Math.floor(this.totalSecsLeft/60/60/24),weeks:Math.floor(this.totalSecsLeft/60/60/24/7),months:Math.floor(this.totalSecsLeft/60/60/24/30.4368),years:Math.abs(this.finalDate.getFullYear()-d.getFullYear())},this.options.elapse||0!==this.totalSecsLeft?this.dispatchEvent("update"):(this.stop(),this.dispatchEvent("finish")))},dispatchEvent:function(b){var c=a.Event(b+".countdown");c.finalDate=this.finalDate,c.elapsed=this.elapsed,c.offset=a.extend({},this.offset),c.strftime=d(this.offset),this.$el.trigger(c)}}),a.fn.countdown=function(){var b=Array.prototype.slice.call(arguments,0);return this.each(function(){var c=a(this).data("countdown-instance");if(void 0!==c){var d=f[c],e=b[0];j.prototype.hasOwnProperty(e)?d[e].apply(d,b.slice(1)):null===String(e).match(/^[$A-Z_][0-9A-Z_$]*$/i)?(d.setFinalDate.call(d,e),d.start()):a.error("Method %s does not exist on jQuery.countdown".replace(/\%s/gi,e))}else new j(this,b[0],b[1])})}});
|
||||
6
js/jquery.js
vendored
Normal file
6
js/jquery.js
vendored
Normal file
File diff suppressed because one or more lines are too long
9
js/masonry.pkgd.min.js
vendored
Normal file
9
js/masonry.pkgd.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
7320
js/swiper.js
Normal file
7320
js/swiper.js
Normal file
File diff suppressed because it is too large
Load diff
13
js/swiper.min.js
vendored
Normal file
13
js/swiper.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue