????
| Current Path : /home2/morganrand/www/wp-content/themes/wanderfuls/framework/visual-composer/helpers/ |
| Current File : /home2/morganrand/www/wp-content/themes/wanderfuls/framework/visual-composer/helpers/inline-js.php |
<?php
/**
* Outputs inline JS for the front-end JS composer
*
* @package Wanderfuls WordPress Theme
* @subpackage VC Functions
*/
class VCEX_Inline_JS {
/**
* Class Constructor
*
* @since 2.0.0
*/
public function __construct( $scripts ) {
$this->output( $scripts );
}
/**
* Output JS
*
* @since 2.0.0
*/
private function output( $scripts ) {
// Add localize code so it can be used in inline JS
if ( function_exists( 'json_encode' ) ) {
$localize_array = TB_Theme_Setup::localize_array(); ?>
<script type='text/javascript'>
/* <![CDATA[ */var tbLocalize = <?php echo wp_json_encode( $localize_array ); ?> /* ]]> */
</script>
<?php
}
// Array of scripts
if ( is_array( $scripts ) ) {
foreach ( $scripts as $script ) {
if ( method_exists( $this, $script ) ) { ?>
<script type="text/javascript">
jQuery( function( $ ) {
<?php $this->parseData(); ?>
<?php $this->$script(); ?>
} );
</script>
<?php } ?>
<?php
}
}
// Output single script
elseif ( method_exists( $this, $scripts ) ) { ?>
<script type="text/javascript">
jQuery( function( $ ) {
<?php $this->parseData(); ?>
<?php $this->$scripts(); ?>
} );
</script>
<?php }
}
/**
* Parse Data
*
* @since 2.0.0
*/
private function parseData() { ?>
function tbParseData( val, fallback ) {
return ( typeof val !== 'undefined' ) ? val : fallback;
}
<?php }
/**
* Isotope
*
* @since 2.0.0
*/
private function isotope() { ?>
if("undefined"!=$.fn.imagesLoaded&&"undefined"!=$.fn.isotope){var self=this;$(".vcex-isotope-grid").each(function(){var t=$(this);t.imagesLoaded(function(){t.isotope({itemSelector:".vcex-isotope-entry",transformsEnabled:!0,isOriginLeft:tbLocalize.isRTL?!1:!0,transitionDuration:t.data("transition-duration")?t.data("transition-duration")+"s":"0.4s",layoutMode:t.data("layout-mode")?t.data("layout-mode"):"masonry",filter:t.data("filter")?t.data("filter"):""})});var i=t.prev("ul.vcex-filter-links");if(i.length){var a=i.find("a");a.click(function(){var i=$(this).attr("data-filter");return t.isotope({filter:i}),$(this).parents("ul").find("li").removeClass("active"),$(this).parent("li").addClass("active"),!1})}})}
<?php }
/**
* Carousels
*
* @since 2.0.0
*/
private function carousel() { ?>
"undefined"!=$.fn.owlCarousel&&$(".tb-carousel").each(function(){var e=$(this),a=e.data(),t=tbLocalize.isRTL?!0:!1,s=a.smartSpeed?a.smartSpeed:tbLocalize.carouselSpeed;e.owlCarousel({animateIn:!1,animateOut:!1,lazyLoad:!1,smartSpeed:s,rtl:t,dots:a.dots,nav:a.nav,items:a.items,slideBy:a.slideby,center:a.center,loop:a.loop,margin:a.margin,autoplay:a.autoplay,autoplayTimeout:a.autoplayTimeout,navText:['<span class="fa fa-chevron-left"><span>','<span class="fa fa-chevron-right"></span>'],responsive:{0:{items:a.itemsMobilePortrait},480:{items:a.itemsMobileLandscape},768:{items:a.itemsTablet},960:{items:a.items}}})});
<?php }
/**
* iLightbox Single Image
*
* @since 2.0.0
*/
private function ilightbox_single() { ?>
if($.fn.iLightBox!=undefined){
$(".tb-lightbox").each(function(){var e=$(this);if(!e.hasClass("tb-lightbox-group-item")){var i=e.data();e.iLightBox({skin:tbParseData(i.skin,tbLocalize.iLightbox.skin),controls:{fullscreen:tbLocalize.iLightbox.controls.fullscreen},show:{title:tbLocalize.iLightbox.show.title,speed:parseInt(tbLocalize.iLightbox.show.speed)},hide:{speed:parseInt(tbLocalize.iLightbox.hide.speed)},effects:{reposition:!0,repositionSpeed:200,switchSpeed:300,loadedFadeSpeed:tbLocalize.iLightbox.effects.loadedFadeSpeed,fadeSpeed:tbLocalize.iLightbox.effects.fadeSpeed},overlay:tbLocalize.iLightbox.overlay,social:tbLocalize.iLightbox.social})}});
}
<?php }
/**
* iLightbox Auto Detect
*
* @since 2.0.0
*/
private function ilightbox_autodetect() { ?>
if($.fn.iLightBox!=undefined){
$(".tb-lightbox-autodetect, .tb-lightbox-autodetect a").each(function(){var e=$(this),i=e.data();e.iLightBox({smartRecognition:!0,skin:tbParseData(i.skin,tbLocalize.iLightbox.skin),path:"horizontal",controls:{fullscreen:tbLocalize.iLightbox.controls.fullscreen},show:{title:tbLocalize.iLightbox.show.title,speed:parseInt(tbLocalize.iLightbox.show.speed)},hide:{speed:parseInt(tbLocalize.iLightbox.hide.speed)},effects:{reposition:!0,repositionSpeed:200,switchSpeed:300,loadedFadeSpeed:tbLocalize.iLightbox.effects.loadedFadeSpeed,fadeSpeed:tbLocalize.iLightbox.effects.fadeSpeed},overlay:tbLocalize.iLightbox.overlay,social:tbLocalize.iLightbox.social})});
}
<?php }
/**
* iLightbox
*
* @since 2.0.0
*/
private function ilightbox_custom_gallery() { ?>
if($.fn.iLightBox!=undefined){
$(".tb-lightbox-gallery").on("click",function(){var e=$(this).data("gallery").split(",");return e&&$.iLightBox(e,{skin:tbLocalize.iLightbox.skin,path:"horizontal",infinite:!0,show:{title:tbLocalize.iLightbox.show.title,speed:parseInt(tbLocalize.iLightbox.show.speed)},hide:{speed:parseInt(tbLocalize.iLightbox.hide.speed)},controls:{arrows:tbLocalize.iLightbox.controls.arrows,thumbnail:tbLocalize.iLightbox.controls.thumbnail,fullscreen:tbLocalize.iLightbox.controls.fullscreen,mousewheel:tbLocalize.iLightbox.controls.mousewheel},effects:{reposition:!0,repositionSpeed:200,switchSpeed:300,loadedFadeSpeed:tbLocalize.iLightbox.effects.loadedFadeSpeed,fadeSpeed:tbLocalize.iLightbox.effects.fadeSpeed},overlay:tbLocalize.iLightbox.overlay,social:tbLocalize.iLightbox.social}),!1});
}
<?php }
/**
* iLightbox
*
* @since 2.0.0
*/
private function ilightbox() {
// some bugs that need fixing..do nothing yet.
return; ?>
<?php }
/**
* DataHovers
*
* @since 2.0.0
*/
private function data_hover() { ?>
$(".tb-data-hover").each(function(){var o=$(this),t=$(this).css("backgroundColor"),r=$(this).css("color"),s=$(this).attr("data-hover-background"),c=$(this).attr("data-hover-color");o.hover(function(){void 0!=CSSStyleDeclaration.prototype.setProperty?(s&&this.style.setProperty("background-color",s,"important"),c&&this.style.setProperty("color",c,"important")):(s&&o.css("background-color",s),c&&o.css("color",c))},function(){void 0!=CSSStyleDeclaration.prototype.setProperty?(s&&this.style.setProperty("background-color",t,"important"),c&&this.style.setProperty("color",r,"important")):(s&&t&&o.css("background-color",t),c&&r&&o.css("color",r))})});
<?php }
/**
* Equal Height - Global
*
* @since 2.0.0
*/
private function equal_heights() { ?>
if($.fn.matchHeight!=undefined){
$( '.equal-height-column, .match-height-row .match-height-content, .vcex-feature-box-match-height .vcex-match-height, .equal-height-content, .match-height-grid .match-height-content, .blog-entry-equal-heights .blog-entry-inner, .tb-vc-row-columns-match-height .tb-vc-column-wrapper' ).matchHeight();
}
<?php }
/**
* Equal Height Content
*
* @since 2.0.0
*/
private function equal_height_content() { ?>
if($.fn.matchHeight!=undefined){
$( '.equal-height-content' ).matchHeight();
}
<?php }
/**
* Equal Height Columns
*
* @since 2.0.0
*/
private function row_equal_columns() { ?>
if($.fn.matchHeight!=undefined){
$( '.tb-vc-row-columns-match-height .tb-vc-column-wrapper' ).matchHeight();
}
$( '.tb-vc-row-reset-columns-match-height' ).find( '.tb-vc-column-wrapper' ).css( 'height', '' );
<?php }
/**
* Slider Pro
*
* @since 2.0.0
*/
private function slider_pro() { ?>
if("undefined"!=$.fn.sliderPro){
var self=this;$(".tb-slider").each(function(){var a=$(this),e=a.data();$(".tb-slider-slide, .tb-slider-thumbnails").css({opacity:1,display:"block"});var t=$(".tb-slider").prev(".tb-slider-preloaderimg"),i=t.length?t.outerHeight():null;a.sliderPro({responsive:!0,width:"100%",height:i,fade:tbParseData(e.fade,600),touchSwipe:tbParseData(e.touchSwipe,!0),fadeDuration:tbParseData(e.animationSpeed,600),slideAnimationDuration:tbParseData(e.animationSpeed,600),autoHeight:tbParseData(e.autoHeight,!0),heightAnimationDuration:tbParseData(e.heightAnimationDuration,500),arrows:tbParseData(e.arrows,!0),fadeArrows:tbParseData(e.fadeArrows,!0),autoplay:tbParseData(e.autoPlay,!0),autoplayDelay:tbParseData(e.autoPlayDelay,5e3),buttons:tbParseData(e.buttons,!0),shuffle:tbParseData(e.shuffle,!1),orientation:tbParseData(e.direction,"horizontal"),loop:tbParseData(e.loop,!1),keyboard:!1,fullScreen:tbParseData(e.fullscreen,!1),slideDistance:tbParseData(e.slideDistance,0),thumbnailHeight:tbParseData(e.thumbnailHeight,70),thumbnailWidth:tbParseData(e.thumbnailWidth,70),thumbnailPointer:tbParseData(e.thumbnailPointer,!1),updateHash:tbParseData(e.updateHash,!1),thumbnailArrows:!1,fadeThumbnailArrows:!1,thumbnailTouchSwipe:!0,fadeCaption:tbParseData(e.fadeCaption,!0),captionFadeDuration:500,waitForLayers:!0,autoScaleLayers:!0,forceSize:"none",thumbnailPosition:"bottom",reachVideoAction:"playVideo",leaveVideoAction:"pauseVideo",endVideoAction:"nextSlide",init:function(){a.prev(".tb-slider-preloaderimg").hide(),a.parent(".gallery-format-post-slider")&&$(".blog-masonry-grid").length&&setTimeout(function(){$(".blog-masonry-grid").isotope("layout")},$heightAnimationDuration+1)},gotoSlideComplete:function(){a.parent(".gallery-format-post-slider")&&$(".blog-masonry-grid").length&&$(".blog-masonry-grid").isotope("layout")}})}),$(".woo-product-entry-slider").click(function(){return!1});
}
<?php }
/**
* Skillbar
*
* @since 2.0.0
*/
private function skillbar() { ?>
$(".vcex-skillbar").each(function(){$(this).find(".vcex-skillbar-bar").animate({width:$(this).attr("data-percent")},800)});
<?php }
/**
* Skillbar
*
* @since 2.0.0
*/
private function milestone() { ?>
if($.fn.appear!=undefined&&$.fn.countTo!=undefined){
$( '.vcex-animated-milestone' ).each( function() {
$( this ).appear( function() {
$( this ).find( '.vcex-milestone-time' ).countTo( {
formatter: function ( value, options ) {
return value.toFixed(options.decimals).replace(/\B(?=(?:\d{3})+(?!\d))/g, ',');
},
} );
}, {
accX : 0,
accY : 0
} );
} );
}
<?php }
/**
* Pop-up title overlay
*
* @since 2.0.0
*/
private function overlay_popup_title() { ?>
$(".overlay-parent-title-push-up").each(function(){var t=$(this),o=t.find(".overlay-title-push-up"),s=t.find("a"),i=s.find("img"),e=o.outerHeight();t.imagesLoaded(function(){o.css({bottom:-e}),s.css({height:i.outerHeight()}),i.css({position:"absolute",top:"0",left:"0",width:"100%",height:"100%"}),t.hover(function(){i.css({top:-20}),o.css({bottom:0})},function(){i.css({top:"0"}),o.css({bottom:-e})})})});
<?php }
/**
* Parallax
*
* @since 2.0.0
*/
private function parallax() { ?>
if ( $.fn.scrolly2 != 'undefined' ) {
$( '.tb-parallax-bg' ).each( function() {
var $this = $( this );
$this.scrolly2().trigger( 'scroll' );
} );
}
<?php }
} // End Class
/**
* Helper function runs the VCEX_Inline_JS class
*
* @since 2.0.0
*/
function vcex_inline_js( $scripts ) {
if ( function_exists( 'vc_is_inline' ) && vc_is_inline() ) {
return new VCEX_Inline_Js( $scripts );
}
}