gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] [taler-backoffice] branch master updated: Scrolling feature


From: gnunet
Subject: [GNUnet-SVN] [taler-backoffice] branch master updated: Scrolling feature.
Date: Wed, 06 Jun 2018 22:38:42 +0200

This is an automated email from the git hooks/post-receive script.

marcello pushed a commit to branch master
in repository backoffice.

The following commit(s) were added to refs/heads/master by this push:
     new b19c24c  Scrolling feature.
b19c24c is described below

commit b19c24c0cabfb8b25a16d816b806d1dc51069721
Author: Marcello Stanisci <address@hidden>
AuthorDate: Wed Jun 6 22:36:50 2018 +0200

    Scrolling feature.
    
    Disabling the scrolling feature after the
    page gets filled by /track/transaction results.
    Such results are not guaranteed to be sorted
    in any way, so there is little point in scrolling
    down towards "older" results.
    
    The scrolling feature will be re-enabled once
    the page will again be filled with results from
    /history - notably, on page refresh.
---
 js/backoffice.js | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/js/backoffice.js b/js/backoffice.js
index 82b0ae6..35e5c88 100644
--- a/js/backoffice.js
+++ b/js/backoffice.js
@@ -31,6 +31,7 @@ var FRACTION = 100000000;
 var START = 0;
 var DELTA = 5
 var LAST = 0;
+var SCROLL = true;
 
 /**
  * This function *could* "type check" 'amount',
@@ -161,6 +162,13 @@ var track_transfer = function(exchange, wtid, cb){
     if(4 == req.readyState){
       switch(req.status){
       case 200:
+        /* Scroll is disabled after showing /track/transfer
+         * results on the page; that's because those results
+         * are not guaranteed to be sorted any how, so there
+         * is little to no point in scrolling towards "older"
+         * results: older than what?  The scroll feature will
+         * be re-enabled from the /history callback.  */
+        SCROLL = false;
         var tracks = JSON.parse(req.responseText);
         cb(false,
            tracks.deposits_sums,
@@ -538,6 +546,7 @@ function change_instance(){
  * to 'fill_table()'.
  */
 function get_history(scroll, cb){
+  SCROLL = true;
   var qs = `/history?instance=${get_instance()}&delta=${DELTA}`;
   if(scroll){
     START = LAST;
@@ -579,8 +588,8 @@ document.addEventListener
 document.addEventListener
   ("scroll", function(){
   /* If page bottom is hit */
-  if(window.innerHeight + window.scrollY
-       >= document.body.offsetHeight)
+  if((window.innerHeight + window.scrollY
+       >= document.body.offsetHeight) && SCROLL)
     get_history(true, fill_table);
   });
 

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]