Skip to content

Instantly share code, notes, and snippets.

@findchris
Created August 26, 2013 22:53
Show Gist options
  • Select an option

  • Save findchris/6347630 to your computer and use it in GitHub Desktop.

Select an option

Save findchris/6347630 to your computer and use it in GitHub Desktop.
JiWire redirect URL source
<!DOCTYPE html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, width=device-width" />
<meta name="apple-mobile-web-app-capable" content="yes"/>
<link href="http://local.jiwire.com/jwindr.jiwire.com/current/css/a4a/selectablemedia/110/style.css" rel="stylesheet" type="text/css" />
<script src="http://local.jiwire.com/jwindr.jiwire.com/current/js/jquery-1.8.2.min.js" type="text/javascript"></script>
<style>
.finish_hide { position:absolute;z-index:5000;top:190px;width:100%;height:220px; margin:0 auto; visibility:hidden;}
.finish_show { position:absolute;z-index:5000;top:190px;width:100%;height:220px; margin:0 auto; visibility:visible;}
.finish_box_small {
top:20px;width:200px;height:165px;margin:0 auto; background-color:#fff;color:#000;
padding:5px; -moz-border-radius: 15px; border-radius: 15px; z-index:5001; border-style:solid;border-width:2px;border-color:#000;
}
.finish_box_large {
top:20px;width:300px;height:200px;margin:0 auto; background-color:#fff;color:#000;
padding:10px; -moz-border-radius: 15px; border-radius: 15px; z-index:5001;border-style:solid;border-width:2px;border-color:#000;
}
.play_button_text { color:#339900; font-weight:900; }
</style>
<script type="text/javascript">
var apps_for_access_url = '';
var next_video_provider_url = '';
var user_is_freq_capped = 'notcapped';
var redir_url = '[REDIR]';
var _unruly_campaign_id = "138813221";
var partner = "unruly_html5_mobile";
var provider = "110";
var airport_code = "OVA";
var video_play = false;
var tHandle = 0;
if ((navigator.userAgent.indexOf('iPhone') != -1 )|| (navigator.userAgent.indexOf('Android') != -1 )){
addEventListener("load", function() {
setTimeout(hideURLbar, 0);
}, false);
}
function hideURLbar() {
window.scrollTo(0, 1);
}
function isLaptop() {
if (
(navigator.userAgent.indexOf('iPhone') != -1 ) ||
(navigator.userAgent.indexOf('Android') != -1 ) ||
(navigator.userAgent.indexOf('iPad') != -1 ) ||
(navigator.userAgent.indexOf('iPod') != -1 )
){
return false;
}
return true;
}
function showSkip() {
var e = document.getElementById('skip_button');
e.innerHTML = "<a href='[REDIR]'>Skip &#187;</a>";
e.style.display = "block";
}
function finishVideo() {
var e = document.getElementById('finish_div');
e.innerHTML = '<div class="finish_box_large"><br>Thank You.<br><br>You are now connected to the internet.<br><br><img src="http://local.jiwire.com/jwindr.jiwire.com/current//images/a4a/FinishButtonBig.png" onclick="finishClick();" /></div>';
e.className = "finish_show";
}
function reminderVideo() {
var e = document.getElementById('finish_div');
e.innerHTML = '<div class="finish_box_large"><br><b>Do you need more time?</b><br><br><br>Press the <span class="play_button_text">PLAY BUTTON</span> to watch<br><br>the video and get connected.<br><br><img src="http://local.jiwire.com/jwindr.jiwire.com/current//images/a4a/OKButtonBig.png" onclick="reminderClick();" /></div>';
e.className = "finish_show";
}
function reminderClick() {
var e = document.getElementById('finish_div');
e.className = "finish_hide";
tHandle = setTimeout("finishClick()",15000);
}
function writeMsg(msgtxt) {
return;
var txt = document.getElementById('msg1').innerHTML;
var d = new Date();
txt += "<br>"+d+":";
txt += msgtxt;
document.getElementById('msg1').innerHTML = txt;
}
function playCheck(failCode) {
if (video_play == false) {
if (failCode == 3 && next_video_provider_url.length > 0) {
writeMsg('video_play false, failcode 3 (capped) and next_video_provider is not null');
window.location='http://local.jiwire.com/jiwire/utilities/tclick.php?action=22103&dsp_id='+ partner +'&ex1=' + airport_code + '&ex2=' + failCode + '&r='+encodeURIComponent(next_video_provider_url);
} else if (failCode == 3 && apps_for_access_url.length > 0) {
writeMsg('video_play false, failcode 3 and apps_for_access is not null');
window.location='http://local.jiwire.com/jiwire/utilities/tclick.php?action=22103&dsp_id='+ partner +'&ex1=' + airport_code + '&ex2=' + failCode + '&r='+encodeURIComponent(apps_for_access_url);
} else if (failCode == 3) {
writeMsg('video_play false, failcode 3 and go to redirurl');
window.location='http://local.jiwire.com/jiwire/utilities/tclick.php?action=22103&dsp_id='+ partner +'&ex1=' + airport_code + '&ex2=' + failCode + '&r='+encodeURIComponent(redir_url);
} else if (failCode == 2 && next_video_provider_url.length > 0) {
writeMsg('video_play false, failcode 2 and next_video_provider is not null');
window.location='http://local.jiwire.com/jiwire/utilities/tclick.php?action=22103&dsp_id='+ partner +'&ex1=' + airport_code + '&ex2=' + failCode + '&r='+encodeURIComponent(next_video_provider_url);
} else {
writeMsg('video_play false, failcode == '+failCode);
reminderVideo();
showSkip();
}
}
}
function setcookie(name,value,expiry,path)
{
//format is: cookename=cookievalue; expires=GMTString; path=/
cookie = name+"="+encodeURIComponent(value);
if(expiry != null) {
var date = new Date ();
date.setSeconds( date.getSeconds() + expiry ); //add seconds to date
cookie +="; expires="+date.toGMTString();
}
if(path == null)
path ="/";
cookie += "; path="+path;
document.cookie =cookie; // set the cookie
}
function unrulyIframeCallback(msg) {
var img = new Image();
if (msg == "play") {
clearTimeout(tHandle);
video_play = true;
writeMsg('video_play true');
img.src = 'http://local.jiwire.com/jiwire/track/ct2.php?action=22109&campaign_id='+ partner +'&ex1=' + airport_code + '&ex2=pct-0';
if (isLaptop() && provider == "150")
setTimeout("showSkip();", 15000);
} else if (msg == 'complete') {
img.src = 'http://local.jiwire.com/jiwire/track/ct2.php?action=22109&campaign_id='+ partner + '&ex1=' + airport_code + '&ex2=pct-100';
setcookie("jw_indrvidcap","capped",86400);
setTimeout("finishVideo();",3000);
}
}
function finishClick() {
window.location = "[REDIR]";
}
function cAndB(failCode)
{
var all = document.getElementsByTagName("*");
var bFound = false;
for (var i=0, max=all.length; i < max; i++) {
if (all[i].tagName == 'IFRAME') {
var url = all[i].src;
if( (url.indexOf("unrulymedia.com") !== -1) && (url.indexOf(_unruly_campaign_id) !== -1) ) {
bFound = true;
}
}
}
if (bFound == false) {
// did not load or took too long to load
if (failCode == 1 && apps_for_access_url.length > 0) {
writeMsg('candb 1');
window.location='http://local.jiwire.com/jiwire/utilities/tclick.php?action=22103&dsp_id='+ partner +'&ex1=' + airport_code + '&ex2=' + failCode + '&r='+encodeURIComponent(apps_for_access_url);
} else {
writeMsg('candb but not 1');
window.location='http://local.jiwire.com/jiwire/utilities/tclick.php?action=22103&dsp_id='+ partner +'&ex1=' + airport_code + '&ex2=' + failCode + '&r='+encodeURIComponent('[REDIR]');
}
}
writeMsg('loaded ok');
tHandle = setTimeout('playCheck(2);',15000);
}
var unrulyMacros = {};
var domain = window.location.hostname;
unrulyMacros.play = "iframe_http://"+domain+"/jiwire/unruly/unruly_callback.php?action=play";
unrulyMacros.complete = "iframe_http://"+domain+"/jiwire/unruly/unruly_callback.php?action=complete";
if (user_is_freq_capped == 'capped')
playCheck(3);
else
setTimeout('cAndB(1);',12000);
</script>
<title>Wi-Fi Internet Access</title>
</head>
<body>
<div id="body">
<!-- content/110/content_unruly_mobile.php -->
<div id="header" data-tap-toggle="false" data-role="header" data-position="fixed">
<div class="texture" style="height:25px;background-color:#81cb2a">
<div style="margin-top:2px;text-align:center;">Wi-Fi Internet Access</div>
</div>
<div id="texture_header"><div id="skip_button">Skip &#187;</div></div>
</div>
<div id="main" style="width:auto;height:480px;">
<div style="width:auto;height:80px;font-weight:900;padding-top:30px">
Press the <span class="play_button_text">PLAY BUTTON</span> below and<br>watch the video to get connected.
</div>
<div id="finish_div" class="finish_hide">
<div class="finish_box_large">
</div>
</div>
<script type="text/javascript">
document.write('<script type="text/javascript" src="http://video.unrulymedia.com/wildfire_'+_unruly_campaign_id+'.js"></scr'+'ipt>');
</script>
</div>
<iframe id="ifm" style="position:absolute;top:-5000px;left:-5000px;" width="1" height="1" src="http://local.jiwire.com/jiwire/track/ct2.php?action=22104&campaign_id=unruly_html5_mobile&ex1=OVA&ex2=1377557463967355dff0430386284dc8550e3b7c96dc7"></iframe>
</div>
<br>
<div id="msg1"></div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment