From 169068362a8c00c23a83264c8c02941680f4dc71 Mon Sep 17 00:00:00 2001 From: Razmig Sarkissian Date: Thu, 3 Aug 2023 23:22:57 +0200 Subject: [PATCH] fix auto scroll --- scores/templates/scores/brackets.html | 15 +---- scores/templates/scores/ranks.html | 17 ++---- scores/templates/scores/teams.html | 17 ++---- scores/templates/scores/tournament.html | 73 +++++++++++-------------- 4 files changed, 43 insertions(+), 79 deletions(-) diff --git a/scores/templates/scores/brackets.html b/scores/templates/scores/brackets.html index fb89906..6facf16 100644 --- a/scores/templates/scores/brackets.html +++ b/scores/templates/scores/brackets.html @@ -32,14 +32,6 @@ } else { iScrollInterval = iScroll * 10; } - var fade = function() { - $("body").fadeOut(iFadeInterval, function(){ - $("html, body").scrollTop(0); - $("body").fadeIn(iFadeInterval,function(){ - setTimeout(loop, iInterval); - }); - }); - } var loop = function() { var iScroll = $(document).height() - $(window).height(); @@ -54,12 +46,11 @@ duration : iScrollInterval, easing : "linear", complete : function() { - setTimeout(fade, iInterval); + setTimeout(function(){ + window.location.reload(); + }, iInterval); } }); - setTimeout(function(){ - window.location.reload(); - }, Math.max(iScrollInterval * 10 + 2000, 15000)); }; setTimeout(loop, iInterval); diff --git a/scores/templates/scores/ranks.html b/scores/templates/scores/ranks.html index 0ca49e1..6a9d577 100644 --- a/scores/templates/scores/ranks.html +++ b/scores/templates/scores/ranks.html @@ -15,7 +15,7 @@ Padel {% if tv %} -
+
{% else %}
{% endif %} @@ -33,14 +33,6 @@ } else { iScrollInterval = iScroll * 10; } - var fade = function() { - $("body").fadeOut(iFadeInterval, function(){ - $("html, body").scrollTop(0); - $("body").fadeIn(iFadeInterval,function(){ - setTimeout(loop, iInterval); - }); - }); - } var loop = function() { var iScroll = $(document).height() - $(window).height(); @@ -55,12 +47,11 @@ duration : iScrollInterval, easing : "linear", complete : function() { - setTimeout(fade, iInterval); + setTimeout(function(){ + window.location.reload(); + }, iInterval); } }); - setTimeout(function(){ - window.location.reload(); - }, Math.max(iScrollInterval * 10 + 2000, 15000)); }; setTimeout(loop, iInterval); diff --git a/scores/templates/scores/teams.html b/scores/templates/scores/teams.html index b59705e..b4eb7db 100644 --- a/scores/templates/scores/teams.html +++ b/scores/templates/scores/teams.html @@ -15,7 +15,7 @@ Padel {% if tv %} -
+
{% else %}
{% endif %} @@ -33,14 +33,6 @@ } else { iScrollInterval = iScroll * 10; } - var fade = function() { - $("body").fadeOut(iFadeInterval, function(){ - $("html, body").scrollTop(0); - $("body").fadeIn(iFadeInterval,function(){ - setTimeout(loop, iInterval); - }); - }); - } var loop = function() { var iScroll = $(document).height() - $(window).height(); @@ -55,12 +47,11 @@ duration : iScrollInterval, easing : "linear", complete : function() { - setTimeout(fade, iInterval); + setTimeout(function(){ + window.location.reload(); + }, iInterval); } }); - setTimeout(function(){ - window.location.reload(); - }, Math.max(iScrollInterval * 10 + 2000, 15000)); }; setTimeout(loop, iInterval); diff --git a/scores/templates/scores/tournament.html b/scores/templates/scores/tournament.html index 6270ae2..86e16e7 100644 --- a/scores/templates/scores/tournament.html +++ b/scores/templates/scores/tournament.html @@ -22,47 +22,38 @@ {% if tv %} + var iInterval = 2000; + var iScrollInterval = 10000; + var iFadeInterval = 500; + var iScroll = $(document).height() - $(window).height(); + + if (iScroll * 10 + 4000 < 15000) { + iScrollInterval = 10000; + } else { + iScrollInterval = iScroll * 10; + } + + var loop = function() { + var iScroll = $(document).height() - $(window).height(); + if (iScroll * 10 + 4000 < 15000) { + iScrollInterval = 10000; + } else { + iScrollInterval = iScroll * 10; + } + $("html, body").animate({ + scrollTop: iScroll + }, { + duration : iScrollInterval, + easing : "linear", + complete : function() { + setTimeout(function(){ + window.location.reload(); + }, iInterval); + } + }); + }; + setTimeout(loop, iInterval); + {% endif %} {% if tournament.club.header %}