'; }, 6000); } }, checkIosBgFix: function() { var pattern = /iPad|iPhone|iPod/; var iOS = pattern.test(navigator.platform); if(iOS) { var elements = base.getBySelector('.bg-fixed'); if(elements) { var length = elements.length; elements = (length)? elements : [elements]; for(var i = 0, maxLength = elements.length; i < maxLength; i++) { var element = elements[i]; base.addClass(element, 'ios-bg-fixed'); } } } } }) ); var lazyLoader; function setupLazyLoader() { return (lazyLoader = new LazyAnimator()); } window.checkLazyLoader = function() { if(lazyLoader) { lazyLoader.update(); } }; app.addModule(Module.extend( { setup: function() { this.setupLazyAnimations(); }, setupLazyAnimations: function() { this.lazyLoader = setupLazyLoader(); } }) ); app.addModule(Module.extend( { setup: function() { this.addVideos(); this.addDemos(); this.addMeeting(); }, foreach: function(attrName, callBack) { var elements = this.getByAttr(attrName); if(elements) { for(var i = 0, maxLength = elements.length; i < maxLength; i++) { var element = elements[i]; callBack.call(this, i, element); } } }, addVideos: function(attrName) { attrName = attrName || 'data-video'; this.foreach(attrName, function(index, element) { var src = base.attr(element, 'data-src'); if(src) { var title = base.attr(element, 'data-title'); var callBack = base.createCallBack(this, this.viewVideo, [title, src]); base.on('click', element, callBack); if(base.attr(element, 'data-autoplay')) { this.viewVideo(title, src); } } }); }, viewVideo: function(title, src) { var vid = { title: title, source: src }; var panel = new VideoModal(vid, '', document.body); panel.setup(); panel.display(); }, addDemos: function(attrName) { attrName = attrName || 'data-demo-request'; var callBack = base.bind(this, this.requestDemo); this.foreach(attrName, function(index, element) { base.on('click', element, callBack); }); }, requestDemo: function() { var location = app.location; var panel = new DemoRequestModal(location,'', document.body); panel.setup(); panel.display(); }, addMeeting: function(attrName) { attrName = attrName || 'data-join-me'; var self = this; this.foreach(attrName, function(index, element) { var type = base.data(element, 'data-type') || 'goto'; base.on('click', element, function(e) { if(e) { base.preventDefault(e); } self.createJoinMePanel(type); }); }); }, createJoinMePanel: function(type) { var panel = new JoinMeModal(type); panel.setup(); panel.display(); }, addBenefits: function(attrName) { attrName = attrName || 'data-benefits'; var callBack = base.bind(this, this.createBenefitsPanel); this.foreach(attrName, function(index, element) { base.on('click', element, callBack); }); }, createBenefitsPanel: function(e) { var panel = new BenefitsModal(); panel.setup(); panel.display(); } }) ); var TopButton = base.Component.extend( { getLayout: function() { return { node: 'button', className: 'bttn scroll-to-top', click: base.bind(this, this.scroll) }; }, scroll: function() { function scrollTop(element) { base.addAnimation({ duration: 200, element: element, property: 'scrollTop', endValue: 0 }); } scrollTop(document.body); scrollTop(document.documentElement); } }); var scrollTopModules = []; window.addScrollModule = function(module) { scrollTopModules.push(module); }; window.removeScrollModule = function(module) { var index = base.inArray(scrollTopModules, module); if(index > -1) { scrollTopModules.splice(index, 1); } }; var requestAnimationFrame = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.msRequestAnimationFrame || window.oRequestAnimationFrame || function(callback){ setTimeout(callback, 0) }; app.addModule(Module.extend( { setup: function() { this.modules = scrollTopModules; this.addEvents(); this.checkScroll(); }, ticking: false, scroll: function(e) { if(!this.ticking) { var self = this; requestAnimationFrame(function() { self.checkScroll(e); self.ticking = false; }); this.ticking = true; } }, addEvents: function() { var self = this; base.on(['scroll', 'resize'], window, function(e) { self.scroll(e); }); }, updateModules: function(scrollTop) { var modules = this.modules; for(var i = 0, length = modules.length; i < length; i++) { var module = modules[i]; module.check(scrollTop); } }, checkScroll: function() { var scrollTop = window.scrollY; this.updateModules(scrollTop); } }) ); var ScrollModule = window.scrollModule = base.Class.extend( { check: function(scrollTop) { }, mobileSize: 840, isMobile: function() { var windowWidth = base.getWindowWidth(); if(typeof windowWidth !== 'undefined') { return (windowWidth > this.mobileSize)? false : true; } return false; } }); var ScrollHeader = ScrollModule.extend( { distance: 15, headerStyled: false, constructor: function(header, headerStyle) { ScrollModule.call(this); this.header = header; this.headerStyle = headerStyle || ''; }, check: function(scrollTop) { var headerDistance = this.distance, header = this.header; if(header) { if(scrollTop >= headerDistance && this.headerStyled === false) { base.addClass(header, 'overlay'); this.headerStyled = true; } else if(scrollTop < headerDistance && this.headerStyled !== false) { base.removeClass(header, 'overlay'); this.headerStyled = false; } } } }); var header = document.getElementById('main-header'); window.addScrollModule(new ScrollHeader(header, 'minimized')); var TopScroll = ScrollModule.extend( { distance: 300, constructor: function() { ScrollModule.call(this); this.createButton(); this.check(); }, createButton: function() { var button = this.button = new TopButton(document.body); button.setup(); }, buttonVisible: false, check: function(scrollTop) { var button = this.button.panel, isMobile = this.isMobile(); if(typeof button === 'undefined') { return true; } if(isMobile) { if(this.buttonVisible === true) { this.buttonVisible = false; base.animate.out(button, 'fadeOut', 800); } } else { if(scrollTop >= this.distance) { if(this.buttonVisible === false) { base.animate._in(button, 'fadeInSlow', 2000); this.buttonVisible = true; } } else { if(this.buttonVisible === true) { this.buttonVisible = false; base.animate.out(button, 'fadeOut', 800); } } } } }); window.addScrollModule(new TopScroll()); })(app); "use strict"; var Modal = base.Component.extend( { constructor: function(container) { base.Component.call(this, container); }, mainPanelClass: '', getLayout: function() { return { className: 'modal ' + this.mainPanelClass, header: this.addHeader(), body: this.addBody(), footer: this.addFooter() }; }, addHeader: function() { return { className: 'title-container', title: { className: 'title title-text left dark', textContent: this.getTitle() } }; }, getTitle: function() { return ''; }, addBody: function() { return this.cache('mainContainer', { className: 'body-container', content: this.addBodyContent() }); }, addBodyContent: function() { return { }; }, addFooter: function() { return { className: 'button-container', children: this.addFooterButtons() }; }, addFooterButton: function(label, className, callBack) { return { node: 'button', textContent: label, className: 'bttn ' + className, click: callBack }; }, addFooterButtons: function() { return [ this.addFooterButton('Close', 'bttn-decline', base.bind(this, this.decline)) ]; }, addRow: function(label, model, prop, validate) { var layout = { className: 'list-row light left' }; if(this.usePlaceholders !== true) { layout.label = { node: 'label', textContent: label }; label = ''; } layout.field = this.addInput(label, 'text', model, prop, validate); return layout; }, addInput: function(placeholder, type, model, prop, validate) { var className = (validate == true)? 'val' : ''; var layout = { node: 'input', type: type, className: className }; if(this.usePlaceholders && placeholder) { layout.placeholder = placeholder; } if(model) { this.bindLayout(layout, model, prop); } return layout; }, bindLayout: function(layout, model, prop) { var id = this.getId(base.uncamelCase(prop, '-')); layout.id = id; layout.bind = this.bind(model, prop); }, confirmAction: function() { var settings = this.validate(); if(settings.status === true) { var mpalert = new Alert('confirm', 'Confirm Action', 'Do you want to submit this request?', base.bind(this, this.accept)); mpalert.start(); } else { var mpalert = new Alert('alert', 'Error', 'The following corrections need to be made before saving.
' + settings.message); mpalert.start(); } }, validateForm: function() { var id = this.id; var form = this.form; if(form) { return base.formValidator.validateForm(form, id); } return false; }, validate: function() { var response = { status: true, message: '', error: 'no' }; var result = this.validateForm(); if(result && result.number !== 0) { response.status = false; response.message = result.message; } return response; }, returnCallBack: function(data) { var callBack = this.callBackFn; if(typeof this.callBackFn === 'function') { callBack(data); } }, removeAndCallBack: function(data) { this.returnCallBack(data); window.setTimeout(base.bind(this, this.display), 200); }, accept: function() { this.removeAndCallBack(); }, decline: function() { this.display(); }, display: function() { this.toggleDisplay(); }, backdropClassName: '', addBackdrop: function() { var callBack = base.bind(this, this.decline); var backdrop = this.backdrop = new BackdropPanel(this.backdropClassName, callBack, this.container); backdrop.setup(); }, toggleMode: 'none', toggleDisplay: function() { var obj = this.panel, display = obj.style.display; if(!display || display === 'none') { obj.style.display = 'block'; this.toggleMode = 'block'; this.addBackdrop(); } else { obj.style.display = 'none'; this.toggleMode = 'none'; this.backdrop.destroy(); this.destroy(); } } }); "use strict"; var JoinMeModal = Modal.extend( { constructor: function(type, callBackFn) { Modal.call(this, document.body); this.response = null; this.type = type; this.callBackFn = callBackFn; }, setup: function() { this.initialize(); this.meetingNumber.focus(); }, getLayout: function() { return { className: 'alert join-me-panel floatDownZ', header: this.addHeader(), body: this.addBody(), footer: this.addFooter() }; }, addHeader: function() { return { node: 'header', className: 'title-container', h2: { className: 'title left dark title-text', textContent: 'Join a ' + (this.getTypeLabel()) + ' Meeting' } }; }, addBody: function() { var callBack = base.bind(this, this.formatNumber); return { className: 'description center dark', groupPanel: { className: 'group-panel', row: { className: 'dark', label: { node: 'label', className: 'right', textContent: '9 Digit Code' }, field: this.cache('meetingNumber', { node: 'input', type: 'text', className: 'center', textContent: '9 Digit Code', keyup: callBack, blur: callBack }) } } }; }, addFooter: function() { var self = this; return { node: 'footer', className: 'buttons', align: { className: 'button-group', children: [ this.addFooterButton('Cancel', 'bttn-decline', function(){self.changeResponse(false);}), this.addFooterButton('Submit', 'bttn-approve', function(){self.changeResponse(true);}) ] } }; }, getResponse: function() { return this.response; }, updateResponse: function(tmpResponse) { this.response = tmpResponse; }, changeResponse: function(tmpResponse) { this.updateResponse(tmpResponse); if(this.response == true) { this.checkMeetingNumber(); } else { this.decline(); } }, checkResponse: function() { return this.response; }, toggleDisplay: function() { var obj = this.panel, display = obj.style.display; if(!display || display === 'none') { obj.style.display = 'table'; this.toggleMode = 'block'; this.addBackdrop(); } else { obj.style.display = 'none'; this.toggleMode = 'none'; this.backdrop.destroy(); this.destroy(); } }, formatNumber: function() { var obj = this.meetingNumber; var number = obj.value; var pattern = /\D/g; var filtered = number.replace(pattern, ''); var num = ''; for(var i = 0, maxLength = filtered.length; i < maxLength; i++) { if(i % 3 == 0 && i != 0) { num += '-'; } num += filtered[i]; } obj.value = num; }, getTypeLabel: function() { return (this.type === 'join-me')? 'Join Me' : 'GoTo'; }, checkMeetingNumber: function() { var meetingNumber = this.meetingNumber; var pattern = /[^0-9]/g; meetingNumber = meetingNumber.value.replace(pattern, ''); var label = this.getTypeLabel(); if(meetingNumber.length > 9) { var mpalert = new Alert('alert', label + ' Meeting Error', 'The meeting number is too long. Please check the number and try again.'); mpalert.start(); } else if(meetingNumber.length < 9) { var mpalert = new Alert('alert', label + ' Meeting Error', 'The meeting number is too short. Please check the number and try again.'); mpalert.start(); } else { this.accept(meetingNumber); } }, accept: function(meetingNumber) { if(typeof meetingNumber !== 'undefined') { var link = (this.type === 'join-me')? 'https://join.me/' : 'https://global.gotomeeting.com/join/'; window.open(link + meetingNumber, '_new'); this.removeAndCallBack(); } else { var mpalert = new Alert('alert', this.getTypeLabel() + ' Meeting Error', 'No meeting number was submitted'); mpalert.start(); } }, decline: function() { this.display(); } }); "use strict"; var VideoModal = Modal.extend( { constructor: function(video, callBackFn, container) { Modal.call(this, container); this.callBackFn = callBackFn; this.video = video; this.delayClose = false; }, mainPanelClass: 'video-panel', getTitle: function() { return base.getValue(this.video, 'title'); }, addBodyContent: function() { return this.addIframe(); }, addIframe: function() { return this.cache('iframeEle', { node: 'iframe', src: this.video.source, width: '100%', height: '100%', frameBorder: '0', allow: 'autoplay' }); }, addFooterButton: function(label, className, callBack) { return { node: 'button', innerHTML: label, className: 'bttn close ' + className, click: callBack }; }, addFooterButtons: function() { return [ this.addFooterButton('', 'bttn-decline', base.bind(this, this.decline)) ]; }, backdropClassName: 'video-shadow', toggleDisplay: function() { var obj = this.panel, display = obj.style.display; if(!display || display === 'none') { obj.style.display = 'block'; this.toggleMode = 'block'; this.addBackdrop(); } else { this.returnCallBack(); if(this.delayClose !== true) { obj.style.display = 'none'; this.toggleMode = 'none'; this.backdrop.destroy(); this.destroy(); } } } }); "use strict"; var LeadModel = base.Model.extend({ url: '/api/lead', xhr: { objectType: 'lead', getDefaultParams: function() { return ""; }, upload: function(instanceParams, callBack) { var params = 'op=upload'; return this.request(params, instanceParams, callBack); }, deleteAll: function(instanceParams, callBack) { var params = 'op=deleteAll'; return this.request(params, instanceParams, callBack); }, claim: function(instanceParams, callBack) { var id = this.model.get('id'); var params = 'op=claim' + '&id=' + id; return this.request(params, instanceParams, callBack); }, requestQuote: function(instanceParams, callBack) { var id = this.model.get('id'); var params = 'op=requestQuote' + '&id=' + id; return this.request(params, instanceParams, callBack); }, search: function(instanceParams, callBack) { var params = 'op=search'; return this.request(params, instanceParams, callBack); }, all: function(callBack, filter, start, count, source) { filter = filter || ''; start = !isNaN(start) ? start : 0; count = !isNaN(count) ? count : 50; var params = 'op=all' + '&filter=' + filter + '&start=' + start + '&stop=' + count + '&source=' + source; return this.request(params, '', callBack); } } }); "use strict"; var DemoRequestModal = Modal.extend( { constructor: function(origin, callBack, container) { Modal.call(this, container); this.model = new LeadModel(); this.origin = origin; this.callBackFn = callBack; }, mainPanelClass: 'demo-request', getTitle: function() { return 'Sign Up Request'; }, addBodyContent: function() { return this.addMainForm(); }, addMainForm: function() { return this.cache('form', { node: 'form', method: 'POST', autocomplete: 'off', novalidate: true, h1: { node: 'h1', textContent: 'We get it. Commitments aren’t easy.' }, p: { node: 'p', textContent: 'That’s why we have a performance guarantee!' }, body: this.addFormContent() }); }, addFooterButtons: function() { return [ this.addFooterButton('Close', 'bttn-decline', base.bind(this, this.decline)), this.addFooterButton('Submit', 'bttn-gradient', base.bind(this, this.confirmAction)) ]; }, addFormContent: function() { var model = this.model; return { className: 'content', children: [ { node: 'h4', textContent: 'Contact Info' }, this.addRow('First Name*', model, 'firstName', true), this.addRow('Last Name*', model, 'lastName', true), this.addRow('Company*', model, 'company', true), this.addRow('Email*', model, 'email', true), this.addRow('Phone*', model, 'phone', true) ] }; }, confirmAction: function() { var settings = this.validate(); if(settings.status === true) { var mpalert = new Alert('confirm', 'Confirm Action', 'Do you want to submit this request?', base.bind(this, this.accept)); mpalert.start(); } else { var mpalert = new Alert('alert', 'Error', 'The following corrections need to be made before saving.
' + settings.message); mpalert.start(); } }, accept: function() { this.request(); }, resetForm: function() { var form = this.form; if (form) { form.reset(); } }, updateModel: function() { var model = this.model; if(app && app.tracker) { model.set('referrer', app.tracker.getReferrer()); } model.set('name', model.get('lastName') + ', ' + model.get('firstName')); model.set('origin', this.origin); }, request: function() { this.updateModel(); var model = this.model; model.xhr.add('', base.bind(this, this.requestResponse)); }, requestResponse: function(response) { if(response) { var result = response; if (result.error === 'no') { var mpalert = new Alert('alert', 'Request Sent', 'Your request has been sent. You will be contacted shortly. ' + result.message); mpalert.start(); if(app && app.tracker) { app.tracker.clear(); } this.resetForm(); this.removeAndCallBack(); } else { var mpalert = new Alert('alert', 'Error', 'There was an error adding the request. ' + result.message); mpalert.start(); } } }, decline: function() { this.display(); }, display: function() { this.toggleDisplay(); } }); "use strict"; var Data = { storage: null, setup: function() { this.supported = this.checkSupport(); if(this.isSupported() === true) { this.storage = window.localStorage; } return this; }, supported: false, isSupported: function() { return this.supported; }, checkSupport: function() { if(typeof window.Storage !== "undefined" && window.localStorage) { return true; } return false; }, get: function(key) { if(this.isSupported() === true) { var value = this.storage.getItem(key); if(typeof value !== 'undefined') { return JSON.parse(value); } } return null; }, set: function(key, value) { if(this.isSupported() === true) { value = JSON.stringify(value); this.storage.setItem(key, value); } }, clear: function() { if(this.isSupported() === true) { this.storage.clear(); } } }.setup(); "use strict"; var BackdropPanel = base.Component.extend( { constructor: function(className, callBackFn, container) { base.Component.call(this, container); this.className = className; this.callBackFn = callBackFn; }, getLayout: function() { return { className: 'panel-shadow modal-shadow fadeIn ' + this.className, click: this.callBackFn }; }, setup: function() { this.render(); } }); "use strict"; var Alert = base.Component.extend( { constructor: function(type, title, description, callback, tmpArgArray) { base.Component.call(this, document.body); this.type = type; this.title = title; this.description = description; this.response = null; this.callback = callback; this.arg = tmpArgArray; this.returnDecline = false; }, getLayout: function() { return { className: 'alert floatDownZ', header: this.addHeader(), body: this.addBody(), footer: this.addFooter() }; }, addHeader: function() { return this.cache('titleContainer', { node: 'header', className: 'title-container', title: { className: 'title left dark', innerHTML: this.title } }); }, addBody: function() { return { className: 'description center dark', text: { node: 'p', innerHTML: this.description } }; }, addFooter: function() { return { node: 'footer', className: 'button-container', buttons: this.addButtons() }; }, addFooterButton: function(label, className, callBack) { return { node: 'button', className: className, textContent: label, click: callBack || '' }; }, addButtons: function() { var layout = { className: 'button-group', buttons: [] }; var buttons = layout.buttons; var self = this; var callBackAccept = function(){self.changeResponse(true);}; var callBackDecline = function(){self.changeResponse(false);}; switch(this.type) { case 'alert': buttons.push( this.cache('button', this.addFooterButton('OK', 'bttn', callBackAccept)) ); break; case 'confirm': buttons.push(this.addFooterButton('No', 'bttn-decline', callBackDecline)); buttons.push( this.cache('button', this.addFooterButton('Yes', 'bttn-approve', callBackAccept)) ); break; case 'confirm-cancel': buttons.push(this.addFooterButton('Cancel', 'bttn', function(){self.cancel();})); buttons.push(this.addFooterButton('No', 'bttn-decline', callBackDecline)); buttons.push( this.cache('button', this.addFooterButton('Yes', 'bttn-approve', callBackAccept)) ); break; } return layout; }, setup: function() { this.createShadow(); this.initialize(); this.button.focus(); }, start: function() { this.setup(); }, createShadow: function() { this.shadow = this.addButton('div', this.id + '_shadow', 'alert-shadow fadeIn', '', base.bind(this, this.declineByShadow), this.container); }, declineByShadow: function() { if(this.type !== 'confirm-cancel') { this.decline(); } else { this.stop(); } }, destroy: function() { this.remove(); var panel = this.shadow; if(panel) { this.removeElement(panel); } }, stop: function() { this.destroy(); }, getResponse: function() { return this.response; }, updateResponse: function(tmpResponse) { this.response = tmpResponse; }, changeResponse: function(tmpResponse) { this.updateResponse(tmpResponse); if(this.response == true) { this.accept(); } else { this.decline(); } }, checkResponse: function() { return this.response; }, makeCallBack: function(response) { var callBack = this.callback; if(typeof callBack === 'function') { var args = this.arg; if(args) { callBack(response, args.valueOf()); } else { callBack(response); } } }, accept: function() { this.makeCallBack(true); this.stop(); }, decline: function() { if(this.returnDecline) { this.makeCallBack(false); } this.stop(); }, cancel: function() { this.stop(); } }); "use strict"; var Tracker = base.Class.extend( { constructor: function(data) { this.data = data; this.setup(); }, setup: function() { this.validate(); }, validate: function() { var referrer = false; var hash = window.location.hash; if(hash) { var parse = this.parse(hash); if(parse) { referrer = parse['referrer'] || false; if(referrer !== false) { this.set('referrer', referrer); } } } }, set: function(key, value) { this.data.set(key, value); }, get: function(key) { return this.data.get(key); }, clear: function() { return this.data.clear(); }, parse: function(str) { var objURL = {}; if(str) { var regExp = /([^?=]+)(=([^&]*))?/g; str.replace(regExp, function(a, b, c, d) { objURL[b] = d; }); } return (base.isEmpty(objURL) === false) ? objURL : false; }, getReferrer: function() { return this.get('referrer'); }, check: function(url) { return true; } }); "use strict"; var requestAnimationFrame = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.msRequestAnimationFrame || window.oRequestAnimationFrame || function(callback){ setTimeout(callback, 0) }; var LazyAnimator = base.Class.extend( { constructor: function(attrName) { this.attrName = (typeof attrName === 'string')? attrName : 'data-animate'; this.size = {width: 0, height: 0}; this.cacheElements = true; this.options = []; this.setup(); }, setup: function() { this.setupEvents(); this.update(); return this; }, resize: function() { this.size = base.getWindowSize(); this.updateOptionPositions(); }, isMobile: function() { return (this.phoneSize >= this.size.width); }, update: function() { this.getElements(); this.resize(); this.checkScroll(); return this; }, updatePosition: function(option) { var element = option.element; option.position = base.position(element, 0); option.size = base.getSize(element); }, updateOptionPositions: function() { var options = this.options, length = options.length; for(var i = 0; i < length; i++) { this.updatePosition(options[i]); } }, getElements: function() { var elements; try { elements = document.querySelectorAll('[' + this.attrName + ']:not(.animated)'); } catch(e){} if(elements) { return this.addOptions(Array.prototype.slice.call(elements)); } return []; }, addOptions: function(elements) { var length = elements.length; if(length) { var element; for(var i = 0; i < length; i++) { element = elements[i]; this.addOption(element); } } return this.options; }, addOption: function(element) { var animation = base.attr(element, this.attrName); animation = animation || 'pullUp'; var delay, timer = 0; var parts = animation.split(';'); if(parts.length > 1) { animation = parts[0]; delay = parseInt(parts[1]); timer = parseInt(parts[2]); } else { delay = parseInt(base.data(element, 'delay')); } var option = { element: element, position: {x: 0, y: 0}, size: {width: 0, height: 0}, delay: delay, animation: animation, timer: timer }; this.updatePosition(option); this.options.push(option); }, removeOption: function(option) { var options = this.options; var index = base.inArray(options, option); if(index > -1) { options.splice(index, 1); } return this; }, checkScroll: function(e) { var options = (this.cacheElements === true)? this.options : this.getElements(); var length = options.length; if(length > 0) { options = options.slice(0); var viewPortSize = this.size; var viewPortTop = (window.pageYOffset || window.scrollY || 0); var viewPortBottom = viewPortSize.height + viewPortTop; var isMobile = this.isMobile(); var option, element, delay, positionY, optionTop, optionBottom; for(var i = 0; i < length; i++) { option = options[i]; element = option.element; if(element) { delay = option.delay || 20; positionY = option.position.y; optionTop = positionY + delay; optionBottom = positionY + option.size.height; var timer = (!isMobile)? option.timer : 0; if(optionTop < viewPortBottom && optionTop >= viewPortTop) { this.animate(option, timer); } else if(optionBottom >= viewPortTop && optionBottom <= viewPortBottom) { this.animate(option, timer); } } } } return this; }, phoneSize: 600, animate: function(option, timer) { timer = timer || 0; var element = option.element; var animation = option.animation; window.setTimeout(function() { base.addClass(element, animation) .addClass(element, 'animated'); }, timer); this.removeOption(option); return this; }, ticking: false, scroll: function(e) { if(!this.ticking) { var self = this; requestAnimationFrame(function() { self.checkScroll(e); self.ticking = false; }); this.ticking = true; } }, setupEvents: function() { var callBack = this.callBack = base.bind(this, this.checkScroll); var scrollCallBack = base.bind(this, this.scroll); var resizeCallBack = base.bind(this, this.resize); var w = window; var params = false; this.addEvents = function() { base.on('scroll', w, scrollCallBack, params); base.on('resize', w, resizeCallBack); }; this.removeEvents = function() { base.off('scroll', w, scrollCallBack, params); base.off('resize', w, resizeCallBack); }; this.addEvents(); return this; } }); "use strict"; (function(app) { app.addModule(Module.extend( { setup: function() { this.setupTest(); this.etupCaseStudiesController(); this.etupReviewController(); this.setupBannerController(); }, setupTest: function() { var test = document.getElementById('test-site'); base.on('submit', test, base.bind(this, this.submitToTest)); var field = document.getElementById('test_url'); base.on('keyup', field, base.bind(this, this.keyup), true); }, keyup: function(e) { e = e || window.event; var field = document.getElementById('test_url'), url = field.value; var keyCode = e.keyCode || e.charCode; if(keyCode === 13) { if(url.substring(0, 4) !== 'http') { field.value = 'http://' + url; this.submitToTest(e); } } }, submitToTest: function(e) { e = e || window.event; base.preventDefault(e); var url = document.getElementById('test_url').value; if(url) { url = (url.substring(0, 4) !== 'http')? 'http://' + url : url; window.location = '/test-my-site?url=' + encodeURI(url); } else { var panel = new Alert('alert', 'Error', 'Please check the url'); panel.start(); } }, etupCaseStudiesController: function() { var container = document.getElementById('case-study'); this.caseStudies = new CaseStudyController(container); this.caseStudies.setup(); }, etupReviewController: function() { var reviewsContainer = document.getElementById('review-slides'); this.reviewSlide = new ReviewSlideController(reviewsContainer); this.reviewSlide.setup(); }, setupBannerController: function() { var bannerContainer = document.getElementById('slides'); this.bannerSlide = new BannerSlideController(bannerContainer); this.bannerSlide.setup(); } }) ); })(app); "use strict"; var CaseStudySlide = base.Component.extend( { constructor: function(settings, container) { base.Component.call(this, container); if(!settings) { return this; } this.fullName = settings.fullName; this.review = settings.review; this.cols = settings.cols || []; this.src = settings.src; this.videoUrl = settings.videoUrl; }, getLayout: function() { return { className: 'row case-study single-slide', colText: { className: 'col-1-2-large', h2: { node: 'h2', text: this.fullName }, p: { node: 'p', className: 'review', text: this.review }, wrap: { node: 'p', className: 'button-wrap', a: { node: 'a', href: '/case-studies', className: 'bttn', text: 'View Case Studies' } }, details: { className: 'row', children: this.addCols() } }, colImage: this.addImage(this.src, this.videoUrl) }; }, addCols: function() { var layout = []; var cols = this.cols; if(cols.length) { for(var i = 0, length = cols.length; i < length; i++) { var col = cols[i]; layout.push(this.addDetail(col[1], col[0])); } } return layout; }, addDetail: function(label, value) { return { className: 'col-1-3-medium', span: { node: 'span', className: 'gray-number', image: { node: 'img', src: '/images/gray-arrow.png', alt: 'Up Arrow' }, value: { node: 'text', textContent: value } }, label: { node: 'p', text: label } }; }, addImage: function(src, videoUrl) { var layout = { className: 'col-1-2-large text-center', a: { node: 'a', className: 'svg-container shadow fadeIn', image: { node: 'picture', innerHTML: src } } }; if(videoUrl) { var a = layout.a; a.click = function() { var vid = { title: '', source: videoUrl }; var panel = new VideoModal(vid, '', document.body); panel.setup(); panel.display(); }; a.play = { node: 'img', className: 'play-button', src: '/images/play-button.svg', alt: 'Play button' }; } return layout; }, activeClass: 'showing', unselect: function() { var element = this.panel; base.removeClass(element, this.activeClass); }, select: function(number) { var element = this.panel; base.addClass(element, this.activeClass); } }); var CaseStudyController = base.Component.extend( { beforeSetup: function() { this.slides = []; this.currentSlide = 0; this.playing = false; this.timer = null; }, getLayout: function() { return { className: 'container slide-container', children: [ this.addCase({ fullName: 'Dr. Ron Hauptman', review: '"BP understood the concept I wanted to convey on my website. ... How much more customized could you get?"', cols: [ this.addColData('1,098', 'Appointment Requests'), this.addColData('125%', 'First-Year Reviews'), this.addColData('1,320%', 'First Year ROI with BP'), ], src: '
', videoUrl: '//player.vimeo.com/video/180966334?color=ffffff&title=0&byline=0&portrait=0&autoplay=true' }), this.addCase({ fullName: 'Dr. Liang', review: '"If I have Business Promotion with a big team... rather than one single person, then I think it will be a lot more effective for my practice."', cols: [ this.addColData('559%', 'First-Year Page Views'), this.addColData('388%', 'First-Year Site Visitors'), this.addColData('862%', 'First Year ROI with BP'), ], src: '
', videoUrl: '//player.vimeo.com/video/194749686?color=ffffff&title=0&byline=0&portrait=0&autoplay=true' }), this.addCase({ fullName: 'Dr. Majors', review: '"For the past 10 years we have actually searched out the very best in this field, and finally, I feel like we have found the very best in the whole dental/medical industry that there is."', cols: [ this.addColData('56', 'Online Reviews'), this.addColData('108%', 'First-Year Site Visitors'), this.addColData('$2,805,035', 'New Patient Revenue'), ], src: '
', videoUrl: '//player.vimeo.com/video/154122229?color=ffffff&title=0&byline=0&portrait=0&autoplay=true' }), this.addCase({ fullName: 'Dr. Blackhurst', review: '"What an amazing product! I love my website, and all the other marketing services they provide."', cols: [ this.addColData('552', 'First-Year Appointment Requests'), this.addColData('345%', 'First-Year Site Visitors'), this.addColData('$322,613', 'New Patient Revenue'), ], src: '
' }), this.addCase({ fullName: 'Copper Cove Pediatric Dentistry', review: '"Everyone we have worked with is very detailed oriented and they work hard to create a website that you are happy with."', cols: [ this.addColData('1,027', 'First-Year Appointment Requests'), this.addColData('168', 'Online Reviews'), this.addColData('$720,792', 'New Patient Revenue'), ], src: '
' }), this.addCase({ fullName: 'Dr. Lowe', review: '"They have been great offering a product that fits our needs, communicating well through the process and keeping on top of deadlines!"', cols: [ this.addColData('70', 'First-Year Appointment Requests'), this.addColData('106', 'Online Reviews'), this.addColData('875%', 'First-Year ROI With BP'), ], src: '
' }), { className: 'slide-controls', children: [ this.cache('pauseButton', this.addButton('pause', 'Pause', this.togglePlay)), this.addButton('previous', '', this.previousSlide), this.addButton('next', '', this.nextSlide) ] } ] }; }, addColData: function(value, label) { label = label || 'Appointment Requests'; return [ value, label ]; }, addButton: function(id, label, callBack) { return { node: 'button', className: 'bttn controls', id: id, textContent: label, click: base.bind(this, callBack) }; }, afterSetup: function() { this.selectSlide(this.currentSlide); }, addCase: function(settings) { var self = this; return this.addChild(CaseStudySlide, [settings], null, function(component) { self.slides.push(component); }); }, togglePlay: function() { if(this.playing) { this.pause(); } else { this.play(); } }, nextSlide: function() { this.goToSlide(this.currentSlide + 1); }, previousSlide: function() { this.goToSlide(this.currentSlide - 1); }, goToSlide: function(number) { var slides = this.slides; var currentSlide = ((number + slides.length) % slides.length); this.selectSlide(currentSlide); }, unselectPrevious: function() { var previous = this.slides[this.currentSlide]; if(previous) { previous.unselect(); } }, selectSlide: function(number) { this.unselectPrevious(); var slide = this.slides[number]; if(slide) { this.currentSlide = number; slide.select(); } this.play(); }, play: function() { this.pause(); this.pauseButton.innerHTML = 'Pause'; this.playing = true; this.timer = window.setInterval(base.bind(this, this.nextSlide), 10000); }, pause: function() { this.pauseButton.innerHTML = 'Play'; this.playing = false; window.clearInterval(this.timer); } }); "use strict"; var ReviewSlide = base.Component.extend( { constructor: function(fullName, reveiw, container) { base.Component.call(this, container); this.fullName = fullName; this.review = reveiw; }, getLayout: function() { return { className: 'single-review single-slide', children: [ { node: 'img', src: '/images/pages/home/stars.png', alt: 'Five stars', className: 'stars' }, { node: 'h3', textContent: this.fullName }, { node: 'blockquote', textContent: this.review } ] }; }, activeClass: 'showing', unselect: function() { var element = this.panel; base.removeClass(element, this.activeClass); }, select: function(number) { var element = this.panel; base.addClass(element, this.activeClass); } }); var ReviewSlideController = base.Component.extend( { beforeSetup: function() { this.slides = []; this.currentSlide = 0; this.playing = false; this.timer = null; }, getLayout: function() { return { className: 'slide-container', children: [ this.addSingleReview( 'Bekah M', '“I have worked with several people at BP and they are so knowledgeable, get back to me quickly, and explain things about my website, online ads and SEO in simple, easy to understand lingo. I\'m looking forward to having a long term relationship with BP Dental!“' ), this.addSingleReview( 'Dr. Clayton Hansen', '“They do a first-rate job and are easy to work with. I\'ve been with them for five years and I\'m still happy.”' ), this.addSingleReview( 'Chas Phelps', '“Our new website is amazing and has increased our search engine optimization!“' ), this.addSingleReview( 'Mark Folks', '“BP Dental is great to work with. Very efficient their response rate is amazing!“' ), this.addSingleReview( 'Shabbir Adenwalla', '“The team at BP Dental has innovative and customized solutions for creating a distinctive online presence“' ), this.addSingleReview( 'Stacie Niederhaus', '“Thank you for the great customer care! Everyone on the team that I have come in contact with at BP Dental has been fabulous. You all know how to do it right!“' ), this.addSingleReview( 'Michael Ruggiero', '“I have extremely happy with bp dental. Our custom website to social media has made our practice stand out from our competitors. The staff is always available, and willing to help. Worth the invertment!“' ), { className: 'slide-controls', children: [ this.cache('pauseButton', this.addButton('pause', 'Pause', this.togglePlay)), this.addButton('previous', '', this.previousSlide), this.addButton('next', '', this.nextSlide) ] } ] }; }, addButton: function(id, label, callBack) { return { node: 'button', className: 'bttn controls', id: id, textContent: label, click: base.bind(this, callBack) }; }, afterSetup: function() { this.selectSlide(this.currentSlide); }, addSingleReview: function(fullName, review) { var self = this; return this.addChild(ReviewSlide, [fullName, review], null, function(component) { self.slides.push(component); }); }, togglePlay: function() { if(this.playing) { this.pause(); } else { this.play(); } }, nextSlide: function() { this.goToSlide(this.currentSlide + 1); }, previousSlide: function() { this.goToSlide(this.currentSlide - 1); }, goToSlide: function(number) { var slides = this.slides; var currentSlide = ((number + slides.length) % slides.length); this.selectSlide(currentSlide); }, unselectPrevious: function() { var previous = this.slides[this.currentSlide]; if(previous) { previous.unselect(); } }, selectSlide: function(number) { this.unselectPrevious(); var slide = this.slides[number]; if(slide) { this.currentSlide = number; slide.select(); } this.play(); }, play: function() { this.pause(); this.pauseButton.innerHTML = 'Pause'; this.playing = true; this.timer = window.setInterval(base.bind(this, this.nextSlide), 4000); }, pause: function() { this.pauseButton.innerHTML = 'Play'; this.playing = false; window.clearInterval(this.timer); } }); "use strict"; var Slide = base.Component.extend( { constructor: function(container) { base.Component.call(this, container); }, getLayout: function() { return { className: 'single-slide' }; }, activeClass: 'showing', unselect: function() { var element = this.panel; base.removeClass(element, this.activeClass); }, select: function(number) { var element = this.panel; base.addClass(element, this.activeClass); } }); var SlideController = base.Component.extend( { beforeSetup: function() { this.slides = []; this.currentSlide = 0; this.playing = false; this.timer = null; }, addButton: function(id, label, callBack) { return { node: 'button', className: 'bttn controls', id: id, textContent: label, click: base.bind(this, callBack) }; }, afterSetup: function() { this.selectSlide(this.currentSlide); }, addSingleSlide: function() { var self = this; return this.addChild(Slide, null, null, function(component) { self.slides.push(component); }); }, togglePlay: function() { if(this.playing) { this.pause(); } else { this.play(); } }, nextSlide: function() { this.goToSlide(this.currentSlide + 1); }, previousSlide: function() { this.goToSlide(this.currentSlide - 1); }, goToSlide: function(number) { var slides = this.slides; var currentSlide = ((number + slides.length) % slides.length); this.selectSlide(currentSlide); }, unselectPrevious: function() { var previous = this.slides[this.currentSlide]; if(previous) { previous.unselect(); } }, selectSlide: function(number) { this.unselectPrevious(); var slide = this.slides[number]; if(slide) { this.currentSlide = number; slide.select(); } this.play(); }, play: function() { this.pause(); this.pauseButton.innerHTML = 'Pause'; this.playing = true; this.timer = window.setInterval(base.bind(this, this.nextSlide), 8000); }, pause: function() { this.pauseButton.innerHTML = 'Play'; this.playing = false; window.clearInterval(this.timer); } }); "use strict"; var BannerSlideController = SlideController.extend( { getLayout: function() { return { className: 'banner-slides', children: [ this.addSingleSlide(), this.addSingleSlide(), this.addSingleSlide(), { className: 'slide-controls hidden', children: [ this.cache('pauseButton', this.addButton('pause', 'Pause', this.togglePlay)), this.addButton('previous', '', this.previousSlide), this.addButton('next', '', this.nextSlide) ] } ]}; } });