From b623cf56838686daf6defb667ee1849bc143a752 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Thu, 21 Dec 2017 12:59:13 -0500 Subject: [PATCH] Bug 15492: (QA follow-up) Reset SCI if idle for 30 seconds Signed-off-by: Kyle M Hall Signed-off-by: Tomas Cohen Arazi Signed-off-by: Josef Moravec --- .../opac-tmpl/bootstrap/en/modules/sci/sci-main.tt | 26 +++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/sci/sci-main.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/sci/sci-main.tt index c33d6f4..85718e3 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/sci/sci-main.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/sci/sci-main.tt @@ -120,7 +120,7 @@
- +
[% ELSE %] @@ -242,6 +242,30 @@ // set focus at the beginning dofocus(); }); + + var idleTime = 0; + $(document).ready(function () { + //Increment the idle time counter every minute. + var idleInterval = setInterval(timerIncrement, 1000); // 1 second + + //Zero the idle timer on mouse movement. + $(this).mousemove(function (e) { + idleTime = 0; + }); + $(this).keypress(function (e) { + idleTime = 0; + }); + }); + + function timerIncrement() { + if ( $("#sci_finish_button").is(":visible") || $("#sci_refresh_button").is(":visible") ) { + idleTime = idleTime + 1; + if (idleTime >= 30 ) { // 30 seconds + if ( $("#sci_finish_button").is(":visible") ) $("#sci_finish_button").click(); + if ( $("#sci_refresh_button").is(":visible") ) $("#sci_refresh_button").click(); + } + } + } [% IF ( Koha.Preference('SCOUserJS') ) %][% END %] -- 2.1.4