Commit ef3663cb authored by Clément OUDOT's avatar Clément OUDOT
Browse files

Move info and confirm timer javascript code out of HTML templates (#683)

parent f887220e
......@@ -50,23 +50,7 @@
<p id="timer"><lang en="Automatically accept in 5 seconds" fr="Acceptation automatique dans 5 secondes"/></p>
</div>
<script>
var i=5;
function go() {
$("#form").submit();
}
function timer() {
var h=$('#timer').html();
if(i>0){i--;}
h=h.replace(/\d+/,i);
$('#timer').html(h);
window.setTimeout('timer()',1000);
}
$(document).ready(function(){
window.setTimeout('go()',5000);
window.setTimeout('timer()',1000);
});
</script>
<script type="text/javascript" src="<TMPL_VAR NAME="SKIN_PATH">/common/js/confirm.js"></script>
</TMPL_IF>
<div class="buttons">
......
......@@ -55,6 +55,7 @@
var antiframe="<TMPL_VAR NAME="ANTIFRAME">";
var appslistorder="<TMPL_VAR NAME="APPSLIST_ORDER">";
var scriptname="<TMPL_VAR NAME="SCRIPT_NAME">";
var activeTimer="<TMPL_VAR NAME="ACTIVE_TIMER">";
//]]></script>
<script type="text/javascript" src="<TMPL_VAR NAME="SKIN_PATH">/common/js/portal.js"></script>
<script src="<TMPL_VAR NAME="SKIN_PATH">/<TMPL_VAR NAME="SKIN">/js/bootstrap.min.js"></script>
......
......@@ -29,38 +29,7 @@
</button>
</div>
</form>
<script>
var i=10;
var _go=1;
function stop() {
_go=0;
$('#timer').html("...");
}
function go() {
if(_go) {
$("#form").submit();
}
}
function timer() {
var h=$('#timer').html();
if(i>0){i--;}
h=h.replace(/\d+/,i);
$('#timer').html(h);
window.setTimeout('timer()',1000);
}
$(document).ready(function(){
// Check if timer should be activated (true by default)
var activeTimer = true;
if (!<TMPL_VAR NAME="ACTIVE_TIMER">) {activeTimer = false;}
if (activeTimer) {
window.setTimeout('go()',10000);
window.setTimeout('timer()',1000);
} else {
stop();
}
});
</script>
<script type="text/javascript" src="<TMPL_VAR NAME="SKIN_PATH">/common/js/info.js"></script>
</div>
......
/* Timer for confirmation page */
var i = 5;
function go() {
$("#form").submit();
}
function timer() {
var h = $('#timer').html();
if (i > 0) {
i--;
}
h = h.replace(/\d+/, i);
$('#timer').html(h);
window.setTimeout('timer()', 1000);
}
$(document).ready(function() {
window.setTimeout('go()', 5000);
window.setTimeout('timer()', 1000);
});
/* Timer for information page */
var i = 10;
var _go = 1;
function stop() {
_go = 0;
$('#timer').html("...");
}
function go() {
if (_go) {
$("#form").submit();
}
}
function timer() {
var h = $('#timer').html();
if (i > 0) {
i--;
}
h = h.replace(/\d+/, i);
$('#timer').html(h);
window.setTimeout('timer()', 1000);
}
$(document).ready(function() {
if (activeTimer) {
window.setTimeout('go()', 10000);
window.setTimeout('timer()', 1000);
} else {
stop();
}
});
......@@ -33,6 +33,13 @@ if (antiframe.match('0')) {
antiframe = true;
}
/* Set activeTimer value (default is true) */
if (activeTimer.match('0')) {
activeTimer = false;
} else {
activeTimer = true;
}
/* jQuery */
$(document).ready(function() {
......
......@@ -10,24 +10,8 @@
<TMPL_UNLESS NAME="LIST"><TMPL_IF NAME="ACTIVE_TIMER">
<p id="timer" class="text-error"><lang en="Automaticaly accept in 5 seconds" fr="Acceptation automatique dans 5 secondes"/></p>
<script>
var i=5;
function go() {
$("#form").submit();
}
function timer() {
var h=$('#timer').html();
if(i>0){i--;}
h=h.replace(/\d+/,i);
$('#timer').html(h);
window.setTimeout('timer()',1000);
}
$(document).ready(function(){
window.setTimeout('go()',5000);
window.setTimeout('timer()',1000);
});
</script>
</TMPL_IF></TMPL_UNLESS>
<script type="text/javascript" src="<TMPL_VAR NAME="SKIN_PATH">/common/js/info.js"></script>
</TMPL_IF></TMPL_UNLESS>
<form id="form" action="#" method="<TMPL_VAR NAME="FORM_METHOD">" class="login">
<TMPL_VAR NAME="HIDDEN_INPUTS">
......
......@@ -47,6 +47,7 @@
var antiframe="<TMPL_VAR NAME="ANTIFRAME">";
var appslistorder="<TMPL_VAR NAME="APPSLIST_ORDER">";
var scriptname='<TMPL_VAR NAME="SCRIPT_NAME">';
var activeTimer="<TMPL_VAR NAME="ACTIVE_TIMER">";
//]]></script>
<script type="text/javascript" src="<TMPL_VAR NAME="SKIN_PATH">/common/js/portal.js"></script>
<TMPL_INCLUDE NAME="customhead.tpl">
......
......@@ -27,39 +27,8 @@
</form>
</div>
</div>
<script>
var i=10;
var _go=1;
function stop() {
_go=0;
$('#timer').html("...");
}
function go() {
if(_go) {
$("#form").submit();
}
}
function timer() {
var h=$('#timer').html();
if(i>0){i--;}
h=h.replace(/\d+/,i);
$('#timer').html(h);
window.setTimeout('timer()',1000);
}
$(document).ready(function(){
// Check if timer should be activated (true by default)
var activeTimer = true;
if (!<TMPL_VAR NAME="ACTIVE_TIMER">) {activeTimer = false;}
if (activeTimer) {
window.setTimeout('go()',10000);
window.setTimeout('timer()',1000);
} else {
stop();
}
});
</script>
<script type="text/javascript" src="<TMPL_VAR NAME="SKIN_PATH">/common/js/info.js"></script>
<TMPL_INCLUDE NAME="footer.tpl">
......@@ -41,23 +41,7 @@
<TMPL_IF NAME="ACTIVE_TIMER">
<p id="timer"><lang en="Automatically accept in 5 seconds" fr="Acceptation automatique dans 5 secondes"/></p>
<script>
var i=5;
function go() {
$("#form").submit();
}
function timer() {
var h=$('#timer').html();
if(i>0){i--;}
h=h.replace(/\d+/,i);
$('#timer').html(h);
window.setTimeout('timer()',1000);
}
$(document).ready(function(){
window.setTimeout('go()',5000);
window.setTimeout('timer()',1000);
});
</script>
<script type="text/javascript" src="<TMPL_VAR NAME="SKIN_PATH">/common/js/info.js"></script>
</TMPL_IF>
<table><tr><td>
......
......@@ -47,6 +47,7 @@
var antiframe="<TMPL_VAR NAME="ANTIFRAME">";
var appslistorder="<TMPL_VAR NAME="APPSLIST_ORDER">";
var scriptname="<TMPL_VAR NAME="SCRIPT_NAME">";
var activeTimer="<TMPL_VAR NAME="ACTIVE_TIMER">";
//]]></script>
<script type="text/javascript" src="<TMPL_VAR NAME="SKIN_PATH">/common/js/portal.js"></script>
<TMPL_INCLUDE NAME="customhead.tpl">
......
......@@ -26,38 +26,7 @@
</div>
</td></tr></tbody></table>
</form>
<script>
var i=10;
var _go=1;
function stop() {
_go=0;
$('#timer').html("...");
}
function go() {
if(_go) {
$("#form").submit();
}
}
function timer() {
var h=$('#timer').html();
if(i>0){i--;}
h=h.replace(/\d+/,i);
$('#timer').html(h);
window.setTimeout('timer()',1000);
}
$(document).ready(function(){
// Check if timer should be activated (true by default)
var activeTimer = true;
if (!<TMPL_VAR NAME="ACTIVE_TIMER">) {activeTimer = false;}
if (activeTimer) {
window.setTimeout('go()',10000);
window.setTimeout('timer()',1000);
} else {
stop();
}
});
</script>
<script type="text/javascript" src="<TMPL_VAR NAME="SKIN_PATH">/common/js/info.js"></script>
</div>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment