Fix JS redirector error (fixes: #1230)

This commit is contained in:
Xavier Guimard 2017-04-27 13:49:29 +00:00
parent 56254f1d4f
commit 2e5755744f
4 changed files with 40 additions and 2 deletions

View File

@ -0,0 +1,10 @@
document.onreadystatechange = () ->
if document.readyState == "complete"
redirect = document.getElementById('redirect').textContent.replace /\s/g, ''
if redirect
if redirect == 'form'
document.getElementById('form').submit()
else
document.location.href = redirect
else
console.log 'No redirection !'

View File

@ -0,0 +1,19 @@
// Generated by CoffeeScript 1.10.0
(function() {
document.onreadystatechange = function() {
var redirect;
if (document.readyState === "complete") {
redirect = document.getElementById('redirect').textContent.replace(/\s/g, '');
if (redirect) {
if (redirect === 'form') {
return document.getElementById('form').submit();
} else {
return document.location.href = redirect;
}
} else {
return console.log('No redirection !');
}
}
};
}).call(this);

View File

@ -0,0 +1 @@
(function(){document.onreadystatechange=function(){var a;if(document.readyState==="complete"){a=document.getElementById("redirect").textContent.replace(/\s/g,"");if(a){if(a==="form"){return document.getElementById("form").submit()}else{return document.location.href=a}}else{return console.log("No redirection !")}}}}).call(this);

View File

@ -8,13 +8,21 @@
<meta http-equiv="cache-control" content="no-cache" />
<link href="<TMPL_VAR NAME="STATIC_PREFIX">common/favicon.ico" rel="icon" type="image/x-icon" />
<link href="<TMPL_VAR NAME="STATIC_PREFIX">common/favicon.ico" rel="shortcut icon" />
<!-- //if:jsminified
<script type="text/javascript" src="<TMPL_VAR NAME="STATIC_PREFIX">/common/js/redirect.min.js"></script>
//else -->
<script type="text/javascript" src="<TMPL_VAR NAME="STATIC_PREFIX">/common/js/redirect.js"></script>
<!-- //endif -->
</head>
<body>
<script id="redirect" type="custom">
<TMPL_IF NAME="HIDDEN_INPUTS">
<body onload="document.getElementById('form').submit()">
form
<TMPL_ELSE>
<body onload="document.location.href='<TMPL_VAR NAME="URL">'">
<TMPL_VAR NAME="URL">
</TMPL_IF>
</script>
<h1 trspan="redirectionInProgres">Redirection in progress...</h1>
<noscript>