var arkIframeName = "arkgamearenaIframe"; var arkGameDivName = "bottomGameDiv";//"arkgamearena"; var scriptSrc = document.querySelector('script[src="http://games.bismarcktribune.com/manage/renderarena"]'); var scriptPhp = document.querySelector('script[src*="/drawportal.php"]'); function getQueryValueByKey (name) { name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]"); var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"), results = regex.exec(location.search); return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " ")); } if(!document.getElementById(arkGameDivName) || scriptSrc.parentNode != 'head' || scriptPhp.parentNode != 'head') { var parentDiv = document.createElement('div'); parentDiv.innerHTML = ''; parentDiv.setAttribute("id", arkGameDivName); parentDiv.style.width = "100%"; if(scriptSrc == null){ scriptPhp.parentNode.insertBefore(parentDiv, scriptPhp); } else{ scriptSrc.parentNode.insertBefore(parentDiv, scriptSrc); } } function prepareIFrame() { var iFrameUrl = "http://games.bismarcktribune.com"; var refUrl = document.location.href; var arkPath = getQueryValueByKey("arkpath"); if(arkPath != "") { var sepVal = "?" if(arkPath.indexOf("?") > -1) { sepVal = "&"; } iFrameUrl = iFrameUrl + arkPath;// + sepVal + "phost=" + decodeURIComponent(refUrl); } var ifrm = document.createElement("IFRAME"); ifrm.setAttribute("src", iFrameUrl); ifrm.width = "100%"; ifrm.height = "1000"; ifrm.style.border = "none"; ifrm.scrolling = "no"; ifrm.setAttribute("id", arkIframeName); return ifrm; } var curGameIframe = prepareIFrame(); document.getElementById(arkGameDivName).appendChild(curGameIframe);//bottomGameDiv if (window.addEventListener) { window.addEventListener('message', receiveMSG, false); } else { window.attachEvent('onmessage', receiveMSG); } function receiveMSG(eventString){ if (eventString.origin == "http://games.bismarcktribune.com") { var str = eventString.data; var data = str.toString().split('&'); var event = data[0].split('=')[1]; if(event == 'changeUrl'){ document.location.href = decodeURIComponent(data[1].split('=')[1]); } if(event == 'setIframeClass'){ var gameName = ''; for(var i=0; i < data.length;i++) { if(data[i].indexOf('gamepagename') !=-1) { gameName = data[i].split('=')[1]; } } var Gifrm = document.createElement("iframe"); Gifrm.setAttribute("src", ' http://games.bismarcktribune.com/arenaapi/game/'+gameName+'/html5'); Gifrm.setAttribute("id", 'arkDogNailForHearst'); document.body.appendChild(Gifrm); Gifrm.setAttribute("class", "fullScreenGame"); Gifrm.scrolling = "no"; Gifrm.width = "100%"; Gifrm.height = window.innerHeight; Gifrm.scrollIntoView(); } if(event == 'changeHeight'){ curGameIframe.height = data[1].split('=')[1]; Gifrm = document.getElementById('arkDogNailForHearst') if(Gifrm){ Gifrm.height = window.innerHeight; Gifrm.width = window.innerWidth; } } if(event == 'game_end'){ Gifrm = document.getElementById('arkDogNailForHearst') if(Gifrm){ Gifrm.remove(); Gifrm.className = ""; document.getElementsByTagName('body')[0].style = ''; } document.getElementById('arkgamearenaIframe').contentWindow.postMessage(eventString.data,'*') } } } if (navigator.userAgent.match(/Android|webOS|iPhone|iPad|iPod|BlackBerry|BB|PlayBook|IEMobile|Windows Phone|Kindle|Silk|Opera Mini/i)) { var ifrm = document.getElementById(arkIframeName); ifrm.width = document.getElementById('bottomGameDiv').clientWidth; window.addEventListener('resize', function (event) { ifrm.width = document.getElementById('bottomGameDiv').clientWidth; ifrm.contentWindow.postMessage("event=getHeight&test=test", "*"); if(event == 'changeHeight'){ ifrm.style.height = data[1].split('=')[1]; } }); } window.addEventListener('resize', function (event) { var game_if = document.getElementById('arkDogNailForHearst'); if (!!game_if) { game_if.width = window.innerWidth; } }); if(document.location.hostname == 'comicskingdom.com'){ document.getElementsByTagName('header').item('h1').setAttribute('style', 'display:none'); document.getElementsByClassName('tophat').item(1).setAttribute('style', 'padding:40px 0') } if(document.location.hostname == 'www.denverpost.com'){ if($){ $('body').css('position', 'static'); $('.body-copy > p').css('display', 'none'); } } if(document.location.hostname == 'www.philly.com'){ if($){ $('#contentinside .lc').css('padding', '0'); } } if(document.location.hostname == 'www.qconline.com'){ if(event == 'changeHeight'){ curGameIframe.height = data[1].split('=')[1]; console.log('did') } } if(document.location.hostname == "www.thegazette.com"){ document.getElementById("header-mobile").style.position = 'absolute' } if(document.location.hostname == "www.hutchnews.com"){ document.getElementById('bottomGameDiv').style.margin = '0 auto' } if(document.location.hostname == "www.sfgate.com"){ if (navigator.userAgent.match(/Android|webOS|iPhone|iPad|iPod|BlackBerry|BB|PlayBook|IEMobile|Windows Phone|Kindle|Silk|Opera Mini/i)) { $('head').append( '' ); } $('.ff-content').css('width', '100%'); document.getElementById('arkgamearenaIframe').width = document.getElementById('bottomGameDiv').clientWidth; } if(document.location.hostname == "mytoba.ca" && navigator.userAgent.match(/Android|webOS|iPhone|iPad|iPod|BlackBerry|BB|PlayBook|IEMobile|Windows Phone|Kindle|Silk|Opera Mini/i)){ document.getElementById('main').style.padding = '25px 0'; document.getElementById('main').style.width = '96%'; document.getElementById('arkgamearenaIframe').style.width = '100%' } if(document.location.hostname == "yukon-news.com"){ document.getElementById("main").style.margin = '0'; document.getElementById("main").style.padding = '0'; document.getElementById("main").style.background = '#fff'; } if(document.location.hostname == "www.mysanantonio.com" && navigator.userAgent.match(/Android|webOS|iPhone|iPad|iPod|BlackBerry|BB|PlayBook|IEMobile|Windows Phone|Kindle|Silk|Opera Mini/i)){ document.getElementById('outer_bg_container').style.width = '100%'; $(function() { $('#inner_bg_container .container, #inner_bg_container .span-31').css('width', '100%'); }); } if(document.location.hostname == "static.montgomeryadvertiser.com"){ document.getElementById('section_').style.width = 'auto'; document.getElementsByClassName('static-card')[0].style.width = 'auto'; document.getElementsByClassName('static-card')[0].style.maxWidth = '1024px'; document.getElementsByClassName('static-card')[0].style.padding = '25px 10px'; document.getElementsByClassName('page')[0].style.width = 'auto'; } if(document.location.hostname == "www.annistonstar.com" && navigator.userAgent.match(/Android|webOS|iPhone|iPad|iPod|BlackBerry|BB|PlayBook|IEMobile|Windows Phone|Kindle|Silk|Opera Mini/i)){ document.getElementsByClassName('index-content')[0].style.padding = '0'; $(function() { $('#mobile-games').css({"height": "100%", "min-height":"100%", "position" : "relative" }); $('.ui-mobile body').css({"height": "100%", "min-height":"100%" }); $('#mobile-games').removeAttr('style'); $('#mobile-games, #tncms-block-1185713, .content-primary').css({"height": "100%", "min-height":"100%" }); $('.ui-overlay-c, .tncms-block').css({"background": "#fff" }); $('.tncms-block').css({"width": "100%" }); $("#mobile-games").die("pageinit").live("pageinit",function(event){ $("#mobile-games .content-secondary").remove(".content-right"); }); }); } if(document.location.hostname == "sedaliademocrat.com"){ document.getElementsByTagName('body')[0].style.height = 'auto'; } if(document.location.hostname == "robesonian.com"){ document.getElementsByTagName('body')[0].style.height = 'auto'; } if(document.location.hostname == "loganbanner.com"){ document.getElementsByTagName('body')[0].style.height = 'auto'; window.addEventListener('resize', arkIframeResize); function arkIframeResize(){ ifrm.width = document.getElementById('bottomGameDiv').clientWidth; } } if(document.location.hostname == "robesonian.com"){ document.getElementsByTagName('body')[0].style.height = 'auto'; } if(document.location.hostname == "static.thespectrum.com"){ document.getElementsByClassName('page')[0].style.width = '100%'; document.getElementsByClassName('static-card')[0].style.width = '100%'; document.getElementsByClassName('static-card')[0].style.maxWidth = '1024px'; document.getElementsByClassName('static-card')[0].style.padding = '25px 5px'; document.getElementById('section_').style.width = '100%'; } if(document.location.hostname == "www.theeasleyprogress.com"){ document.getElementsByClassName('section-main')[0].style.maxWidth = '1000px'; } if(window.jQuery){ jQuery('body').css('height', 'auto'); } if(document.location.hostname === "newbritainheraldtest.cms.falconocp.com" || document.location.hostname === "bristolpresstest.cms.falconocp.com"){ if(navigator.userAgent.match(/Android|webOS|iPhone|iPad|iPod|BlackBerry|BB|PlayBook|IEMobile|Windows Phone|Kindle|Silk|Opera Mini/i)){ viewport = document.querySelector("meta[name=viewport]"); viewport.setAttribute('content', 'width=980'); jQuery('body').css('margin', '0'); } } if(document.location.hostname === "www.globegazette.com"){ if (navigator.userAgent.match(/Android|webOS|iPhone|iPad|iPod|BlackBerry|BB|PlayBook|IEMobile|Windows Phone|Kindle|Silk|Opera Mini/i)) { document.getElementById('main-page-container').style.width = '100%'; } } if(navigator.userAgent.match(/Android|webOS|iPhone|iPad|iPod|BlackBerry|BB|PlayBook|IEMobile|Windows Phone|Kindle|Silk|Opera Mini/i)){ jQuery(function () { jQuery('#x-pencil-click-bg').css('background-image', 'none'); }); } if(document.location.hostname === "www.philly.com"){ $('header').css('position', 'absolute'); $('header').css('z-index', '5'); $('#lCol').css('padding', '0 10px'); } if(document.location.hostname === "www.gosanangelo.com"){ if(navigator.userAgent.match(/Android|webOS|iPhone|iPad|iPod|BlackBerry|BB|PlayBook|IEMobile|Windows Phone|Kindle|Silk|Opera Mini/i)){ jQuery(function () { jQuery('.masthead--container, .privacy-notice').css('z-index', '100'); console.log('---gosangelo222-inner--'); }); } } if(document.location.hostname === "newsok.com"){ $(function() { $('.container, .span12').css('width','100%'); $('.container, .span12').css('max-width','990px'); $('.container').css('padding','0'); }); } if(document.location.hostname == "static.jsonline.com"){ document.getElementById('section_').style.width = '980px'; var elems = document.getElementsByClassName('static-card'); for(var i = 0; i < elems.length; i++) { elems[i].style.width = '100%'; } var pageEl = document.getElementsByClassName('page'); for(var i = 0; i < pageEl.length; i++) { pageEl[i].style.width = '100%'; } }