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,63 @@
/*
* jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
*
* Uses the built in easing capabilities added In jQuery 1.1
* to offer multiple easing options
*
* TERMS OF USE - jQuery Easing
*
* Open source under the BSD License.
*
* Copyright � 2008 George McGinley Smith
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* Neither the name of the author nor the names of contributors may be used to endorse
* or promote products derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
jQuery.easing.jswing=jQuery.easing.swing;jQuery.extend(jQuery.easing,{def:"easeOutQuad",swing:function(e,f,a,h,g){return jQuery.easing[jQuery.easing.def](e,f,a,h,g)},easeInQuad:function(e,f,a,h,g){return h*(f/=g)*f+a},easeOutQuad:function(e,f,a,h,g){return -h*(f/=g)*(f-2)+a},easeInOutQuad:function(e,f,a,h,g){if((f/=g/2)<1){return h/2*f*f+a}return -h/2*((--f)*(f-2)-1)+a},easeInCubic:function(e,f,a,h,g){return h*(f/=g)*f*f+a},easeOutCubic:function(e,f,a,h,g){return h*((f=f/g-1)*f*f+1)+a},easeInOutCubic:function(e,f,a,h,g){if((f/=g/2)<1){return h/2*f*f*f+a}return h/2*((f-=2)*f*f+2)+a},easeInQuart:function(e,f,a,h,g){return h*(f/=g)*f*f*f+a},easeOutQuart:function(e,f,a,h,g){return -h*((f=f/g-1)*f*f*f-1)+a},easeInOutQuart:function(e,f,a,h,g){if((f/=g/2)<1){return h/2*f*f*f*f+a}return -h/2*((f-=2)*f*f*f-2)+a},easeInQuint:function(e,f,a,h,g){return h*(f/=g)*f*f*f*f+a},easeOutQuint:function(e,f,a,h,g){return h*((f=f/g-1)*f*f*f*f+1)+a},easeInOutQuint:function(e,f,a,h,g){if((f/=g/2)<1){return h/2*f*f*f*f*f+a}return h/2*((f-=2)*f*f*f*f+2)+a},easeInSine:function(e,f,a,h,g){return -h*Math.cos(f/g*(Math.PI/2))+h+a},easeOutSine:function(e,f,a,h,g){return h*Math.sin(f/g*(Math.PI/2))+a},easeInOutSine:function(e,f,a,h,g){return -h/2*(Math.cos(Math.PI*f/g)-1)+a},easeInExpo:function(e,f,a,h,g){return(f==0)?a:h*Math.pow(2,10*(f/g-1))+a},easeOutExpo:function(e,f,a,h,g){return(f==g)?a+h:h*(-Math.pow(2,-10*f/g)+1)+a},easeInOutExpo:function(e,f,a,h,g){if(f==0){return a}if(f==g){return a+h}if((f/=g/2)<1){return h/2*Math.pow(2,10*(f-1))+a}return h/2*(-Math.pow(2,-10*--f)+2)+a},easeInCirc:function(e,f,a,h,g){return -h*(Math.sqrt(1-(f/=g)*f)-1)+a},easeOutCirc:function(e,f,a,h,g){return h*Math.sqrt(1-(f=f/g-1)*f)+a},easeInOutCirc:function(e,f,a,h,g){if((f/=g/2)<1){return -h/2*(Math.sqrt(1-f*f)-1)+a}return h/2*(Math.sqrt(1-(f-=2)*f)+1)+a},easeInElastic:function(f,h,e,l,k){var i=1.70158;var j=0;var g=l;if(h==0){return e}if((h/=k)==1){return e+l}if(!j){j=k*0.3}if(g<Math.abs(l)){g=l;var i=j/4}else{var i=j/(2*Math.PI)*Math.asin(l/g)}return -(g*Math.pow(2,10*(h-=1))*Math.sin((h*k-i)*(2*Math.PI)/j))+e},easeOutElastic:function(f,h,e,l,k){var i=1.70158;var j=0;var g=l;if(h==0){return e}if((h/=k)==1){return e+l}if(!j){j=k*0.3}if(g<Math.abs(l)){g=l;var i=j/4}else{var i=j/(2*Math.PI)*Math.asin(l/g)}return g*Math.pow(2,-10*h)*Math.sin((h*k-i)*(2*Math.PI)/j)+l+e},easeInOutElastic:function(f,h,e,l,k){var i=1.70158;var j=0;var g=l;if(h==0){return e}if((h/=k/2)==2){return e+l}if(!j){j=k*(0.3*1.5)}if(g<Math.abs(l)){g=l;var i=j/4}else{var i=j/(2*Math.PI)*Math.asin(l/g)}if(h<1){return -0.5*(g*Math.pow(2,10*(h-=1))*Math.sin((h*k-i)*(2*Math.PI)/j))+e}return g*Math.pow(2,-10*(h-=1))*Math.sin((h*k-i)*(2*Math.PI)/j)*0.5+l+e},easeInBack:function(e,f,a,i,h,g){if(g==undefined){g=1.70158}return i*(f/=h)*f*((g+1)*f-g)+a},easeOutBack:function(e,f,a,i,h,g){if(g==undefined){g=1.70158}return i*((f=f/h-1)*f*((g+1)*f+g)+1)+a},easeInOutBack:function(e,f,a,i,h,g){if(g==undefined){g=1.70158}if((f/=h/2)<1){return i/2*(f*f*(((g*=(1.525))+1)*f-g))+a}return i/2*((f-=2)*f*(((g*=(1.525))+1)*f+g)+2)+a},easeInBounce:function(e,f,a,h,g){return h-jQuery.easing.easeOutBounce(e,g-f,0,h,g)+a},easeOutBounce:function(e,f,a,h,g){if((f/=g)<(1/2.75)){return h*(7.5625*f*f)+a}else{if(f<(2/2.75)){return h*(7.5625*(f-=(1.5/2.75))*f+0.75)+a}else{if(f<(2.5/2.75)){return h*(7.5625*(f-=(2.25/2.75))*f+0.9375)+a}else{return h*(7.5625*(f-=(2.625/2.75))*f+0.984375)+a}}}},easeInOutBounce:function(e,f,a,h,g){if(f<g/2){return jQuery.easing.easeInBounce(e,f*2,0,h,g)*0.5+a}return jQuery.easing.easeOutBounce(e,f*2-g,0,h,g)*0.5+h*0.5+a}});
// Animation of elements appearance
jQuery( function( $ ) {
"use strict";
$( '.animate_fade, .animate_afc, .animate_afl, .animate_afr, .animate_aft, .animate_afb, .animate_wfc, ' +
'.animate_hfc, .animate_rfc, .animate_rfl, .animate_rfr' ).each( function() {
$us.scroll.addWaypoint( $( this ), '15%', function( $elm ) {
if ( ! $elm.hasClass( 'animate_start' ) ) {
setTimeout( function() {
$elm.addClass( 'animate_start' );
}, 20 );
}
} );
} );
$( '.wpb_animate_when_almost_visible' ).each( function() {
$us.scroll.addWaypoint( $( this ), '15%', function( $elm ) {
if ( ! $elm.hasClass( 'wpb_start_animation' ) ) {
setTimeout( function() {
$elm.addClass( 'wpb_start_animation' );
}, 20 );
}
} );
} );
} );
@@ -0,0 +1 @@
jQuery.easing.jswing=jQuery.easing.swing;jQuery.extend(jQuery.easing,{def:"easeOutQuad",swing:function(e,f,a,h,g){return jQuery.easing[jQuery.easing.def](e,f,a,h,g)},easeInQuad:function(e,f,a,h,g){return h*(f/=g)*f+a},easeOutQuad:function(e,f,a,h,g){return -h*(f/=g)*(f-2)+a},easeInOutQuad:function(e,f,a,h,g){if((f/=g/2)<1){return h/2*f*f+a}return -h/2*((--f)*(f-2)-1)+a},easeInCubic:function(e,f,a,h,g){return h*(f/=g)*f*f+a},easeOutCubic:function(e,f,a,h,g){return h*((f=f/g-1)*f*f+1)+a},easeInOutCubic:function(e,f,a,h,g){if((f/=g/2)<1){return h/2*f*f*f+a}return h/2*((f-=2)*f*f+2)+a},easeInQuart:function(e,f,a,h,g){return h*(f/=g)*f*f*f+a},easeOutQuart:function(e,f,a,h,g){return -h*((f=f/g-1)*f*f*f-1)+a},easeInOutQuart:function(e,f,a,h,g){if((f/=g/2)<1){return h/2*f*f*f*f+a}return -h/2*((f-=2)*f*f*f-2)+a},easeInQuint:function(e,f,a,h,g){return h*(f/=g)*f*f*f*f+a},easeOutQuint:function(e,f,a,h,g){return h*((f=f/g-1)*f*f*f*f+1)+a},easeInOutQuint:function(e,f,a,h,g){if((f/=g/2)<1){return h/2*f*f*f*f*f+a}return h/2*((f-=2)*f*f*f*f+2)+a},easeInSine:function(e,f,a,h,g){return -h*Math.cos(f/g*(Math.PI/2))+h+a},easeOutSine:function(e,f,a,h,g){return h*Math.sin(f/g*(Math.PI/2))+a},easeInOutSine:function(e,f,a,h,g){return -h/2*(Math.cos(Math.PI*f/g)-1)+a},easeInExpo:function(e,f,a,h,g){return(f==0)?a:h*Math.pow(2,10*(f/g-1))+a},easeOutExpo:function(e,f,a,h,g){return(f==g)?a+h:h*(-Math.pow(2,-10*f/g)+1)+a},easeInOutExpo:function(e,f,a,h,g){if(f==0){return a}if(f==g){return a+h}if((f/=g/2)<1){return h/2*Math.pow(2,10*(f-1))+a}return h/2*(-Math.pow(2,-10*--f)+2)+a},easeInCirc:function(e,f,a,h,g){return -h*(Math.sqrt(1-(f/=g)*f)-1)+a},easeOutCirc:function(e,f,a,h,g){return h*Math.sqrt(1-(f=f/g-1)*f)+a},easeInOutCirc:function(e,f,a,h,g){if((f/=g/2)<1){return -h/2*(Math.sqrt(1-f*f)-1)+a}return h/2*(Math.sqrt(1-(f-=2)*f)+1)+a},easeInElastic:function(f,h,e,l,k){var i=1.70158;var j=0;var g=l;if(h==0){return e}if((h/=k)==1){return e+l}if(!j){j=k*0.3}if(g<Math.abs(l)){g=l;var i=j/4}else{var i=j/(2*Math.PI)*Math.asin(l/g)}return-(g*Math.pow(2,10*(h-=1))*Math.sin((h*k-i)*(2*Math.PI)/j))+e},easeOutElastic:function(f,h,e,l,k){var i=1.70158;var j=0;var g=l;if(h==0){return e}if((h/=k)==1){return e+l}if(!j){j=k*0.3}if(g<Math.abs(l)){g=l;var i=j/4}else{var i=j/(2*Math.PI)*Math.asin(l/g)}return g*Math.pow(2,-10*h)*Math.sin((h*k-i)*(2*Math.PI)/j)+l+e},easeInOutElastic:function(f,h,e,l,k){var i=1.70158;var j=0;var g=l;if(h==0){return e}if((h/=k/2)==2){return e+l}if(!j){j=k*(0.3*1.5)}if(g<Math.abs(l)){g=l;var i=j/4}else{var i=j/(2*Math.PI)*Math.asin(l/g)}if(h<1){return-0.5*(g*Math.pow(2,10*(h-=1))*Math.sin((h*k-i)*(2*Math.PI)/j))+e}return g*Math.pow(2,-10*(h-=1))*Math.sin((h*k-i)*(2*Math.PI)/j)*0.5+l+e},easeInBack:function(e,f,a,i,h,g){if(g==undefined){g=1.70158}return i*(f/=h)*f*((g+1)*f-g)+a},easeOutBack:function(e,f,a,i,h,g){if(g==undefined){g=1.70158}return i*((f=f/h-1)*f*((g+1)*f+g)+1)+a},easeInOutBack:function(e,f,a,i,h,g){if(g==undefined){g=1.70158}if((f/=h/2)<1){return i/2*(f*f*(((g*=(1.525))+1)*f-g))+a}return i/2*((f-=2)*f*(((g*=(1.525))+1)*f+g)+2)+a},easeInBounce:function(e,f,a,h,g){return h-jQuery.easing.easeOutBounce(e,g-f,0,h,g)+a},easeOutBounce:function(e,f,a,h,g){if((f/=g)<(1/2.75)){return h*(7.5625*f*f)+a}else{if(f<(2/2.75)){return h*(7.5625*(f-=(1.5/2.75))*f+0.75)+a}else{if(f<(2.5/2.75)){return h*(7.5625*(f-=(2.25/2.75))*f+0.9375)+a}else{return h*(7.5625*(f-=(2.625/2.75))*f+0.984375)+a}}}},easeInOutBounce:function(e,f,a,h,g){if(f<g/2){return jQuery.easing.easeInBounce(e,f*2,0,h,g)*0.5+a}return jQuery.easing.easeOutBounce(e,f*2-g,0,h,g)*0.5+h*0.5+a}});jQuery(function($){"use strict";$('.animate_fade, .animate_afc, .animate_afl, .animate_afr, .animate_aft, .animate_afb, .animate_wfc, '+'.animate_hfc, .animate_rfc, .animate_rfl, .animate_rfr').each(function(){$us.scroll.addWaypoint($(this),'15%',function($elm){if(!$elm.hasClass('animate_start')){setTimeout(function(){$elm.addClass('animate_start')},20)}})});$('.wpb_animate_when_almost_visible').each(function(){$us.scroll.addWaypoint($(this),'15%',function($elm){if(!$elm.hasClass('wpb_start_animation')){setTimeout(function(){$elm.addClass('wpb_start_animation')},20)}})})})
@@ -0,0 +1,76 @@
/**
* WordPress Comments Form
*
*/
! function( $ ) {
"use strict";
$us.CommnentsForm = function( container, options ) {
this.init( container, options );
};
$us.CommnentsForm.prototype = {
init: function( container, options ) {
this.$container = $( container );
this.$form = this.$container.find( 'form.comment-form' );
if ( ! this.$form.length ) {
return;
}
this.$jsonContainer = this.$container.find( '.us-comments-json' );
if ( ! this.$jsonContainer.length ) {
return;
}
this.jsonData = this.$jsonContainer[ 0 ].onclick() || {};
this.$jsonContainer.remove();
this.$fields = {
content: {
field: this.$form.find( 'textarea' ),
msg: this.jsonData.no_content_msg || 'Please enter a Message'
},
name: {
field: this.$form.find( '.for_text input[type="text"]' ),
msg: this.jsonData.no_name_msg || 'Please enter your Name'
},
email: {
field: this.$form.find( '.for_email input[type="email"]' ),
msg: this.jsonData.no_email_msg || 'Please enter a valid email address.'
}
};
this._events = {
formSubmit: this.formSubmit.bind( this )
};
this.$form.on( 'submit', this._events.formSubmit );
},
formSubmit: function( event ) {
// Clear errors
this.$form.find( '.w-form-row.check_wrong' ).removeClass( 'check_wrong' );
this.$form.find( '.w-form-state' ).html( '' );
// Do not send empty fields
for ( var i in this.$fields ) {
if ( this.$fields[ i ].field.length == 0 ) {
continue;
}
if ( this.$fields[ i ].field.val() == '' && this.$fields[ i ].field.attr( 'data-required' ) ) {
this.$fields[ i ].field.closest( '.w-form-row' ).toggleClass( 'check_wrong' );
this.$fields[ i ].field.closest( '.w-form-row' ).find( '.w-form-row-state' ).html( this.$fields[ i ].msg );
event.preventDefault();
}
}
}
};
$.fn.CommnentsForm = function( options ) {
return this.each( function() {
$( this ).data( 'CommnentsForm', new $us.CommnentsForm( this, options ) );
} );
};
$( function() {
$( '.w-post-elm.post_comments.layout_comments_template' ).CommnentsForm();
$( '.l-section.for_comments' ).CommnentsForm();
} );
}( jQuery );
@@ -0,0 +1,4 @@
!function($){"use strict";$us.CommnentsForm=function(container,options){this.init(container,options)};$us.CommnentsForm.prototype={init:function(container,options){this.$container=$(container);this.$form=this.$container.find('form.comment-form');if(!this.$form.length){return}
this.$jsonContainer=this.$container.find('.us-comments-json');if(!this.$jsonContainer.length){return}
this.jsonData=this.$jsonContainer[0].onclick()||{};this.$jsonContainer.remove();this.$fields={content:{field:this.$form.find('textarea'),msg:this.jsonData.no_content_msg||'Please enter a Message'},name:{field:this.$form.find('.for_text input[type="text"]'),msg:this.jsonData.no_name_msg||'Please enter your Name'},email:{field:this.$form.find('.for_email input[type="email"]'),msg:this.jsonData.no_email_msg||'Please enter a valid email address.'}};this._events={formSubmit:this.formSubmit.bind(this)};this.$form.on('submit',this._events.formSubmit)},formSubmit:function(event){this.$form.find('.w-form-row.check_wrong').removeClass('check_wrong');this.$form.find('.w-form-state').html('');for(var i in this.$fields){if(this.$fields[i].field.length==0){continue}
if(this.$fields[i].field.val()==''&&this.$fields[i].field.attr('data-required')){this.$fields[i].field.closest('.w-form-row').toggleClass('check_wrong');this.$fields[i].field.closest('.w-form-row').find('.w-form-row-state').html(this.$fields[i].msg);event.preventDefault()}}}};$.fn.CommnentsForm=function(options){return this.each(function(){$(this).data('CommnentsForm',new $us.CommnentsForm(this,options))})};$(function(){$('.w-post-elm.post_comments.layout_comments_template').CommnentsForm();$('.l-section.for_comments').CommnentsForm()})}(jQuery)
@@ -0,0 +1,257 @@
/**
* UpSolution Shortcode: us_cform
*/
jQuery( function( $ ) {
$( '.w-form.for_cform' ).each( function() {
var $container = $( this ),
$form = $container.find( 'form:first' ),
$submitBtn = $form.find( '.w-btn' ),
$resultField = $form.find( '.w-form-message' ),
options = $container.find( '.w-form-json' )[ 0 ].onclick(),
$requiredCheckboxes = $form.find( '.for_checkboxes.required' );
$container.find( '.w-form-json' ).remove();
$form.submit( function( event ) {
event.preventDefault();
// Prevent double-sending
if ( $submitBtn.hasClass( 'loading' ) ) {
return;
}
$resultField.usMod( 'type', false ).html( '' );
// Validation
var errors = 0;
$form.find( '[data-required="true"]' ).each( function() {
var $input = $( this ),
isEmpty = $input.is( '[type="checkbox"]' ) ? ( ! $input.is( ':checked' ) ) : ( $input.val() == '' ),
$row = $input.closest( '.w-form-row' );
// Skip checkboxes
if ( $row.hasClass( 'for_checkboxes' ) ) {
return true;
}
$row.toggleClass( 'check_wrong', isEmpty );
if ( isEmpty ) {
errors ++;
}
} );
// Count required checkboxes separately
if ( $requiredCheckboxes.length ) {
$requiredCheckboxes.each( function() {
var $input = $( this ).find( 'input[type="checkbox"]' ),
$row = $input.closest( '.w-form-row' ),
isEmpty = ! $input.is( ':checked' ) ? true : false;
$row.toggleClass( 'check_wrong', isEmpty );
if ( isEmpty ) {
errors ++;
}
} );
}
if ( errors != 0 ) {
return;
}
$submitBtn.addClass( 'loading' );
$.ajax( {
type: 'POST',
url: options.ajaxurl,
dataType: 'json',
data: $form.serialize(),
success: function( result ) {
if ( result.success ) {
$resultField.usMod( 'type', 'success' ).html( result.data );
$form.find( '.w-form-row.check_wrong' ).removeClass( 'check_wrong' );
$form.find( '.w-form-row.not-empty' ).removeClass( 'not-empty' );
$form.find( 'input[type="text"], input[type="email"], textarea' ).val( '' );
$form[ 0 ].reset();
} else {
$form.find( '.w-form-row.check_wrong' ).removeClass( 'check_wrong' );
if ( result.data && typeof result.data == 'object' ) {
for ( var fieldName in result.data ) {
if ( fieldName == 'empty_message' ) {
$resultField.usMod( 'type', 'error' );
continue;
}
if ( ! result.data.hasOwnProperty( fieldName ) ) {
continue;
}
fieldName = result.data[ fieldName ].name;
var $input = $form.find( '[name="' + fieldName + '"]' );
$input.closest( '.w-form-row' ).addClass( 'check_wrong' )
}
} else {
$resultField.usMod( 'type', 'error' ).html( result.data );
}
}
},
complete: function() {
$submitBtn.removeClass( 'loading' );
}
} );
} );
} );
} );
/**
* UpSolution Login Widget: widget_us_login
*
*/
! function( $ ) {
"use strict";
$us.WLogin = function( container, options ) {
this.init( container, options );
};
$us.WLogin.prototype = {
init: function( container, options ) {
this.$container = $( container );
// Prevent double init
if ( this.$container.data( 'loginInit' ) == 1 ) {
return;
}
this.$container.data( 'loginInit', 1 );
this.$form = this.$container.find( '.w-form' );
this.$profile = this.$container.find( '.w-profile' );
this.$preloader = this.$container.find( 'div.g-preloader' );
this.$submitBtn = this.$form.find( '.w-btn' );
this.$username = this.$form.find( '.for_text input[type="text"]' );
this.$password = this.$form.find( '.for_password input[type="password"]' );
this.$nonceVal = this.$form.find( '#us_login_nonce' ).val();
this.$resultField = this.$form.find( '.w-form-message' );
this.$jsonContainer = this.$container.find( '.w-profile-json' );
this.jsonData = this.$jsonContainer[ 0 ].onclick() || {};
this.$jsonContainer.remove();
this.ajaxUrl = this.jsonData.ajax_url || '';
this.logoutRedirect = this.jsonData.logout_redirect || '/';
this.loginRedirect = this.jsonData.login_redirect || '';
this._events = {
formSubmit: this.formSubmit.bind( this )
};
this.$form.on( 'submit', this._events.formSubmit );
$.ajax( {
type: 'post',
url: this.ajaxUrl,
data: {
action: 'us_ajax_user_info',
logout_redirect: this.logoutRedirect
},
success: function( result ) {
if ( result.success ) {
var $avatar = this.$profile.find( '.w-profile-avatar' ),
$name = this.$profile.find( '.w-profile-name' ),
$logoutLink = this.$profile.find( '.w-profile-link.for_logout' );
$avatar.html( result.data.avatar );
$name.html( result.data.name );
$logoutLink.attr( 'href', result.data.logout_url );
this.$profile.removeClass( 'hidden' );
} else {
this.$form.removeClass( 'hidden' );
}
this.$preloader.addClass( 'hidden' );
}.bind( this )
} );
},
formSubmit: function( event ) {
event.preventDefault();
// Prevent double-sending
if ( this.$submitBtn.hasClass( 'loading' ) ) {
return;
}
// Clear errors
this.$resultField.usMod( 'type', false ).html( '' );
this.$form.find( '.w-form-row.check_wrong' ).removeClass( 'check_wrong' );
this.$form.find( '.w-form-state' ).html( '' );
// Prevent sending data with empty username
if ( this.$form.find( '.for_text input[type="text"]' ).val() == '' ) {
this.$username.closest( '.w-form-row' ).toggleClass( 'check_wrong' );
return;
}
this.$submitBtn.addClass( 'loading' );
$.ajax( {
type: 'post',
url: this.ajaxUrl,
dataType: 'json',
data: {
action: 'us_ajax_login',
username: this.$username.val(),
password: this.$password.val(),
us_login_nonce: this.$nonceVal
},
success: function( result ) {
if ( result.success ) {
document.location.href = this.loginRedirect;
} else {
if ( result.data.code == 'invalid_username' ) {
var $rowLog = this.$username.closest( '.w-form-row' );
$rowLog.toggleClass( 'check_wrong' );
$rowLog.find( '.w-form-row-state' ).html( result.data.message ? result.data.message : '' );
} else if ( result.data.code == 'incorrect_password' || result.data.code == 'empty_password' ) {
var $rowPwd = this.$password.closest( '.w-form-row' );
$rowPwd.toggleClass( 'check_wrong' );
$rowPwd.find( '.w-form-row-state' ).html( result.data.message ? result.data.message : '' );
} else {
this.$resultField.usMod( 'type', 'error' ).html( result.data.message );
}
}
this.$submitBtn.removeClass( 'loading' );
}.bind( this ),
} );
}
};
$.fn.wUsLogin = function( options ) {
return this.each( function() {
$( this ).data( 'wUsLogin', new $us.WLogin( this, options ) );
} );
};
$( function() {
$( '.widget_us_login' ).wUsLogin();
} );
}( jQuery );
/**
* Form customs
*/
jQuery( function( $ ) {
// Add not-empty class when filling form fields
$( 'input[type="text"], input[type="email"], input[type="tel"], input[type="number"], input[type="date"], input[type="search"], input[type="url"], input[type="password"], textarea' ).each( function( index, input ) {
var $input = $( input ),
$row = $input.closest( '.w-form-row' );
if ( $input.attr( 'type' ) == 'hidden' ) {
return;
}
$row.toggleClass( 'not-empty', $input.val() != '' );
$input.on( 'input', function() {
$row.toggleClass( 'not-empty', $input.val() != '' );
} );
} );
// Add focused class for all form fields
$( document ).on( 'focus', '.w-form-row-field input, .w-form-row-field textarea', function() {
$( this ).closest( '.w-form-row' ).addClass( 'focused' );
} );
$( document ).on( 'blur', '.w-form-row-field input, .w-form-row-field textarea', function() {
$( this ).closest( '.w-form-row' ).removeClass( 'focused' );
} );
} );
+13
View File
@@ -0,0 +1,13 @@
jQuery(function($){$('.w-form.for_cform').each(function(){var $container=$(this),$form=$container.find('form:first'),$submitBtn=$form.find('.w-btn'),$resultField=$form.find('.w-form-message'),options=$container.find('.w-form-json')[0].onclick(),$requiredCheckboxes=$form.find('.for_checkboxes.required');$container.find('.w-form-json').remove();$form.submit(function(event){event.preventDefault();if($submitBtn.hasClass('loading')){return}
$resultField.usMod('type',!1).html('');var errors=0;$form.find('[data-required="true"]').each(function(){var $input=$(this),isEmpty=$input.is('[type="checkbox"]')?(!$input.is(':checked')):($input.val()==''),$row=$input.closest('.w-form-row');if($row.hasClass('for_checkboxes')){return!0}
$row.toggleClass('check_wrong',isEmpty);if(isEmpty){errors ++}});if($requiredCheckboxes.length){$requiredCheckboxes.each(function(){var $input=$(this).find('input[type="checkbox"]'),$row=$input.closest('.w-form-row'),isEmpty=!$input.is(':checked')?!0:!1;$row.toggleClass('check_wrong',isEmpty);if(isEmpty){errors ++}})}
if(errors!=0){return}
$submitBtn.addClass('loading');$.ajax({type:'POST',url:options.ajaxurl,dataType:'json',data:$form.serialize(),success:function(result){if(result.success){$resultField.usMod('type','success').html(result.data);$form.find('.w-form-row.check_wrong').removeClass('check_wrong');$form.find('.w-form-row.not-empty').removeClass('not-empty');$form.find('input[type="text"], input[type="email"], textarea').val('');$form[0].reset()}else{$form.find('.w-form-row.check_wrong').removeClass('check_wrong');if(result.data&&typeof result.data=='object'){for(var fieldName in result.data){if(fieldName=='empty_message'){$resultField.usMod('type','error');continue}
if(!result.data.hasOwnProperty(fieldName)){continue}
fieldName=result.data[fieldName].name;var $input=$form.find('[name="'+fieldName+'"]');$input.closest('.w-form-row').addClass('check_wrong')}}else{$resultField.usMod('type','error').html(result.data)}}},complete:function(){$submitBtn.removeClass('loading')}})})})});!function($){"use strict";$us.WLogin=function(container,options){this.init(container,options)};$us.WLogin.prototype={init:function(container,options){this.$container=$(container);if(this.$container.data('loginInit')==1){return}
this.$container.data('loginInit',1);this.$form=this.$container.find('.w-form');this.$profile=this.$container.find('.w-profile');this.$preloader=this.$container.find('div.g-preloader');this.$submitBtn=this.$form.find('.w-btn');this.$username=this.$form.find('.for_text input[type="text"]');this.$password=this.$form.find('.for_password input[type="password"]');this.$nonceVal=this.$form.find('#us_login_nonce').val();this.$resultField=this.$form.find('.w-form-message');this.$jsonContainer=this.$container.find('.w-profile-json');this.jsonData=this.$jsonContainer[0].onclick()||{};this.$jsonContainer.remove();this.ajaxUrl=this.jsonData.ajax_url||'';this.logoutRedirect=this.jsonData.logout_redirect||'/';this.loginRedirect=this.jsonData.login_redirect||'';this._events={formSubmit:this.formSubmit.bind(this)};this.$form.on('submit',this._events.formSubmit);$.ajax({type:'post',url:this.ajaxUrl,data:{action:'us_ajax_user_info',logout_redirect:this.logoutRedirect},success:function(result){if(result.success){var $avatar=this.$profile.find('.w-profile-avatar'),$name=this.$profile.find('.w-profile-name'),$logoutLink=this.$profile.find('.w-profile-link.for_logout');$avatar.html(result.data.avatar);$name.html(result.data.name);$logoutLink.attr('href',result.data.logout_url);this.$profile.removeClass('hidden')}else{this.$form.removeClass('hidden')}
this.$preloader.addClass('hidden')}.bind(this)})},formSubmit:function(event){event.preventDefault();if(this.$submitBtn.hasClass('loading')){return}
this.$resultField.usMod('type',!1).html('');this.$form.find('.w-form-row.check_wrong').removeClass('check_wrong');this.$form.find('.w-form-state').html('');if(this.$form.find('.for_text input[type="text"]').val()==''){this.$username.closest('.w-form-row').toggleClass('check_wrong');return}
this.$submitBtn.addClass('loading');$.ajax({type:'post',url:this.ajaxUrl,dataType:'json',data:{action:'us_ajax_login',username:this.$username.val(),password:this.$password.val(),us_login_nonce:this.$nonceVal},success:function(result){if(result.success){document.location.href=this.loginRedirect}else{if(result.data.code=='invalid_username'){var $rowLog=this.$username.closest('.w-form-row');$rowLog.toggleClass('check_wrong');$rowLog.find('.w-form-row-state').html(result.data.message?result.data.message:'')}else if(result.data.code=='incorrect_password'||result.data.code=='empty_password'){var $rowPwd=this.$password.closest('.w-form-row');$rowPwd.toggleClass('check_wrong');$rowPwd.find('.w-form-row-state').html(result.data.message?result.data.message:'')}else{this.$resultField.usMod('type','error').html(result.data.message)}}
this.$submitBtn.removeClass('loading')}.bind(this),})}};$.fn.wUsLogin=function(options){return this.each(function(){$(this).data('wUsLogin',new $us.WLogin(this,options))})};$(function(){$('.widget_us_login').wUsLogin()})}(jQuery);jQuery(function($){$('input[type="text"], input[type="email"], input[type="tel"], input[type="number"], input[type="date"], input[type="search"], input[type="url"], input[type="password"], textarea').each(function(index,input){var $input=$(input),$row=$input.closest('.w-form-row');if($input.attr('type')=='hidden'){return}
$row.toggleClass('not-empty',$input.val()!='');$input.on('input',function(){$row.toggleClass('not-empty',$input.val()!='')})});$(document).on('focus','.w-form-row-field input, .w-form-row-field textarea',function(){$(this).closest('.w-form-row').addClass('focused')});$(document).on('blur','.w-form-row-field input, .w-form-row-field textarea',function(){$(this).closest('.w-form-row').removeClass('focused')})})
@@ -0,0 +1,550 @@
/*!
* imagesLoaded PACKAGED v4.1.4
* JavaScript is all like "You images are done yet or what?"
* MIT License
*/
!function(e,t){"function"==typeof define&&define.amd?define("ev-emitter/ev-emitter",t):"object"==typeof module&&module.exports?module.exports=t():e.EvEmitter=t()}("undefined"!=typeof window?window:this,function(){function e(){}var t=e.prototype;return t.on=function(e,t){if(e&&t){var i=this._events=this._events||{},n=i[e]=i[e]||[];return n.indexOf(t)==-1&&n.push(t),this}},t.once=function(e,t){if(e&&t){this.on(e,t);var i=this._onceEvents=this._onceEvents||{},n=i[e]=i[e]||{};return n[t]=!0,this}},t.off=function(e,t){var i=this._events&&this._events[e];if(i&&i.length){var n=i.indexOf(t);return n!=-1&&i.splice(n,1),this}},t.emitEvent=function(e,t){var i=this._events&&this._events[e];if(i&&i.length){i=i.slice(0),t=t||[];for(var n=this._onceEvents&&this._onceEvents[e],o=0;o<i.length;o++){var r=i[o],s=n&&n[r];s&&(this.off(e,r),delete n[r]),r.apply(this,t)}return this}},t.allOff=function(){delete this._events,delete this._onceEvents},e}),function(e,t){"use strict";"function"==typeof define&&define.amd?define(["ev-emitter/ev-emitter"],function(i){return t(e,i)}):"object"==typeof module&&module.exports?module.exports=t(e,require("ev-emitter")):e.imagesLoaded=t(e,e.EvEmitter)}("undefined"!=typeof window?window:this,function(e,t){function i(e,t){for(var i in t)e[i]=t[i];return e}function n(e){if(Array.isArray(e))return e;var t="object"==typeof e&&"number"==typeof e.length;return t?d.call(e):[e]}function o(e,t,r){if(!(this instanceof o))return new o(e,t,r);var s=e;return"string"==typeof e&&(s=document.querySelectorAll(e)),s?(this.elements=n(s),this.options=i({},this.options),"function"==typeof t?r=t:i(this.options,t),r&&this.on("always",r),this.getImages(),h&&(this.jqDeferred=new h.Deferred),void setTimeout(this.check.bind(this))):void a.error("Bad element for imagesLoaded "+(s||e))}function r(e){this.img=e}function s(e,t){this.url=e,this.element=t,this.img=new Image}var h=e.jQuery,a=e.console,d=Array.prototype.slice;o.prototype=Object.create(t.prototype),o.prototype.options={},o.prototype.getImages=function(){this.images=[],this.elements.forEach(this.addElementImages,this)},o.prototype.addElementImages=function(e){"IMG"==e.nodeName&&this.addImage(e),this.options.background===!0&&this.addElementBackgroundImages(e);var t=e.nodeType;if(t&&u[t]){for(var i=e.querySelectorAll("img"),n=0;n<i.length;n++){var o=i[n];this.addImage(o)}if("string"==typeof this.options.background){var r=e.querySelectorAll(this.options.background);for(n=0;n<r.length;n++){var s=r[n];this.addElementBackgroundImages(s)}}}};var u={1:!0,9:!0,11:!0};return o.prototype.addElementBackgroundImages=function(e){var t=getComputedStyle(e);if(t)for(var i=/url\((['"])?(.*?)\1\)/gi,n=i.exec(t.backgroundImage);null!==n;){var o=n&&n[2];o&&this.addBackground(o,e),n=i.exec(t.backgroundImage)}},o.prototype.addImage=function(e){var t=new r(e);this.images.push(t)},o.prototype.addBackground=function(e,t){var i=new s(e,t);this.images.push(i)},o.prototype.check=function(){function e(e,i,n){setTimeout(function(){t.progress(e,i,n)})}var t=this;return this.progressedCount=0,this.hasAnyBroken=!1,this.images.length?void this.images.forEach(function(t){t.once("progress",e),t.check()}):void this.complete()},o.prototype.progress=function(e,t,i){this.progressedCount++,this.hasAnyBroken=this.hasAnyBroken||!e.isLoaded,this.emitEvent("progress",[this,e,t]),this.jqDeferred&&this.jqDeferred.notify&&this.jqDeferred.notify(this,e),this.progressedCount==this.images.length&&this.complete(),this.options.debug&&a&&a.log("progress: "+i,e,t)},o.prototype.complete=function(){var e=this.hasAnyBroken?"fail":"done";if(this.isComplete=!0,this.emitEvent(e,[this]),this.emitEvent("always",[this]),this.jqDeferred){var t=this.hasAnyBroken?"reject":"resolve";this.jqDeferred[t](this)}},r.prototype=Object.create(t.prototype),r.prototype.check=function(){var e=this.getIsImageComplete();return e?void this.confirm(0!==this.img.naturalWidth,"naturalWidth"):(this.proxyImage=new Image,this.proxyImage.addEventListener("load",this),this.proxyImage.addEventListener("error",this),this.img.addEventListener("load",this),this.img.addEventListener("error",this),void(this.proxyImage.src=this.img.src))},r.prototype.getIsImageComplete=function(){return this.img.complete&&this.img.naturalWidth},r.prototype.confirm=function(e,t){this.isLoaded=e,this.emitEvent("progress",[this,this.img,t])},r.prototype.handleEvent=function(e){var t="on"+e.type;this[t]&&this[t](e)},r.prototype.onload=function(){this.confirm(!0,"onload"),this.unbindEvents()},r.prototype.onerror=function(){this.confirm(!1,"onerror"),this.unbindEvents()},r.prototype.unbindEvents=function(){this.proxyImage.removeEventListener("load",this),this.proxyImage.removeEventListener("error",this),this.img.removeEventListener("load",this),this.img.removeEventListener("error",this)},s.prototype=Object.create(r.prototype),s.prototype.check=function(){this.img.addEventListener("load",this),this.img.addEventListener("error",this),this.img.src=this.url;var e=this.getIsImageCompleteLine truncated
/**
* UpSolution Theme Core JavaScript Code
*
* @requires jQuery
*/
if ( window.$us === undefined ) {
window.$us = {};
}
/**
* Retrieve/set/erase dom modificator class <mod>_<value> for UpSolution CSS Framework
* @param {String} mod Modificator namespace
* @param {String} [value] Value
* @returns {string|jQuery}
*/
jQuery.fn.usMod = function( mod, value ) {
if ( this.length == 0 ) {
return this;
}
// Remove class modificator
if ( value === false ) {
this.get( 0 ).className = this.get( 0 ).className.replace( new RegExp( '(^| )' + mod + '\_[a-zA-Z0-9\_\-]+( |$)' ), '$2' );
return this;
}
var pcre = new RegExp( '^.*?' + mod + '\_([a-zA-Z0-9\_\-]+).*?$' ),
arr;
// Retrieve modificator
if ( value === undefined ) {
return ( arr = pcre.exec( this.get( 0 ).className ) ) ? arr[ 1 ] : false;
}
// Set modificator
else {
this.usMod( mod, false ).get( 0 ).className += ' ' + mod + '_' + value;
return this;
}
};
/**
* Convert data from PHP to boolean the right way
* @param {mixed} value
* @returns {Boolean}
*/
$us.toBool = function( value ) {
if ( typeof value == 'string' ) {
return ( value == 'true' || value == 'True' || value == 'TRUE' || value == '1' );
}
if ( typeof value == 'boolean' ) {
return value;
}
return ! ! parseInt( value );
};
$us.getScript = function( url, callback ) {
if ( ! $us.ajaxLoadJs ) {
callback();
return false;
}
if ( $us.loadedScripts === undefined ) {
$us.loadedScripts = {};
$us.loadedScriptsFunct = {};
}
if ( $us.loadedScripts[ url ] === 'loaded' ) {
callback();
return;
} else if ( $us.loadedScripts[ url ] === 'loading' ) {
$us.loadedScriptsFunct[ url ].push( callback );
return;
}
$us.loadedScripts[ url ] = 'loading';
$us.loadedScriptsFunct[ url ] = [];
$us.loadedScriptsFunct[ url ].push( callback )
var complete = function() {
for ( var i = 0; i < $us.loadedScriptsFunct[ url ].length; i ++ ) {
$us.loadedScriptsFunct[ url ][ i ]();
}
$us.loadedScripts[ url ] = 'loaded';
};
var options = {
dataType: "script",
cache: true,
url: url,
complete: complete
};
return jQuery.ajax( options );
};
// Detecting IE browser
$us.detectIE = function() {
var ua = window.navigator.userAgent;
var msie = ua.indexOf( 'MSIE ' );
if ( msie > 0 ) {
// IE 10 or older => return version number
return parseInt( ua.substring( msie + 5, ua.indexOf( '.', msie ) ), 10 );
}
var trident = ua.indexOf( 'Trident/' );
if ( trident > 0 ) {
// IE 11 => return version number
var rv = ua.indexOf( 'rv:' );
return parseInt( ua.substring( rv + 3, ua.indexOf( '.', rv ) ), 10 );
}
var edge = ua.indexOf( 'Edge/' );
if ( edge > 0 ) {
// Edge (IE 12+) => return version number
return parseInt( ua.substring( edge + 5, ua.indexOf( '.', edge ) ), 10 );
}
// other browser
return false;
};
// Fixing hovers for devices with both mouse and touch screen
jQuery.isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test( navigator.userAgent );
jQuery( 'html' ).toggleClass( 'no-touch', ! jQuery.isMobile );
jQuery( 'html' ).toggleClass( 'ie11', $us.detectIE() == 11 );
/**
* Commonly used jQuery objects
*/
! function( $ ) {
$us.$window = $( window );
$us.$document = $( document );
$us.$html = $( 'html' );
$us.$body = $( '.l-body:first' );
$us.$htmlBody = $us.$html.add( $us.$body );
$us.$canvas = $( '.l-canvas:first' );
}( jQuery );
// Extending Lazy Load
if ( jQuery.lazyLoadXT !== undefined && jQuery.lazyLoadXT.updateEvent !== undefined ) {
jQuery.lazyLoadXT.updateEvent = jQuery.lazyLoadXT.updateEvent + ' click uslazyloadevent';
}
/**
* $us.canvas
*
* All the needed data and functions to work with overall canvas.
*/
! function( $ ) {
"use strict";
function USCanvas( options ) {
// Setting options
var defaults = {
disableEffectsWidth: 900,
responsive: true,
backToTopDisplay: 100
};
this.options = $.extend( {}, defaults, options || {} );
// Commonly used dom elements
this.$header = $us.$canvas.find( '.l-header' );
this.$main = $us.$canvas.find( '.l-main' );
this.$sections = $us.$canvas.find( '.l-section' );
this.$firstSection = this.$sections.first();
this.$secondSection = this.$sections.eq( 1 );
this.$fullscreenSections = this.$sections.filter( '.height_full' );
this.$topLink = $( '.w-toplink' );
// Canvas modificators
this.type = $us.$canvas.usMod( 'type' );
// Initial header position
this._headerPos = this.$header.usMod( 'pos' );
// Current header position
this.headerPos = this._headerPos;
this.headerInitialPos = $us.$body.usMod( 'headerinpos' );
this.headerBg = this.$header.usMod( 'bg' );
this.rtl = $us.$body.hasClass( 'rtl' );
// Will be used to count fullscreen sections heights and proper scroll positions
this.scrolledOccupiedHeight = 0;
// Used to prevent resize events on scroll for Android browsers
this.isScrolling = false;
this.scrollTimeout = false;
this.isAndroid = /Android/i.test( navigator.userAgent );
// If in iframe...
if ( $us.$body.hasClass( 'us_iframe' ) ) {
// change links so they lead to main window
$( 'a:not([target])' ).each( function() {
$( this ).attr( 'target', '_parent' )
} );
// hide preloader
jQuery( function( $ ) {
var $framePreloader = $( '.l-popup-box-content .g-preloader', window.parent.document );
$framePreloader.hide();
} );
}
// Boundable events
this._events = {
scroll: this.scroll.bind( this ),
resize: this.resize.bind( this )
};
$us.$window.on( 'scroll', this._events.scroll );
$us.$window.on( 'resize load', this._events.resize );
// Complex logics requires two initial renders: before inner elements render and after
setTimeout( this._events.resize, 25 );
setTimeout( this._events.resize, 75 );
}
USCanvas.prototype = {
/**
* Scroll-driven logics
*/
scroll: function() {
var scrollTop = parseInt( $us.$window.scrollTop() );
// Show/hide go to top link
this.$topLink.toggleClass( 'active', ( scrollTop >= this.winHeight * this.options.backToTopDisplay / 100 ) );
if ( this.isAndroid ) {
this.isScrolling = true;
if ( this.scrollTimeout ) {
clearTimeout( this.scrollTimeout );
}
this.scrollTimeout = setTimeout( function() {
this.isScrolling = false;
}.bind( this ), 100 );
}
},
/**
* Resize-driven logics
*/
resize: function() {
// Window dimensions
this.winHeight = parseInt( $us.$window.height() );
this.winWidth = parseInt( $us.$window.width() );
// Disabling animation on mobile devices
$us.$body.toggleClass( 'disable_effects', ( this.winWidth < this.options.disableEffectsWidth ) );
// Vertical centering of fullscreen sections in IE 11
var ieVersion = $us.detectIE();
if ( ( ieVersion !== false && ieVersion == 11 ) && ( this.$fullscreenSections.length > 0 && ! this.isScrolling ) ) {
var adminBar = $( '#wpadminbar' ),
adminBarHeight = ( adminBar.length ) ? adminBar.height() : 0;
this.$fullscreenSections.each( function( index, section ) {
var $section = $( section ),
sectionHeight = this.winHeight,
isFirstSection = ( index == 0 && $section.is( this.$firstSection ) );
// First section
if ( isFirstSection ) {
sectionHeight -= $section.offset().top;
}
// 2+ sections
else {
sectionHeight -= $us.header.scrolledOccupiedHeight + adminBarHeight;
}
if ( $section.hasClass( 'valign_center' ) ) {
var $sectionH = $section.find( '.l-section-h' ),
sectionTopPadding = parseInt( $section.css( 'padding-top' ) ),
contentHeight = $sectionH.outerHeight(),
topMargin;
$sectionH.css( 'margin-top', '' );
// Section was extended by extra top padding that is overlapped by fixed solid header and not
// visible
var sectionOverlapped = isFirstSection && $us.header.pos == 'fixed' && $us.header.bg != 'transparent' && $us.header.orientation != 'ver';
if ( sectionOverlapped ) {
// Part of first section is overlapped by header
topMargin = Math.max( 0, ( sectionHeight - sectionTopPadding - contentHeight ) / 2 );
} else {
topMargin = Math.max( 0, ( sectionHeight - contentHeight ) / 2 - sectionTopPadding );
}
$sectionH.css( 'margin-top', topMargin || '' );
}
}.bind( this ) );
$us.$canvas.trigger( 'contentChange' );
}
// If the page is loaded in iframe
if ( $us.$body.hasClass( 'us_iframe' ) ) {
var $frameContent = $( '.l-popup-box-content', window.parent.document ),
outerHeight = $us.$body.outerHeight( true );
if ( outerHeight > 0 && $( window.parent ).height() > outerHeight ) {
$frameContent.css( 'height', outerHeight );
} else {
$frameContent.css( 'height', '' );
}
}
// Fix scroll glitches that could occur after the resize
this.scroll();
}
};
$us.canvas = new USCanvas( $us.canvasOptions || {} );
}( jQuery );
/**
* CSS-analog of jQuery slideDown/slideUp/fadeIn/fadeOut functions (for better rendering)
*/
! function() {
/**
* Remove the passed inline CSS attributes.
*
* Usage: $elm.resetInlineCSS('height', 'width');
*/
jQuery.fn.resetInlineCSS = function() {
for ( var index = 0; index < arguments.length; index ++ ) {
this.css( arguments[ index ], '' );
}
return this;
};
jQuery.fn.clearPreviousTransitions = function() {
// Stopping previous events, if there were any
var prevTimers = ( this.data( 'animation-timers' ) || '' ).split( ',' );
if ( prevTimers.length >= 2 ) {
this.resetInlineCSS( 'transition' );
prevTimers.map( clearTimeout );
this.removeData( 'animation-timers' );
}
return this;
};
/**
*
* @param {Object} css key-value pairs of animated css
* @param {Number} duration in milliseconds
* @param {Function} onFinish
* @param {String} easing CSS easing name
* @param {Number} delay in milliseconds
*/
jQuery.fn.performCSSTransition = function( css, duration, onFinish, easing, delay ) {
duration = duration || 250;
delay = delay || 25;
easing = easing || 'ease';
var $this = this,
transition = [];
this.clearPreviousTransitions();
for ( var attr in css ) {
if ( ! css.hasOwnProperty( attr ) ) {
continue;
}
transition.push( attr + ' ' + ( duration / 1000 ) + 's ' + easing );
}
transition = transition.join( ', ' );
$this.css( {
transition: transition
} );
// Starting the transition with a slight delay for the proper application of CSS transition properties
var timer1 = setTimeout( function() {
$this.css( css );
}, delay );
var timer2 = setTimeout( function() {
$this.resetInlineCSS( 'transition' );
if ( typeof onFinish == 'function' ) {
onFinish();
}
}, duration + delay );
this.data( 'animation-timers', timer1 + ',' + timer2 );
};
// Height animations
jQuery.fn.slideDownCSS = function( duration, onFinish, easing, delay ) {
if ( this.length == 0 ) {
return;
}
var $this = this;
this.clearPreviousTransitions();
// Grabbing paddings
this.resetInlineCSS( 'padding-top', 'padding-bottom' );
var timer1 = setTimeout( function() {
var paddingTop = parseInt( $this.css( 'padding-top' ) ),
paddingBottom = parseInt( $this.css( 'padding-bottom' ) );
// Grabbing the "auto" height in px
$this.css( {
visibility: 'hidden',
position: 'absolute',
height: 'auto',
'padding-top': 0,
'padding-bottom': 0,
display: 'block'
} );
var height = $this.height();
$this.css( {
overflow: 'hidden',
height: '0px',
opacity: 0,
visibility: '',
position: ''
} );
$this.performCSSTransition( {
opacity: 1,
height: height + paddingTop + paddingBottom,
'padding-top': paddingTop,
'padding-bottom': paddingBottom
}, duration, function() {
$this.resetInlineCSS( 'overflow' ).css( 'height', 'auto' );
if ( typeof onFinish == 'function' ) {
onFinish();
}
}, easing, delay );
}, 25 );
this.data( 'animation-timers', timer1 + ',null' );
};
jQuery.fn.slideUpCSS = function( duration, onFinish, easing, delay ) {
if ( this.length == 0 ) {
return;
}
this.clearPreviousTransitions();
this.css( {
height: this.outerHeight(),
overflow: 'hidden',
'padding-top': this.css( 'padding-top' ),
'padding-bottom': this.css( 'padding-bottom' )
} );
var $this = this;
this.performCSSTransition( {
height: 0,
opacity: 0,
'padding-top': 0,
'padding-bottom': 0
}, duration, function() {
$this.resetInlineCSS( 'overflow', 'padding-top', 'padding-bottom' ).css( {
display: 'none'
} );
if ( typeof onFinish == 'function' ) {
onFinish();
}
}, easing, delay );
};
// Opacity animations
jQuery.fn.fadeInCSS = function( duration, onFinish, easing, delay ) {
if ( this.length == 0 ) {
return;
}
this.clearPreviousTransitions();
this.css( {
opacity: 0,
display: 'block'
} );
this.performCSSTransition( {
opacity: 1
}, duration, onFinish, easing, delay );
};
jQuery.fn.fadeOutCSS = function( duration, onFinish, easing, delay ) {
if ( this.length == 0 ) {
return;
}
var $this = this;
this.performCSSTransition( {
opacity: 0
}, duration, function() {
$this.css( 'display', 'none' );
if ( typeof onFinish == 'function' ) {
onFinish();
}
}, easing, delay );
};
}();
jQuery( function( $ ) {
"use strict";
// Force popup opening on links with ref
if ( $( 'a[ref=magnificPopup][class!=direct-link]' ).length != 0 ) {
$us.getScript( $us.templateDirectoryUri + '/framework/js/vendor/magnific-popup.js', function() {
$( 'a[ref=magnificPopup][class!=direct-link]' ).magnificPopup( {
type: 'image',
removalDelay: 300,
mainClass: 'mfp-fade',
fixedContentPos: true
} );
} );
}
// Hide background images until are loaded
jQuery( '.l-section-img' ).each( function() {
var $this = $( this ),
img = new Image(),
bgImg = $this.css( 'background-image' ) || '';
// If the background image CSS seems to be valid, preload an image and then show it
if ( bgImg.match( /url\(['"]*(.*?)['"]*\)/i ) ) {
img.onload = function() {
if ( ! $this.hasClass( 'loaded' ) ) {
$this.addClass( 'loaded' );
}
};
img.src = bgImg.replace( /url\(['"]*(.*?)['"]*\)/i, '$1' );
// If we cannot parse the background image CSS, just add loaded class to the background tag so a background
// image is shown anyways
} else {
$this.addClass( 'loaded' );
}
} );
/* YouTube/Vimeo background */
$( window ).on( 'resize load', function() {
var $container = $( '.with_youtube, .with_vimeo' );
if ( ! $container.length ) {
return;
}
$container.each( function() {
this.$container = $( this );
var $frame = this.$container.find( 'iframe' ),
cHeight = this.$container.innerHeight(),
cWidth = this.$container.innerWidth(),
fWidth = '',
fHeight = '';
if ( cWidth / cHeight < 16 / 9 ) {
fWidth = cHeight * ( 16 / 9 );
fHeight = cHeight;
} else {
fWidth = cWidth;
fHeight = fWidth * ( 9 / 16 );
}
$frame.css( {
'width': Math.round( fWidth ),
'height': Math.round( fHeight ),
} );
} );
} );
} );
+35
View File
@@ -0,0 +1,35 @@
!function(e,t){"function"==typeof define&&define.amd?define("ev-emitter/ev-emitter",t):"object"==typeof module&&module.exports?module.exports=t():e.EvEmitter=t()}("undefined"!=typeof window?window:this,function(){function e(){}var t=e.prototype;return t.on=function(e,t){if(e&&t){var i=this._events=this._events||{},n=i[e]=i[e]||[];return n.indexOf(t)==-1&&n.push(t),this}},t.once=function(e,t){if(e&&t){this.on(e,t);var i=this._onceEvents=this._onceEvents||{},n=i[e]=i[e]||{};return n[t]=!0,this}},t.off=function(e,t){var i=this._events&&this._events[e];if(i&&i.length){var n=i.indexOf(t);return n!=-1&&i.splice(n,1),this}},t.emitEvent=function(e,t){var i=this._events&&this._events[e];if(i&&i.length){i=i.slice(0),t=t||[];for(var n=this._onceEvents&&this._onceEvents[e],o=0;o<i.length;o++){var r=i[o],s=n&&n[r];s&&(this.off(e,r),delete n[r]),r.apply(this,t)}return this}},t.allOff=function(){delete this._events,delete this._onceEvents},e}),function(e,t){"use strict";"function"==typeof define&&define.amd?define(["ev-emitter/ev-emitter"],function(i){return t(e,i)}):"object"==typeof module&&module.exports?module.exports=t(e,require("ev-emitter")):e.imagesLoaded=t(e,e.EvEmitter)}("undefined"!=typeof window?window:this,function(e,t){function i(e,t){for(var i in t)e[i]=t[i];return e}function n(e){if(Array.isArray(e))return e;var t="object"==typeof e&&"number"==typeof e.length;return t?d.call(e):[e]}function o(e,t,r){if(!(this instanceof o))return new o(e,t,r);var s=e;return"string"==typeof e&&(s=document.querySelectorAll(e)),s?(this.elements=n(s),this.options=i({},this.options),"function"==typeof t?r=t:i(this.options,t),r&&this.on("always",r),this.getImages(),h&&(this.jqDeferred=new h.Deferred),void setTimeout(this.check.bind(this))):void a.error("Bad element for imagesLoaded "+(s||e))}function r(e){this.img=e}function s(e,t){this.url=e,this.element=t,this.img=new Image}var h=e.jQuery,a=e.console,d=Array.prototype.slice;o.prototype=Object.create(t.prototype),o.prototype.options={},o.prototype.getImages=function(){this.images=[],this.elements.forEach(this.addElementImages,this)},o.prototype.addElementImages=function(e){"IMG"==e.nodeName&&this.addImage(e),this.options.background===!0&&this.addElementBackgroundImages(e);var t=e.nodeType;if(t&&u[t]){for(var i=e.querySelectorAll("img"),n=0;n<i.length;n++){var o=i[n];this.addImage(o)}if("string"==typeof this.options.background){var r=e.querySelectorAll(this.options.background);for(n=0;n<r.length;n++){var s=r[n];this.addElementBackgroundImages(s)}}}};var u={1:!0,9:!0,11:!0};return o.prototype.addElementBackgroundImages=function(e){var t=getComputedStyle(e);if(t)for(var i=/url\((['"])?(.*?)\1\)/gi,n=i.exec(t.backgroundImage);null!==n;){var o=n&&n[2];o&&this.addBackground(o,e),n=i.exec(t.backgroundImage)}},o.prototype.addImage=function(e){var t=new r(e);this.images.push(t)},o.prototype.addBackground=function(e,t){var i=new s(e,t);this.images.push(i)},o.prototype.check=function(){function e(e,i,n){setTimeout(function(){t.progress(e,i,n)})}var t=this;return this.progressedCount=0,this.hasAnyBroken=!1,this.images.length?void this.images.forEach(function(t){t.once("progress",e),t.check()}):void this.complete()},o.prototype.progress=function(e,t,i){this.progressedCount++,this.hasAnyBroken=this.hasAnyBroken||!e.isLoaded,this.emitEvent("progress",[this,e,t]),this.jqDeferred&&this.jqDeferred.notify&&this.jqDeferred.notify(this,e),this.progressedCount==this.images.length&&this.complete(),this.options.debug&&a&&a.log("progress: "+i,e,t)},o.prototype.complete=function(){var e=this.hasAnyBroken?"fail":"done";if(this.isComplete=!0,this.emitEvent(e,[this]),this.emitEvent("always",[this]),this.jqDeferred){var t=this.hasAnyBroken?"reject":"resolve";this.jqDeferred[t](this)}},r.prototype=Object.create(t.prototype),r.prototype.check=function(){var e=this.getIsImageComplete();return e?void this.confirm(0!==this.img.naturalWidth,"naturalWidth"):(this.proxyImage=new Image,this.proxyImage.addEventListener("load",this),this.proxyImage.addEventListener("error",this),this.img.addEventListener("load",this),this.img.addEventListener("error",this),void(this.proxyImage.src=this.img.src))},r.prototype.getIsImageComplete=function(){return this.img.complete&&this.img.naturalWidth},r.prototype.confirm=function(e,t){this.isLoaded=e,this.emitEvent("progress",[this,this.img,t])},r.prototype.handleEvent=function(e){var t="on"+e.type;this[t]&&this[t](e)},r.prototype.onload=function(){this.confirm(!0,"onload"),this.unbindEvents()},r.prototype.onerror=function(){this.confirm(!1,"onerror"),this.unbindEvents()},r.prototype.unbindEvents=function(){this.proxyImage.removeEventListener("load",this),this.proxyImage.removeEventListener("error",this),this.img.removeEventListener("load",this),this.img.removeEventListener("error",this)},s.prototype=Object.create(r.prototype),s.prototype.check=function(){this.img.addEventListener("load",this),this.img.addEventListener("error",this),this.img.src=this.url;var e=this.getIsImageCompleteLine truncated
jQuery.fn.usMod=function(mod,value){if(this.length==0){return this}
if(value===!1){this.get(0).className=this.get(0).className.replace(new RegExp('(^| )'+mod+'\_[a-zA-Z0-9\_\-]+( |$)'),'$2');return this}
var pcre=new RegExp('^.*?'+mod+'\_([a-zA-Z0-9\_\-]+).*?$'),arr;if(value===undefined){return(arr=pcre.exec(this.get(0).className))?arr[1]:!1}
else{this.usMod(mod,!1).get(0).className+=' '+mod+'_'+value;return this}};$us.toBool=function(value){if(typeof value=='string'){return(value=='true'||value=='True'||value=='TRUE'||value=='1')}
if(typeof value=='boolean'){return value}
return!!parseInt(value)};$us.getScript=function(url,callback){if(!$us.ajaxLoadJs){callback();return!1}
if($us.loadedScripts===undefined){$us.loadedScripts={};$us.loadedScriptsFunct={}}
if($us.loadedScripts[url]==='loaded'){callback();return}else if($us.loadedScripts[url]==='loading'){$us.loadedScriptsFunct[url].push(callback);return}
$us.loadedScripts[url]='loading';$us.loadedScriptsFunct[url]=[];$us.loadedScriptsFunct[url].push(callback)
var complete=function(){for(var i=0;i<$us.loadedScriptsFunct[url].length;i ++){$us.loadedScriptsFunct[url][i]()}
$us.loadedScripts[url]='loaded'};var options={dataType:"script",cache:!0,url:url,complete:complete};return jQuery.ajax(options)};$us.detectIE=function(){var ua=window.navigator.userAgent;var msie=ua.indexOf('MSIE ');if(msie>0){return parseInt(ua.substring(msie+5,ua.indexOf('.',msie)),10)}
var trident=ua.indexOf('Trident/');if(trident>0){var rv=ua.indexOf('rv:');return parseInt(ua.substring(rv+3,ua.indexOf('.',rv)),10)}
var edge=ua.indexOf('Edge/');if(edge>0){return parseInt(ua.substring(edge+5,ua.indexOf('.',edge)),10)}
return!1};jQuery.isMobile=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);jQuery('html').toggleClass('no-touch',!jQuery.isMobile);jQuery('html').toggleClass('ie11',$us.detectIE()==11);!function($){$us.$window=$(window);$us.$document=$(document);$us.$html=$('html');$us.$body=$('.l-body:first');$us.$htmlBody=$us.$html.add($us.$body);$us.$canvas=$('.l-canvas:first')}(jQuery);if(jQuery.lazyLoadXT!==undefined&&jQuery.lazyLoadXT.updateEvent!==undefined){jQuery.lazyLoadXT.updateEvent=jQuery.lazyLoadXT.updateEvent+' click uslazyloadevent'}
!function($){"use strict";function USCanvas(options){var defaults={disableEffectsWidth:900,responsive:!0,backToTopDisplay:100};this.options=$.extend({},defaults,options||{});this.$header=$us.$canvas.find('.l-header');this.$main=$us.$canvas.find('.l-main');this.$sections=$us.$canvas.find('.l-section');this.$firstSection=this.$sections.first();this.$secondSection=this.$sections.eq(1);this.$fullscreenSections=this.$sections.filter('.height_full');this.$topLink=$('.w-toplink');this.type=$us.$canvas.usMod('type');this._headerPos=this.$header.usMod('pos');this.headerPos=this._headerPos;this.headerInitialPos=$us.$body.usMod('headerinpos');this.headerBg=this.$header.usMod('bg');this.rtl=$us.$body.hasClass('rtl');this.scrolledOccupiedHeight=0;this.isScrolling=!1;this.scrollTimeout=!1;this.isAndroid=/Android/i.test(navigator.userAgent);if($us.$body.hasClass('us_iframe')){$('a:not([target])').each(function(){$(this).attr('target','_parent')});jQuery(function($){var $framePreloader=$('.l-popup-box-content .g-preloader',window.parent.document);$framePreloader.hide()})}
this._events={scroll:this.scroll.bind(this),resize:this.resize.bind(this)};$us.$window.on('scroll',this._events.scroll);$us.$window.on('resize load',this._events.resize);setTimeout(this._events.resize,25);setTimeout(this._events.resize,75)}
USCanvas.prototype={scroll:function(){var scrollTop=parseInt($us.$window.scrollTop());this.$topLink.toggleClass('active',(scrollTop>=this.winHeight*this.options.backToTopDisplay/100));if(this.isAndroid){this.isScrolling=!0;if(this.scrollTimeout){clearTimeout(this.scrollTimeout)}
this.scrollTimeout=setTimeout(function(){this.isScrolling=!1}.bind(this),100)}},resize:function(){this.winHeight=parseInt($us.$window.height());this.winWidth=parseInt($us.$window.width());$us.$body.toggleClass('disable_effects',(this.winWidth<this.options.disableEffectsWidth));var ieVersion=$us.detectIE();if((ieVersion!==!1&&ieVersion==11)&&(this.$fullscreenSections.length>0&&!this.isScrolling)){var adminBar=$('#wpadminbar'),adminBarHeight=(adminBar.length)?adminBar.height():0;this.$fullscreenSections.each(function(index,section){var $section=$(section),sectionHeight=this.winHeight,isFirstSection=(index==0&&$section.is(this.$firstSection));if(isFirstSection){sectionHeight-=$section.offset().top}
else{sectionHeight-=$us.header.scrolledOccupiedHeight+adminBarHeight}
if($section.hasClass('valign_center')){var $sectionH=$section.find('.l-section-h'),sectionTopPadding=parseInt($section.css('padding-top')),contentHeight=$sectionH.outerHeight(),topMargin;$sectionH.css('margin-top','');var sectionOverlapped=isFirstSection&&$us.header.pos=='fixed'&&$us.header.bg!='transparent'&&$us.header.orientation!='ver';if(sectionOverlapped){topMargin=Math.max(0,(sectionHeight-sectionTopPadding-contentHeight)/2)}else{topMargin=Math.max(0,(sectionHeight-contentHeight)/2-sectionTopPadding)}
$sectionH.css('margin-top',topMargin||'')}}.bind(this));$us.$canvas.trigger('contentChange')}
if($us.$body.hasClass('us_iframe')){var $frameContent=$('.l-popup-box-content',window.parent.document),outerHeight=$us.$body.outerHeight(!0);if(outerHeight>0&&$(window.parent).height()>outerHeight){$frameContent.css('height',outerHeight)}else{$frameContent.css('height','')}}
this.scroll()}};$us.canvas=new USCanvas($us.canvasOptions||{})}(jQuery);!function(){jQuery.fn.resetInlineCSS=function(){for(var index=0;index<arguments.length;index ++){this.css(arguments[index],'')}
return this};jQuery.fn.clearPreviousTransitions=function(){var prevTimers=(this.data('animation-timers')||'').split(',');if(prevTimers.length>=2){this.resetInlineCSS('transition');prevTimers.map(clearTimeout);this.removeData('animation-timers')}
return this};jQuery.fn.performCSSTransition=function(css,duration,onFinish,easing,delay){duration=duration||250;delay=delay||25;easing=easing||'ease';var $this=this,transition=[];this.clearPreviousTransitions();for(var attr in css){if(!css.hasOwnProperty(attr)){continue}
transition.push(attr+' '+(duration/1000)+'s '+easing)}
transition=transition.join(', ');$this.css({transition:transition});var timer1=setTimeout(function(){$this.css(css)},delay);var timer2=setTimeout(function(){$this.resetInlineCSS('transition');if(typeof onFinish=='function'){onFinish()}},duration+delay);this.data('animation-timers',timer1+','+timer2)};jQuery.fn.slideDownCSS=function(duration,onFinish,easing,delay){if(this.length==0){return}
var $this=this;this.clearPreviousTransitions();this.resetInlineCSS('padding-top','padding-bottom');var timer1=setTimeout(function(){var paddingTop=parseInt($this.css('padding-top')),paddingBottom=parseInt($this.css('padding-bottom'));$this.css({visibility:'hidden',position:'absolute',height:'auto','padding-top':0,'padding-bottom':0,display:'block'});var height=$this.height();$this.css({overflow:'hidden',height:'0px',opacity:0,visibility:'',position:''});$this.performCSSTransition({opacity:1,height:height+paddingTop+paddingBottom,'padding-top':paddingTop,'padding-bottom':paddingBottom},duration,function(){$this.resetInlineCSS('overflow').css('height','auto');if(typeof onFinish=='function'){onFinish()}},easing,delay)},25);this.data('animation-timers',timer1+',null')};jQuery.fn.slideUpCSS=function(duration,onFinish,easing,delay){if(this.length==0){return}
this.clearPreviousTransitions();this.css({height:this.outerHeight(),overflow:'hidden','padding-top':this.css('padding-top'),'padding-bottom':this.css('padding-bottom')});var $this=this;this.performCSSTransition({height:0,opacity:0,'padding-top':0,'padding-bottom':0},duration,function(){$this.resetInlineCSS('overflow','padding-top','padding-bottom').css({display:'none'});if(typeof onFinish=='function'){onFinish()}},easing,delay)};jQuery.fn.fadeInCSS=function(duration,onFinish,easing,delay){if(this.length==0){return}
this.clearPreviousTransitions();this.css({opacity:0,display:'block'});this.performCSSTransition({opacity:1},duration,onFinish,easing,delay)};jQuery.fn.fadeOutCSS=function(duration,onFinish,easing,delay){if(this.length==0){return}
var $this=this;this.performCSSTransition({opacity:0},duration,function(){$this.css('display','none');if(typeof onFinish=='function'){onFinish()}},easing,delay)}}();jQuery(function($){"use strict";if($('a[ref=magnificPopup][class!=direct-link]').length!=0){$us.getScript($us.templateDirectoryUri+'/framework/js/vendor/magnific-popup.js',function(){$('a[ref=magnificPopup][class!=direct-link]').magnificPopup({type:'image',removalDelay:300,mainClass:'mfp-fade',fixedContentPos:!0})})}
jQuery('.l-section-img').each(function(){var $this=$(this),img=new Image(),bgImg=$this.css('background-image')||'';if(bgImg.match(/url\(['"]*(.*?)['"]*\)/i)){img.onload=function(){if(!$this.hasClass('loaded')){$this.addClass('loaded')}};img.src=bgImg.replace(/url\(['"]*(.*?)['"]*\)/i,'$1')}else{$this.addClass('loaded')}});$(window).on('resize load',function(){var $container=$('.with_youtube, .with_vimeo');if(!$container.length){return}
$container.each(function(){this.$container=$(this);var $frame=this.$container.find('iframe'),cHeight=this.$container.innerHeight(),cWidth=this.$container.innerWidth(),fWidth='',fHeight='';if(cWidth/cHeight<16/9){fWidth=cHeight*(16/9);fHeight=cHeight}else{fWidth=cWidth;fHeight=fWidth*(9/16)}
$frame.css({'width':Math.round(fWidth),'height':Math.round(fHeight),})})})})
@@ -0,0 +1,328 @@
/**
* $us.header
* Dev note: should be initialized after $us.canvas
*/
! function( $ ) {
"use strict";
function USHeader( settings ) {
this.settings = settings || {};
this.state = 'default'; // 'tablets' / 'mobiles'
this.$container = $us.$canvas.find( '.l-header' );
// Will be used to count fullscreen sections heights and proper scroll positions
this.scrolledOccupiedHeight = 0;
if ( this.$container.length == 0 ) {
return;
}
this.$topCell = this.$container.find( '.l-subheader.at_top .l-subheader-cell:first' );
this.$middleCell = this.$container.find( '.l-subheader.at_middle .l-subheader-cell:first' );
this.$bottomCell = this.$container.find( '.l-subheader.at_bottom .l-subheader-cell:first' );
this.$showBtn = $( '.w-header-show:first' );
this.orientation = $us.$body.usMod( 'header' );
this.pos = this.$container.usMod( 'pos' ); // 'fixed' / 'static'
this.bg = this.$container.usMod( 'bg' ); // 'solid' / 'transparent'
this.shadow = this.$container.usMod( 'shadow' ); // 'none' / 'thin' / 'wide'
// Will be used to count fullscreen sections heights and proper scroll positions
this.scrolledOccupiedHeight = 0;
// Breakpoints
this.tabletsBreakpoint = parseInt( settings.tablets && settings.tablets.options && settings.tablets.options.breakpoint ) || 900;
this.mobilesBreakpoint = parseInt( settings.mobiles && settings.mobiles.options && settings.mobiles.options.breakpoint ) || 600;
this._events = {
scroll: this.scroll.bind( this ),
resize: this.resize.bind( this ),
contentChange: function() {
this._countScrollable();
}.bind( this ),
hideMobileVerticalHeader: function( e ) {
if ( $.contains( this.$container[ 0 ], e.target ) ) {
return;
}
$us.$body
.off( $.isMobile ? 'touchstart' : 'click', this._events.hideMobileVerticalHeader );
setTimeout( function() {
$us.$body.removeClass( 'header-show' );
}, 10 );
}.bind( this )
};
this.$elms = {};
this.$places = {
hidden: this.$container.find( '.l-subheader.for_hidden' )
};
this.$container.find( '.l-subheader-cell' ).each( function( index, cell ) {
var $cell = $( cell );
this.$places[ $cell.parent().parent().usMod( 'at' ) + '_' + $cell.usMod( 'at' ) ] = $cell;
}.bind( this ) );
var regexp = /(^| )ush_([a-z_]+)_([0-9]+)( |$)/;
this.$container.find( '[class*=ush_]' ).each( function( index, elm ) {
var $elm = $( elm ),
matches = regexp.exec( $elm.attr( 'class' ) );
if ( ! matches ) {
return;
}
var id = matches[ 2 ] + ':' + matches[ 3 ];
this.$elms[ id ] = $elm;
if ( $elm.is( '.w-vwrapper, .w-hwrapper' ) ) {
this.$places[ id ] = $elm;
}
}.bind( this ) );
// TODO Objects with the header elements
$us.$window.on( 'scroll', this._events.scroll );
$us.$window.on( 'resize load', this._events.resize );
this.resize();
$us.$canvas.on( 'contentChange', function() {
if ( this.orientation == 'ver' ) {
this.docHeight = $us.$document.height();
}
}.bind( this ) );
this.$container.on( 'contentChange', this._events.contentChange );
this.$showBtn.on( 'click', function( e ) {
if ( $us.$body.hasClass( 'header-show' ) ) {
return;
}
e.stopPropagation();
$us.$body
.addClass( 'header-show' )
.on( $.isMobile ? 'touchstart' : 'click', this._events.hideMobileVerticalHeader );
}.bind( this ) );
}
$.extend( USHeader.prototype, {
scroll: function() {
var scrollTop = parseInt( $us.$window.scrollTop() );
if ( this.pos == 'fixed' ) {
if ( this.orientation == 'hor' ) {
if ( ( $us.canvas.headerInitialPos == 'bottom' || $us.canvas.headerInitialPos == 'below' ) && ( $us.$body.usMod( 'state' ) == 'default' ) ) {
if ( this.adminBarHeight ) {
scrollTop += this.adminBarHeight;
}
if ( scrollTop >= this.headerTop ) {
if ( ! this.$container.hasClass( 'sticky' ) ) {
this.$container.addClass( 'sticky' );
}
if ( this.applyHeaderTop && this.$container.css( 'top' ) != '' ) {
this.$container.css( 'top', '' );
}
} else if ( scrollTop < this.headerTop ) {
if ( this.$container.hasClass( 'sticky' ) ) {
this.$container.removeClass( 'sticky' );
}
if ( this.applyHeaderTop && this.$container.css( 'top' ) != this.headerTop ) {
this.$container.css( 'top', this.headerTop );
}
}
} else {
this.$container.toggleClass( 'sticky', scrollTop >= ( parseInt( this.settings[ this.state ].options.scroll_breakpoint ) || 100 ) );
}
} else if ( ! jQuery.isMobile && this.$container.hasClass( 'scrollable' ) && this.docHeight > this.headerHeight + this.htmlTopMargin ) {
var scrollRangeDiff = this.headerHeight - $us.canvas.winHeight + this.htmlTopMargin;
if ( this._sidedHeaderScrollRange === undefined ) {
this._sidedHeaderScrollRange = [ 0, scrollRangeDiff ];
}
if ( scrollTop <= this._sidedHeaderScrollRange[ 0 ] ) {
this._sidedHeaderScrollRange[ 0 ] = Math.max( 0, scrollTop );
this._sidedHeaderScrollRange[ 1 ] = this._sidedHeaderScrollRange[ 0 ] + scrollRangeDiff;
this.$container.css( {
position: 'fixed',
top: this.htmlTopMargin
} );
}
else if ( this._sidedHeaderScrollRange[ 0 ] < scrollTop && scrollTop < this._sidedHeaderScrollRange[ 1 ] ) {
this.$container.css( {
position: 'absolute',
top: this._sidedHeaderScrollRange[ 0 ]
} );
}
else if ( this._sidedHeaderScrollRange[ 1 ] <= scrollTop ) {
this._sidedHeaderScrollRange[ 1 ] = Math.min( this.docHeight - $us.canvas.winHeight, scrollTop );
this._sidedHeaderScrollRange[ 0 ] = this._sidedHeaderScrollRange[ 1 ] - scrollRangeDiff;
this.$container.css( {
position: 'fixed',
top: $us.canvas.winHeight - this.headerHeight
} );
}
}
}
},
resize: function() {
var newState = 'default';
if ( window.innerWidth < this.tabletsBreakpoint ) {
newState = ( window.innerWidth < this.mobilesBreakpoint ) ? 'mobiles' : 'tablets';
}
this.setState( newState );
if ( this.pos == 'fixed' && this.orientation == 'hor' ) {
var isSticky = this.$container.hasClass( 'sticky' );
this.$container.addClass( 'notransition' );
if ( ! isSticky ) {
this.$container.addClass( 'sticky' );
}
this.scrolledOccupiedHeight = this.$container.height();
if ( ! isSticky ) {
this.$container.removeClass( 'sticky' );
}
// Removing with a small delay to prevent css glitch
setTimeout( function() {
this.$container.removeClass( 'notransition' );
}.bind( this ), 50 );
} else /*if (this.orientation == 'ver' || this.pos == 'static')*/ {
this.scrolledOccupiedHeight = 0;
}
if ( this.orientation == 'hor' ) {
if ( this.pos == 'fixed' && ( $us.canvas.headerInitialPos == 'bottom' || $us.canvas.headerInitialPos == 'below' ) && ( $us.$body.usMod( 'state' ) == 'default' ) ) {
var adminBar = $( '#wpadminbar' );
this.adminBarHeight = ( adminBar.length ) ? adminBar.height() : 0;
this.headerTop = $us.canvas.$firstSection.outerHeight() + this.adminBarHeight;
if ( $us.canvas.headerInitialPos == 'bottom' ) {
this.headerTop = this.headerTop - this.$container.outerHeight();
}
if ( ! $us.canvas.$firstSection.hasClass( 'height_full' ) ) {
this.$container.css( 'bottom', 'auto' );
this.applyHeaderTop = true;
this.$container.css( 'top', this.headerTop );
}
} else {
this.applyHeaderTop = false;
this.$container.css( 'top', '' );
}
} else {
this.applyHeaderTop = false;
this.$container.css( 'top', '' );
}
this._countScrollable();
this.scroll();
},
setState: function( newState ) {
if ( newState == this.state ) {
return;
}
var newOrientation = this.settings[ newState ].options.orientation || 'hor',
newPos = $us.toBool( this.settings[ newState ].options.sticky ) ? 'fixed' : 'static',
newBg = $us.toBool( this.settings[ newState ].options.transparent ) ? 'transparent' : 'solid',
newShadow = this.settings[ newState ].options.shadow || 'thin';
if ( newOrientation == 'ver' ) {
newPos = 'fixed';
newBg = 'solid';
}
this.state = newState;
// Don't change the order: orientation -> pos -> bg -> layout
this._setOrientation( newOrientation );
this._setPos( newPos );
this._setBg( newBg );
this._setShadow( newShadow );
this._setLayout( this.settings[ newState ].layout || {} );
$us.$body.usMod( 'state', newState );
if ( newState == 'default' ) {
$us.$body.removeClass( 'header-show' );
}
// Updating the menu because of dependencies
if ( $us.nav !== undefined ) {
$us.nav.resize();
}
},
_setOrientation: function( newOrientation ) {
if ( newOrientation == this.orientation ) {
return;
}
$us.$body.usMod( 'header', newOrientation );
this.orientation = newOrientation;
},
_countScrollable: function() {
if ( this.orientation == 'ver' && this.pos == 'fixed' && this.state == 'default' ) {
this.docHeight = $us.$document.height();
this.htmlTopMargin = parseInt( $us.$html.css( 'margin-top' ) );
this.headerHeight = this.$topCell.height() + this.$middleCell.height() + this.$bottomCell.height();
if ( this.headerHeight > $us.canvas.winHeight - this.htmlTopMargin ) {
this.$container.addClass( 'scrollable' );
} else if ( this.$container.hasClass( 'scrollable' ) ) {
this.$container.removeClass( 'scrollable' ).resetInlineCSS( 'position', 'top', 'bottom' );
delete this._sidedHeaderScrollRange;
}
if ( this.headerHeight + this.htmlTopMargin >= this.docHeight ) {
this.$container.css( {
position: 'absolute',
top: 0
} );
}
} else if ( this.$container.hasClass( 'scrollable' ) ) {
this.$container.removeClass( 'scrollable' ).resetInlineCSS( 'position', 'top', 'bottom' );
delete this._sidedHeaderScrollRange;
}
},
_setPos: function( newPos ) {
if ( newPos == this.pos ) {
return;
}
this.$container.usMod( 'pos', newPos );
if ( newPos == 'static' ) {
this.$container.removeClass( 'sticky' );
}
this.pos = newPos;
this._countScrollable();
},
_setBg: function( newBg ) {
if ( newBg == this.bg ) {
return;
}
this.$container.usMod( 'bg', newBg );
this.bg = newBg;
},
_setShadow: function( newShadow ) {
if ( newShadow == this.shadow ) {
return;
}
this.$container.usMod( 'shadow', newShadow );
this.shadow = newShadow;
},
/**
* Recursive function to place elements based on their ids
* @param {Array} elms
* @param {jQuery} $place
* @private
*/
_placeElements: function( elms, $place ) {
for ( var i = 0; i < elms.length; i ++ ) {
var elmId;
if ( typeof elms[ i ] == 'object' ) {
// Wrapper
elmId = elms[ i ][ 0 ];
if ( this.$places[ elmId ] === undefined || this.$elms[ elmId ] === undefined ) {
continue;
}
this.$elms[ elmId ].appendTo( $place );
this._placeElements( elms[ i ].shift(), this.$places[ elmId ] );
} else {
// Element
elmId = elms[ i ];
if ( this.$elms[ elmId ] === undefined ) {
continue;
}
this.$elms[ elmId ].appendTo( $place );
}
}
},
_setLayout: function( newLayout ) {
// Retrieving the currently shown layout structure
var curLayout = {};
$.each( this.$places, function( place, $place ) {
}.bind( this ) );
for ( var place in newLayout ) {
if ( ! newLayout.hasOwnProperty( place ) || this.$places[ place ] === undefined ) {
continue;
}
this._placeElements( newLayout[ place ], this.$places[ place ] );
}
}
} );
$us.header = new USHeader( $us.headerSettings || {} );
}( jQuery );
+30
View File
@@ -0,0 +1,30 @@
!function($){"use strict";function USHeader(settings){this.settings=settings||{};this.state='default';this.$container=$us.$canvas.find('.l-header');this.scrolledOccupiedHeight=0;if(this.$container.length==0){return}
this.$topCell=this.$container.find('.l-subheader.at_top .l-subheader-cell:first');this.$middleCell=this.$container.find('.l-subheader.at_middle .l-subheader-cell:first');this.$bottomCell=this.$container.find('.l-subheader.at_bottom .l-subheader-cell:first');this.$showBtn=$('.w-header-show:first');this.orientation=$us.$body.usMod('header');this.pos=this.$container.usMod('pos');this.bg=this.$container.usMod('bg');this.shadow=this.$container.usMod('shadow');this.scrolledOccupiedHeight=0;this.tabletsBreakpoint=parseInt(settings.tablets&&settings.tablets.options&&settings.tablets.options.breakpoint)||900;this.mobilesBreakpoint=parseInt(settings.mobiles&&settings.mobiles.options&&settings.mobiles.options.breakpoint)||600;this._events={scroll:this.scroll.bind(this),resize:this.resize.bind(this),contentChange:function(){this._countScrollable()}.bind(this),hideMobileVerticalHeader:function(e){if($.contains(this.$container[0],e.target)){return}
$us.$body.off($.isMobile?'touchstart':'click',this._events.hideMobileVerticalHeader);setTimeout(function(){$us.$body.removeClass('header-show')},10)}.bind(this)};this.$elms={};this.$places={hidden:this.$container.find('.l-subheader.for_hidden')};this.$container.find('.l-subheader-cell').each(function(index,cell){var $cell=$(cell);this.$places[$cell.parent().parent().usMod('at')+'_'+$cell.usMod('at')]=$cell}.bind(this));var regexp=/(^| )ush_([a-z_]+)_([0-9]+)( |$)/;this.$container.find('[class*=ush_]').each(function(index,elm){var $elm=$(elm),matches=regexp.exec($elm.attr('class'));if(!matches){return}
var id=matches[2]+':'+matches[3];this.$elms[id]=$elm;if($elm.is('.w-vwrapper, .w-hwrapper')){this.$places[id]=$elm}}.bind(this));$us.$window.on('scroll',this._events.scroll);$us.$window.on('resize load',this._events.resize);this.resize();$us.$canvas.on('contentChange',function(){if(this.orientation=='ver'){this.docHeight=$us.$document.height()}}.bind(this));this.$container.on('contentChange',this._events.contentChange);this.$showBtn.on('click',function(e){if($us.$body.hasClass('header-show')){return}
e.stopPropagation();$us.$body.addClass('header-show').on($.isMobile?'touchstart':'click',this._events.hideMobileVerticalHeader)}.bind(this))}
$.extend(USHeader.prototype,{scroll:function(){var scrollTop=parseInt($us.$window.scrollTop());if(this.pos=='fixed'){if(this.orientation=='hor'){if(($us.canvas.headerInitialPos=='bottom'||$us.canvas.headerInitialPos=='below')&&($us.$body.usMod('state')=='default')){if(this.adminBarHeight){scrollTop+=this.adminBarHeight}
if(scrollTop>=this.headerTop){if(!this.$container.hasClass('sticky')){this.$container.addClass('sticky')}
if(this.applyHeaderTop&&this.$container.css('top')!=''){this.$container.css('top','')}}else if(scrollTop<this.headerTop){if(this.$container.hasClass('sticky')){this.$container.removeClass('sticky')}
if(this.applyHeaderTop&&this.$container.css('top')!=this.headerTop){this.$container.css('top',this.headerTop)}}}else{this.$container.toggleClass('sticky',scrollTop>=(parseInt(this.settings[this.state].options.scroll_breakpoint)||100))}}else if(!jQuery.isMobile&&this.$container.hasClass('scrollable')&&this.docHeight>this.headerHeight+this.htmlTopMargin){var scrollRangeDiff=this.headerHeight-$us.canvas.winHeight+this.htmlTopMargin;if(this._sidedHeaderScrollRange===undefined){this._sidedHeaderScrollRange=[0,scrollRangeDiff]}
if(scrollTop<=this._sidedHeaderScrollRange[0]){this._sidedHeaderScrollRange[0]=Math.max(0,scrollTop);this._sidedHeaderScrollRange[1]=this._sidedHeaderScrollRange[0]+scrollRangeDiff;this.$container.css({position:'fixed',top:this.htmlTopMargin})}
else if(this._sidedHeaderScrollRange[0]<scrollTop&&scrollTop<this._sidedHeaderScrollRange[1]){this.$container.css({position:'absolute',top:this._sidedHeaderScrollRange[0]})}
else if(this._sidedHeaderScrollRange[1]<=scrollTop){this._sidedHeaderScrollRange[1]=Math.min(this.docHeight-$us.canvas.winHeight,scrollTop);this._sidedHeaderScrollRange[0]=this._sidedHeaderScrollRange[1]-scrollRangeDiff;this.$container.css({position:'fixed',top:$us.canvas.winHeight-this.headerHeight})}}}},resize:function(){var newState='default';if(window.innerWidth<this.tabletsBreakpoint){newState=(window.innerWidth<this.mobilesBreakpoint)?'mobiles':'tablets'}
this.setState(newState);if(this.pos=='fixed'&&this.orientation=='hor'){var isSticky=this.$container.hasClass('sticky');this.$container.addClass('notransition');if(!isSticky){this.$container.addClass('sticky')}
this.scrolledOccupiedHeight=this.$container.height();if(!isSticky){this.$container.removeClass('sticky')}
setTimeout(function(){this.$container.removeClass('notransition')}.bind(this),50)}else{this.scrolledOccupiedHeight=0}
if(this.orientation=='hor'){if(this.pos=='fixed'&&($us.canvas.headerInitialPos=='bottom'||$us.canvas.headerInitialPos=='below')&&($us.$body.usMod('state')=='default')){var adminBar=$('#wpadminbar');this.adminBarHeight=(adminBar.length)?adminBar.height():0;this.headerTop=$us.canvas.$firstSection.outerHeight()+this.adminBarHeight;if($us.canvas.headerInitialPos=='bottom'){this.headerTop=this.headerTop-this.$container.outerHeight()}
if(!$us.canvas.$firstSection.hasClass('height_full')){this.$container.css('bottom','auto');this.applyHeaderTop=!0;this.$container.css('top',this.headerTop)}}else{this.applyHeaderTop=!1;this.$container.css('top','')}}else{this.applyHeaderTop=!1;this.$container.css('top','')}
this._countScrollable();this.scroll()},setState:function(newState){if(newState==this.state){return}
var newOrientation=this.settings[newState].options.orientation||'hor',newPos=$us.toBool(this.settings[newState].options.sticky)?'fixed':'static',newBg=$us.toBool(this.settings[newState].options.transparent)?'transparent':'solid',newShadow=this.settings[newState].options.shadow||'thin';if(newOrientation=='ver'){newPos='fixed';newBg='solid'}
this.state=newState;this._setOrientation(newOrientation);this._setPos(newPos);this._setBg(newBg);this._setShadow(newShadow);this._setLayout(this.settings[newState].layout||{});$us.$body.usMod('state',newState);if(newState=='default'){$us.$body.removeClass('header-show')}
if($us.nav!==undefined){$us.nav.resize()}},_setOrientation:function(newOrientation){if(newOrientation==this.orientation){return}
$us.$body.usMod('header',newOrientation);this.orientation=newOrientation},_countScrollable:function(){if(this.orientation=='ver'&&this.pos=='fixed'&&this.state=='default'){this.docHeight=$us.$document.height();this.htmlTopMargin=parseInt($us.$html.css('margin-top'));this.headerHeight=this.$topCell.height()+this.$middleCell.height()+this.$bottomCell.height();if(this.headerHeight>$us.canvas.winHeight-this.htmlTopMargin){this.$container.addClass('scrollable')}else if(this.$container.hasClass('scrollable')){this.$container.removeClass('scrollable').resetInlineCSS('position','top','bottom');delete this._sidedHeaderScrollRange}
if(this.headerHeight+this.htmlTopMargin>=this.docHeight){this.$container.css({position:'absolute',top:0})}}else if(this.$container.hasClass('scrollable')){this.$container.removeClass('scrollable').resetInlineCSS('position','top','bottom');delete this._sidedHeaderScrollRange}},_setPos:function(newPos){if(newPos==this.pos){return}
this.$container.usMod('pos',newPos);if(newPos=='static'){this.$container.removeClass('sticky')}
this.pos=newPos;this._countScrollable()},_setBg:function(newBg){if(newBg==this.bg){return}
this.$container.usMod('bg',newBg);this.bg=newBg},_setShadow:function(newShadow){if(newShadow==this.shadow){return}
this.$container.usMod('shadow',newShadow);this.shadow=newShadow},_placeElements:function(elms,$place){for(var i=0;i<elms.length;i ++){var elmId;if(typeof elms[i]=='object'){elmId=elms[i][0];if(this.$places[elmId]===undefined||this.$elms[elmId]===undefined){continue}
this.$elms[elmId].appendTo($place);this._placeElements(elms[i].shift(),this.$places[elmId])}else{elmId=elms[i];if(this.$elms[elmId]===undefined){continue}
this.$elms[elmId].appendTo($place)}}},_setLayout:function(newLayout){var curLayout={};$.each(this.$places,function(place,$place){}.bind(this));for(var place in newLayout){if(!newLayout.hasOwnProperty(place)||this.$places[place]===undefined){continue}
this._placeElements(newLayout[place],this.$places[place])}}});$us.header=new USHeader($us.headerSettings||{})}(jQuery)
@@ -0,0 +1,294 @@
/*
* Horparallax
*
* @version 1.0
*
* Copyright 2017 UpSolution
*/
! function( $ ) {
/*
********* Horparallax class definition ***********/
var Horparallax = function( container, options ) {
// Context
var that = this;
this.$window = $( window );
this.container = $( container );
// Apply options
if ( container.onclick != undefined ) {
options = $.extend( {}, container.onclick() || {}, typeof options == 'object' && options );
this.container.removeProp( 'onclick' );
}
options = $.extend( {}, $.fn.horparallax.defaults, typeof options == 'object' && options );
this.options = options;
this.bg = this.container.find( options.bgSelector );
// Count sizes
this.containerWidth = this.container.outerWidth();
this.containerHeight = this.container.outerHeight();
this.bgWidth = this.bg.outerWidth();
this.windowHeight = this.$window.height();
// Count frame rate
this._frameRate = Math.round( 1000 / this.options.fps );
// To fix IE bug that handles mousemove before mouseenter
this.mouseInside = false;
// Mouse events for desktop browsers
if ( ! ( 'ontouchstart' in window ) || ! ( 'DeviceOrientationEvent' in window ) ) {
this.container
.mouseenter( function( e ) {
// To fix IE bug that handles mousemove before mouseenter
that.mouseInside = true;
var offset = that.container.offset(),
coord = ( e.pageX - offset.left ) / that.containerWidth;
that.cancel();
that._hoverAnimation = true;
that._hoverFrom = that.now;
that._hoverTo = coord;
that.start( that._hoverTo );
} )
.mousemove( function( e ) {
// To fix IE bug that handles mousemove before mouseenter
if ( ! that.mouseInside ) {
return;
}
// Reducing processor load for too frequent event calls
if ( that._lastFrame + that._frameRate > Date.now() ) {
return;
}
var offset = that.container.offset(),
coord = ( e.pageX - offset.left ) / that.containerWidth;
// Handle hover animation
if ( that._hoverAnimation ) {
that._hoverTo = coord;
return;
}
that.set( coord );
that._lastFrame = Date.now();
} )
.mouseleave( function( e ) {
that.mouseInside = false;
that.cancel();
that.start( that.options.basePoint );
} );
}
// Handle resize
this.$window.resize( function() {
that.handleResize();
} );
// Device orientation events for touch devices
this._orientationDriven = ( 'ontouchstart' in window && 'DeviceOrientationEvent' in window );
if ( this._orientationDriven ) {
// Check if container is visible
this._checkIfVisible();
window.addEventListener( "deviceorientation", function( e ) {
// Reducing processor load for too frequent event calls
if ( ! that.visible || that._lastFrame + that._frameRate > Date.now() ) {
return;
}
that._deviceOrientationChange( e );
that._lastFrame = Date.now();
} );
this.$window.resize( function() {
that._checkIfVisible();
} );
this.$window.scroll( function() {
that._checkIfVisible();
} );
}
// Set to basepoint
this.set( this.options.basePoint );
this._lastFrame = Date.now();
};
Horparallax.prototype = {
/**
* Event to fire on deviceorientation change
* @private
*/
_deviceOrientationChange: function( e ) {
var gamma = e.gamma,
beta = e.beta,
x, y;
switch ( window.orientation ) {
case - 90:
beta = Math.max( - 45, Math.min( 45, beta ) );
x = ( beta + 45 ) / 90;
break;
case 90:
beta = Math.max( - 45, Math.min( 45, beta ) );
x = ( 45 - beta ) / 90;
break;
case 180:
gamma = Math.max( - 45, Math.min( 45, gamma ) );
x = ( gamma + 45 ) / 90;
break;
case 0:
default:
// Upside down
if ( gamma < - 90 || gamma > 90 ) {
gamma = Math.abs( e.gamma ) / e.gamma * ( 180 - Math.abs( e.gamma ) );
}
gamma = Math.max( - 45, Math.min( 45, gamma ) );
x = ( 45 - gamma ) / 90;
break;
}
this.set( x );
},
/**
* Handle container resize
*/
handleResize: function() {
this.containerWidth = this.container.outerWidth();
this.containerHeight = this.container.outerHeight();
this.bgWidth = this.bg.outerWidth();
this.windowHeight = this.$window.height();
this.set( this.now );
},
/**
* Update container visibility status (to prevent unnessesary rendering)
* @private
*/
_checkIfVisible: function() {
var scrollTop = this.$window.scrollTop(),
containerTop = this.container.offset().top;
this.visible = ( containerTop + this.containerHeight > scrollTop && containerTop < scrollTop + this.windowHeight );
},
/**
* Render horparallax frame.
* @param {Array} x is ranged in [0, 1]
*/
set: function( x ) {
this.bg.css( 'left', ( this.containerWidth - this.bgWidth ) * x );
this.now = x;
return this;
},
/**
* Step value computing function, read more at http://mootools.net/docs/core/Fx/Fx
* @param {Number} from
* @param {Number} to
* @param {Number} delta
* @return {Number}
*/
compute: function( from, to, delta ) {
if ( this._hoverAnimation ) {
return ( this._hoverTo - this._hoverFrom ) * delta + this._hoverFrom;
}
return ( to - from ) * delta + from;
},
/**
* Start animation to certain point
* @param {Array} to
* @return {Horparallax}
*/
start: function( to ) {
var from = this.now,
that = this;
this.container
.css( 'delta', 0 )
.animate( {
delta: 1
}, {
duration: this.options.duration,
easing: this.options.easing,
complete: function() {
that._hoverAnimation = false;
},
step: function( delta ) {
that.set( that.compute( from, to, delta ) );
},
queue: false
} );
return this;
},
/**
* Cancel animation
* @return {Horparallax}
*/
cancel: function() {
this._hoverAnimation = false;
this.container.stop( true, false );
return this;
}
};
// EaseOutElastic easing
if ( $.easing.easeOutElastic == undefined ) {
/**
* Original function by George McGinley Smith
* @link http://gsgd.co.uk/sandbox/jquery/easing/
*/
$.easing.easeOutElastic = function( x, t, b, c, d ) {
var s = 1.70158, p = 0, a = c;
if ( t == 0 ) {
return b;
}
if ( ( t /= d ) == 1 ) {
return b + c;
}
if ( ! p ) {
p = d * .3;
}
if ( a < Math.abs( c ) ) {
a = c;
var s = p / 4;
}
else {
var s = p / ( 2 * Math.PI ) * Math.asin( c / a );
}
return a * Math.pow( 2, - 10 * t ) * Math.sin( ( t * d - s ) * ( 2 * Math.PI ) / p ) + c + b;
};
}
$.fn.horparallax = function( options ) {
return this.each( function() {
var $this = $( this ),
data = $this.data( 'horparallax' );
if ( ! data ) {
$this.data( 'horparallax', ( data = new Horparallax( this, options ) ) )
}
} );
};
$.fn.horparallax.defaults = {
/**
* @var {Number} Frame per second limit for rendering
*/
fps: 60,
/**
* @var {Number} Point for basic position (after the cursor moves out of the container)
*/
basePoint: .5,
/**
* @var {Number} Return to base point duration
*/
duration: 500,
/**
* @var {String} Background layer selector
*/
bgSelector: '.l-section-img',
/**
* @var {Function} Returning-to-basepoint easing
*/
easing: 'swing'// 'easeOutElastic'
};
$.fn.horparallax.Constructor = Horparallax;
$( function() {
jQuery( '.parallax_hor' ).horparallax();
} );
}( jQuery );
@@ -0,0 +1,17 @@
!function($){var Horparallax=function(container,options){var that=this;this.$window=$(window);this.container=$(container);if(container.onclick!=undefined){options=$.extend({},container.onclick()||{},typeof options=='object'&&options);this.container.removeProp('onclick')}
options=$.extend({},$.fn.horparallax.defaults,typeof options=='object'&&options);this.options=options;this.bg=this.container.find(options.bgSelector);this.containerWidth=this.container.outerWidth();this.containerHeight=this.container.outerHeight();this.bgWidth=this.bg.outerWidth();this.windowHeight=this.$window.height();this._frameRate=Math.round(1000/this.options.fps);this.mouseInside=!1;if(!('ontouchstart' in window)||!('DeviceOrientationEvent' in window)){this.container.mouseenter(function(e){that.mouseInside=!0;var offset=that.container.offset(),coord=(e.pageX-offset.left)/that.containerWidth;that.cancel();that._hoverAnimation=!0;that._hoverFrom=that.now;that._hoverTo=coord;that.start(that._hoverTo)}).mousemove(function(e){if(!that.mouseInside){return}
if(that._lastFrame+that._frameRate>Date.now()){return}
var offset=that.container.offset(),coord=(e.pageX-offset.left)/that.containerWidth;if(that._hoverAnimation){that._hoverTo=coord;return}
that.set(coord);that._lastFrame=Date.now()}).mouseleave(function(e){that.mouseInside=!1;that.cancel();that.start(that.options.basePoint)})}
this.$window.resize(function(){that.handleResize()});this._orientationDriven=('ontouchstart' in window&&'DeviceOrientationEvent' in window);if(this._orientationDriven){this._checkIfVisible();window.addEventListener("deviceorientation",function(e){if(!that.visible||that._lastFrame+that._frameRate>Date.now()){return}
that._deviceOrientationChange(e);that._lastFrame=Date.now()});this.$window.resize(function(){that._checkIfVisible()});this.$window.scroll(function(){that._checkIfVisible()})}
this.set(this.options.basePoint);this._lastFrame=Date.now()};Horparallax.prototype={_deviceOrientationChange:function(e){var gamma=e.gamma,beta=e.beta,x,y;switch(window.orientation){case-90:beta=Math.max(-45,Math.min(45,beta));x=(beta+45)/90;break;case 90:beta=Math.max(-45,Math.min(45,beta));x=(45-beta)/90;break;case 180:gamma=Math.max(-45,Math.min(45,gamma));x=(gamma+45)/90;break;case 0:default:if(gamma<-90||gamma>90){gamma=Math.abs(e.gamma)/e.gamma*(180-Math.abs(e.gamma))}
gamma=Math.max(-45,Math.min(45,gamma));x=(45-gamma)/90;break}
this.set(x)},handleResize:function(){this.containerWidth=this.container.outerWidth();this.containerHeight=this.container.outerHeight();this.bgWidth=this.bg.outerWidth();this.windowHeight=this.$window.height();this.set(this.now)},_checkIfVisible:function(){var scrollTop=this.$window.scrollTop(),containerTop=this.container.offset().top;this.visible=(containerTop+this.containerHeight>scrollTop&&containerTop<scrollTop+this.windowHeight)},set:function(x){this.bg.css('left',(this.containerWidth-this.bgWidth)*x);this.now=x;return this},compute:function(from,to,delta){if(this._hoverAnimation){return(this._hoverTo-this._hoverFrom)*delta+this._hoverFrom}
return(to-from)*delta+from},start:function(to){var from=this.now,that=this;this.container.css('delta',0).animate({delta:1},{duration:this.options.duration,easing:this.options.easing,complete:function(){that._hoverAnimation=!1},step:function(delta){that.set(that.compute(from,to,delta))},queue:!1});return this},cancel:function(){this._hoverAnimation=!1;this.container.stop(!0,!1);return this}};if($.easing.easeOutElastic==undefined){$.easing.easeOutElastic=function(x,t,b,c,d){var s=1.70158,p=0,a=c;if(t==0){return b}
if((t/=d)==1){return b+c}
if(!p){p=d*.3}
if(a<Math.abs(c)){a=c;var s=p/4}
else{var s=p/(2*Math.PI)*Math.asin(c/a)}
return a*Math.pow(2,-10*t)*Math.sin((t*d-s)*(2*Math.PI)/p)+c+b}}
$.fn.horparallax=function(options){return this.each(function(){var $this=$(this),data=$this.data('horparallax');if(!data){$this.data('horparallax',(data=new Horparallax(this,options)))}})};$.fn.horparallax.defaults={fps:60,basePoint:.5,duration:500,bgSelector:'.l-section-img',easing:'swing'};$.fn.horparallax.Constructor=Horparallax;$(function(){jQuery('.parallax_hor').horparallax()})}(jQuery)
@@ -0,0 +1,214 @@
/*
Plugin: jQuery Parallax
Version 1.1.3
Author: Ian Lunn
Twitter: @IanLunn
Author URL: http://www.ianlunn.co.uk/
Plugin URL: http://www.ianlunn.co.uk/plugins/jquery-parallax/
(Contains lots of UpSolution's modifications)
Dual licensed under the MIT and GPL licenses:
http://www.opensource.org/licenses/mit-license.php
http://www.gnu.org/licenses/gpl.html
*/
( function( $ ) {
var $window = $( window ),
windowHeight = $window.height();
$.fn.parallax = function( xposParam ) {
this.each( function() {
var $container = $( this ),
$this = $container.children( '.l-section-img' ),
speedFactor,
offsetFactor = 0,
getHeight,
topOffset = 0,
containerHeight = 0,
containerWidth = 0,
// Disable parallax on certain screen/img ratios
disableParallax = false,
parallaxIsDisabled = false,
// Base image width and height (if can be achieved)
baseImgHeight = 0,
baseImgWidth = 0,
// Backgroud-size cover? and current image size (counted)
isBgCover = ( $this.css( 'background-size' ) == 'cover' ),
originalBgPos = $this.css( 'background-position' ),
curImgHeight = 0,
reversed = $container.hasClass( 'parallaxdir_reversed' ),
baseSpeedFactor = reversed ? - 0.1 : 0.61,
xpos,
outerHeight = true;
if ( $this.length == 0 ) {
return;
}
// setup defaults if arguments aren't specified
if ( xposParam === undefined ) {
xpos = "50%";
} else {
xpos = xposParam;
}
if ( $container.hasClass( 'parallax_xpos_right' ) ) {
xpos = "100%";
} else if ( $container.hasClass( 'parallax_xpos_left' ) ) {
xpos = "0%";
}
if ( outerHeight ) {
getHeight = function( jqo ) {
return jqo.outerHeight( true );
};
} else {
getHeight = function( jqo ) {
return jqo.height();
};
}
// Count background image size
function getBackgroundSize( callback ) {
var img = new Image(),
// here we will place image's width and height
width, height,
// here we get the size of the background and split it to array
backgroundSize = ( $this.css( 'background-size' ) || ' ' ).split( ' ' ),
backgroundWidthAttr = $this.attr( 'data-img-width' ),
backgroundHeightAttr = $this.attr( 'data-img-height' );
if ( backgroundWidthAttr != '' ) {
width = parseInt( backgroundWidthAttr );
}
if ( backgroundHeightAttr != '' ) {
height = parseInt( backgroundHeightAttr );
}
if ( width !== undefined && height !== undefined ) {
// Image is not needed
return callback( { width: width, height: height } );
}
// checking if width was set to pixel value
if ( /px/.test( backgroundSize[ 0 ] ) ) {
width = parseInt( backgroundSize[ 0 ] );
}
// checking if width was set to percent value
if ( /%/.test( backgroundSize[ 0 ] ) ) {
width = $this.parent().width() * ( parseInt( backgroundSize[ 0 ] ) / 100 );
}
// checking if height was set to pixel value
if ( /px/.test( backgroundSize[ 1 ] ) ) {
height = parseInt( backgroundSize[ 1 ] );
}
// checking if height was set to percent value
if ( /%/.test( backgroundSize[ 1 ] ) ) {
height = $this.parent().height() * ( parseInt( backgroundSize[ 0 ] ) / 100 );
}
if ( width !== undefined && height !== undefined ) {
// Image is not needed
return callback( { width: width, height: height } );
}
// Image is needed
img.onload = function() {
// check if width was set earlier, if not then set it now
if ( typeof width == 'undefined' ) {
width = this.width;
}
// do the same with height
if ( typeof height == 'undefined' ) {
height = this.height;
}
// call the callback
callback( { width: width, height: height } );
};
// extract image source from css using one, simple regex
// src should be set AFTER onload handler
img.src = ( $this.css( 'background-image' ) || '' ).replace( /url\(['"]*(.*?)['"]*\)/g, '$1' );
}
function update() {
if ( disableParallax ) {
if ( ! parallaxIsDisabled ) {
$this.css( 'backgroundPosition', originalBgPos );
$container.usMod( 'parallax', 'fixed' );
parallaxIsDisabled = true;
}
return;
} else {
if ( parallaxIsDisabled ) {
$container.usMod( 'parallax', 'ver' );
parallaxIsDisabled = false;
}
}
if ( isNaN( speedFactor ) ) {
return;
}
var pos = $window.scrollTop();
// Check if totally above or totally below viewport
if ( ( topOffset + containerHeight < pos ) || ( pos < topOffset - windowHeight ) ) {
return;
}
$this.css( 'backgroundPosition', xpos + " " + ( offsetFactor + speedFactor * ( topOffset - pos ) ) + "px" );
}
function resize() {
setTimeout( function() {
windowHeight = $window.height();
containerHeight = getHeight( $this );
containerWidth = $this.width();
if ( $window.width() < $us.canvasOptions.disableEffectsWidth ) {
disableParallax = true;
} else {
disableParallax = false;
if ( isBgCover ) {
if ( baseImgWidth / baseImgHeight <= containerWidth / containerHeight ) {
// Resizing by width
curImgHeight = baseImgHeight * ( $this.width() / baseImgWidth );
disableParallax = false;
}
else {
disableParallax = true;
}
}
}
// Improving speed factor to prevent showing image limits
if ( curImgHeight !== 0 ) {
if ( baseSpeedFactor >= 0 ) {
speedFactor = Math.min( baseSpeedFactor, curImgHeight / windowHeight );
offsetFactor = Math.min( 0, .5 * ( windowHeight - curImgHeight - speedFactor * ( windowHeight - containerHeight ) ) );
} else {
speedFactor = Math.min( baseSpeedFactor, ( windowHeight - containerHeight ) / ( windowHeight + containerHeight ) );
offsetFactor = Math.max( 0, speedFactor * containerHeight );
}
} else {
speedFactor = baseSpeedFactor;
offsetFactor = 0;
}
topOffset = $this.offset().top;
update();
}, 10 );
}
getBackgroundSize( function( sz ) {
curImgHeight = baseImgHeight = sz.height;
baseImgWidth = sz.width;
resize();
} );
$window.bind( { scroll: update, load: resize, resize: resize } );
resize();
} );
};
jQuery( '.parallax_ver' ).parallax( '50%' );
} )( jQuery );
@@ -0,0 +1,25 @@
(function($){var $window=$(window),windowHeight=$window.height();$.fn.parallax=function(xposParam){this.each(function(){var $container=$(this),$this=$container.children('.l-section-img'),speedFactor,offsetFactor=0,getHeight,topOffset=0,containerHeight=0,containerWidth=0,disableParallax=!1,parallaxIsDisabled=!1,baseImgHeight=0,baseImgWidth=0,isBgCover=($this.css('background-size')=='cover'),originalBgPos=$this.css('background-position'),curImgHeight=0,reversed=$container.hasClass('parallaxdir_reversed'),baseSpeedFactor=reversed?-0.1:0.61,xpos,outerHeight=!0;if($this.length==0){return}
if(xposParam===undefined){xpos="50%"}else{xpos=xposParam}
if($container.hasClass('parallax_xpos_right')){xpos="100%"}else if($container.hasClass('parallax_xpos_left')){xpos="0%"}
if(outerHeight){getHeight=function(jqo){return jqo.outerHeight(!0)}}else{getHeight=function(jqo){return jqo.height()}}
function getBackgroundSize(callback){var img=new Image(),width,height,backgroundSize=($this.css('background-size')||' ').split(' '),backgroundWidthAttr=$this.attr('data-img-width'),backgroundHeightAttr=$this.attr('data-img-height');if(backgroundWidthAttr!=''){width=parseInt(backgroundWidthAttr)}
if(backgroundHeightAttr!=''){height=parseInt(backgroundHeightAttr)}
if(width!==undefined&&height!==undefined){return callback({width:width,height:height})}
if(/px/.test(backgroundSize[0])){width=parseInt(backgroundSize[0])}
if(/%/.test(backgroundSize[0])){width=$this.parent().width()*(parseInt(backgroundSize[0])/100)}
if(/px/.test(backgroundSize[1])){height=parseInt(backgroundSize[1])}
if(/%/.test(backgroundSize[1])){height=$this.parent().height()*(parseInt(backgroundSize[0])/100)}
if(width!==undefined&&height!==undefined){return callback({width:width,height:height})}
img.onload=function(){if(typeof width=='undefined'){width=this.width}
if(typeof height=='undefined'){height=this.height}
callback({width:width,height:height})};img.src=($this.css('background-image')||'').replace(/url\(['"]*(.*?)['"]*\)/g,'$1')}
function update(){if(disableParallax){if(!parallaxIsDisabled){$this.css('backgroundPosition',originalBgPos);$container.usMod('parallax','fixed');parallaxIsDisabled=!0}
return}else{if(parallaxIsDisabled){$container.usMod('parallax','ver');parallaxIsDisabled=!1}}
if(isNaN(speedFactor)){return}
var pos=$window.scrollTop();if((topOffset+containerHeight<pos)||(pos<topOffset-windowHeight)){return}
$this.css('backgroundPosition',xpos+" "+(offsetFactor+speedFactor*(topOffset-pos))+"px")}
function resize(){setTimeout(function(){windowHeight=$window.height();containerHeight=getHeight($this);containerWidth=$this.width();if($window.width()<$us.canvasOptions.disableEffectsWidth){disableParallax=!0}else{disableParallax=!1;if(isBgCover){if(baseImgWidth/baseImgHeight<=containerWidth/containerHeight){curImgHeight=baseImgHeight*($this.width()/baseImgWidth);disableParallax=!1}
else{disableParallax=!0}}}
if(curImgHeight!==0){if(baseSpeedFactor>=0){speedFactor=Math.min(baseSpeedFactor,curImgHeight/windowHeight);offsetFactor=Math.min(0,.5*(windowHeight-curImgHeight-speedFactor*(windowHeight-containerHeight)))}else{speedFactor=Math.min(baseSpeedFactor,(windowHeight-containerHeight)/(windowHeight+containerHeight));offsetFactor=Math.max(0,speedFactor*containerHeight)}}else{speedFactor=baseSpeedFactor;offsetFactor=0}
topOffset=$this.offset().top;update()},10)}
getBackgroundSize(function(sz){curImgHeight=baseImgHeight=sz.height;baseImgWidth=sz.width;resize()});$window.bind({scroll:update,load:resize,resize:resize});resize()})};jQuery('.parallax_ver').parallax('50%')})(jQuery)
@@ -0,0 +1,17 @@
/**
* UpSolution Element: l-preloader
*/
! function( $ ) {
"use strict";
if ( $( '.l-preloader' ).length ) {
$( 'document' ).ready( function() {
setTimeout( function() {
$( '.l-preloader' ).addClass( 'done' );
}, 500 );
setTimeout( function() {
$( '.l-preloader' ).addClass( 'hidden' );
}, 1000 ); // 500 ms after 'done' class is added
} );
}
}( jQuery );
@@ -0,0 +1 @@
!function($){"use strict";if($('.l-preloader').length){$('document').ready(function(){setTimeout(function(){$('.l-preloader').addClass('done')},500);setTimeout(function(){$('.l-preloader').addClass('hidden')},1000)})}}(jQuery)
@@ -0,0 +1,472 @@
/**
* $us.scroll
*
* ScrollSpy, Smooth scroll links and hash-based scrolling all-in-one
*
* @requires $us.canvas
*/
! function( $ ) {
"use strict";
function USScroll( options ) {
// Setting options
var defaults = {
/**
* @param {String|jQuery} Selector or object of hash scroll anchors that should be attached on init
*/
attachOnInit: '.menu-item a[href*="#"], .menu-item[href*="#"], a.w-btn[href*="#"], .w-text a[href*="#"], ' + '.vc_icon_element a[href*="#"], .vc_custom_heading a[href*="#"], a.w-grid-item-anchor[href*="#"], .w-toplink, ' + '.w-image a[href*="#"], .w-iconbox a[href*="#"], .w-comments-title a[href*="#"], a.smooth-scroll[href*="#"]',
/**
* @param {String} Classname that will be toggled on relevant buttons
*/
buttonActiveClass: 'active',
/**
* @param {String} Classname that will be toggled on relevant menu items
*/
menuItemActiveClass: 'current-menu-item',
/**
* @param {String} Classname that will be toggled on relevant menu ancestors
*/
menuItemAncestorActiveClass: 'current-menu-ancestor',
/**
* @param {Number} Duration of scroll animation
*/
animationDuration: $us.canvasOptions.scrollDuration,
/**
* @param {String} Easing for scroll animation
*/
animationEasing: 'easeInOutExpo'
};
this.options = $.extend( {}, defaults, options || {} );
// Hash blocks with targets and activity indicators
this.blocks = {};
// Is scrolling to some specific block at the moment?
this.isScrolling = false;
// Waypoints that will be called at certain scroll position
this.waypoints = [];
// Sticky rows
this.stickyRows = [];//$('.l-section.type_sticky');
// Boundable events
this._events = {
cancel: this.cancel.bind( this ), scroll: this.scroll.bind( this ), resize: this.resize.bind( this )
};
this._canvasTopOffset = 0;
$us.$window.on( 'resize load', this._events.resize );
setTimeout( this._events.resize, 75 );
$us.$window.on( 'scroll', this._events.scroll );
setTimeout( this._events.scroll, 75 );
if ( this.options.attachOnInit ) {
this.attach( this.options.attachOnInit );
}
$( '.l-section.type_sticky' ).each( function( key, row ) {
var $row = $( row ), $rowGap = $row.next( '.l-section-gap' ), stickyRow = {
$row: $row, $rowGap: $rowGap
};
this._countStickyRow( stickyRow );
this.stickyRows.push( stickyRow );
}.bind( this ) );
// Recount scroll positions on any content changes
$us.$canvas.on( 'contentChange', this._countAllPositions.bind( this ) );
// Handling initial document hash
if ( document.location.hash && document.location.hash.indexOf( '#!' ) == - 1 ) {
var hash = document.location.hash, scrollPlace = ( this.blocks[ hash ] !== undefined ) ? hash : undefined;
if ( scrollPlace === undefined ) {
try {
var $target = $( hash );
if ( $target.length != 0 ) {
scrollPlace = $target;
}
}
catch ( error ) {
//Do not have to do anything here since scrollPlace is already undefined
}
}
if ( scrollPlace !== undefined ) {
// While page loads, its content changes, and we'll keep the proper scroll on each sufficient content
// change until the page finishes loading or user scrolls the page manually
var keepScrollPositionTimer = setInterval( function() {
this.scrollTo( scrollPlace );
}.bind( this ), 100 );
var clearHashEvents = function() {
// Content size still may change via other script right after page load
setTimeout( function() {
clearInterval( keepScrollPositionTimer );
$us.canvas.resize();
this._countAllPositions();
this.scrollTo( scrollPlace );
}.bind( this ), 100 );
$us.$window.off( 'load touchstart mousewheel DOMMouseScroll touchstart', clearHashEvents );
}.bind( this );
$us.$window.on( 'load touchstart mousewheel DOMMouseScroll touchstart', clearHashEvents );
}
}
}
USScroll.prototype = {
/**
* Count hash's target position and store it properly
*
* @param {String} hash
* @private
*/
_countPosition: function( hash ) {
var targetTop = this.blocks[ hash ].target.offset().top;
if ( this.blocks[ hash ].target.is( '.l-section.sticky' ) ) {
this.blocks[ hash ].target.removeClass( 'sticky' );
targetTop = this.blocks[ hash ].target.offset().top;
this.blocks[ hash ].target.addClass( 'sticky' );
}
this.blocks[ hash ].top = Math.ceil( targetTop - this._canvasTopOffset );
if ( $us.header.headerTop === undefined || ( $us.header.headerTop > 0 && targetTop > $us.header.headerTop ) ) {
this.blocks[ hash ].top = this.blocks[ hash ].top - $us.header.scrolledOccupiedHeight;
}
if ( this.stickyRows[ 0 ] !== undefined && window.innerWidth > this.stickyRows[ 0 ].disableWidth && targetTop > this.stickyRows[ 0 ].originalTop ) {
this.blocks[ hash ].top = this.blocks[ hash ].top - this.stickyRows[ 0 ].height;
}
this.blocks[ hash ].bottom = this.blocks[ hash ].top + this.blocks[ hash ].target.outerHeight( false );
},
/**
* Count all targets' positions for proper scrolling
*
* @private
*/
_countAllPositions: function() {
// Take into account #wpadminbar (and others possible) offset
this._canvasTopOffset = $us.$canvas.offset().top;
// Counting stickyRows
for ( var i = 0; i < this.stickyRows.length; i ++ ) {
this._countStickyRow( this.stickyRows[ i ] );
}
// Counting blocks
for ( var hash in this.blocks ) {
if ( ! this.blocks.hasOwnProperty( hash ) ) {
continue;
}
this._countPosition( hash );
}
// Counting waypoints
for ( var i = 0; i < this.waypoints.length; i ++ ) {
this._countWaypoint( this.waypoints[ i ] );
}
},
/**
* Indicate scroll position by hash
*
* @param {String} activeHash
* @private
*/
_indicatePosition: function( activeHash ) {
var activeMenuAncestors = [];
for ( var hash in this.blocks ) {
if ( ! this.blocks.hasOwnProperty( hash ) ) {
continue;
}
if ( this.blocks[ hash ].buttons !== undefined ) {
this.blocks[ hash ].buttons.toggleClass( this.options.buttonActiveClass, hash === activeHash );
}
if ( this.blocks[ hash ].menuItems !== undefined ) {
this.blocks[ hash ].menuItems.toggleClass( this.options.menuItemActiveClass, hash === activeHash );
}
if ( this.blocks[ hash ].menuAncestors !== undefined ) {
this.blocks[ hash ].menuAncestors.removeClass( this.options.menuItemAncestorActiveClass );
}
}
if ( this.blocks[ activeHash ] !== undefined && this.blocks[ activeHash ].menuAncestors !== undefined ) {
this.blocks[ activeHash ].menuAncestors.addClass( this.options.menuItemAncestorActiveClass );
}
},
/**
* Attach anchors so their targets will be listened for possible scrolls
*
* @param {String|jQuery} anchors Selector or list of anchors to attach
*/
attach: function( anchors ) {
// Location pattern to check absolute URLs for current location
var locationPattern = new RegExp( '^' + location.pathname.replace( /[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&" ) + '#' );
var $anchors = $( anchors );
if ( $anchors.length == 0 ) {
return;
}
$anchors.each( function( index, anchor ) {
var $anchor = $( anchor ), href = $anchor.attr( 'href' ), hash = $anchor.prop( 'hash' );
// Ignoring ajax links
if ( hash.indexOf( '#!' ) != - 1 ) {
return;
}
// Checking if the hash is connected with the current page
if ( ! ( // Link type: #something
href.charAt( 0 ) == '#' || // Link type: /#something
( href.charAt( 0 ) == '/' && locationPattern.test( href ) ) || // Link type:
// http://example.com/some/path/#something
href.indexOf( location.host + location.pathname + '#' ) > - 1 ) ) {
return;
}
// Do we have an actual target, for which we'll need to count geometry?
if ( hash != '' && hash != '#' ) {
// Attach target
if ( this.blocks[ hash ] === undefined ) {
var $target = $( hash ), $type = '';
// Don't attach anchors that actually have no target
if ( $target.length == 0 ) {
return;
}
// If it's the only row in a section, than use section instead
if ( $target.hasClass( 'g-cols' ) && $target.parent().children().length == 1 ) {
$target = $target.closest( '.l-section' );
}
// If it's tabs or tour item, then use tabs container
if ( $target.hasClass( 'w-tabs-section' ) ) {
var $newTarget = $target.closest( '.w-tabs' );
if ( ! $newTarget.hasClass( 'accordion' ) ) {
$target = $newTarget;
$type = 'tab';
}
}
this.blocks[ hash ] = {
target: $target, type: $type
};
this._countPosition( hash );
}
// Attach activity indicator
if ( $anchor.parent().length > 0 && $anchor.parent().hasClass( 'menu-item' ) ) {
var $menuIndicator = $anchor.closest( '.menu-item' );
this.blocks[ hash ].menuItems = ( this.blocks[ hash ].menuItems || $() ).add( $menuIndicator );
var $menuAncestors = $menuIndicator.parents( '.menu-item-has-children' );
if ( $menuAncestors.length > 0 ) {
this.blocks[ hash ].menuAncestors = ( this.blocks[ hash ].menuAncestors || $() ).add( $menuAncestors );
}
} else {
this.blocks[ hash ].buttons = ( this.blocks[ hash ].buttons || $() ).add( $anchor );
}
}
$anchor.on( 'click', function( event ) {
event.preventDefault();
this.scrollTo( hash, true );
//If it's tabs
if ( typeof this.blocks[ hash ] !== 'undefined' ) {
if ( this.blocks[ hash ].type == 'tab' ) {
var $linkedSection = this.blocks[ hash ].target.find( '.w-tabs-section[id="' + hash.substr( 1 ) + '"]' );
if ( $linkedSection.length && ( ! $linkedSection.hasClass( 'active' ) ) ) {
var $header = $linkedSection.find( '.w-tabs-section-header' );
$header.click();
}
}
}
}.bind( this ) );
}.bind( this ) );
},
/**
* Scroll page to a certain position or hash
*
* @param {Number|String|jQuery} place
* @param {Boolean} animate
*/
scrollTo: function( place, animate ) {
var placeType, newY;
// Scroll to top
if ( place == '' || place == '#' ) {
newY = 0;
placeType = 'top';
}
// Scroll by hash
else if ( this.blocks[ place ] !== undefined ) {
newY = this.blocks[ place ].top;
placeType = 'hash';
} else if ( place instanceof $ ) {
if ( place.hasClass( 'w-tabs-section' ) ) {
var newPlace = place.closest( '.w-tabs' );
if ( ! newPlace.hasClass( 'accordion' ) ) {
place = newPlace;
}
}
newY = Math.floor( place.offset().top - this._canvasTopOffset );
if ( $us.header.headerTop === undefined || ( $us.header.headerTop > 0 && place.offset().top > $us.header.headerTop ) ) {
newY = newY - $us.header.scrolledOccupiedHeight;
}
placeType = 'element';
} else {
newY = Math.floor( place - this._canvasTopOffset );
if ( $us.header.headerTop === undefined || ( $us.header.headerTop > 0 && place > $us.header.headerTop ) ) {
newY = newY - $us.header.scrolledOccupiedHeight;
}
}
var indicateActive = function() {
if ( placeType == 'hash' ) {
this._indicatePosition( place );
} else {
this.scroll();
}
}.bind( this );
if ( animate ) {
this.isScrolling = true;
// Fix for iPads since scrollTop returns 0 all the time
if ( navigator.userAgent.match( /iPad/i ) != null && $( '.us_iframe' ).length && placeType == 'hash' ) {
$( place )[ 0 ].scrollIntoView( { behavior: "smooth", block: "start" } );
}
$us.$htmlBody.stop( true, false ).animate( {
scrollTop: newY + 'px'
}, {
duration: this.options.animationDuration, easing: this.options.animationEasing, always: function() {
$us.$window.off( 'keydown mousewheel DOMMouseScroll touchstart', this._events.cancel );
this.isScrolling = false;
indicateActive();
}.bind( this )
} );
// Allow user to stop scrolling manually
$us.$window.on( 'keydown mousewheel DOMMouseScroll touchstart', this._events.cancel );
} else {
$us.$htmlBody.stop( true, false ).scrollTop( newY );
indicateActive();
}
},
/**
* Cancel scroll
*/
cancel: function() {
$us.$htmlBody.stop( true, false );
},
/**
* Add new waypoint
*
* @param {jQuery} $elm object with the element
* @param {mixed} offset Offset from bottom of screen in pixels ('100') or percents ('20%')
* @param {Function} fn The function that will be called
*/
addWaypoint: function( $elm, offset, fn ) {
$elm = ( $elm instanceof $ ) ? $elm : $( $elm );
if ( $elm.length == 0 ) {
return;
}
if ( typeof offset != 'string' || offset.indexOf( '%' ) == - 1 ) {
// Not percent: using pixels
offset = parseInt( offset );
}
var waypoint = {
$elm: $elm, offset: offset, fn: fn
};
this._countWaypoint( waypoint );
this.waypoints.push( waypoint );
},
/**
*
* @param {Object} waypoint
* @private
*/
_countWaypoint: function( waypoint ) {
var elmTop = waypoint.$elm.offset().top, winHeight = $us.$window.height();
if ( typeof waypoint.offset == 'number' ) {
// Offset is defined in pixels
waypoint.scrollPos = elmTop - winHeight + waypoint.offset;
} else {
// Offset is defined in percents
waypoint.scrollPos = elmTop - winHeight + winHeight * parseInt( waypoint.offset ) / 100;
}
},
/**
*
* @param {Object} stickyRow
* @private
*/
_countStickyRow: function( stickyRow ) {
var isSticky = false;
if ( stickyRow.$row.hasClass( 'sticky' ) ) {
isSticky = true;
stickyRow.$row.removeClass( 'sticky' );
}
stickyRow.disableWidth = ( stickyRow.$row.data( 'sticky-disable-width' ) !== undefined ) ? stickyRow.$row.data( 'sticky-disable-width' ) : 900;
stickyRow.originalTop = stickyRow.$row.offset().top;
stickyRow.top = stickyRow.$row.offset().top - this._canvasTopOffset;
if ( $us.header.headerTop === undefined || ( $us.header.headerTop > 0 && stickyRow.top > $us.header.headerTop ) ) {
stickyRow.top = stickyRow.top - $us.header.scrolledOccupiedHeight;
}
stickyRow.height = stickyRow.$row.outerHeight();
if ( stickyRow.$row.is( '.l-main .l-section:first-child' ) ) {
stickyRow.height = stickyRow.height - parseInt( stickyRow.$row.css( 'padding-top' ) );
}
if ( isSticky ) {
stickyRow.$row.addClass( 'sticky' );
}
},
/**
* Scroll handler
*/
scroll: function() {
var scrollTop = parseInt( $us.$window.scrollTop() );
if ( ! this.isScrolling ) {
var activeHash;
for ( var hash in this.blocks ) {
if ( ! this.blocks.hasOwnProperty( hash ) ) {
continue;
}
if ( scrollTop >= ( this.blocks[ hash ].top - 1 ) && scrollTop < ( this.blocks[ hash ].bottom - 1 ) ) {
activeHash = hash;
break;
}
}
this._indicatePosition( activeHash );
}
// Handling sticky rows
for ( var i = 0; i < this.stickyRows.length; i ++ ) {
if ( this.stickyRows[ i ].top < scrollTop && window.innerWidth > this.stickyRows[ i ].disableWidth ) {
this.stickyRows[ i ].$row.addClass( 'sticky' );
this.stickyRows[ i ].$rowGap.css( 'height', this.stickyRows[ i ].height );
} else {
this.stickyRows[ i ].$row.removeClass( 'sticky' );
this.stickyRows[ i ].$rowGap.css( 'height', null );
}
}
// Handling waypoints
for ( var i = 0; i < this.waypoints.length; i ++ ) {
if ( this.waypoints[ i ].scrollPos < scrollTop ) {
this.waypoints[ i ].fn( this.waypoints[ i ].$elm );
this.waypoints.splice( i, 1 );
i --;
}
}
},
/**
* Resize handler
*/
resize: function() {
// Delaying the resize event to prevent glitches
setTimeout( function() {
this._countAllPositions();
this.scroll();
}.bind( this ), 150 );
this._countAllPositions();
this.scroll();
}
};
$( function() {
$us.scroll = new USScroll( $us.scrollOptions || {} );
} );
}( jQuery );
+37
View File
@@ -0,0 +1,37 @@
!function($){"use strict";function USScroll(options){var defaults={attachOnInit:'.menu-item a[href*="#"], .menu-item[href*="#"], a.w-btn[href*="#"], .w-text a[href*="#"], '+'.vc_icon_element a[href*="#"], .vc_custom_heading a[href*="#"], a.w-grid-item-anchor[href*="#"], .w-toplink, '+'.w-image a[href*="#"], .w-iconbox a[href*="#"], .w-comments-title a[href*="#"], a.smooth-scroll[href*="#"]',buttonActiveClass:'active',menuItemActiveClass:'current-menu-item',menuItemAncestorActiveClass:'current-menu-ancestor',animationDuration:$us.canvasOptions.scrollDuration,animationEasing:'easeInOutExpo'};this.options=$.extend({},defaults,options||{});this.blocks={};this.isScrolling=!1;this.waypoints=[];this.stickyRows=[];this._events={cancel:this.cancel.bind(this),scroll:this.scroll.bind(this),resize:this.resize.bind(this)};this._canvasTopOffset=0;$us.$window.on('resize load',this._events.resize);setTimeout(this._events.resize,75);$us.$window.on('scroll',this._events.scroll);setTimeout(this._events.scroll,75);if(this.options.attachOnInit){this.attach(this.options.attachOnInit)}
$('.l-section.type_sticky').each(function(key,row){var $row=$(row),$rowGap=$row.next('.l-section-gap'),stickyRow={$row:$row,$rowGap:$rowGap};this._countStickyRow(stickyRow);this.stickyRows.push(stickyRow)}.bind(this));$us.$canvas.on('contentChange',this._countAllPositions.bind(this));if(document.location.hash&&document.location.hash.indexOf('#!')==-1){var hash=document.location.hash,scrollPlace=(this.blocks[hash]!==undefined)?hash:undefined;if(scrollPlace===undefined){try{var $target=$(hash);if($target.length!=0){scrollPlace=$target}}
catch(error){}}
if(scrollPlace!==undefined){var keepScrollPositionTimer=setInterval(function(){this.scrollTo(scrollPlace)}.bind(this),100);var clearHashEvents=function(){setTimeout(function(){clearInterval(keepScrollPositionTimer);$us.canvas.resize();this._countAllPositions();this.scrollTo(scrollPlace)}.bind(this),100);$us.$window.off('load touchstart mousewheel DOMMouseScroll touchstart',clearHashEvents)}.bind(this);$us.$window.on('load touchstart mousewheel DOMMouseScroll touchstart',clearHashEvents)}}}
USScroll.prototype={_countPosition:function(hash){var targetTop=this.blocks[hash].target.offset().top;if(this.blocks[hash].target.is('.l-section.sticky')){this.blocks[hash].target.removeClass('sticky');targetTop=this.blocks[hash].target.offset().top;this.blocks[hash].target.addClass('sticky')}
this.blocks[hash].top=Math.ceil(targetTop-this._canvasTopOffset);if($us.header.headerTop===undefined||($us.header.headerTop>0&&targetTop>$us.header.headerTop)){this.blocks[hash].top=this.blocks[hash].top-$us.header.scrolledOccupiedHeight}
if(this.stickyRows[0]!==undefined&&window.innerWidth>this.stickyRows[0].disableWidth&&targetTop>this.stickyRows[0].originalTop){this.blocks[hash].top=this.blocks[hash].top-this.stickyRows[0].height}
this.blocks[hash].bottom=this.blocks[hash].top+this.blocks[hash].target.outerHeight(!1)},_countAllPositions:function(){this._canvasTopOffset=$us.$canvas.offset().top;for(var i=0;i<this.stickyRows.length;i ++){this._countStickyRow(this.stickyRows[i])}
for(var hash in this.blocks){if(!this.blocks.hasOwnProperty(hash)){continue}
this._countPosition(hash)}
for(var i=0;i<this.waypoints.length;i ++){this._countWaypoint(this.waypoints[i])}},_indicatePosition:function(activeHash){var activeMenuAncestors=[];for(var hash in this.blocks){if(!this.blocks.hasOwnProperty(hash)){continue}
if(this.blocks[hash].buttons!==undefined){this.blocks[hash].buttons.toggleClass(this.options.buttonActiveClass,hash===activeHash)}
if(this.blocks[hash].menuItems!==undefined){this.blocks[hash].menuItems.toggleClass(this.options.menuItemActiveClass,hash===activeHash)}
if(this.blocks[hash].menuAncestors!==undefined){this.blocks[hash].menuAncestors.removeClass(this.options.menuItemAncestorActiveClass)}}
if(this.blocks[activeHash]!==undefined&&this.blocks[activeHash].menuAncestors!==undefined){this.blocks[activeHash].menuAncestors.addClass(this.options.menuItemAncestorActiveClass)}},attach:function(anchors){var locationPattern=new RegExp('^'+location.pathname.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")+'#');var $anchors=$(anchors);if($anchors.length==0){return}
$anchors.each(function(index,anchor){var $anchor=$(anchor),href=$anchor.attr('href'),hash=$anchor.prop('hash');if(hash.indexOf('#!')!=-1){return}
if(!(href.charAt(0)=='#'||(href.charAt(0)=='/'&&locationPattern.test(href))||href.indexOf(location.host+location.pathname+'#')>-1)){return}
if(hash!=''&&hash!='#'){if(this.blocks[hash]===undefined){var $target=$(hash),$type='';if($target.length==0){return}
if($target.hasClass('g-cols')&&$target.parent().children().length==1){$target=$target.closest('.l-section')}
if($target.hasClass('w-tabs-section')){var $newTarget=$target.closest('.w-tabs');if(!$newTarget.hasClass('accordion')){$target=$newTarget;$type='tab'}}
this.blocks[hash]={target:$target,type:$type};this._countPosition(hash)}
if($anchor.parent().length>0&&$anchor.parent().hasClass('menu-item')){var $menuIndicator=$anchor.closest('.menu-item');this.blocks[hash].menuItems=(this.blocks[hash].menuItems||$()).add($menuIndicator);var $menuAncestors=$menuIndicator.parents('.menu-item-has-children');if($menuAncestors.length>0){this.blocks[hash].menuAncestors=(this.blocks[hash].menuAncestors||$()).add($menuAncestors)}}else{this.blocks[hash].buttons=(this.blocks[hash].buttons||$()).add($anchor)}}
$anchor.on('click',function(event){event.preventDefault();this.scrollTo(hash,!0);if(typeof this.blocks[hash]!=='undefined'){if(this.blocks[hash].type=='tab'){var $linkedSection=this.blocks[hash].target.find('.w-tabs-section[id="'+hash.substr(1)+'"]');if($linkedSection.length&&(!$linkedSection.hasClass('active'))){var $header=$linkedSection.find('.w-tabs-section-header');$header.click()}}}}.bind(this))}.bind(this))},scrollTo:function(place,animate){var placeType,newY;if(place==''||place=='#'){newY=0;placeType='top'}
else if(this.blocks[place]!==undefined){newY=this.blocks[place].top;placeType='hash'}else if(place instanceof $){if(place.hasClass('w-tabs-section')){var newPlace=place.closest('.w-tabs');if(!newPlace.hasClass('accordion')){place=newPlace}}
newY=Math.floor(place.offset().top-this._canvasTopOffset);if($us.header.headerTop===undefined||($us.header.headerTop>0&&place.offset().top>$us.header.headerTop)){newY=newY-$us.header.scrolledOccupiedHeight}
placeType='element'}else{newY=Math.floor(place-this._canvasTopOffset);if($us.header.headerTop===undefined||($us.header.headerTop>0&&place>$us.header.headerTop)){newY=newY-$us.header.scrolledOccupiedHeight}}
var indicateActive=function(){if(placeType=='hash'){this._indicatePosition(place)}else{this.scroll()}}.bind(this);if(animate){this.isScrolling=!0;if(navigator.userAgent.match(/iPad/i)!=null&&$('.us_iframe').length&&placeType=='hash'){$(place)[0].scrollIntoView({behavior:"smooth",block:"start"})}
$us.$htmlBody.stop(!0,!1).animate({scrollTop:newY+'px'},{duration:this.options.animationDuration,easing:this.options.animationEasing,always:function(){$us.$window.off('keydown mousewheel DOMMouseScroll touchstart',this._events.cancel);this.isScrolling=!1;indicateActive()}.bind(this)});$us.$window.on('keydown mousewheel DOMMouseScroll touchstart',this._events.cancel)}else{$us.$htmlBody.stop(!0,!1).scrollTop(newY);indicateActive()}},cancel:function(){$us.$htmlBody.stop(!0,!1)},addWaypoint:function($elm,offset,fn){$elm=($elm instanceof $)?$elm:$($elm);if($elm.length==0){return}
if(typeof offset!='string'||offset.indexOf('%')==-1){offset=parseInt(offset)}
var waypoint={$elm:$elm,offset:offset,fn:fn};this._countWaypoint(waypoint);this.waypoints.push(waypoint)},_countWaypoint:function(waypoint){var elmTop=waypoint.$elm.offset().top,winHeight=$us.$window.height();if(typeof waypoint.offset=='number'){waypoint.scrollPos=elmTop-winHeight+waypoint.offset}else{waypoint.scrollPos=elmTop-winHeight+winHeight*parseInt(waypoint.offset)/100}},_countStickyRow:function(stickyRow){var isSticky=!1;if(stickyRow.$row.hasClass('sticky')){isSticky=!0;stickyRow.$row.removeClass('sticky')}
stickyRow.disableWidth=(stickyRow.$row.data('sticky-disable-width')!==undefined)?stickyRow.$row.data('sticky-disable-width'):900;stickyRow.originalTop=stickyRow.$row.offset().top;stickyRow.top=stickyRow.$row.offset().top-this._canvasTopOffset;if($us.header.headerTop===undefined||($us.header.headerTop>0&&stickyRow.top>$us.header.headerTop)){stickyRow.top=stickyRow.top-$us.header.scrolledOccupiedHeight}
stickyRow.height=stickyRow.$row.outerHeight();if(stickyRow.$row.is('.l-main .l-section:first-child')){stickyRow.height=stickyRow.height-parseInt(stickyRow.$row.css('padding-top'))}
if(isSticky){stickyRow.$row.addClass('sticky')}},scroll:function(){var scrollTop=parseInt($us.$window.scrollTop());if(!this.isScrolling){var activeHash;for(var hash in this.blocks){if(!this.blocks.hasOwnProperty(hash)){continue}
if(scrollTop>=(this.blocks[hash].top-1)&&scrollTop<(this.blocks[hash].bottom-1)){activeHash=hash;break}}
this._indicatePosition(activeHash)}
for(var i=0;i<this.stickyRows.length;i ++){if(this.stickyRows[i].top<scrollTop&&window.innerWidth>this.stickyRows[i].disableWidth){this.stickyRows[i].$row.addClass('sticky');this.stickyRows[i].$rowGap.css('height',this.stickyRows[i].height)}else{this.stickyRows[i].$row.removeClass('sticky');this.stickyRows[i].$rowGap.css('height',null)}}
for(var i=0;i<this.waypoints.length;i ++){if(this.waypoints[i].scrollPos<scrollTop){this.waypoints[i].fn(this.waypoints[i].$elm);this.waypoints.splice(i,1);i --}}},resize:function(){setTimeout(function(){this._countAllPositions();this.scroll()}.bind(this),150);this._countAllPositions();this.scroll()}};$(function(){$us.scroll=new USScroll($us.scrollOptions||{})})}(jQuery)