From cf09251a9071bf8b84bb027a0b6fbbf0e72ea2ed Mon Sep 17 00:00:00 2001 From: mrilyew <99399973+mrilyew@users.noreply.github.com> Date: Fri, 23 May 2025 21:36:51 +0300 Subject: [PATCH] feat(ajax): show loading cursor --- Web/static/css/main.css | 4 ++++ Web/static/js/router.js | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Web/static/css/main.css b/Web/static/css/main.css index 0332d278..cc63a36f 100644 --- a/Web/static/css/main.css +++ b/Web/static/css/main.css @@ -14,6 +14,10 @@ body { line-height: 1.19; } +body.ajax_request_made { + cursor: progress; +} + body, .ovk-fullscreen-dimmer, .ovk-photo-view-dimmer { scrollbar-gutter: stable both-edges; } diff --git a/Web/static/js/router.js b/Web/static/js/router.js index 2a3a6c6a..4882926a 100644 --- a/Web/static/js/router.js +++ b/Web/static/js/router.js @@ -202,7 +202,7 @@ window.router = new class { if(this.prev_page_html && this.prev_page_html.pathname != location.pathname) { this.prev_page_html = null } - + const push_url = params.push_state ?? true const next_page_url = new URL(url) if(push_url) { @@ -210,6 +210,8 @@ window.router = new class { } else { history.replaceState({'from_router': 1}, '', url) } + + u('body').addClass('ajax_request_made') const parser = new DOMParser const next_page_request = await fetch(next_page_url, { @@ -227,6 +229,8 @@ window.router = new class { this.__closeMsgs() this.__unlinkObservers() + + u('body').removeClass('ajax_request_made') try { this.__appendPage(parsed_content)