This is an automated email from the ASF dual-hosted git repository.

humbedooh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-ponymail-foal.git

commit fa5e39bf1524325eb251ad326e88de17bb6cde44
Author: Daniel Gruno <[email protected]>
AuthorDate: Wed Nov 17 21:01:22 2021 +0100

    regen JS
---
 webui/js/ponymail.js | 48 ++++++++++++++++++++++++++----------------------
 1 file changed, 26 insertions(+), 22 deletions(-)

diff --git a/webui/js/ponymail.js b/webui/js/ponymail.js
index f94ebe8..feb0df7 100644
--- a/webui/js/ponymail.js
+++ b/webui/js/ponymail.js
@@ -3194,7 +3194,7 @@ function init_preferences(state, json) {
     if (can_store) {
         let local_preferences = 
window.localStorage.getItem('ponymail_preferences');
         if (local_preferences) {
-            ljson = JSON.parse(local_preferences);
+            let ljson = JSON.parse(local_preferences);
             if (ljson.chatty_layout !== undefined) {
                 chatty_layout = ljson.chatty_layout;
             }
@@ -3301,6 +3301,7 @@ function set_skin_permalink(skin) {
     parse_permalink();
 }
 
+
 /******************************************
  Fetched from source/primer.js
 ******************************************/
@@ -4332,57 +4333,60 @@ async function sidebar_stats(json) {
  Fetched from source/swipe.js
 ******************************************/
 
-const SWIPE_THRESHOLD = 50;  // Need at least this long a swipe before we 
register it
-let xDown, yDown;
+const SWIPE_THRESHOLD = 50; // Need at least this long a swipe before we 
register it
+let xDown;
+let yDown;
 
 // touch/swipe begins                                                          
               
 function touchStart(evt) {
     let firstTouch = (evt.touches || evt.originalEvent.touches)[0];
-    xDown = firstTouch.clientX;                                      
-    yDown = firstTouch.clientY;                                      
+    xDown = firstTouch.clientX;
+    yDown = firstTouch.clientY;
 }
 
 // Touch/swipe ends
 function touchEnd(evt) {
-    if ( !xDown || !yDown ) {
-        return
-    }
-    let xUp = evt.changedTouches[0].clientX;                                   
 
+    if (!xDown || !yDown) return
+    let xUp = evt.changedTouches[0].clientX;
     let yUp = evt.changedTouches[0].clientY;
 
     let xDiff = Math.abs(xDown - xUp);
     let yDiff = Math.abs(yDown - yUp);
     let coords = {
         detail: {
-            swipestart: { coords: [xDown, yDown] },
-            swipestop: { coords: [xUp, yUp] }
+            swipestart: {
+                coords: [xDown, yDown]
+            },
+            swipestop: {
+                coords: [xUp, yUp]
+            }
         }
     };
     // If the swipe was too short, abort
-    if ( Math.sqrt(xDiff**2 + yDiff**2) < SWIPE_THRESHOLD ) return
-    
+    if (Math.sqrt(xDiff ** 2 + yDiff ** 2) < SWIPE_THRESHOLD) return
+
     // Which direction??
-    if ( xDiff > yDiff ) {
-        if ( xDiff > 0 ) {
+    if (xDiff > yDiff) {
+        if (xDiff > 0) {
             document.dispatchEvent(new CustomEvent("swipeleft", coords));
         } else {
             document.dispatchEvent(new CustomEvent("swiperight", coords));
-        }                       
+        }
     } else {
-        if ( yDiff > 0 ) {
+        if (yDiff > 0) {
             document.dispatchEvent(new CustomEvent("swipeup", coords));
-        } else { 
+        } else {
             document.dispatchEvent(new CustomEvent("swipedown", coords));
-        }                                                                 
+        }
     }
 
     xDown = null;
-    yDown = null;                                             
+    yDown = null;
 };
 
 function attachSwipe(elm) {
     console.log("Attaching swipe detector to element ", elm);
-    elm.addEventListener('touchstart', touchStart, false);        
-    elm.addEventListener('touchend', touchEnd, false);
+    elm.addEventListener("touchstart", touchStart, false);
+    elm.addEventListener("touchend", touchEnd, false);
 }
 

Reply via email to