var scriptName = "voxant_player.js"; var voxant_scripts = document.getElementsByTagName('script'); var voxant_playerScript = voxant_scripts[voxant_scripts.length - 1]; var voxant_queryString = voxant_playerScript.src.replace(/^[^\?]+\??/,''); var hostname = null; var parentURL = null; var voxant_scriptLocation = voxant_playerScript.src.split("?")[0]; voxant_scriptLocation = voxant_scriptLocation.substr(0, voxant_scriptLocation.length - scriptName.length); function getUrlParams(concatString,paramName,targetUrl){ var name = paramName.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]"), regexS = "[\\?&]" + name + "=([^&#]*)", regex = new RegExp(regexS,'i'), results = regex.exec(targetUrl); if (results == null) { return ''; } else { return concatString + results[1]; } } // Required Parameters try{ // try to get the hostname and url hostname = "\',\'host\':\'" + window.parent.window.document.location.hostname; parentURL = "\',\'u\':\'" + parent.document.URL; } catch(e) { // but, if inside an iframe, then get from the iframe hostname = "\',\'host\':\'" + window.location.hostname; parentURL = "\',\'u\':\'" + window.document.URL; }; var jsEmbed = getUrlParams("","m",voxant_playerScript.src); var jsAsset = getUrlParams("","a",voxant_playerScript.src); var jsHeight = getUrlParams("","h",voxant_playerScript.src); var jsWidth = getUrlParams("","w",voxant_playerScript.src); var newW = Number(jsWidth)+1; var newH = Number(jsHeight)+1; // Optional Parameters (Use function to "erase" if not present) var urlAssetId = getUrlParams("\',\'assetId\':\'" ,"assetId", parentURL); var jsSkin = getUrlParams("\',\'skin\':\'" ,"skin", voxant_playerScript.src); var jsTint = getUrlParams("\',\'tint\':\'" ,"tint", voxant_playerScript.src); var jsBorder = getUrlParams("\',\'border\':\'" ,"border", voxant_playerScript.src); var jsAutoMash = getUrlParams("\',\'autoMash\':\'" ,"autoMash",voxant_playerScript.src); var jsVersion = getUrlParams("\',\'version\':\'" ,"version", voxant_playerScript.src); // Build JSON string and iframe request var tnrJSON = "tnrParams={"+"\'qstr\':\'"+voxant_queryString +jsSkin +jsTint +jsBorder +jsAutoMash +urlAssetId +jsVersion +hostname +parentURL +"\'}"; var docStr = ""; document.write(docStr);