Tweak PWA mobile loading indicator
* Don't show the loading indicator when intercepted href="#" links have been clicked (e.g. like buttons, settings tabs)
This commit is contained in:
parent
def9f6ddcf
commit
2cf4405ce0
|
@ -16,7 +16,11 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||
const spinner = document.querySelector("#nonshy-pwa-loader");
|
||||
(document.querySelectorAll("a, form") || []).forEach(node => {
|
||||
// Links: only on-site ones.
|
||||
if (node.tagName === 'A' && node.target === '_blank') return;
|
||||
if (node.tagName === 'A') {
|
||||
let href = node.attributes.href?.textContent;
|
||||
if (!href) return;
|
||||
if (node.target === '_blank' || href.indexOf('#') === 0 || href.indexOf(location.pathname) === 0) return;
|
||||
}
|
||||
|
||||
// Show our spinner on click or submit.
|
||||
node.addEventListener(node.tagName === 'A' ? 'click' : 'submit', () => {
|
||||
|
|
Loading…
Reference in New Issue
Block a user