First complete upload on nas

This commit is contained in:
2024-09-18 11:20:28 +02:00
commit 4f086962fe
6456 changed files with 1232660 additions and 0 deletions
File diff suppressed because one or more lines are too long
+13
View File
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+10
View 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)
+8
View File
@@ -0,0 +1,8 @@
jQuery.easing.jswing=jQuery.easing.swing;
jQuery.extend(jQuery.easing,{def:"easeOutQuad",swing:function(e,a,c,b,d){return jQuery.easing[jQuery.easing.def](e,a,c,b,d)},easeInQuad:function(e,a,c,b,d){return b*(a/=d)*a+c},easeOutQuad:function(e,a,c,b,d){return-b*(a/=d)*(a-2)+c},easeInOutQuad:function(e,a,c,b,d){if((a/=d/2)<1)return b/2*a*a+c;return-b/2*(--a*(a-2)-1)+c},easeInCubic:function(e,a,c,b,d){return b*(a/=d)*a*a+c},easeOutCubic:function(e,a,c,b,d){return b*((a=a/d-1)*a*a+1)+c},easeInOutCubic:function(e,a,c,b,d){if((a/=d/2)<1)return b/
2*a*a*a+c;return b/2*((a-=2)*a*a+2)+c},easeInQuart:function(e,a,c,b,d){return b*(a/=d)*a*a*a+c},easeOutQuart:function(e,a,c,b,d){return-b*((a=a/d-1)*a*a*a-1)+c},easeInOutQuart:function(e,a,c,b,d){if((a/=d/2)<1)return b/2*a*a*a*a+c;return-b/2*((a-=2)*a*a*a-2)+c},easeInQuint:function(e,a,c,b,d){return b*(a/=d)*a*a*a*a+c},easeOutQuint:function(e,a,c,b,d){return b*((a=a/d-1)*a*a*a*a+1)+c},easeInOutQuint:function(e,a,c,b,d){if((a/=d/2)<1)return b/2*a*a*a*a*a+c;return b/2*((a-=2)*a*a*a*a+2)+c},easeInSine:function(e,
a,c,b,d){return-b*Math.cos(a/d*(Math.PI/2))+b+c},easeOutSine:function(e,a,c,b,d){return b*Math.sin(a/d*(Math.PI/2))+c},easeInOutSine:function(e,a,c,b,d){return-b/2*(Math.cos(Math.PI*a/d)-1)+c},easeInExpo:function(e,a,c,b,d){return a==0?c:b*Math.pow(2,10*(a/d-1))+c},easeOutExpo:function(e,a,c,b,d){return a==d?c+b:b*(-Math.pow(2,-10*a/d)+1)+c},easeInOutExpo:function(e,a,c,b,d){if(a==0)return c;if(a==d)return c+b;if((a/=d/2)<1)return b/2*Math.pow(2,10*(a-1))+c;return b/2*(-Math.pow(2,-10*--a)+2)+c},
easeInCirc:function(e,a,c,b,d){return-b*(Math.sqrt(1-(a/=d)*a)-1)+c},easeOutCirc:function(e,a,c,b,d){return b*Math.sqrt(1-(a=a/d-1)*a)+c},easeInOutCirc:function(e,a,c,b,d){if((a/=d/2)<1)return-b/2*(Math.sqrt(1-a*a)-1)+c;return b/2*(Math.sqrt(1-(a-=2)*a)+1)+c},easeInElastic:function(e,a,c,b,d){e=1.70158;var f=0,g=b;if(a==0)return c;if((a/=d)==1)return c+b;f||(f=d*0.3);if(g<Math.abs(b)){g=b;e=f/4}else e=f/(2*Math.PI)*Math.asin(b/g);return-(g*Math.pow(2,10*(a-=1))*Math.sin((a*d-e)*2*Math.PI/f))+c},easeOutElastic:function(e,
a,c,b,d){e=1.70158;var f=0,g=b;if(a==0)return c;if((a/=d)==1)return c+b;f||(f=d*0.3);if(g<Math.abs(b)){g=b;e=f/4}else e=f/(2*Math.PI)*Math.asin(b/g);return g*Math.pow(2,-10*a)*Math.sin((a*d-e)*2*Math.PI/f)+b+c},easeInOutElastic:function(e,a,c,b,d){e=1.70158;var f=0,g=b;if(a==0)return c;if((a/=d/2)==2)return c+b;f||(f=d*0.3*1.5);if(g<Math.abs(b)){g=b;e=f/4}else e=f/(2*Math.PI)*Math.asin(b/g);if(a<1)return-0.5*g*Math.pow(2,10*(a-=1))*Math.sin((a*d-e)*2*Math.PI/f)+c;return g*Math.pow(2,-10*(a-=1))*Math.sin((a*
d-e)*2*Math.PI/f)*0.5+b+c},easeInBack:function(e,a,c,b,d,f){if(f==undefined)f=1.70158;return b*(a/=d)*a*((f+1)*a-f)+c},easeOutBack:function(e,a,c,b,d,f){if(f==undefined)f=1.70158;return b*((a=a/d-1)*a*((f+1)*a+f)+1)+c},easeInOutBack:function(e,a,c,b,d,f){if(f==undefined)f=1.70158;if((a/=d/2)<1)return b/2*a*a*(((f*=1.525)+1)*a-f)+c;return b/2*((a-=2)*a*(((f*=1.525)+1)*a+f)+2)+c},easeInBounce:function(e,a,c,b,d){return b-jQuery.easing.easeOutBounce(e,d-a,0,b,d)+c},easeOutBounce:function(e,a,c,b,d){return(a/=
d)<1/2.75?b*7.5625*a*a+c:a<2/2.75?b*(7.5625*(a-=1.5/2.75)*a+0.75)+c:a<2.5/2.75?b*(7.5625*(a-=2.25/2.75)*a+0.9375)+c:b*(7.5625*(a-=2.625/2.75)*a+0.984375)+c},easeInOutBounce:function(e,a,c,b,d){if(a<d/2)return jQuery.easing.easeInBounce(e,a*2,0,b,d)*0.5+c;return jQuery.easing.easeOutBounce(e,a*2-d,0,b,d)*0.5+b*0.5+c}});
+82
View File
@@ -0,0 +1,82 @@
/*jshint browser:true */
/*!
* FitVids 1.1
*
* Copyright 2013, Chris Coyier - http://css-tricks.com + Dave Rupert - http://daverupert.com
* Credit to Thierry Koblentz - http://www.alistapart.com/articles/creating-intrinsic-ratios-for-video/
* Released under the WTFPL license - http://sam.zoy.org/wtfpl/
*
*/
;(function( $ ){
'use strict';
$.fn.fitVids = function( options ) {
var settings = {
customSelector: null,
ignore: null
};
if(!document.getElementById('fit-vids-style')) {
// appendStyles: https://github.com/toddmotto/fluidvids/blob/master/dist/fluidvids.js
var head = document.head || document.getElementsByTagName('head')[0];
var css = '.fluid-width-video-wrapper{width:100%;position:relative;padding:0;}.fluid-width-video-wrapper iframe,.fluid-width-video-wrapper object,.fluid-width-video-wrapper embed {position:absolute;top:0;left:0;width:100%;height:100%;}';
var div = document.createElement("div");
div.innerHTML = '<p>x</p><style id="fit-vids-style">' + css + '</style>';
head.appendChild(div.childNodes[1]);
}
if ( options ) {
$.extend( settings, options );
}
return this.each(function(){
var selectors = [
'iframe[src*="player.vimeo.com"]',
'iframe[src*="youtube.com"]',
'iframe[src*="youtube-nocookie.com"]',
'iframe[src*="kickstarter.com"][src*="video.html"]',
'object',
'embed'
];
if (settings.customSelector) {
selectors.push(settings.customSelector);
}
var ignoreList = '.fitvidsignore';
if(settings.ignore) {
ignoreList = ignoreList + ', ' + settings.ignore;
}
var $allVideos = $(this).find(selectors.join(','));
$allVideos = $allVideos.not('object object'); // SwfObj conflict patch
$allVideos = $allVideos.not(ignoreList); // Disable FitVids on this video.
$allVideos.each(function(count){
var $this = $(this);
if($this.parents(ignoreList).length > 0) {
return; // Disable FitVids on this video.
}
if (this.tagName.toLowerCase() === 'embed' && $this.parent('object').length || $this.parent('.fluid-width-video-wrapper').length) { return; }
if ((!$this.css('height') && !$this.css('width')) && (isNaN($this.attr('height')) || isNaN($this.attr('width'))))
{
$this.attr('height', 9);
$this.attr('width', 16);
}
var height = ( this.tagName.toLowerCase() === 'object' || ($this.attr('height') && !isNaN(parseInt($this.attr('height'), 10))) ) ? parseInt($this.attr('height'), 10) : $this.height(),
width = !isNaN(parseInt($this.attr('width'), 10)) ? parseInt($this.attr('width'), 10) : $this.width(),
aspectRatio = height / width;
if(!$this.attr('id')){
var videoID = 'fitvid' + count;
$this.attr('id', videoID);
}
$this.wrap('<div class="fluid-width-video-wrapper"></div>').parent('.fluid-width-video-wrapper').css('padding-top', (aspectRatio * 100)+'%');
$this.removeAttr('height').removeAttr('width');
});
});
};
// Works with either jQuery or Zepto
})( window.jQuery || window.Zepto );
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
+1
View File
@@ -0,0 +1 @@
(function(e){var t=e(window);var n=t.height();t.resize(function(){n=t.height()});e.fn.parallax=function(r,i,s){function l(){var s=t.scrollTop();o.each(function(){var t=e(this);var f=t.offset().top;var l=u(t);if(f+l<s||f>s+n){return}o.css("backgroundPosition",r+" "+Math.round((a-s)*i)+"px")})}var o=e(this);var u;var a;var f=0;o.each(function(){a=o.offset().top});if(s){u=function(e){return e.outerHeight(true)}}else{u=function(e){return e.height()}}if(arguments.length<1||r===null)r="50%";if(arguments.length<2||i===null)i=.1;if(arguments.length<3||s===null)s=true;t.bind("scroll",l).resize(l);l()}})(jQuery)
+218
View File
@@ -0,0 +1,218 @@
// Sticky Plugin v1.0.2 for jQuery
// =============
// Author: Anthony Garand
// Improvements by German M. Bravo (Kronuz) and Ruud Kamphuis (ruudk)
// Improvements by Leonardo C. Daronco (daronco)
// Created: 2/14/2011
// Date: 16/04/2015
// Website: http://labs.anthonygarand.com/sticky
// Description: Makes an element on the page stick on the screen as you scroll
// It will only set the 'top' and 'position' of your element, you
// might need to adjust the width in some cases.
(function($) {
var slice = Array.prototype.slice; // save ref to original slice()
var splice = Array.prototype.splice; // save ref to original slice()
var defaults = {
topSpacing: 0,
bottomSpacing: 0,
className: 'is-sticky',
wrapperClassName: 'sticky-wrapper',
center: false,
getWidthFrom: '',
widthFromWrapper: true, // works only when .getWidthFrom is empty
responsiveWidth: false
},
$window = $(window),
$document = $(document),
sticked = [],
windowHeight = $window.height(),
scroller = function() {
var scrollTop = $window.scrollTop(),
documentHeight = $document.height(),
dwh = documentHeight - windowHeight,
extra = (scrollTop > dwh) ? dwh - scrollTop : 0;
for (var i = 0; i < sticked.length; i++) {
var s = sticked[i],
elementTop = s.stickyWrapper.offset().top,
etse = elementTop - s.topSpacing - extra;
if (scrollTop <= etse) {
if (s.currentTop !== null) {
s.stickyElement
.css({
'width': '',
'position': '',
'top': ''
});
s.stickyElement.parent().removeClass(s.className);
s.stickyElement.trigger('sticky-end', [s]);
s.currentTop = null;
}
}
else {
var newTop = documentHeight - s.stickyElement.outerHeight()
- s.topSpacing - s.bottomSpacing - scrollTop - extra;
if (newTop < 0) {
newTop = newTop + s.topSpacing;
} else {
newTop = s.topSpacing;
}
if (s.currentTop != newTop) {
var newWidth;
if ( s.getWidthFrom ) {
newWidth = $(s.getWidthFrom).width() || null;
}
else if(s.widthFromWrapper) {
newWidth = s.stickyWrapper.width();
}
if ( newWidth == null ) {
newWidth = s.stickyElement.width();
}
s.stickyElement
.css('width', newWidth)
.css('position', 'fixed')
.css('top', newTop);
s.stickyElement.parent().addClass(s.className);
if (s.currentTop === null) {
s.stickyElement.trigger('sticky-start', [s]);
} else {
// sticky is started but it have to be repositioned
s.stickyElement.trigger('sticky-update', [s]);
}
if (s.currentTop === s.topSpacing && s.currentTop > newTop || s.currentTop === null && newTop < s.topSpacing) {
// just reached bottom || just started to stick but bottom is already reached
s.stickyElement.trigger('sticky-bottom-reached', [s]);
} else if(s.currentTop !== null && newTop === s.topSpacing && s.currentTop < newTop) {
// sticky is started && sticked at topSpacing && overflowing from top just finished
s.stickyElement.trigger('sticky-bottom-unreached', [s]);
}
s.currentTop = newTop;
}
}
}
},
resizer = function() {
windowHeight = $window.height();
for (var i = 0; i < sticked.length; i++) {
var s = sticked[i];
var newWidth = null;
if ( s.getWidthFrom ) {
if ( s.responsiveWidth === true ) {
newWidth = $(s.getWidthFrom).width();
}
}
else if(s.widthFromWrapper) {
newWidth = s.stickyWrapper.width();
}
if ( newWidth != null ) {
s.stickyElement.css('width', newWidth);
}
}
},
methods = {
init: function(options) {
var o = $.extend({}, defaults, options);
return this.each(function() {
var stickyElement = $(this);
var stickyId = stickyElement.attr('id');
var stickyHeight = stickyElement.outerHeight();
var wrapperId = stickyId ? stickyId + '-' + defaults.wrapperClassName : defaults.wrapperClassName
var wrapper = $('<div></div>')
.attr('id', wrapperId)
.addClass(o.wrapperClassName);
stickyElement.wrapAll(wrapper);
var stickyWrapper = stickyElement.parent();
if (o.center) {
stickyWrapper.css({width:stickyElement.outerWidth(),marginLeft:"auto",marginRight:"auto"});
}
if (stickyElement.css("float") == "right") {
stickyElement.css({"float":"none"}).parent().css({"float":"right"});
}
stickyWrapper.css('height', stickyHeight);
o.stickyElement = stickyElement;
o.stickyWrapper = stickyWrapper;
o.currentTop = null;
sticked.push(o);
});
},
update: scroller,
unstick: function(options) {
return this.each(function() {
var that = this;
var unstickyElement = $(that);
var removeIdx = -1;
var i = sticked.length;
while ( i-- > 0 )
{
if (sticked[i].stickyElement.get(0) === that)
{
splice.call(sticked,i,1);
removeIdx = i;
}
}
if(removeIdx != -1)
{
unstickyElement.unwrap();
unstickyElement
.css({
'width': '',
'position': '',
'top': '',
'float': ''
})
;
}
});
}
};
// should be more efficient than using $window.scroll(scroller) and $window.resize(resizer):
if (window.addEventListener) {
window.addEventListener('scroll', scroller, false);
window.addEventListener('resize', resizer, false);
} else if (window.attachEvent) {
window.attachEvent('onscroll', scroller);
window.attachEvent('onresize', resizer);
}
$.fn.sticky = function(method) {
if (methods[method]) {
return methods[method].apply(this, slice.call(arguments, 1));
} else if (typeof method === 'object' || !method ) {
return methods.init.apply( this, arguments );
} else {
$.error('Method ' + method + ' does not exist on jQuery.sticky');
}
};
$.fn.unstick = function(method) {
if (methods[method]) {
return methods[method].apply(this, slice.call(arguments, 1));
} else if (typeof method === 'object' || !method ) {
return methods.unstick.apply( this, arguments );
} else {
$.error('Method ' + method + ' does not exist on jQuery.sticky');
}
};
$(function() {
setTimeout(scroller, 0);
});
})(jQuery);
+312
View File
@@ -0,0 +1,312 @@
// jquery.tweet.js - See http://tweet.seaofclouds.com/ or https://github.com/seaofclouds/tweet for more info
// Copyright (c) 2008-2012 Todd Matthews & Steve Purcell
// Modified by Stan Scates for https://github.com/StanScates/Tweet.js-Mod
(function (factory) {
if (typeof define === 'function' && define.amd)
define(['jquery'], factory); // AMD support for RequireJS etc.
else
factory(jQuery);
}(function ($) {
$.fn.tweet = function(o){
var s = $.extend({
modpath: "php/twitter/cws_tweet.php", // [string] relative URL to Tweet.js mod (see https://github.com/StanScates/Tweet.js-Mod)
username: null, // [string or array] required unless using the 'query' option; one or more twitter screen names (use 'list' option for multiple names, where possible)
list_id: null, // [integer] ID of list to fetch when using list functionality
list: null, // [string] optional slug of list belonging to username
favorites: false, // [boolean] display the user's favorites instead of his tweets
query: null, // [string] optional search query (see also: http://search.twitter.com/operators)
avatar_size: null, // [integer] height and width of avatar if displayed (48px max)
count: 3, // [integer] how many tweets to display?
fetch: null, // [integer] how many tweets to fetch via the API (set this higher than 'count' if using the 'filter' option)
page: 1, // [integer] which page of results to fetch (if count != fetch, you'll get unexpected results)
retweets: true, // [boolean] whether to fetch (official) retweets (not supported in all display modes)
intro_text: null, // [string] do you want text BEFORE your your tweets?
outro_text: null, // [string] do you want text AFTER your tweets?
join_text: null, // [string] optional text in between date and tweet, try setting to "auto"
auto_join_text_default: "i said,", // [string] auto text for non verb: "i said" bullocks
auto_join_text_ed: "i", // [string] auto text for past tense: "i" surfed
auto_join_text_ing: "i am", // [string] auto tense for present tense: "i was" surfing
auto_join_text_reply: "i replied to", // [string] auto tense for replies: "i replied to" @someone "with"
auto_join_text_url: "i was looking at", // [string] auto tense for urls: "i was looking at" http:...
loading_text: null, // [string] optional loading text, displayed while tweets load
refresh_interval: null , // [integer] optional number of seconds after which to reload tweets
twitter_url: "twitter.com", // [string] custom twitter url, if any (apigee, etc.)
twitter_api_url: "api.twitter.com", // [string] custom twitter api url, if any (apigee, etc.)
twitter_search_url: "api.twitter.com", // [string] custom twitter search url, if any (apigee, etc.)
template: "{avatar}{time}{join}{text}", // [string or function] template used to construct each tweet <li> - see code for available vars
comparator: function(tweet1, tweet2) { // [function] comparator used to sort tweets (see Array.sort)
return tweet2["tweet_time"] - tweet1["tweet_time"];
},
filter: function(tweet) { // [function] whether or not to include a particular tweet (be sure to also set 'fetch')
return true;
}
// You can attach callbacks to the following events using jQuery's standard .bind() mechanism:
// "loaded" -- triggered when tweets have been fetched and rendered
}, o);
// See http://daringfireball.net/2010/07/improved_regex_for_matching_urls
var url_regexp = /\b((?:[a-z][\w-]+:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]))/gi;
// Expand values inside simple string templates with {placeholders}
function t(template, info) {
if (typeof template === "string") {
var result = template;
for(var key in info) {
var val = info[key];
result = result.replace(new RegExp('{'+key+'}','g'), val === null ? '' : val);
}
return result;
} else return template(info);
}
// Export the t function for use when passing a function as the 'template' option
$.extend({tweet: {t: t}});
function replacer (regex, replacement) {
return function() {
var returning = [];
this.each(function() {
returning.push(this.replace(regex, replacement));
});
return $(returning);
};
}
function escapeHTML(s) {
return s.replace(/</g,"&lt;").replace(/>/g,"^&gt;");
}
$.fn.extend({
linkUser: replacer(/(^|[\W])@(\w+)/gi, "$1<span class=\"at\">@</span><a href=\"http://"+s.twitter_url+"/$2\">$2</a>"),
// Support various latin1 (\u00**) and arabic (\u06**) alphanumeric chars
linkHash: replacer(/(?:^| )[\#]+([\w\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u00ff\u0600-\u06ff]+)/gi,
' <a href="https://twitter.com/search?q=%23$1'+((s.username && s.username.length == 1 && !s.list) ? '&from='+s.username.join("%2BOR%2B") : '')+'" class="tweet_hashtag">#$1</a>'),
makeHeart: replacer(/(&lt;)+[3]/gi, "<tt class='heart'>&#x2665;</tt>")
});
function linkURLs(text, entities) {
return text.replace(url_regexp, function(match) {
var url = (/^[a-z]+:/i).test(match) ? match : "http://"+match;
var text = match;
for(var i = 0; i < entities.length; ++i) {
var entity = entities[i];
if (entity.url == url && entity.expanded_url) {
url = entity.expanded_url;
text = entity.display_url;
break;
}
}
return "<a href=\""+escapeHTML(url)+"\">"+escapeHTML(text)+"</a>";
});
}
function parse_date(date_str) {
// The non-search twitter APIs return inconsistently-formatted dates, which Date.parse
// cannot handle in IE. We therefore perform the following transformation:
// "Wed Apr 29 08:53:31 +0000 2009" => "Wed, Apr 29 2009 08:53:31 +0000"
return Date.parse(date_str.replace(/^([a-z]{3})( [a-z]{3} \d\d?)(.*)( \d{4})$/i, '$1,$2$4$3'));
}
function relative_time(date) {
var relative_to = (arguments.length > 1) ? arguments[1] : new Date();
var delta = parseInt((relative_to.getTime() - date) / 1000, 10);
var r = '';
if (delta < 1) {
r = 'just now';
} else if (delta < 60) {
r = delta + ' seconds ago';
} else if(delta < 120) {
r = 'about a minute ago';
} else if(delta < (45*60)) {
r = 'about ' + (parseInt(delta / 60, 10)).toString() + ' minutes ago';
} else if(delta < (2*60*60)) {
r = 'about an hour ago';
} else if(delta < (24*60*60)) {
r = 'about ' + (parseInt(delta / 3600, 10)).toString() + ' hours ago';
} else if(delta < (48*60*60)) {
r = 'about a day ago';
} else {
r = 'about ' + (parseInt(delta / 86400, 10)).toString() + ' days ago';
}
return r;
}
function build_auto_join_text(text) {
if (text.match(/^(@([A-Za-z0-9-_]+)) .*/i)) {
return s.auto_join_text_reply;
} else if (text.match(url_regexp)) {
return s.auto_join_text_url;
} else if (text.match(/^((\w+ed)|just) .*/im)) {
return s.auto_join_text_ed;
} else if (text.match(/^(\w*ing) .*/i)) {
return s.auto_join_text_ing;
} else {
return s.auto_join_text_default;
}
}
function build_api_request() {
var modpath = s.modpath,
count = (s.fetch === null) ? s.count : s.fetch,
defaults = {
include_entities: 1
};
if (s.list) {
return {
host: s.twitter_api_url,
url: "/1.1/lists/statuses.json",
parameters: $.extend({}, defaults, {
list_id: s.list_id,
slug: s.list,
owner_screen_name: s.username,
page: s.page,
count: count,
include_rts: (s.retweets ? 1 : 0)
})
};
} else if (s.favorites) {
return {
host: s.twitter_api_url,
url: "/1.1/favorites/list.json",
parameters: $.extend({}, defaults, {
list_id: s.list_id,
screen_name: s.username,
page: s.page,
count: count
})
};
} else if (s.query === null && s.username.length === 1) {
return {
host: s.twitter_api_url,
url: "/1.1/statuses/user_timeline.json",
parameters: $.extend({}, defaults, {
screen_name: s.username,
page: s.page,
count: count,
include_rts: (s.retweets ? 1 : 0)
})
};
} else {
var query = (s.query || 'from:'+s.username.join(' OR from:'));
return {
host: s.twitter_search_url,
url: "/1.1/search/tweets.json",
parameters: $.extend({}, defaults, {
q: query,
count: count
})
};
}
}
function extract_avatar_url(item, secure) {
if (secure) {
return ('user' in item) ?
item.user.profile_image_url_https :
extract_avatar_url(item, false).
replace(/^http:\/\/[a-z0-9]{1,3}\.twimg\.com\//, "https://s3.amazonaws.com/twitter_production/");
} else {
return item.profile_image_url || item.user.profile_image_url;
}
}
// Convert twitter API objects into data available for
// constructing each tweet <li> using a template
function extract_template_data(item) {
var o = {};
o.item = item;
o.source = item.source;
// The actual user name is not returned by all Twitter APIs, so please do not file an issue if it is empty.
o.name = item.from_user_name || item.user.name;
o.screen_name = item.from_user || item.user.screen_name;
o.avatar_size = s.avatar_size;
o.avatar_url = extract_avatar_url(item, (document.location.protocol === 'https:'));
o.retweet = typeof(item.retweeted_status) != 'undefined';
o.tweet_time = parse_date(item.created_at);
o.join_text = s.join_text == "auto" ? build_auto_join_text(item.text) : s.join_text;
o.tweet_id = item.id_str;
o.twitter_base = "http://"+s.twitter_url+"/";
o.user_url = o.twitter_base+o.screen_name;
o.tweet_url = o.user_url+"/status/"+o.tweet_id;
o.reply_url = o.twitter_base+"intent/tweet?in_reply_to="+o.tweet_id;
o.retweet_url = o.twitter_base+"intent/retweet?tweet_id="+o.tweet_id;
o.favorite_url = o.twitter_base+"intent/favorite?tweet_id="+o.tweet_id;
o.retweeted_screen_name = o.retweet && item.retweeted_status.user.screen_name;
o.tweet_relative_time = relative_time(o.tweet_time);
o.entities = item.entities ? (item.entities.urls || []).concat(item.entities.media || []) : [];
o.tweet_raw_text = o.retweet ? ('RT @'+o.retweeted_screen_name+' '+item.retweeted_status.text) : item.text; // avoid '...' in long retweets
o.tweet_text = $([linkURLs(o.tweet_raw_text, o.entities)]).linkUser().linkHash()[0];
o.tweet_text_fancy = $([o.tweet_text]).makeHeart()[0];
// Default spans, and pre-formatted blocks for common layouts
o.user = t('<a class="tweet_user" href="{user_url}">{screen_name}</a>', o);
o.join = s.join_text ? t(' <span class="tweet_join">{join_text}</span> ', o) : ' ';
o.avatar = o.avatar_size ?
t('<a class="tweet_avatar" href="{user_url}"><img src="{avatar_url}" height="{avatar_size}" width="{avatar_size}" alt="{screen_name}\'s avatar" title="{screen_name}\'s avatar" border="0"/></a>', o) : '';
o.time = t('<span class="tweet_time"><a href="{tweet_url}" title="view tweet on twitter">{tweet_relative_time}</a></span>', o);
o.text = t('<span class="tweet_text">{tweet_text_fancy}</span>', o);
o.reply_action = t('<a class="tweet_action tweet_reply" href="{reply_url}">reply</a>', o);
o.retweet_action = t('<a class="tweet_action tweet_retweet" href="{retweet_url}">retweet</a>', o);
o.favorite_action = t('<a class="tweet_action tweet_favorite" href="{favorite_url}">favorite</a>', o);
return o;
}
return this.each(function(i, widget){
var list = $('<ul class="tweet_list">');
var intro = '<p class="tweet_intro">'+s.intro_text+'</p>';
var outro = '<p class="tweet_outro">'+s.outro_text+'</p>';
var loading = $('<p class="loading">'+s.loading_text+'</p>');
if(s.username && typeof(s.username) == "string"){
s.username = [s.username];
}
$(widget).unbind("tweet:load").bind("tweet:load", function(){
if (s.loading_text) $(widget).empty().append(loading);
$.ajax({
dataType: "json",
type: "post",
async: false,
url: s.modpath || "/twitter/",
data: { request: build_api_request() },
success: function(data, status) {
if(data.message) {
console.log(data.message);
}
var response = data;
$(widget).empty().append(list);
if (s.intro_text) list.before(intro);
list.empty();
/* if(response.statuses !== undefined) {
resp = response.statuses;
} else if(response.results !== undefined) {
resp = response.results;
} else {
resp = response;
}*/
resp = response;
var tweets = $.map(resp, extract_template_data);
tweets = $.grep(tweets, s.filter).sort(s.comparator).slice(0, s.count);
list.append($.map(tweets, function(o) { return "<li>" + t(s.template, o) + "</li>"; }).join('')).
children('li:first').addClass('tweet_first').end().
children('li:odd').addClass('tweet_even').end().
children('li:even').addClass('tweet_odd');
if (s.outro_text) list.after(outro);
$(widget).trigger("loaded").trigger((tweets ? "empty" : "full"));
if (s.refresh_interval) {
window.setTimeout(function() { $(widget).trigger("tweet:load"); }, 1000 * s.refresh_interval);
}
}
});
}).trigger("tweet:load");
});
};
}));
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+47
View 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.orignalItems=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.$owlItems=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.orignalItems=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.orignalItems)&&(this.options.items=this.orignalItems);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.$owlItems.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.$owlItems.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.$owlItems[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.$owlItems[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.$owlItems[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.$owlItems[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.$owlItems[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.$owlItems.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.$owlItems[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.$owlItems.eq(a.currentItem),d=a.$owlItems.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,owlItems:this.$owlItems,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);
+10
View File
@@ -0,0 +1,10 @@
/*!
* Retina.js v1.3.0
*
* Copyright 2014 Imulus, LLC
* Released under the MIT license
*
* Retina.js is an open source script that makes it easy to serve
* high-resolution images to devices with retina displays.
*/
!function(){function a(){}function b(a){return f.retinaImageSuffix+a}function c(a,c){if(this.path=a||"","undefined"!=typeof c&&null!==c)this.at_2x_path=c,this.perform_check=!1;else{if(void 0!==document.createElement){var d=document.createElement("a");d.href=this.path,d.pathname=d.pathname.replace(g,b),this.at_2x_path=d.href}else{var e=this.path.split("?");e[0]=e[0].replace(g,b),this.at_2x_path=e.join("?")}this.perform_check=!0}}function d(a){this.el=a,this.path=new c(this.el.getAttribute("src"),this.el.getAttribute("data-at2x"));var b=this;this.path.check_2x_variant(function(a){a&&b.swap()})}var e="undefined"==typeof exports?window:exports,f={retinaImageSuffix:"@2x",check_mime_type:!0,force_original_dimensions:!0};e.Retina=a,a.configure=function(a){null===a&&(a={});for(var b in a)a.hasOwnProperty(b)&&(f[b]=a[b])},a.init=function(a){null===a&&(a=e);var b=a.onload||function(){};a.onload=function(){var a,c,e=document.getElementsByTagName("img"),f=[];for(a=0;a<e.length;a+=1)c=e[a],c.getAttributeNode("data-no-retina")||f.push(new d(c));b()}},a.isRetina=function(){var a="(-webkit-min-device-pixel-ratio: 1.5), (min--moz-device-pixel-ratio: 1.5), (-o-min-device-pixel-ratio: 3/2), (min-resolution: 1.5dppx)";return e.devicePixelRatio>1?!0:e.matchMedia&&e.matchMedia(a).matches?!0:!1};var g=/\.\w+$/;e.RetinaImagePath=c,c.confirmed_paths=[],c.prototype.is_external=function(){return!(!this.path.match(/^https?\:/i)||this.path.match("//"+document.domain))},c.prototype.check_2x_variant=function(a){var b,d=this;return this.is_external()?a(!1):this.perform_check||"undefined"==typeof this.at_2x_path||null===this.at_2x_path?this.at_2x_path in c.confirmed_paths?a(!0):(b=new XMLHttpRequest,b.open("HEAD",this.at_2x_path),b.onreadystatechange=function(){if(4!==b.readyState)return a(!1);if(b.status>=200&&b.status<=399){if(f.check_mime_type){var e=b.getResponseHeader("Content-Type");if(null===e||!e.match(/^image/i))return a(!1)}return c.confirmed_paths.push(d.at_2x_path),a(!0)}return a(!1)},b.send(),void 0):a(!0)},e.RetinaImage=d,d.prototype.swap=function(a){function b(){c.el.complete?(f.force_original_dimensions&&(c.el.setAttribute("width",c.el.offsetWidth),c.el.setAttribute("height",c.el.offsetHeight)),c.el.setAttribute("src",a)):setTimeout(b,5)}"undefined"==typeof a&&(a=this.path.at_2x_path);var c=this;b()},a.isRetina()&&a.init(e)}();
+934
View File
@@ -0,0 +1,934 @@
"use strict"; // start of use strict
$(document).ready(function () {
$(window).trigger("resize");
backgroundImg_init();
top_panel_search_init();
sticky_set();
init_classic_menu();
heightFull_init();
accordion_init();
toggle_init();
loginshow();
checkout_open_field();
counter_init();
filter_init();
lightbox_init();
masonry_init();
scroll_top_init();
twitter_init();
pageSliders_init();
infobox_init();
googleMap_init();
gridList_init();
shop_price_slider();
calendar_init();
widgetMenu_init();
revolution_slider();
YTVideo_init();
contact_form_init();
cws_touch_events_fix ();
});
$(window).load(function(){
init_classic_menu_resize();
progress_bar_loader();
pageSliders_init();
});
$(window).resize(function(){
init_classic_menu_resize();
heightFull_init();
pageSliders_init();
masonry_init();
sticky_set();
});
$(window).scroll(function(){
progress_bar_loader ();
});
$(window).on('load', function() {
$("body").imagesLoaded(function(){
$(".preloader-wave").fadeOut();
$("#preloader").delay(200).fadeOut("slow").remove();
});
});
function cws_touch_events_fix (){
if ( is_mobile_device() ){
jQuery( ".container" ).on( "mouseenter", ".hover-effect, .product .pic", function (e){
e.preventDefault();
jQuery( this ).trigger( "hover" );
});
jQuery( ".main-nav" ).on( "hover", ".mobile_nav .button_open, .mobile_nav li > a", function ( e ){
e.preventDefault();
jQuery( this ).trigger( "click" );
});
}
}
// Background image
function backgroundImg_init(){
var pageSection = $(".home-section, .page-section, .small-section, .blog-section, .small-section-2, .breadcrumb-section");
pageSection.each(function(indx){
if ($(this).attr("data-background")){
$(this).css("background-image", "url(" + $(this).data("background") + ")");
}
});
}
// Function for block height 100%
function height_line(height_object, height_donor){
height_object.height(height_donor.height());
height_object.css({
"line-height": height_donor.height() + "px"
});
}
// Top panel search
function top_panel_search_init(){
$(".main-nav .search-menu").on('click', function(){
$(this).parents('.main-nav').find('.search-menu-cont').fadeToggle(200);
$(this).parents('.main-nav').addClass('search-on');
$(this).parents('.main-nav').find('.search-menu-cont .search-field').focus();
})
$('.main-nav .search-menu-cont .search-back-button').on('click', function(){
$(this).parents('.main-nav').find('.search-menu-cont').fadeToggle(200);
$(this).parents('.main-nav').removeClass('search-on');
})
}
// Classic menu resize
var mobile_nav = $(".mobile-nav");
var desktop_nav = $(".desktop-nav");
function init_classic_menu_resize(){
$(".mobile-on .desktop-nav > ul").css("max-height", $(window).height() - $(".main-nav").height() - 20 + "px");
if ($(window).width() <= 1024) {
$(".main-nav").addClass("mobile-on");
} else
if ($(window).width() > 1024) {
$(".main-nav").removeClass("mobile-on");
desktop_nav.show();
}
}
// Sticky function
function sticky_set () {
if(is_mobile_device ()) {
$(".js-stick").unstick();
$(".main-nav").removeClass('small-height');
} else if (!($('.sticky-wrapper').length)) {
$(".js-stick").sticky({
topSpacing: 0
});
}
}
// Classic menu
function init_classic_menu(){
// Navbar sticky
height_line($(".inner-nav > ul > li > a"), $(".main-nav"));
height_line(mobile_nav, $(".main-nav"));
mobile_nav.css({
"width": $(".main-nav").height() + "px"
});
// Transpaner menu
if ($(".main-nav").hasClass("transparent")){
$(".main-nav").addClass("js-transparent");
}
$(window).scroll(function(){
if ($('.sticky-header').hasClass('top-fixed')) {
if ($(window).scrollTop() > 10) {
$(".js-transparent").removeClass("transparent");
$(".main-nav, .nav-logo-wrap .logo, .mobile-nav, .search-back-button").addClass("small-height");
}
else {
$(".js-transparent").addClass("transparent");
$(".main-nav, .nav-logo-wrap .logo, .mobile-nav, .search-back-button").removeClass("small-height");
}
};
});
// Mobile menu toggle
mobile_nav.on('click', function(){
if (desktop_nav.hasClass("js-opened")) {
desktop_nav.slideUp("slow", "easeOutExpo").removeClass("js-opened");
$(this).removeClass("active");
} else {
desktop_nav.slideDown("slow", "easeOutQuart").addClass("js-opened");
$(this).addClass("active");
}
});
desktop_nav.find("a:not(.nav-submenu)").on('click', function(){
if (mobile_nav.hasClass("active")) {
desktop_nav.slideUp("slow", "easeOutExpo").removeClass("js-opened");
mobile_nav.removeClass("active");
}
});
var navSubmenu = $(".nav-submenu");
var navThisLi;
navSubmenu.on('click', function(){
if ($(".main-nav").hasClass("mobile-on")) {
navThisLi = $(this).parent("li:first");
if (navThisLi.hasClass("js-opened")) {
navThisLi.find(".submenu:first").slideUp(function(){
navThisLi.removeClass("js-opened");
});
} else {
navThisLi.addClass("js-opened");
navThisLi.find(".submenu:first").slideDown();
}
return false;
}
});
navThisLi = navSubmenu.parent("li");
navThisLi.hover(function(){
if (!($(".main-nav").hasClass("mobile-on"))) {
$(this).find(".submenu:first").stop(true, true).fadeIn("fast");
}
}, function(){
if (!($(".main-nav").hasClass("mobile-on"))) {
$(this).find(".submenu:first").stop(true, true).delay(100).fadeOut("fast");
}
});
}
// Mobile device detect
function is_mobile_device () {
if ( ( $(window).width()<767) || (navigator.userAgent.match(/(Android|iPhone|iPod|iPad)/) ) ) {
return true;
} else {
return false;
}
}
// Height full
function heightFull_init(){
$(".height-full").height($(window).height());
}
// Accordion
function accordion_init(){
if ($(".accordion > dt > a").hasClass("active")) {
$(this).parent().next().css({display: "block"}).slideDown("easeOutExpo");
};
$(".accordion > dt > a").on('click', function(){
var current = $(this).parent().next("dd");
$(this).parents(".accordion").find("dt > a").removeClass("active");
$(this).addClass("active");
$(this).parents(".accordion").find("dd").slideUp("easeInExpo");
$(this).parent().next().slideDown("easeOutExpo");
return false;
});
};
// Toggle
function toggle_init(){
if ($(".toggle > dt > a").hasClass("active")) {
$(this).parent().next().css({display: "block"}).slideDown("easeOutExpo");
};
$(".toggle > dt > a").on('click', function(){
if ($(this).hasClass("active")) {
$(this).parent().next().slideUp("easeOutExpo");
$(this).removeClass("active");
}
else {
var current = $(this).parent().next("dd");
$(this).addClass("active");
$(this).parent().next().slideDown("easeOutExpo");
}
return false;
});
};
// Login show
function loginshow (){
$(".showlogin").on('click', function(){
$("form.login").slideToggle("easeOutExpo");
})
$(".showcode").on('click', function(){
$("form.code").slideToggle("easeOutExpo");
})
}
// Checkout open field
function checkout_open_field() {
$(".payment_method_cheque input, .payment_method_paypal input, .payment_method_bank input").on("click", function(){
var x = $(this).parent().children(".payment_box");
if ( $(x).hasClass("active") ) {
return false;
} else {
$('.payment_method_cheque .payment_box, .payment_method_paypal .payment_box, .payment_method_bank .payment_box').removeClass("active").slideUp();
$(x).addClass("active").slideDown(300);
}
})
}
// Counter
function counter_init(){
$(".count-number").appear(function(){
var count = $(this);
count.countTo({
from: 0,
to: count.html(),
speed: 1300,
refreshInterval: 60,
});
});
}
// Filter
function filter_init(){
var fselector = 0;
var filter_mode;
if ($("#filter-grid").hasClass("masonry")){
filter_mode = "masonry";
} else{
filter_mode = "fitRows"
}
$("#filter-grid").imagesLoaded(function(){
$("#filter-grid").isotope({
itemSelector: '.all',
layoutMode: filter_mode,
filter: fselector
});
});
$(".filter").on('click', function(){
$(".filter").removeClass("active");
$(this).addClass("active");
fselector = $(this).attr('data-filter');
$("#filter-grid").isotope({
itemSelector: '.all',
layoutMode: filter_mode,
filter: fselector
});
return false;
});
}
// Lightbox
function lightbox_init(){
$(".lightbox").magnificPopup({
gallery: {
enabled: true
}
});
$(".lightbox-single").magnificPopup({
type: 'image'
});
}
// Masonry
function masonry_init(){
$(".masonry").imagesLoaded(function(){
$(".masonry").masonry();
});
}
// Progress bar
function progress_bar_loader(){
$('.skill-bar-progress').each(function(){
var el = this;
if (is_visible(el)){
if ($(el).attr("processed")!="true"){
$(el).css("width","0%");
$(el).attr("processed","true");
var val = parseInt($(el).attr("data-value"), 10);
var fill = 0;
var speed = val/100;
var timer = setInterval(function (){
if (fill<val){
fill += 1;
$(el).css("width",String(fill)+"%");
var ind = $(el).parent().parent().find(".skill-bar-perc");
$(ind).text(fill+"%");
}
},(10/speed));
}
}
});
}
// Visible function
function is_visible (el){
var w_h = $(window).height();
var dif = $(el).offset().top - $(window).scrollTop();
if ((dif > 0) && (dif<w_h)){
return true;
} else {
return false;
}
}
// Scroll top function
function scroll_top_init(){
$('#scroll-top').on( 'click', function() {
$('html, body').animate({scrollTop: 0});
return false;
});
if( $(window).scrollTop() > 500 ) {
$('#scroll-top').fadeIn();
} else {
$('#scroll-top').fadeOut();
}
$(window).scroll(function(){
if( $(window).scrollTop() > 500 ) {
$('#scroll-top').fadeIn();
} else {
$('#scroll-top').fadeOut();
}
})
}
// Wrap this
$.fn.WrapThis = function(arg1, arg2) { /*=Takes 2 arguments, arg1 is how many elements to wrap together, arg2 is the element to wrap*/
var wrapClass = "column"; //=Set class name for wrapping element
var itemLength = $(this).find(arg2).length; //=Get the total length of elements
var remainder = itemLength%arg1; //=Calculate the remainder for the last array
var lastArray = itemLength - remainder; //=Calculate where the last array should begin
var arr = [];
if($.isNumeric(arg1)) {
$(this).find(arg2).each(function(idx, item) {
var newNum = idx + 1;
if(newNum%arg1 !== 0 && newNum <= lastArray){
arr.push(item);
}
else if(newNum%arg1 == 0 && newNum <= lastArray) {
arr.push(item);
var column = $(this).pushStack(arr);
column.wrapAll('<div class="' + wrapClass + '"/>'); //=If the array reaches arg1 setting then wrap the array in a column
arr = [];
}
else if(newNum > lastArray && newNum !== itemLength){ //=If newNum is greater than the lastArray setting then start new array of elements
arr.push(item);
}
else { //=If newNum is greater than the length of all the elements then wrap the remainder of elements in a column
arr.push(item);
var column = $(this).pushStack(arr);
column.wrapAll('<div class="' + wrapClass + '"/>');
arr = []
}
});
}
}
// Twitter carousel
function twitter_init(){
$('.twitter-carousel').tweet({
username: 'Creative_WS',
count: 8,
loading_text: 'loading twitter feed...',
template: "<i class='fa fa-twitter twitt'></i><p><a class='link-color' href='{user_url}'>@{screen_name}</a>{join}{text}<br>{time}</p>"
});
$('.twitter-carousel .tweet_list').WrapThis(2, 'li');
$('.twitter-carousel .tweet_list').addClass("widget-slider-twitt").addClass("nav-alt-1").addClass("owl-carousel");
$('.twitter-footer').tweet({
username: 'Creative_WS',
count: 2,
loading_text: 'loading twitter feed...',
template: "<i class='fa fa-twitter twitt'></i><p><a class='link-color' href='{user_url}'>@{screen_name}</a>{join}{text}<br>{time}</p>"
});
$('.twitter-carousel .tweet_list').WrapThis(2, 'li');
}
// Page sliders
function pageSliders_init(){
$(".slider-1").owlCarousel({
items: 3,
itemsDesktop: [1199, 2],
itemsTablet: [998, 2],
itemsTabletSmall: [768, 1],
itemsMobile: [480, 1],
stopOnHover: true,
navigation: false,
navigationText: ["<i class='fa fa-angle-left'></i>", "<i class='fa fa-angle-right'></i>"]
});
$(".slider-2").owlCarousel({
singleItem: true,
navigation: true,
navigationText: ["<i class='fa fa-angle-left'></i>", "<i class='fa fa-angle-right'></i>"]
});
$(".slider-3").owlCarousel({
items: 4,
itemsDesktop: [1199, 3],
itemsTabletSmall: [768, 2],
itemsMobile: [480, 1],
navigation: false,
navigationText: ["<i class='fa fa-angle-left'></i>", "<i class='fa fa-angle-right'></i>"]
});
$(".slider-4").owlCarousel({
items: 5,
itemsDesktop: [1700, 5],
itemsDesktopSmall: [1199, 3],
itemsTabletSmall: [768, 2],
itemsMobile: [480, 1],
navigation: false,
navigationText: ["<i class='fa fa-angle-left'></i>", "<i class='fa fa-angle-right'></i>"]
});
$(".widget-slider-1").owlCarousel({
items: 3,
itemsDesktop: [1199, 3],
itemsTabletSmall: [768, 3],
itemsMobile: [480, 1],
navigation: true,
navigationText: ["<i class='flaticon-arrows-1'></i>", "<i class='flaticon-arrows-2'></i>"]
});
$(".widget-slider-2").owlCarousel({
singleItem: true,
navigation: true,
navigationText: ["<i class='flaticon-arrows-1'></i>", "<i class='flaticon-arrows-2'></i>"]
});
$(".widget-slider-twitt").owlCarousel({
singleItem: true,
navigation: true,
navigationText: ["<i class='flaticon-arrows-1'></i>", "<i class='flaticon-arrows-2'></i>"]
});
}
// Inobox function
function infobox_init(){
$(".info-boxes .close-button").on( 'click', function() {
$(this).parent().animate({'opacity' : '0'}, 300).slideUp(300);
});
}
// Google map function
function googleMap_init(){
var gmMapDiv = $("#map-canvas");
if (gmMapDiv.length) {
var gmCenterAddress = gmMapDiv.attr("data-address");
var gmMarkerAddress = gmMapDiv.attr("data-address");
gmMapDiv.gmap3({
action: "init",
marker: {
address: gmMarkerAddress,
options: {
icon: "images/map-marker.png"
}
},
map: {
options: {
zoom: 6,
zoomControl: true,
zoomControlOptions: {
style: google.maps.ZoomControlStyle.SMALL,
position: google.maps.ControlPosition.LEFT_TOP
},
mapTypeControl: false,
scaleControl: false,
scrollwheel: false,
streetViewControl: false,
draggable: true,
styles: [{
"featureType":"water",
"elementType":"geometry.fill",
"stylers":[{"color":"#d9d7cc"}]},
{"featureType":"transit",
"stylers":[{"color":"#575341"},
{"visibility":"off"}]},
{"featureType":"road.highway",
"elementType":"geometry.stroke",
"stylers":[{"visibility":"on"},
{"color":"#e6e5de"}]},
{"featureType":"road.highway",
"elementType":"geometry.fill",
"stylers":[{"color":"#cbc8b9"}]},
{"featureType":"road.local",
"elementType":"geometry.fill",
"stylers":[{"visibility":"on"},
{"color":"#cbc8b9"},{"weight":1.8}]},
{"featureType":"road.local",
"elementType":"geometry.stroke",
"stylers":[{"color":"#c0ccda"}]},
{"featureType":"poi",
"elementType":"geometry.fill",
"stylers":[{"visibility":"on"},
{"color":"#b0bfd1"}]},
{"featureType":"administrative",
"elementType":"geometry",
"stylers":[{"color":"#e6e5de"}]},
{"featureType":"road.arterial",
"elementType":"geometry.fill",
"stylers":[{"color":"#cbc8b9"}]},
{"featureType":"road.arterial",
"elementType":"geometry.fill",
"stylers":[{"color":"#cbc8b9"}]},
{"featureType":"landscape",
"elementType":"geometry.fill",
"stylers":[{"visibility":"on"},
{"color":"#f8f8f6"}]},
{"featureType":"road",
"elementType":"labels.text.fill",
"stylers":[{"color":"#575341"}]},
{"featureType":"administrative",
"elementType":"labels.text.fill",
"stylers":[{"visibility":"on"},
{"color":"#575341"}]},
{"featureType":"poi",
"elementType":"labels.icon",
"stylers":[{"visibility":"off"}]},
{"featureType":"poi",
"elementType":"labels",
"stylers":[{"visibility":"off"}]},
{"featureType":"road.arterial",
"elementType":"geometry.stroke",
"stylers":[{"color":"#f8f8f6"}]},
{"featureType":"road",
"elementType":"labels.icon",
"stylers":[{"visibility":"off"}]},
{"featureType":"poi",
"elementType":"geometry.fill",
"stylers":[{"color":"#d9d7cc"}]
}]
}
}
});
}
}
// Grid or List function
function gridList_init(){
$(".woocommerce .products").addClass("grid-view");
$("#list-grid>div").on("click", function () {
$(this).addClass("active").siblings().removeClass("active");
if ($(this).hasClass("grid-view")) {
if ($(".woocommerce .products").hasClass("grid-view")) {
return false;
} else {
$(".woocommerce .products").fadeOut(300,function() {
$(".woocommerce .products").addClass("grid-view").removeClass("list-view").fadeIn(300);
});
}
}
if ($(this).hasClass("list-view")){
if ($(".woocommerce .products").hasClass("list-view")) {
return false;
} else {
$(".woocommerce .products").fadeOut(300,function(){
$(".woocommerce .products").addClass("list-view").removeClass("grid-view").fadeIn(300);
});
}
}
});
}
// Price slider function
function shop_price_slider(){
var current_min_price
var current_max_price
window.shop_price_slider_params = {
'currency_symbol' : '£',
'currency_pos' : 'left',
}
// shop_price_slider_params is required to continue, ensure the object exists
if ( typeof shop_price_slider_params === 'undefined' ) {
return false;
}
// Get markup ready for slider
$( 'input#min_price, input#max_price' ).hide();
$( '.price_slider, .price_label' ).show();
// Price slider uses jquery ui
var min_price = $( '.price_slider_amount #min_price' ).data( 'min' ),
max_price = $( '.price_slider_amount #max_price' ).data( 'max' );
current_min_price = parseInt( min_price, 10 );
current_max_price = parseInt( max_price, 10 );
if ( shop_price_slider_params.min_price ) current_min_price = parseInt( shop_price_slider_params.min_price, 10 );
if ( shop_price_slider_params.max_price ) current_max_price = parseInt( shop_price_slider_params.max_price, 10 );
$( 'body' ).bind( 'price_slider_create price_slider_slide', function( event, min, max ) {
if ( shop_price_slider_params.currency_pos === 'left' ) {
$( '.price_slider_amount span.from' ).html( shop_price_slider_params.currency_symbol + min );
$( '.price_slider_amount span.to' ).html( shop_price_slider_params.currency_symbol + max );
} else if ( shop_price_slider_params.currency_pos === 'left_space' ) {
$( '.price_slider_amount span.from' ).html( shop_price_slider_params.currency_symbol + " " + min );
$( '.price_slider_amount span.to' ).html( shop_price_slider_params.currency_symbol + " " + max );
} else if ( shop_price_slider_params.currency_pos === 'right' ) {
$( '.price_slider_amount span.from' ).html( min + shop_price_slider_params.currency_symbol );
$( '.price_slider_amount span.to' ).html( max + shop_price_slider_params.currency_symbol );
} else if ( shop_price_slider_params.currency_pos === 'right_space' ) {
$( '.price_slider_amount span.from' ).html( min + " " + shop_price_slider_params.currency_symbol );
$( '.price_slider_amount span.to' ).html( max + " " + shop_price_slider_params.currency_symbol );
}
$( 'body' ).trigger( 'price_slider_updated', min, max );
});
$( '.price_slider' ).slider({
range: true,
animate: true,
min: min_price,
max: max_price,
values: [ current_min_price, current_max_price ],
create : function( event, ui ) {
$( '.price_slider_amount #min_price' ).val( current_min_price );
$( '.price_slider_amount #max_price' ).val( current_max_price );
$( 'body' ).trigger( 'price_slider_create', [ current_min_price, current_max_price ] );
},
slide: function( event, ui ) {
$( 'input#min_price' ).val( ui.values[0] );
$( 'input#max_price' ).val( ui.values[1] );
$( 'body' ).trigger( 'price_slider_slide', [ ui.values[0], ui.values[1] ] );
},
change: function( event, ui ) {
$( 'body' ).trigger( 'price_slider_change', [ ui.values[0], ui.values[1] ] );
},
});
};
// Calendar widget
function calendar_init(){
if ($("#calendar").length) {
$('#calendar').datepicker({
prevText: '<i class="fa fa-angle-left"></i>',
nextText: '<i class="fa fa-angle-right"></i>',
firstDay: 1,
dayNamesMin: [ "S", "M", "T", "W", "T", "F", "S" ]
});
}
}
// Menu widget
function widgetMenu_init(){
$('.widget-navigation li>ul').parent().addClass('has-child');
$('.widget-navigation li>a').on( 'click', function(e) {
e.stopPropagation();
})
$('.widget-navigation li>a').on( 'click', function(e) {
e.stopPropagation();
if( $(this).parent().children('ul').length ) {
$(this).parent().children('ul').slideToggle(500);
$(this).parent().toggleClass('active');
$(this).parent().children('ul').toggleClass('active');
}
});
}
// Revolution slider
function revolution_slider () {
$('.tp-banner-slider').on("revolution.slide.onloaded",function (e) {
$('.tp-banner-slider').css("opacity","1");
});
if ( jQuery('.tp-banner-slider').length ) {
jQuery('.tp-banner-slider').revolution({
responsiveLevels:[4096,992,768,480],
dottedOverlay:"custom",
delay:9000,
startwidth:1170,
startheight:800,
hideThumbs:10,
navigation: {
arrows:{enable:true}
},
fullWidth:"on",
fullScreen:"off",
forceFullWidth:"on",
hideThumbsOnMobile:"off",
hideNavDelayOnMobile:1500,
hideBulletsOnMobile:"off",
hideArrowsOnMobile:"off",
hideThumbsUnderResolution:0,
navigationType:"none"
});
}
}
// Youtube video player
function YTVideo_init(){
$(".blog-media.video, .widget-media-post").fitVids();
}
// Contact form function
function contact_form_init(){
if ($(".contact-form").length) {
/**/
/* contact form */
/**/
/* validate the contact form fields */
$(".contact-form").each(function(){
$(this).validate( /*feedback-form*/{
onkeyup: false,
onfocusout: false,
errorElement: 'p',
errorLabelContainer: $(this).parent().children(".alert-boxes.error-alert").children(".message"),
rules:
{
name:
{
required: true
},
email:
{
required: true,
email: true
},
message:
{
required: true
}
},
messages:
{
name:
{
required: 'Please enter your name',
},
email:
{
required: 'Please enter your email address',
email: 'Please enter a VALID email address'
},
message:
{
required: 'Please enter your message'
}
},
invalidHandler: function()
{
$(this).parent().children(".alert-boxes.error-alert").slideDown('fast');
$("#feedback-form-success").slideUp('fast');
},
submitHandler: function(form)
{
$(form).parent().children(".alert-boxes.error-alert").slideUp('fast');
var $form = $(form).ajaxSubmit();
submit_handler($form, $(form).parent().children(".email_server_responce") );
}
});
})
/* Ajax, Server response */
var submit_handler = function (form, wrapper){
var $wrapper = $(wrapper); //this class should be set in HTML code
$wrapper.css("display","block");
var data = {
action: "email_server_responce",
values: $(form).serialize()
};
//send data to server
$.post("php/contacts-process.php", data, function(s_response) {
s_response = $.parseJSON(s_response);
if(s_response.info == 'success'){
$wrapper.addClass("message message-success").append("<div class='info-boxes confirmation-message' id='feedback-form-success'><strong>Success!</strong><br><p>Your message was successfully delivered.</p></div>");
$wrapper.delay(5000).hide(500, function(){
$(this).removeClass("message message-success").text("").fadeIn(500);
$wrapper.css("display","none");
});
$(form)[0].reset();
} else {
$wrapper.addClass("message message-error").append("<div class='message_box error-box'><div class='message_box_header'>Error Box</div><p>Server fail! Please try again later!</p></div>");
$wrapper.delay(5000).hide(500, function(){
$(this).removeClass("message message-success").text("").fadeIn(500);
$wrapper.css("display","none");
});
}
});
return false;
}
}
}