var verifyHostURL = "//verify.flickfusion.net/"; var currentScriptUrl = (document.currentScript || scripts[scripts.length - 1]).src; var clientKey = "C713107F-F7DA-4150-83D7-B5B02A2610DD"; var domainReferrer = window.location.hostname; //dev if (getParameterByName('ff_client')) clientKey = getParameterByName('ff_client') var verifyClientURL = verifyHostURL + "ff_verify_client.php?client_id=" + clientKey; var filterUniqueVins = {}; (function(history) { var pushState = history.pushState; history.pushState = function(state) { if (typeof history.onpushstate == "function") { history.onpushstate({ state: state }); } filterUniqueVins = {} return pushState.apply(history, arguments); } })(window.history); window.addEventListener('popstate', function(e) { filterUniqueVins = {} }); // Configuration object function isMobile() { if (navigator.userAgent.match(/Android/i) || navigator.userAgent.match(/webOS/i) || navigator.userAgent.match(/iPhone/i) || navigator.userAgent.match(/iPad/i) || navigator.userAgent.match(/iPod/i) || navigator.userAgent.match(/BlackBerry/i) || navigator.userAgent.match(/Windows Phone/i) ) { return true; } else { return false; } } var checkIsMobile = isMobile(); // SRP SNIPPET if (document.querySelector(siteConfig.VLPIndicator)) { var targetElementOnSRP = { container: siteConfig.VLP.container, buttonTarget: function() { return adjustModifyChilds(siteConfig.VLP.buttonTarget); }, list: function () { var classArray = siteConfig.VLP.container.split(','); for (let index = 0; index < classArray.length; index++) { if(document.querySelector(classArray[index]) && !isHidden(document.querySelector(classArray[index]))){ return document.querySelectorAll(classArray[index]); } } }, ajaxButtonGroup: function() { var classArray = siteConfig.VLP.dynamicAjaxGroupMobileButtons.split(','); for (let index = 0; index < classArray.length; index++) { if(document.querySelector(classArray[index]) && !isHidden(document.querySelector(classArray[index]))){ return classArray[index]; } } }, vin: function () { var vinIdentifiers = siteConfig.VLP.vin.split(','); for (let index = 0; index < vinIdentifiers.length; index++) { if(!isHidden(document.querySelector(vinIdentifiers[index]))){ return vinIdentifiers[index]; } } }, vinRegex: siteConfig.VLP.vinRegex, vinAttribute: siteConfig.VLP.vinAttribute, vinIdentifier: function() { return adjustModifyChilds(this.vin()); }, targetVinNumber: function(buttonItem) { if (this.vinIdentifier()) { if (siteConfig.VLP.vinFromChildHTMLElementPath && (buttonItem.querySelector(this.vinIdentifier())) && siteConfig.VLP.vinBaseRegex) return ((buttonItem.querySelector(this.vinIdentifier())).outerHTML.toString()).match(/\w{17}/)[0].substring(0, 17); else if (buttonItem.querySelector(this.vinIdentifier()) && siteConfig.VLP.vinRegex) return ((buttonItem.querySelector(this.vinIdentifier())).outerHTML.toString()).match(siteConfig.VLP.vinRegex)[1].substring(0, 17); else if (siteConfig.VLP.vinBaseRegex && siteConfig.VLP.baseVinAttribute) return buttonItem.getAttribute(siteConfig.VLP.baseVinAttribute).match(siteConfig.VLP.vinBaseRegex)[0]; else if (siteConfig.VLP.vinAttribute) { if (siteConfig.VLP.vinBaseTarget && siteConfig.VLP.vinBaseTargetIdentifier) return buttonItem.getAttribute(siteConfig.VLP.vinBaseTargetIdentifier); if (siteConfig.VLP.vinBaseTarget) return buttonItem.getAttribute('data-vin'); return buttonItem.querySelector(this.vinIdentifier()) ? buttonItem.querySelector(this.vinIdentifier()).getAttribute(siteConfig.VLP.vinAttribute) : ''; } else { if (buttonItem.querySelector(this.vinIdentifier())) return buttonItem.querySelector(this.vinIdentifier()).innerText; } } return '' }, buttonClass: function() { return targetMobileORDesktop(siteConfig.VLP.mobileButtonClass, siteConfig.VLP.buttonClass) }, buttonPlacingPostion: function() { return targetMobileORDesktop(siteConfig.VLP.mobileButtonPos, siteConfig.VLP.buttonPos) }, buttonCSS: function() { return targetMobileORDesktop(siteConfig.VLP.mobileButtonStyle, siteConfig.VLP.buttonStyle) }, buttonContent: function() { return targetMobileORDesktop(siteConfig.VLP.mobileButtonText, siteConfig.VLP.buttonText) }, buttonParentStyle: function() { return targetMobileORDesktop(siteConfig.VLP.mobileButtonParentStyle, siteConfig.VLP.buttonParentStyle) }, buttonParentClass: function() { return targetMobileORDesktop(siteConfig.VLP.mobileButtonParentClass, siteConfig.VLP.buttonParentClass) }, placeToInsertButton: function(buttonItem) { var buttonPostion; if (checkIsMobile && siteConfig.VLP.mobileButtonTarget != undefined) { buttonPostion = adjustModifyChilds(siteConfig.VLP.mobileButtonTarget); if (siteConfig.VLP.mobileButtonTarget) { return buttonItem.querySelector(buttonPostion); } } else { if (siteConfig.VLP.buttonTarget) { buttonPostion = adjustModifyChilds(siteConfig.VLP.buttonTarget); return buttonItem.querySelector(buttonPostion); } } }, includeSiteCSS: '', mobileButtonTarget: siteConfig.VLP.mobileButtonTarget, mobileButtonText: siteConfig.VLP.mobileButtonText, mobileCanary: siteConfig.VLP.mobileCanary } if(window.isFlickScriptLoaded === undefined){ generateButtonsOnSRP(); runDynamicButtonsAddedFun(); } window.isFlickScriptLoaded = true; } // VDP SNIPPET if (document.querySelector(siteConfig.VDPIndicator)) { var targetElementOnVDP = { target: document.querySelector(adjustModifyChilds(siteConfig.VDP.target)), vinIdentifier: function() { return adjustModifyChilds(siteConfig.VDP.vin); }, targetVinNumber: function() { if (this.vinIdentifier()) { if (document.querySelector(this.vinIdentifier()) && siteConfig.VDP.vinRegex) return ((document.querySelector(this.vinIdentifier())).outerHTML.toString()).match(siteConfig.VDP.vinRegex)[1].substring(0, 17); else if (siteConfig.VDP.vinAttribute) return document.querySelector(this.vinIdentifier()) ? document.querySelector(this.vinIdentifier()).getAttribute(siteConfig.VDP.vinAttribute) : ''; else { if (document.querySelector(this.vinIdentifier())) return document.querySelector(this.vinIdentifier()).innerText; } } return '' }, placeToInsertButton: function() { var buttonPostion; if (checkIsMobile && siteConfig.VDP.mobileButtonTarget != undefined) { buttonPostion = adjustModifyChilds(siteConfig.VDP.mobileButtonTarget); if (siteConfig.VDP.mobileButtonTarget) { return document.querySelector(buttonPostion); } } else { if (siteConfig.VDP.target) { buttonPostion = adjustModifyChilds(siteConfig.VDP.target); return document.querySelector(buttonPostion); } } }, vin: siteConfig.VDP.vin, vinRegex: siteConfig.VDP.vinRegex, vinAttribute: siteConfig.VDP.vinAttribute, buttonCSS: function() { return targetMobileORDesktop(siteConfig.VDP.mobileButtonStyle, siteConfig.VDP.buttonStyle) }, buttonContent: function() { return targetMobileORDesktop(siteConfig.VDP.mobileButtonText, siteConfig.VDP.buttonText) }, buttonPlacingPostion: function() { return targetMobileORDesktop(siteConfig.VDP.mobileButtonPos, siteConfig.VDP.buttonPos) }, buttonClass: function() { return targetMobileORDesktop(siteConfig.VDP.mobileButtonClass, siteConfig.VDP.buttonClass) }, buttonParentStyle: function() { return targetMobileORDesktop(siteConfig.VDP.mobileButtonParentStyle, siteConfig.VDP.buttonParentStyle) }, buttonParentClass: function() { return targetMobileORDesktop(siteConfig.VDP.mobileButtonParentClass, siteConfig.VDP.buttonParentClass) }, includeSiteCSS: '', } if(window.isFlickScriptLoaded === undefined) generateButtonsOnVDP(); window.isFlickScriptLoaded = true; } // Main start function targetMobileORDesktop(mobile, desktop) { if (checkIsMobile && mobile != undefined) { if (mobile) return mobile else return '' } else { if (desktop) return desktop else return '' } } // VDP function generateButtonsOnVDP() { if (siteConfig.VDP.siteStyle) createStyleTagAndAppend(siteConfig.VDP.siteStyle); if (targetElementOnVDP.includeSiteCSS) createStyleTagAndAppend(targetElementOnVDP.includeSiteCSS); requestDataJSONP(verifyClientURL, "jsoncallback", function(data) { if (data.code == 200) { var scriptTag = document.createElement("script"); scriptTag.setAttribute("src", "//media.flickfusion.net//videos/global/open_ff_window_new.js"); scriptTag.setAttribute("type", "text/javascript"); document.head.appendChild(scriptTag); var vinNumber = targetElementOnVDP.targetVinNumber(); // var vinNumber = "1G1JD6SB5L4101244" if (getParameterByName('ff_test_vin')) var vinNumber = getParameterByName('ff_test_vin'); var verifyVinURL = verifyHostURL + "ff_verify_vin.php?vin=" + vinNumber + "&client_id=" + clientKey; requestDataJSONP(verifyVinURL, "jsoncallback", function(data) { if (data.code == 200) { if (data.data.popup !== undefined && data.data.popup.is360 == 1) { if (siteConfig.VDP.carousel) { generateFlickfusionPlayer(data.data.popup.url); return; } var flickButton = document.createElement('div'); flickButton.setAttribute("flick", vinNumber); flickButton.addEventListener('click', function(e) { e.preventDefault(); e.stopPropagation(); new ConModal({ width: 960, videoPage: 2, modalTitle: "Video", iframeUrl: data.data.popup.url + "&referer=" + domainReferrer, }); }) insertButtonOnPostion(generateFlickButtonOnVDP(flickButton), targetElementOnVDP.placeToInsertButton(), targetElementOnVDP.buttonPlacingPostion()); } else { generateButtonAndPlayer(vinNumber) } } else { generateButtonAndPlayer(vinNumber) } }); } }); } function generateButtonAndPlayer(vinNumber) { var createSpinId = document.createElement('div'); createSpinId.id = "spin"; var fyuseButtonGenerate = document.createElement('div'); var getFyuseIdService = "https://media.flickfusion.net/360/hn_360_client.php?vin=" + vinNumber; requestDataJSONP(getFyuseIdService, "jsoncallback", function(fyuseData) { if (fyuseData.code == 200) { var fyuseId = JSON.parse(fyuseData.fid)[0]; fyuseButtonGenerate.setAttribute("fyuse", fyuseId); var RefNode = targetElementOnVDP.placeToInsertButton(); if (siteConfig.VDP.carousel) { generateFyuseInlinePlayer(fyuseId); return; } insertButtonOnPostion(generateFlickButtonOnVDP(fyuseButtonGenerate), RefNode, targetElementOnVDP.buttonPlacingPostion()); insertButtonOnPostion(createSpinId, RefNode, targetElementOnVDP.buttonPlacingPostion()); fyuseButtonGenerate.addEventListener('click', function(e) { e.preventDefault(); e.stopPropagation(); loadFyuse(fyuseId); }) } }); } function generateFlickfusionPlayer(url) { if (siteConfig.VDP.deleteEl) document.querySelector(siteConfig.VDP.deleteEl).style.display = "none"; var iframeElement = document.createElement("iframe"), playerAspectRatio = 16 / 9; if (window.location.hostname == "www.hondamarysville.com") playerAspectRatio = 16 / 11; iframeElement.scrolling = "no"; iframeElement.frameBorder = "no"; iframeElement.style.border = "none"; iframeElement.src = url + "&referer=" + domainReferrer; iframeElement.style.border = "none"; document.querySelector(adjustModifyChilds(siteConfig.VDP.target)).style.height = "100%"; document.querySelector(adjustModifyChilds(siteConfig.VDP.target)).parentNode.style.height = "100%"; iframeElement.setAttribute("allowfullscreen", true); document.querySelector(adjustModifyChilds(siteConfig.VDP.target)).appendChild(iframeElement); setPlayerDimentions(iframeElement, playerAspectRatio); } function generateFyuseInlinePlayer(fyuseId) { if (siteConfig.VDP.deleteEl) document.querySelector(siteConfig.VDP.deleteEl).style.display = "none"; var createSpinId = document.createElement('div'); createSpinId.id = "spin"; document.querySelector(adjustModifyChilds(siteConfig.VDP.target)).style.height = "100%"; document.querySelector(adjustModifyChilds(siteConfig.VDP.target)).parentNode.style.height = "100%"; document.querySelector(adjustModifyChilds(siteConfig.VDP.target)).appendChild(createSpinId); generateFyusePlayer(createSpinId, fyuseId) /* if(buttonWrapper.getAttribute('flick')){ return generateFlickPlayer(buttonWrapper, buttonWrapper.getAttribute('flick')); } */ } function generateFyusePlayer(buttonWrapper, fyuseId) { var fyusePlayerAspectRatio = 16 / 9; setPlayerDimentions(document.querySelector('#spin'), fyusePlayerAspectRatio); function loadFyuseAPI(callback) { var script = document.createElement("script"); script.type = "text/javascript"; script.src = "https://fyu.se/embed?v=3.0"; script.onreadystatechange = callback; script.onload = callback; document.head.appendChild(script); } function loadFyuse() { function handler() { if (xhr.readyState === XMLHttpRequest.DONE) { if (xhr.status === 200) { var spin = FYU.add(fyuseId, buttonWrapper, { aspect: { mode: 0, align: "top" }, preload: 1, nologo: 1, logo: 0, zoom: 1, zoomBtns: 1, thumb_index: 0, fullscreen: 0, inlineBtn: 1 }); spin.tags(); document.querySelector('#spin').addEventListener('mousedown', function(e) { e.preventDefault(); e.stopPropagation(); }) } } } var xhr = new XMLHttpRequest(), method = "GET", url = FYU.protocol + "//" + FYU.host + "/embed/" + fyuseId; xhr.onreadystatechange = handler; xhr.open(method, url, true); xhr.send(); } if (typeof fyuseId !== "undefined") { loadFyuseAPI(loadFyuse); } } function setPlayerDimentions(player, aspectRatio) { // -- 16/9 & 4/3 are most common aspect ratios, if other than both two we are setting aspect ratio to default i.e 16/9 if (!(aspectRatio == 16 / 9 || aspectRatio == 4 / 3)) aspectRatio = 16 / 11; player.style.cssText = "position: relative; top: 50%; transform: translateY(-50%);"; if (siteConfig.VDP.targetStyle) player.style.cssText = siteConfig.VDP.targetStyle; player.style.width = "100%"; player.style.maxWidth = "960px"; player.style.maxHeight = "540px"; if (aspectRatio == 4 / 3) player.style.maxHeight = "720px"; player.style.height = Math.round(player.parentElement.offsetWidth / (aspectRatio)) + "px"; window.onresize = function() { player.style.height = Math.round(player.parentElement.offsetWidth / (aspectRatio)) + "px"; }; } // SRP function generateButtonsOnSRP() { if (siteConfig.VLP.siteStyle) createStyleTagAndAppend(siteConfig.VLP.siteStyle); if (targetElementOnSRP.includeSiteCSS) createStyleTagAndAppend(targetElementOnSRP.includeSiteCSS); requestDataJSONP(verifyClientURL, "jsoncallback", function(data) { if (data.code == 200) { var scriptTag = document.createElement("script"); scriptTag.setAttribute("src", "//media.flickfusion.net//videos/global/open_ff_window_new.js"); scriptTag.setAttribute("type", "text/javascript"); document.head.appendChild(scriptTag); targetElementOnSRP.list().forEach(function(buttonItem, index, array) { var vinNumber = targetElementOnSRP.targetVinNumber(buttonItem); // var vinNumber = "1G1JD6SB5L4101244" if (getParameterByName('ff_test_vin')) var vinNumber = getParameterByName('ff_test_vin') if (!(filterUniqueVins[vinNumber])) srpVerifyVinService(targetElementOnSRP.placeToInsertButton(buttonItem), vinNumber, targetElementOnSRP.buttonPlacingPostion()); }); } }); } function srpVerifyVinService(insertButtonPosition, vinNumber, buttonPlacingPostion) { filterUniqueVins[vinNumber] = true; if (!vinNumber) return; var verifyVinURL = verifyHostURL + "ff_verify_vin.php?vin=" + vinNumber + "&client_id=" + clientKey; requestDataJSONP(verifyVinURL, "jsoncallback", function(data) { if (data.code == 200) { if (data.data.popup !== undefined && data.data.popup.is360 == 1) { var flickButton = document.createElement('div'); flickButton.setAttribute("flick", vinNumber); flickButton.addEventListener('click', function(e) { e.preventDefault(); e.stopPropagation(); new ConModal({ width: 960, videoPage: 2, modalTitle: "Video", iframeUrl: data.data.popup.url + "&referer=" + domainReferrer, }); }) insertButtonOnPostion(generateFlickButtonOnSRP(flickButton), insertButtonPosition, buttonPlacingPostion); } else { checkForFyuse(insertButtonPosition, vinNumber, buttonPlacingPostion); } } else { checkForFyuse(insertButtonPosition, vinNumber, buttonPlacingPostion); } }); } function checkForFyuse(insertButtonPosition, vinNumber, buttonPlacingPostion) { filterUniqueVins[vinNumber] = true; if (!vinNumber) return; var createSpinId = document.createElement('div'); createSpinId.id = "spin"; var fyuseButtonGenerate = document.createElement('div'); var getFyuseIdService = "https://media.flickfusion.net/360/hn_360_client.php?vin=" + vinNumber; requestDataJSONP(getFyuseIdService, "jsoncallback", function(fyuseData) { if (fyuseData.code == 200) { var fyuseId = JSON.parse(fyuseData.fid)[0]; fyuseButtonGenerate.setAttribute("fyuse", fyuseId); insertButtonOnPostion(generateFlickButtonOnSRP(fyuseButtonGenerate), insertButtonPosition, buttonPlacingPostion); insertButtonOnPostion(createSpinId, insertButtonPosition, buttonPlacingPostion); fyuseButtonGenerate.addEventListener('click', function(e) { e.preventDefault(); e.stopPropagation(); loadFyuse(fyuseId); }) } }); } function createStyleTagAndAppend(cssStyles) { head = document.head || document.getElementsByTagName('head')[0], style = document.createElement('style'); style.innerText = cssStyles; head.appendChild(style); } function generateFlickButtonOnVDP(buttonWrapper) { var parentStyle = ''; var button = document.createElement('a'); buttonWrapper.id = "ff_link"; buttonWrapper.style.cssText = targetElementOnVDP.buttonParentStyle(); buttonWrapper.className = targetElementOnVDP.buttonParentClass(); button.style.cssText = targetElementOnVDP.buttonCSS(); button.className = targetElementOnVDP.buttonClass(); button.innerHTML = targetElementOnVDP.buttonContent(); if (targetElementOnVDP.buttonPlacingPostion() == 'bottom') { if (targetElementOnVDP.buttonParentStyle()) parentStyle = targetElementOnVDP.buttonParentStyle(); buttonWrapper.style.cssText = "position: relative; width: 100%; top: 0; left: 0;" + parentStyle; } buttonWrapper.appendChild(button); return buttonWrapper; } function generateFlickButtonOnSRP(buttonWrapper) { var parentStyle = ''; var button = document.createElement('a'); buttonWrapper.id = "ff_link"; button.style.cssText = targetElementOnSRP.buttonCSS(); buttonWrapper.style.cssText = targetElementOnSRP.buttonParentStyle(); button.className = targetElementOnSRP.buttonClass(); buttonWrapper.className = targetElementOnSRP.buttonParentClass(); button.innerHTML = targetElementOnSRP.buttonContent(); if (targetElementOnSRP.buttonPlacingPostion() == 'bottom') { if (targetElementOnSRP.buttonParentStyle()) parentStyle = targetElementOnSRP.buttonParentStyle(); buttonWrapper.style.cssText = "position: relative; width: 100%; top: 0; left: 0;" + parentStyle; } buttonWrapper.appendChild(button); return buttonWrapper; } // Main ends // helper methods function runDynamicButtonsAddedFun() { var observer = new MutationObserver(function(mutations) { runButtonGenerate(mutations); }); observer.observe(document, { attributes: true, childList: true, characterData: true, subtree: true }); function runButtonGenerate(data) { data.filter(function(element) { if ((element.addedNodes[0] instanceof Element || element.addedNodes[0] instanceof HTMLDocument)) { var container = adjustModifyChilds(targetElementOnSRP.container); var targetButton = adjustModifyChilds(siteConfig.VLP.buttonTarget); if (siteConfig.VLP.dynamicAjaxGroupMobileButtons && element.target.querySelector(targetElementOnSRP.ajaxButtonGroup())) { element.target.querySelectorAll(targetElementOnSRP.ajaxButtonGroup()).forEach(function(item) { if (item.getAttribute('id') == 'ff_link' || item.classList.contains('spin-button')) return false; var mainData = item.querySelector(targetButton); if (!(filterUniqueVins[processVinNumber(item, targetButton)])) srpVerifyVinService(mainData, processVinNumber(item, targetButton), targetElementOnSRP.buttonPlacingPostion()); }) } if (siteConfig.VLP.dynamicAjaxGroupMobileButtons && element.addedNodes[0].querySelector(targetElementOnSRP.ajaxButtonGroup())) { element.addedNodes[0].querySelectorAll(targetElementOnSRP.ajaxButtonGroup()).forEach(function(ele) { if (ele.getAttribute('id') == 'ff_link' || ele.classList.contains('spin-button')) return false; var mainData = ele.querySelector(targetButton); if (!(filterUniqueVins[processVinNumber(ele, targetButton)])) srpVerifyVinService(mainData, processVinNumber(ele, targetButton), targetElementOnSRP.buttonPlacingPostion()); }) } if (element.addedNodes[0].querySelector(targetButton)) { if (element.addedNodes[0].getAttribute('id') == 'ff_link' || element.addedNodes[0].classList.contains('spin-button')) return false; var mainData = element.addedNodes[0].querySelector(targetButton); if (!(filterUniqueVins[processVinNumber(element.addedNodes[0], targetButton)])) srpVerifyVinService(mainData, processVinNumber(element.addedNodes[0], targetButton), targetElementOnSRP.buttonPlacingPostion()); } } }); } } function adjustModifyChilds(data) { if (data) return data.replace(":first", ":first-child").replace(":last", ":last-child"); } function processVinNumber(item, finder) { if (item.querySelector(finder)) { return targetElementOnSRP.targetVinNumber(item); } } function insertButtonOnPostion(newNode, referenceNode, position) { if (referenceNode == null) return false; if (position == 'top') return referenceNode.parentNode.insertBefore(newNode, referenceNode); else if (position == 'bottom') return referenceNode.parentNode.insertBefore(newNode, referenceNode.nextSibling); else return referenceNode.parentNode.insertBefore(newNode, referenceNode.nextSibling); } function loadFyuse(fyuseId) { function loadFyuseAPI(callback) { var script = document.createElement("script"); script.type = "text/javascript"; script.src = "https://fyu.se/embed?v=3.0"; script.onreadystatechange = callback; script.onload = callback; document.head.appendChild(script); } function loadFyuse() { function handler() { if (xhr.readyState === XMLHttpRequest.DONE) { if (xhr.status === 200) { var spin = FYU.add(fyuseId, "spin", { aspect: { mode: 0 }, preload: 1, nologo: 1, logo: 0, zoom: 1, zoomBtns: 1, thumb_index: 0, fullscreen: 0, nooverlay: 0, inlineBtn: 1, motion: 0 }); spin.tags(); spin.fullscreen() } } } var xhr = new XMLHttpRequest(), method = "GET", url = FYU.protocol + "//" + FYU.host + "/embed/" + fyuseId; xhr.onreadystatechange = handler; xhr.open(method, url, true); xhr.send(); } if (typeof fyuseId !== "undefined") { loadFyuseAPI(loadFyuse); } } function requestDataJSONP(url, key, callback) { var doc = document, head = doc.head, script = doc.createElement("script"), callbackName = "f" + Math.round(Math.random() * Date.now()); script.setAttribute("src", url + (url.indexOf("?") > 0 ? "&" : "?") + key + "=" + callbackName); window[callbackName] = function(json) { window[callbackName] = undefined; setTimeout(function() { head.removeChild(script); }, 0); callback(json); }; head.appendChild(script); } function isHidden(el) { if(el instanceof Element){ var style = window.getComputedStyle(el); return (style.display === 'none') } return false; } // dev function getParameterByName(name, url) { if (!url) url = window.location.href; name = name.replace(/[\[\]]/g, '\\$&'); var regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)'), results = regex.exec(url); if (!results) return null; if (!results[2]) return ''; return decodeURIComponent(results[2].replace(/\+/g, ' ')); }