XPLAN loadbalancer error page
by paulftw
HTML
<div id='loadingmsg'>
Loading...
</div>
<div id=defaultmsg>
<h1>Default Error Message</h1>
Service is temporarily unavailable.<br/>
Please contact your network administrator.
<pre>
Setup instructions:
cd %TMP%
mkdir xplan_messages
echo window.SetMsg('JSFiddle Custom Message'); > xplan_messages\fiddle.jshell.net.js
python -m SimpleHTTPServer
</pre>
</div>
<div id=custommsg>
</div>
CSS
pre {
margin-top: 64px;
background-color: #eee;
border: 2px dashed #aaa;
border-radius: 6px;
padding: 16px;
}
JavaScript
var msg_loaded = false;
window.SetMsg = function(msg) {
msg_loaded = true;
$('#custommsg').html(msg).fadeIn();
$('#defaultmsg').hide();
$('#loadingmsg').hide();
};
window.setTimeout(function() {
if (!msg_loaded) {
$('#defaultmsg').fadeIn();
$('#loadingmsg').hide();
}
}, 2000);
$(function() {
$('#custommsg').hide();
$('#defaultmsg').hide();
var js_addr = 'http://127.0.0.1:8000/xplan_messages/' +
window.location.host + '.js';
/**
* URL localhost:8000/xplan_messages/fiddle.jshell.net.js
* should be a static file with text:
* window.SetMsg('JSFiddle Custom Message');
*/
var script = document.createElement('script');
script.type= 'text/javascript';
script.src= js_addr;
$('body').append(script);
});