diff --git a/src/Money.Blazor.Host/wwwroot/js/site.js b/src/Money.Blazor.Host/wwwroot/js/site.js index 2cefe7f3..ad29d678 100644 --- a/src/Money.Blazor.Host/wwwroot/js/site.js +++ b/src/Money.Blazor.Host/wwwroot/js/site.js @@ -67,10 +67,12 @@ window.PullToRefresh = { Initialize: function (interop) { window.PullToRefresh._interop = interop; + const refreshTreshold = 200; let _isActive = false; let _startY; let _maxY = 0; let container = document.body; + const listenerOptions = { passive: true }; container.addEventListener('touchstart', e => { _startY = 0; @@ -82,20 +84,19 @@ window.PullToRefresh = { } else { _isActive = false; } - }, { passive: true }); + }, listenerOptions); container.addEventListener('touchmove', e => { const y = e.touches[0].pageY; _maxY = Math.floor(y); - }, { passive: true }); + }, listenerOptions); container.addEventListener("touchend", () => { const delta = Math.floor(_maxY - _startY); - if (_isActive && delta > 100) { - //alert(`Start '${_startY}', Max '${_maxY}', Delta '${delta}'`); + if (_isActive && delta > refreshTreshold) { window.PullToRefresh.Raise(); } - }, { passive: true }); + }, listenerOptions); }, Raise: function() { window.PullToRefresh._interop.invokeMethodAsync("PullToRefresh.Pulled"); diff --git a/src/Money.Blazor.Host/wwwroot/js/site.min.js b/src/Money.Blazor.Host/wwwroot/js/site.min.js index de64e253..2e7a529a 100644 --- a/src/Money.Blazor.Host/wwwroot/js/site.min.js +++ b/src/Money.Blazor.Host/wwwroot/js/site.min.js @@ -1 +1 @@ -"use strict";var isStarted=!1,isLoaded=!1;window.Bootstrap={Modal:{Show:function(n){$(n).modal({show:!0,focus:!0}).on("shown.bs.modal",function(){$(n).find("[data-autofocus]").first().trigger("focus")})},Hide:function(n){$(n).modal("hide")},Dispose:function(n){$(n).modal("dispose")}}};window.Network={Initialize:function(n){function t(){n.invokeMethodAsync("Network.StatusChanged",navigator.onLine)}window.addEventListener("online",t);window.addEventListener("offline",t);navigator.onLine||t(navigator.onLine)}};window.Money={ApplicationStarted:function(){isLoaded=!0},NavigateTo:function(n){return window.location.href=n,!0},SaveToken:function(n){"localStorage"in window&&(n==null?window.localStorage.removeItem("token"):window.localStorage.setItem("token",n))},LoadToken:function(){return"localStorage"in window?window.localStorage.getItem("token"):null},AnimateSplash:function(){setTimeout(function(){$(".splash").addClass("animate")},300)}};window.PullToRefresh={Initialize:function(n){window.PullToRefresh._interop=n;var t=!1,i=undefined,r=0,u=document.body;u.addEventListener("touchstart",function(n){i=0;r=0;document.scrollingElement.scrollTop===0?(i=Math.floor(n.touches[0].pageY),t=!0):t=!1},{passive:!0});u.addEventListener("touchmove",function(n){var t=n.touches[0].pageY;r=Math.floor(t)},{passive:!0});u.addEventListener("touchend",function(){var n=Math.floor(r-i);t&&n>100&&window.PullToRefresh.Raise()},{passive:!0})},Raise:function(){window.PullToRefresh._interop.invokeMethodAsync("PullToRefresh.Pulled")}}; \ No newline at end of file +"use strict";var isStarted=!1,isLoaded=!1;window.Bootstrap={Modal:{Show:function(n){$(n).modal({show:!0,focus:!0}).on("shown.bs.modal",function(){$(n).find("[data-autofocus]").first().trigger("focus")})},Hide:function(n){$(n).modal("hide")},Dispose:function(n){$(n).modal("dispose")}}};window.Network={Initialize:function(n){function t(){n.invokeMethodAsync("Network.StatusChanged",navigator.onLine)}window.addEventListener("online",t);window.addEventListener("offline",t);navigator.onLine||t(navigator.onLine)}};window.Money={ApplicationStarted:function(){isLoaded=!0},NavigateTo:function(n){return window.location.href=n,!0},SaveToken:function(n){"localStorage"in window&&(n==null?window.localStorage.removeItem("token"):window.localStorage.setItem("token",n))},LoadToken:function(){return"localStorage"in window?window.localStorage.getItem("token"):null},AnimateSplash:function(){setTimeout(function(){$(".splash").addClass("animate")},300)}};window.PullToRefresh={Initialize:function(n){window.PullToRefresh._interop=n;var e=200,t=!1,i=undefined,r=0,u=document.body,f={passive:!0};u.addEventListener("touchstart",function(n){i=0;r=0;document.scrollingElement.scrollTop===0?(i=Math.floor(n.touches[0].pageY),t=!0):t=!1},f);u.addEventListener("touchmove",function(n){var t=n.touches[0].pageY;r=Math.floor(t)},f);u.addEventListener("touchend",function(){var n=Math.floor(r-i);t&&n>e&&window.PullToRefresh.Raise()},f)},Raise:function(){window.PullToRefresh._interop.invokeMethodAsync("PullToRefresh.Pulled")}}; \ No newline at end of file