27102023
This commit is contained in:
9
js/bootstrap-datetimepicker.min.js
vendored
Normal file
9
js/bootstrap-datetimepicker.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
2320
js/bootstrap.js
vendored
Normal file
2320
js/bootstrap.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
7
js/bootstrap.min.js
vendored
Normal file
7
js/bootstrap.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
91
js/contact-form-validation-recaptcha.js
Normal file
91
js/contact-form-validation-recaptcha.js
Normal file
@@ -0,0 +1,91 @@
|
||||
jQuery(document).ready(function($) {
|
||||
|
||||
'use strict';
|
||||
|
||||
$('#contact-form').validate({
|
||||
submitHandler: function(form) {
|
||||
|
||||
var $form = $(form),
|
||||
$messageSuccess = $('#contactSuccess'),
|
||||
$messageError = $('#contactError'),
|
||||
$submitButton = $(this.submitButton);
|
||||
|
||||
$submitButton.button('loading');
|
||||
|
||||
// Ajax Submit
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: $form.attr('action'),
|
||||
data: $('#contact-form').serialize(),
|
||||
dataType: 'json',
|
||||
complete: function(data) {
|
||||
|
||||
if (typeof data.responseJSON === 'object') {
|
||||
if (data.responseJSON.response == 'success') {
|
||||
|
||||
$messageSuccess.removeClass('hidden');
|
||||
$messageError.addClass('hidden');
|
||||
|
||||
// Reset Form
|
||||
$form.find('.controled')
|
||||
.val('')
|
||||
.blur()
|
||||
.parent()
|
||||
.removeClass('has-success')
|
||||
.removeClass('has-error')
|
||||
.find('label.error')
|
||||
.remove();
|
||||
|
||||
$form.find('.controled').removeClass('error');
|
||||
|
||||
if (($messageSuccess.offset().top - 80) < $(window).scrollTop()) {
|
||||
$('html, body').animate({
|
||||
scrollTop: $messageSuccess.offset().top - 80
|
||||
}, 300);
|
||||
}
|
||||
|
||||
$submitButton.button('reset');
|
||||
|
||||
$('.controled').keyup(function(){
|
||||
$messageSuccess.addClass('hidden');
|
||||
});
|
||||
grecaptcha.reset();
|
||||
return;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
$messageError.removeClass('hidden');
|
||||
$messageSuccess.addClass('hidden');
|
||||
|
||||
// Reset Form
|
||||
$form.find('.controled')
|
||||
.val('')
|
||||
.blur()
|
||||
.parent()
|
||||
.removeClass('has-success')
|
||||
.removeClass('has-error')
|
||||
.find('label.error')
|
||||
.remove();
|
||||
|
||||
if (($messageError.offset().top - 80) < $(window).scrollTop()) {
|
||||
$('html, body').animate({
|
||||
scrollTop: $messageError.offset().top - 80
|
||||
}, 300);
|
||||
}
|
||||
|
||||
$form.find('.has-success').removeClass('has-success');
|
||||
|
||||
$submitButton.button('reset');
|
||||
|
||||
$('.controled').keyup(function(){
|
||||
$messageError.addClass('hidden');
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
91
js/contact-form-validation.js
Normal file
91
js/contact-form-validation.js
Normal file
@@ -0,0 +1,91 @@
|
||||
jQuery(document).ready(function($) {
|
||||
|
||||
'use strict';
|
||||
|
||||
$('#contact-form').validate({
|
||||
submitHandler: function(form) {
|
||||
|
||||
var $form = $(form),
|
||||
$messageSuccess = $('#contactSuccess'),
|
||||
$messageError = $('#contactError'),
|
||||
$submitButton = $(this.submitButton);
|
||||
|
||||
$submitButton.button('loading');
|
||||
|
||||
// Ajax Submit
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: $form.attr('action'),
|
||||
data: $('#contact-form').serialize(),
|
||||
dataType: 'json',
|
||||
complete: function(data) {
|
||||
|
||||
if (typeof data.responseJSON === 'object') {
|
||||
if (data.responseJSON.response == 'success') {
|
||||
|
||||
$messageSuccess.removeClass('hidden');
|
||||
$messageError.addClass('hidden');
|
||||
|
||||
// Reset Form
|
||||
$form.find('.controled')
|
||||
.val('')
|
||||
.blur()
|
||||
.parent()
|
||||
.removeClass('has-success')
|
||||
.removeClass('has-error')
|
||||
.find('label.error')
|
||||
.remove();
|
||||
|
||||
$form.find('.controled').removeClass('error');
|
||||
|
||||
if (($messageSuccess.offset().top - 80) < $(window).scrollTop()) {
|
||||
$('html, body').animate({
|
||||
scrollTop: $messageSuccess.offset().top - 80
|
||||
}, 300);
|
||||
}
|
||||
|
||||
$submitButton.button('reset');
|
||||
|
||||
$('.controled').keyup(function(){
|
||||
$messageSuccess.addClass('hidden');
|
||||
});
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
$messageError.removeClass('hidden');
|
||||
$messageSuccess.addClass('hidden');
|
||||
|
||||
// Reset Form
|
||||
$form.find('.controled')
|
||||
.val('')
|
||||
.blur()
|
||||
.parent()
|
||||
.removeClass('has-success')
|
||||
.removeClass('has-error')
|
||||
.find('label.error')
|
||||
.remove();
|
||||
|
||||
if (($messageError.offset().top - 80) < $(window).scrollTop()) {
|
||||
$('html, body').animate({
|
||||
scrollTop: $messageError.offset().top - 80
|
||||
}, 300);
|
||||
}
|
||||
|
||||
$form.find('.has-success').removeClass('has-success');
|
||||
|
||||
$submitButton.button('reset');
|
||||
|
||||
$('.controled').keyup(function(){
|
||||
$messageError.addClass('hidden');
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
1
js/contact-form-validation.min.js
vendored
Normal file
1
js/contact-form-validation.min.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
jQuery(document).ready(function(e){"use strict";e("#contact-form").validate({submitHandler:function(s){var o=e(s),a=e("#contactSuccess"),t=e("#contactError"),r=e(this.submitButton);r.button("loading"),e.ajax({type:"POST",url:o.attr("action"),data:{name:o.find("#name").val(),email:o.find("#email").val(),subject:o.find("#subject").val(),message:o.find("#message").val()},dataType:"json",complete:function(s){return"object"==typeof s.responseJSON&&"success"==s.responseJSON.response?(a.removeClass("hidden"),t.addClass("hidden"),o.find(".controled").val("").blur().parent().removeClass("has-success").removeClass("has-error").find("label.error").remove(),o.find(".controled").removeClass("error"),a.offset().top-80<e(window).scrollTop()&&e("html, body").animate({scrollTop:a.offset().top-80},300),r.button("reset"),void e(".controled").keyup(function(){a.addClass("hidden")})):(t.removeClass("hidden"),a.addClass("hidden"),o.find(".controled").val("").blur().parent().removeClass("has-success").removeClass("has-error").find("label.error").remove(),t.offset().top-80<e(window).scrollTop()&&e("html, body").animate({scrollTop:t.offset().top-80},300),o.find(".has-success").removeClass("has-success"),r.button("reset"),void e(".controled").keyup(function(){t.addClass("hidden")}))}})}})});
|
||||
75
js/flex-slider.js
Normal file
75
js/flex-slider.js
Normal file
@@ -0,0 +1,75 @@
|
||||
jQuery(document).ready(function($) {
|
||||
|
||||
// Flex Slider
|
||||
$(window).ready(function() {
|
||||
|
||||
//FLEX SLIDER CAROUSEL INITIALIZE ---------------------------------------------
|
||||
if ( $('.carousel-post-style1').length ){
|
||||
$('.carousel-post-style1').flexslider({ });
|
||||
};
|
||||
|
||||
$('.flexslider').flexslider({
|
||||
animation: 'fade',
|
||||
animationLoop: true, //Boolean: Should the animation loop? If false, directionNav will received "disable" classes at either end
|
||||
slideshow: true, //Boolean: Animate slider automatically
|
||||
slideshowSpeed: 7000, //Integer: Set the speed of the slideshow cycling, in milliseconds
|
||||
animationSpeed: 800, //Boolean: Pause the slideshow when interacting with control elements, highly recommended.
|
||||
pauseOnHover: true,
|
||||
pauseOnAction:false,
|
||||
controlNav: false,
|
||||
directionNav: true,
|
||||
controlsContainer: '.flex-container',
|
||||
prevText: '',
|
||||
nextText: '',
|
||||
start: function(slider) {
|
||||
var sliderMain = $('.slider-1 .flex-active-slide');
|
||||
var toptitle = $('.slider-1 .flex-active-slide .flex-top-bot').data('toptitle');
|
||||
var topimage = $('.slider-1 .flex-active-slide .item').data('topimage');
|
||||
var topfade = $('.slider-1 .flex-active-slide .fade-flex').data('topfade');
|
||||
var bottomtext = $('.slider-1 .flex-active-slide .flex-bot-top').data('bottomtext');
|
||||
var bottomlinks = $('.slider-1 .flex-active-slide .links').data('bottomlinks');
|
||||
|
||||
sliderMain.find('.item').css({ top: topimage});
|
||||
sliderMain.find('.item').animate({ right: '0', opacity: '1'}, 1000);
|
||||
sliderMain.find('.fade-flex').css({ top: topfade});
|
||||
sliderMain.find('.fade-flex').animate({ opacity: '1'}, 1000);
|
||||
sliderMain.find('.flex-top-bot').animate({ left: '0', top: toptitle, opacity: '1'}, 1500);
|
||||
sliderMain.find('.flex-bot-top').animate({ left: '0', bottom: bottomtext, opacity: '1'}, 1500);
|
||||
sliderMain.find('.links').css({ bottom: bottomlinks});
|
||||
sliderMain.find('.links').animate({ left: '0', opacity: '1'}, 1800);
|
||||
|
||||
// remove class loading after start
|
||||
slider.removeClass('loading');
|
||||
},
|
||||
before: function(slider) {
|
||||
var sliderMain = $('.slider-1 .flex-active-slide');
|
||||
|
||||
sliderMain.find('.item').animate({ right: '-100%', opacity: '0'}, 1000);
|
||||
sliderMain.find('.fade-flex').animate({ opacity: '0'}, 1000);
|
||||
sliderMain.find('.flex-top-bot').animate({ left: '0', opacity: '0'}, 1500);
|
||||
sliderMain.find('.flex-bot-top').animate({ left: '0', bottom: '-50%', opacity: '0'}, 1500);
|
||||
sliderMain.find('.links').animate({ left: '-100%', opacity: '0'}, 1800);
|
||||
},
|
||||
after: function(slider) {
|
||||
var sliderMain = $('.slider-1 .flex-active-slide');
|
||||
|
||||
var toptitle = $('.slider-1 .flex-active-slide .flex-top-bot').data('toptitle');
|
||||
var topimage = $('.slider-1 .flex-active-slide .item').data('topimage');
|
||||
var topfade = $('.slider-1 .flex-active-slide .fade-flex').data('topfade');
|
||||
var bottomtext = $('.slider-1 .flex-active-slide .flex-bot-top').data('bottomtext');
|
||||
var bottomlinks = $('.slider-1 .flex-active-slide .links').data('bottomlinks');
|
||||
|
||||
sliderMain.find('.item').css({ top: topimage});
|
||||
sliderMain.find('.item').animate({ right: '0', opacity: '1'}, 1000);
|
||||
sliderMain.find('.fade-flex').css({ top: topfade});
|
||||
sliderMain.find('.fade-flex').animate({ opacity: '1'}, 1000);
|
||||
sliderMain.find('.flex-top-bot').animate({ left: '0', top: toptitle, opacity: '1'}, 1500);
|
||||
sliderMain.find('.flex-bot-top').animate({ left: '0', bottom: bottomtext, opacity: '1'}, 1500);
|
||||
sliderMain.find('.links').css({ bottom: bottomlinks});
|
||||
sliderMain.find('.links').animate({ left: '0', opacity: '1'}, 1800);
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
63
js/fs-menu.js
Normal file
63
js/fs-menu.js
Normal file
@@ -0,0 +1,63 @@
|
||||
jQuery(document).ready(function($){
|
||||
|
||||
var MQL = 1170;
|
||||
|
||||
//FIXED HEADER ON
|
||||
$('#nav-stick').affix({
|
||||
offset: {
|
||||
top: 1,
|
||||
}
|
||||
});
|
||||
|
||||
//open/close primary navigation
|
||||
$('.fs-primary-nav-trigger').on('click', function(){
|
||||
$('.fs-menu-icon').toggleClass('is-clicked');
|
||||
$('.fs-header').toggleClass('menu-is-open');
|
||||
$('#nav-stick').addClass('affix-fix');
|
||||
$('#nav-stick2').addClass('affix-fix');
|
||||
$('.logo-hiding').addClass('logo-hide');
|
||||
|
||||
//in firefox transitions break when parent overflow is changed, so we need to wait for the end of the trasition to give the body an overflow hidden
|
||||
if( $('.fs-primary-nav').hasClass('is-visible') ) {
|
||||
$('#nav-stick').removeClass('affix-fix');
|
||||
$('#nav-stick2').removeClass('affix-fix');
|
||||
$('.logo-hiding').removeClass('logo-hide');
|
||||
$('.fs-primary-nav').removeClass('is-visible').one('webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend',function(){
|
||||
$('body').removeClass('overflow-hidden');
|
||||
});
|
||||
} else {
|
||||
$('.fs-primary-nav').addClass('is-visible').one('webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend',function(){
|
||||
$('body').addClass('overflow-hidden');
|
||||
});
|
||||
};
|
||||
|
||||
return false;
|
||||
|
||||
});
|
||||
|
||||
// SUB MENU
|
||||
var fsParentSub = $(".fs-parent");
|
||||
var fsLiSub;
|
||||
|
||||
fsParentSub.on('click', function(){
|
||||
|
||||
fsLiSub = $(this).parent("li:first");
|
||||
if (fsLiSub.hasClass("fs-active")) {
|
||||
fsLiSub.find(".fs-sub:first").slideUp(function(){
|
||||
fsLiSub.removeClass("fs-active");
|
||||
});
|
||||
} else {
|
||||
|
||||
var li = $(this).closest("li").parent("ul").children("li");
|
||||
if ($(li).is(".fs-active")) {
|
||||
$(li).removeClass("fs-active").children("ul").slideUp()
|
||||
}
|
||||
fsLiSub.addClass("fs-active");
|
||||
fsLiSub.find(".fs-sub:first").slideDown();
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
13
js/gmap3.min.js
vendored
Normal file
13
js/gmap3.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
7
js/imagesloaded.pkgd.min.js
vendored
Normal file
7
js/imagesloaded.pkgd.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
12
js/isotope.pkgd.min.js
vendored
Normal file
12
js/isotope.pkgd.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
16
js/jflickrfeed.min.js
vendored
Normal file
16
js/jflickrfeed.min.js
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
/*
|
||||
* Copyright (C) 2009 Joel Sutherland
|
||||
* Licenced under the MIT license
|
||||
* http://www.newmediacampaigns.com/page/jquery-flickr-plugin
|
||||
*
|
||||
* Available tags for templates:
|
||||
* title, link, date_taken, description, published, author, author_id, tags, image*
|
||||
*/
|
||||
(function($){$.fn.jflickrfeed=function(settings,callback){settings=$.extend(true,{flickrbase:'http://api.flickr.com/services/feeds/',feedapi:'photos_public.gne',limit:20,qstrings:{lang:'en-us',format:'json',jsoncallback:'?'},cleanDescription:true,useTemplate:true,itemTemplate:'',itemCallback:function(){}},settings);var url=settings.flickrbase+settings.feedapi+'?';var first=true;for(var key in settings.qstrings){if(!first)
|
||||
url+='&';url+=key+'='+settings.qstrings[key];first=false;}
|
||||
return $(this).each(function(){var $container=$(this);var container=this;$.getJSON(url,function(data){$.each(data.items,function(i,item){if(i<settings.limit){if(settings.cleanDescription){var regex=/<p>(.*?)<\/p>/g;var input=item.description;if(regex.test(input)){item.description=input.match(regex)[2]
|
||||
if(item.description!=undefined)
|
||||
item.description=item.description.replace('<p>','').replace('</p>','');}}
|
||||
item['image_s']=item.media.m.replace('_m','_s');item['image_t']=item.media.m.replace('_m','_t');item['image_m']=item.media.m.replace('_m','_m');item['image']=item.media.m.replace('_m','');item['image_b']=item.media.m.replace('_m','_b');delete item.media;if(settings.useTemplate){var template=settings.itemTemplate;for(var key in item){var rgx=new RegExp('{{'+key+'}}','g');template=template.replace(rgx,item[key]);}
|
||||
$container.append(template)}
|
||||
settings.itemCallback.call(container,item);}});if($.isFunction(callback)){callback.call(container,data);}});});}})(jQuery);
|
||||
4
js/jquery-1.11.2.min.js
vendored
Normal file
4
js/jquery-1.11.2.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
10
js/jquery.appear.js
Normal file
10
js/jquery.appear.js
Normal file
@@ -0,0 +1,10 @@
|
||||
/*
|
||||
* jQuery.appear
|
||||
* https://github.com/bas2k/jquery.appear/
|
||||
* http://code.google.com/p/jquery-appear/
|
||||
*
|
||||
* Copyright (c) 2009 Michael Hixson
|
||||
* Copyright (c) 2012 Alexander Brovikov
|
||||
* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
|
||||
*/
|
||||
(function(e){e.fn.appear=function(t,n){var r=e.extend({data:undefined,one:true,accX:0,accY:0},n);return this.each(function(){var n=e(this);n.appeared=false;if(!t){n.trigger("appear",r.data);return}var i=e(window);var s=function(){if(!n.is(":visible")){n.appeared=false;return}var e=i.scrollLeft();var t=i.scrollTop();var s=n.offset();var o=s.left;var u=s.top;var a=r.accX;var f=r.accY;var l=n.height();var c=i.height();var h=n.width();var p=i.width();if(u+l+f>=t&&u<=t+c+f&&o+h+a>=e&&o<=e+p+a){if(!n.appeared)n.trigger("appear",r.data)}else{n.appeared=false}};var o=function(){n.appeared=true;if(r.one){i.unbind("scroll",s);var o=e.inArray(s,e.fn.appear.checks);if(o>=0)e.fn.appear.checks.splice(o,1)}t.apply(this,arguments)};if(r.one)n.one("appear",r.data,o);else n.bind("appear",r.data,o);i.scroll(s);e.fn.appear.checks.push(s);s()})};e.extend(e.fn.appear,{checks:[],timeout:null,checkAll:function(){var t=e.fn.appear.checks.length;if(t>0)while(t--)e.fn.appear.checks[t]()},run:function(){if(e.fn.appear.timeout)clearTimeout(e.fn.appear.timeout);e.fn.appear.timeout=setTimeout(e.fn.appear.checkAll,20)}});e.each(["append","prepend","after","before","attr","removeAttr","addClass","removeClass","toggleClass","remove","css","show","hide"],function(t,n){var r=e.fn[n];if(r){e.fn[n]=function(){var t=r.apply(this,arguments);e.fn.appear.run();return t}}})})(jQuery);(function(e){e.fn.countTo=function(t){t=e.extend({},e.fn.countTo.defaults,t||{});var n=Math.ceil(t.speed/t.refreshInterval),r=(t.to-t.from)/n;return e(this).each(function(){function a(){o+=r;s++;e(i).html(o.toFixed(t.decimals));if(typeof t.onUpdate=="function"){t.onUpdate.call(i,o)}if(s>=n){clearInterval(u);o=t.to;if(typeof t.onComplete=="function"){t.onComplete.call(i,o)}}}var i=this,s=0,o=t.from,u=setInterval(a,t.refreshInterval)})};e.fn.countTo.defaults={from:0,to:100,speed:1e3,refreshInterval:100,decimals:0,onUpdate:null,onComplete:null}})(jQuery)
|
||||
9
js/jquery.backgroundvideo.min.js
vendored
Normal file
9
js/jquery.backgroundvideo.min.js
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
/*
|
||||
* jQuery Background video plugin for jQuery
|
||||
* ---
|
||||
* Copyright 2011, Victor Coulon (http://victorcoulon.fr)
|
||||
* Released under the MIT, BSD, and GPL Licenses.
|
||||
* based on jQuery Plugin Boilerplate 1.3
|
||||
*/
|
||||
|
||||
(function(t){t.backgroundVideo=function(e,i){var n={videoid:"video_background",autoplay:true,loop:true,preload:true};var s=this;s.settings={};var o=function(){s.settings=t.extend({},n,i);s.el=e;d()};var d=function(){var e="",i="",n="",o="",d=s.settings.preload,g=s.settings.autoplay,a=s.settings.loop;if(d){i='preload="auto"'}else{i=""}if(g){n='autoplay="autoplay"'}else{n=""}if(a){o='loop="true"'}else{o=""}e+='<video id="'+s.settings.videoid+'"'+i+n+o;if(s.settings.poster){e+=' poster="'+s.settings.poster+'" '}e+='style="display:none;position:absolute;top:0;left:0;bottom:0;right:0;z-index:-100;width:100%;height:100%;">';for(var l=0;l<s.settings.types.length;l++){e+='<source src="'+s.settings.path+s.settings.filename+"."+s.settings.types[l]+'" type="video/'+s.settings.types[l]+'" />'}e+="bgvideo</video>";s.el.prepend(e);s.videoEl=document.getElementById(s.settings.videoid);s.$videoEl=t(s.videoEl);s.$videoEl.fadeIn(2e3);r()};var r=function(){var t=g();s.$videoEl.width(t*s.settings.width);s.$videoEl.height(t*s.settings.height);if(typeof s.settings.align!=="undefined"){a()}};var g=function(){var e=t(window).width();var i=t(window).height();var n=e/i;var o=s.settings.width/s.settings.height;var d=i/s.settings.height;if(n>=o){d=e/s.settings.width}return d};var a=function(){var e=(t(window).width()>>1)-(s.$videoEl.width()>>1)|0;var i=(t(window).height()>>1)-(s.$videoEl.height()>>1)|0;if(s.settings.align=="centerXY"){s.$videoEl.css({left:e,top:i});return}if(s.settings.align=="centerX"){s.$videoEl.css("left",e);return}if(s.settings.align=="centerY"){s.$videoEl.css("top",i);return}};o();t(window).resize(function(){r()});s.$videoEl.bind("ended",function(){this.play()})}})(jQuery);
|
||||
1
js/jquery.countTo.js
Normal file
1
js/jquery.countTo.js
Normal file
@@ -0,0 +1 @@
|
||||
(function(e){function t(e,t){return e.toFixed(t.decimals)}e.fn.countTo=function(t){t=t||{};return e(this).each(function(){function l(){a+=i;u++;c(a);if(typeof n.onUpdate=="function"){n.onUpdate.call(s,a)}if(u>=r){o.removeData("countTo");clearInterval(f.interval);a=n.to;if(typeof n.onComplete=="function"){n.onComplete.call(s,a)}}}function c(e){var t=n.formatter.call(s,e,n);o.text(t)}var n=e.extend({},e.fn.countTo.defaults,{from:e(this).data("from"),to:e(this).data("to"),speed:e(this).data("speed"),refreshInterval:e(this).data("refresh-interval"),decimals:e(this).data("decimals")},t);var r=Math.ceil(n.speed/n.refreshInterval),i=(n.to-n.from)/r;var s=this,o=e(this),u=0,a=n.from,f=o.data("countTo")||{};o.data("countTo",f);if(f.interval){clearInterval(f.interval)}f.interval=setInterval(l,n.refreshInterval);c(a)})};e.fn.countTo.defaults={from:0,to:0,speed:1e3,refreshInterval:100,decimals:0,formatter:t,onUpdate:null,onComplete:null}})(jQuery)
|
||||
22
js/jquery.countdown.min.js
vendored
Normal file
22
js/jquery.countdown.min.js
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
/*!
|
||||
* The Final Countdown for jQuery v2.0.4 (http://hilios.github.io/jQuery.countdown/)
|
||||
* Copyright (c) 2014 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(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){return function(b){var c=b.match(/%(-|!)?[A-Z]{1}(:[^;]+;)?/gi);if(c)for(var e=0,f=c.length;f>e;++e){var g=c[e].match(/%(-|!)?([a-zA-Z]{1})(:[^;]+;)?/),i=new RegExp(g[0]),j=g[1]||"",k=g[3]||"",l=null;g=g[2],h.hasOwnProperty(g)&&(l=h[g],l=Number(a[l])),null!==l&&("!"===j&&(l=d(k,l)),""===j&&10>l&&(l="0"+l.toString()),b=b.replace(i,l.toString()))}return b=b.replace(/%%/,"%")}}function d(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 e=100,f=[],g=[];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 h={Y:"years",m:"months",w:"weeks",d:"days",D:"totalDays",H:"hours",M:"minutes",S:"seconds"},i=function(b,c,d){this.el=b,this.$el=a(b),this.interval=null,this.offset={},this.instanceNumber=f.length,f.push(this),this.$el.data("countdown-instance",this.instanceNumber),d&&(this.$el.on("update.countdown",d),this.$el.on("stoped.countdown",d),this.$el.on("finish.countdown",d)),this.setFinalDate(c),this.start()};a.extend(i.prototype,{start:function(){null!==this.interval&&clearInterval(this.interval);var a=this;this.update(),this.interval=setInterval(function(){a.update.call(a)},e)},stop:function(){clearInterval(this.interval),this.interval=null,this.dispatchEvent("stoped")},pause:function(){this.stop.call(this)},resume:function(){this.start.call(this)},remove:function(){this.stop(),f[this.instanceNumber]=null,delete this.$el.data().countdownInstance},setFinalDate:function(a){this.finalDate=b(a)},update:function(){return 0===this.$el.closest("html").length?void this.remove():(this.totalSecsLeft=this.finalDate.getTime()-(new Date).getTime(),this.totalSecsLeft=Math.ceil(this.totalSecsLeft/1e3),this.totalSecsLeft=this.totalSecsLeft<0?0:this.totalSecsLeft,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,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),years:Math.floor(this.totalSecsLeft/60/60/24/365)},void(0===this.totalSecsLeft?(this.stop(),this.dispatchEvent("finish")):this.dispatchEvent("update")))},dispatchEvent:function(b){var d=a.Event(b+".countdown");d.finalDate=this.finalDate,d.offset=a.extend({},this.offset),d.strftime=c(this.offset),this.$el.trigger(d)}}),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];i.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 i(this,b[0],b[1])})}});
|
||||
205
js/jquery.easing.1.3.js
Normal file
205
js/jquery.easing.1.3.js
Normal file
@@ -0,0 +1,205 @@
|
||||
/*
|
||||
* jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
|
||||
*
|
||||
* Uses the built in easing capabilities added In jQuery 1.1
|
||||
* to offer multiple easing options
|
||||
*
|
||||
* TERMS OF USE - jQuery Easing
|
||||
*
|
||||
* Open source under the BSD License.
|
||||
*
|
||||
* Copyright © 2008 George McGinley Smith
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* Neither the name of the author nor the names of contributors may be used to endorse
|
||||
* or promote products derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
||||
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
// t: current time, b: begInnIng value, c: change In value, d: duration
|
||||
jQuery.easing['jswing'] = jQuery.easing['swing'];
|
||||
|
||||
jQuery.extend( jQuery.easing,
|
||||
{
|
||||
def: 'easeOutQuad',
|
||||
swing: function (x, t, b, c, d) {
|
||||
//alert(jQuery.easing.default);
|
||||
return jQuery.easing[jQuery.easing.def](x, t, b, c, d);
|
||||
},
|
||||
easeInQuad: function (x, t, b, c, d) {
|
||||
return c*(t/=d)*t + b;
|
||||
},
|
||||
easeOutQuad: function (x, t, b, c, d) {
|
||||
return -c *(t/=d)*(t-2) + b;
|
||||
},
|
||||
easeInOutQuad: function (x, t, b, c, d) {
|
||||
if ((t/=d/2) < 1) return c/2*t*t + b;
|
||||
return -c/2 * ((--t)*(t-2) - 1) + b;
|
||||
},
|
||||
easeInCubic: function (x, t, b, c, d) {
|
||||
return c*(t/=d)*t*t + b;
|
||||
},
|
||||
easeOutCubic: function (x, t, b, c, d) {
|
||||
return c*((t=t/d-1)*t*t + 1) + b;
|
||||
},
|
||||
easeInOutCubic: function (x, t, b, c, d) {
|
||||
if ((t/=d/2) < 1) return c/2*t*t*t + b;
|
||||
return c/2*((t-=2)*t*t + 2) + b;
|
||||
},
|
||||
easeInQuart: function (x, t, b, c, d) {
|
||||
return c*(t/=d)*t*t*t + b;
|
||||
},
|
||||
easeOutQuart: function (x, t, b, c, d) {
|
||||
return -c * ((t=t/d-1)*t*t*t - 1) + b;
|
||||
},
|
||||
easeInOutQuart: function (x, t, b, c, d) {
|
||||
if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
|
||||
return -c/2 * ((t-=2)*t*t*t - 2) + b;
|
||||
},
|
||||
easeInQuint: function (x, t, b, c, d) {
|
||||
return c*(t/=d)*t*t*t*t + b;
|
||||
},
|
||||
easeOutQuint: function (x, t, b, c, d) {
|
||||
return c*((t=t/d-1)*t*t*t*t + 1) + b;
|
||||
},
|
||||
easeInOutQuint: function (x, t, b, c, d) {
|
||||
if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
|
||||
return c/2*((t-=2)*t*t*t*t + 2) + b;
|
||||
},
|
||||
easeInSine: function (x, t, b, c, d) {
|
||||
return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
|
||||
},
|
||||
easeOutSine: function (x, t, b, c, d) {
|
||||
return c * Math.sin(t/d * (Math.PI/2)) + b;
|
||||
},
|
||||
easeInOutSine: function (x, t, b, c, d) {
|
||||
return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
|
||||
},
|
||||
easeInExpo: function (x, t, b, c, d) {
|
||||
return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
|
||||
},
|
||||
easeOutExpo: function (x, t, b, c, d) {
|
||||
return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
|
||||
},
|
||||
easeInOutExpo: function (x, t, b, c, d) {
|
||||
if (t==0) return b;
|
||||
if (t==d) return b+c;
|
||||
if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
|
||||
return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
|
||||
},
|
||||
easeInCirc: function (x, t, b, c, d) {
|
||||
return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
|
||||
},
|
||||
easeOutCirc: function (x, t, b, c, d) {
|
||||
return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
|
||||
},
|
||||
easeInOutCirc: function (x, t, b, c, d) {
|
||||
if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
|
||||
return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
|
||||
},
|
||||
easeInElastic: function (x, t, b, c, d) {
|
||||
var s=1.70158;var p=0;var a=c;
|
||||
if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
|
||||
if (a < Math.abs(c)) { a=c; var s=p/4; }
|
||||
else var s = p/(2*Math.PI) * Math.asin (c/a);
|
||||
return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
|
||||
},
|
||||
easeOutElastic: function (x, t, b, c, d) {
|
||||
var s=1.70158;var p=0;var a=c;
|
||||
if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
|
||||
if (a < Math.abs(c)) { a=c; var s=p/4; }
|
||||
else var s = p/(2*Math.PI) * Math.asin (c/a);
|
||||
return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
|
||||
},
|
||||
easeInOutElastic: function (x, t, b, c, d) {
|
||||
var s=1.70158;var p=0;var a=c;
|
||||
if (t==0) return b; if ((t/=d/2)==2) return b+c; if (!p) p=d*(.3*1.5);
|
||||
if (a < Math.abs(c)) { a=c; var s=p/4; }
|
||||
else var s = p/(2*Math.PI) * Math.asin (c/a);
|
||||
if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
|
||||
return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
|
||||
},
|
||||
easeInBack: function (x, t, b, c, d, s) {
|
||||
if (s == undefined) s = 1.70158;
|
||||
return c*(t/=d)*t*((s+1)*t - s) + b;
|
||||
},
|
||||
easeOutBack: function (x, t, b, c, d, s) {
|
||||
if (s == undefined) s = 1.70158;
|
||||
return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
|
||||
},
|
||||
easeInOutBack: function (x, t, b, c, d, s) {
|
||||
if (s == undefined) s = 1.70158;
|
||||
if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
|
||||
return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
|
||||
},
|
||||
easeInBounce: function (x, t, b, c, d) {
|
||||
return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b;
|
||||
},
|
||||
easeOutBounce: function (x, t, b, c, d) {
|
||||
if ((t/=d) < (1/2.75)) {
|
||||
return c*(7.5625*t*t) + b;
|
||||
} else if (t < (2/2.75)) {
|
||||
return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
|
||||
} else if (t < (2.5/2.75)) {
|
||||
return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
|
||||
} else {
|
||||
return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
|
||||
}
|
||||
},
|
||||
easeInOutBounce: function (x, t, b, c, d) {
|
||||
if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;
|
||||
return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;
|
||||
}
|
||||
});
|
||||
|
||||
/*
|
||||
*
|
||||
* TERMS OF USE - EASING EQUATIONS
|
||||
*
|
||||
* Open source under the BSD License.
|
||||
*
|
||||
* Copyright © 2001 Robert Penner
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* Neither the name of the author nor the names of contributors may be used to endorse
|
||||
* or promote products derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
||||
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
33
js/jquery.equalheights.js
Normal file
33
js/jquery.equalheights.js
Normal file
@@ -0,0 +1,33 @@
|
||||
/*!
|
||||
* Simple jQuery Equal Heights
|
||||
*
|
||||
* Copyright (c) 2013 Matt Banks
|
||||
* Dual licensed under the MIT and GPL licenses.
|
||||
* Uses the same license as jQuery, see:
|
||||
* http://docs.jquery.com/License
|
||||
*
|
||||
* @version 1.5.1
|
||||
*/
|
||||
(function($) {
|
||||
|
||||
$.fn.equalHeights = function() {
|
||||
var maxHeight = 0,
|
||||
$this = $(this);
|
||||
|
||||
$this.each( function() {
|
||||
var height = $(this).innerHeight();
|
||||
|
||||
if ( height > maxHeight ) { maxHeight = height; }
|
||||
});
|
||||
|
||||
return $this.css('height', maxHeight);
|
||||
};
|
||||
|
||||
// auto-initialize plugin
|
||||
$('[data-equal]').each(function(){
|
||||
var $this = $(this),
|
||||
target = $this.data('equal');
|
||||
$this.find(target).equalHeights();
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
5
js/jquery.flexslider-min.js
vendored
Normal file
5
js/jquery.flexslider-min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
4
js/jquery.magnific-popup.min.js
vendored
Normal file
4
js/jquery.magnific-popup.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
223
js/jquery.nav.js
Normal file
223
js/jquery.nav.js
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 3.0.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.$win = $(window);
|
||||
this.sections = {};
|
||||
this.didScroll = false;
|
||||
this.$doc = $(document);
|
||||
this.docHeight = this.$doc.height();
|
||||
};
|
||||
|
||||
// the plugin prototype
|
||||
OnePageNav.prototype = {
|
||||
defaults: {
|
||||
navItems: 'a',
|
||||
currentClass: 'current',
|
||||
changeHash: false,
|
||||
easing: 'swing',
|
||||
filter: '',
|
||||
scrollSpeed: 750,
|
||||
scrollThreshold: 0.5,
|
||||
begin: false,
|
||||
end: false,
|
||||
scrollChange: false
|
||||
},
|
||||
|
||||
init: function() {
|
||||
// Introduce defaults that can be extended either
|
||||
// globally or using an object lightral.
|
||||
this.config = $.extend({}, this.defaults, this.options, this.metadata);
|
||||
|
||||
this.$nav = this.$elem.find(this.config.navItems);
|
||||
|
||||
//Filter any links out of the nav
|
||||
if(this.config.filter !== '') {
|
||||
this.$nav = this.$nav.filter(this.config.filter);
|
||||
}
|
||||
|
||||
//Handle clicks on the nav
|
||||
this.$nav.on('click.onePageNav', $.proxy(this.handleClick, this));
|
||||
|
||||
//Get the section positions
|
||||
this.getPositions();
|
||||
|
||||
//Handle scroll changes
|
||||
this.bindInterval();
|
||||
|
||||
//Update the positions on resize too
|
||||
this.$win.on('resize.onePageNav', $.proxy(this.getPositions, this));
|
||||
|
||||
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);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
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
|
||||
self.scrollTo(newLoc, 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
scrollTo: function(target, callback) {
|
||||
var offset = $(target).offset().top;
|
||||
|
||||
$('html, body').animate({
|
||||
scrollTop: (offset - this.config.scrollOffset)
|
||||
}, this.config.scrollSpeed, this.config.easing, callback);
|
||||
},
|
||||
|
||||
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 );
|
||||
197
js/jquery.placeholder.js
Normal file
197
js/jquery.placeholder.js
Normal file
@@ -0,0 +1,197 @@
|
||||
/*! http://mths.be/placeholder v2.0.8 by @mathias */
|
||||
;(function(window, document, $) {
|
||||
|
||||
// Opera Mini v7 doesn’t support placeholder although its DOM seems to indicate so
|
||||
var isOperaMini = Object.prototype.toString.call(window.operamini) == '[object OperaMini]';
|
||||
var isInputSupported = 'placeholder' in document.createElement('input') && !isOperaMini;
|
||||
var isTextareaSupported = 'placeholder' in document.createElement('textarea') && !isOperaMini;
|
||||
var prototype = $.fn;
|
||||
var valHooks = $.valHooks;
|
||||
var propHooks = $.propHooks;
|
||||
var hooks;
|
||||
var placeholder;
|
||||
|
||||
if (isInputSupported && isTextareaSupported) {
|
||||
|
||||
placeholder = prototype.placeholder = function() {
|
||||
return this;
|
||||
};
|
||||
|
||||
placeholder.input = placeholder.textarea = true;
|
||||
|
||||
} else {
|
||||
|
||||
placeholder = prototype.placeholder = function() {
|
||||
var $this = this;
|
||||
$this
|
||||
.filter((isInputSupported ? 'textarea' : ':input') + '[placeholder]')
|
||||
.not('.placeholder')
|
||||
.bind({
|
||||
'focus.placeholder': clearPlaceholder,
|
||||
'blur.placeholder': setPlaceholder
|
||||
})
|
||||
.data('placeholder-enabled', true)
|
||||
.trigger('blur.placeholder');
|
||||
return $this;
|
||||
};
|
||||
|
||||
placeholder.input = isInputSupported;
|
||||
placeholder.textarea = isTextareaSupported;
|
||||
|
||||
hooks = {
|
||||
'get': function(element) {
|
||||
var $element = $(element);
|
||||
|
||||
var $passwordInput = $element.data('placeholder-password');
|
||||
if ($passwordInput) {
|
||||
return $passwordInput[0].value;
|
||||
}
|
||||
|
||||
return $element.data('placeholder-enabled') && $element.hasClass('placeholder') ? '' : element.value;
|
||||
},
|
||||
'set': function(element, value) {
|
||||
var $element = $(element);
|
||||
|
||||
var $passwordInput = $element.data('placeholder-password');
|
||||
if ($passwordInput) {
|
||||
return $passwordInput[0].value = value;
|
||||
}
|
||||
|
||||
if (!$element.data('placeholder-enabled')) {
|
||||
return element.value = value;
|
||||
}
|
||||
if (value == '') {
|
||||
element.value = value;
|
||||
// Issue #56: Setting the placeholder causes problems if the element continues to have focus.
|
||||
if (element != safeActiveElement()) {
|
||||
// We can't use `triggerHandler` here because of dummy text/password inputs :(
|
||||
setPlaceholder.call(element);
|
||||
}
|
||||
} else if ($element.hasClass('placeholder')) {
|
||||
clearPlaceholder.call(element, true, value) || (element.value = value);
|
||||
} else {
|
||||
element.value = value;
|
||||
}
|
||||
// `set` can not return `undefined`; see http://jsapi.info/jquery/1.7.1/val#L2363
|
||||
return $element;
|
||||
}
|
||||
};
|
||||
|
||||
if (!isInputSupported) {
|
||||
valHooks.input = hooks;
|
||||
propHooks.value = hooks;
|
||||
}
|
||||
if (!isTextareaSupported) {
|
||||
valHooks.textarea = hooks;
|
||||
propHooks.value = hooks;
|
||||
}
|
||||
|
||||
$(function() {
|
||||
// Look for forms
|
||||
$(document).delegate('form', 'submit.placeholder', function() {
|
||||
// Clear the placeholder values so they don't get submitted
|
||||
var $inputs = $('.placeholder', this).each(clearPlaceholder);
|
||||
setTimeout(function() {
|
||||
$inputs.each(setPlaceholder);
|
||||
}, 10);
|
||||
});
|
||||
});
|
||||
|
||||
// Clear placeholder values upon page reload
|
||||
$(window).bind('beforeunload.placeholder', function() {
|
||||
$('.placeholder').each(function() {
|
||||
this.value = '';
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function args(elem) {
|
||||
// Return an object of element attributes
|
||||
var newAttrs = {};
|
||||
var rinlinejQuery = /^jQuery\d+$/;
|
||||
$.each(elem.attributes, function(i, attr) {
|
||||
if (attr.specified && !rinlinejQuery.test(attr.name)) {
|
||||
newAttrs[attr.name] = attr.value;
|
||||
}
|
||||
});
|
||||
return newAttrs;
|
||||
}
|
||||
|
||||
function clearPlaceholder(event, value) {
|
||||
var input = this;
|
||||
var $input = $(input);
|
||||
if (input.value == $input.attr('placeholder') && $input.hasClass('placeholder')) {
|
||||
if ($input.data('placeholder-password')) {
|
||||
$input = $input.hide().next().show().attr('id', $input.removeAttr('id').data('placeholder-id'));
|
||||
// If `clearPlaceholder` was called from `$.valHooks.input.set`
|
||||
if (event === true) {
|
||||
return $input[0].value = value;
|
||||
}
|
||||
$input.focus();
|
||||
} else {
|
||||
input.value = '';
|
||||
$input.removeClass('placeholder');
|
||||
input == safeActiveElement() && input.select();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function setPlaceholder() {
|
||||
var $replacement;
|
||||
var input = this;
|
||||
var $input = $(input);
|
||||
var id = this.id;
|
||||
if (input.value == '') {
|
||||
if (input.type == 'password') {
|
||||
if (!$input.data('placeholder-textinput')) {
|
||||
try {
|
||||
$replacement = $input.clone().attr({ 'type': 'text' });
|
||||
} catch(e) {
|
||||
$replacement = $('<input>').attr($.extend(args(this), { 'type': 'text' }));
|
||||
}
|
||||
$replacement
|
||||
.removeAttr('name')
|
||||
.data({
|
||||
'placeholder-password': $input,
|
||||
'placeholder-id': id
|
||||
})
|
||||
.bind('focus.placeholder', clearPlaceholder);
|
||||
$input
|
||||
.data({
|
||||
'placeholder-textinput': $replacement,
|
||||
'placeholder-id': id
|
||||
})
|
||||
.before($replacement);
|
||||
}
|
||||
$input = $input.removeAttr('id').hide().prev().attr('id', id).show();
|
||||
// Note: `$input[0] != input` now!
|
||||
}
|
||||
$input.addClass('placeholder');
|
||||
$input[0].value = $input.attr('placeholder');
|
||||
} else {
|
||||
$input.removeClass('placeholder');
|
||||
}
|
||||
}
|
||||
|
||||
function safeActiveElement() {
|
||||
// Avoid IE9 `document.activeElement` of death
|
||||
// https://github.com/mathiasbynens/jquery-placeholder/pull/99
|
||||
try {
|
||||
return document.activeElement;
|
||||
} catch (exception) {}
|
||||
}
|
||||
|
||||
}(this, document, jQuery));
|
||||
|
||||
//PLACEHOLDERS for FORMS --------------------------------------------------------
|
||||
// To test the @id toggling on password inputs in browsers that don’t support changing an input’s @type dynamically (e.g. Firefox 3.6 or IE), uncomment this:
|
||||
// $.fn.hide = function() { return this; }
|
||||
// Then uncomment the last rule in the <style> element (in the <head>).
|
||||
$(function() {
|
||||
// Invoke the plugin
|
||||
$('input, textarea').placeholder();
|
||||
// That’s it, really.
|
||||
// Now display a message if the browser supports placeholder natively
|
||||
|
||||
});
|
||||
2
js/jquery.stellar.min.js
vendored
Normal file
2
js/jquery.stellar.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
4
js/jquery.validate.min.js
vendored
Normal file
4
js/jquery.validate.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
955
js/main.js
Normal file
955
js/main.js
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
1
js/min-main.js
Normal file
1
js/min-main.js
Normal file
File diff suppressed because one or more lines are too long
4
js/modernizr.custom.js
Normal file
4
js/modernizr.custom.js
Normal file
File diff suppressed because one or more lines are too long
4
js/modernizr.js
Normal file
4
js/modernizr.js
Normal file
File diff suppressed because one or more lines are too long
7
js/moment.js
Normal file
7
js/moment.js
Normal file
File diff suppressed because one or more lines are too long
13
js/npm.js
Normal file
13
js/npm.js
Normal file
@@ -0,0 +1,13 @@
|
||||
// This file is autogenerated via the `commonjs` Grunt task. You can require() this file in a CommonJS environment.
|
||||
require('../../js/transition.js')
|
||||
require('../../js/alert.js')
|
||||
require('../../js/button.js')
|
||||
require('../../js/carousel.js')
|
||||
require('../../js/collapse.js')
|
||||
require('../../js/dropdown.js')
|
||||
require('../../js/modal.js')
|
||||
require('../../js/tooltip.js')
|
||||
require('../../js/popover.js')
|
||||
require('../../js/scrollspy.js')
|
||||
require('../../js/tab.js')
|
||||
require('../../js/affix.js')
|
||||
1512
js/owl-carousel/owl.carousel.js
Normal file
1512
js/owl-carousel/owl.carousel.js
Normal file
File diff suppressed because it is too large
Load Diff
47
js/owl-carousel/owl.carousel.min.js
vendored
Normal file
47
js/owl-carousel/owl.carousel.min.js
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
"function"!==typeof Object.create&&(Object.create=function(f){function g(){}g.prototype=f;return new g});
|
||||
(function(f,g,k){var l={init:function(a,b){this.$elem=f(b);this.options=f.extend({},f.fn.owlCarousel.options,this.$elem.data(),a);this.userOptions=a;this.loadContent()},loadContent:function(){function a(a){var d,e="";if("function"===typeof b.options.jsonSuccess)b.options.jsonSuccess.apply(this,[a]);else{for(d in a.owl)a.owl.hasOwnProperty(d)&&(e+=a.owl[d].item);b.$elem.html(e)}b.logIn()}var b=this,e;"function"===typeof b.options.beforeInit&&b.options.beforeInit.apply(this,[b.$elem]);"string"===typeof b.options.jsonPath?
|
||||
(e=b.options.jsonPath,f.getJSON(e,a)):b.logIn()},logIn:function(){this.$elem.data("owl-originalStyles",this.$elem.attr("style"));this.$elem.data("owl-originalClasses",this.$elem.attr("class"));this.$elem.css({opacity:0});this.orignalightms=this.options.items;this.checkBrowser();this.wrapperWidth=0;this.checkVisible=null;this.setVars()},setVars:function(){if(0===this.$elem.children().length)return!1;this.baseClass();this.eventTypes();this.$userItems=this.$elem.children();this.itemsAmount=this.$userItems.length;
|
||||
this.wrapItems();this.$owlightms=this.$elem.find(".owl-item");this.$owlWrapper=this.$elem.find(".owl-wrapper");this.playDirection="next";this.prevItem=0;this.prevArr=[0];this.currentItem=0;this.customEvents();this.onStartup()},onStartup:function(){this.updateItems();this.calculateAll();this.buildControls();this.updateControls();this.response();this.moveEvents();this.stopOnHover();this.owlStatus();!1!==this.options.transitionStyle&&this.transitionTypes(this.options.transitionStyle);!0===this.options.autoPlay&&
|
||||
(this.options.autoPlay=5E3);this.play();this.$elem.find(".owl-wrapper").css("display","block");this.$elem.is(":visible")?this.$elem.css("opacity",1):this.watchVisibility();this.onstartup=!1;this.eachMoveUpdate();"function"===typeof this.options.afterInit&&this.options.afterInit.apply(this,[this.$elem])},eachMoveUpdate:function(){!0===this.options.lazyLoad&&this.lazyLoad();!0===this.options.autoHeight&&this.autoHeight();this.onVisibleItems();"function"===typeof this.options.afterAction&&this.options.afterAction.apply(this,
|
||||
[this.$elem])},updateVars:function(){"function"===typeof this.options.beforeUpdate&&this.options.beforeUpdate.apply(this,[this.$elem]);this.watchVisibility();this.updateItems();this.calculateAll();this.updatePosition();this.updateControls();this.eachMoveUpdate();"function"===typeof this.options.afterUpdate&&this.options.afterUpdate.apply(this,[this.$elem])},reload:function(){var a=this;g.setTimeout(function(){a.updateVars()},0)},watchVisibility:function(){var a=this;if(!1===a.$elem.is(":visible"))a.$elem.css({opacity:0}),
|
||||
g.clearInterval(a.autoPlayInterval),g.clearInterval(a.checkVisible);else return!1;a.checkVisible=g.setInterval(function(){a.$elem.is(":visible")&&(a.reload(),a.$elem.animate({opacity:1},200),g.clearInterval(a.checkVisible))},500)},wrapItems:function(){this.$userItems.wrapAll('<div class="owl-wrapper">').wrap('<div class="owl-item"></div>');this.$elem.find(".owl-wrapper").wrap('<div class="owl-wrapper-outer">');this.wrapperOuter=this.$elem.find(".owl-wrapper-outer");this.$elem.css("display","block")},
|
||||
baseClass:function(){var a=this.$elem.hasClass(this.options.baseClass),b=this.$elem.hasClass(this.options.theme);a||this.$elem.addClass(this.options.baseClass);b||this.$elem.addClass(this.options.theme)},updateItems:function(){var a,b;if(!1===this.options.responsive)return!1;if(!0===this.options.singleItem)return this.options.items=this.orignalightms=1,this.options.itemsCustom=!1,this.options.itemsDesktop=!1,this.options.itemsDesktopSmall=!1,this.options.itemsTablet=!1,this.options.itemsTabletSmall=
|
||||
!1,this.options.itemsMobile=!1;a=f(this.options.responsiveBaseWidth).width();a>(this.options.itemsDesktop[0]||this.orignalightms)&&(this.options.items=this.orignalightms);if(!1!==this.options.itemsCustom)for(this.options.itemsCustom.sort(function(a,b){return a[0]-b[0]}),b=0;b<this.options.itemsCustom.length;b+=1)this.options.itemsCustom[b][0]<=a&&(this.options.items=this.options.itemsCustom[b][1]);else a<=this.options.itemsDesktop[0]&&!1!==this.options.itemsDesktop&&(this.options.items=this.options.itemsDesktop[1]),
|
||||
a<=this.options.itemsDesktopSmall[0]&&!1!==this.options.itemsDesktopSmall&&(this.options.items=this.options.itemsDesktopSmall[1]),a<=this.options.itemsTablet[0]&&!1!==this.options.itemsTablet&&(this.options.items=this.options.itemsTablet[1]),a<=this.options.itemsTabletSmall[0]&&!1!==this.options.itemsTabletSmall&&(this.options.items=this.options.itemsTabletSmall[1]),a<=this.options.itemsMobile[0]&&!1!==this.options.itemsMobile&&(this.options.items=this.options.itemsMobile[1]);this.options.items>this.itemsAmount&&
|
||||
!0===this.options.itemsScaleUp&&(this.options.items=this.itemsAmount)},response:function(){var a=this,b,e;if(!0!==a.options.responsive)return!1;e=f(g).width();a.resizer=function(){f(g).width()!==e&&(!1!==a.options.autoPlay&&g.clearInterval(a.autoPlayInterval),g.clearTimeout(b),b=g.setTimeout(function(){e=f(g).width();a.updateVars()},a.options.responsiveRefreshRate))};f(g).resize(a.resizer)},updatePosition:function(){this.jumpTo(this.currentItem);!1!==this.options.autoPlay&&this.checkAp()},appendItemsSizes:function(){var a=
|
||||
this,b=0,e=a.itemsAmount-a.options.items;a.$owlightms.each(function(c){var d=f(this);d.css({width:a.itemWidth}).data("owl-item",Number(c));if(0===c%a.options.items||c===e)c>e||(b+=1);d.data("owl-roundPages",b)})},appendWrapperSizes:function(){this.$owlWrapper.css({width:this.$owlightms.length*this.itemWidth*2,left:0});this.appendItemsSizes()},calculateAll:function(){this.calculateWidth();this.appendWrapperSizes();this.loops();this.max()},calculateWidth:function(){this.itemWidth=Math.round(this.$elem.width()/
|
||||
this.options.items)},max:function(){var a=-1*(this.itemsAmount*this.itemWidth-this.options.items*this.itemWidth);this.options.items>this.itemsAmount?this.maximumPixels=a=this.maximumItem=0:(this.maximumItem=this.itemsAmount-this.options.items,this.maximumPixels=a);return a},min:function(){return 0},loops:function(){var a=0,b=0,e,c;this.positionsInArray=[0];this.pagesInArray=[];for(e=0;e<this.itemsAmount;e+=1)b+=this.itemWidth,this.positionsInArray.push(-b),!0===this.options.scrollPerPage&&(c=f(this.$owlightms[e]),
|
||||
c=c.data("owl-roundPages"),c!==a&&(this.pagesInArray[a]=this.positionsInArray[e],a=c))},buildControls:function(){if(!0===this.options.navigation||!0===this.options.pagination)this.owlControls=f('<div class="owl-controls"/>').toggleClass("clickable",!this.browser.isTouch).appendTo(this.$elem);!0===this.options.pagination&&this.buildPagination();!0===this.options.navigation&&this.buildButtons()},buildButtons:function(){var a=this,b=f('<div class="owl-buttons"/>');a.owlControls.append(b);a.buttonPrev=
|
||||
f("<div/>",{"class":"owl-prev",html:a.options.navigationText[0]||""});a.buttonNext=f("<div/>",{"class":"owl-next",html:a.options.navigationText[1]||""});b.append(a.buttonPrev).append(a.buttonNext);b.on("touchstart.owlControls mousedown.owlControls",'div[class^="owl"]',function(a){a.preventDefault()});b.on("touchend.owlControls mouseup.owlControls",'div[class^="owl"]',function(b){b.preventDefault();f(this).hasClass("owl-next")?a.next():a.prev()})},buildPagination:function(){var a=this;a.paginationWrapper=
|
||||
f('<div class="owl-pagination"/>');a.owlControls.append(a.paginationWrapper);a.paginationWrapper.on("touchend.owlControls mouseup.owlControls",".owl-page",function(b){b.preventDefault();Number(f(this).data("owl-page"))!==a.currentItem&&a.goTo(Number(f(this).data("owl-page")),!0)})},updatePagination:function(){var a,b,e,c,d,g;if(!1===this.options.pagination)return!1;this.paginationWrapper.html("");a=0;b=this.itemsAmount-this.itemsAmount%this.options.items;for(c=0;c<this.itemsAmount;c+=1)0===c%this.options.items&&
|
||||
(a+=1,b===c&&(e=this.itemsAmount-this.options.items),d=f("<div/>",{"class":"owl-page"}),g=f("<span></span>",{text:!0===this.options.paginationNumbers?a:"","class":!0===this.options.paginationNumbers?"owl-numbers":""}),d.append(g),d.data("owl-page",b===c?e:c),d.data("owl-roundPages",a),this.paginationWrapper.append(d));this.checkPagination()},checkPagination:function(){var a=this;if(!1===a.options.pagination)return!1;a.paginationWrapper.find(".owl-page").each(function(){f(this).data("owl-roundPages")===
|
||||
f(a.$owlightms[a.currentItem]).data("owl-roundPages")&&(a.paginationWrapper.find(".owl-page").removeClass("active"),f(this).addClass("active"))})},checkNavigation:function(){if(!1===this.options.navigation)return!1;!1===this.options.rewindNav&&(0===this.currentItem&&0===this.maximumItem?(this.buttonPrev.addClass("disabled"),this.buttonNext.addClass("disabled")):0===this.currentItem&&0!==this.maximumItem?(this.buttonPrev.addClass("disabled"),this.buttonNext.removeClass("disabled")):this.currentItem===
|
||||
this.maximumItem?(this.buttonPrev.removeClass("disabled"),this.buttonNext.addClass("disabled")):0!==this.currentItem&&this.currentItem!==this.maximumItem&&(this.buttonPrev.removeClass("disabled"),this.buttonNext.removeClass("disabled")))},updateControls:function(){this.updatePagination();this.checkNavigation();this.owlControls&&(this.options.items>=this.itemsAmount?this.owlControls.hide():this.owlControls.show())},destroyControls:function(){this.owlControls&&this.owlControls.remove()},next:function(a){if(this.isTransition)return!1;
|
||||
this.currentItem+=!0===this.options.scrollPerPage?this.options.items:1;if(this.currentItem>this.maximumItem+(!0===this.options.scrollPerPage?this.options.items-1:0))if(!0===this.options.rewindNav)this.currentItem=0,a="rewind";else return this.currentItem=this.maximumItem,!1;this.goTo(this.currentItem,a)},prev:function(a){if(this.isTransition)return!1;this.currentItem=!0===this.options.scrollPerPage&&0<this.currentItem&&this.currentItem<this.options.items?0:this.currentItem-(!0===this.options.scrollPerPage?
|
||||
this.options.items:1);if(0>this.currentItem)if(!0===this.options.rewindNav)this.currentItem=this.maximumItem,a="rewind";else return this.currentItem=0,!1;this.goTo(this.currentItem,a)},goTo:function(a,b,e){var c=this;if(c.isTransition)return!1;"function"===typeof c.options.beforeMove&&c.options.beforeMove.apply(this,[c.$elem]);a>=c.maximumItem?a=c.maximumItem:0>=a&&(a=0);c.currentItem=c.owl.currentItem=a;if(!1!==c.options.transitionStyle&&"drag"!==e&&1===c.options.items&&!0===c.browser.support3d)return c.swapSpeed(0),
|
||||
!0===c.browser.support3d?c.transition3d(c.positionsInArray[a]):c.css2slide(c.positionsInArray[a],1),c.afterGo(),c.singleItemTransition(),!1;a=c.positionsInArray[a];!0===c.browser.support3d?(c.isCss3Finish=!1,!0===b?(c.swapSpeed("paginationSpeed"),g.setTimeout(function(){c.isCss3Finish=!0},c.options.paginationSpeed)):"rewind"===b?(c.swapSpeed(c.options.rewindSpeed),g.setTimeout(function(){c.isCss3Finish=!0},c.options.rewindSpeed)):(c.swapSpeed("slideSpeed"),g.setTimeout(function(){c.isCss3Finish=!0},
|
||||
c.options.slideSpeed)),c.transition3d(a)):!0===b?c.css2slide(a,c.options.paginationSpeed):"rewind"===b?c.css2slide(a,c.options.rewindSpeed):c.css2slide(a,c.options.slideSpeed);c.afterGo()},jumpTo:function(a){"function"===typeof this.options.beforeMove&&this.options.beforeMove.apply(this,[this.$elem]);a>=this.maximumItem||-1===a?a=this.maximumItem:0>=a&&(a=0);this.swapSpeed(0);!0===this.browser.support3d?this.transition3d(this.positionsInArray[a]):this.css2slide(this.positionsInArray[a],1);this.currentItem=
|
||||
this.owl.currentItem=a;this.afterGo()},afterGo:function(){this.prevArr.push(this.currentItem);this.prevItem=this.owl.prevItem=this.prevArr[this.prevArr.length-2];this.prevArr.shift(0);this.prevItem!==this.currentItem&&(this.checkPagination(),this.checkNavigation(),this.eachMoveUpdate(),!1!==this.options.autoPlay&&this.checkAp());"function"===typeof this.options.afterMove&&this.prevItem!==this.currentItem&&this.options.afterMove.apply(this,[this.$elem])},stop:function(){this.apStatus="stop";g.clearInterval(this.autoPlayInterval)},
|
||||
checkAp:function(){"stop"!==this.apStatus&&this.play()},play:function(){var a=this;a.apStatus="play";if(!1===a.options.autoPlay)return!1;g.clearInterval(a.autoPlayInterval);a.autoPlayInterval=g.setInterval(function(){a.next(!0)},a.options.autoPlay)},swapSpeed:function(a){"slideSpeed"===a?this.$owlWrapper.css(this.addCssSpeed(this.options.slideSpeed)):"paginationSpeed"===a?this.$owlWrapper.css(this.addCssSpeed(this.options.paginationSpeed)):"string"!==typeof a&&this.$owlWrapper.css(this.addCssSpeed(a))},
|
||||
addCssSpeed:function(a){return{"-webkit-transition":"all "+a+"ms ease","-moz-transition":"all "+a+"ms ease","-o-transition":"all "+a+"ms ease",transition:"all "+a+"ms ease"}},removeTransition:function(){return{"-webkit-transition":"","-moz-transition":"","-o-transition":"",transition:""}},doTranslate:function(a){return{"-webkit-transform":"translate3d("+a+"px, 0px, 0px)","-moz-transform":"translate3d("+a+"px, 0px, 0px)","-o-transform":"translate3d("+a+"px, 0px, 0px)","-ms-transform":"translate3d("+
|
||||
a+"px, 0px, 0px)",transform:"translate3d("+a+"px, 0px,0px)"}},transition3d:function(a){this.$owlWrapper.css(this.doTranslate(a))},css2move:function(a){this.$owlWrapper.css({left:a})},css2slide:function(a,b){var e=this;e.isCssFinish=!1;e.$owlWrapper.stop(!0,!0).animate({left:a},{duration:b||e.options.slideSpeed,complete:function(){e.isCssFinish=!0}})},checkBrowser:function(){var a=k.createElement("div");a.style.cssText=" -moz-transform:translate3d(0px, 0px, 0px); -ms-transform:translate3d(0px, 0px, 0px); -o-transform:translate3d(0px, 0px, 0px); -webkit-transform:translate3d(0px, 0px, 0px); transform:translate3d(0px, 0px, 0px)";
|
||||
a=a.style.cssText.match(/translate3d\(0px, 0px, 0px\)/g);this.browser={support3d:null!==a&&1===a.length,isTouch:"ontouchstart"in g||g.navigator.msMaxTouchPoints}},moveEvents:function(){if(!1!==this.options.mouseDrag||!1!==this.options.touchDrag)this.gestures(),this.disabledEvents()},eventTypes:function(){var a=["s","e","x"];this.ev_types={};!0===this.options.mouseDrag&&!0===this.options.touchDrag?a=["touchstart.owl mousedown.owl","touchmove.owl mousemove.owl","touchend.owl touchcancel.owl mouseup.owl"]:
|
||||
!1===this.options.mouseDrag&&!0===this.options.touchDrag?a=["touchstart.owl","touchmove.owl","touchend.owl touchcancel.owl"]:!0===this.options.mouseDrag&&!1===this.options.touchDrag&&(a=["mousedown.owl","mousemove.owl","mouseup.owl"]);this.ev_types.start=a[0];this.ev_types.move=a[1];this.ev_types.end=a[2]},disabledEvents:function(){this.$elem.on("dragstart.owl",function(a){a.preventDefault()});this.$elem.on("mousedown.disableTextSelect",function(a){return f(a.target).is("input, textarea, select, option")})},
|
||||
gestures:function(){function a(a){if(void 0!==a.touches)return{x:a.touches[0].pageX,y:a.touches[0].pageY};if(void 0===a.touches){if(void 0!==a.pageX)return{x:a.pageX,y:a.pageY};if(void 0===a.pageX)return{x:a.clientX,y:a.clientY}}}function b(a){"on"===a?(f(k).on(d.ev_types.move,e),f(k).on(d.ev_types.end,c)):"off"===a&&(f(k).off(d.ev_types.move),f(k).off(d.ev_types.end))}function e(b){b=b.originalEvent||b||g.event;d.newPosX=a(b).x-h.offsetX;d.newPosY=a(b).y-h.offsetY;d.newRelativeX=d.newPosX-h.relativePos;
|
||||
"function"===typeof d.options.startDragging&&!0!==h.dragging&&0!==d.newRelativeX&&(h.dragging=!0,d.options.startDragging.apply(d,[d.$elem]));(8<d.newRelativeX||-8>d.newRelativeX)&&!0===d.browser.isTouch&&(void 0!==b.preventDefault?b.preventDefault():b.returnValue=!1,h.sliding=!0);(10<d.newPosY||-10>d.newPosY)&&!1===h.sliding&&f(k).off("touchmove.owl");d.newPosX=Math.max(Math.min(d.newPosX,d.newRelativeX/5),d.maximumPixels+d.newRelativeX/5);!0===d.browser.support3d?d.transition3d(d.newPosX):d.css2move(d.newPosX)}
|
||||
function c(a){a=a.originalEvent||a||g.event;var c;a.target=a.target||a.srcElement;h.dragging=!1;!0!==d.browser.isTouch&&d.$owlWrapper.removeClass("grabbing");d.dragDirection=0>d.newRelativeX?d.owl.dragDirection="left":d.owl.dragDirection="right";0!==d.newRelativeX&&(c=d.getNewPosition(),d.goTo(c,!1,"drag"),h.targetElement===a.target&&!0!==d.browser.isTouch&&(f(a.target).on("click.disable",function(a){a.stopImmediatePropagation();a.stopPropagation();a.preventDefault();f(a.target).off("click.disable")}),
|
||||
a=f._data(a.target,"events").click,c=a.pop(),a.splice(0,0,c)));b("off")}var d=this,h={offsetX:0,offsetY:0,baseElWidth:0,relativePos:0,position:null,minSwipe:null,maxSwipe:null,sliding:null,dargging:null,targetElement:null};d.isCssFinish=!0;d.$elem.on(d.ev_types.start,".owl-wrapper",function(c){c=c.originalEvent||c||g.event;var e;if(3===c.which)return!1;if(!(d.itemsAmount<=d.options.items)){if(!1===d.isCssFinish&&!d.options.dragBeforeAnimFinish||!1===d.isCss3Finish&&!d.options.dragBeforeAnimFinish)return!1;
|
||||
!1!==d.options.autoPlay&&g.clearInterval(d.autoPlayInterval);!0===d.browser.isTouch||d.$owlWrapper.hasClass("grabbing")||d.$owlWrapper.addClass("grabbing");d.newPosX=0;d.newRelativeX=0;f(this).css(d.removeTransition());e=f(this).position();h.relativePos=e.left;h.offsetX=a(c).x-e.left;h.offsetY=a(c).y-e.top;b("on");h.sliding=!1;h.targetElement=c.target||c.srcElement}})},getNewPosition:function(){var a=this.closestItem();a>this.maximumItem?a=this.currentItem=this.maximumItem:0<=this.newPosX&&(this.currentItem=
|
||||
a=0);return a},closestItem:function(){var a=this,b=!0===a.options.scrollPerPage?a.pagesInArray:a.positionsInArray,e=a.newPosX,c=null;f.each(b,function(d,g){e-a.itemWidth/20>b[d+1]&&e-a.itemWidth/20<g&&"left"===a.moveDirection()?(c=g,a.currentItem=!0===a.options.scrollPerPage?f.inArray(c,a.positionsInArray):d):e+a.itemWidth/20<g&&e+a.itemWidth/20>(b[d+1]||b[d]-a.itemWidth)&&"right"===a.moveDirection()&&(!0===a.options.scrollPerPage?(c=b[d+1]||b[b.length-1],a.currentItem=f.inArray(c,a.positionsInArray)):
|
||||
(c=b[d+1],a.currentItem=d+1))});return a.currentItem},moveDirection:function(){var a;0>this.newRelativeX?(a="right",this.playDirection="next"):(a="left",this.playDirection="prev");return a},customEvents:function(){var a=this;a.$elem.on("owl.next",function(){a.next()});a.$elem.on("owl.prev",function(){a.prev()});a.$elem.on("owl.play",function(b,e){a.options.autoPlay=e;a.play();a.hoverStatus="play"});a.$elem.on("owl.stop",function(){a.stop();a.hoverStatus="stop"});a.$elem.on("owl.goTo",function(b,e){a.goTo(e)});
|
||||
a.$elem.on("owl.jumpTo",function(b,e){a.jumpTo(e)})},stopOnHover:function(){var a=this;!0===a.options.stopOnHover&&!0!==a.browser.isTouch&&!1!==a.options.autoPlay&&(a.$elem.on("mouseover",function(){a.stop()}),a.$elem.on("mouseout",function(){"stop"!==a.hoverStatus&&a.play()}))},lazyLoad:function(){var a,b,e,c,d;if(!1===this.options.lazyLoad)return!1;for(a=0;a<this.itemsAmount;a+=1)b=f(this.$owlightms[a]),"loaded"!==b.data("owl-loaded")&&(e=b.data("owl-item"),c=b.find(".lazyOwl"),"string"!==typeof c.data("src")?
|
||||
b.data("owl-loaded","loaded"):(void 0===b.data("owl-loaded")&&(c.hide(),b.addClass("loading").data("owl-loaded","checked")),(d=!0===this.options.lazyFollow?e>=this.currentItem:!0)&&e<this.currentItem+this.options.items&&c.length&&this.lazyPreload(b,c)))},lazyPreload:function(a,b){function e(){a.data("owl-loaded","loaded").removeClass("loading");b.removeAttr("data-src");"fade"===d.options.lazyEffect?b.fadeIn(400):b.show();"function"===typeof d.options.afterLazyLoad&&d.options.afterLazyLoad.apply(this,
|
||||
[d.$elem])}function c(){f+=1;d.completeImg(b.get(0))||!0===k?e():100>=f?g.setTimeout(c,100):e()}var d=this,f=0,k;"DIV"===b.prop("tagName")?(b.css("background-image","url("+b.data("src")+")"),k=!0):b[0].src=b.data("src");c()},autoHeight:function(){function a(){var a=f(e.$owlightms[e.currentItem]).height();e.wrapperOuter.css("height",a+"px");e.wrapperOuter.hasClass("autoHeight")||g.setTimeout(function(){e.wrapperOuter.addClass("autoHeight")},0)}function b(){d+=1;e.completeImg(c.get(0))?a():100>=d?g.setTimeout(b,
|
||||
100):e.wrapperOuter.css("height","")}var e=this,c=f(e.$owlightms[e.currentItem]).find("img"),d;void 0!==c.get(0)?(d=0,b()):a()},completeImg:function(a){return!a.complete||"undefined"!==typeof a.naturalWidth&&0===a.naturalWidth?!1:!0},onVisibleItems:function(){var a;!0===this.options.addClassActive&&this.$owlightms.removeClass("active");this.visibleItems=[];for(a=this.currentItem;a<this.currentItem+this.options.items;a+=1)this.visibleItems.push(a),!0===this.options.addClassActive&&f(this.$owlightms[a]).addClass("active");
|
||||
this.owl.visibleItems=this.visibleItems},transitionTypes:function(a){this.outClass="owl-"+a+"-out";this.inClass="owl-"+a+"-in"},singleItemTransition:function(){var a=this,b=a.outClass,e=a.inClass,c=a.$owlightms.eq(a.currentItem),d=a.$owlightms.eq(a.prevItem),f=Math.abs(a.positionsInArray[a.currentItem])+a.positionsInArray[a.prevItem],g=Math.abs(a.positionsInArray[a.currentItem])+a.itemWidth/2;a.isTransition=!0;a.$owlWrapper.addClass("owl-origin").css({"-webkit-transform-origin":g+"px","-moz-perspective-origin":g+
|
||||
"px","perspective-origin":g+"px"});d.css({position:"relative",left:f+"px"}).addClass(b).on("webkitAnimationEnd oAnimationEnd MSAnimationEnd animationend",function(){a.endPrev=!0;d.off("webkitAnimationEnd oAnimationEnd MSAnimationEnd animationend");a.clearTransStyle(d,b)});c.addClass(e).on("webkitAnimationEnd oAnimationEnd MSAnimationEnd animationend",function(){a.endCurrent=!0;c.off("webkitAnimationEnd oAnimationEnd MSAnimationEnd animationend");a.clearTransStyle(c,e)})},clearTransStyle:function(a,
|
||||
b){a.css({position:"",left:""}).removeClass(b);this.endPrev&&this.endCurrent&&(this.$owlWrapper.removeClass("owl-origin"),this.isTransition=this.endCurrent=this.endPrev=!1)},owlStatus:function(){this.owl={userOptions:this.userOptions,baseElement:this.$elem,userItems:this.$userItems,owlightms:this.$owlightms,currentItem:this.currentItem,prevItem:this.prevItem,visibleItems:this.visibleItems,isTouch:this.browser.isTouch,browser:this.browser,dragDirection:this.dragDirection}},clearEvents:function(){this.$elem.off(".owl owl mousedown.disableTextSelect");
|
||||
f(k).off(".owl owl");f(g).off("resize",this.resizer)},unWrap:function(){0!==this.$elem.children().length&&(this.$owlWrapper.unwrap(),this.$userItems.unwrap().unwrap(),this.owlControls&&this.owlControls.remove());this.clearEvents();this.$elem.attr("style",this.$elem.data("owl-originalStyles")||"").attr("class",this.$elem.data("owl-originalClasses"))},destroy:function(){this.stop();g.clearInterval(this.checkVisible);this.unWrap();this.$elem.removeData()},reinit:function(a){a=f.extend({},this.userOptions,
|
||||
a);this.unWrap();this.init(a,this.$elem)},addItem:function(a,b){var e;if(!a)return!1;if(0===this.$elem.children().length)return this.$elem.append(a),this.setVars(),!1;this.unWrap();e=void 0===b||-1===b?-1:b;e>=this.$userItems.length||-1===e?this.$userItems.eq(-1).after(a):this.$userItems.eq(e).before(a);this.setVars()},removeItem:function(a){if(0===this.$elem.children().length)return!1;a=void 0===a||-1===a?-1:a;this.unWrap();this.$userItems.eq(a).remove();this.setVars()}};f.fn.owlCarousel=function(a){return this.each(function(){if(!0===
|
||||
f(this).data("owl-init"))return!1;f(this).data("owl-init",!0);var b=Object.create(l);b.init(a,this);f.data(this,"owlCarousel",b)})};f.fn.owlCarousel.options={items:5,itemsCustom:!1,itemsDesktop:[1199,4],itemsDesktopSmall:[979,3],itemsTablet:[768,2],itemsTabletSmall:!1,itemsMobile:[479,1],singleItem:!1,itemsScaleUp:!1,slideSpeed:200,paginationSpeed:800,rewindSpeed:1E3,autoPlay:!1,stopOnHover:!1,navigation:!1,navigationText:["prev","next"],rewindNav:!0,scrollPerPage:!1,pagination:!0,paginationNumbers:!1,
|
||||
responsive:!0,responsiveRefreshRate:200,responsiveBaseWidth:g,baseClass:"owl-carousel",theme:"owl-theme",lazyLoad:!1,lazyFollow:!0,lazyEffect:"fade",autoHeight:!1,jsonPath:!1,jsonSuccess:!1,dragBeforeAnimFinish:!0,mouseDrag:!0,touchDrag:!0,addClassActive:!1,transitionStyle:!1,beforeUpdate:!1,afterUpdate:!1,beforeInit:!1,afterInit:!1,beforeMove:!1,afterMove:!1,afterAction:!1,startDragging:!1,afterLazyLoad:!1}})(jQuery,window,document);
|
||||
1
js/owl.carousel.min.js
vendored
Normal file
1
js/owl.carousel.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
11
js/placeholder.js
Normal file
11
js/placeholder.js
Normal file
@@ -0,0 +1,11 @@
|
||||
/*********************************************
|
||||
|
||||
jQuery extended placeholder plugin.
|
||||
Text, password, and textarea fields supported.
|
||||
Version: 0.9.2
|
||||
Author: Sergey Estrin
|
||||
Site: http://g-rain-design.ru/en/jquery/placeholder/
|
||||
Released under the MIT License.
|
||||
|
||||
*********************************************/
|
||||
!function(e){e.fn.placeholder_clear=function(){var a=e(this).data("placeholders");e(this).find("input[placeholder], textarea[placeholder]").each(function(){var l=e(this).attr("name");l in a&&e(this).val()==a[l]&&e(this).val("")})},e.fn.placeholder_focus=function(a){this.val()==a&&(this.val(""),this.removeClass(e.fn.placeholder_options.placeholded_class))},e.fn.placeholder_blur=function(a){""==this.val()&&(this.val(a),this.addClass(e.fn.placeholder_options.placeholded_class))},e.fn.placeholder_password_focus=function(a){if(!this.is(":password")&&this.val()==a){var l=e('<input type="password" name="'+this.attr("name")+'" value="" />');l.attr("placeholder",a),l.attr("class",this.attr("class")),l.removeClass("pie_first-child"),l.removeClass(e.fn.placeholder_options.placeholded_class),l.blur(function(){l.placeholder_password_blur(a)}),this.replaceWith(l),l.focus(),l.focus()}},e.fn.placeholder_password_blur=function(a){if(this.is(":password")&&""==this.val()){var l=e('<input type="text" name="'+this.attr("name")+'" value="'+a+'" />');l.attr("placeholder",a),l.attr("class",this.attr("class")),l.removeClass("pie_first-child"),l.addClass(e.fn.placeholder_options.placeholded_class),l.focus(function(){l.placeholder_password_focus(a)}),this.replaceWith(l)}},e.fn.placeholder=function(a){if(null!=a)for(var l in a)null!=e.fn.placeholder_options[l]&&(e.fn.placeholder_options[l]=a[l]);var o=this;e.fn.placeholder_options.container&&e(e.fn.placeholder_options.container_selector).each(function(){var a=e(this).find(e.fn.placeholder_options.caption_selector+":first").html(),l=e(this).find("input:text:first, input:password:first, textarea:first");a&&l[0]&&(l.attr("placeholder",a),o.push(l))}),o.each(function(){var a=e(this),l=e.fn.placeholder_options.caption_prefix+a.attr("placeholder")+e.fn.placeholder_options.caption_postfix,o=a.parents("form:first"),t=o.data("placeholders");t instanceof Array||(t=[]),t[a.attr("name")]=l,o.data("placeholders",t),o.unbind("submit",e.fn.placeholder_clear).bind("submit",e.fn.placeholder_clear),a.is(":password")?(a.placeholder_password_blur(l),a.focus(function(){a.placeholder_password_focus(l)}),a.blur(function(){a.placeholder_password_blur(l)})):(a.placeholder_blur(l),a.focus(function(){a.placeholder_focus(l)}),a.blur(function(){a.placeholder_blur(l)}))})},e.fn.placeholder_options={placeholded_class:"placeholded",caption_prefix:"",caption_postfix:"",container:!1,container_selector:".form-field-container",caption_selector:".form-field-caption"}}(jQuery),$().ready(function(){$(":input[placeholder], textarea[placeholder]").placeholder()});
|
||||
1
js/side-menu.js
Normal file
1
js/side-menu.js
Normal file
@@ -0,0 +1 @@
|
||||
jQuery(document).ready(function(e){e("#nav-stick").affix({offset:{top:1}});var n=e("#cd-menu-trigger"),s=e(".sliding-content"),i=e("header");n.on("click",function(o){o.preventDefault(),n.toggleClass("is-clicked"),i.toggleClass("lateral-menu-is-open"),s.toggleClass("lateral-menu-is-open").one("webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend",function(){e("body").toggleClass("overflow-hidden")}),e("#cd-lateral-nav").toggleClass("lateral-menu-is-open"),e("html").hasClass("no-csstransitions")&&e("body").toggleClass("overflow-hidden")}),s.on("click",function(o){e(o.target).is("#cd-menu-trigger, #cd-menu-trigger span")||(n.removeClass("is-clicked"),i.removeClass("lateral-menu-is-open"),s.removeClass("lateral-menu-is-open").one("webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend",function(){e("body").removeClass("overflow-hidden")}),e("#cd-lateral-nav").removeClass("lateral-menu-is-open"),e("html").hasClass("no-csstransitions")&&e("body").removeClass("overflow-hidden"))}),e(".item-has-children").children("a").on("click",function(n){n.preventDefault(),e(this).toggleClass("submenu-open").next(".sub-menu").slideToggle(200).end().parent(".item-has-children").siblings(".item-has-children").children("a").removeClass("submenu-open").next(".sub-menu").slideUp(200)})});
|
||||
154
js/text-rotator.js
Normal file
154
js/text-rotator.js
Normal file
@@ -0,0 +1,154 @@
|
||||
jQuery(document).ready(function($){
|
||||
//set animation timing
|
||||
var animationDelay = 3500,
|
||||
//loading bar effect
|
||||
barAnimationDelay = 3800,
|
||||
barWaiting = barAnimationDelay - 3000, //3000 is the duration of the transition on the loading bar - set in the scss/css file
|
||||
//letters effect
|
||||
lettersDelay = 50,
|
||||
//type effect
|
||||
typeLettersDelay = 150,
|
||||
selectionDuration = 500,
|
||||
typeAnimationDelay = selectionDuration + 800,
|
||||
//clip effect
|
||||
revealDuration = 600,
|
||||
revealAnimationDelay = 1500;
|
||||
|
||||
initHeadline();
|
||||
|
||||
|
||||
function initHeadline() {
|
||||
//insert <i> element for each letter of a changing word
|
||||
singleLetters($('.cd-headline.letters').find('b'));
|
||||
//initialise headline animation
|
||||
animateHeadline($('.cd-headline'));
|
||||
}
|
||||
|
||||
function singleLetters($words) {
|
||||
$words.each(function(){
|
||||
var word = $(this),
|
||||
letters = word.text().split(''),
|
||||
selected = word.hasClass('is-visible');
|
||||
for (i in letters) {
|
||||
if(word.parents('.rotate-2').length > 0) letters[i] = '<em>' + letters[i] + '</em>';
|
||||
letters[i] = (selected) ? '<i class="in">' + letters[i] + '</i>': '<i>' + letters[i] + '</i>';
|
||||
}
|
||||
var newLetters = letters.join('');
|
||||
word.html(newLetters).css('opacity', 1);
|
||||
});
|
||||
}
|
||||
|
||||
function animateHeadline($headlines) {
|
||||
var duration = animationDelay;
|
||||
$headlines.each(function(){
|
||||
var headline = $(this);
|
||||
|
||||
if(headline.hasClass('loading-bar')) {
|
||||
duration = barAnimationDelay;
|
||||
setTimeout(function(){ headline.find('.cd-words-wrapper').addClass('is-loading') }, barWaiting);
|
||||
} else if (headline.hasClass('clip')){
|
||||
var spanWrapper = headline.find('.cd-words-wrapper'),
|
||||
newWidth = spanWrapper.width() + 10
|
||||
spanWrapper.css('width', newWidth);
|
||||
} else if (!headline.hasClass('type') ) {
|
||||
//assign to .cd-words-wrapper the width of its longest word
|
||||
var words = headline.find('.cd-words-wrapper b'),
|
||||
width = 0;
|
||||
words.each(function(){
|
||||
var wordWidth = $(this).width();
|
||||
if (wordWidth > width) width = wordWidth;
|
||||
});
|
||||
headline.find('.cd-words-wrapper').css('width', width);
|
||||
};
|
||||
|
||||
//trigger animation
|
||||
setTimeout(function(){ hideWord( headline.find('.is-visible').eq(0) ) }, duration);
|
||||
});
|
||||
}
|
||||
|
||||
function hideWord($word) {
|
||||
var nextWord = takeNext($word);
|
||||
|
||||
if($word.parents('.cd-headline').hasClass('type')) {
|
||||
var parentSpan = $word.parent('.cd-words-wrapper');
|
||||
parentSpan.addClass('selected').removeClass('waiting');
|
||||
setTimeout(function(){
|
||||
parentSpan.removeClass('selected');
|
||||
$word.removeClass('is-visible').addClass('is-hidden').children('i').removeClass('in').addClass('out');
|
||||
}, selectionDuration);
|
||||
setTimeout(function(){ showWord(nextWord, typeLettersDelay) }, typeAnimationDelay);
|
||||
|
||||
} else if($word.parents('.cd-headline').hasClass('letters')) {
|
||||
var bool = ($word.children('i').length >= nextWord.children('i').length) ? true : false;
|
||||
hideLetter($word.find('i').eq(0), $word, bool, lettersDelay);
|
||||
showLetter(nextWord.find('i').eq(0), nextWord, bool, lettersDelay);
|
||||
|
||||
} else if($word.parents('.cd-headline').hasClass('clip')) {
|
||||
$word.parents('.cd-words-wrapper').animate({ width : '2px' }, revealDuration, function(){
|
||||
switchWord($word, nextWord);
|
||||
showWord(nextWord);
|
||||
});
|
||||
|
||||
} else if ($word.parents('.cd-headline').hasClass('loading-bar')){
|
||||
$word.parents('.cd-words-wrapper').removeClass('is-loading');
|
||||
switchWord($word, nextWord);
|
||||
setTimeout(function(){ hideWord(nextWord) }, barAnimationDelay);
|
||||
setTimeout(function(){ $word.parents('.cd-words-wrapper').addClass('is-loading') }, barWaiting);
|
||||
|
||||
} else {
|
||||
switchWord($word, nextWord);
|
||||
setTimeout(function(){ hideWord(nextWord) }, animationDelay);
|
||||
}
|
||||
}
|
||||
|
||||
function showWord($word, $duration) {
|
||||
if($word.parents('.cd-headline').hasClass('type')) {
|
||||
showLetter($word.find('i').eq(0), $word, false, $duration);
|
||||
$word.addClass('is-visible').removeClass('is-hidden');
|
||||
|
||||
} else if($word.parents('.cd-headline').hasClass('clip')) {
|
||||
$word.parents('.cd-words-wrapper').animate({ 'width' : $word.width() + 10 }, revealDuration, function(){
|
||||
setTimeout(function(){ hideWord($word) }, revealAnimationDelay);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function hideLetter($letter, $word, $bool, $duration) {
|
||||
$letter.removeClass('in').addClass('out');
|
||||
|
||||
if(!$letter.is(':last-child')) {
|
||||
setTimeout(function(){ hideLetter($letter.next(), $word, $bool, $duration); }, $duration);
|
||||
} else if($bool) {
|
||||
setTimeout(function(){ hideWord(takeNext($word)) }, animationDelay);
|
||||
}
|
||||
|
||||
if($letter.is(':last-child') && $('html').hasClass('no-csstransitions')) {
|
||||
var nextWord = takeNext($word);
|
||||
switchWord($word, nextWord);
|
||||
}
|
||||
}
|
||||
|
||||
function showLetter($letter, $word, $bool, $duration) {
|
||||
$letter.addClass('in').removeClass('out');
|
||||
|
||||
if(!$letter.is(':last-child')) {
|
||||
setTimeout(function(){ showLetter($letter.next(), $word, $bool, $duration); }, $duration);
|
||||
} else {
|
||||
if($word.parents('.cd-headline').hasClass('type')) { setTimeout(function(){ $word.parents('.cd-words-wrapper').addClass('waiting'); }, 200);}
|
||||
if(!$bool) { setTimeout(function(){ hideWord($word) }, animationDelay) }
|
||||
}
|
||||
}
|
||||
|
||||
function takeNext($word) {
|
||||
return (!$word.is(':last-child')) ? $word.next() : $word.parent().children().eq(0);
|
||||
}
|
||||
|
||||
function takePrev($word) {
|
||||
return (!$word.is(':first-child')) ? $word.prev() : $word.parent().children().last();
|
||||
}
|
||||
|
||||
function switchWord($oldWord, $newWord) {
|
||||
$oldWord.removeClass('is-visible').addClass('is-hidden');
|
||||
$newWord.removeClass('is-hidden').addClass('is-visible');
|
||||
}
|
||||
});
|
||||
179
js/twitter/index.php
Normal file
179
js/twitter/index.php
Normal file
@@ -0,0 +1,179 @@
|
||||
<?php
|
||||
/*
|
||||
|
||||
Stan Scates
|
||||
blr | further
|
||||
|
||||
stan@sc8s.com
|
||||
blrfurther.com
|
||||
|
||||
Basic OAuth and caching layer for Seaofclouds' tweet.js, designed
|
||||
to introduce compatibility with Twitter's v1.1 API.
|
||||
|
||||
Version: 1.3.1
|
||||
Created: 2013.02.20
|
||||
|
||||
https://github.com/seaofclouds/tweet
|
||||
https://github.com/themattharris/tmhOAuth
|
||||
|
||||
*/
|
||||
|
||||
if(empty($_POST)) { die(); }
|
||||
|
||||
class ezTweet {
|
||||
/*************************************** config ***************************************/
|
||||
|
||||
// Your Twitter App Consumer Key
|
||||
private $consumer_key = 'TAAXGrJOrbmu4SSpx1MV4mg9D';
|
||||
|
||||
// Your Twitter App Consumer Secret
|
||||
private $consumer_secret = '9RmLMr0P6mh871hKNMdVlmq4OuDJEHfCUxupVJvgT7eB73usK0';
|
||||
|
||||
// Your Twitter App Access Token
|
||||
private $user_token = '703265035-ct9h1XUgyleHR0jvUYmesYblnDzrUhcoJo8XuMm4';
|
||||
|
||||
// Your Twitter App Access Token Secret
|
||||
private $user_secret = 'WenIFWU1fLUA1tjXoMJqp2R0Zyg6Hh34OvorDE5ElGfvb';
|
||||
|
||||
// Path to tmhOAuth libraries
|
||||
private $lib = './lib/';
|
||||
|
||||
// Enable caching
|
||||
private $cache_enabled = false;
|
||||
|
||||
// Cache interval (minutes)
|
||||
private $cache_interval = 1;
|
||||
|
||||
// Path to writable cache directory
|
||||
private $cache_dir = './';
|
||||
|
||||
// Enable debugging
|
||||
private $debug = false;
|
||||
|
||||
/**************************************************************************************/
|
||||
|
||||
public function __construct() {
|
||||
// Initialize paths and etc.
|
||||
$this->pathify($this->cache_dir);
|
||||
$this->pathify($this->lib);
|
||||
$this->message = '';
|
||||
|
||||
// Set server-side debug params
|
||||
if($this->debug === true) {
|
||||
error_reporting(-1);
|
||||
} else {
|
||||
error_reporting(0);
|
||||
}
|
||||
}
|
||||
|
||||
public function fetch() {
|
||||
echo json_encode(
|
||||
array(
|
||||
'response' => json_decode($this->getJSON(), true),
|
||||
'message' => ($this->debug) ? $this->message : false
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
private function getJSON() {
|
||||
if($this->cache_enabled === true) {
|
||||
$CFID = $this->generateCFID();
|
||||
$cache_file = $this->cache_dir.$CFID;
|
||||
|
||||
if(file_exists($cache_file) && (filemtime($cache_file) > (time() - 60 * intval($this->cache_interval)))) {
|
||||
return file_get_contents($cache_file, FILE_USE_INCLUDE_PATH);
|
||||
} else {
|
||||
|
||||
$JSONraw = $this->getTwitterJSON();
|
||||
$JSON = $JSONraw['response'];
|
||||
|
||||
// Don't write a bad cache file if there was a CURL error
|
||||
if($JSONraw['errno'] != 0) {
|
||||
$this->consoleDebug($JSONraw['error']);
|
||||
return $JSON;
|
||||
}
|
||||
|
||||
if($this->debug === true) {
|
||||
// Check for twitter-side errors
|
||||
$pj = json_decode($JSON, true);
|
||||
if(isset($pj['errors'])) {
|
||||
foreach($pj['errors'] as $error) {
|
||||
$message = 'Twitter Error: "'.$error['message'].'", Error Code #'.$error['code'];
|
||||
$this->consoleDebug($message);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if(is_writable($this->cache_dir) && $JSONraw) {
|
||||
if(file_put_contents($cache_file, $JSON, LOCK_EX) === false) {
|
||||
$this->consoleDebug("Error writing cache file");
|
||||
}
|
||||
} else {
|
||||
$this->consoleDebug("Cache directory is not writable");
|
||||
}
|
||||
return $JSON;
|
||||
}
|
||||
} else {
|
||||
$JSONraw = $this->getTwitterJSON();
|
||||
|
||||
if($this->debug === true) {
|
||||
// Check for CURL errors
|
||||
if($JSONraw['errno'] != 0) {
|
||||
$this->consoleDebug($JSONraw['error']);
|
||||
}
|
||||
|
||||
// Check for twitter-side errors
|
||||
$pj = json_decode($JSONraw['response'], true);
|
||||
if(isset($pj['errors'])) {
|
||||
foreach($pj['errors'] as $error) {
|
||||
$message = 'Twitter Error: "'.$error['message'].'", Error Code #'.$error['code'];
|
||||
$this->consoleDebug($message);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return $JSONraw['response'];
|
||||
}
|
||||
}
|
||||
|
||||
private function getTwitterJSON() {
|
||||
require $this->lib.'tmhOAuth.php';
|
||||
require $this->lib.'tmhUtilities.php';
|
||||
|
||||
$tmhOAuth = new tmhOAuth(array(
|
||||
'consumer_key' => $this->consumer_key,
|
||||
'consumer_secret' => $this->consumer_secret,
|
||||
'user_token' => $this->user_token,
|
||||
'user_secret' => $this->user_secret,
|
||||
'curl_ssl_verifypeer' => false
|
||||
));
|
||||
|
||||
$url = $_POST['request']['url'];
|
||||
$params = $_POST['request']['parameters'];
|
||||
|
||||
$tmhOAuth->request('GET', $tmhOAuth->url($url), $params);
|
||||
return $tmhOAuth->response;
|
||||
}
|
||||
|
||||
private function generateCFID() {
|
||||
// The unique cached filename ID
|
||||
return md5(serialize($_POST)).'.json';
|
||||
}
|
||||
|
||||
private function pathify(&$path) {
|
||||
// Ensures our user-specified paths are up to snuff
|
||||
$path = realpath($path).'/';
|
||||
}
|
||||
|
||||
private function consoleDebug($message) {
|
||||
if($this->debug === true) {
|
||||
$this->message .= 'tweet.js: '.$message."\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$ezTweet = new ezTweet;
|
||||
$ezTweet->fetch();
|
||||
|
||||
?>
|
||||
4
js/twitter/jquery.tweet.js
Normal file
4
js/twitter/jquery.tweet.js
Normal file
File diff suppressed because one or more lines are too long
724
js/twitter/lib/tmhOAuth.php
Normal file
724
js/twitter/lib/tmhOAuth.php
Normal file
@@ -0,0 +1,724 @@
|
||||
<?php
|
||||
/**
|
||||
* tmhOAuth
|
||||
*
|
||||
* An OAuth 1.0A library written in PHP.
|
||||
* The library supports file uploading using multipart/form as well as general
|
||||
* REST requests. OAuth authentication is sent using the an Authorization Header.
|
||||
*
|
||||
* @author themattharris
|
||||
* @version 0.7.4
|
||||
*
|
||||
* 19 February 2013
|
||||
*/
|
||||
class tmhOAuth {
|
||||
const VERSION = '0.7.4';
|
||||
|
||||
var $response = array();
|
||||
|
||||
/**
|
||||
* Creates a new tmhOAuth object
|
||||
*
|
||||
* @param string $config, the configuration to use for this request
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($config=array()) {
|
||||
$this->params = array();
|
||||
$this->headers = array();
|
||||
$this->auto_fixed_time = false;
|
||||
$this->buffer = null;
|
||||
|
||||
// default configuration options
|
||||
$this->config = array_merge(
|
||||
array(
|
||||
// leave 'user_agent' blank for default, otherwise set this to
|
||||
// something that clearly identifies your app
|
||||
'user_agent' => '',
|
||||
// default timezone for requests
|
||||
'timezone' => 'UTC',
|
||||
|
||||
'use_ssl' => true,
|
||||
'host' => 'api.twitter.com',
|
||||
|
||||
'consumer_key' => '',
|
||||
'consumer_secret' => '',
|
||||
'user_token' => '',
|
||||
'user_secret' => '',
|
||||
'force_nonce' => false,
|
||||
'nonce' => false, // used for checking signatures. leave as false for auto
|
||||
'force_timestamp' => false,
|
||||
'timestamp' => false, // used for checking signatures. leave as false for auto
|
||||
|
||||
// oauth signing variables that are not dynamic
|
||||
'oauth_version' => '1.0',
|
||||
'oauth_signature_method' => 'HMAC-SHA1',
|
||||
|
||||
// you probably don't want to change any of these curl values
|
||||
'curl_connecttimeout' => 30,
|
||||
'curl_timeout' => 10,
|
||||
|
||||
// for security this should always be set to 2.
|
||||
'curl_ssl_verifyhost' => 2,
|
||||
// for security this should always be set to true.
|
||||
'curl_ssl_verifypeer' => true,
|
||||
|
||||
// you can get the latest cacert.pem from here http://curl.haxx.se/ca/cacert.pem
|
||||
'curl_cainfo' => dirname(__FILE__) . DIRECTORY_SEPARATOR . 'cacert.pem',
|
||||
'curl_capath' => dirname(__FILE__),
|
||||
|
||||
'curl_followlocation' => false, // whether to follow redirects or not
|
||||
|
||||
// support for proxy servers
|
||||
'curl_proxy' => false, // really you don't want to use this if you are using streaming
|
||||
'curl_proxyuserpwd' => false, // format username:password for proxy, if required
|
||||
'curl_encoding' => '', // leave blank for all supported formats, else use gzip, deflate, identity
|
||||
|
||||
// streaming API
|
||||
'is_streaming' => false,
|
||||
'streaming_eol' => "\r\n",
|
||||
'streaming_metrics_interval' => 60,
|
||||
|
||||
// header or querystring. You should always use header!
|
||||
// this is just to help me debug other developers implementations
|
||||
'as_header' => true,
|
||||
'debug' => false,
|
||||
),
|
||||
$config
|
||||
);
|
||||
$this->set_user_agent();
|
||||
date_default_timezone_set($this->config['timezone']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the useragent for PHP to use
|
||||
* If '$this->config['user_agent']' already has a value it is used instead of one
|
||||
* being generated.
|
||||
*
|
||||
* @return void value is stored to the config array class variable
|
||||
*/
|
||||
private function set_user_agent() {
|
||||
if (!empty($this->config['user_agent']))
|
||||
return;
|
||||
|
||||
if ($this->config['curl_ssl_verifyhost'] && $this->config['curl_ssl_verifypeer']) {
|
||||
$ssl = '+SSL';
|
||||
} else {
|
||||
$ssl = '-SSL';
|
||||
}
|
||||
|
||||
$ua = 'tmhOAuth ' . self::VERSION . $ssl . ' - //github.com/themattharris/tmhOAuth';
|
||||
$this->config['user_agent'] = $ua;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a random OAuth nonce.
|
||||
* If 'force_nonce' is true a nonce is not generated and the value in the configuration will be retained.
|
||||
*
|
||||
* @param string $length how many characters the nonce should be before MD5 hashing. default 12
|
||||
* @param string $include_time whether to include time at the beginning of the nonce. default true
|
||||
* @return void value is stored to the config array class variable
|
||||
*/
|
||||
private function create_nonce($length=12, $include_time=true) {
|
||||
if ($this->config['force_nonce'] == false) {
|
||||
$sequence = array_merge(range(0,9), range('A','Z'), range('a','z'));
|
||||
$length = $length > count($sequence) ? count($sequence) : $length;
|
||||
shuffle($sequence);
|
||||
|
||||
$prefix = $include_time ? microtime() : '';
|
||||
$this->config['nonce'] = md5(substr($prefix . implode('', $sequence), 0, $length));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a timestamp.
|
||||
* If 'force_timestamp' is true a nonce is not generated and the value in the configuration will be retained.
|
||||
*
|
||||
* @return void value is stored to the config array class variable
|
||||
*/
|
||||
private function create_timestamp() {
|
||||
$this->config['timestamp'] = ($this->config['force_timestamp'] == false ? time() : $this->config['timestamp']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Encodes the string or array passed in a way compatible with OAuth.
|
||||
* If an array is passed each array value will will be encoded.
|
||||
*
|
||||
* @param mixed $data the scalar or array to encode
|
||||
* @return $data encoded in a way compatible with OAuth
|
||||
*/
|
||||
private function safe_encode($data) {
|
||||
if (is_array($data)) {
|
||||
return array_map(array($this, 'safe_encode'), $data);
|
||||
} else if (is_scalar($data)) {
|
||||
return str_ireplace(
|
||||
array('+', '%7E'),
|
||||
array(' ', '~'),
|
||||
rawurlencode($data)
|
||||
);
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Decodes the string or array from it's URL encoded form
|
||||
* If an array is passed each array value will will be decoded.
|
||||
*
|
||||
* @param mixed $data the scalar or array to decode
|
||||
* @return string $data decoded from the URL encoded form
|
||||
*/
|
||||
private function safe_decode($data) {
|
||||
if (is_array($data)) {
|
||||
return array_map(array($this, 'safe_decode'), $data);
|
||||
} else if (is_scalar($data)) {
|
||||
return rawurldecode($data);
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of the standard OAuth parameters.
|
||||
*
|
||||
* @return array all required OAuth parameters, safely encoded
|
||||
*/
|
||||
private function get_defaults() {
|
||||
$defaults = array(
|
||||
'oauth_version' => $this->config['oauth_version'],
|
||||
'oauth_nonce' => $this->config['nonce'],
|
||||
'oauth_timestamp' => $this->config['timestamp'],
|
||||
'oauth_consumer_key' => $this->config['consumer_key'],
|
||||
'oauth_signature_method' => $this->config['oauth_signature_method'],
|
||||
);
|
||||
|
||||
// include the user token if it exists
|
||||
if ( $this->config['user_token'] )
|
||||
$defaults['oauth_token'] = $this->config['user_token'];
|
||||
|
||||
// safely encode
|
||||
foreach ($defaults as $k => $v) {
|
||||
$_defaults[$this->safe_encode($k)] = $this->safe_encode($v);
|
||||
}
|
||||
|
||||
return $_defaults;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extracts and decodes OAuth parameters from the passed string
|
||||
*
|
||||
* @param string $body the response body from an OAuth flow method
|
||||
* @return array the response body safely decoded to an array of key => values
|
||||
*/
|
||||
public function extract_params($body) {
|
||||
$kvs = explode('&', $body);
|
||||
$decoded = array();
|
||||
foreach ($kvs as $kv) {
|
||||
$kv = explode('=', $kv, 2);
|
||||
$kv[0] = $this->safe_decode($kv[0]);
|
||||
$kv[1] = $this->safe_decode($kv[1]);
|
||||
$decoded[$kv[0]] = $kv[1];
|
||||
}
|
||||
return $decoded;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepares the HTTP method for use in the base string by converting it to
|
||||
* uppercase.
|
||||
*
|
||||
* @param string $method an HTTP method such as GET or POST
|
||||
* @return void value is stored to the class variable 'method'
|
||||
*/
|
||||
private function prepare_method($method) {
|
||||
$this->method = strtoupper($method);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepares the URL for use in the base string by ripping it apart and
|
||||
* reconstructing it.
|
||||
*
|
||||
* Ref: 3.4.1.2
|
||||
*
|
||||
* @param string $url the request URL
|
||||
* @return void value is stored to the class variable 'url'
|
||||
*/
|
||||
private function prepare_url($url) {
|
||||
$parts = parse_url($url);
|
||||
|
||||
$port = isset($parts['port']) ? $parts['port'] : false;
|
||||
$scheme = $parts['scheme'];
|
||||
$host = $parts['host'];
|
||||
$path = isset($parts['path']) ? $parts['path'] : false;
|
||||
|
||||
$port or $port = ($scheme == 'https') ? '443' : '80';
|
||||
|
||||
if (($scheme == 'https' && $port != '443')
|
||||
|| ($scheme == 'http' && $port != '80')) {
|
||||
$host = "$host:$port";
|
||||
}
|
||||
|
||||
// the scheme and host MUST be lowercase
|
||||
$this->url = strtolower("$scheme://$host");
|
||||
// but not the path
|
||||
$this->url .= $path;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepares all parameters for the base string and request.
|
||||
* Multipart parameters are ignored as they are not defined in the specification,
|
||||
* all other types of parameter are encoded for compatibility with OAuth.
|
||||
*
|
||||
* @param array $params the parameters for the request
|
||||
* @return void prepared values are stored in the class variable 'signing_params'
|
||||
*/
|
||||
private function prepare_params($params) {
|
||||
// do not encode multipart parameters, leave them alone
|
||||
if ($this->config['multipart']) {
|
||||
$this->request_params = $params;
|
||||
$params = array();
|
||||
}
|
||||
|
||||
// signing parameters are request parameters + OAuth default parameters
|
||||
$this->signing_params = array_merge($this->get_defaults(), (array)$params);
|
||||
|
||||
// Remove oauth_signature if present
|
||||
// Ref: Spec: 9.1.1 ("The oauth_signature parameter MUST be excluded.")
|
||||
if (isset($this->signing_params['oauth_signature'])) {
|
||||
unset($this->signing_params['oauth_signature']);
|
||||
}
|
||||
|
||||
// Parameters are sorted by name, using lexicographical byte value ordering.
|
||||
// Ref: Spec: 9.1.1 (1)
|
||||
uksort($this->signing_params, 'strcmp');
|
||||
|
||||
// encode. Also sort the signed parameters from the POST parameters
|
||||
foreach ($this->signing_params as $k => $v) {
|
||||
$k = $this->safe_encode($k);
|
||||
|
||||
if (is_array($v))
|
||||
$v = implode(',', $v);
|
||||
|
||||
$v = $this->safe_encode($v);
|
||||
$_signing_params[$k] = $v;
|
||||
$kv[] = "{$k}={$v}";
|
||||
}
|
||||
|
||||
// auth params = the default oauth params which are present in our collection of signing params
|
||||
$this->auth_params = array_intersect_key($this->get_defaults(), $_signing_params);
|
||||
if (isset($_signing_params['oauth_callback'])) {
|
||||
$this->auth_params['oauth_callback'] = $_signing_params['oauth_callback'];
|
||||
unset($_signing_params['oauth_callback']);
|
||||
}
|
||||
|
||||
if (isset($_signing_params['oauth_verifier'])) {
|
||||
$this->auth_params['oauth_verifier'] = $_signing_params['oauth_verifier'];
|
||||
unset($_signing_params['oauth_verifier']);
|
||||
}
|
||||
|
||||
// request_params is already set if we're doing multipart, if not we need to set them now
|
||||
if ( ! $this->config['multipart'])
|
||||
$this->request_params = array_diff_key($_signing_params, $this->get_defaults());
|
||||
|
||||
// create the parameter part of the base string
|
||||
$this->signing_params = implode('&', $kv);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepares the OAuth signing key
|
||||
*
|
||||
* @return void prepared signing key is stored in the class variable 'signing_key'
|
||||
*/
|
||||
private function prepare_signing_key() {
|
||||
$this->signing_key = $this->safe_encode($this->config['consumer_secret']) . '&' . $this->safe_encode($this->config['user_secret']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare the base string.
|
||||
* Ref: Spec: 9.1.3 ("Concatenate Request Elements")
|
||||
*
|
||||
* @return void prepared base string is stored in the class variable 'base_string'
|
||||
*/
|
||||
private function prepare_base_string() {
|
||||
$url = $this->url;
|
||||
|
||||
# if the host header is set we need to rewrite the basestring to use
|
||||
# that, instead of the request host. otherwise the signature won't match
|
||||
# on the server side
|
||||
if (!empty($this->custom_headers['Host'])) {
|
||||
$url = str_ireplace(
|
||||
$this->config['host'],
|
||||
$this->custom_headers['Host'],
|
||||
$url
|
||||
);
|
||||
}
|
||||
|
||||
$base = array(
|
||||
$this->method,
|
||||
$url,
|
||||
$this->signing_params
|
||||
);
|
||||
$this->base_string = implode('&', $this->safe_encode($base));
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepares the Authorization header
|
||||
*
|
||||
* @return void prepared authorization header is stored in the class variable headers['Authorization']
|
||||
*/
|
||||
private function prepare_auth_header() {
|
||||
unset($this->headers['Authorization']);
|
||||
|
||||
uksort($this->auth_params, 'strcmp');
|
||||
if (!$this->config['as_header']) :
|
||||
$this->request_params = array_merge($this->request_params, $this->auth_params);
|
||||
return;
|
||||
endif;
|
||||
|
||||
foreach ($this->auth_params as $k => $v) {
|
||||
$kv[] = "{$k}=\"{$v}\"";
|
||||
}
|
||||
$this->auth_header = 'OAuth ' . implode(', ', $kv);
|
||||
$this->headers['Authorization'] = $this->auth_header;
|
||||
}
|
||||
|
||||
/**
|
||||
* Signs the request and adds the OAuth signature. This runs all the request
|
||||
* parameter preparation methods.
|
||||
*
|
||||
* @param string $method the HTTP method being used. e.g. POST, GET, HEAD etc
|
||||
* @param string $url the request URL without query string parameters
|
||||
* @param array $params the request parameters as an array of key=value pairs
|
||||
* @param string $useauth whether to use authentication when making the request.
|
||||
* @return void
|
||||
*/
|
||||
private function sign($method, $url, $params, $useauth) {
|
||||
$this->prepare_method($method);
|
||||
$this->prepare_url($url);
|
||||
$this->prepare_params($params);
|
||||
|
||||
// we don't sign anything is we're not using auth
|
||||
if ($useauth) {
|
||||
$this->prepare_base_string();
|
||||
$this->prepare_signing_key();
|
||||
|
||||
$this->auth_params['oauth_signature'] = $this->safe_encode(
|
||||
base64_encode(
|
||||
hash_hmac(
|
||||
'sha1', $this->base_string, $this->signing_key, true
|
||||
)));
|
||||
|
||||
$this->prepare_auth_header();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Make an HTTP request using this library. This method doesn't return anything.
|
||||
* Instead the response should be inspected directly.
|
||||
*
|
||||
* @param string $method the HTTP method being used. e.g. POST, GET, HEAD etc
|
||||
* @param string $url the request URL without query string parameters
|
||||
* @param array $params the request parameters as an array of key=value pairs. Default empty array
|
||||
* @param string $useauth whether to use authentication when making the request. Default true
|
||||
* @param string $multipart whether this request contains multipart data. Default false
|
||||
* @param array $headers any custom headers to send with the request. Default empty array
|
||||
* @return int the http response code for the request. 0 is returned if a connection could not be made
|
||||
*/
|
||||
public function request($method, $url, $params=array(), $useauth=true, $multipart=false, $headers=array()) {
|
||||
// reset the request headers (we don't want to reuse them)
|
||||
$this->headers = array();
|
||||
$this->custom_headers = $headers;
|
||||
|
||||
$this->config['multipart'] = $multipart;
|
||||
|
||||
$this->create_nonce();
|
||||
$this->create_timestamp();
|
||||
|
||||
$this->sign($method, $url, $params, $useauth);
|
||||
|
||||
if (!empty($this->custom_headers))
|
||||
$this->headers = array_merge((array)$this->headers, (array)$this->custom_headers);
|
||||
|
||||
return $this->curlit();
|
||||
}
|
||||
|
||||
/**
|
||||
* Make a long poll HTTP request using this library. This method is
|
||||
* different to the other request methods as it isn't supposed to disconnect
|
||||
*
|
||||
* Using this method expects a callback which will receive the streaming
|
||||
* responses.
|
||||
*
|
||||
* @param string $method the HTTP method being used. e.g. POST, GET, HEAD etc
|
||||
* @param string $url the request URL without query string parameters
|
||||
* @param array $params the request parameters as an array of key=value pairs
|
||||
* @param string $callback the callback function to stream the buffer to.
|
||||
* @return void
|
||||
*/
|
||||
public function streaming_request($method, $url, $params=array(), $callback='') {
|
||||
if ( ! empty($callback) ) {
|
||||
if ( ! is_callable($callback) ) {
|
||||
return false;
|
||||
}
|
||||
$this->config['streaming_callback'] = $callback;
|
||||
}
|
||||
$this->metrics['start'] = time();
|
||||
$this->metrics['interval_start'] = $this->metrics['start'];
|
||||
$this->metrics['tweets'] = 0;
|
||||
$this->metrics['last_tweets'] = 0;
|
||||
$this->metrics['bytes'] = 0;
|
||||
$this->metrics['last_bytes'] = 0;
|
||||
$this->config['is_streaming'] = true;
|
||||
$this->request($method, $url, $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles the updating of the current Streaming API metrics.
|
||||
*
|
||||
* @return array the metrics for the streaming api connection
|
||||
*/
|
||||
private function update_metrics() {
|
||||
$now = time();
|
||||
if (($this->metrics['interval_start'] + $this->config['streaming_metrics_interval']) > $now)
|
||||
return false;
|
||||
|
||||
$this->metrics['tps'] = round( ($this->metrics['tweets'] - $this->metrics['last_tweets']) / $this->config['streaming_metrics_interval'], 2);
|
||||
$this->metrics['bps'] = round( ($this->metrics['bytes'] - $this->metrics['last_bytes']) / $this->config['streaming_metrics_interval'], 2);
|
||||
|
||||
$this->metrics['last_bytes'] = $this->metrics['bytes'];
|
||||
$this->metrics['last_tweets'] = $this->metrics['tweets'];
|
||||
$this->metrics['interval_start'] = $now;
|
||||
return $this->metrics;
|
||||
}
|
||||
|
||||
/**
|
||||
* Utility function to create the request URL in the requested format
|
||||
*
|
||||
* @param string $request the API method without extension
|
||||
* @param string $format the format of the response. Default json. Set to an empty string to exclude the format
|
||||
* @return string the concatenation of the host, API version, API method and format
|
||||
*/
|
||||
public function url($request, $format='json') {
|
||||
$format = strlen($format) > 0 ? ".$format" : '';
|
||||
$proto = $this->config['use_ssl'] ? 'https:/' : 'http:/';
|
||||
|
||||
// backwards compatibility with v0.1
|
||||
if (isset($this->config['v']))
|
||||
$this->config['host'] = $this->config['host'] . '/' . $this->config['v'];
|
||||
|
||||
$request = ltrim($request, '/');
|
||||
|
||||
$pos = strlen($request) - strlen($format);
|
||||
if (substr($request, $pos) === $format)
|
||||
$request = substr_replace($request, '', $pos);
|
||||
|
||||
return implode('/', array(
|
||||
$proto,
|
||||
$this->config['host'],
|
||||
$request . $format
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Public access to the private safe decode/encode methods
|
||||
*
|
||||
* @param string $text the text to transform
|
||||
* @param string $mode the transformation mode. either encode or decode
|
||||
* @return string $text transformed by the given $mode
|
||||
*/
|
||||
public function transformText($text, $mode='encode') {
|
||||
return $this->{"safe_$mode"}($text);
|
||||
}
|
||||
|
||||
/**
|
||||
* Utility function to parse the returned curl headers and store them in the
|
||||
* class array variable.
|
||||
*
|
||||
* @param object $ch curl handle
|
||||
* @param string $header the response headers
|
||||
* @return string the length of the header
|
||||
*/
|
||||
private function curlHeader($ch, $header) {
|
||||
$this->response['raw'] .= $header;
|
||||
|
||||
list($key, $value) = array_pad(explode(':', $header, 2), 2, null);
|
||||
|
||||
$key = trim($key);
|
||||
$value = trim($value);
|
||||
|
||||
if ( ! isset($this->response['headers'][$key])) {
|
||||
$this->response['headers'][$key] = $value;
|
||||
} else {
|
||||
if (!is_array($this->response['headers'][$key])) {
|
||||
$this->response['headers'][$key] = array($this->response['headers'][$key]);
|
||||
}
|
||||
$this->response['headers'][$key][] = $value;
|
||||
}
|
||||
|
||||
return strlen($header);
|
||||
}
|
||||
|
||||
/**
|
||||
* Utility function to parse the returned curl buffer and store them until
|
||||
* an EOL is found. The buffer for curl is an undefined size so we need
|
||||
* to collect the content until an EOL is found.
|
||||
*
|
||||
* This function calls the previously defined streaming callback method.
|
||||
*
|
||||
* @param object $ch curl handle
|
||||
* @param string $data the current curl buffer
|
||||
* @return int the length of the data string processed in this function
|
||||
*/
|
||||
private function curlWrite($ch, $data) {
|
||||
$l = strlen($data);
|
||||
if (strpos($data, $this->config['streaming_eol']) === false) {
|
||||
$this->buffer .= $data;
|
||||
return $l;
|
||||
}
|
||||
|
||||
$buffered = explode($this->config['streaming_eol'], $data);
|
||||
$content = $this->buffer . $buffered[0];
|
||||
|
||||
$this->metrics['tweets']++;
|
||||
$this->metrics['bytes'] += strlen($content);
|
||||
|
||||
if ( ! is_callable($this->config['streaming_callback']))
|
||||
return 0;
|
||||
|
||||
$metrics = $this->update_metrics();
|
||||
$stop = call_user_func(
|
||||
$this->config['streaming_callback'],
|
||||
$content,
|
||||
strlen($content),
|
||||
$metrics
|
||||
);
|
||||
$this->buffer = $buffered[1];
|
||||
if ($stop)
|
||||
return 0;
|
||||
|
||||
return $l;
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes a curl request. Takes no parameters as all should have been prepared
|
||||
* by the request method
|
||||
*
|
||||
* the response data is stored in the class variable 'response'
|
||||
*
|
||||
* @return int the http response code for the request. 0 is returned if a connection could not be made
|
||||
*/
|
||||
private function curlit() {
|
||||
$this->response['raw'] = '';
|
||||
|
||||
// method handling
|
||||
switch ($this->method) {
|
||||
case 'POST':
|
||||
break;
|
||||
default:
|
||||
// GET, DELETE request so convert the parameters to a querystring
|
||||
if ( ! empty($this->request_params)) {
|
||||
foreach ($this->request_params as $k => $v) {
|
||||
// Multipart params haven't been encoded yet.
|
||||
// Not sure why you would do a multipart GET but anyway, here's the support for it
|
||||
if ($this->config['multipart']) {
|
||||
$params[] = $this->safe_encode($k) . '=' . $this->safe_encode($v);
|
||||
} else {
|
||||
$params[] = $k . '=' . $v;
|
||||
}
|
||||
}
|
||||
$qs = implode('&', $params);
|
||||
$this->url = strlen($qs) > 0 ? $this->url . '?' . $qs : $this->url;
|
||||
$this->request_params = array();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// configure curl
|
||||
$c = curl_init();
|
||||
curl_setopt_array($c, array(
|
||||
CURLOPT_USERAGENT => $this->config['user_agent'],
|
||||
CURLOPT_CONNECTTIMEOUT => $this->config['curl_connecttimeout'],
|
||||
CURLOPT_TIMEOUT => $this->config['curl_timeout'],
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_SSL_VERIFYPEER => $this->config['curl_ssl_verifypeer'],
|
||||
CURLOPT_SSL_VERIFYHOST => $this->config['curl_ssl_verifyhost'],
|
||||
|
||||
CURLOPT_FOLLOWLOCATION => $this->config['curl_followlocation'],
|
||||
CURLOPT_PROXY => $this->config['curl_proxy'],
|
||||
CURLOPT_ENCODING => $this->config['curl_encoding'],
|
||||
CURLOPT_URL => $this->url,
|
||||
// process the headers
|
||||
CURLOPT_HEADERFUNCTION => array($this, 'curlHeader'),
|
||||
CURLOPT_HEADER => false,
|
||||
CURLINFO_HEADER_OUT => true,
|
||||
));
|
||||
|
||||
if ($this->config['curl_cainfo'] !== false)
|
||||
curl_setopt($c, CURLOPT_CAINFO, $this->config['curl_cainfo']);
|
||||
|
||||
if ($this->config['curl_capath'] !== false)
|
||||
curl_setopt($c, CURLOPT_CAPATH, $this->config['curl_capath']);
|
||||
|
||||
if ($this->config['curl_proxyuserpwd'] !== false)
|
||||
curl_setopt($c, CURLOPT_PROXYUSERPWD, $this->config['curl_proxyuserpwd']);
|
||||
|
||||
if ($this->config['is_streaming']) {
|
||||
// process the body
|
||||
$this->response['content-length'] = 0;
|
||||
curl_setopt($c, CURLOPT_TIMEOUT, 0);
|
||||
curl_setopt($c, CURLOPT_WRITEFUNCTION, array($this, 'curlWrite'));
|
||||
}
|
||||
|
||||
switch ($this->method) {
|
||||
case 'GET':
|
||||
break;
|
||||
case 'POST':
|
||||
curl_setopt($c, CURLOPT_POST, true);
|
||||
curl_setopt($c, CURLOPT_POSTFIELDS, $this->request_params);
|
||||
break;
|
||||
default:
|
||||
curl_setopt($c, CURLOPT_CUSTOMREQUEST, $this->method);
|
||||
}
|
||||
|
||||
if ( ! empty($this->request_params) ) {
|
||||
// if not doing multipart we need to implode the parameters
|
||||
if ( ! $this->config['multipart'] ) {
|
||||
foreach ($this->request_params as $k => $v) {
|
||||
$ps[] = "{$k}={$v}";
|
||||
}
|
||||
$this->request_params = implode('&', $ps);
|
||||
}
|
||||
curl_setopt($c, CURLOPT_POSTFIELDS, $this->request_params);
|
||||
}
|
||||
|
||||
if ( ! empty($this->headers)) {
|
||||
foreach ($this->headers as $k => $v) {
|
||||
$headers[] = trim($k . ': ' . $v);
|
||||
}
|
||||
curl_setopt($c, CURLOPT_HTTPHEADER, $headers);
|
||||
}
|
||||
|
||||
if (isset($this->config['prevent_request']) && (true == $this->config['prevent_request']))
|
||||
return 0;
|
||||
|
||||
// do it!
|
||||
$response = curl_exec($c);
|
||||
$code = curl_getinfo($c, CURLINFO_HTTP_CODE);
|
||||
$info = curl_getinfo($c);
|
||||
$error = curl_error($c);
|
||||
$errno = curl_errno($c);
|
||||
curl_close($c);
|
||||
|
||||
// store the response
|
||||
$this->response['code'] = $code;
|
||||
$this->response['response'] = $response;
|
||||
$this->response['info'] = $info;
|
||||
$this->response['error'] = $error;
|
||||
$this->response['errno'] = $errno;
|
||||
|
||||
if (!isset($this->response['raw'])) {
|
||||
$this->response['raw'] = '';
|
||||
}
|
||||
$this->response['raw'] .= $response;
|
||||
|
||||
return $code;
|
||||
}
|
||||
}
|
||||
280
js/twitter/lib/tmhUtilities.php
Normal file
280
js/twitter/lib/tmhUtilities.php
Normal file
@@ -0,0 +1,280 @@
|
||||
<?php
|
||||
/**
|
||||
* tmhUtilities
|
||||
*
|
||||
* Helpful utility and Twitter formatting functions
|
||||
*
|
||||
* @author themattharris
|
||||
* @version 0.5.0
|
||||
*
|
||||
* 04 September 2012
|
||||
*/
|
||||
class tmhUtilities {
|
||||
const VERSION = '0.5.0';
|
||||
/**
|
||||
* Entifies the tweet using the given entities element.
|
||||
* Deprecated.
|
||||
* You should instead use entify_with_options.
|
||||
*
|
||||
* @param array $tweet the json converted to normalised array
|
||||
* @param array $replacements if specified, the entities and their replacements will be stored to this variable
|
||||
* @return the tweet text with entities replaced with hyperlinks
|
||||
*/
|
||||
public static function entify($tweet, &$replacements=array()) {
|
||||
return tmhUtilities::entify_with_options($tweet, array(), $replacements);
|
||||
}
|
||||
|
||||
/**
|
||||
* Entifies the tweet using the given entities element, using the provided
|
||||
* options.
|
||||
*
|
||||
* @param array $tweet the json converted to normalised array
|
||||
* @param array $options settings to be used when rendering the entities
|
||||
* @param array $replacements if specified, the entities and their replacements will be stored to this variable
|
||||
* @return the tweet text with entities replaced with hyperlinks
|
||||
*/
|
||||
public static function entify_with_options($tweet, $options=array(), &$replacements=array()) {
|
||||
$default_opts = array(
|
||||
'encoding' => 'UTF-8',
|
||||
'target' => '',
|
||||
);
|
||||
|
||||
$opts = array_merge($default_opts, $options);
|
||||
|
||||
$encoding = mb_internal_encoding();
|
||||
mb_internal_encoding($opts['encoding']);
|
||||
|
||||
$keys = array();
|
||||
$is_retweet = false;
|
||||
|
||||
if (isset($tweet['retweeted_status'])) {
|
||||
$tweet = $tweet['retweeted_status'];
|
||||
$is_retweet = true;
|
||||
}
|
||||
|
||||
if (!isset($tweet['entities'])) {
|
||||
return $tweet['text'];
|
||||
}
|
||||
|
||||
$target = (!empty($opts['target'])) ? ' target="'.$opts['target'].'"' : '';
|
||||
|
||||
// prepare the entities
|
||||
foreach ($tweet['entities'] as $type => $things) {
|
||||
foreach ($things as $entity => $value) {
|
||||
$tweet_link = "<a href=\"https://twitter.com/{$tweet['user']['screen_name']}/statuses/{$tweet['id']}\"{$target}>{$tweet['created_at']}</a>";
|
||||
|
||||
switch ($type) {
|
||||
case 'hashtags':
|
||||
$href = "<a href=\"https://twitter.com/search?q=%23{$value['text']}\"{$target}>#{$value['text']}</a>";
|
||||
break;
|
||||
case 'user_mentions':
|
||||
$href = "@<a href=\"https://twitter.com/{$value['screen_name']}\" title=\"{$value['name']}\"{$target}>{$value['screen_name']}</a>";
|
||||
break;
|
||||
case 'urls':
|
||||
case 'media':
|
||||
$url = empty($value['expanded_url']) ? $value['url'] : $value['expanded_url'];
|
||||
$display = isset($value['display_url']) ? $value['display_url'] : str_replace('http://', '', $url);
|
||||
// Not all pages are served in UTF-8 so you may need to do this ...
|
||||
$display = urldecode(str_replace('%E2%80%A6', '…', urlencode($display)));
|
||||
$href = "<a href=\"{$value['url']}\"{$target}>{$display}</a>";
|
||||
break;
|
||||
}
|
||||
$keys[$value['indices']['0']] = mb_substr(
|
||||
$tweet['text'],
|
||||
$value['indices']['0'],
|
||||
$value['indices']['1'] - $value['indices']['0']
|
||||
);
|
||||
$replacements[$value['indices']['0']] = $href;
|
||||
}
|
||||
}
|
||||
|
||||
ksort($replacements);
|
||||
$replacements = array_reverse($replacements, true);
|
||||
$entified_tweet = $tweet['text'];
|
||||
foreach ($replacements as $k => $v) {
|
||||
$entified_tweet = mb_substr($entified_tweet, 0, $k).$v.mb_substr($entified_tweet, $k + strlen($keys[$k]));
|
||||
}
|
||||
$replacements = array(
|
||||
'replacements' => $replacements,
|
||||
'keys' => $keys
|
||||
);
|
||||
|
||||
mb_internal_encoding($encoding);
|
||||
return $entified_tweet;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current URL. This is instead of PHP_SELF which is unsafe
|
||||
*
|
||||
* @param bool $dropqs whether to drop the querystring or not. Default true
|
||||
* @return string the current URL
|
||||
*/
|
||||
public static function php_self($dropqs=true) {
|
||||
$protocol = 'http';
|
||||
if (isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on') {
|
||||
$protocol = 'https';
|
||||
} elseif (isset($_SERVER['SERVER_PORT']) && ($_SERVER['SERVER_PORT'] == '443')) {
|
||||
$protocol = 'https';
|
||||
}
|
||||
|
||||
$url = sprintf('%s://%s%s',
|
||||
$protocol,
|
||||
$_SERVER['SERVER_NAME'],
|
||||
$_SERVER['REQUEST_URI']
|
||||
);
|
||||
|
||||
$parts = parse_url($url);
|
||||
|
||||
$port = $_SERVER['SERVER_PORT'];
|
||||
$scheme = $parts['scheme'];
|
||||
$host = $parts['host'];
|
||||
$path = @$parts['path'];
|
||||
$qs = @$parts['query'];
|
||||
|
||||
$port or $port = ($scheme == 'https') ? '443' : '80';
|
||||
|
||||
if (($scheme == 'https' && $port != '443')
|
||||
|| ($scheme == 'http' && $port != '80')) {
|
||||
$host = "$host:$port";
|
||||
}
|
||||
$url = "$scheme://$host$path";
|
||||
if ( ! $dropqs)
|
||||
return "{$url}?{$qs}";
|
||||
else
|
||||
return $url;
|
||||
}
|
||||
|
||||
public static function is_cli() {
|
||||
return (PHP_SAPI == 'cli' && empty($_SERVER['REMOTE_ADDR']));
|
||||
}
|
||||
|
||||
/**
|
||||
* Debug function for printing the content of an object
|
||||
*
|
||||
* @param mixes $obj
|
||||
*/
|
||||
public static function pr($obj) {
|
||||
|
||||
if (!self::is_cli())
|
||||
echo '<pre style="word-wrap: break-word">';
|
||||
if ( is_object($obj) )
|
||||
print_r($obj);
|
||||
elseif ( is_array($obj) )
|
||||
print_r($obj);
|
||||
else
|
||||
echo $obj;
|
||||
if (!self::is_cli())
|
||||
echo '</pre>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Make an HTTP request using this library. This method is different to 'request'
|
||||
* because on a 401 error it will retry the request.
|
||||
*
|
||||
* When a 401 error is returned it is possible the timestamp of the client is
|
||||
* too different to that of the API server. In this situation it is recommended
|
||||
* the request is retried with the OAuth timestamp set to the same as the API
|
||||
* server. This method will automatically try that technique.
|
||||
*
|
||||
* This method doesn't return anything. Instead the response should be
|
||||
* inspected directly.
|
||||
*
|
||||
* @param string $method the HTTP method being used. e.g. POST, GET, HEAD etc
|
||||
* @param string $url the request URL without query string parameters
|
||||
* @param array $params the request parameters as an array of key=value pairs
|
||||
* @param string $useauth whether to use authentication when making the request. Default true.
|
||||
* @param string $multipart whether this request contains multipart data. Default false
|
||||
*/
|
||||
public static function auto_fix_time_request($tmhOAuth, $method, $url, $params=array(), $useauth=true, $multipart=false) {
|
||||
$tmhOAuth->request($method, $url, $params, $useauth, $multipart);
|
||||
|
||||
// if we're not doing auth the timestamp isn't important
|
||||
if ( ! $useauth)
|
||||
return;
|
||||
|
||||
// some error that isn't a 401
|
||||
if ($tmhOAuth->response['code'] != 401)
|
||||
return;
|
||||
|
||||
// some error that is a 401 but isn't because the OAuth token and signature are incorrect
|
||||
// TODO: this check is horrid but helps avoid requesting twice when the username and password are wrong
|
||||
if (stripos($tmhOAuth->response['response'], 'password') !== false)
|
||||
return;
|
||||
|
||||
// force the timestamp to be the same as the Twitter servers, and re-request
|
||||
$tmhOAuth->auto_fixed_time = true;
|
||||
$tmhOAuth->config['force_timestamp'] = true;
|
||||
$tmhOAuth->config['timestamp'] = strtotime($tmhOAuth->response['headers']['date']);
|
||||
return $tmhOAuth->request($method, $url, $params, $useauth, $multipart);
|
||||
}
|
||||
|
||||
/**
|
||||
* Asks the user for input and returns the line they enter
|
||||
*
|
||||
* @param string $prompt the text to display to the user
|
||||
* @return the text entered by the user
|
||||
*/
|
||||
public static function read_input($prompt) {
|
||||
echo $prompt;
|
||||
$handle = fopen("php://stdin","r");
|
||||
$data = fgets($handle);
|
||||
return trim($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a password from the shell.
|
||||
*
|
||||
* This function works on *nix systems only and requires shell_exec and stty.
|
||||
*
|
||||
* @param boolean $stars Wether or not to output stars for given characters
|
||||
* @return string
|
||||
* @url http://www.dasprids.de/blog/2008/08/22/getting-a-password-hidden-from-stdin-with-php-cli
|
||||
*/
|
||||
public static function read_password($prompt, $stars=false) {
|
||||
echo $prompt;
|
||||
$style = shell_exec('stty -g');
|
||||
|
||||
if ($stars === false) {
|
||||
shell_exec('stty -echo');
|
||||
$password = rtrim(fgets(STDIN), "\n");
|
||||
} else {
|
||||
shell_exec('stty -icanon -echo min 1 time 0');
|
||||
$password = '';
|
||||
while (true) :
|
||||
$char = fgetc(STDIN);
|
||||
if ($char === "\n") :
|
||||
break;
|
||||
elseif (ord($char) === 127) :
|
||||
if (strlen($password) > 0) {
|
||||
fwrite(STDOUT, "\x08 \x08");
|
||||
$password = substr($password, 0, -1);
|
||||
}
|
||||
else
|
||||
fwrite(STDOUT, "*");
|
||||
$password .= $char;
|
||||
endif;
|
||||
endwhile;
|
||||
}
|
||||
|
||||
// Reset
|
||||
shell_exec('stty ' . $style);
|
||||
echo PHP_EOL;
|
||||
return $password;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if one string ends with another
|
||||
*
|
||||
* @param string $haystack the string to check inside of
|
||||
* @param string $needle the string to check $haystack ends with
|
||||
* @return true if $haystack ends with $needle, false otherwise
|
||||
*/
|
||||
public static function endswith($haystack, $needle) {
|
||||
$haylen = strlen($haystack);
|
||||
$needlelen = strlen($needle);
|
||||
if ($needlelen > $haylen)
|
||||
return false;
|
||||
|
||||
return substr_compare($haystack, $needle, -$needlelen) === 0;
|
||||
}
|
||||
}
|
||||
2
js/wow.min.js
vendored
Normal file
2
js/wow.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user