/** * * Helpme since v1 * */ (function () { 'use strict'; // Root namespace: helpme // Init in header.php // Object to hold our modules helpme.modules = {}; // We need function wrappers to trigger our modules on demand. // This is best way until we refactor whole codebase into modules so we could remove wrappers and move to AMD loading. // Some of modules are mendatory, some will be triggered with if(true) based on JSON collection and dependency map. // We don't need DOM ready as we include scripts in footer where DOM is ready already. Bind to onload with reason. // IMPORTANT TODO - try to handle modules with ES6 module import / export polyfilled with google traceur Utils(); Polyfills(); ModuleHeader(); // Polyfill older browsers helpme.utils.polyfills.initAll(); })(); ;function ModuleHeader() { // Dependency HELPME modules: // helpme.utils // Dependency JSON->DOM modules // 'theme_header', // 'helpme_header' // Dependency libraries // jQuery (function ($) { 'use strict'; helpme.modules.header = (function() { var Public = { calcHeight: calcHeight }; var $window = $(window); // // calcHeight() method // var header = helpme.utils.JSONLookup('theme_header'), vcHeader = helpme.utils.JSONLookup('helpme_header'), adminbar = 0, totalHeight = 0; function calcHeight() { if(php.hasAdminbar) { if($window.width() > 782) { adminbar = 32; } else { adminbar = 46; } } totalHeight = adminbar + (header[0] != undefined ? header[0].params.stickyHeight : 0) + (vcHeader[0] != undefined ? vcHeader[0].params.stickyHeight : 0); return Math.round(totalHeight); } return Public; })(); })(jQuery); } ;function Utils() { // Dependency HELPME modules: // Dependency PHP modules: // php.json // Dependency JSON->DOM modules // Try not to keep them here. (function () { helpme.utils = (function () { 'use strict'; var Public = { JSONLookup: JSONLookup }; // // JSONLookup() method // Searches through our global JSON collection by element name // returns array of objects matched by name // function JSONLookup(name) { var params = []; for(var i = 0, jsonLength = php.json.length; i < jsonLength; i++) { if(php.json[i].name == name) { params.push(php.json[i]); } } return params; } return Public; })(); })(); };function Polyfills() { (function () { 'use strict'; helpme.utils.polyfills = (function () { var Public = { bindPolyfill: bindPolyfill, rAFPolyfill: rAFPolyfill, initAll: function() { bindPolyfill(); rAFPolyfill(); } } function bindPolyfill() { if (!Function.prototype.bind) { Function.prototype.bind = function(oThis) { if (typeof this !== 'function') { // closest thing possible to the ECMAScript 5 // internal IsCallable function throw new TypeError('Function.prototype.bind - what is trying to be bound is not callable'); } var aArgs = Array.prototype.slice.call(arguments, 1), fToBind = this, fNOP = function() {}, fBound = function() { return fToBind.apply(this instanceof fNOP && oThis ? this : oThis, aArgs.concat(Array.prototype.slice.call(arguments))); }; fNOP.prototype = this.prototype; fBound.prototype = new fNOP(); return fBound; }; } } function rAFPolyfill() { var lastTime, vendors, x; lastTime = 0; vendors = ["webkit", "moz"]; x = 0; while (x < vendors.length && !window.requestAnimationFrame) { window.requestAnimationFrame = window[vendors[x] + "RequestAnimationFrame"]; window.cancelAnimationFrame = window[vendors[x] + "CancelAnimationFrame"] || window[vendors[x] + "CancelRequestAnimationFrame"]; ++x; } if (!window.requestAnimationFrame) { window.requestAnimationFrame = function(callback, element) { var currTime, id, timeToCall; currTime = new Date().getTime(); timeToCall = Math.max(0, 16 - (currTime - lastTime)); id = window.setTimeout(function() { callback(currTime + timeToCall); }, timeToCall); lastTime = currTime + timeToCall; return id; }; } if (!window.cancelAnimationFrame) { window.cancelAnimationFrame = function(id) { clearTimeout(id); }; } }; return Public; })(); })(); };var abb = {}; function is_touch_device() { return !!('ontouchstart' in window) || !!('onmsgesturechange' in window); } jQuery.exists = function(selector) { return (jQuery(selector).length > 0); }; jQuery.fn.hasAttr = function(name) { return this.attr(name) !== undefined; }; var BrowserDetect = { init: function () { this.browser = this.searchString(this.dataBrowser) || "Other"; this.version = this.searchVersion(navigator.userAgent) || this.searchVersion(navigator.appVersion) || "Unknown"; }, searchString: function (data) { for (var i = 0; i < data.length; i++) { var dataString = data[i].string; this.versionSearchString = data[i].subString; if (dataString.indexOf(data[i].subString) !== -1) { return data[i].identity; } } }, searchVersion: function (dataString) { var index = dataString.indexOf(this.versionSearchString); if (index === -1) { return; } var rv = dataString.indexOf("rv:"); if (this.versionSearchString === "Trident" && rv !== -1) { return parseFloat(dataString.substring(rv + 3)); } else { return parseFloat(dataString.substring(index + this.versionSearchString.length + 1)); } }, dataBrowser: [ {string: navigator.userAgent, subString: "Chrome", identity: "Chrome"}, {string: navigator.userAgent, subString: "MSIE", identity: "IE"}, {string: navigator.userAgent, subString: "Trident", identity: "IE"}, {string: navigator.userAgent, subString: "Firefox", identity: "Firefox"}, {string: navigator.userAgent, subString: "Safari", identity: "Safari"}, {string: navigator.userAgent, subString: "Opera", identity: "Opera"} ] }; BrowserDetect.init(); jQuery('html').addClass(BrowserDetect.browser).addClass(BrowserDetect.browser + BrowserDetect.version); (function($) { "use strict"; /* Gets IE version */ /* -------------------------------------------------------------------- */ function helpme_detect_ie() { var ua = window.navigator.userAgent; var msie = ua.indexOf('MSIE '); var trident = ua.indexOf('Trident/'); if (msie > 0) { return parseInt(ua.substring(msie + 5, ua.indexOf('.', msie)), 10); } if (trident > 0) { var rv = ua.indexOf('rv:'); return parseInt(ua.substring(rv + 3, ua.indexOf('.', rv)), 10); } return false; } // abb.header = function() { // var Public = { // height: height // }; // var $window = $(window); // // // // height() method // // // var headerHeight = $('#helpme-header').height(), // adminbar = 0, // totalHeight = 0; // function height() { // if(php.hasAdminbar) { // if($window.width() > 782) { // adminbar = 32; // } else { // adminbar = 46; // } // } // totalHeight = // adminbar + // headerHeight; // return Math.round(totalHeight); // conso // } // return Public; // }; ////////////////////////////////////////////////////////////////////////// // // Defining global utils and variables for cross app use // todo: move vars to utils // ////////////////////////////////////////////////////////////////////////// var scrollY = (window.pageYOffset !== undefined) ? window.pageYOffset : (document.documentElement || document.body.parentNode || document.body).scrollTop, // Updated in global event handler global_window_width = $(window).width(), global_window_height = $(window).height(), global_admin_bar, global_admin_bar_height = 0; $(window).load(function() { if ($.exists("#wpadminbar")) { global_admin_bar = $("#wpadminbar"); } }); if(php.hasAdminbar) { if($(window).width() > 782) { global_admin_bar_height = 32; } else { global_admin_bar_height = 46; } } function helpme_update_globals() { global_window_width = $(window).width(); global_window_height = $(window).height(); } window.scroll = function() { scrollY = (window.pageYOffset !== undefined) ? window.pageYOffset : (document.documentElement || document.body.parentNode || document.body).scrollTop; } abb.fullHeight = function() { var $header = $('#helpme-header'), windowHeight = $(window).height(), adminbar = global_admin_bar_height, totalHeight; var headerHeight = 0; if($header) headerHeight = $header.data('height'); if($header.hasClass('transparent-header')) headerHeight = 0; if($header.hasClass('sticky-trigger-header')) headerHeight = $header.data('sticky-height'); if($header.hasClass('header-structure-vertical')) headerHeight = 0; totalHeight = windowHeight - (adminbar + headerHeight); return totalHeight; } abb.smoothScrollTo = function(offsetTop, duration) { $('html, body').stop().animate({ scrollTop: offsetTop }, { duration: duration, easing: "easeInOutExpo" }); }; ////////////////////////////////////////////////////////////////////////// // // Global scroll handler // ////////////////////////////////////////////////////////////////////////// var animationThrottle = function(toThrottle, wait) { var lastTick = Date.now(), endTimeout = null; return function run() { if(Date.now() - lastTick > wait) { lastTick = Date.now(); clearTimeout(endTimeout); window.requestAnimationFrame(toThrottle); } else { clearTimeout(endTimeout); endTimeout = setTimeout(run, wait); } }; }; var scrollAnimations = { sets: [], init: function() { this.update(); this.attachEvents(); // console.table(this.sets); }, attachEvents: function() { window.addEventListener('scroll', animationThrottle( this.play.bind(this), 0 )); }, add: function(handler) { this.sets.push(handler); }, play: function() { this.update(); this.sets.forEach( function(animationSet) { animationSet(scrollY); }.bind(this)); }, update: function() { scrollY = (window.pageYOffset !== undefined) ? window.pageYOffset : (document.documentElement || document.body.parentNode || document.body).scrollTop; }, }; scrollAnimations.init(); var debouncedScrollAnimations = { sets: [], init: function() { this.attachEvents(); }, attachEvents: function() { window.addEventListener('scroll', animationThrottle( this.play.bind(this), 200 )); }, add: function(handler) { this.sets.push(handler); }, play: function() { this.sets.forEach( function(animationSet) { animationSet(scrollY); }.bind(this)); }, }; debouncedScrollAnimations.init(); /* Logo placement */ /* -------------------------------------------------------------------- */ /* Marge double menu */ /* -------------------------------------------------------------------- */ function helpme_double_menu() { "use strict"; var $header_1 = $('.theme-main-header'), $header_2 = $('#theme-page .vc_row').first().find('.helpme-secondary-header'), $stickyPadding = $('.sticky-header-padding'); if($header_1.length && $header_2.length) { // Merge headers if placed one under the other $header_1.append($header_2); $header_2.removeClass('sticky-header'); // Get heights values var header_1_height = $header_1.data('height'), header_1_sticky_height = $header_1.data('sticky-height'), header_2_height = $header_2.height(), header_2_sticky_height = $header_2.data('sticky-height'), stickyPaddingVal = parseInt($stickyPadding.css('padding-top').replace('px', '')); // Lets check what we have // console.log('header_1_height: ' + header_1_height); // console.log('header_1_sticky_height: ' + header_1_sticky_height); // console.log('header_2_height: ' + header_2_height); // console.log('header_2_sticky_height: ' + header_2_sticky_height); // console.log('stickyPaddingVal: ' + stickyPaddingVal); // Update height values of marged header $header_1.attr('data-height', (header_1_height + header_2_height)); $header_1.attr('data-sticky-height', (header_1_sticky_height + header_2_sticky_height)); // Update top padding $stickyPadding.css({ 'padding-top': (stickyPaddingVal + header_2_height) + 'px' }); } } helpme_double_menu(); /* Page Title Intro */ /* -------------------------------------------------------------------- */ function helpme_page_title_intro() { "use strict"; if (!is_touch_device()) { $('#helpme-page-title').each(function() { var progressVal, currentPoint, $this = $(this), parentHeight = $this.outerHeight(), $fullHeight = $this.attr('data-fullHeight'), startPoint = 0, endPoint = $this.offset().top + parentHeight, effectLayer = $this.find('.helpme-page-title-bg'), gradientLayer = $this.find('.helpme-effect-gradient-layer'), animation = $this.attr('data-intro'); var layout = function() { var $heading = $this.find('.helpme-page-heading'), $fullHeight = $this.attr('data-fullHeight'), $header_height = 0, $height = $this.attr('data-height'), page_title_full_height = 0; if ($.exists('#helpme-header.sticky-header') && !$('#helpme-header').hasClass('transparent-header')) { var $header_height = parseInt($('#helpme-header.sticky-header').attr('data-sticky-height')); } if ($fullHeight === 'true') { page_title_full_height = global_window_height - $header_height - global_admin_bar_height; } else { page_title_full_height = $height; } $this.css('height', page_title_full_height); if ($('#helpme-header').hasClass('transparent-header') && $fullHeight == 'true') { var header_height = parseInt($('#helpme-header').attr('data-height')); var padding = parseInt($this.css('padding-top')); $this.css({ 'padding' : 0 }); $heading.css({ 'padding-top' : (page_title_full_height/2 - $heading.height()/2)+'px' }); } } layout(); if ($fullHeight == 'true') { $(window).on("debouncedresize", function() { layout(); }) } if ($('#helpme-header').hasClass('transparent-header') && $fullHeight != 'true' ) { var header_height = parseInt($('#helpme-header').attr('data-height')); var padding = parseInt($this.css('padding-top')); $this.css({ 'padding-top' : (padding + header_height)+'px' }) } var parallaxSpeed = .7, zoomFactor = 1.4; if (animation == "parallax") { var set = function() { currentPoint = (startPoint + scrollY) * parallaxSpeed; effectLayer.css({ 'transform': 'translateY(' + currentPoint + 'px)' }); } set(); scrollAnimations.add(set); } if (animation == "parallaxZoomOut") { var set = function() { currentPoint = (startPoint + scrollY) * parallaxSpeed; progressVal = (1 / (endPoint - startPoint) * (scrollY - startPoint)); var zoomCalc = zoomFactor - ((zoomFactor - 1.2) * progressVal); effectLayer.css({ 'transform': 'translateY(' + currentPoint + 'px), scale(' + zoomCalc + ')' }); } set(); scrollAnimations.add(set); } if (animation == "gradient") { var set = function() { progressVal = (1 / (endPoint - startPoint) * (scrollY - startPoint)); gradientLayer.css({ opacity: progressVal * 2 }); } set(); scrollAnimations.add(set); } }); } } /* Progress Button */ /* -------------------------------------------------------------------- */ var progressButton = { loader: function(form) { var $form = form, progressBar = $form.find(".helpme-progress-button .helpme-progress-inner"), buttonText = $form.find(".helpme-progress-button .helpme-progress-button-content"), progressButton = new TimelineLite(); progressButton .to(progressBar, 0, { width: "100%", scaleX: 0, scaleY: 1 }) .to(buttonText, .3, { y: -5 }) .to(progressBar, 1.5, { scaleX: 1, ease: Power2.easeInOut }, "-=.1") .to(buttonText, .3, { y: 0 }) .to(progressBar, .3, { scaleY: 0 }); }, success: function(form) { var $form = form, buttonText = $form.find(".helpme-button .helpme-progress-button-content, .helpme-contact-button .helpme-progress-button-content"), successIcon = $form.find(".helpme-progress-button .state-success"), progressButtonSuccess = new TimelineLite({ onComplete: hideSuccessMessage }); progressButtonSuccess .to(buttonText, .3, { paddingRight: 20, ease: Power2.easeInOut }, "+=1") .to(successIcon, .3, { opacity: 1 }) .to(successIcon, 2, { opacity: 1 }); function hideSuccessMessage() { progressButtonSuccess.reverse() } }, error: function(form) { var $form = form, buttonText = $form.find(".helpme-button .helpme-progress-button-content, .helpme-contact-button .helpme-progress-button-content"), errorIcon = $form.find(".helpme-progress-button .state-error"), progressButtonError = new TimelineLite({ onComplete: hideErrorMessage }); progressButtonError .to(buttonText, .3, { paddingRight: 20 }, "+=1") .to(errorIcon, .3, { opacity: 1 }) .to(errorIcon, 2, { opacity: 1 }); function hideErrorMessage() { progressButtonError.reverse() } } } ;/* Window Scroller */ /* -------------------------------------------------------------------- */ function helpme_window_scroller() { if (!$.exists('.helpme-window-scroller')) { return false; } $('.helpme-window-scroller').each(function() { var $this = $(this), $container_h = $this.attr('data-height'), $image = $this.find('img'), $speed = parseInt($this.attr('data-speed')); $this.stop(true, true).hoverIntent(function() { $image.animate({ 'top': -($image.height() - $container_h) }, $speed); }, function() { $image.animate({ 'top': 0 }, $speed / 3); }); }); };/* Header Section Sticky function */ /* -------------------------------------------------------------------- */ function sticky_header() { var $helpme_header = $('#helpme-header').first(); if ($helpme_header.hasClass('sticky-header') && global_window_width > helpme_nav_res_width) { var header_structure = $helpme_header.attr('data-header-structure'); if(header_structure == 'vertical') { var helpme_header_height = 200; } else { var helpme_header_height = parseInt((helpme_header_padding * 2) + helpme_logo_height) + 130; } var chopScrollAnimation = function() { if (global_window_width > helpme_nav_res_width) { if (scrollY > helpme_header_height) { $helpme_header.addClass('sticky-trigger-header'); } else { $helpme_header.removeClass('sticky-trigger-header'); } } // setTimeout(function() { // helpme_main_navigation(); // }, 200); } debouncedScrollAnimations.add(chopScrollAnimation); } } function transparent_header_sticky() { var $helpme_header = $('#helpme-header'); if ($helpme_header.hasClass('transparent-header') && global_window_width > helpme_nav_res_width) { var trigger = false; var chopScrollAnimation = function() { var sharp_active = $('.helpme-sharp-slider.first-el-true').find('.swiper-slide-active').attr('data-header-skin'), header_structure = $helpme_header.attr('data-header-structure'); if(header_structure == 'vertical') { var helpme_header_height = 200; } else { var helpme_header_height = parseInt((helpme_header_padding * 2) + helpme_logo_height) + 130; } helpme_header_trans_offset = (helpme_header_trans_offset == 0) ? global_window_height : helpme_header_trans_offset; if (global_window_width > helpme_nav_res_width) { if (scrollY > helpme_header_height || trigger) { $helpme_header.addClass('header-offset-passed'); } else { $helpme_header.removeClass('header-offset-passed'); } if (scrollY > helpme_header_trans_offset || trigger) { $helpme_header.addClass('transparent-header-sticky sticky-trigger-header').removeClass('light-header-skin dark-header-skin'); } else { if (sharp_active != '' && typeof sharp_active !== 'undefined') { $helpme_header.removeClass('transparent-header-sticky sticky-trigger-header').addClass(sharp_active + '-header-skin'); } else { $helpme_header.removeClass('transparent-header-sticky sticky-trigger-header').addClass($helpme_header.attr('data-transparent-skin') + '-header-skin'); } } } // setTimeout(function() { // helpme_main_navigation(); // }, 200); } debouncedScrollAnimations.add(chopScrollAnimation); $('body').on('page_intro', function() { setTimeout(function() { trigger = true; chopScrollAnimation(); }, 1000); }); $('body').on('page_outro', function() { setTimeout(function() { trigger = false; chopScrollAnimation(); }, 500); }); } };/* Main Navigation Init */ /* -------------------------------------------------------------------- */ function helpme_main_navigation_init() { // $(".main-navigation-ul").dcMegaMenu({ // rowItems: '6', // speed: 200, // effect: 'fade', // fullWidth: true // }); "use strict"; var $body = $('body'); if (!$body.hasClass('navigation-initialised')) { $(".main-navigation-ul").MegaMenu({ type: "vertical", delay: 200 }); $('#helpme-vm-menu').dlmenu(); $body.addClass('navigation-initialised'); } } /* Main Navigation mobile mode */ /* -------------------------------------------------------------------- */ $('body').data('res-nav-appended', false); function helpme_main_navigation_functions() { if (global_window_width > helpme_nav_res_width) { $('.helpme-responsive-nav').hide(); setTimeout(function() { helpme_main_navigation_init(); // helpme_main_navigation(); }, 200); if ($('#helpme-header').attr('data-header-style') == 'transparent') { $('#helpme-header').addClass('transparent-header ' + $('#helpme-header').attr('data-transparent-skin') + '-header-skin'); } } else { $('.main-navigation-ul, .helpme-vertical-menu').each(function() { var $this = $(this), res_nav = $('.responsive-nav-container'); if(!res_nav.hasClass('res-nav-appended')) { $this.clone().attr({ "class": "helpme-responsive-nav" }).appendTo(res_nav); res_nav.addClass('res-nav-appended') } }); $('.helpme-responsive-nav > li > ul').each(function() { if(!$(this).siblings('a').find('span').length) { $(this).siblings('a').append(''); } }); $('.helpme-responsive-nav').show(); if(!$('body').data('res-nav-appended')) { $('.helpme-responsive-nav > li').stop(true).on('click', function(e) { var $this = $(this), $arrow = $this.find('.helpme-nav-arrow'); if($(e.target).hasClass('helpme-nav-arrow') || $(e.target).hasClass('helpme-nav-open')) { if ($arrow.hasClass('helpme-nav-sub-closed')) { $arrow.parent().siblings('ul').slideDown(450).end().end().removeClass('helpme-nav-sub-closed').addClass('helpme-nav-sub-opened'); } else { $arrow.parent().siblings('ul').slideUp(450).end().end().removeClass('helpme-nav-sub-opened').addClass('helpme-nav-sub-closed'); } e.preventDefault(); } }); $('body').data('res-nav-appended', true); }; if ($('#helpme-header').attr('data-header-style') == 'transparent') { $('#helpme-header').removeClass('transparent-header ' + $('#helpme-header').attr('data-transparent-skin') + '-header-skin'); } if(!$.exists('#helpme-responsive-wrap')) { var $header_height = 0; var $window_height = $(window).outerHeight(); if ($.exists('#wpadminbar')) { $header_height += $('#wpadminbar').outerHeight(); } if($.exists('.responsive-nav-container')) { $header_height += $('#helpme-header').height(); // console.log($header_height); var nav_height = $window_height - $header_height; $('.responsive-nav-container').wrap('
'); } $(window).on('resize', function() { $('#helpme-responsive-wrap').css({ 'max-height' : ($(window).height() - $header_height) + 'px' }); }); } } if (global_window_width < helpme_grid_width) { $('.main-navigation-ul .sub-container.mega, .main-navigation-ul .sub-container.mega .row').each(function() { $(this).css('width', global_window_width - 40); }); } };/* Secondary Header Scripts */ /* -------------------------------------------------------------------- */ var secondary_header_offset; function helpme_secondary_header_res() { if ($.exists('.helpme-secondary-header')) { secondary_header_offset = $('.helpme-secondary-header').offset().top; // switched from position(). We need val relative to document. // console.log(secondary_header_offset); } } function secondary_header() { var $this = $('.helpme-secondary-header'); if ($this.length) { var helpme_header = 0; if ($.exists("#helpme-header.sticky-header")) { helpme_header = parseInt($("#helpme-header.sticky-header").attr('data-sticky-height')); } if ($.exists(".helpme-header-toolbar") && $.exists('#helpme-header.sticky-header')) { helpme_header += 35; } if(!$('.helpme-secondary-header').parent().hasClass('theme-main-header')) { var dsitance_from_top = secondary_header_offset - helpme_header - global_admin_bar_height; var animationSet = function() { if (scrollY > dsitance_from_top) { $this.addClass('secondary-header-sticky').css('top', (helpme_header + global_admin_bar_height)); $('.secondary-header-space').addClass('secondary-space-sticky'); } else { $this.removeClass('secondary-header-sticky').css('top', 'auto'); $('.secondary-header-space').removeClass('secondary-space-sticky'); } } debouncedScrollAnimations.add(animationSet); } } } ; /* Retina compatible images */ /* -------------------------------------------------------------------- */ var helpme_retina = function() { return { init: function() { var pixelRatio = !!window.devicePixelRatio ? window.devicePixelRatio : 1; if (pixelRatio > 1) { $("img").each(function(idx, el) { el = $(el); if (el.attr("data-retina-src")) { el.attr("data-src-orig", el.attr("src")); el.attr("src", el.attr("data-retina-src")); } }); } } }; }(); helpme_retina.init(); ; $(window).load(function() { /* Milestone Number Shortcode */ /* -------------------------------------------------------------------- */ $('.helpme-milestone').one('inview', function(event, visible) { if (visible == true) { var el_this = $(this), stop_number = el_this.find('.milestone-number').attr('data-stop'), animation_speed = parseInt(el_this.find('.milestone-number').attr('data-speed')); $({ countNum: el_this.find('.milestone-number').text() }).animate({ countNum: stop_number }, { duration: animation_speed, step: function() { el_this.find('.milestone-number').text(Math.floor(this.countNum)); }, complete: function() { el_this.find('.milestone-number').text(this.countNum); } }); } }); /* Skill Meter and Charts */ /* -------------------------------------------------------------------- */ $('.helpme-skill-meter .progress-outer').one('inview', function(event, visible) { if (visible == true) { var $this = $(this); $this.animate({ width: $(this).attr("data-width") + '%' }, 2000); } }); $('.helpme-chart').one('inview', function(event, visible) { if (visible == true) { var $this = $(this), $parent_width = $(this).parent().width(), $chart_size = $this.attr('data-barSize'); if ($parent_width < $chart_size) { $chart_size = $parent_width; $this.css('line-height', $chart_size); $this.find('i').css({ 'line-height': $chart_size + 'px', 'font-size': ($chart_size / 3) }); } $this.easyPieChart({ animate: 1300, lineCap: 'square', lineWidth: $this.attr('data-lineWidth'), size: $chart_size, barColor: $this.attr('data-barColor'), trackColor: $this.attr('data-trackColor'), scaleColor: 'transparent', onStep: function(value) { this.$el.find('.chart-percent span').text(Math.ceil(value)); } }); } }); /* Animated Contents */ /* -------------------------------------------------------------------- */ if (is_touch_device() || global_window_width < 800) { $('body').addClass('no-transform').find('.helpme-animate-element').removeClass('helpme-animate-element'); } $('.helpme-animate-element').one('inview', function(event, visible) { if (visible == true) { $(this).addClass('helpme-in-viewport'); } }); }); ;/* Google Maps */ /* -------------------------------------------------------------------- */ function helpme_google_maps() { "use strict"; $('.helpme-gmaps').each(function() { var $this = $(this), $id = $this.attr('id'), $zoom = parseInt($this.attr('data-zoom')), $latitude = $this.attr('data-latitude'), $longitude = $this.attr('data-longitude'), $address = $this.attr('data-address'), $latitude_2 = $this.attr('data-latitude2'), $longitude_2 = $this.attr('data-longitude2'), $address_2 = $this.attr('data-address2'), $latitude_3 = $this.attr('data-latitude3'), $longitude_3 = $this.attr('data-longitude3'), $address_3 = $this.attr('data-address3'), $pin_icon = $this.attr('data-pin-icon'), $pan_control = $this.attr('data-pan-control') === "true" ? true : false, $map_type_control = $this.attr('data-map-type-control') === "true" ? true : false, $scale_control = $this.attr('data-scale-control') === "true" ? true : false, $draggable = $this.attr('data-draggable') === "true" ? true : false, $zoom_control = $this.attr('data-zoom-control') === "true" ? true : false, $modify_coloring = $this.attr('data-modify-coloring') === "true" ? true : false, $saturation = $this.attr('data-saturation'), $hue = $this.attr('data-hue'), $gamma = $this.attr('data-gamma'), $lightness = $this.attr('data-lightness'), $fullHeight = $this.attr('data-fullHeight') === "true" ? true : false, map_height, $header_height = 0, $parent = $this.parent(), $height = $parent.height(), $styles; var mapDimensions = function() { if ($.exists('#helpme-header') && !$('#helpme-header').hasClass('transparent-header')) { if($('#helpme-header').hasClass('sticky-header')) { $header_height = parseInt($('#helpme-header').attr('data-sticky-height')); } else { $header_height = parseInt($('#helpme-header').attr('data-height')); } } if ($fullHeight === true) { map_height = global_window_height - $header_height - global_admin_bar_height; } else { map_height = $height; } $parent.height(map_height); if($parent.hasClass('helpme-gmaps-parallax')){ $this.height(map_height+200); } else { $this.height(map_height); } // Reinit maps } if ($modify_coloring == true) { var $styles = [{ stylers: [{ hue: $hue }, { saturation: $saturation }, { lightness: $lightness },{ gamma: $gamma },{ featureType: "landscape.man_made", stylers: [{ visibility: "on" }] }] }]; } var map; function initialize() { var bounds = new google.maps.LatLngBounds(); var mapOptions = { zoom: $zoom, panControl: $pan_control, zoomControl: $zoom_control, mapTypeControl: $map_type_control, scaleControl: $scale_control, draggable: $draggable, scrollwheel: false, mapTypeId: google.maps.MapTypeId.ROADMAP, styles: $styles }; map = new google.maps.Map(document.getElementById($id), mapOptions); map.setTilt(45); // Multiple Markers var markers = []; var infoWindowContent = []; if ($latitude != '' && $longitude != '') { markers[0] = [$address, $latitude, $longitude]; infoWindowContent[0] = ['' + $address + '
' + $address_2 + '
' + $address_3 + '
The requested content cannot be loaded.
Please try again later.
The requested content cannot be loaded.
Please try again later.