Created
December 18, 2017 08:58
-
-
Save matt-/d1360a50e29d88650f840f5fc634066c to your computer and use it in GitHub Desktop.
Embedded Javascript from Southwest Flight
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var r44_btime = r44_btime || new Date(); | |
var r44_btimems = r44_btime.getTime()/1000; | |
var r44_smu_time = r44_smu_time || new Date().getTime(); | |
var r44_is_cached = r44_is_cached || false; | |
var r44_retime, r44_retimems, r44_letime; | |
var r44_enable = (window.location != window.parent.location) ? false : true; | |
var R44 = R44 || {}; | |
R44.domain = R44.domain || ''; | |
if (!R44.domain.length) { | |
R44.domain='http://getconnected.southwestwifi.com'; | |
} | |
R44.htmlportallink='<a href="'+R44.domain+'" alt="back to portal"><img src="'+R44.domain+'/images/s-w-logo.png" alt="Southwest" /></a>'; | |
R44.htmlunbheadermin='<div id="r44unbheadermin" style="display:none;" >' + | |
'<span id="r44unbshow"><a href="#"><img class="r44unbcontrol" src="'+R44.domain+'/images/forward.svg" alt=">"/></a></span>' + | |
'<div class="r44unbcontent">' + | |
'<div id="r44unbheaderinfo" class="r44unbrow">'+R44.htmlportallink +'</div>' + | |
'</div>' + | |
'</div>'; | |
R44.htmlunbheader='<div id="r44unbheader" style="display:none;">' + | |
'<span id="r44unbhide"><a href="#"><img class="r44unbcontrol" src="'+R44.domain+'/images/back.svg" alt="<"/></a></span>' + | |
'<div class="r44unbcontent">' + | |
'<div id="r44unbheaderinfo" class="r44unbrow">'+R44.htmlportallink +'</div>' + | |
'<div class="r44unbrow"><span id="c_ttgc"> - </span></div>' + | |
'</div>' + | |
'</div>'; | |
R44.htmladaptor=R44.htmlunbheadermin + R44.htmlunbheader; | |
R44.createadaptor=function() { | |
var f=document.createDocumentFragment(); | |
var e=document.createElement('div'); | |
e.innerHTML = R44.htmladaptor; | |
while (e.firstChild) { | |
f.appendChild(e.firstChild); | |
} | |
return f; | |
}; | |
R44.current_callback=function(response) { | |
if (response.ttgc) { jqr44('#c_ttgc').text(response.ttgc + ' remaining'); } | |
}; | |
R44.m_callback=function(response) { | |
if (response.unb_state) { R44.show_unb(); } else { R44.hide_unb(); } | |
}; | |
R44.m_call=function() { | |
var c_url = R44.domain+'/mp.json'; | |
jqr44.ajax({ | |
url: c_url, | |
dataType: 'jsonp', | |
jsonpCallback: 'R44.m_callback', | |
error: function(results){ | |
} | |
}); | |
}; | |
R44.at_call=function(data) { | |
var c_url = R44.domain+'/ap.json'; | |
jqr44.ajax({ | |
url: c_url, | |
data: data, | |
dataType: 'jsonp', | |
error: function(results){ | |
} | |
}); | |
}; | |
R44.unb_call=function(data) { | |
var c_url = R44.domain+'/unb.json'; | |
jqr44.ajax({ | |
url: c_url, | |
data: data, | |
dataType: 'jsonp', | |
error: function(results){ | |
} | |
}); | |
}; | |
R44.current_call=function() { | |
var c_url = R44.domain+'/currentp.json'; | |
jqr44.ajax({ | |
url: c_url, | |
dataType: 'jsonp', | |
jsonpCallback: 'R44.current_callback', | |
error: function(results){ | |
} | |
}); | |
}; | |
R44.show_unb=function() { | |
jqr44("#r44unbheadermin").hide(); | |
jqr44("#r44unbheader").show(); | |
}; | |
R44.hide_unb=function() { | |
jqr44("#r44unbheader").hide(); | |
jqr44("#r44unbheadermin").show(); | |
}; | |
R44.set_unb=function() { | |
var max_index=2147483647; | |
var o_layers=jqr44('div').filter(function(){ return (jqr44(this).css('z-index') == max_index && jqr44(this).attr('id')!="r44unbheader" && jqr44(this).attr('id')!= "r44unbheadermin")}) | |
o_layers.css({"z-index":max_index-10}) | |
}; | |
jqr44(document).ready(function() { | |
r44_retime = new Date(); | |
r44_retimems = r44_retime.getTime()/1000; | |
if (!r44_enable) return; | |
if (r44_enable) { document.body.appendChild(R44.createadaptor()); } | |
R44.m_call(); | |
R44.set_unb(); | |
jqr44('#r44unbhide').click(function(e) { | |
R44.hide_unb(); | |
R44.unb_call({'s':false}); | |
e.preventDefault(); | |
}); | |
jqr44('#r44unbshow').click(function(e) { | |
R44.show_unb(); | |
R44.unb_call({'s':true}); | |
e.preventDefault(); | |
}); | |
R44.current_call();setInterval(function() { R44.current_call(); }, 120000); | |
}); | |
jqr44(window).load(function() { | |
if (!r44_enable) return; | |
r44_letime = new Date(); | |
r44_letimems = r44_letime.getTime()/1000; | |
var r44_ltime = r44_letimems-r44_btimems; | |
var r44_rtime = r44_retimems-r44_btimems; | |
var r44data = {"url":window.location.href, "smu_start_time": r44_smu_time, "js_start_time":r44_btimems, "js_load_time":r44_ltime, "js_ready_time":r44_rtime, "is_cached": r44_is_cached}; | |
R44.at_call(r44data); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment