function ws() { setTimeout(() => { if(document.querySelector('.active .webview-navigation#Tab')){ // Check if the tab has the navigation controls const WLSTA = () => {document.querySelector('.active .loading-indicator').style.opacity = '1'} const WLSTO = () => {document.querySelector('.active .loading-indicator').style.opacity = '0'} document.querySelector('.active webview').addEventListener('did-start-loading', WLSTA) document.querySelector('.active webview').addEventListener('did-stop-loading', WLSTO) } else { // Don't do anything if the tab has no navigation controls } }, 0200) }