Import legacy nurinda.co.id website

This commit is contained in:
dirga committed 2026-10-01 14:27:19 +07:00
1 parent 3f59bb9038
commit 6e21646ac4
13389 files changed
+3246690

No files matched your search

@@ -0,0 +1,252 @@
/**
* UpSolution Element: Counter
*/
! function( $ ) {
/**
* Counter Number part animations
* @param container
* @constructor
*/
var USCounterNumber = function( container ) {
this.$container = $( container );
this.initialString = this.$container.html() + '';
this.finalString = this.$container.data( 'final' ) + '';
this.format = this.getFormat( this.initialString, this.finalString );
if ( this.format.decMark ) {
var pattern = new RegExp( '[^0-9\/' + this.format.decMark + ']+', 'g' );
this.initial = parseFloat( this.initialString.replace( pattern, '' ).replace( this.format.decMark, '.' ) );
this.final = parseFloat( this.finalString.replace( pattern, '' ).replace( this.format.decMark, '.' ) );
} else {
this.initial = parseInt( this.initialString.replace( /[^0-9]+/g, '' ) );
this.final = parseInt( this.finalString.replace( /[^0-9]+/g, '' ) );
}
if ( this.format.accounting ) {
if ( this.initialString.length > 0 && this.initialString[ 0 ] == '(' ) {
this.initial = - this.initial;
}
if ( this.finalString.length > 0 && this.finalString[ 0 ] == '(' ) {
this.final = - this.final;
}
}
};
USCounterNumber.prototype = {
/**
* Function to be called at each animation frame
* @param now float Relative state between 0 and 1
*/
step: function( now ) {
var value = ( 1 - now ) * this.initial + this.final * now,
intPart = Math[ this.format.decMark ? 'floor' : 'round' ]( value ).toString(),
result = '';
if ( this.format.zerofill ) {
intPart = '0'.repeat( this.format.intDigits - intPart.length ) + intPart;
}
if ( this.format.groupMark ) {
if ( this.format.indian ) {
result += intPart.replace( /(\d)(?=(\d\d)+\d$)/g, '$1' + this.format.groupMark );
} else {
result += intPart.replace( /\B(?=(\d{3})+(?!\d))/g, this.format.groupMark );
}
} else {
result += intPart;
}
if ( this.format.decMark ) {
var decimalPart = ( value % 1 ).toFixed( this.format.decDigits ).substring( 2 );
result += this.format.decMark + decimalPart;
}
if ( this.format.accounting && result.length > 0 && result[ 0 ] == '-' ) {
result = '(' + result.substring( 1 ) + ')';
}
this.$container.html( result );
},
/**
* Get number format based on initial and final number strings
* @param initial string
* @param final string
* @returns {{groupMark, decMark, accounting, zerofill, indian}}
*/
getFormat: function( initial, final ) {
var iFormat = this._getFormat( initial ),
fFormat = this._getFormat( final ),
// Final format has more priority
format = $.extend( {}, iFormat, fFormat );
// Group marks detector is more precise, so using it in controversial cases
if ( format.groupMark == format.decMark ) {
delete format.groupMark;
}
return format;
},
/**
* Get number format based on a single number string
* @param str string
* @returns {{groupMark, decMark, accounting, zerofill, indian}}
* @private
*/
_getFormat: function( str ) {
var marks = str.replace( /[0-9\(\)\-]+/g, '' ),
format = {};
if ( str.charAt( 0 ) == '(' ) {
format.accounting = true;
}
if ( /^0[0-9]/.test( str ) ) {
format.zerofill = true;
}
str = str.replace( /[\(\)\-]/g, '' );
if ( marks.length != 0 ) {
if ( marks.length > 1 ) {
format.groupMark = marks.charAt( 0 );
if ( marks.charAt( 0 ) != marks.charAt( marks.length - 1 ) ) {
format.decMark = marks.charAt( marks.length - 1 );
}
if ( str.split( format.groupMark ).length > 2 && str.split( format.groupMark )[ 1 ].length == 2 ) {
format.indian = true;
}
} else/*if (marks.length == 1)*/ {
format[ ( ( str.length - str.indexOf( marks ) - 1 ) == 3 ) ? 'groupMark' : 'decMark' ] = marks;
}
if ( format.decMark ) {
format.decDigits = str.length - str.indexOf( format.decMark ) - 1;
}
}
if ( format.zerofill ) {
format.intDigits = str.replace( /[^\d]+/g, '' ).length - ( format.decDigits || 0 );
}
return format;
}
};
/**
* Counter Number part animations
* @param container
* @constructor
*/
var USCounterText = function( container ) {
this.$container = $( container );
this.initial = this.$container.text() + '';
this.final = this.$container.data( 'final' ) + '';
this.partsStates = this.getStates( this.initial, this.final );
this.len = 1 / ( this.partsStates.length - 1 );
// Text value won't be changed on each frame, so we'll update it only on demand
this.curState = 0;
};
USCounterText.prototype = {
/**
* Function to be called at each animation frame
* @param now float Relative state between 0 and 1
*/
step: function( now ) {
var state = Math.round( Math.max( 0, now / this.len ) );
if ( state == this.curState ) {
return;
}
this.$container.html( this.partsStates[ state ] );
this.curState = state;
},
/**
* Slightly modified Wagner-Fischer algorithm to obtain the shortest edit distance with intermediate states
* @param initial string The initial string
* @param final string The final string
* @returns {Array}
* @private
*/
getStates: function( initial, final ) {
var dist = [],
i, j;
for ( i = 0; i <= initial.length; i ++ ) {
dist[ i ] = [ i ];
}
for ( j = 1; j <= final.length; j ++ ) {
dist[ 0 ][ j ] = j;
for ( i = 1; i <= initial.length; i ++ ) {
dist[ i ][ j ] = ( initial[ i - 1 ] === final[ j - 1 ] ) ? dist[ i - 1 ][ j - 1 ] : ( Math.min( dist[ i - 1 ][ j ], dist[ i ][ j - 1 ], dist[ i - 1 ][ j - 1 ] ) + 1 );
}
}
// Obtaining the intermediate states
var states = [ final ];
for ( i = initial.length, j = final.length; i > 0 || j > 0; i --, j -- ) {
var min = dist[ i ][ j ];
if ( i > 0 ) {
min = Math.min( min, dist[ i - 1 ][ j ], ( j > 0 ) ? dist[ i - 1 ][ j - 1 ] : min );
}
if ( j > 0 ) {
min = Math.min( min, dist[ i ][ j - 1 ] );
}
if ( min >= dist[ i ][ j ] ) {
continue;
}
if ( min == dist[ i ][ j - 1 ] ) {
// Remove
states.unshift( states[ 0 ].substring( 0, j - 1 ) + states[ 0 ].substring( j ) );
i ++;
} else if ( min == dist[ i - 1 ][ j - 1 ] ) {
// Modify
states.unshift( states[ 0 ].substring( 0, j - 1 ) + initial[ i - 1 ] + states[ 0 ].substring( j ) );
} else if ( min == dist[ i - 1 ][ j ] ) {
// Insert
states.unshift( states[ 0 ].substring( 0, j ) + initial[ i - 1 ] + states[ 0 ].substring( j ) );
j ++;
}
}
return states;
}
};
/**
*
* @param container
* @constructor
*/
var USCounter = function( container ) {
// Commonly used DOM elements
this.$container = $( container );
this.parts = [];
this.duration = parseInt( this.$container.data( 'duration' ) || 2000 );
this.$container.find( '.w-counter-value-part' ).each( function( index, part ) {
var $part = $( part );
// Skipping the ones that won't be changed
if ( $part.html() + '' == $part.data( 'final' ) + '' ) {
return;
}
var type = $part.usMod( 'type' );
if ( type == 'number' ) {
this.parts.push( new USCounterNumber( $part ) );
} else {
this.parts.push( new USCounterText( $part ) );
}
}.bind( this ) );
if ( window.$us !== undefined && window.$us.scroll !== undefined ) {
// Animate element when it becomes visible
$us.scroll.addWaypoint( this.$container, '15%', this.animate.bind( this ) );
} else {
// No waypoints available: animate right from the start
this.animate();
}
};
USCounter.prototype = {
animate: function( duration ) {
this.$container.css( 'w-counter', 0 ).animate( { 'w-counter': 1 }, {
duration: this.duration,
step: this.step.bind( this )
} );
},
/**
* Function to be called at each animation frame
* @param now float Relative state between 0 and 1
*/
step: function( now ) {
for ( var i = 0; i < this.parts.length; i ++ ) {
this.parts[ i ].step( now );
}
}
};
$.fn.wCounter = function( options ) {
return this.each( function() {
$( this ).data( 'wItext', new USCounter( this, options ) );
} );
};
$( function() {
$( '.w-counter' ).wCounter();
} );
}( jQuery );
@@ -0,0 +1,22 @@
!function($){var USCounterNumber=function(container){this.$container=$(container);this.initialString=this.$container.html()+'';this.finalString=this.$container.data('final')+'';this.format=this.getFormat(this.initialString,this.finalString);if(this.format.decMark){var pattern=new RegExp('[^0-9\/'+this.format.decMark+']+','g');this.initial=parseFloat(this.initialString.replace(pattern,'').replace(this.format.decMark,'.'));this.final=parseFloat(this.finalString.replace(pattern,'').replace(this.format.decMark,'.'))}else{this.initial=parseInt(this.initialString.replace(/[^0-9]+/g,''));this.final=parseInt(this.finalString.replace(/[^0-9]+/g,''))}
if(this.format.accounting){if(this.initialString.length>0&&this.initialString[0]=='('){this.initial=-this.initial}
if(this.finalString.length>0&&this.finalString[0]=='('){this.final=-this.final}}};USCounterNumber.prototype={step:function(now){var value=(1-now)*this.initial+this.final*now,intPart=Math[this.format.decMark?'floor':'round'](value).toString(),result='';if(this.format.zerofill){intPart='0'.repeat(this.format.intDigits-intPart.length)+intPart}
if(this.format.groupMark){if(this.format.indian){result+=intPart.replace(/(\d)(?=(\d\d)+\d$)/g,'$1'+this.format.groupMark)}else{result+=intPart.replace(/\B(?=(\d{3})+(?!\d))/g,this.format.groupMark)}}else{result+=intPart}
if(this.format.decMark){var decimalPart=(value%1).toFixed(this.format.decDigits).substring(2);result+=this.format.decMark+decimalPart}
if(this.format.accounting&&result.length>0&&result[0]=='-'){result='('+result.substring(1)+')'}
this.$container.html(result)},getFormat:function(initial,final){var iFormat=this._getFormat(initial),fFormat=this._getFormat(final),format=$.extend({},iFormat,fFormat);if(format.groupMark==format.decMark){delete format.groupMark}
return format},_getFormat:function(str){var marks=str.replace(/[0-9\(\)\-]+/g,''),format={};if(str.charAt(0)=='('){format.accounting=!0}
if(/^0[0-9]/.test(str)){format.zerofill=!0}
str=str.replace(/[\(\)\-]/g,'');if(marks.length!=0){if(marks.length>1){format.groupMark=marks.charAt(0);if(marks.charAt(0)!=marks.charAt(marks.length-1)){format.decMark=marks.charAt(marks.length-1)}
if(str.split(format.groupMark).length>2&&str.split(format.groupMark)[1].length==2){format.indian=!0}}else{format[((str.length-str.indexOf(marks)-1)==3)?'groupMark':'decMark']=marks}
if(format.decMark){format.decDigits=str.length-str.indexOf(format.decMark)-1}}
if(format.zerofill){format.intDigits=str.replace(/[^\d]+/g,'').length-(format.decDigits||0)}
return format}};var USCounterText=function(container){this.$container=$(container);this.initial=this.$container.text()+'';this.final=this.$container.data('final')+'';this.partsStates=this.getStates(this.initial,this.final);this.len=1/(this.partsStates.length-1);this.curState=0};USCounterText.prototype={step:function(now){var state=Math.round(Math.max(0,now/this.len));if(state==this.curState){return}
this.$container.html(this.partsStates[state]);this.curState=state},getStates:function(initial,final){var dist=[],i,j;for(i=0;i<=initial.length;i ++){dist[i]=[i]}
for(j=1;j<=final.length;j ++){dist[0][j]=j;for(i=1;i<=initial.length;i ++){dist[i][j]=(initial[i-1]===final[j-1])?dist[i-1][j-1]:(Math.min(dist[i-1][j],dist[i][j-1],dist[i-1][j-1])+1)}}
var states=[final];for(i=initial.length,j=final.length;i>0||j>0;i --,j --){var min=dist[i][j];if(i>0){min=Math.min(min,dist[i-1][j],(j>0)?dist[i-1][j-1]:min)}
if(j>0){min=Math.min(min,dist[i][j-1])}
if(min>=dist[i][j]){continue}
if(min==dist[i][j-1]){states.unshift(states[0].substring(0,j-1)+states[0].substring(j));i ++}else if(min==dist[i-1][j-1]){states.unshift(states[0].substring(0,j-1)+initial[i-1]+states[0].substring(j))}else if(min==dist[i-1][j]){states.unshift(states[0].substring(0,j)+initial[i-1]+states[0].substring(j));j ++}}
return states}};var USCounter=function(container){this.$container=$(container);this.parts=[];this.duration=parseInt(this.$container.data('duration')||2000);this.$container.find('.w-counter-value-part').each(function(index,part){var $part=$(part);if($part.html()+''==$part.data('final')+''){return}
var type=$part.usMod('type');if(type=='number'){this.parts.push(new USCounterNumber($part))}else{this.parts.push(new USCounterText($part))}}.bind(this));if(window.$us!==undefined&&window.$us.scroll!==undefined){$us.scroll.addWaypoint(this.$container,'15%',this.animate.bind(this))}else{this.animate()}};USCounter.prototype={animate:function(duration){this.$container.css('w-counter',0).animate({'w-counter':1},{duration:this.duration,step:this.step.bind(this)})},step:function(now){for(var i=0;i<this.parts.length;i ++){this.parts[i].step(now)}}};$.fn.wCounter=function(options){return this.each(function(){$(this).data('wItext',new USCounter(this,options))})};$(function(){$('.w-counter').wCounter()})}(jQuery)
@@ -0,0 +1,80 @@
/**
* UpSolution Element: Dropdown
*/
( function( $ ) {
"use strict";
$.fn.wDropdown = function() {
return this.each( function() {
var $this = $( this ),
$list = $this.find( '.w-dropdown-list' ),
$current = $this.find( '.w-dropdown-current' ),
$currentAnchor = $current.find( 'a' ),
$anchors = $this.find( 'a' ),
openEventName = 'click',
closeEventName = 'mouseup touchstart mousewheel DOMMouseScroll touchstart',
justOpened = false;
if ( $this.hasClass( 'open_on_hover' ) ) {
openEventName = 'mouseenter';
closeEventName = 'mouseleave';
}
var closeList = function() {
$this.removeClass( 'opened' );
$us.$window.off( closeEventName, closeListEvent );
};
var closeListEvent = function( e ) {
if ( closeEventName != 'mouseleave' && $this.has( e.target ).length !== 0 ) {
return;
}
e.stopPropagation();
e.preventDefault();
closeList();
};
var openList = function() {
$this.addClass( 'opened' );
if ( closeEventName == 'mouseleave' ) {
$this.on( closeEventName, closeListEvent );
} else {
$us.$window.on( closeEventName, closeListEvent );
}
justOpened = true;
window.setTimeout( function() {
justOpened = false;
}, 500 );
};
var openListEvent = function( e ) {
if ( openEventName == 'click' && $this.hasClass( 'opened' ) && ! justOpened ) {
closeList();
return;
}
openList();
};
$current.on( openEventName, openListEvent );
$anchors.on( 'focus.upsolution', function() {
openList();
} );
$this.on( 'keydown', function( e ) {
var keyCode = e.keyCode || e.which;
if ( keyCode == 9 ) {
var $target = $( e.target ) ? $( e.target ) : {},
index = $anchors.index( $target );
if ( e.shiftKey ) {
if ( index === 0 ) {
closeList();
}
} else {
if ( index === $anchors.length - 1 ) {
closeList();
}
}
}
} );
} );
};
$( function() {
$( '.w-dropdown' ).wDropdown();
} );
} )( jQuery );
@@ -0,0 +1,5 @@
(function($){"use strict";$.fn.wDropdown=function(){return this.each(function(){var $this=$(this),$list=$this.find('.w-dropdown-list'),$current=$this.find('.w-dropdown-current'),$currentAnchor=$current.find('a'),$anchors=$this.find('a'),openEventName='click',closeEventName='mouseup touchstart mousewheel DOMMouseScroll touchstart',justOpened=!1;if($this.hasClass('open_on_hover')){openEventName='mouseenter';closeEventName='mouseleave'}
var closeList=function(){$this.removeClass('opened');$us.$window.off(closeEventName,closeListEvent)};var closeListEvent=function(e){if(closeEventName!='mouseleave'&&$this.has(e.target).length!==0){return}
e.stopPropagation();e.preventDefault();closeList()};var openList=function(){$this.addClass('opened');if(closeEventName=='mouseleave'){$this.on(closeEventName,closeListEvent)}else{$us.$window.on(closeEventName,closeListEvent)}
justOpened=!0;window.setTimeout(function(){justOpened=!1},500)};var openListEvent=function(e){if(openEventName=='click'&&$this.hasClass('opened')&&!justOpened){closeList();return}
openList()};$current.on(openEventName,openListEvent);$anchors.on('focus.upsolution',function(){openList()});$this.on('keydown',function(e){var keyCode=e.keyCode||e.which;if(keyCode==9){var $target=$(e.target)?$(e.target):{},index=$anchors.index($target);if(e.shiftKey){if(index===0){closeList()}}else{if(index===$anchors.length-1){closeList()}}}})})};$(function(){$('.w-dropdown').wDropdown()})})(jQuery)
@@ -0,0 +1,146 @@
/**
* UpSolution Element: FlipBox
*/
! function( $ ) {
"use strict";
$us.WFlipBox = function( container ) {
// Common dom elements
this.$container = $( container );
this.$front = this.$container.find( '.w-flipbox-front' );
this.$frontH = this.$container.find( '.w-flipbox-front-h' );
this.$back = this.$container.find( '.w-flipbox-back' );
this.$backH = this.$container.find( '.w-flipbox-back-h' );
this.$btn = this.$container.find( '.w-btn' );
// Simplified animation for IE11
if ( ! ! window.MSInputMethodContext && ! ! document.documentMode ) {
this.$container.usMod( 'animation', 'cardflip' ).find( '.w-flipbox-h' ).css( {
'transition-duration': '0s',
'-webkit-transition-duration': '0s'
} );
}
// In chrome cube flip animation makes button not clickable. Replacing it with cube tilt
var isWebkit = 'WebkitAppearance' in document.documentElement.style;
if ( isWebkit && this.$container.usMod( 'animation' ) === 'cubeflip' && this.$btn.length ) {
this.$container.usMod( 'animation', 'cubetilt' );
}
// For diagonal cube animations height should equal width (heometrical restriction)
var animation = this.$container.usMod( 'animation' ),
direction = this.$container.usMod( 'direction' );
this.forceSquare = ( animation == 'cubeflip' && [ 'ne', 'se', 'sw', 'nw' ].indexOf( direction ) != - 1 );
// Container height is determined by the maximum content height
this.autoSize = ( this.$front[ 0 ].style.height == '' && ! this.forceSquare );
// Content is centered
this.centerContent = ( this.$container.usMod( 'valign' ) == 'center' );
if ( this._events === undefined ) {
this._events = {};
}
$.extend( this._events, {
resize: this.resize.bind( this )
} );
if ( this.centerContent || this.autoSize ) {
this.padding = parseInt( this.$front.css( 'padding-top' ) );
}
if ( this.centerContent || this.forceSquare || this.autoSize ) {
$us.$window.bind( 'resize load', this._events.resize );
this.resize();
}
this.makeHoverable( '.w-btn' );
// Fixing css3 animations rendering glitch on page load
setTimeout( function() {
this.$back.css( 'display', '' );
this.resize();
}.bind( this ), 250 );
};
$us.WFlipBox.prototype = {
resize: function() {
var width = this.$container.width(),
height;
if ( this.autoSize || this.centerContent ) {
var frontContentHeight = this.$frontH.height(),
backContentHeight = this.$backH.height();
}
// Changing the whole container height
if ( this.forceSquare || this.autoSize ) {
height = this.forceSquare ? width : ( Math.max( frontContentHeight, backContentHeight ) + 2 * this.padding );
this.$front.css( 'height', height + 'px' );
} else {
height = this.$container.height();
}
if ( this.centerContent ) {
this.$front.css( 'padding-top', Math.max( this.padding, ( height - frontContentHeight ) / 2 ) );
this.$back.css( 'padding-top', Math.max( this.padding, ( height - backContentHeight ) / 2 ) );
}
},
makeHoverable: function( exclude ) {
if ( this._events === undefined ) {
this._events = {};
}
if ( jQuery.isMobile ) {
// Mobile: Touch hover
this._events.touchHoverStart = function() {
this.$container.toggleClass( 'hover' );
}.bind( this );
this.$container.on( 'touchstart', this._events.touchHoverStart );
if ( exclude ) {
this._events.touchHoverPrevent = function( e ) {
e.stopPropagation();
};
this.$container.find( exclude ).on( 'touchstart', this._events.touchHoverPrevent );
}
} else {
// Desktop: Mouse hover
this._mouseInside = false;
this._focused = false;
$.extend( this._events, {
mouseHoverStart: function() {
this.$container.addClass( 'hover' );
this._mouseInside = true;
}.bind( this ),
mouseHoverEnd: function() {
if ( ! this._focused ) {
this.$container.removeClass( 'hover' );
}
this._mouseInside = false;
}.bind( this ),
focus: function() {
this.$container.addClass( 'hover' );
this._focused = true;
}.bind( this ),
blur: function() {
if ( ! this._mouseInside ) {
this.$container.removeClass( 'hover' );
}
this._focused = false;
}.bind( this )
} );
this.$container.on( 'mouseenter', this._events.mouseHoverStart );
this.$container.on( 'mouseleave', this._events.mouseHoverEnd );
this.$focusable = this.$container.find( 'a' ).addBack( 'a' );
this.$focusable.on( 'focus', this._events.focus );
this.$focusable.on( 'blur', this._events.blur );
}
}
};
$.fn.wFlipBox = function( options ) {
return this.each( function() {
$( this ).data( 'wFlipBox', new $us.WFlipBox( this, options ) );
} );
};
$( function() {
$( '.w-flipbox' ).wFlipBox();
} );
}( jQuery );
@@ -0,0 +1,11 @@
!function($){"use strict";$us.WFlipBox=function(container){this.$container=$(container);this.$front=this.$container.find('.w-flipbox-front');this.$frontH=this.$container.find('.w-flipbox-front-h');this.$back=this.$container.find('.w-flipbox-back');this.$backH=this.$container.find('.w-flipbox-back-h');this.$btn=this.$container.find('.w-btn');if(!!window.MSInputMethodContext&&!!document.documentMode){this.$container.usMod('animation','cardflip').find('.w-flipbox-h').css({'transition-duration':'0s','-webkit-transition-duration':'0s'})}
var isWebkit='WebkitAppearance' in document.documentElement.style;if(isWebkit&&this.$container.usMod('animation')==='cubeflip'&&this.$btn.length){this.$container.usMod('animation','cubetilt')}
var animation=this.$container.usMod('animation'),direction=this.$container.usMod('direction');this.forceSquare=(animation=='cubeflip'&&['ne','se','sw','nw'].indexOf(direction)!=-1);this.autoSize=(this.$front[0].style.height==''&&!this.forceSquare);this.centerContent=(this.$container.usMod('valign')=='center');if(this._events===undefined){this._events={}}
$.extend(this._events,{resize:this.resize.bind(this)});if(this.centerContent||this.autoSize){this.padding=parseInt(this.$front.css('padding-top'))}
if(this.centerContent||this.forceSquare||this.autoSize){$us.$window.bind('resize load',this._events.resize);this.resize()}
this.makeHoverable('.w-btn');setTimeout(function(){this.$back.css('display','');this.resize()}.bind(this),250)};$us.WFlipBox.prototype={resize:function(){var width=this.$container.width(),height;if(this.autoSize||this.centerContent){var frontContentHeight=this.$frontH.height(),backContentHeight=this.$backH.height()}
if(this.forceSquare||this.autoSize){height=this.forceSquare?width:(Math.max(frontContentHeight,backContentHeight)+2*this.padding);this.$front.css('height',height+'px')}else{height=this.$container.height()}
if(this.centerContent){this.$front.css('padding-top',Math.max(this.padding,(height-frontContentHeight)/2));this.$back.css('padding-top',Math.max(this.padding,(height-backContentHeight)/2))}},makeHoverable:function(exclude){if(this._events===undefined){this._events={}}
if(jQuery.isMobile){this._events.touchHoverStart=function(){this.$container.toggleClass('hover')}.bind(this);this.$container.on('touchstart',this._events.touchHoverStart);if(exclude){this._events.touchHoverPrevent=function(e){e.stopPropagation()};this.$container.find(exclude).on('touchstart',this._events.touchHoverPrevent)}}else{this._mouseInside=!1;this._focused=!1;$.extend(this._events,{mouseHoverStart:function(){this.$container.addClass('hover');this._mouseInside=!0}.bind(this),mouseHoverEnd:function(){if(!this._focused){this.$container.removeClass('hover')}
this._mouseInside=!1}.bind(this),focus:function(){this.$container.addClass('hover');this._focused=!0}.bind(this),blur:function(){if(!this._mouseInside){this.$container.removeClass('hover')}
this._focused=!1}.bind(this)});this.$container.on('mouseenter',this._events.mouseHoverStart);this.$container.on('mouseleave',this._events.mouseHoverEnd);this.$focusable=this.$container.find('a').addBack('a');this.$focusable.on('focus',this._events.focus);this.$focusable.on('blur',this._events.blur)}}};$.fn.wFlipBox=function(options){return this.each(function(){$(this).data('wFlipBox',new $us.WFlipBox(this,options))})};$(function(){$('.w-flipbox').wFlipBox()})}(jQuery)
@@ -0,0 +1,52 @@
/**
* UpSolution Element: Gallery
* Used for regular WordPress gallery design improvement
*/
jQuery( function( $ ) {
$( '.w-gallery.link_file .w-gallery-list' ).each( function() {
$us.getScript( $us.templateDirectoryUri + '/framework/js/vendor/magnific-popup.js', function() {
$( this ).magnificPopup( {
type: 'image',
delegate: 'a.w-gallery-item',
gallery: {
enabled: true,
navigateByImgClick: true,
preload: [ 0, 1 ],
tPrev: $us.langOptions.magnificPopup.tPrev, // Alt text on left arrow
tNext: $us.langOptions.magnificPopup.tNext, // Alt text on right arrow
tCounter: $us.langOptions.magnificPopup.tCounter // Markup for "1 of 7" counter
},
removalDelay: 300,
mainClass: 'mfp-fade',
fixedContentPos: true
} );
}.bind( this ) );
} );
// Applying isotope to gallery
$( '.w-gallery.type_masonry' ).each( function( index, gallery ) {
$us.getScript( $us.templateDirectoryUri + '/framework/js/vendor/isotope.js', function() {
var $container = $( $( gallery ).find( '.w-gallery-list' ) ),
isotopeOptions = {
layoutMode: 'masonry',
isOriginLeft: ! $( 'body' ).hasClass( 'rtl' )
};
if ( $container.parents( '.w-tabs-section-content-h' ).length ) {
isotopeOptions.transitionDuration = 0;
}
$container.imagesLoaded( function() {
$container.isotope( isotopeOptions );
$container.isotope();
} );
$us.$canvas.on( 'contentChange', function() {
$container.imagesLoaded( function() {
$container.isotope();
} );
} );
} );
} );
} );
@@ -0,0 +1,2 @@
jQuery(function($){$('.w-gallery.link_file .w-gallery-list').each(function(){$us.getScript($us.templateDirectoryUri+'/framework/js/vendor/magnific-popup.js',function(){$(this).magnificPopup({type:'image',delegate:'a.w-gallery-item',gallery:{enabled:!0,navigateByImgClick:!0,preload:[0,1],tPrev:$us.langOptions.magnificPopup.tPrev,tNext:$us.langOptions.magnificPopup.tNext,tCounter:$us.langOptions.magnificPopup.tCounter},removalDelay:300,mainClass:'mfp-fade',fixedContentPos:!0})}.bind(this))});$('.w-gallery.type_masonry').each(function(index,gallery){$us.getScript($us.templateDirectoryUri+'/framework/js/vendor/isotope.js',function(){var $container=$($(gallery).find('.w-gallery-list')),isotopeOptions={layoutMode:'masonry',isOriginLeft:!$('body').hasClass('rtl')};if($container.parents('.w-tabs-section-content-h').length){isotopeOptions.transitionDuration=0}
$container.imagesLoaded(function(){$container.isotope(isotopeOptions);$container.isotope()});$us.$canvas.on('contentChange',function(){$container.imagesLoaded(function(){$container.isotope()})})})})})
@@ -0,0 +1,215 @@
/**
* UpSolution Element: Google Maps
*
* Used for [us_gmaps] shortcode
*/
! function( $ ) {
"use strict";
$us.WMapsGeocodesCounter = 0; // counter of total geocode requests number
$us.WMapsGeocodesRunning = false;
$us.WMapsCurrentGeocode = 0; // current processing geocode
$us.WMapsGeocodesMax = 5; // max number of simultaneous geocode requests allowed
$us.WMapsGeocodesStack = {};
$us.WMapsRunGeoCode = function() {
if ( $us.WMapsCurrentGeocode <= $us.WMapsGeocodesCounter ) {
$us.WMapsGeocodesRunning = true;
if ( $us.WMapsGeocodesStack[ $us.WMapsCurrentGeocode ] != null ) {
$us.WMapsGeocodesStack[ $us.WMapsCurrentGeocode ]();
}
} else {
$us.WMapsGeocodesRunning = false;
}
};
$us.WMaps = function( container, options ) {
this.$container = $( container );
// Prevent double init
if ( this.$container.data( 'mapInit' ) == 1 ) {
return;
}
this.$container.data( 'mapInit', 1 );
var $jsonContainer = this.$container.find( '.w-map-json' ),
jsonOptions = $jsonContainer[ 0 ].onclick() || {},
$jsonStyleContainer = this.$container.find( '.w-map-style-json' ),
jsonStyleOptions,
shouldRunGeoCode = false;
$jsonContainer.remove();
if ( $jsonStyleContainer.length ) {
jsonStyleOptions = $jsonStyleContainer[ 0 ].onclick() || {};
$jsonStyleContainer.remove();
}
// Setting options
var defaults = {};
this.options = $.extend( {}, defaults, jsonOptions, options );
this._events = {
redraw: this.redraw.bind( this )
};
var gmapsOptions = {
el: '#' + this.$container.attr( 'id' ),
lat: 0,
lng: 0,
zoom: this.options.zoom,
type: this.options.type,
height: this.options.height + 'px',
width: '100%',
mapTypeId: google.maps.MapTypeId[ this.options.maptype ]
};
if ( this.options.hideControls ) {
gmapsOptions.disableDefaultUI = true;
}
if ( this.options.disableZoom ) {
gmapsOptions.scrollwheel = false;
}
if ( this.options.disableDragging && ( ! $us.$html.hasClass( 'no-touch' ) ) ) {
gmapsOptions.draggable = false;
}
if ( this.options.mapBgColor ) {
gmapsOptions.backgroundColor = this.options.mapBgColor;
}
this.GMapsObj = new GMaps( gmapsOptions );
if ( jsonStyleOptions != null && jsonStyleOptions != {} ) {
this.GMapsObj.map.setOptions( { styles: jsonStyleOptions } );
}
var matches = this.options.address.match( /^(-?\d+.\d+)\s?,?\s?(-?\d+.\d+)$/ ),
that = this;
if ( matches ) {
this.options.latitude = matches[ 1 ];
this.options.longitude = matches[ 2 ];
this.GMapsObj.setCenter( this.options.latitude, this.options.longitude );
} else {
var mapGeoCode = function() {
GMaps.geocode( {
address: that.options.address,
callback: function( results, status ) {
if ( status == 'OK' ) {
var latlng = results[ 0 ].geometry.location;
that.options.latitude = latlng.lat();
that.options.longitude = latlng.lng();
that.GMapsObj.setCenter( that.options.latitude, that.options.longitude );
$us.WMapsCurrentGeocode ++;
$us.WMapsRunGeoCode();
} else if ( status == "OVER_QUERY_LIMIT" ) {
setTimeout( function() {
$us.WMapsRunGeoCode()
}, 2000 );
}
}
} );
};
shouldRunGeoCode = true;
$us.WMapsGeocodesStack[ $us.WMapsGeocodesCounter ] = mapGeoCode;
$us.WMapsGeocodesCounter ++;
}
// Map Markers
$.each( this.options.markers, function( i, val ) {
var markerOptions = {};
if ( that.options.icon != null || that.options.markers[ i ].marker_img != null ) {
var url, size, width, height;
if ( that.options.markers[ i ].marker_img != null ) {
url = that.options.markers[ i ].marker_img[ 0 ];
width = parseInt( that.options.markers[ i ].marker_size[ 0 ] );
height = parseInt( that.options.markers[ i ].marker_size[ 1 ] );
size = new google.maps.Size( width, height );
} else {
url = that.options.icon.url;
size = new google.maps.Size( that.options.icon.size[ 0 ], that.options.icon.size[ 1 ] );
}
markerOptions.icon = {
url: url,
size: size,
scaledSize: size,
};
}
if ( that.options.markers[ i ] != null ) {
var matches = that.options.markers[ i ].address.match( /^(-?\d+.\d+)\s?,?\s?(-?\d+.\d+)$/ );
if ( matches ) {
markerOptions.lat = matches[ 1 ];
markerOptions.lng = matches[ 2 ];
markerOptions.infoWindow = { content: that.options.markers[ i ].html };
var marker = that.GMapsObj.addMarker( markerOptions );
if ( that.options.markers[ i ].infowindow ) {
marker.infoWindow.open( that.GMapsObj.map, marker );
}
} else {
var markerGeoCode = function() {
GMaps.geocode( {
address: that.options.markers[ i ].address,
callback: function( results, status ) {
if ( status == 'OK' ) {
var latlng = results[ 0 ].geometry.location;
markerOptions.lat = latlng.lat();
markerOptions.lng = latlng.lng();
markerOptions.infoWindow = { content: that.options.markers[ i ].html };
var marker = that.GMapsObj.addMarker( markerOptions );
if ( that.options.markers[ i ].infowindow ) {
marker.infoWindow.open( that.GMapsObj.map, marker );
}
$us.WMapsCurrentGeocode ++;
$us.WMapsRunGeoCode();
} else if ( status == "OVER_QUERY_LIMIT" ) {
setTimeout( function() {
$us.WMapsRunGeoCode()
}, 2000 );
}
}
} );
};
shouldRunGeoCode = true;
$us.WMapsGeocodesStack[ $us.WMapsGeocodesCounter ] = markerGeoCode;
$us.WMapsGeocodesCounter ++;
}
}
} );
if ( shouldRunGeoCode && ( ! $us.WMapsGeocodesRunning ) ) {
$us.WMapsRunGeoCode();
}
$us.$canvas.on( 'contentChange', this._events.redraw );
// In case some toggler was opened before the actual page load
$us.$window.load( this._events.redraw );
};
$us.WMaps.prototype = {
// Fixing hidden and other breaking-cases maps
redraw: function() {
if ( this.$container.is( ':hidden' ) ) {
return;
}
this.GMapsObj.refresh();
if ( this.options.latitude != null && this.options.longitude != null ) {
this.GMapsObj.setCenter( this.options.latitude, this.options.longitude );
}
}
};
$.fn.wMaps = function( options ) {
return this.each( function() {
$( this ).data( 'wMaps', new $us.WMaps( this, options ) );
} );
};
$( function() {
var $wMap = $( '.w-map.provider_google' );
if ( $wMap.length ) {
$us.getScript( $us.templateDirectoryUri + '/framework/js/vendor/gmaps.js', function() {
$wMap.wMaps();
} );
}
} );
}( jQuery );
@@ -0,0 +1,14 @@
!function($){"use strict";$us.WMapsGeocodesCounter=0;$us.WMapsGeocodesRunning=!1;$us.WMapsCurrentGeocode=0;$us.WMapsGeocodesMax=5;$us.WMapsGeocodesStack={};$us.WMapsRunGeoCode=function(){if($us.WMapsCurrentGeocode<=$us.WMapsGeocodesCounter){$us.WMapsGeocodesRunning=!0;if($us.WMapsGeocodesStack[$us.WMapsCurrentGeocode]!=null){$us.WMapsGeocodesStack[$us.WMapsCurrentGeocode]()}}else{$us.WMapsGeocodesRunning=!1}};$us.WMaps=function(container,options){this.$container=$(container);if(this.$container.data('mapInit')==1){return}
this.$container.data('mapInit',1);var $jsonContainer=this.$container.find('.w-map-json'),jsonOptions=$jsonContainer[0].onclick()||{},$jsonStyleContainer=this.$container.find('.w-map-style-json'),jsonStyleOptions,shouldRunGeoCode=!1;$jsonContainer.remove();if($jsonStyleContainer.length){jsonStyleOptions=$jsonStyleContainer[0].onclick()||{};$jsonStyleContainer.remove()}
var defaults={};this.options=$.extend({},defaults,jsonOptions,options);this._events={redraw:this.redraw.bind(this)};var gmapsOptions={el:'#'+this.$container.attr('id'),lat:0,lng:0,zoom:this.options.zoom,type:this.options.type,height:this.options.height+'px',width:'100%',mapTypeId:google.maps.MapTypeId[this.options.maptype]};if(this.options.hideControls){gmapsOptions.disableDefaultUI=!0}
if(this.options.disableZoom){gmapsOptions.scrollwheel=!1}
if(this.options.disableDragging&&(!$us.$html.hasClass('no-touch'))){gmapsOptions.draggable=!1}
if(this.options.mapBgColor){gmapsOptions.backgroundColor=this.options.mapBgColor}
this.GMapsObj=new GMaps(gmapsOptions);if(jsonStyleOptions!=null&&jsonStyleOptions!={}){this.GMapsObj.map.setOptions({styles:jsonStyleOptions})}
var matches=this.options.address.match(/^(-?\d+.\d+)\s?,?\s?(-?\d+.\d+)$/),that=this;if(matches){this.options.latitude=matches[1];this.options.longitude=matches[2];this.GMapsObj.setCenter(this.options.latitude,this.options.longitude)}else{var mapGeoCode=function(){GMaps.geocode({address:that.options.address,callback:function(results,status){if(status=='OK'){var latlng=results[0].geometry.location;that.options.latitude=latlng.lat();that.options.longitude=latlng.lng();that.GMapsObj.setCenter(that.options.latitude,that.options.longitude);$us.WMapsCurrentGeocode ++;$us.WMapsRunGeoCode()}else if(status=="OVER_QUERY_LIMIT"){setTimeout(function(){$us.WMapsRunGeoCode()},2000)}}})};shouldRunGeoCode=!0;$us.WMapsGeocodesStack[$us.WMapsGeocodesCounter]=mapGeoCode;$us.WMapsGeocodesCounter ++}
$.each(this.options.markers,function(i,val){var markerOptions={};if(that.options.icon!=null||that.options.markers[i].marker_img!=null){var url,size,width,height;if(that.options.markers[i].marker_img!=null){url=that.options.markers[i].marker_img[0];width=parseInt(that.options.markers[i].marker_size[0]);height=parseInt(that.options.markers[i].marker_size[1]);size=new google.maps.Size(width,height)}else{url=that.options.icon.url;size=new google.maps.Size(that.options.icon.size[0],that.options.icon.size[1])}
markerOptions.icon={url:url,size:size,scaledSize:size,}}
if(that.options.markers[i]!=null){var matches=that.options.markers[i].address.match(/^(-?\d+.\d+)\s?,?\s?(-?\d+.\d+)$/);if(matches){markerOptions.lat=matches[1];markerOptions.lng=matches[2];markerOptions.infoWindow={content:that.options.markers[i].html};var marker=that.GMapsObj.addMarker(markerOptions);if(that.options.markers[i].infowindow){marker.infoWindow.open(that.GMapsObj.map,marker)}}else{var markerGeoCode=function(){GMaps.geocode({address:that.options.markers[i].address,callback:function(results,status){if(status=='OK'){var latlng=results[0].geometry.location;markerOptions.lat=latlng.lat();markerOptions.lng=latlng.lng();markerOptions.infoWindow={content:that.options.markers[i].html};var marker=that.GMapsObj.addMarker(markerOptions);if(that.options.markers[i].infowindow){marker.infoWindow.open(that.GMapsObj.map,marker)}
$us.WMapsCurrentGeocode ++;$us.WMapsRunGeoCode()}else if(status=="OVER_QUERY_LIMIT"){setTimeout(function(){$us.WMapsRunGeoCode()},2000)}}})};shouldRunGeoCode=!0;$us.WMapsGeocodesStack[$us.WMapsGeocodesCounter]=markerGeoCode;$us.WMapsGeocodesCounter ++}}});if(shouldRunGeoCode&&(!$us.WMapsGeocodesRunning)){$us.WMapsRunGeoCode()}
$us.$canvas.on('contentChange',this._events.redraw);$us.$window.load(this._events.redraw)};$us.WMaps.prototype={redraw:function(){if(this.$container.is(':hidden')){return}
this.GMapsObj.refresh();if(this.options.latitude!=null&&this.options.longitude!=null){this.GMapsObj.setCenter(this.options.latitude,this.options.longitude)}}};$.fn.wMaps=function(options){return this.each(function(){$(this).data('wMaps',new $us.WMaps(this,options))})};$(function(){var $wMap=$('.w-map.provider_google');if($wMap.length){$us.getScript($us.templateDirectoryUri+'/framework/js/vendor/gmaps.js',function(){$wMap.wMaps()})}})}(jQuery)
@@ -0,0 +1,592 @@
/**
* UpSolution Element: Grid
*/
( function( $ ) {
"use strict";
$us.WGrid = function( container, options ) {
this.init( container, options );
};
$us.WGrid.prototype = {
init: function( container, options ) {
// Commonly used dom elements
this.$container = $( container );
this.$filters = this.$container.find( '.g-filters-item' );
this.$list = this.$container.find( '.w-grid-list' );
this.$items = this.$container.find( '.w-grid-item' );
this.$pagination = this.$container.find( '.pagination' );
this.$loadmore = this.$container.find( '.g-loadmore' );
this.$preloader = this.$container.find( '.w-grid-preloader' );
this.curFilterTaxonomy = '';
this.paginationType = this.$pagination.length ? 'regular' : ( this.$loadmore.length ? 'ajax' : 'none' );
this.filterTaxonomyName = this.$list.data( 'filter_taxonomy_name' ) ? this.$list.data( 'filter_taxonomy_name' ) : 'category';
this.loading = false;
// Prevent double init
if ( this.$container.data( 'gridInit' ) == 1 ) {
return;
}
this.$container.data( 'gridInit', 1 );
var $jsonContainer = this.$container.find( '.w-grid-json' );
if ( $jsonContainer.length ) {
this.ajaxData = $jsonContainer[ 0 ].onclick() || {};
this.ajaxUrl = this.ajaxData.ajax_url || '';
$jsonContainer.remove();
}
this.carouselSettings = this.ajaxData.carousel_settings;
this.breakpoints = this.ajaxData.carousel_breakpoints || {};
if ( this.$list.hasClass( 'owl-carousel' ) ) {
$us.getScript( $us.templateDirectoryUri + '/framework/js/vendor/owl.carousel.js', function() {
this.carouselOptions = {
mouseDrag: ! jQuery.isMobile,
items: parseInt( this.carouselSettings.items ),
rtl: $( '.l-body' ).hasClass( 'rtl' ),
nav: this.carouselSettings.nav,
navElement: 'div',
navText: [ this.carouselSettings.navPrev, this.carouselSettings.navNext ],
dots: this.carouselSettings.dots,
loop: this.carouselSettings.center,
rewind: true,
center: this.carouselSettings.center,
autoplay: this.carouselSettings.autoplay,
autoplayTimeout: this.carouselSettings.timeout,
autoHeight: this.carouselSettings.autoHeight,
slideBy: this.carouselSettings.slideby,
smartSpeed: this.carouselSettings.speed,
slideTransition: this.carouselSettings.transition,
autoplayHoverPause: true,
responsive: this.breakpoints
};
if ( this.carouselSettings.autoplay == 1 ) {
this.carouselOptions.loop = 1;
}
if ( this.carouselSettings.smooth_play == 1 ) {
this.carouselOptions.slideTransition = 'linear';
this.carouselOptions.autoplaySpeed = this.carouselSettings.timeout;
this.carouselOptions.slideBy = 1;
this.carouselOptions.loop = 1;
}
this.$list.owlCarousel( this.carouselOptions );
this.$list.on('changed.owl.carousel', function(event) {
$(document).trigger('uslazyloadevent');
});
}.bind( this ) );
}
if ( this.$container.hasClass( 'popup_page' ) ) {
if ( this.ajaxData == undefined ) {
return;
}
this.lightboxTimer = null;
this.$lightboxOverlay = this.$container.find( '.l-popup-overlay' );
this.$lightboxWrap = this.$container.find( '.l-popup-wrap' );
this.$lightboxBox = this.$container.find( '.l-popup-box' );
this.$lightboxContent = this.$container.find( '.l-popup-box-content' );
this.$lightboxContentPreloader = this.$lightboxContent.find( '.g-preloader' );
this.$lightboxContentFrame = this.$container.find( '.l-popup-box-content-frame' );
this.$lightboxNextArrow = this.$container.find( '.l-popup-arrow.to_next' );
this.$lightboxPrevArrow = this.$container.find( '.l-popup-arrow.to_prev' );
this.$container.find( '.l-popup-closer' ).click( function() {
this.hideLightbox();
}.bind( this ) );
this.$container.find( '.l-popup-box' ).click( function() {
this.hideLightbox();
}.bind( this ) );
this.$container.find( '.l-popup-box-content' ).click( function( e ) {
e.stopPropagation();
}.bind( this ) );
this.originalURL = window.location.href;
this.lightboxOpened = false;
if ( this.$list.hasClass( 'owl-carousel' ) ) {
$us.getScript( $us.templateDirectoryUri + '/framework/js/vendor/owl.carousel.js', function() {
this.initLightboxAnchors();
}.bind( this ) );
} else {
this.initLightboxAnchors();
}
$( window ).on( 'resize', function() {
if ( this.lightboxOpened && $us.$window.width() < $us.canvasOptions.disableEffectsWidth ) {
this.hideLightbox();
}
}.bind( this ) );
}
if ( this.$list.hasClass( 'owl-carousel' ) ) {
return;
}
if ( this.paginationType != 'none' || this.$filters.length ) {
if ( this.ajaxData == undefined ) {
return;
}
this.templateVars = this.ajaxData.template_vars || {};
if ( this.filterTaxonomyName ) {
this.initialFilterTaxonomy = this.$list.data( 'filter_default_taxonomies' ) ? this.$list.data( 'filter_default_taxonomies' ).split( ',' ) : '';
this.curFilterTaxonomy = this.initialFilterTaxonomy;
}
this.curPage = this.ajaxData.current_page || 1;
this.perpage = this.ajaxData.perpage || this.$items.length;
this.infiniteScroll = this.ajaxData.infinite_scroll || 0;
}
if ( this.$container.hasClass( 'with_isotope' ) ) {
$us.getScript( $us.templateDirectoryUri + '/framework/js/vendor/isotope.js', function() {
this.$list.imagesLoaded( function() {
var smallestItemSelector,
isotopeOptions = {
itemSelector: '.w-grid-item',
layoutMode: ( this.$container.hasClass( 'isotope_fit_rows' ) ) ? 'fitRows' : 'masonry',
isOriginLeft: ! $( '.l-body' ).hasClass( 'rtl' )
};
if ( this.$list.find( '.size_1x1' ).length ) {
smallestItemSelector = '.size_1x1';
} else if ( this.$list.find( '.size_1x2' ).length ) {
smallestItemSelector = '.size_1x2';
} else if ( this.$list.find( '.size_2x1' ).length ) {
smallestItemSelector = '.size_2x1';
} else if ( this.$list.find( '.size_2x2' ).length ) {
smallestItemSelector = '.size_2x2';
}
if ( smallestItemSelector ) {
isotopeOptions.masonry = { columnWidth: smallestItemSelector };
}
this.$list.isotope( isotopeOptions );
this.$list.isotope();
if ( this.paginationType == 'ajax' ) {
this.initAjaxPagination();
}
$us.$canvas.on( 'lazyload contentChange', function() {
this.$list.imagesLoaded( function() {
this.$list.isotope( 'layout' );
}.bind( this ) );
}.bind( this ) );
}.bind( this ) );
}.bind( this ) );
} else if ( this.paginationType == 'ajax' ) {
this.initAjaxPagination();
}
this.$filters.each( function( index, filter ) {
var $filter = $( filter ),
taxonomy = $filter.data( 'taxonomy' );
$filter.on( 'click', function() {
if ( taxonomy != this.curFilterTaxonomy ) {
if ( this.loading ) {
return;
}
this.setState( 1, taxonomy );
this.$filters.removeClass( 'active' );
$filter.addClass( 'active' );
}
}.bind( this ) )
}.bind( this ) );
},
initLightboxAnchors: function() {
this.$anchors = this.$list.find( '.w-grid-item-anchor' );
this.$anchors.on( 'click', function( e ) {
var $clicked = $( e.target ),
$item = $clicked.closest( '.w-grid-item' ),
$anchor = $item.find( '.w-grid-item-anchor' ),
itemUrl = $anchor.attr( 'href' );
if ( ! $item.hasClass( 'custom-link' ) ) {
if ( $us.$window.width() >= $us.canvasOptions.disableEffectsWidth ) {
e.stopPropagation();
e.preventDefault();
this.openLightboxItem( itemUrl, $item );
}
}
}.bind( this ) );
},
// Pagination and Filters functions
initAjaxPagination: function() {
this.$loadmore.on( 'click', function() {
if ( this.curPage < this.ajaxData.max_num_pages ) {
this.setState( this.curPage + 1 );
}
}.bind( this ) );
if ( this.infiniteScroll ) {
$us.scroll.addWaypoint( this.$loadmore, '-70%', function() {
this.$loadmore.click();
}.bind( this ) );
}
},
setState: function( page, taxonomy ) {
if ( this.loading ) {
return;
}
this.loading = true;
if ( this.$filters.length ) {
taxonomy = taxonomy || this.curFilterTaxonomy;
if ( taxonomy == '*' ) {
taxonomy = this.initialFilterTaxonomy;
}
if ( taxonomy != '' ) {
var newTaxArgs = {
'taxonomy': this.filterTaxonomyName,
'field': 'slug',
'terms': taxonomy
},
taxQueryFound = false;
if ( this.templateVars.query_args.tax_query == undefined ) {
this.templateVars.query_args.tax_query = [];
} else {
$.each( this.templateVars.query_args.tax_query, function( index, taxArgs ) {
if ( taxArgs != null && taxArgs.taxonomy == this.filterTaxonomyName ) {
this.templateVars.query_args.tax_query[ index ] = newTaxArgs;
taxQueryFound = true;
return false;
}
}.bind( this ) );
}
if ( ! taxQueryFound ) {
this.templateVars.query_args.tax_query.push( newTaxArgs );
}
} else if ( this.templateVars.query_args.tax_query != undefined ) {
$.each( this.templateVars.query_args.tax_query, function( index, taxArgs ) {
if ( taxArgs != null && taxArgs.taxonomy == this.filterTaxonomyName ) {
this.templateVars.query_args.tax_query[ index ] = null;
return false;
}
}.bind( this ) );
}
}
this.templateVars.query_args.paged = page;
if ( this.paginationType == 'ajax' ) {
if ( page == 1 ) {
this.$loadmore.addClass( 'done' );
} else {
this.$loadmore.addClass( 'loading' );
}
}
if ( this.paginationType != 'ajax' || page == 1 ) {
this.$preloader.addClass( 'active' );
if ( this.$list.data( 'isotope' ) ) {
this.$list.isotope( 'remove', this.$container.find( '.w-grid-item' ) );
this.$list.isotope( 'layout' );
} else {
this.$container.find( '.w-grid-item' ).remove();
}
}
this.ajaxData.template_vars = JSON.stringify( this.templateVars );
$.ajax( {
type: 'post',
url: this.ajaxData.ajax_url,
data: this.ajaxData,
success: function( html ) {
var $result = $( html ),
$container = $result.find( '.w-grid-list' ),
$items = $container.children(),
isotope = this.$list.data( 'isotope' ),
smallestItemSelector;
$container.imagesLoaded( function() {
this.beforeAppendItems( $items );
$items.appendTo( this.$list );
$container.remove();
var $sliders = $items.find( '.w-slider' );
this.afterAppendItems( $items );
if ( isotope ) {
isotope.appended( $items );
}
if ( $sliders.length ) {
$us.getScript( $us.templateDirectoryUri + '/framework/js/vendor/royalslider.js', function() {
$sliders.each( function( index, slider ) {
$( slider ).wSlider().find( '.royalSlider' ).data( 'royalSlider' ).ev.on( 'rsAfterInit', function() {
if ( isotope ) {
this.$list.isotope( 'layout' );
}
} );
}.bind( this ) );
}.bind( this ) );
}
if ( isotope ) {
if ( this.$list.find( '.size_1x1' ).length ) {
smallestItemSelector = '.size_1x1';
} else if ( this.$list.find( '.size_1x2' ).length ) {
smallestItemSelector = '.size_1x2';
} else if ( this.$list.find( '.size_2x1' ).length ) {
smallestItemSelector = '.size_2x1';
} else if ( this.$list.find( '.size_2x2' ).length ) {
smallestItemSelector = '.size_2x2';
}
if ( smallestItemSelector && isotope.options.masonry ) {
isotope.options.masonry.columnWidth = smallestItemSelector;
}
this.$list.isotope( 'layout' );
}
if ( this.paginationType == 'ajax' ) {
if ( page == 1 ) {
var $jsonContainer = $result.find( '.w-grid-json' );
if ( $jsonContainer.length ) {
var ajaxData = $jsonContainer[ 0 ].onclick() || {};
this.ajaxData.max_num_pages = ajaxData.max_num_pages || this.ajaxData.max_num_pages;
} else {
this.ajaxData.max_num_pages = 1;
}
}
if ( this.templateVars.query_args.paged >= this.ajaxData.max_num_pages ) {
this.$loadmore.addClass( 'done' );
} else {
this.$loadmore.removeClass( 'done' );
this.$loadmore.removeClass( 'loading' );
}
if ( this.infiniteScroll ) {
$us.scroll.addWaypoint( this.$loadmore, '-70%', function() {
this.$loadmore.click();
}.bind( this ) );
}
}
if ( this.$container.hasClass( 'popup_page' ) ) {
$.each( $items, function( index, item ) {
var $loadedItem = $( item ),
$anchor = $loadedItem.find( '.w-grid-item-anchor' ),
itemUrl = $anchor.attr( 'href' );
if ( ! $loadedItem.hasClass( 'custom-link' ) ) {
$anchor.click( function( e ) {
if ( $us.$window.width() >= $us.canvasOptions.disableEffectsWidth ) {
e.stopPropagation();
e.preventDefault();
this.openLightboxItem( itemUrl, $loadedItem );
}
}.bind( this ) );
}
}.bind( this ) );
}
// Resize canvas to avoid Parallax calculation issues
$us.$canvas.resize();
this.$preloader.removeClass( 'active' );
}.bind( this ) );
this.loading = false;
}.bind( this ),
error: function() {
this.$loadmore.removeClass( 'loading' );
}.bind( this )
} );
this.curPage = page;
this.curFilterTaxonomy = taxonomy;
},
// Lightbox Functions
_hasScrollbar: function() {
return document.documentElement.scrollHeight > document.documentElement.clientHeight;
},
_getScrollbarSize: function() {
if ( $us.scrollbarSize === undefined ) {
var scrollDiv = document.createElement( 'div' );
scrollDiv.style.cssText = 'width: 99px; height: 99px; overflow: scroll; position: absolute; top: -9999px;';
document.body.appendChild( scrollDiv );
$us.scrollbarSize = scrollDiv.offsetWidth - scrollDiv.clientWidth;
document.body.removeChild( scrollDiv );
}
return $us.scrollbarSize;
},
openLightboxItem: function( itemUrl, $item ) {
this.showLightbox();
var $nextItem = $item.nextAll( 'article:visible:not(.custom-link)' ).first(),
$prevItem = $item.prevAll( 'article:visible:not(.custom-link)' ).first();
if ( $nextItem.length != 0 ) {
this.$lightboxNextArrow.show();
this.$lightboxNextArrow.attr( 'title', $nextItem.find( '.w-grid-item-title' ).text() );
this.$lightboxNextArrow.off( 'click' ).click( function( e ) {
var $nextItemAnchor = $nextItem.find( '.w-grid-item-anchor' ),
nextItemUrl = $nextItemAnchor.attr( 'href' );
e.stopPropagation();
e.preventDefault();
this.openLightboxItem( nextItemUrl, $nextItem );
}.bind( this ) );
} else {
this.$lightboxNextArrow.attr( 'title', '' );
this.$lightboxNextArrow.hide();
}
if ( $prevItem.length != 0 ) {
this.$lightboxPrevArrow.show();
this.$lightboxPrevArrow.attr( 'title', $prevItem.find( '.w-grid-item-title' ).text() );
this.$lightboxPrevArrow.off( 'click' ).click( function( e ) {
var $prevItemAnchor = $prevItem.find( '.w-grid-item-anchor' ),
prevItemUrl = $prevItemAnchor.attr( 'href' );
e.stopPropagation();
e.preventDefault();
this.openLightboxItem( prevItemUrl, $prevItem );
}.bind( this ) );
} else {
this.$lightboxPrevArrow.attr( 'title', '' );
this.$lightboxPrevArrow.hide();
}
if ( itemUrl.indexOf( '?' ) !== - 1 ) {
this.$lightboxContentFrame.attr( 'src', itemUrl + '&us_iframe=1' );
} else {
this.$lightboxContentFrame.attr( 'src', itemUrl + '?us_iframe=1' );
}
// Replace window location with item's URL // TODO: bring back history replacement before production
//if (history.replaceState) {
// history.replaceState(null, null, itemUrl);
//}
this.$lightboxContentFrame.load( function() {
this.lightboxContentLoaded();
}.bind( this ) );
},
lightboxContentLoaded: function() {
this.$lightboxContentPreloader.css( 'display', 'none' );
},
showLightbox: function() {
clearTimeout( this.lightboxTimer );
this.$lightboxOverlay.appendTo( $us.$body ).show();
this.$lightboxWrap.appendTo( $us.$body ).show();
this.lightboxOpened = true;
this.$lightboxContentPreloader.css( 'display', 'block' );
// this.$lightboxContentFrame.css('display', 'none');
// this.$lightboxContentFrame.css('width', this.$lightboxContent.width());
$us.$html.addClass( 'usoverlay_fixed' );
if ( ! $.isMobile ) {
// Storing the value for the whole popup visibility session
this.windowHasScrollbar = this._hasScrollbar();
if ( this.windowHasScrollbar && this._getScrollbarSize() ) {
$us.$html.css( 'margin-right', this._getScrollbarSize() );
}
}
this.lightboxTimer = setTimeout( function() {
this.afterShowLightbox();
}.bind( this ), 25 );
},
afterShowLightbox: function() {
clearTimeout( this.lightboxTimer );
this.$lightboxOverlay.addClass( 'active' );
this.$lightboxBox.addClass( 'active' );
$us.$canvas.trigger( 'contentChange' );
$us.$window.trigger( 'resize' );
},
hideLightbox: function() {
clearTimeout( this.lightboxTimer );
this.lightboxOpened = false;
this.$lightboxOverlay.removeClass( 'active' );
this.$lightboxBox.removeClass( 'active' );
// Replace window location back to original URL
if ( history.replaceState ) {
history.replaceState( null, null, this.originalURL );
}
this.lightboxTimer = setTimeout( function() {
this.afterHideLightbox();
}.bind( this ), 500 );
},
afterHideLightbox: function() {
clearTimeout( this.lightboxTimer );
this.$lightboxOverlay.appendTo( this.$container ).hide();
this.$lightboxWrap.appendTo( this.$container ).hide();
this.$lightboxContentFrame.attr( 'src', 'about:blank' );
$us.$html.removeClass( 'usoverlay_fixed' );
if ( ! $.isMobile ) {
if ( this.windowHasScrollbar ) {
$us.$html.css( 'margin-right', '' );
}
}
},
/**
* Overloadable function for themes
* @param $items
*/
beforeAppendItems: function( $items ) {
},
afterAppendItems: function( $items ) {
}
};
$.fn.wGrid = function( options ) {
return this.each( function() {
$( this ).data( 'wGrid', new $us.WGrid( this, options ) );
} );
};
$( '.w-grid-list' ).each( function() {
var $list = $( this );
$us.getScript( $us.templateDirectoryUri + '/framework/js/vendor/magnific-popup.js', function() {
var delegateStr = 'a[ref=magnificPopupGrid]:visible',
popupOptions;
if ( $list.hasClass( 'owl-carousel' ) ) {
delegateStr = '.owl-item:not(.cloned) a[ref=magnificPopupGrid]';
}
popupOptions = {
type: 'image',
delegate: delegateStr,
gallery: {
enabled: true,
navigateByImgClick: true,
preload: [ 0, 1 ],
tPrev: $us.langOptions.magnificPopup.tPrev, // Alt text on left arrow
tNext: $us.langOptions.magnificPopup.tNext, // Alt text on right arrow
tCounter: $us.langOptions.magnificPopup.tCounter // Markup for "1 of 7" counter
},
removalDelay: 300,
mainClass: 'mfp-fade',
fixedContentPos: true
};
$list.magnificPopup( popupOptions );
if ( $list.hasClass( 'owl-carousel' ) ) {
$us.getScript( $us.templateDirectoryUri + '/framework/js/vendor/owl.carousel.js', function() {
$( '.owl-item.cloned' ).click( function( e ) {
e.preventDefault();
e.stopPropagation();
var $gridItem = $( this ).find( '.w-grid-item' ),
id = $gridItem.data( 'id' ),
$originalGridItem = $list.find( '.owl-item:not(.cloned) > .w-grid-item[data-id=' + id + ']' ),
$originalOwlItem = $originalGridItem.parent(),
index = $list.find( '.owl-item:not(.cloned)' ).index( $originalOwlItem );
$list.magnificPopup( 'open', index );
} );
} );
}
} );
} );
} )( jQuery );
@@ -0,0 +1,40 @@
(function($){"use strict";$us.WGrid=function(container,options){this.init(container,options)};$us.WGrid.prototype={init:function(container,options){this.$container=$(container);this.$filters=this.$container.find('.g-filters-item');this.$list=this.$container.find('.w-grid-list');this.$items=this.$container.find('.w-grid-item');this.$pagination=this.$container.find('.pagination');this.$loadmore=this.$container.find('.g-loadmore');this.$preloader=this.$container.find('.w-grid-preloader');this.curFilterTaxonomy='';this.paginationType=this.$pagination.length?'regular':(this.$loadmore.length?'ajax':'none');this.filterTaxonomyName=this.$list.data('filter_taxonomy_name')?this.$list.data('filter_taxonomy_name'):'category';this.loading=!1;if(this.$container.data('gridInit')==1){return}
this.$container.data('gridInit',1);var $jsonContainer=this.$container.find('.w-grid-json');if($jsonContainer.length){this.ajaxData=$jsonContainer[0].onclick()||{};this.ajaxUrl=this.ajaxData.ajax_url||'';$jsonContainer.remove()}
this.carouselSettings=this.ajaxData.carousel_settings;this.breakpoints=this.ajaxData.carousel_breakpoints||{};if(this.$list.hasClass('owl-carousel')){$us.getScript($us.templateDirectoryUri+'/framework/js/vendor/owl.carousel.js',function(){this.carouselOptions={mouseDrag:!jQuery.isMobile,items:parseInt(this.carouselSettings.items),rtl:$('.l-body').hasClass('rtl'),nav:this.carouselSettings.nav,navElement:'div',navText:[this.carouselSettings.navPrev,this.carouselSettings.navNext],dots:this.carouselSettings.dots,loop:this.carouselSettings.center,rewind:!0,center:this.carouselSettings.center,autoplay:this.carouselSettings.autoplay,autoplayTimeout:this.carouselSettings.timeout,autoHeight:this.carouselSettings.autoHeight,slideBy:this.carouselSettings.slideby,smartSpeed:this.carouselSettings.speed,slideTransition:this.carouselSettings.transition,autoplayHoverPause:!0,responsive:this.breakpoints};if(this.carouselSettings.autoplay==1){this.carouselOptions.loop=1}
if(this.carouselSettings.smooth_play==1){this.carouselOptions.slideTransition='linear';this.carouselOptions.autoplaySpeed=this.carouselSettings.timeout;this.carouselOptions.slideBy=1;this.carouselOptions.loop=1}
this.$list.owlCarousel(this.carouselOptions);this.$list.on('changed.owl.carousel',function(event){$(document).trigger('uslazyloadevent')})}.bind(this))}
if(this.$container.hasClass('popup_page')){if(this.ajaxData==undefined){return}
this.lightboxTimer=null;this.$lightboxOverlay=this.$container.find('.l-popup-overlay');this.$lightboxWrap=this.$container.find('.l-popup-wrap');this.$lightboxBox=this.$container.find('.l-popup-box');this.$lightboxContent=this.$container.find('.l-popup-box-content');this.$lightboxContentPreloader=this.$lightboxContent.find('.g-preloader');this.$lightboxContentFrame=this.$container.find('.l-popup-box-content-frame');this.$lightboxNextArrow=this.$container.find('.l-popup-arrow.to_next');this.$lightboxPrevArrow=this.$container.find('.l-popup-arrow.to_prev');this.$container.find('.l-popup-closer').click(function(){this.hideLightbox()}.bind(this));this.$container.find('.l-popup-box').click(function(){this.hideLightbox()}.bind(this));this.$container.find('.l-popup-box-content').click(function(e){e.stopPropagation()}.bind(this));this.originalURL=window.location.href;this.lightboxOpened=!1;if(this.$list.hasClass('owl-carousel')){$us.getScript($us.templateDirectoryUri+'/framework/js/vendor/owl.carousel.js',function(){this.initLightboxAnchors()}.bind(this))}else{this.initLightboxAnchors()}
$(window).on('resize',function(){if(this.lightboxOpened&&$us.$window.width()<$us.canvasOptions.disableEffectsWidth){this.hideLightbox()}}.bind(this))}
if(this.$list.hasClass('owl-carousel')){return}
if(this.paginationType!='none'||this.$filters.length){if(this.ajaxData==undefined){return}
this.templateVars=this.ajaxData.template_vars||{};if(this.filterTaxonomyName){this.initialFilterTaxonomy=this.$list.data('filter_default_taxonomies')?this.$list.data('filter_default_taxonomies').split(','):'';this.curFilterTaxonomy=this.initialFilterTaxonomy}
this.curPage=this.ajaxData.current_page||1;this.perpage=this.ajaxData.perpage||this.$items.length;this.infiniteScroll=this.ajaxData.infinite_scroll||0}
if(this.$container.hasClass('with_isotope')){$us.getScript($us.templateDirectoryUri+'/framework/js/vendor/isotope.js',function(){this.$list.imagesLoaded(function(){var smallestItemSelector,isotopeOptions={itemSelector:'.w-grid-item',layoutMode:(this.$container.hasClass('isotope_fit_rows'))?'fitRows':'masonry',isOriginLeft:!$('.l-body').hasClass('rtl')};if(this.$list.find('.size_1x1').length){smallestItemSelector='.size_1x1'}else if(this.$list.find('.size_1x2').length){smallestItemSelector='.size_1x2'}else if(this.$list.find('.size_2x1').length){smallestItemSelector='.size_2x1'}else if(this.$list.find('.size_2x2').length){smallestItemSelector='.size_2x2'}
if(smallestItemSelector){isotopeOptions.masonry={columnWidth:smallestItemSelector}}
this.$list.isotope(isotopeOptions);this.$list.isotope();if(this.paginationType=='ajax'){this.initAjaxPagination()}
$us.$canvas.on('lazyload contentChange',function(){this.$list.imagesLoaded(function(){this.$list.isotope('layout')}.bind(this))}.bind(this))}.bind(this))}.bind(this))}else if(this.paginationType=='ajax'){this.initAjaxPagination()}
this.$filters.each(function(index,filter){var $filter=$(filter),taxonomy=$filter.data('taxonomy');$filter.on('click',function(){if(taxonomy!=this.curFilterTaxonomy){if(this.loading){return}
this.setState(1,taxonomy);this.$filters.removeClass('active');$filter.addClass('active')}}.bind(this))}.bind(this))},initLightboxAnchors:function(){this.$anchors=this.$list.find('.w-grid-item-anchor');this.$anchors.on('click',function(e){var $clicked=$(e.target),$item=$clicked.closest('.w-grid-item'),$anchor=$item.find('.w-grid-item-anchor'),itemUrl=$anchor.attr('href');if(!$item.hasClass('custom-link')){if($us.$window.width()>=$us.canvasOptions.disableEffectsWidth){e.stopPropagation();e.preventDefault();this.openLightboxItem(itemUrl,$item)}}}.bind(this))},initAjaxPagination:function(){this.$loadmore.on('click',function(){if(this.curPage<this.ajaxData.max_num_pages){this.setState(this.curPage+1)}}.bind(this));if(this.infiniteScroll){$us.scroll.addWaypoint(this.$loadmore,'-70%',function(){this.$loadmore.click()}.bind(this))}},setState:function(page,taxonomy){if(this.loading){return}
this.loading=!0;if(this.$filters.length){taxonomy=taxonomy||this.curFilterTaxonomy;if(taxonomy=='*'){taxonomy=this.initialFilterTaxonomy}
if(taxonomy!=''){var newTaxArgs={'taxonomy':this.filterTaxonomyName,'field':'slug','terms':taxonomy},taxQueryFound=!1;if(this.templateVars.query_args.tax_query==undefined){this.templateVars.query_args.tax_query=[]}else{$.each(this.templateVars.query_args.tax_query,function(index,taxArgs){if(taxArgs!=null&&taxArgs.taxonomy==this.filterTaxonomyName){this.templateVars.query_args.tax_query[index]=newTaxArgs;taxQueryFound=!0;return!1}}.bind(this))}
if(!taxQueryFound){this.templateVars.query_args.tax_query.push(newTaxArgs)}}else if(this.templateVars.query_args.tax_query!=undefined){$.each(this.templateVars.query_args.tax_query,function(index,taxArgs){if(taxArgs!=null&&taxArgs.taxonomy==this.filterTaxonomyName){this.templateVars.query_args.tax_query[index]=null;return!1}}.bind(this))}}
this.templateVars.query_args.paged=page;if(this.paginationType=='ajax'){if(page==1){this.$loadmore.addClass('done')}else{this.$loadmore.addClass('loading')}}
if(this.paginationType!='ajax'||page==1){this.$preloader.addClass('active');if(this.$list.data('isotope')){this.$list.isotope('remove',this.$container.find('.w-grid-item'));this.$list.isotope('layout')}else{this.$container.find('.w-grid-item').remove()}}
this.ajaxData.template_vars=JSON.stringify(this.templateVars);$.ajax({type:'post',url:this.ajaxData.ajax_url,data:this.ajaxData,success:function(html){var $result=$(html),$container=$result.find('.w-grid-list'),$items=$container.children(),isotope=this.$list.data('isotope'),smallestItemSelector;$container.imagesLoaded(function(){this.beforeAppendItems($items);$items.appendTo(this.$list);$container.remove();var $sliders=$items.find('.w-slider');this.afterAppendItems($items);if(isotope){isotope.appended($items)}
if($sliders.length){$us.getScript($us.templateDirectoryUri+'/framework/js/vendor/royalslider.js',function(){$sliders.each(function(index,slider){$(slider).wSlider().find('.royalSlider').data('royalSlider').ev.on('rsAfterInit',function(){if(isotope){this.$list.isotope('layout')}})}.bind(this))}.bind(this))}
if(isotope){if(this.$list.find('.size_1x1').length){smallestItemSelector='.size_1x1'}else if(this.$list.find('.size_1x2').length){smallestItemSelector='.size_1x2'}else if(this.$list.find('.size_2x1').length){smallestItemSelector='.size_2x1'}else if(this.$list.find('.size_2x2').length){smallestItemSelector='.size_2x2'}
if(smallestItemSelector&&isotope.options.masonry){isotope.options.masonry.columnWidth=smallestItemSelector}
this.$list.isotope('layout')}
if(this.paginationType=='ajax'){if(page==1){var $jsonContainer=$result.find('.w-grid-json');if($jsonContainer.length){var ajaxData=$jsonContainer[0].onclick()||{};this.ajaxData.max_num_pages=ajaxData.max_num_pages||this.ajaxData.max_num_pages}else{this.ajaxData.max_num_pages=1}}
if(this.templateVars.query_args.paged>=this.ajaxData.max_num_pages){this.$loadmore.addClass('done')}else{this.$loadmore.removeClass('done');this.$loadmore.removeClass('loading')}
if(this.infiniteScroll){$us.scroll.addWaypoint(this.$loadmore,'-70%',function(){this.$loadmore.click()}.bind(this))}}
if(this.$container.hasClass('popup_page')){$.each($items,function(index,item){var $loadedItem=$(item),$anchor=$loadedItem.find('.w-grid-item-anchor'),itemUrl=$anchor.attr('href');if(!$loadedItem.hasClass('custom-link')){$anchor.click(function(e){if($us.$window.width()>=$us.canvasOptions.disableEffectsWidth){e.stopPropagation();e.preventDefault();this.openLightboxItem(itemUrl,$loadedItem)}}.bind(this))}}.bind(this))}
$us.$canvas.resize();this.$preloader.removeClass('active')}.bind(this));this.loading=!1}.bind(this),error:function(){this.$loadmore.removeClass('loading')}.bind(this)});this.curPage=page;this.curFilterTaxonomy=taxonomy},_hasScrollbar:function(){return document.documentElement.scrollHeight>document.documentElement.clientHeight},_getScrollbarSize:function(){if($us.scrollbarSize===undefined){var scrollDiv=document.createElement('div');scrollDiv.style.cssText='width: 99px; height: 99px; overflow: scroll; position: absolute; top: -9999px;';document.body.appendChild(scrollDiv);$us.scrollbarSize=scrollDiv.offsetWidth-scrollDiv.clientWidth;document.body.removeChild(scrollDiv)}
return $us.scrollbarSize},openLightboxItem:function(itemUrl,$item){this.showLightbox();var $nextItem=$item.nextAll('article:visible:not(.custom-link)').first(),$prevItem=$item.prevAll('article:visible:not(.custom-link)').first();if($nextItem.length!=0){this.$lightboxNextArrow.show();this.$lightboxNextArrow.attr('title',$nextItem.find('.w-grid-item-title').text());this.$lightboxNextArrow.off('click').click(function(e){var $nextItemAnchor=$nextItem.find('.w-grid-item-anchor'),nextItemUrl=$nextItemAnchor.attr('href');e.stopPropagation();e.preventDefault();this.openLightboxItem(nextItemUrl,$nextItem)}.bind(this))}else{this.$lightboxNextArrow.attr('title','');this.$lightboxNextArrow.hide()}
if($prevItem.length!=0){this.$lightboxPrevArrow.show();this.$lightboxPrevArrow.attr('title',$prevItem.find('.w-grid-item-title').text());this.$lightboxPrevArrow.off('click').click(function(e){var $prevItemAnchor=$prevItem.find('.w-grid-item-anchor'),prevItemUrl=$prevItemAnchor.attr('href');e.stopPropagation();e.preventDefault();this.openLightboxItem(prevItemUrl,$prevItem)}.bind(this))}else{this.$lightboxPrevArrow.attr('title','');this.$lightboxPrevArrow.hide()}
if(itemUrl.indexOf('?')!==-1){this.$lightboxContentFrame.attr('src',itemUrl+'&us_iframe=1')}else{this.$lightboxContentFrame.attr('src',itemUrl+'?us_iframe=1')}
this.$lightboxContentFrame.load(function(){this.lightboxContentLoaded()}.bind(this))},lightboxContentLoaded:function(){this.$lightboxContentPreloader.css('display','none')},showLightbox:function(){clearTimeout(this.lightboxTimer);this.$lightboxOverlay.appendTo($us.$body).show();this.$lightboxWrap.appendTo($us.$body).show();this.lightboxOpened=!0;this.$lightboxContentPreloader.css('display','block');$us.$html.addClass('usoverlay_fixed');if(!$.isMobile){this.windowHasScrollbar=this._hasScrollbar();if(this.windowHasScrollbar&&this._getScrollbarSize()){$us.$html.css('margin-right',this._getScrollbarSize())}}
this.lightboxTimer=setTimeout(function(){this.afterShowLightbox()}.bind(this),25)},afterShowLightbox:function(){clearTimeout(this.lightboxTimer);this.$lightboxOverlay.addClass('active');this.$lightboxBox.addClass('active');$us.$canvas.trigger('contentChange');$us.$window.trigger('resize')},hideLightbox:function(){clearTimeout(this.lightboxTimer);this.lightboxOpened=!1;this.$lightboxOverlay.removeClass('active');this.$lightboxBox.removeClass('active');if(history.replaceState){history.replaceState(null,null,this.originalURL)}
this.lightboxTimer=setTimeout(function(){this.afterHideLightbox()}.bind(this),500)},afterHideLightbox:function(){clearTimeout(this.lightboxTimer);this.$lightboxOverlay.appendTo(this.$container).hide();this.$lightboxWrap.appendTo(this.$container).hide();this.$lightboxContentFrame.attr('src','about:blank');$us.$html.removeClass('usoverlay_fixed');if(!$.isMobile){if(this.windowHasScrollbar){$us.$html.css('margin-right','')}}},beforeAppendItems:function($items){},afterAppendItems:function($items){}};$.fn.wGrid=function(options){return this.each(function(){$(this).data('wGrid',new $us.WGrid(this,options))})};$('.w-grid-list').each(function(){var $list=$(this);$us.getScript($us.templateDirectoryUri+'/framework/js/vendor/magnific-popup.js',function(){var delegateStr='a[ref=magnificPopupGrid]:visible',popupOptions;if($list.hasClass('owl-carousel')){delegateStr='.owl-item:not(.cloned) a[ref=magnificPopupGrid]'}
popupOptions={type:'image',delegate:delegateStr,gallery:{enabled:!0,navigateByImgClick:!0,preload:[0,1],tPrev:$us.langOptions.magnificPopup.tPrev,tNext:$us.langOptions.magnificPopup.tNext,tCounter:$us.langOptions.magnificPopup.tCounter},removalDelay:300,mainClass:'mfp-fade',fixedContentPos:!0};$list.magnificPopup(popupOptions);if($list.hasClass('owl-carousel')){$us.getScript($us.templateDirectoryUri+'/framework/js/vendor/owl.carousel.js',function(){$('.owl-item.cloned').click(function(e){e.preventDefault();e.stopPropagation();var $gridItem=$(this).find('.w-grid-item'),id=$gridItem.data('id'),$originalGridItem=$list.find('.owl-item:not(.cloned) > .w-grid-item[data-id='+id+']'),$originalOwlItem=$originalGridItem.parent(),index=$list.find('.owl-item:not(.cloned)').index($originalOwlItem);$list.magnificPopup('open',index)})})}})})})(jQuery)
@@ -0,0 +1,144 @@
/**
* UpSolution Element: Interactive Text
*/
! function( $ ) {
"use strict";
$us.WItext = function( container ) {
this.$container = $( container );
var data = this.$container[ 0 ].onclick() || {};
this.$container.removeAttr( 'onclick' );
this.type = this.$container.usMod( 'type' );
this.animateChars = ( this.type.substring( this.type.length - 5 ) == 'Chars' );
if ( this.animateChars ) {
this.type = this.type.substring( 0, this.type.length - 5 );
}
this.duration = parseInt( data.duration ) || 1000;
this.delay = parseInt( data.delay ) || 5000;
this.dynamicColor = ( data.dynamicColor || '' );
this.$parts = this.$container.find( '.w-itext-part' );
if ( this.$parts.length == 0 ) {
return;
} // No animated parts
this.parts = [];
this.partsStates = []; // part index => text states
this.animateParts = []; // animation index => animated parts indexes
this.$parts.css( {
'-webkit-transition-duration': this.duration + 'ms',
'transition-duration': this.duration + 'ms'
} ).each( function( partIndex, part ) {
this.parts[ partIndex ] = $( part );
this.partsStates[ partIndex ] = part.onclick() || [];
this.parts[ partIndex ].removeAttr( 'onclick' );
$.map( part.className.match( /changesat_[0-9]+/g ), function( elm ) {
var animIndex = parseInt( elm.replace( 'changesat_', '' ) );
if ( this.animateParts[ animIndex ] === undefined ) {
this.animateParts[ animIndex ] = [];
}
this.animateParts[ animIndex ].push( partIndex );
}.bind( this ) );
}.bind( this ) );
this.active = 0;
this.maxActive = this.partsStates[ 0 ].length - 1;
this._events = {
animate: this.animate.bind( this ),
postAnimate: this.postAnimate.bind( this )
};
// Start animation
this.timer = setTimeout( this._events.animate, this.delay );
};
$us.WItext.prototype = {
animate: function() {
var nextState = ( this.active == this.maxActive ) ? 0 : ( this.active + 1 );
for ( var partIndex = 0; partIndex < this.parts.length; partIndex ++ ) {
if ( this.partsStates[ partIndex ][ this.active ] != this.partsStates[ partIndex ][ nextState ] ) {
this.parts[ partIndex ].addClass( 'dynamic' );
if ( this.dynamicColor ) {
this.parts[ partIndex ].css( 'color', this.dynamicColor );
}
this._animatePart( partIndex );
} else {
this.parts[ partIndex ].removeClass( 'dynamic' );
if ( this.dynamicColor ) {
this.parts[ partIndex ].css( 'color', '' );
}
}
}
this.timer = setTimeout( this._events.postAnimate, this.duration + this.delay / 2 );
},
/**
* Animate a certain dynamic part
* @param partIndex
* @private
*/
_animatePart: function( partIndex ) {
// Preparing part for animation
var nextState = ( this.active == this.maxActive ) ? 0 : ( this.active + 1 ),
nextValue = this.partsStates[ partIndex ][ nextState ],
$curSpan = this.parts[ partIndex ].wrapInner( '<span></span>' ).children( 'span' ),
$nextSpan = $( '<span class="measure"></span>' ).html( nextValue.replace( ' ', '&nbsp;' ) ).appendTo( this.parts[ partIndex ] ),
nextWidth = $nextSpan.width(),
outType = ( this.type == 'flipInX' ) ? 'flipOutX' : 'fadeOut',
i;
// Measuring the future part width
this.parts[ partIndex ].addClass( 'notransition' ).css( 'width', this.parts[ partIndex ].width() );
setTimeout( function() {
this.parts[ partIndex ].removeClass( 'notransition' ).css( 'width', nextWidth );
}.bind( this ), 25 );
$curSpan.css( {
position: 'absolute',
left: 0,
top: 0,
'-webkit-transition-duration': ( this.duration / 5 ) + 'ms',
'transition-duration': ( this.duration / 5 ) + 'ms'
} ).addClass( 'animated_' + outType );
$nextSpan.css( 'width', nextWidth ).removeClass( 'measure' ).prependTo( this.parts[ partIndex ] );
if ( this.animateChars ) {
$nextSpan.empty();
var $chars = [],
charDuration = Math.floor( this.duration / nextValue.length );
for ( i = 0; i < nextValue.length; i ++ ) {
$chars.push( $( '<span>' + ( ( nextValue[ i ] != ' ' ) ? nextValue[ i ] : '&nbsp;' ) + '</span>' ).css( {
'-webkit-transition-duration': charDuration + 'ms',
'transition-duration': charDuration + 'ms'
} ).appendTo( $nextSpan ) );
}
$.each( $chars, function( index, char ) {
setTimeout( function() {
$( char ).addClass( 'animated_' + this.type );
}.bind( this ), charDuration * index );
}.bind( this ) );
} else {
$nextSpan.wrapInner( '<span></span>' ).children( 'span' ).css( {
'-webkit-transition-duration': this.duration + 'ms',
'transition-duration': this.duration + 'ms'
} ).addClass( 'animated_' + this.type );
}
setTimeout( this._cleanupPartAnimation.bind( this, partIndex ), this.duration + this.delay / 2 );
},
/**
* Clean up a certain part from animation
* @param partIndex
* @private
*/
_cleanupPartAnimation: function( partIndex ) {
var nextState = ( this.active == this.maxActive ) ? 0 : ( this.active + 1 ),
nextValue = this.partsStates[ partIndex ][ nextState ];
this.parts[ partIndex ].addClass( 'notransition' ).css( 'width', '' ).html( nextValue.replace( ' ', '&nbsp;' ) );
},
postAnimate: function() {
this.active = ( this.active == this.maxActive ) ? 0 : ( this.active + 1 );
this.timer = setTimeout( this._events.animate, this.delay / 2 );
}
};
$.fn.wItext = function( options ) {
return this.each( function() {
$( this ).data( 'wItext', new $us.WItext( this, options ) );
} );
};
$( function() {
$( '.w-itext' ).wItext();
} );
}( jQuery );
@@ -0,0 +1,8 @@
!function($){"use strict";$us.WItext=function(container){this.$container=$(container);var data=this.$container[0].onclick()||{};this.$container.removeAttr('onclick');this.type=this.$container.usMod('type');this.animateChars=(this.type.substring(this.type.length-5)=='Chars');if(this.animateChars){this.type=this.type.substring(0,this.type.length-5)}
this.duration=parseInt(data.duration)||1000;this.delay=parseInt(data.delay)||5000;this.dynamicColor=(data.dynamicColor||'');this.$parts=this.$container.find('.w-itext-part');if(this.$parts.length==0){return}
this.parts=[];this.partsStates=[];this.animateParts=[];this.$parts.css({'-webkit-transition-duration':this.duration+'ms','transition-duration':this.duration+'ms'}).each(function(partIndex,part){this.parts[partIndex]=$(part);this.partsStates[partIndex]=part.onclick()||[];this.parts[partIndex].removeAttr('onclick');$.map(part.className.match(/changesat_[0-9]+/g),function(elm){var animIndex=parseInt(elm.replace('changesat_',''));if(this.animateParts[animIndex]===undefined){this.animateParts[animIndex]=[]}
this.animateParts[animIndex].push(partIndex)}.bind(this))}.bind(this));this.active=0;this.maxActive=this.partsStates[0].length-1;this._events={animate:this.animate.bind(this),postAnimate:this.postAnimate.bind(this)};this.timer=setTimeout(this._events.animate,this.delay)};$us.WItext.prototype={animate:function(){var nextState=(this.active==this.maxActive)?0:(this.active+1);for(var partIndex=0;partIndex<this.parts.length;partIndex ++){if(this.partsStates[partIndex][this.active]!=this.partsStates[partIndex][nextState]){this.parts[partIndex].addClass('dynamic');if(this.dynamicColor){this.parts[partIndex].css('color',this.dynamicColor)}
this._animatePart(partIndex)}else{this.parts[partIndex].removeClass('dynamic');if(this.dynamicColor){this.parts[partIndex].css('color','')}}}
this.timer=setTimeout(this._events.postAnimate,this.duration+this.delay/2)},_animatePart:function(partIndex){var nextState=(this.active==this.maxActive)?0:(this.active+1),nextValue=this.partsStates[partIndex][nextState],$curSpan=this.parts[partIndex].wrapInner('<span></span>').children('span'),$nextSpan=$('<span class="measure"></span>').html(nextValue.replace(' ','&nbsp;')).appendTo(this.parts[partIndex]),nextWidth=$nextSpan.width(),outType=(this.type=='flipInX')?'flipOutX':'fadeOut',i;this.parts[partIndex].addClass('notransition').css('width',this.parts[partIndex].width());setTimeout(function(){this.parts[partIndex].removeClass('notransition').css('width',nextWidth)}.bind(this),25);$curSpan.css({position:'absolute',left:0,top:0,'-webkit-transition-duration':(this.duration/5)+'ms','transition-duration':(this.duration/5)+'ms'}).addClass('animated_'+outType);$nextSpan.css('width',nextWidth).removeClass('measure').prependTo(this.parts[partIndex]);if(this.animateChars){$nextSpan.empty();var $chars=[],charDuration=Math.floor(this.duration/nextValue.length);for(i=0;i<nextValue.length;i ++){$chars.push($('<span>'+((nextValue[i]!=' ')?nextValue[i]:'&nbsp;')+'</span>').css({'-webkit-transition-duration':charDuration+'ms','transition-duration':charDuration+'ms'}).appendTo($nextSpan))}
$.each($chars,function(index,char){setTimeout(function(){$(char).addClass('animated_'+this.type)}.bind(this),charDuration*index)}.bind(this))}else{$nextSpan.wrapInner('<span></span>').children('span').css({'-webkit-transition-duration':this.duration+'ms','transition-duration':this.duration+'ms'}).addClass('animated_'+this.type)}
setTimeout(this._cleanupPartAnimation.bind(this,partIndex),this.duration+this.delay/2)},_cleanupPartAnimation:function(partIndex){var nextState=(this.active==this.maxActive)?0:(this.active+1),nextValue=this.partsStates[partIndex][nextState];this.parts[partIndex].addClass('notransition').css('width','').html(nextValue.replace(' ','&nbsp;'))},postAnimate:function(){this.active=(this.active==this.maxActive)?0:(this.active+1);this.timer=setTimeout(this._events.animate,this.delay/2)}};$.fn.wItext=function(options){return this.each(function(){$(this).data('wItext',new $us.WItext(this,options))})};$(function(){$('.w-itext').wItext()})}(jQuery)
@@ -0,0 +1,187 @@
/**
* UpSolution Element: Leaflet Maps
*
* Used for [us_gmaps] shortcode
*
* Leaflet JS Official Docs https://leafletjs.com/
*/
! function( $ ) {
"use strict";
$us.WLmaps = function( container, options ) {
this.init( container, options );
};
$us.WLmaps.prototype = {
init: function( container, options ) {
this.$container = $( container );
this.mapId = this.$container.attr( 'id' );
var $jsonContainer = this.$container.find( '.w-map-json' ),
jsonOptions = $jsonContainer[ 0 ].onclick() || {},
defaults = {};
$jsonContainer.remove();
this.options = $.extend( {}, defaults, jsonOptions, options );
this._events = {
redraw: this.redraw.bind( this ),
};
$us.$canvas.on( 'contentChange', this._events.redraw );
this.beforeRender();
},
beforeRender: function() {
var matches = this.options.address.match( /^(\d+.\d+)\s?,?\s?(\d+.\d+)$/ );
if ( matches ) {
this.center = [ matches[ 1 ], matches[ 2 ] ];
this.renderMap();
} else {
this.geocoder( this.options.address );
}
},
redraw: function() {
if ( ! this.lmap || this.$container.is( ':hidden' ) ) {
return;
}
this.lmap.invalidateSize( true );
},
geocoder: function( request, markerOptions, popup ) {
var endPoint = "https://nominatim.openstreetmap.org/search?format=json&limit=1&q=",
that = this;
// Get coordinates from the search engine
$.getJSON( endPoint + encodeURI( request ), function( json ) {
// First Success
} ).done( function( json ) {
if ( ! json.length ) {
// Return in case no coordinates were found
return;
}
// Get Coordinates
var bBox = json[ 0 ].boundingbox;
if ( ! markerOptions ) {
// Get coordinates to set map center and add 1st marker
that.center = [ bBox[ 1 ], bBox[ 3 ] ];
that.renderMap();
} else {
that.marker = L.marker( [ bBox[ 1 ], bBox[ 3 ] ], markerOptions ).addTo( that.lmap );
// Add marker popups
if ( popup ) {
that.marker.bindPopup( popup );
}
}
} );
},
renderMap: function() {
var lmapsOptions = {
// Basic Map setup
center: this.center,
zoom: this.options.zoom,
};
if ( this.options.hideControls ) {
// Hide zooming buttons
lmapsOptions.zoomControl = false;
}
if ( this.options.disableZoom ) {
// Disable Mouse Zooming
lmapsOptions.scrollWheelZoom = false;
}
// Main map object
this.lmap = L.map( this.mapId, lmapsOptions );
// Add a Raster layer to the map
L.tileLayer( this.options.style ).addTo( this.lmap );
this.renderMarkers();
if ( this.options.disableDragging && ( ! $us.$html.hasClass( 'no-touch' ) ) ) {
// Disable dragging on mobiles
this.lmap.dragging.disable();
}
},
renderMarkers: function() {
if ( this.options.markers.length ) {
// Add markers
var mainOptions = {};
for ( var i = 0; i < this.options.markers.length; i ++ ) {
if ( i == 0 ) {
// Handle first marker separately
if ( this.options.icon != null ) {
var mainMarkerSizes = this.options.icon.size[ 0 ],
markerImg = L.icon( {
iconUrl: this.options.icon.url,
iconSize: mainMarkerSizes,
} );
// Set icon offset
markerImg.options.iconAnchor = [ mainMarkerSizes / 2, mainMarkerSizes ];
// Set popup offset
markerImg.options.popupAnchor = [ 0, - mainMarkerSizes ];
// Push Marker Icons to Options object
mainOptions.icon = markerImg;
}
// Add main marker with calculated coordinates
var marker = L.marker( this.center, mainOptions ).addTo( this.lmap );
// Add a popup to the 1st marker
if ( this.options.markers[ i ].html ) {
if ( this.options.markers[ i ].infowindow ) {
marker.bindPopup( this.options.markers[ i ].html ).openPopup();
} else {
marker.bindPopup( this.options.markers[ i ].html );
}
}
} else {
var markerOptions = {};
// All markers but first
if ( this.options.markers[ i ].marker_img != null ) {
var markerSizes = this.options.markers[ i ].marker_size[ 0 ],
markerImg = L.icon( {
iconUrl: this.options.markers[ i ].marker_img[ 0 ],
iconSize: markerSizes,
} );
// Set icon offset
markerImg.options.iconAnchor = [ markerSizes / 2, markerSizes ];
// Set popup offset
markerImg.options.popupAnchor = [ 0, - markerSizes ];
markerOptions.icon = markerImg;
} else {
markerOptions = mainOptions;
}
var matches = this.options.markers[ i ].address.match( /^(-?\d+.\d+)\s?,?\s?(-?\d+.\d+)$/ );
if ( matches ) {
this.marker = L.marker( [ matches[ 1 ], matches[ 2 ] ], markerOptions ).addTo( this.lmap );
if ( this.options.markers[ i ].html ) {
// Add a popup if marker has some text
this.marker.bindPopup( this.options.markers[ i ].html )
}
} else {
this.geocoder( this.options.markers[ i ].address, markerOptions, this.options.markers[ i ].html );
}
}
}
}
}
};
$.fn.WLmaps = function( options ) {
return this.each( function() {
$( this ).data( 'wLmaps', new $us.WLmaps( this, options ) );
} );
};
$( function() {
var $wLmap = $( '.w-map.provider_osm' );
if ( $wLmap.length ) {
$us.getScript( $us.templateDirectoryUri + '/framework/js/vendor/leaflet.js', function() {
$wLmap.WLmaps();
} );
}
} );
}( jQuery );
@@ -0,0 +1,7 @@
!function($){"use strict";$us.WLmaps=function(container,options){this.init(container,options)};$us.WLmaps.prototype={init:function(container,options){this.$container=$(container);this.mapId=this.$container.attr('id');var $jsonContainer=this.$container.find('.w-map-json'),jsonOptions=$jsonContainer[0].onclick()||{},defaults={};$jsonContainer.remove();this.options=$.extend({},defaults,jsonOptions,options);this._events={redraw:this.redraw.bind(this),};$us.$canvas.on('contentChange',this._events.redraw);this.beforeRender()},beforeRender:function(){var matches=this.options.address.match(/^(\d+.\d+)\s?,?\s?(\d+.\d+)$/);if(matches){this.center=[matches[1],matches[2]];this.renderMap()}else{this.geocoder(this.options.address)}},redraw:function(){if(!this.lmap||this.$container.is(':hidden')){return}
this.lmap.invalidateSize(!0)},geocoder:function(request,markerOptions,popup){var endPoint="https://nominatim.openstreetmap.org/search?format=json&limit=1&q=",that=this;$.getJSON(endPoint+encodeURI(request),function(json){}).done(function(json){if(!json.length){return}
var bBox=json[0].boundingbox;if(!markerOptions){that.center=[bBox[1],bBox[3]];that.renderMap()}else{that.marker=L.marker([bBox[1],bBox[3]],markerOptions).addTo(that.lmap);if(popup){that.marker.bindPopup(popup)}}})},renderMap:function(){var lmapsOptions={center:this.center,zoom:this.options.zoom,};if(this.options.hideControls){lmapsOptions.zoomControl=!1}
if(this.options.disableZoom){lmapsOptions.scrollWheelZoom=!1}
this.lmap=L.map(this.mapId,lmapsOptions);L.tileLayer(this.options.style).addTo(this.lmap);this.renderMarkers();if(this.options.disableDragging&&(!$us.$html.hasClass('no-touch'))){this.lmap.dragging.disable()}},renderMarkers:function(){if(this.options.markers.length){var mainOptions={};for(var i=0;i<this.options.markers.length;i ++){if(i==0){if(this.options.icon!=null){var mainMarkerSizes=this.options.icon.size[0],markerImg=L.icon({iconUrl:this.options.icon.url,iconSize:mainMarkerSizes,});markerImg.options.iconAnchor=[mainMarkerSizes/2,mainMarkerSizes];markerImg.options.popupAnchor=[0,-mainMarkerSizes];mainOptions.icon=markerImg}
var marker=L.marker(this.center,mainOptions).addTo(this.lmap);if(this.options.markers[i].html){if(this.options.markers[i].infowindow){marker.bindPopup(this.options.markers[i].html).openPopup()}else{marker.bindPopup(this.options.markers[i].html)}}}else{var markerOptions={};if(this.options.markers[i].marker_img!=null){var markerSizes=this.options.markers[i].marker_size[0],markerImg=L.icon({iconUrl:this.options.markers[i].marker_img[0],iconSize:markerSizes,});markerImg.options.iconAnchor=[markerSizes/2,markerSizes];markerImg.options.popupAnchor=[0,-markerSizes];markerOptions.icon=markerImg}else{markerOptions=mainOptions}
var matches=this.options.markers[i].address.match(/^(-?\d+.\d+)\s?,?\s?(-?\d+.\d+)$/);if(matches){this.marker=L.marker([matches[1],matches[2]],markerOptions).addTo(this.lmap);if(this.options.markers[i].html){this.marker.bindPopup(this.options.markers[i].html)}}else{this.geocoder(this.options.markers[i].address,markerOptions,this.options.markers[i].html)}}}}}};$.fn.WLmaps=function(options){return this.each(function(){$(this).data('wLmaps',new $us.WLmaps(this,options))})};$(function(){var $wLmap=$('.w-map.provider_osm');if($wLmap.length){$us.getScript($us.templateDirectoryUri+'/framework/js/vendor/leaflet.js',function(){$wLmap.WLmaps()})}})}(jQuery)
@@ -0,0 +1,397 @@
/**
* $us.nav
*
* Header navigation with all the possible states
*
* @requires $us.canvas
*/
! function( $ ) {
$us.Nav = function( container, options ) {
this.init( container, options );
};
$us.mobileNavOpened = 0;
$us.Nav.prototype = {
init: function( container, options ) {
// Commonly used dom elements
this.$nav = $( container );
if ( this.$nav.length == 0 ) {
return;
}
this.$control = this.$nav.find( '.w-nav-control' );
this.$close = this.$nav.find( '.w-nav-close' );
this.$items = this.$nav.find( '.menu-item' );
this.$list = this.$nav.find( '.w-nav-list.level_1' );
this.$subItems = this.$list.find( '.menu-item-has-children' );
this.$subAnchors = this.$list.find( '.menu-item-has-children > .w-nav-anchor' );
this.$subLists = this.$list.find( '.menu-item-has-children > .w-nav-list' );
this.$anchors = this.$nav.find( '.w-nav-anchor' );
this.$arrows = $( '.w-nav-arrow' );
var adminBar = $( '#wpadminbar' );
this.adminBarHeight = ( adminBar.length ) ? adminBar.height() : 0;
// Setting options
this.options = this.$nav.find( '.w-nav-options:first' )[ 0 ].onclick() || {};
// In case the nav doesn't exist, do nothing
if ( this.$nav.length == 0 ) {
return;
}
this.type = this.$nav.usMod( 'type' );
this.layout = this.$nav.usMod( 'layout' );
this.mobileOpened = false;
// Mobile menu toggler
this.$control.on( 'click', function() {
this.mobileOpened = ! this.mobileOpened;
if ( ! this.options.mobileBehavior ) {
// Making arrows focusable
this.$arrows.attr( 'tabindex', 0 );
}
this.$anchors.each( function() {
// Making empty links focusable and clickable to open a dropdown
if ( $( this ).attr( 'href' ) == undefined ) {
$( this ).attr( 'href', 'javascript:void(0)' );
}
} );
if ( this.layout != 'dropdown' ) {
this.$anchors.removeAttr( 'tabindex' );
}
if ( this.mobileOpened ) {
// Closing all other menus if present
$( '.l-header .w-nav' ).not( container ).each( function() {
$( this ).trigger( 'USNavClose' );
} );
// Closing opened sublists
this.$control.addClass( 'active' );
this.$items.filter( '.opened' ).removeClass( 'opened' );
this.$subLists.resetInlineCSS( 'display', 'height' );
if ( this.layout == 'dropdown' ) {
this.$list.slideDownCSS( 250, this._events.contentChanged );
}
$us.mobileNavOpened ++;
} else {
this.$control.removeClass( 'active' );
if ( this.layout == 'dropdown' ) {
this.$list.slideUpCSS( 250, this._events.contentChanged );
}
if ( ! this.options.mobileBehavior ) {
this.$arrows.removeAttr( 'tabindex' );
}
if ( this.layout != 'dropdown' ) {
this.$anchors.attr( 'tabindex', - 1 );
}
$us.mobileNavOpened --;
}
$us.$canvas.trigger( 'contentChange' );
}.bind( this ) );
this.$control.on( 'focusin', function( e ) {
if ( this.type != 'mobile' || this.layout == 'dropdown' ) {
return;
}
this.$anchors.attr( 'tabindex', - 1 );
}.bind( this ) );
// Close
this.$close.on( 'click', function() {
this.mobileOpened = false;
this.$control.removeClass( 'active' );
$us.mobileNavOpened --;
$us.$canvas.trigger( 'contentChange' );
}.bind( this ) );
// Close on ESC key pressed
$us.$document.keyup( function( e ) {
if ( e.keyCode == 27 ) {
if ( this.mobileOpened ) {
if ( this.layout == 'dropdown' ) {
this.$list.slideUpCSS( 250, this._events.contentChanged );
}
this.mobileOpened = false;
this.$control.removeClass( 'active' );
if ( ! this.options.mobileBehavior ) {
this.$arrows.removeAttr( 'tabindex' );
}
if ( this.layout != 'dropdown' ) {
this.$anchors.attr( 'tabindex', - 1 );
}
$us.mobileNavOpened --;
$us.$canvas.trigger( 'contentChange' );
}
}
}.bind( this ) );
// Bindable events
this._events = {
// Mobile submenu togglers
menuToggler: function( $item, show ) {
if ( this.type != 'mobile' ) {
return;
}
var $sublist = $item.children( '.w-nav-list' );
if ( show ) {
$item.addClass( 'opened' );
$sublist.slideDownCSS( 250, this._events.contentChanged );
} else {
$item.removeClass( 'opened' );
$sublist.slideUpCSS( 250, this._events.contentChanged );
}
}.bind( this ),
focusHandler: function( e ) {
if ( this.type == 'mobile' ) {
return;
}
var $item = $( e.target ).closest( '.menu-item' ),
$target = $( e.target );
$item.parents( '.menu-item' ).addClass( 'opened' );
$item.on( 'mouseleave', function() {
$target.blur();
} );
}.bind( this ),
blurHandler: function( e ) {
if ( this.type == 'mobile' ) {
return;
}
var $item = $( e.target ).closest( '.menu-item' );
$item.parents( '.menu-item' ).removeClass( 'opened' );
}.bind( this ),
clickHandler: function( e ) {
if ( this.type != 'mobile' ) {
return;
}
e.stopPropagation();
e.preventDefault();
var $item = $( e.currentTarget ).closest( '.menu-item' ),
isOpened = $item.hasClass( 'opened' );
this._events.menuToggler( $item, ! isOpened );
}.bind( this ),
keyDownHandler: function( e ) {
if ( this.type != 'mobile' ) {
return;
}
var keyCode = e.keyCode || e.which;
// Enter Handler for arrows
if ( keyCode == 13 ) {
var $target = $( e.target ),
$item = $target.closest( '.menu-item' ),
isOpened = $item.hasClass( 'opened' );
if ( ! $target.is( this.$arrows ) ) {
return;
}
e.stopPropagation();
e.preventDefault();
this._events.menuToggler( $item, ! isOpened );
}
// Tab handler
if ( keyCode == 9 ) {
var $target = $( e.target ) ? $( e.target ) : {},
i = this.$anchors.index( $target ),
isDropdownLayout = this.layout == 'dropdown' ? true : false,
closeMenu = function() {
// Close whole dropdown when going outside
if ( this.mobileOpened ) {
if ( isDropdownLayout ) {
this.$list.slideUpCSS( 250, this._events.contentChanged );
}
this.mobileOpened = false;
this.$control.removeClass( 'active' );
$us.mobileNavOpened --;
$us.$canvas.trigger( 'contentChange' );
if ( ! this.options.mobileBehavior ) {
this.$arrows.removeAttr( 'tabindex' );
}
if ( this.layout != 'dropdown' ) {
this.$anchors.attr( 'tabindex', - 1 );
}
}
}.bind( this );
if ( e.shiftKey ) {
if ( ( i === this.$anchors.length - 1 ) && this.layout != 'dropdown' ) {
this.$anchors.attr( 'tabindex', - 1 );
}
if ( i === 0 ) {
closeMenu();
}
} else {
if ( i === this.$anchors.length - 1 ) {
closeMenu();
}
}
}
}.bind( this ),
resize: this.resize.bind( this ),
contentChanged: function() {
if ( this.type == 'mobile' && $us.header.orientation == 'hor' && $us.canvas.headerPos == 'fixed' && this.layout == 'fixed' ) {
this.setFixedMobileMaxHeight();
}
$us.header.$container.trigger( 'contentChange' );
}.bind( this ),
close: function() {
if ( this.$list != undefined && jQuery.fn.slideUpCSS != undefined && this.mobileOpened && this.type == 'mobile' ) {
this.mobileOpened = false;
if ( this.layout == 'dropdown' && this.headerOrientation == 'hor' ) {
this.$list.slideUpCSS( 250 );
}
$us.mobileNavOpened --;
$us.$canvas.trigger( 'contentChange' );
}
}.bind( this )
};
// Toggle on item clicks
if ( this.options.mobileBehavior ) {
this.$subAnchors.on( 'click', this._events.clickHandler );
}
// Toggle on arrows
else {
this.$list.find( '.menu-item-has-children > .w-nav-anchor > .w-nav-arrow' ).on( 'click', this._events.clickHandler );
this.$list.find( '.menu-item-has-children > .w-nav-anchor > .w-nav-arrow' ).on( 'click', this._events.keyDownHandler );
}
// Mark all the togglable items
this.$subItems.each( function() {
var $this = $( this ),
$parentItem = $this.parent().closest( '.menu-item' );
if ( $parentItem.length == 0 || $parentItem.usMod( 'columns' ) === false ) {
$this.addClass( 'togglable' );
}
} );
// Touch screen handling for desktop type
if ( ! $us.$html.hasClass( 'no-touch' ) ) {
this.$list.find( '.menu-item-has-children.togglable > .w-nav-anchor' ).on( 'click', function( e ) {
if ( this.type == 'mobile' ) {
return;
}
e.preventDefault();
var $this = $( e.currentTarget ),
$item = $this.parent(),
$list = $item.children( '.w-nav-list' );
// Second tap: going to the URL
if ( $item.hasClass( 'opened' ) ) {
return location.assign( $this.attr( 'href' ) );
}
$item.addClass( 'opened' );
var outsideClickEvent = function( e ) {
if ( $.contains( $item[ 0 ], e.target ) ) {
return;
}
$item.removeClass( 'opened' );
$us.$body.off( 'touchstart', outsideClickEvent );
};
$us.$body.on( 'touchstart', outsideClickEvent );
}.bind( this ) );
}
// Close on click outside of level 1 menu list
$( $us.$document ).on( 'mouseup touchend', function( e ) {
if ( this.mobileOpened && this.type == 'mobile' ) {
if ( ! this.$control.is( e.target ) && this.$control.has( e.target ).length === 0 && ! this.$list.is( e.target ) && this.$list.has( e.target ).length === 0 ) {
this.mobileOpened = false;
this.$control.removeClass( 'active' );
this.$items.filter( '.opened' ).removeClass( 'opened' );
this.$subLists.slideUpCSS( 250 );
if ( this.layout == 'dropdown' && this.headerOrientation == 'hor' ) {
this.$list.slideUpCSS( 250 );
}
$us.mobileNavOpened --;
$us.$canvas.trigger( 'contentChange' );
}
}
}.bind( this ) );
// Accessibility
this.$anchors.on( 'focus.upsolution', this._events.focusHandler );
this.$anchors.on( 'blur.upsolution', this._events.blurHandler );
this.$nav.on( 'keydown.upsolution', this._events.keyDownHandler );
// Close menu on anchor clicks
this.$anchors.on( 'click', function( e ) {
if ( this.type != 'mobile' || $us.header.orientation != 'hor' ) {
return;
}
// Toggled the item
if ( this.options.mobileBehavior && $( e.currentTarget ).closest( '.menu-item' ).hasClass( 'menu-item-has-children' ) ) {
return;
}
this.mobileOpened = false;
this.$control.removeClass( 'active' );
if ( this.layout == 'dropdown' ) {
this.$list.slideUpCSS( 250 );
}
$us.mobileNavOpened --;
$us.$canvas.trigger( 'contentChange' );
}.bind( this ) );
$us.$window.on( 'resize', this._events.resize );
setTimeout( function() {
this.resize();
$us.header.$container.trigger( 'contentChange' );
}.bind( this ), 50 );
this.$nav.on( 'USNavClose', this._events.close );
},
/**
* Count proper dimensions
*/
setFixedMobileMaxHeight: function() {
//var listTop = Math.min(this.$list.position().top, $us.header.scrolledOccupiedHeight);
this.$list.css( 'max-height', $us.canvas.winHeight - this.adminBarHeight - $us.header.scrolledOccupiedHeight + 'px' );
},
/**
* Resize handler
*/
resize: function() {
if ( this.$nav.length == 0 ) {
return;
}
var nextType = ( window.innerWidth < this.options.mobileWidth ) ? 'mobile' : 'desktop';
if ( $us.header.orientation != this.headerOrientation || nextType != this.type ) {
// Clearing the previous state
this.$subLists.resetInlineCSS( 'display', 'height' );
if ( this.headerOrientation == 'hor' && this.type == 'mobile' ) {
this.$list.resetInlineCSS( 'display', 'height', 'max-height', 'opacity' );
}
// Closing opened sublists
this.$items.removeClass( 'opened' );
this.headerOrientation = $us.header.orientation;
this.type = nextType;
this.$nav.usMod( 'type', nextType );
if ( ! this.options.mobileBehavior ) {
this.$arrows.removeAttr( 'tabindex' );
}
if ( this.layout != 'dropdown' ) {
this.$anchors.removeAttr( 'tabindex' );
}
}
// Max-height limitation for fixed header layouts
var adminBar = $( '#wpadminbar' ),
isHeaderFixed = this.$nav.closest( 'header' ).hasClass( 'pos_fixed' );
this.adminBarHeight = ( adminBar.length ) ? adminBar.height() : 0;
if ( $us.header.orientation == 'hor' && this.type == 'mobile' && this.layout == 'dropdown' && isHeaderFixed ) {
this.setFixedMobileMaxHeight();
}
this.$list.removeClass( 'hide_for_mobiles' );
}
};
$.fn.usNav = function( options ) {
return this.each( function() {
$( this ).data( 'usNav', new $us.Nav( this, options ) );
} );
};
$( '.l-header .w-nav' ).usNav();
}( jQuery );
@@ -0,0 +1,41 @@
!function($){$us.Nav=function(container,options){this.init(container,options)};$us.mobileNavOpened=0;$us.Nav.prototype={init:function(container,options){this.$nav=$(container);if(this.$nav.length==0){return}
this.$control=this.$nav.find('.w-nav-control');this.$close=this.$nav.find('.w-nav-close');this.$items=this.$nav.find('.menu-item');this.$list=this.$nav.find('.w-nav-list.level_1');this.$subItems=this.$list.find('.menu-item-has-children');this.$subAnchors=this.$list.find('.menu-item-has-children > .w-nav-anchor');this.$subLists=this.$list.find('.menu-item-has-children > .w-nav-list');this.$anchors=this.$nav.find('.w-nav-anchor');this.$arrows=$('.w-nav-arrow');var adminBar=$('#wpadminbar');this.adminBarHeight=(adminBar.length)?adminBar.height():0;this.options=this.$nav.find('.w-nav-options:first')[0].onclick()||{};if(this.$nav.length==0){return}
this.type=this.$nav.usMod('type');this.layout=this.$nav.usMod('layout');this.mobileOpened=!1;this.$control.on('click',function(){this.mobileOpened=!this.mobileOpened;if(!this.options.mobileBehavior){this.$arrows.attr('tabindex',0)}
this.$anchors.each(function(){if($(this).attr('href')==undefined){$(this).attr('href','javascript:void(0)')}});if(this.layout!='dropdown'){this.$anchors.removeAttr('tabindex')}
if(this.mobileOpened){$('.l-header .w-nav').not(container).each(function(){$(this).trigger('USNavClose')});this.$control.addClass('active');this.$items.filter('.opened').removeClass('opened');this.$subLists.resetInlineCSS('display','height');if(this.layout=='dropdown'){this.$list.slideDownCSS(250,this._events.contentChanged)}
$us.mobileNavOpened ++}else{this.$control.removeClass('active');if(this.layout=='dropdown'){this.$list.slideUpCSS(250,this._events.contentChanged)}
if(!this.options.mobileBehavior){this.$arrows.removeAttr('tabindex')}
if(this.layout!='dropdown'){this.$anchors.attr('tabindex',-1)}
$us.mobileNavOpened --}
$us.$canvas.trigger('contentChange')}.bind(this));this.$control.on('focusin',function(e){if(this.type!='mobile'||this.layout=='dropdown'){return}
this.$anchors.attr('tabindex',-1)}.bind(this));this.$close.on('click',function(){this.mobileOpened=!1;this.$control.removeClass('active');$us.mobileNavOpened --;$us.$canvas.trigger('contentChange')}.bind(this));$us.$document.keyup(function(e){if(e.keyCode==27){if(this.mobileOpened){if(this.layout=='dropdown'){this.$list.slideUpCSS(250,this._events.contentChanged)}
this.mobileOpened=!1;this.$control.removeClass('active');if(!this.options.mobileBehavior){this.$arrows.removeAttr('tabindex')}
if(this.layout!='dropdown'){this.$anchors.attr('tabindex',-1)}
$us.mobileNavOpened --;$us.$canvas.trigger('contentChange')}}}.bind(this));this._events={menuToggler:function($item,show){if(this.type!='mobile'){return}
var $sublist=$item.children('.w-nav-list');if(show){$item.addClass('opened');$sublist.slideDownCSS(250,this._events.contentChanged)}else{$item.removeClass('opened');$sublist.slideUpCSS(250,this._events.contentChanged)}}.bind(this),focusHandler:function(e){if(this.type=='mobile'){return}
var $item=$(e.target).closest('.menu-item'),$target=$(e.target);$item.parents('.menu-item').addClass('opened');$item.on('mouseleave',function(){$target.blur()})}.bind(this),blurHandler:function(e){if(this.type=='mobile'){return}
var $item=$(e.target).closest('.menu-item');$item.parents('.menu-item').removeClass('opened')}.bind(this),clickHandler:function(e){if(this.type!='mobile'){return}
e.stopPropagation();e.preventDefault();var $item=$(e.currentTarget).closest('.menu-item'),isOpened=$item.hasClass('opened');this._events.menuToggler($item,!isOpened)}.bind(this),keyDownHandler:function(e){if(this.type!='mobile'){return}
var keyCode=e.keyCode||e.which;if(keyCode==13){var $target=$(e.target),$item=$target.closest('.menu-item'),isOpened=$item.hasClass('opened');if(!$target.is(this.$arrows)){return}
e.stopPropagation();e.preventDefault();this._events.menuToggler($item,!isOpened)}
if(keyCode==9){var $target=$(e.target)?$(e.target):{},i=this.$anchors.index($target),isDropdownLayout=this.layout=='dropdown'?!0:!1,closeMenu=function(){if(this.mobileOpened){if(isDropdownLayout){this.$list.slideUpCSS(250,this._events.contentChanged)}
this.mobileOpened=!1;this.$control.removeClass('active');$us.mobileNavOpened --;$us.$canvas.trigger('contentChange');if(!this.options.mobileBehavior){this.$arrows.removeAttr('tabindex')}
if(this.layout!='dropdown'){this.$anchors.attr('tabindex',-1)}}}.bind(this);if(e.shiftKey){if((i===this.$anchors.length-1)&&this.layout!='dropdown'){this.$anchors.attr('tabindex',-1)}
if(i===0){closeMenu()}}else{if(i===this.$anchors.length-1){closeMenu()}}}}.bind(this),resize:this.resize.bind(this),contentChanged:function(){if(this.type=='mobile'&&$us.header.orientation=='hor'&&$us.canvas.headerPos=='fixed'&&this.layout=='fixed'){this.setFixedMobileMaxHeight()}
$us.header.$container.trigger('contentChange')}.bind(this),close:function(){if(this.$list!=undefined&&jQuery.fn.slideUpCSS!=undefined&&this.mobileOpened&&this.type=='mobile'){this.mobileOpened=!1;if(this.layout=='dropdown'&&this.headerOrientation=='hor'){this.$list.slideUpCSS(250)}
$us.mobileNavOpened --;$us.$canvas.trigger('contentChange')}}.bind(this)};if(this.options.mobileBehavior){this.$subAnchors.on('click',this._events.clickHandler)}
else{this.$list.find('.menu-item-has-children > .w-nav-anchor > .w-nav-arrow').on('click',this._events.clickHandler);this.$list.find('.menu-item-has-children > .w-nav-anchor > .w-nav-arrow').on('click',this._events.keyDownHandler)}
this.$subItems.each(function(){var $this=$(this),$parentItem=$this.parent().closest('.menu-item');if($parentItem.length==0||$parentItem.usMod('columns')===!1){$this.addClass('togglable')}});if(!$us.$html.hasClass('no-touch')){this.$list.find('.menu-item-has-children.togglable > .w-nav-anchor').on('click',function(e){if(this.type=='mobile'){return}
e.preventDefault();var $this=$(e.currentTarget),$item=$this.parent(),$list=$item.children('.w-nav-list');if($item.hasClass('opened')){return location.assign($this.attr('href'))}
$item.addClass('opened');var outsideClickEvent=function(e){if($.contains($item[0],e.target)){return}
$item.removeClass('opened');$us.$body.off('touchstart',outsideClickEvent)};$us.$body.on('touchstart',outsideClickEvent)}.bind(this))}
$($us.$document).on('mouseup touchend',function(e){if(this.mobileOpened&&this.type=='mobile'){if(!this.$control.is(e.target)&&this.$control.has(e.target).length===0&&!this.$list.is(e.target)&&this.$list.has(e.target).length===0){this.mobileOpened=!1;this.$control.removeClass('active');this.$items.filter('.opened').removeClass('opened');this.$subLists.slideUpCSS(250);if(this.layout=='dropdown'&&this.headerOrientation=='hor'){this.$list.slideUpCSS(250)}
$us.mobileNavOpened --;$us.$canvas.trigger('contentChange')}}}.bind(this));this.$anchors.on('focus.upsolution',this._events.focusHandler);this.$anchors.on('blur.upsolution',this._events.blurHandler);this.$nav.on('keydown.upsolution',this._events.keyDownHandler);this.$anchors.on('click',function(e){if(this.type!='mobile'||$us.header.orientation!='hor'){return}
if(this.options.mobileBehavior&&$(e.currentTarget).closest('.menu-item').hasClass('menu-item-has-children')){return}
this.mobileOpened=!1;this.$control.removeClass('active');if(this.layout=='dropdown'){this.$list.slideUpCSS(250)}
$us.mobileNavOpened --;$us.$canvas.trigger('contentChange')}.bind(this));$us.$window.on('resize',this._events.resize);setTimeout(function(){this.resize();$us.header.$container.trigger('contentChange')}.bind(this),50);this.$nav.on('USNavClose',this._events.close)},setFixedMobileMaxHeight:function(){this.$list.css('max-height',$us.canvas.winHeight-this.adminBarHeight-$us.header.scrolledOccupiedHeight+'px')},resize:function(){if(this.$nav.length==0){return}
var nextType=(window.innerWidth<this.options.mobileWidth)?'mobile':'desktop';if($us.header.orientation!=this.headerOrientation||nextType!=this.type){this.$subLists.resetInlineCSS('display','height');if(this.headerOrientation=='hor'&&this.type=='mobile'){this.$list.resetInlineCSS('display','height','max-height','opacity')}
this.$items.removeClass('opened');this.headerOrientation=$us.header.orientation;this.type=nextType;this.$nav.usMod('type',nextType);if(!this.options.mobileBehavior){this.$arrows.removeAttr('tabindex')}
if(this.layout!='dropdown'){this.$anchors.removeAttr('tabindex')}}
var adminBar=$('#wpadminbar'),isHeaderFixed=this.$nav.closest('header').hasClass('pos_fixed');this.adminBarHeight=(adminBar.length)?adminBar.height():0;if($us.header.orientation=='hor'&&this.type=='mobile'&&this.layout=='dropdown'&&isHeaderFixed){this.setFixedMobileMaxHeight()}
this.$list.removeClass('hide_for_mobiles')}};$.fn.usNav=function(options){return this.each(function(){$(this).data('usNav',new $us.Nav(this,options))})};$('.l-header .w-nav').usNav()}(jQuery)
@@ -0,0 +1,28 @@
/**
* UpSolution Element: Message
*/
( function( $ ) {
"use strict";
$.fn.usMessage = function() {
return this.each( function() {
var $this = $( this ),
$closer = $this.find( '.w-message-close' );
$closer.click( function() {
$this.wrap( '<div></div>' );
var $wrapper = $this.parent();
$wrapper.css( { overflow: 'hidden', height: $this.outerHeight( true ) } );
$wrapper.performCSSTransition( {
height: 0
}, 300, function() {
$wrapper.remove();
$us.$canvas.trigger( 'contentChange' );
}, 'cubic-bezier(.4,0,.2,1)' );
} );
} );
};
$( function() {
$( '.w-message' ).usMessage();
} );
} )( jQuery );
@@ -0,0 +1 @@
(function($){"use strict";$.fn.usMessage=function(){return this.each(function(){var $this=$(this),$closer=$this.find('.w-message-close');$closer.click(function(){$this.wrap('<div></div>');var $wrapper=$this.parent();$wrapper.css({overflow:'hidden',height:$this.outerHeight(!0)});$wrapper.performCSSTransition({height:0},300,function(){$wrapper.remove();$us.$canvas.trigger('contentChange')},'cubic-bezier(.4,0,.2,1)')})})};$(function(){$('.w-message').usMessage()})})(jQuery)
@@ -0,0 +1,279 @@
/**
* UpSolution Element: Page Scroller
*/
( function( $ ) {
"use strict";
$us.PageScroller = function( container, options ) {
this.init( container, options );
};
$us.PageScroller.prototype = {
init: function( container, options ) {
var defaults = {
coolDown: 100,
animationDuration: 1000,
animationEasing: 'easeInOutExpo'
},
scrollTop = parseInt( $us.$window.scrollTop() );
this.options = $.extend( {}, defaults, options );
this.$container = $( container );
this._canvasTopOffset = $us.$canvas.offset().top;
this.activeSection = 0;
this.sections = [];
this.dots = [];
this.scrolls = [];
this.usingDots = false;
this.isTouch = ( ( 'ontouchstart' in window ) || ( navigator.msMaxTouchPoints > 0 ) || ( navigator.maxTouchPoints ) );
this.disableWidth = ( this.$container.data( 'disablewidth' ) !== undefined ) ? this.$container.data( 'disablewidth' ) : 768;
if ( this.$container.data( 'speed' ) !== undefined ) {
this.options.animationDuration = this.$container.data( 'speed' );
}
// Adding header if isn't sticky
if ( $us.canvas.headerPos == 'static' && $us.header.orientation == 'hor' ) {
$us.canvas.$header.each( function() {
var $section = $us.canvas.$header,
section = {
$section: $section
};
this._countPosition( section );
this.sections.push( section );
}.bind( this ) );
}
// Adding canvas sections
$us.$canvas.find( '.l-section' ).each( function( key, elm ) {
var $section = $( elm ),
section = {
$section: $section
};
this._countPosition( section );
this.sections.push( section );
}.bind( this ) );
// Adding dots for canvas sections
this.$dotsContainer = this.$container.find( '.w-scroller-dots' );
if ( this.$dotsContainer.length ) {
this.usingDots = true;
this.$firstDot = this.$dotsContainer.find( '.w-scroller-dot' ).first();
for ( var i = 1; i < this.sections.length; i ++ ) {
this.$firstDot.clone().appendTo( this.$dotsContainer );
}
this.$dots = this.$dotsContainer.find( '.w-scroller-dot' );
this.$dots.each( function( key, elm ) {
var $dot = $( elm );
this.dots[ key ] = $dot;
$dot.click( function() {
this.scrollTo( key );
this.$dots.removeClass( 'active' );
$dot.addClass( 'active' );
}.bind( this ) );
}.bind( this ) );
this.dots[ this.activeSection ].addClass( 'active' );
this.$dotsContainer.addClass( 'show' );
}
// Adding footer sections
$( '.l-footer > .l-section' ).each( function( key, elm ) {
var $section = $( elm ),
section = {
$section: $section
};
this._countPosition( section );
this.sections.push( section );
}.bind( this ) );
this._attachEvents();
// Boundable events
this._events = {
scroll: this.scroll.bind( this ),
resize: this.resize.bind( this )
};
$us.$canvas.on( 'contentChange', this._events.resize );
$us.$window.on( 'resize load', this._events.resize );
$us.$window.on( 'resize load scroll', this._events.scroll );
setTimeout( this._events.resize, 100 );
},
getScrollSpeed: function( number ) {
var sum = 0;
var lastElements = this.scrolls.slice( Math.max( this.scrolls.length - number, 1 ) );
for ( var i = 0; i < lastElements.length; i ++ ) {
sum = sum + lastElements[ i ];
}
return Math.ceil( sum / number );
},
_attachEvents: function() {
$us.$document.off( 'mousewheel DOMMouseScroll MozMousePixelScroll' );
$us.$canvas.off( 'touchstart touchmove' );
if ( $us.$window.width() > this.disableWidth && $us.mobileNavOpened <= 0 && ( ! $us.$html.hasClass( 'cloverlay_fixed' ) ) ) {
$us.$document.on( 'mousewheel DOMMouseScroll MozMousePixelScroll', function( e ) {
e.preventDefault();
var currentTime = new Date().getTime(),
target = this.activeSection,
direction = e.originalEvent.wheelDelta || - e.originalEvent.detail,
speedEnd, speedMiddle, isAccelerating;
if ( this.scrolls.length > 149 ) {
this.scrolls.shift();
}
this.scrolls.push( Math.abs( direction ) );
if ( ( currentTime - this.previousMouseWheelTime ) > this.options.coolDown ) {
this.scrolls = [];
}
this.previousMouseWheelTime = currentTime;
speedEnd = this.getScrollSpeed( 10 );
speedMiddle = this.getScrollSpeed( 70 );
isAccelerating = speedEnd >= speedMiddle;
if ( isAccelerating ) {
if ( direction < 0 ) {
target ++;
} else if ( direction > 0 ) {
target --;
}
if ( this.sections[ target ] == undefined ) {
return;
}
this.scrollTo( target );
this.lastScroll = currentTime;
}
}.bind( this ) );
if ( $.isMobile || this.isTouch ) {
$us.$canvas.on( 'touchstart', function( event ) {
var e = event.originalEvent;
if ( typeof e.pointerType === 'undefined' || e.pointerType != 'mouse' ) {
this.touchStartY = e.touches[ 0 ].pageY;
}
}.bind( this ) );
$us.$canvas.on( 'touchmove', function( event ) {
event.preventDefault();
var currentTime = new Date().getTime(),
e = event.originalEvent,
target = this.activeSection;
this.touchEndY = e.touches[ 0 ].pageY;
if ( Math.abs( this.touchStartY - this.touchEndY ) > ( $us.$window.height() / 50 ) ) {
if ( this.touchStartY > this.touchEndY ) {
target ++;
} else if ( this.touchEndY > this.touchStartY ) {
target --;
}
if ( this.sections[ target ] == undefined ) {
return;
}
this.scrollTo( target );
this.lastScroll = currentTime;
}
}.bind( this ) );
}
}
},
_countPosition: function( section ) {
section.top = section.$section.offset().top - this._canvasTopOffset;
if ( $us.header.headerTop === undefined || ( $us.header.headerTop > 0 && section.top > $us.header.headerTop ) ) {
section.top = section.top - $us.header.scrolledOccupiedHeight;
}
section.bottom = section.top + section.$section.outerHeight( false );
},
_countAllPositions: function() {
for ( var section in this.sections ) {
if ( this.sections[ section ].$section.length ) {
this._countPosition( this.sections[ section ] );
}
}
},
scrollTo: function( target ) {
var currentTime = new Date().getTime();
if ( this.previousScrollTime !== undefined && ( currentTime - this.previousScrollTime < this.options.animationDuration ) ) {
return;
}
this.previousScrollTime = currentTime;
if ( this.usingDots ) {
this.$dots.removeClass( 'active' );
if ( this.dots[ target ] !== undefined ) {
this.dots[ target ].addClass( 'active' );
}
}
$us.$htmlBody.stop( true, false ).animate( {
scrollTop: this.sections[ target ][ 'top' ] + 'px'
}, {
duration: this.options.animationDuration,
easing: this.options.animationEasing,
always: function() {
this.activeSection = target;
}.bind( this )
} );
},
resize: function() {
this._attachEvents();
// Delaying the resize event to prevent glitches
setTimeout( function() {
this._countAllPositions();
// this.scrollTo(this.activeSection);
}.bind( this ), 150 );
this._countAllPositions();
// this.scrollTo(this.activeSection);
},
scroll: function() {
var currentTime = new Date().getTime();
if ( ( currentTime - this.lastScroll ) < ( this.options.coolDown + this.options.animationDuration ) ) {
return;
}
if ( this.scrollTimeout ) {
clearTimeout( this.scrollTimeout );
}
this.scrollTimeout = setTimeout( function() {
var scrollTop = parseInt( $us.$window.scrollTop() );
for ( var section in this.sections ) {
if ( scrollTop >= ( this.sections[ section ].top - 1 ) && scrollTop < ( this.sections[ section ].bottom - 1 ) ) {
this.activeSection = section;
break;
}
}
if ( this.usingDots ) {
this.$dots.removeClass( 'active' );
if ( this.dots[ this.activeSection ] !== undefined ) {
this.dots[ this.activeSection ].addClass( 'active' );
}
}
}.bind( this ), 500 );
}
};
$.fn.usPageScroller = function( options ) {
return this.each( function() {
$( this ).data( 'usPageScroller', new $us.PageScroller( this, options ) );
} );
};
$( function() {
$( '.w-scroller' ).usPageScroller();
} );
} )( jQuery );
@@ -0,0 +1,18 @@
(function($){"use strict";$us.PageScroller=function(container,options){this.init(container,options)};$us.PageScroller.prototype={init:function(container,options){var defaults={coolDown:100,animationDuration:1000,animationEasing:'easeInOutExpo'},scrollTop=parseInt($us.$window.scrollTop());this.options=$.extend({},defaults,options);this.$container=$(container);this._canvasTopOffset=$us.$canvas.offset().top;this.activeSection=0;this.sections=[];this.dots=[];this.scrolls=[];this.usingDots=!1;this.isTouch=(('ontouchstart' in window)||(navigator.msMaxTouchPoints>0)||(navigator.maxTouchPoints));this.disableWidth=(this.$container.data('disablewidth')!==undefined)?this.$container.data('disablewidth'):768;if(this.$container.data('speed')!==undefined){this.options.animationDuration=this.$container.data('speed')}
if($us.canvas.headerPos=='static'&&$us.header.orientation=='hor'){$us.canvas.$header.each(function(){var $section=$us.canvas.$header,section={$section:$section};this._countPosition(section);this.sections.push(section)}.bind(this))}
$us.$canvas.find('.l-section').each(function(key,elm){var $section=$(elm),section={$section:$section};this._countPosition(section);this.sections.push(section)}.bind(this));this.$dotsContainer=this.$container.find('.w-scroller-dots');if(this.$dotsContainer.length){this.usingDots=!0;this.$firstDot=this.$dotsContainer.find('.w-scroller-dot').first();for(var i=1;i<this.sections.length;i ++){this.$firstDot.clone().appendTo(this.$dotsContainer)}
this.$dots=this.$dotsContainer.find('.w-scroller-dot');this.$dots.each(function(key,elm){var $dot=$(elm);this.dots[key]=$dot;$dot.click(function(){this.scrollTo(key);this.$dots.removeClass('active');$dot.addClass('active')}.bind(this))}.bind(this));this.dots[this.activeSection].addClass('active');this.$dotsContainer.addClass('show')}
$('.l-footer > .l-section').each(function(key,elm){var $section=$(elm),section={$section:$section};this._countPosition(section);this.sections.push(section)}.bind(this));this._attachEvents();this._events={scroll:this.scroll.bind(this),resize:this.resize.bind(this)};$us.$canvas.on('contentChange',this._events.resize);$us.$window.on('resize load',this._events.resize);$us.$window.on('resize load scroll',this._events.scroll);setTimeout(this._events.resize,100)},getScrollSpeed:function(number){var sum=0;var lastElements=this.scrolls.slice(Math.max(this.scrolls.length-number,1));for(var i=0;i<lastElements.length;i ++){sum=sum+lastElements[i]}
return Math.ceil(sum/number)},_attachEvents:function(){$us.$document.off('mousewheel DOMMouseScroll MozMousePixelScroll');$us.$canvas.off('touchstart touchmove');if($us.$window.width()>this.disableWidth&&$us.mobileNavOpened<=0&&(!$us.$html.hasClass('cloverlay_fixed'))){$us.$document.on('mousewheel DOMMouseScroll MozMousePixelScroll',function(e){e.preventDefault();var currentTime=new Date().getTime(),target=this.activeSection,direction=e.originalEvent.wheelDelta||-e.originalEvent.detail,speedEnd,speedMiddle,isAccelerating;if(this.scrolls.length>149){this.scrolls.shift()}
this.scrolls.push(Math.abs(direction));if((currentTime-this.previousMouseWheelTime)>this.options.coolDown){this.scrolls=[]}
this.previousMouseWheelTime=currentTime;speedEnd=this.getScrollSpeed(10);speedMiddle=this.getScrollSpeed(70);isAccelerating=speedEnd>=speedMiddle;if(isAccelerating){if(direction<0){target ++}else if(direction>0){target --}
if(this.sections[target]==undefined){return}
this.scrollTo(target);this.lastScroll=currentTime}}.bind(this));if($.isMobile||this.isTouch){$us.$canvas.on('touchstart',function(event){var e=event.originalEvent;if(typeof e.pointerType==='undefined'||e.pointerType!='mouse'){this.touchStartY=e.touches[0].pageY}}.bind(this));$us.$canvas.on('touchmove',function(event){event.preventDefault();var currentTime=new Date().getTime(),e=event.originalEvent,target=this.activeSection;this.touchEndY=e.touches[0].pageY;if(Math.abs(this.touchStartY-this.touchEndY)>($us.$window.height()/50)){if(this.touchStartY>this.touchEndY){target ++}else if(this.touchEndY>this.touchStartY){target --}
if(this.sections[target]==undefined){return}
this.scrollTo(target);this.lastScroll=currentTime}}.bind(this))}}},_countPosition:function(section){section.top=section.$section.offset().top-this._canvasTopOffset;if($us.header.headerTop===undefined||($us.header.headerTop>0&&section.top>$us.header.headerTop)){section.top=section.top-$us.header.scrolledOccupiedHeight}
section.bottom=section.top+section.$section.outerHeight(!1)},_countAllPositions:function(){for(var section in this.sections){if(this.sections[section].$section.length){this._countPosition(this.sections[section])}}},scrollTo:function(target){var currentTime=new Date().getTime();if(this.previousScrollTime!==undefined&&(currentTime-this.previousScrollTime<this.options.animationDuration)){return}
this.previousScrollTime=currentTime;if(this.usingDots){this.$dots.removeClass('active');if(this.dots[target]!==undefined){this.dots[target].addClass('active')}}
$us.$htmlBody.stop(!0,!1).animate({scrollTop:this.sections[target].top+'px'},{duration:this.options.animationDuration,easing:this.options.animationEasing,always:function(){this.activeSection=target}.bind(this)})},resize:function(){this._attachEvents();setTimeout(function(){this._countAllPositions()}.bind(this),150);this._countAllPositions()},scroll:function(){var currentTime=new Date().getTime();if((currentTime-this.lastScroll)<(this.options.coolDown+this.options.animationDuration)){return}
if(this.scrollTimeout){clearTimeout(this.scrollTimeout)}
this.scrollTimeout=setTimeout(function(){var scrollTop=parseInt($us.$window.scrollTop());for(var section in this.sections){if(scrollTop>=(this.sections[section].top-1)&&scrollTop<(this.sections[section].bottom-1)){this.activeSection=section;break}}
if(this.usingDots){this.$dots.removeClass('active');if(this.dots[this.activeSection]!==undefined){this.dots[this.activeSection].addClass('active')}}}.bind(this),500)}};$.fn.usPageScroller=function(options){return this.each(function(){$(this).data('usPageScroller',new $us.PageScroller(this,options))})};$(function(){$('.w-scroller').usPageScroller()})})(jQuery)
@@ -0,0 +1,128 @@
/**
* UpSolution Element: Modal Popup
*/
! function( $ ) {
"use strict";
$us.WPopup = function( container ) {
this.$container = $( container );
this._events = {
show: this.show.bind( this ),
afterShow: this.afterShow.bind( this ),
hide: this.hide.bind( this ),
preventHide: function( e ) {
e.stopPropagation();
},
afterHide: this.afterHide.bind( this ),
keyup: function( e ) {
if ( e.key == "Escape" ) {
this.hide();
}
}.bind( this )
};
// Event name for triggering CSS transition finish
this.transitionEndEvent = ( navigator.userAgent.search( /webkit/i ) > 0 ) ? 'webkitTransitionEnd' : 'transitionend';
this.isFixed = ! jQuery.isMobile;
this.$trigger = this.$container.find( '.w-popup-trigger' );
this.triggerType = this.$trigger.usMod( 'type' );
if ( this.triggerType == 'load' ) {
var delay = this.$trigger.data( 'delay' ) || 2;
setTimeout( this.show.bind( this ), delay * 1000 );
} else if ( this.triggerType == 'selector' ) {
var selector = this.$trigger.data( 'selector' );
if ( selector ) {
$us.$body.on( 'click', selector, this._events.show );
}
} else {
this.$trigger.on( 'click', this._events.show );
}
this.$wrap = this.$container.find( '.w-popup-wrap' )
.usMod( 'pos', this.isFixed ? 'fixed' : 'absolute' )
.on( 'click', this._events.hide );
this.$box = this.$container.find( '.w-popup-box' );
this.$overlay = this.$container.find( '.w-popup-overlay' )
.usMod( 'pos', this.isFixed ? 'fixed' : 'absolute' )
.on( 'click', this._events.hide );
this.$container.find( '.w-popup-closer' ).on( 'click', this._events.hide );
this.$box.on( 'click', this._events.preventHide );
this.timer = null;
};
$us.WPopup.prototype = {
_hasScrollbar: function() {
return document.documentElement.scrollHeight > document.documentElement.clientHeight;
},
_getScrollbarSize: function() {
if ( $us.scrollbarSize === undefined ) {
var scrollDiv = document.createElement( 'div' );
scrollDiv.style.cssText = 'width: 99px; height: 99px; overflow: scroll; position: absolute; top: -9999px;';
document.body.appendChild( scrollDiv );
$us.scrollbarSize = scrollDiv.offsetWidth - scrollDiv.clientWidth;
document.body.removeChild( scrollDiv );
}
return $us.scrollbarSize;
},
show: function() {
clearTimeout( this.timer );
this.$overlay.appendTo( $us.$body ).show();
this.$wrap.appendTo( $us.$body ).css( 'display', 'flex' );
if ( this.isFixed ) {
$us.$html.addClass( 'usoverlay_fixed' );
// Storing the value for the whole popup visibility session
this.windowHasScrollbar = this._hasScrollbar();
if ( this.windowHasScrollbar && this._getScrollbarSize() ) {
$us.$html.css( 'margin-right', this._getScrollbarSize() );
}
} else {
this.$overlay.css( {
height: $us.$document.height()
} );
this.$wrap.css( 'top', $us.$window.scrollTop() );
}
$us.$body.on( 'keyup', this._events.keyup );
this.timer = setTimeout( this._events.afterShow, 25 );
},
afterShow: function() {
clearTimeout( this.timer );
this.$overlay.addClass( 'active' );
this.$box.addClass( 'active' );
if ( window.$us !== undefined && $us.$canvas !== undefined ) {
$us.$canvas.trigger( 'contentChange' );
}
$us.$window.trigger( 'resize' );
},
hide: function() {
clearTimeout( this.timer );
$us.$body.off( 'keyup', this._events.keyup );
this.$box.on( this.transitionEndEvent, this._events.afterHide );
this.$overlay.removeClass( 'active' );
this.$box.removeClass( 'active' );
// Closing it anyway
this.timer = setTimeout( this._events.afterHide, 1000 );
},
afterHide: function() {
clearTimeout( this.timer );
this.$box.off( this.transitionEndEvent, this._events.afterHide );
this.$overlay.appendTo( this.$container ).hide();
this.$wrap.appendTo( this.$container ).hide();
if ( this.isFixed ) {
$us.$html.removeClass( 'usoverlay_fixed' );
if ( this.windowHasScrollbar ) {
$us.$html.css( 'margin-right', '' );
}
$us.$window.trigger( 'resize' );
}
},
};
$.fn.wPopup = function( options ) {
return this.each( function() {
$( this ).data( 'wPopup', new $us.WPopup( this, options ) );
} );
};
$( function() {
$( '.w-popup' ).wPopup();
} );
}( jQuery );
@@ -0,0 +1,6 @@
!function($){"use strict";$us.WPopup=function(container){this.$container=$(container);this._events={show:this.show.bind(this),afterShow:this.afterShow.bind(this),hide:this.hide.bind(this),preventHide:function(e){e.stopPropagation()},afterHide:this.afterHide.bind(this),keyup:function(e){if(e.key=="Escape"){this.hide()}}.bind(this)};this.transitionEndEvent=(navigator.userAgent.search(/webkit/i)>0)?'webkitTransitionEnd':'transitionend';this.isFixed=!jQuery.isMobile;this.$trigger=this.$container.find('.w-popup-trigger');this.triggerType=this.$trigger.usMod('type');if(this.triggerType=='load'){var delay=this.$trigger.data('delay')||2;setTimeout(this.show.bind(this),delay*1000)}else if(this.triggerType=='selector'){var selector=this.$trigger.data('selector');if(selector){$us.$body.on('click',selector,this._events.show)}}else{this.$trigger.on('click',this._events.show)}
this.$wrap=this.$container.find('.w-popup-wrap').usMod('pos',this.isFixed?'fixed':'absolute').on('click',this._events.hide);this.$box=this.$container.find('.w-popup-box');this.$overlay=this.$container.find('.w-popup-overlay').usMod('pos',this.isFixed?'fixed':'absolute').on('click',this._events.hide);this.$container.find('.w-popup-closer').on('click',this._events.hide);this.$box.on('click',this._events.preventHide);this.timer=null};$us.WPopup.prototype={_hasScrollbar:function(){return document.documentElement.scrollHeight>document.documentElement.clientHeight},_getScrollbarSize:function(){if($us.scrollbarSize===undefined){var scrollDiv=document.createElement('div');scrollDiv.style.cssText='width: 99px; height: 99px; overflow: scroll; position: absolute; top: -9999px;';document.body.appendChild(scrollDiv);$us.scrollbarSize=scrollDiv.offsetWidth-scrollDiv.clientWidth;document.body.removeChild(scrollDiv)}
return $us.scrollbarSize},show:function(){clearTimeout(this.timer);this.$overlay.appendTo($us.$body).show();this.$wrap.appendTo($us.$body).css('display','flex');if(this.isFixed){$us.$html.addClass('usoverlay_fixed');this.windowHasScrollbar=this._hasScrollbar();if(this.windowHasScrollbar&&this._getScrollbarSize()){$us.$html.css('margin-right',this._getScrollbarSize())}}else{this.$overlay.css({height:$us.$document.height()});this.$wrap.css('top',$us.$window.scrollTop())}
$us.$body.on('keyup',this._events.keyup);this.timer=setTimeout(this._events.afterShow,25)},afterShow:function(){clearTimeout(this.timer);this.$overlay.addClass('active');this.$box.addClass('active');if(window.$us!==undefined&&$us.$canvas!==undefined){$us.$canvas.trigger('contentChange')}
$us.$window.trigger('resize')},hide:function(){clearTimeout(this.timer);$us.$body.off('keyup',this._events.keyup);this.$box.on(this.transitionEndEvent,this._events.afterHide);this.$overlay.removeClass('active');this.$box.removeClass('active');this.timer=setTimeout(this._events.afterHide,1000)},afterHide:function(){clearTimeout(this.timer);this.$box.off(this.transitionEndEvent,this._events.afterHide);this.$overlay.appendTo(this.$container).hide();this.$wrap.appendTo(this.$container).hide();if(this.isFixed){$us.$html.removeClass('usoverlay_fixed');if(this.windowHasScrollbar){$us.$html.css('margin-right','')}
$us.$window.trigger('resize')}},};$.fn.wPopup=function(options){return this.each(function(){$(this).data('wPopup',new $us.WPopup(this,options))})};$(function(){$('.w-popup').wPopup()})}(jQuery)
@@ -0,0 +1,56 @@
/**
* UpSolution Element: Progbar
*/
( function( $ ) {
$.fn.wProgbar = function() {
return this.each( function() {
var $container = $( this ),
count = $container.data( 'count' ) + '',
$titleCount = $container.find( '.w-progbar-title-count' ),
$barCount = $container.find( '.w-progbar-bar-count' );
// Prevent double init
if ( $container.data( 'progBarInit' ) == 1 ) {
return;
}
$container.data( 'progBarInit', 1 );
if ( count === null ) {
count = 50;
}
if ( /bot|googlebot|crawler|spider|robot|crawling/i.test( navigator.userAgent ) ) {
$container.removeClass( 'initial' );
$titleCount.html( count + '%' );
$barCount.html( count + '%' );
return;
}
$titleCount.html( '0%' );
$barCount.html( '0%' );
$us.scroll.addWaypoint( this, '15%', function() {
var current = 0,
step = 40,
stepValue = count / 40,
interval = setInterval( function() {
current += stepValue;
step --;
$titleCount.html( current.toFixed( 0 ) + '%' );
$barCount.html( current.toFixed( 0 ) + '%' );
if ( step <= 0 ) {
$titleCount.html( count + '%' );
$barCount.html( count + '%' );
window.clearInterval( interval );
}
}, 20 );
$container.removeClass( 'initial' );
} );
} );
};
$( function() {
jQuery( '.w-progbar' ).wProgbar();
} );
} )( jQuery );
@@ -0,0 +1,4 @@
(function($){$.fn.wProgbar=function(){return this.each(function(){var $container=$(this),count=$container.data('count')+'',$titleCount=$container.find('.w-progbar-title-count'),$barCount=$container.find('.w-progbar-bar-count');if($container.data('progBarInit')==1){return}
$container.data('progBarInit',1);if(count===null){count=50}
if(/bot|googlebot|crawler|spider|robot|crawling/i.test(navigator.userAgent)){$container.removeClass('initial');$titleCount.html(count+'%');$barCount.html(count+'%');return}
$titleCount.html('0%');$barCount.html('0%');$us.scroll.addWaypoint(this,'15%',function(){var current=0,step=40,stepValue=count/40,interval=setInterval(function(){current+=stepValue;step --;$titleCount.html(current.toFixed(0)+'%');$barCount.html(current.toFixed(0)+'%');if(step<=0){$titleCount.html(count+'%');$barCount.html(count+'%');window.clearInterval(interval)}},20);$container.removeClass('initial')})})};$(function(){jQuery('.w-progbar').wProgbar()})})(jQuery)
@@ -0,0 +1,144 @@
/**
* UpSolution Element: Sharing Buttons
*/
! function( $ ) {
"use strict";
function WShare( selector ) {
var $this = $( selector ),
$parent = $this.parent(),
first_image_src,
opt = {
url: window.location,
text: document.title,
lang: document.documentElement.lang,
image: $( 'meta[name="og:image"]' ).attr( 'content' ) || ''
};
if ( window.selectedText ) {
opt.text = window.selectedText;
}
if ( $parent.attr( 'data-sharing-url' ) !== undefined && $parent.attr( 'data-sharing-url' ) !== '' ) {
opt.url = $parent.attr( 'data-sharing-url' );
}
if ( $parent.attr( 'data-sharing-image' ) !== undefined && $parent.attr( 'data-sharing-image' ) !== '' ) {
opt.image = $parent.attr( 'data-sharing-image' );
}
if ( opt.image === '' || opt.image === undefined ) {
first_image_src = $( 'img' ).first().attr( 'src' );
if ( first_image_src !== undefined && first_image_src !== '' ) {
opt.image = first_image_src;
}
}
if ( $this.hasClass( 'facebook' ) ) {
window.open( "https://www.facebook.com/sharer/sharer.php?u=" + encodeURIComponent( opt.url ) + "&quote=" + encodeURIComponent( opt.text ) + "", "facebook", "toolbar=0, status=0, width=900, height=500" );
} else if ( $this.hasClass( 'twitter' ) ) {
window.open( "https://twitter.com/intent/tweet?text=" + encodeURIComponent( opt.text ) + "&url=" + encodeURIComponent( opt.url ), "twitter", "toolbar=0, status=0, width=650, height=360" );
} else if ( $this.hasClass( 'linkedin' ) ) {
window.open( 'https://www.linkedin.com/shareArticle?mini=true&url=' + encodeURIComponent( opt.url ), 'linkedin', 'toolbar=no,width=550,height=550' );
} else if ( $this.hasClass( 'whatsapp' ) ) {
if ( jQuery.isMobile ) {
window.open( "https://api.whatsapp.com/send?text=" + encodeURIComponent( opt.text + ' ' + opt.url ), "whatsapp", "toolbar=0, status=0, width=900, height=500" );
} else {
window.open( "https://web.whatsapp.com/send?text=" + encodeURIComponent( opt.text + ' ' + opt.url ), "whatsapp", "toolbar=0, status=0, width=900, height=500" );
}
} else if ( $this.hasClass( 'xing' ) ) {
window.open( "https://www.xing.com/spi/shares/new?url=" + encodeURIComponent( opt.url ), "xing", "toolbar=no, status=0, width=900, height=500" );
} else if ( $this.hasClass( 'reddit' ) ) {
window.open( "https://www.reddit.com/submit?url=" + encodeURIComponent( opt.url ) + "&title=" + encodeURIComponent( opt.text ), "reddit", "toolbar=no, status=0, width=900, height=500" );
} else if ( $this.hasClass( 'pinterest' ) ) {
window.open( 'https://www.pinterest.com/pin/create/button/?url=' + encodeURIComponent( opt.url ) + '&media=' + encodeURIComponent( opt.image ) + '&description=' + encodeURIComponent( opt.text ), 'pinterest', 'toolbar=no,width=700,height=300' );
} else if ( $this.hasClass( 'vk' ) ) {
window.open( 'https://vk.com/share.php?url=' + encodeURIComponent( opt.url ) + '&title=' + encodeURIComponent( opt.text ) + '&description=&image=' + encodeURIComponent( opt.image ),'vk','toolbar=no,width=700,height=300' );
} else if ( $this.hasClass( 'email' ) ) {
window.location = 'mailto:?subject=' + opt.text + '&body=' + encodeURIComponent ( opt.url );
}
}
// Enable sharing via text selection
if ( $( '.w-sharing-tooltip' ).length ) {
var activeArea = '.l-main';
// If Allow sharing in post content only
if ( $( '.w-sharing-tooltip' ).attr( 'data-sharing-area' ) === 'post_content' ) {
activeArea = '.w-post-elm.post_content';
}
// Close tooltip if click anywhere on page
$( 'body' ).not( activeArea ).bind( 'mouseup', function() {
var selection;
if ( window.getSelection ) {
selection = window.getSelection();
} else if ( document.selection ) {
selection = document.selection.createRange();
}
if ( selection.toString() === '' ) {
$( ".w-sharing-tooltip.active:visible" ).hide();
}
} );
// Open tooltip
$( activeArea ).bind( 'mouseup', function( e ) {
var selection, tooltip = '', url, $copy2clipboard = $( '.w-sharing-item.copy2clipboard' );
if ( window.getSelection ) {
selection = window.getSelection();
} else if ( document.selection ) {
selection = document.selection.createRange();
}
$( ".w-sharing-tooltip" ).each( function() {
if ( $( this ).hasClass( 'active' ) ) {
tooltip = this;
}
} );
// mark first tooltip as active
if ( tooltip === '' ) {
$( ".w-sharing-tooltip:first" ).addClass( 'active' );
$( ".w-sharing-tooltip.active" ).appendTo( "body" );
tooltip = ".w-sharing-tooltip.active";
}
//copy selected text to window.selectedText and show tooltip
if ( selection.toString() !== '' ) {
window.selectedText = selection.toString();
$( tooltip ).css( {
"display": "inline-block", "left": e.pageX, "top": e.pageY - 50,
} );
} else {
window.selectedText = '';
$( tooltip ).hide();
}
//if copy
$copy2clipboard.on( 'click', function() {
// get url
if ( $copy2clipboard.parent().attr( 'data-sharing-url' ) !== undefined && $copy2clipboard.parent().attr( 'data-sharing-url' ) !== '' ) {
url = $copy2clipboard.parent().attr( 'data-sharing-url' );
} else {
url = window.location;
}
// create hidden selection
var el = document.createElement( 'textarea' );
el.value = window.selectedText + ' ' + url;
el.setAttribute( 'readonly', '' );
el.style.position = 'absolute';
el.style.left = '-9999px';
document.body.appendChild( el );
el.select();
document.execCommand( 'copy' );
document.body.removeChild( el );
$( tooltip ).hide();
} );
} );
}
$( '.w-sharing-item' ).on( 'click', function() {
WShare( this );
$( '.w-sharing-tooltip' ).hide();
} );
}( jQuery );
@@ -0,0 +1,13 @@
!function($){"use strict";function WShare(selector){var $this=$(selector),$parent=$this.parent(),first_image_src,opt={url:window.location,text:document.title,lang:document.documentElement.lang,image:$('meta[name="og:image"]').attr('content')||''};if(window.selectedText){opt.text=window.selectedText}
if($parent.attr('data-sharing-url')!==undefined&&$parent.attr('data-sharing-url')!==''){opt.url=$parent.attr('data-sharing-url')}
if($parent.attr('data-sharing-image')!==undefined&&$parent.attr('data-sharing-image')!==''){opt.image=$parent.attr('data-sharing-image')}
if(opt.image===''||opt.image===undefined){first_image_src=$('img').first().attr('src');if(first_image_src!==undefined&&first_image_src!==''){opt.image=first_image_src}}
if($this.hasClass('facebook')){window.open("https://www.facebook.com/sharer/sharer.php?u="+encodeURIComponent(opt.url)+"&quote="+encodeURIComponent(opt.text)+"","facebook","toolbar=0, status=0, width=900, height=500")}else if($this.hasClass('twitter')){window.open("https://twitter.com/intent/tweet?text="+encodeURIComponent(opt.text)+"&url="+encodeURIComponent(opt.url),"twitter","toolbar=0, status=0, width=650, height=360")}else if($this.hasClass('linkedin')){window.open('https://www.linkedin.com/shareArticle?mini=true&url='+encodeURIComponent(opt.url),'linkedin','toolbar=no,width=550,height=550')}else if($this.hasClass('whatsapp')){if(jQuery.isMobile){window.open("https://api.whatsapp.com/send?text="+encodeURIComponent(opt.text+' '+opt.url),"whatsapp","toolbar=0, status=0, width=900, height=500")}else{window.open("https://web.whatsapp.com/send?text="+encodeURIComponent(opt.text+' '+opt.url),"whatsapp","toolbar=0, status=0, width=900, height=500")}}else if($this.hasClass('xing')){window.open("https://www.xing.com/spi/shares/new?url="+encodeURIComponent(opt.url),"xing","toolbar=no, status=0, width=900, height=500")}else if($this.hasClass('reddit')){window.open("https://www.reddit.com/submit?url="+encodeURIComponent(opt.url)+"&title="+encodeURIComponent(opt.text),"reddit","toolbar=no, status=0, width=900, height=500")}else if($this.hasClass('pinterest')){window.open('https://www.pinterest.com/pin/create/button/?url='+encodeURIComponent(opt.url)+'&media='+encodeURIComponent(opt.image)+'&description='+encodeURIComponent(opt.text),'pinterest','toolbar=no,width=700,height=300')}else if($this.hasClass('vk')){window.open('https://vk.com/share.php?url='+encodeURIComponent(opt.url)+'&title='+encodeURIComponent(opt.text)+'&description=&image='+encodeURIComponent(opt.image),'vk','toolbar=no,width=700,height=300')}else if($this.hasClass('email')){window.location='mailto:?subject='+opt.text+'&body='+encodeURIComponent(opt.url)}}
if($('.w-sharing-tooltip').length){var activeArea='.l-main';if($('.w-sharing-tooltip').attr('data-sharing-area')==='post_content'){activeArea='.w-post-elm.post_content'}
$('body').not(activeArea).bind('mouseup',function(){var selection;if(window.getSelection){selection=window.getSelection()}else if(document.selection){selection=document.selection.createRange()}
if(selection.toString()===''){$(".w-sharing-tooltip.active:visible").hide()}});$(activeArea).bind('mouseup',function(e){var selection,tooltip='',url,$copy2clipboard=$('.w-sharing-item.copy2clipboard');if(window.getSelection){selection=window.getSelection()}else if(document.selection){selection=document.selection.createRange()}
$(".w-sharing-tooltip").each(function(){if($(this).hasClass('active')){tooltip=this}});if(tooltip===''){$(".w-sharing-tooltip:first").addClass('active');$(".w-sharing-tooltip.active").appendTo("body");tooltip=".w-sharing-tooltip.active"}
if(selection.toString()!==''){window.selectedText=selection.toString();$(tooltip).css({"display":"inline-block","left":e.pageX,"top":e.pageY-50,})}else{window.selectedText='';$(tooltip).hide()}
$copy2clipboard.on('click',function(){if($copy2clipboard.parent().attr('data-sharing-url')!==undefined&&$copy2clipboard.parent().attr('data-sharing-url')!==''){url=$copy2clipboard.parent().attr('data-sharing-url')}else{url=window.location}
var el=document.createElement('textarea');el.value=window.selectedText+' '+url;el.setAttribute('readonly','');el.style.position='absolute';el.style.left='-9999px';document.body.appendChild(el);el.select();document.execCommand('copy');document.body.removeChild(el);$(tooltip).hide()})})}
$('.w-sharing-item').on('click',function(){WShare(this);$('.w-sharing-tooltip').hide()})}(jQuery)
@@ -0,0 +1,66 @@
/**
* UpSolution Element: Slider
*/
( function( $ ) {
$.fn.wSlider = function() {
return this.each( function() {
$us.getScript( $us.templateDirectoryUri + '/framework/js/vendor/royalslider.js', function() {
var $this = $( this ),
$frame = $this.find( '.w-slider-h' ),
$slider = $this.find( '.royalSlider' ),
$options = $this.find( '.w-slider-json' ),
options = $options[ 0 ].onclick() || {};
// Prevent double init
if ( $this.data( 'sliderInit' ) == 1 ) {
return;
}
$this.data( 'sliderInit', 1 );
$options.remove();
if ( ! $.fn.royalSlider ) {
return;
}
// Always apply certain fit option for grid listing slider
if ( $this.parent().hasClass( 'w-post-elm' ) ) {
options[ 'imageScaleMode' ] = 'fill';
}
options[ 'usePreloader' ] = false;
$slider.royalSlider( options );
var slider = $slider.data( 'royalSlider' );
if ( options.fullscreen && options.fullscreen.enabled ) {
// Moving royal slider to the very end of body element to allow a proper fullscreen
var rsEnterFullscreen = function() {
$slider.appendTo( $( 'body' ) );
slider.ev.off( 'rsEnterFullscreen', rsEnterFullscreen );
slider.ev.on( 'rsExitFullscreen', rsExitFullscreen );
slider.updateSliderSize();
};
slider.ev.on( 'rsEnterFullscreen', rsEnterFullscreen );
var rsExitFullscreen = function() {
$slider.prependTo( $frame );
slider.ev.off( 'rsExitFullscreen', rsExitFullscreen );
slider.ev.on( 'rsEnterFullscreen', rsEnterFullscreen );
};
}
slider.ev.on( 'rsAfterContentSet', function() {
slider.slides.forEach( function( slide ) {
$( slide.content.find( 'img' )[ 0 ] ).attr( 'alt', slide.caption.attr( 'data-alt' ) );
} );
} );
$us.$canvas.on( 'contentChange', function() {
$slider.parent().imagesLoaded( function() {
slider.updateSliderSize();
} );
} );
}.bind( this ) );
} );
};
$( function() {
jQuery( '.w-slider' ).wSlider();
} );
} )( jQuery );
@@ -0,0 +1,5 @@
(function($){$.fn.wSlider=function(){return this.each(function(){$us.getScript($us.templateDirectoryUri+'/framework/js/vendor/royalslider.js',function(){var $this=$(this),$frame=$this.find('.w-slider-h'),$slider=$this.find('.royalSlider'),$options=$this.find('.w-slider-json'),options=$options[0].onclick()||{};if($this.data('sliderInit')==1){return}
$this.data('sliderInit',1);$options.remove();if(!$.fn.royalSlider){return}
if($this.parent().hasClass('w-post-elm')){options.imageScaleMode='fill'}
options.usePreloader=!1;$slider.royalSlider(options);var slider=$slider.data('royalSlider');if(options.fullscreen&&options.fullscreen.enabled){var rsEnterFullscreen=function(){$slider.appendTo($('body'));slider.ev.off('rsEnterFullscreen',rsEnterFullscreen);slider.ev.on('rsExitFullscreen',rsExitFullscreen);slider.updateSliderSize()};slider.ev.on('rsEnterFullscreen',rsEnterFullscreen);var rsExitFullscreen=function(){$slider.prependTo($frame);slider.ev.off('rsExitFullscreen',rsExitFullscreen);slider.ev.on('rsEnterFullscreen',rsEnterFullscreen)}}
slider.ev.on('rsAfterContentSet',function(){slider.slides.forEach(function(slide){$(slide.content.find('img')[0]).attr('alt',slide.caption.attr('data-alt'))})});$us.$canvas.on('contentChange',function(){$slider.parent().imagesLoaded(function(){slider.updateSliderSize()})})}.bind(this))})};$(function(){jQuery('.w-slider').wSlider()})})(jQuery)
@@ -0,0 +1,396 @@
/**
* UpSolution Element: Tabs
*
* @requires $us.canvas
*/
!function( $ ) {
"use strict";
$us.WTabs = function( container, options ) {
this.init( container, options );
};
$us.WTabs.prototype = {
init: function( container, options ) {
// Setting options
var defaults = {
duration: 300,
easing: 'cubic-bezier(.78,.13,.15,.86)'
};
this.options = $.extend( {}, defaults, options );
this.isRtl = $( '.l-body' ).hasClass( 'rtl' );
// Commonly used dom elements
this.$container = $( container );
this.$tabsList = this.$container.find( '.w-tabs-list:first' );
this.$tabs = this.$tabsList.find( '.w-tabs-item' );
this.$tabsH = this.$tabsList.find( '.w-tabs-item-h' );
this.$sectionsWrapper = this.$container.find( '.w-tabs-sections:first' );
this.$sectionsHelper = this.$sectionsWrapper.children();
this.$sections = this.$sectionsHelper.find( '.w-tabs-section' );
this.$headers = this.$sections.children( '.w-tabs-section-header' );
this.$contents = this.$sections.children( '.w-tabs-section-content' );
this.$line_charts = this.$container.find( ".vc_line-chart" );
this.$round_charts = this.$container.find( ".vc_round-chart" );
// Class variables
this.width = 0;
this.tabWidths = [];
this.isTogglable = ( this.$container.usMod( 'type' ) == 'togglable' );
// Basic layout
this.basicLayout = this.$container.hasClass( 'accordion' ) ? 'accordion' : ( this.$container.usMod( 'layout' ) || 'default' );
// Current active layout (may be switched to 'accordion')
this.curLayout = this.basicLayout;
this.responsive = $us.canvas.options.responsive;
// Array of active tabs indexes
this.active = [];
this.activeOnInit = [];
this.definedActive = [];
this.count = this.$tabs.length;
// Container width at which we should switch to accordion layout
this.minWidth = 0;
if ( this.count == 0 ) {
return;
}
// Preparing arrays of jQuery objects for easier manipulating in future
this.tabs = $.map( this.$tabs.toArray(), $ );
this.sections = $.map( this.$sections.toArray(), $ );
this.headers = $.map( this.$headers.toArray(), $ );
this.contents = $.map( this.$contents.toArray(), $ );
$.each( this.tabs, function( index ) {
if ( this.sections[ index ].hasClass( 'content-empty' ) ) {
this.tabs[ index ].hide();
this.sections[ index ].hide();
}
if ( this.tabs[ index ].hasClass( 'active' ) ) {
this.active.push( index );
this.activeOnInit.push( index );
}
if ( this.tabs[ index ].hasClass( 'defined-active' ) ) {
this.definedActive.push( index );
}
this.tabs[ index ].add( this.headers[ index ] ).on( 'click', function( e ) {
e.preventDefault();
// Toggling accordion sections
if ( this.curLayout == 'accordion' && this.isTogglable ) {
// Cannot toggle the only active item
this.toggleSection( index );
}
// Setting tabs active item
else {
if ( index != this.active[ 0 ] ) {
this.headerClicked = true;
this.openSection( index );
} else if ( this.curLayout == 'accordion' ) {
this.contents[ index ].css( 'display', 'block' ).slideUp( this.options.duration, this._events.contentChanged );
this.tabs[ index ].removeClass( 'active' );
this.sections[ index ].removeClass( 'active' );
this.active[ 0 ] = undefined;
}
}
}.bind( this ) );
}.bind( this ) );
this.$tabsH.on( 'click', function( e ) {
e.preventDefault();
} );
// Boundable events
this._events = {
resize: this.resize.bind( this ),
hashchange: this.hashchange.bind( this ),
contentChanged: function() {
$us.$canvas.trigger( 'contentChange' );
// TODO: check if we can do this without hardcoding line charts init here;
this.$line_charts.length && jQuery.fn.vcLineChart && this.$line_charts.vcLineChart( { reload: !1 } );
this.$round_charts.length && jQuery.fn.vcRoundChart && this.$round_charts.vcRoundChart( { reload: !1 } );
}.bind( this )
};
// Starting everything
this.switchLayout( this.curLayout );
$us.$window.on( 'resize', this._events.resize );
$us.$window.on( 'hashchange', this._events.hashchange );
$us.$document.on( 'ready', this._events.resize );
$us.$document.on( 'ready', function() {
setTimeout( this._events.resize, 50 );
setTimeout( function() {
// Open tab on page load by hash
if ( window.location.hash ) {
var hash = window.location.hash.substr( 1 ),
$linkedSection = this.$container.find( '.w-tabs-section[id="' + hash + '"]' );
if ( $linkedSection.length && ( !$linkedSection.hasClass( 'active' ) ) ) {
var $header = $linkedSection.find( '.w-tabs-section-header' );
$header.click();
}
}
}.bind( this ), 150 );
}.bind( this ) );
// Support for external links to tabs
$.each( this.tabs, function( index ) {
if ( this.headers[ index ].attr( 'href' ) != undefined ) {
var tabHref = this.headers[ index ].attr( 'href' ),
tabHeader = this.headers[ index ];
$( 'a[href="' + tabHref + '"]' ).on( 'click', function( e ) {
e.preventDefault();
if ( $( this ).hasClass( 'w-tabs-section-header', 'w-tabs-item-h' ) ) {
return;
}
tabHeader.click();
} );
}
}.bind( this ) );
this.$container.addClass( 'initialized' );
},
hashchange: function() {
if ( window.location.hash ) {
var hash = window.location.hash.substr( 1 ),
$linkedSection = this.$container.find( '.w-tabs-section[id="' + hash + '"]' );
if ( $linkedSection.length && ( !$linkedSection.hasClass( 'active' ) ) ) {
var $header = $linkedSection.find( '.w-tabs-section-header' );
$header.click();
}
}
},
switchLayout: function( to ) {
this.cleanUpLayout( this.curLayout );
this.prepareLayout( to );
this.curLayout = to;
},
/**
* Clean up layout's special inline styles and/or dom elements
* @param from
*/
cleanUpLayout: function( from ) {
if ( from == 'default' || from == 'timeline' || from == 'modern' || from == 'trendy' ) {
this.$sectionsWrapper.clearPreviousTransitions().resetInlineCSS( 'width', 'height' );
this.$sectionsHelper.clearPreviousTransitions().resetInlineCSS( 'position', 'width', 'left' );
this.$sections.resetInlineCSS( 'width', 'display' );
this.$container.removeClass( 'autoresize' );
} else if ( from == 'accordion' ) {
this.$container.removeClass( 'accordion' );
this.$sections.resetInlineCSS( 'display' );
this.$contents.resetInlineCSS( 'height', 'padding-top', 'padding-bottom', 'display', 'opacity' );
} else if ( from == 'ver' ) {
this.$contents.resetInlineCSS( 'height', 'padding-top', 'padding-bottom', 'display', 'opacity' );
}
},
/**
* Apply layout's special inline styles and/or dom elements
* @param to
*/
prepareLayout: function( to ) {
if ( to != 'accordion' && this.active[ 0 ] == undefined ) {
this.active[ 0 ] = this.activeOnInit[ 0 ];
if ( this.active[ 0 ] != undefined ) {
this.tabs[ this.active[ 0 ] ].addClass( 'active' );
this.sections[ this.active[ 0 ] ].addClass( 'active' );
}
}
if ( to == 'default' || to == 'timeline' || to == 'modern' || to == 'trendy' ) {
this.$container.addClass( 'autoresize' );
this.$sectionsHelper.css( 'position', 'absolute' );
} else if ( to == 'accordion' ) {
this.$container.addClass( 'accordion' );
this.$contents.hide();
if ( this.curLayout != 'accordion' && this.active[ 0 ] != undefined && this.active[ 0 ] != this.definedActive[ 0 ] ) {
this.tabs[ this.active[ 0 ] ].removeClass( 'active' );
this.sections[ this.active[ 0 ] ].removeClass( 'active' );
this.active[ 0 ] = this.definedActive[ 0 ];
}
for ( var i = 0; i < this.active.length; i ++ ) {
if ( this.contents[ this.active[ i ] ] !== undefined ) {
this.tabs[ this.active[ i ] ].addClass( 'active' );
this.sections[ this.active[ i ] ].addClass( 'active' );
this.contents[ this.active[ i ] ].show();
}
}
} else if ( to == 'ver' ) {
this.$contents.hide();
this.contents[ this.active[ 0 ] ].show();
}
},
/**
* Measure needed sizes and store them to this.tabWidths variable
*
* TODO Count minWidth here as well
*/
measure: function() {
if ( this.basicLayout == 'ver' ) {
// Measuring minimum tabs width
this.$tabsList.css( 'width', 0 );
var minTabWidth = this.$tabsList.outerWidth( true );
this.$tabsList.css( 'width', '' );
// Measuring the mininum content width
this.$container.addClass( 'measure' );
var minContentWidth = this.$sectionsWrapper.outerWidth( true );
this.$container.removeClass( 'measure' );
// Measuring minimum tabs width for percent-based sizes
var navWidth = this.$container.usMod( 'navwidth' );
if ( navWidth != 'auto' ) {
// Percent-based measure
minTabWidth = Math.max( minTabWidth, minContentWidth * parseInt( navWidth ) / ( 100 - parseInt( navWidth ) ) );
}
this.minWidth = Math.max( 480, minContentWidth + minTabWidth + 1 );
} else {
this.tabWidths = [];
// We hide active line temporarily to count tab sizes properly
this.$container.addClass( 'measure' );
for ( var index = 0; index < this.tabs.length; index ++ ) {
this.tabWidths.push( this.tabs[ index ].outerWidth( true ) );
}
this.$container.removeClass( 'measure' );
if ( this.basicLayout == 'default' || this.basicLayout == 'timeline' || this.basicLayout == 'modern' || this.basicLayout == 'trendy' ) {
// Array sum
this.minWidth = this.tabWidths.reduce( function( pv, cv ) {
return pv + cv;
}, 0 );
}
}
},
/**
* Open tab section
*
* @param index int
*/
openSection: function( index ) {
if ( this.sections[ index ] === undefined ) {
return;
}
if ( this.curLayout == 'default' || this.curLayout == 'timeline' || this.curLayout == 'modern' || this.curLayout == 'trendy' ) {
this.$container.addClass( 'autoresize' );
this.$sections.removeClass( 'active' ).css( 'display', 'none' );
this.sections[ index ].stop( true, true ).fadeIn( this.options.duration, function() {
$( this ).addClass( 'active' );
} );
} else if ( this.curLayout == 'accordion' ) {
if ( this.contents[ this.active[ 0 ] ] !== undefined ) {
this.contents[ this.active[ 0 ] ].css( 'display', 'block' ).slideUp( this.options.duration );
}
this.contents[ index ].css( 'display', 'none' ).slideDown( this.options.duration, this._events.contentChanged );
// Scrolling to the opened section at small window dimensions
if ( $us.canvas.winWidth < 768 && this.headerClicked == true ) {
var newTop = this.headers[ 0 ].offset().top;
for ( var i = 0; i < index; i ++ ) {
newTop += this.headers[ i ].outerHeight();
}
$us.scroll.scrollTo( newTop, true );
this.headerClicked = false;
}
this.$sections.removeClass( 'active' );
this.sections[ index ].addClass( 'active' );
} else if ( this.curLayout == 'ver' ) {
if ( this.contents[ this.active[ 0 ] ] !== undefined ) {
this.contents[ this.active[ 0 ] ].css( 'display', 'none' );
}
this.contents[ index ].css( 'display', 'none' ).stop( true, true ).fadeIn( this.options.duration, this._events.contentChanged );
this.$sections.removeClass( 'active' );
this.sections[ index ].addClass( 'active' );
}
this._events.contentChanged();
this.$tabs.removeClass( 'active' );
this.tabs[ index ].addClass( 'active' );
this.active[ 0 ] = index;
},
/**
* Toggle some togglable accordion section
*
* @param index
*/
toggleSection: function( index ) {
// (!) Can only be used within accordion state
var indexPos = $.inArray( index, this.active );
if ( indexPos != - 1 ) {
this.contents[ index ].css( 'display', 'block' ).slideUp( this.options.duration, this._events.contentChanged );
this.tabs[ index ].removeClass( 'active' );
this.sections[ index ].removeClass( 'active' );
this.active.splice( indexPos, 1 );
} else {
this.contents[ index ].css( 'display', 'none' ).slideDown( this.options.duration, this._events.contentChanged );
this.tabs[ index ].addClass( 'active' );
this.sections[ index ].addClass( 'active' );
this.active.push( index );
}
},
/**
* Resize-driven logics
*/
resize: function() {
this.width = this.$container.width();
this.$tabsList.removeClass( 'hidden' );
// Basic layout may be overriden
if ( this.responsive ) {
// if (this.basicLayout == 'ver' && this.curLayout != 'ver') this.switchLayout('ver');
if ( this.curLayout != 'accordion' ) {
this.measure();
}
var nextLayout = ( this.width < this.minWidth ) ? 'accordion' : this.basicLayout;
if ( nextLayout !== this.curLayout ) {
this.switchLayout( nextLayout );
}
}
// Fixing tabs display
if ( this.curLayout == 'default' || this.curLayout == 'timeline' || this.curLayout == 'modern' || this.curLayout == 'trendy' ) {
this.$container.addClass( 'autoresize' );
this.$sectionsWrapper.css( 'width', this.width );
this.$sectionsHelper.css( 'width', this.count * this.width );
this.$sections.css( 'width', this.width );
if ( this.contents[ this.active[ 0 ] ] !== undefined ) {
this.$sectionsHelper.css( 'left', - this.width * ( this.isRtl ? ( this.count - this.active[ 0 ] - 1 ) : this.active[ 0 ] ) );
var height = this.sections[ this.active[ 0 ] ].height();
this.$sectionsWrapper.css( 'height', height );
}
}
this._events.contentChanged();
}
};
$.fn.wTabs = function( options ) {
return this.each( function() {
$( this ).data( 'wTabs', new $us.WTabs( this, options ) );
} );
};
}( jQuery );
/* RevSlider support for our tabs */
jQuery( function( $ ) {
$( '.w-tabs .rev_slider' ).each( function() {
var $slider = $( this );
$slider.bind( "revolution.slide.onloaded", function( e ) {
$us.$canvas.on( 'contentChange', function() {
$slider.revredraw();
} );
} );
} );
} );
@@ -0,0 +1,20 @@
!function($){"use strict";$us.WTabs=function(container,options){this.init(container,options)};$us.WTabs.prototype={init:function(container,options){var defaults={duration:300,easing:'cubic-bezier(.78,.13,.15,.86)'};this.options=$.extend({},defaults,options);this.isRtl=$('.l-body').hasClass('rtl');this.$container=$(container);this.$tabsList=this.$container.find('.w-tabs-list:first');this.$tabs=this.$tabsList.find('.w-tabs-item');this.$tabsH=this.$tabsList.find('.w-tabs-item-h');this.$sectionsWrapper=this.$container.find('.w-tabs-sections:first');this.$sectionsHelper=this.$sectionsWrapper.children();this.$sections=this.$sectionsHelper.find('.w-tabs-section');this.$headers=this.$sections.children('.w-tabs-section-header');this.$contents=this.$sections.children('.w-tabs-section-content');this.$line_charts=this.$container.find(".vc_line-chart");this.$round_charts=this.$container.find(".vc_round-chart");this.width=0;this.tabWidths=[];this.isTogglable=(this.$container.usMod('type')=='togglable');this.basicLayout=this.$container.hasClass('accordion')?'accordion':(this.$container.usMod('layout')||'default');this.curLayout=this.basicLayout;this.responsive=$us.canvas.options.responsive;this.active=[];this.activeOnInit=[];this.definedActive=[];this.count=this.$tabs.length;this.minWidth=0;if(this.count==0){return}
this.tabs=$.map(this.$tabs.toArray(),$);this.sections=$.map(this.$sections.toArray(),$);this.headers=$.map(this.$headers.toArray(),$);this.contents=$.map(this.$contents.toArray(),$);$.each(this.tabs,function(index){if(this.sections[index].hasClass('content-empty')){this.tabs[index].hide();this.sections[index].hide()}
if(this.tabs[index].hasClass('active')){this.active.push(index);this.activeOnInit.push(index)}
if(this.tabs[index].hasClass('defined-active')){this.definedActive.push(index)}
this.tabs[index].add(this.headers[index]).on('click',function(e){e.preventDefault();if(this.curLayout=='accordion'&&this.isTogglable){this.toggleSection(index)}
else{if(index!=this.active[0]){this.headerClicked=!0;this.openSection(index)}else if(this.curLayout=='accordion'){this.contents[index].css('display','block').slideUp(this.options.duration,this._events.contentChanged);this.tabs[index].removeClass('active');this.sections[index].removeClass('active');this.active[0]=undefined}}}.bind(this))}.bind(this));this.$tabsH.on('click',function(e){e.preventDefault()});this._events={resize:this.resize.bind(this),hashchange:this.hashchange.bind(this),contentChanged:function(){$us.$canvas.trigger('contentChange');this.$line_charts.length&&jQuery.fn.vcLineChart&&this.$line_charts.vcLineChart({reload:!1});this.$round_charts.length&&jQuery.fn.vcRoundChart&&this.$round_charts.vcRoundChart({reload:!1})}.bind(this)};this.switchLayout(this.curLayout);$us.$window.on('resize',this._events.resize);$us.$window.on('hashchange',this._events.hashchange);$us.$document.on('ready',this._events.resize);$us.$document.on('ready',function(){setTimeout(this._events.resize,50);setTimeout(function(){if(window.location.hash){var hash=window.location.hash.substr(1),$linkedSection=this.$container.find('.w-tabs-section[id="'+hash+'"]');if($linkedSection.length&&(!$linkedSection.hasClass('active'))){var $header=$linkedSection.find('.w-tabs-section-header');$header.click()}}}.bind(this),150)}.bind(this));$.each(this.tabs,function(index){if(this.headers[index].attr('href')!=undefined){var tabHref=this.headers[index].attr('href'),tabHeader=this.headers[index];$('a[href="'+tabHref+'"]').on('click',function(e){e.preventDefault();if($(this).hasClass('w-tabs-section-header','w-tabs-item-h')){return}
tabHeader.click()})}}.bind(this));this.$container.addClass('initialized')},hashchange:function(){if(window.location.hash){var hash=window.location.hash.substr(1),$linkedSection=this.$container.find('.w-tabs-section[id="'+hash+'"]');if($linkedSection.length&&(!$linkedSection.hasClass('active'))){var $header=$linkedSection.find('.w-tabs-section-header');$header.click()}}},switchLayout:function(to){this.cleanUpLayout(this.curLayout);this.prepareLayout(to);this.curLayout=to},cleanUpLayout:function(from){if(from=='default'||from=='timeline'||from=='modern'||from=='trendy'){this.$sectionsWrapper.clearPreviousTransitions().resetInlineCSS('width','height');this.$sectionsHelper.clearPreviousTransitions().resetInlineCSS('position','width','left');this.$sections.resetInlineCSS('width','display');this.$container.removeClass('autoresize')}else if(from=='accordion'){this.$container.removeClass('accordion');this.$sections.resetInlineCSS('display');this.$contents.resetInlineCSS('height','padding-top','padding-bottom','display','opacity')}else if(from=='ver'){this.$contents.resetInlineCSS('height','padding-top','padding-bottom','display','opacity')}},prepareLayout:function(to){if(to!='accordion'&&this.active[0]==undefined){this.active[0]=this.activeOnInit[0];if(this.active[0]!=undefined){this.tabs[this.active[0]].addClass('active');this.sections[this.active[0]].addClass('active')}}
if(to=='default'||to=='timeline'||to=='modern'||to=='trendy'){this.$container.addClass('autoresize');this.$sectionsHelper.css('position','absolute')}else if(to=='accordion'){this.$container.addClass('accordion');this.$contents.hide();if(this.curLayout!='accordion'&&this.active[0]!=undefined&&this.active[0]!=this.definedActive[0]){this.tabs[this.active[0]].removeClass('active');this.sections[this.active[0]].removeClass('active');this.active[0]=this.definedActive[0]}
for(var i=0;i<this.active.length;i ++){if(this.contents[this.active[i]]!==undefined){this.tabs[this.active[i]].addClass('active');this.sections[this.active[i]].addClass('active');this.contents[this.active[i]].show()}}}else if(to=='ver'){this.$contents.hide();this.contents[this.active[0]].show()}},measure:function(){if(this.basicLayout=='ver'){this.$tabsList.css('width',0);var minTabWidth=this.$tabsList.outerWidth(!0);this.$tabsList.css('width','');this.$container.addClass('measure');var minContentWidth=this.$sectionsWrapper.outerWidth(!0);this.$container.removeClass('measure');var navWidth=this.$container.usMod('navwidth');if(navWidth!='auto'){minTabWidth=Math.max(minTabWidth,minContentWidth*parseInt(navWidth)/(100-parseInt(navWidth)))}
this.minWidth=Math.max(480,minContentWidth+minTabWidth+1)}else{this.tabWidths=[];this.$container.addClass('measure');for(var index=0;index<this.tabs.length;index ++){this.tabWidths.push(this.tabs[index].outerWidth(!0))}
this.$container.removeClass('measure');if(this.basicLayout=='default'||this.basicLayout=='timeline'||this.basicLayout=='modern'||this.basicLayout=='trendy'){this.minWidth=this.tabWidths.reduce(function(pv,cv){return pv+cv},0)}}},openSection:function(index){if(this.sections[index]===undefined){return}
if(this.curLayout=='default'||this.curLayout=='timeline'||this.curLayout=='modern'||this.curLayout=='trendy'){this.$container.addClass('autoresize');this.$sections.removeClass('active').css('display','none');this.sections[index].stop(!0,!0).fadeIn(this.options.duration,function(){$(this).addClass('active')})}else if(this.curLayout=='accordion'){if(this.contents[this.active[0]]!==undefined){this.contents[this.active[0]].css('display','block').slideUp(this.options.duration)}
this.contents[index].css('display','none').slideDown(this.options.duration,this._events.contentChanged);if($us.canvas.winWidth<768&&this.headerClicked==!0){var newTop=this.headers[0].offset().top;for(var i=0;i<index;i ++){newTop+=this.headers[i].outerHeight()}
$us.scroll.scrollTo(newTop,!0);this.headerClicked=!1}
this.$sections.removeClass('active');this.sections[index].addClass('active')}else if(this.curLayout=='ver'){if(this.contents[this.active[0]]!==undefined){this.contents[this.active[0]].css('display','none')}
this.contents[index].css('display','none').stop(!0,!0).fadeIn(this.options.duration,this._events.contentChanged);this.$sections.removeClass('active');this.sections[index].addClass('active')}
this._events.contentChanged();this.$tabs.removeClass('active');this.tabs[index].addClass('active');this.active[0]=index},toggleSection:function(index){var indexPos=$.inArray(index,this.active);if(indexPos!=-1){this.contents[index].css('display','block').slideUp(this.options.duration,this._events.contentChanged);this.tabs[index].removeClass('active');this.sections[index].removeClass('active');this.active.splice(indexPos,1)}else{this.contents[index].css('display','none').slideDown(this.options.duration,this._events.contentChanged);this.tabs[index].addClass('active');this.sections[index].addClass('active');this.active.push(index)}},resize:function(){this.width=this.$container.width();this.$tabsList.removeClass('hidden');if(this.responsive){if(this.curLayout!='accordion'){this.measure()}
var nextLayout=(this.width<this.minWidth)?'accordion':this.basicLayout;if(nextLayout!==this.curLayout){this.switchLayout(nextLayout)}}
if(this.curLayout=='default'||this.curLayout=='timeline'||this.curLayout=='modern'||this.curLayout=='trendy'){this.$container.addClass('autoresize');this.$sectionsWrapper.css('width',this.width);this.$sectionsHelper.css('width',this.count*this.width);this.$sections.css('width',this.width);if(this.contents[this.active[0]]!==undefined){this.$sectionsHelper.css('left',-this.width*(this.isRtl?(this.count-this.active[0]-1):this.active[0]));var height=this.sections[this.active[0]].height();this.$sectionsWrapper.css('height',height)}}
this._events.contentChanged()}};$.fn.wTabs=function(options){return this.each(function(){$(this).data('wTabs',new $us.WTabs(this,options))})}}(jQuery);jQuery(function($){$('.w-tabs .rev_slider').each(function(){var $slider=$(this);$slider.bind("revolution.slide.onloaded",function(e){$us.$canvas.on('contentChange',function(){$slider.revredraw()})})})})