Created
April 21, 2017 18:50
-
-
Save Maluen/c82581aaa488f73fdbe4d036e5e6f510 to your computer and use it in GitHub Desktop.
Extensions: simple heuristic way to check if the user is logged in (in any page)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default function isPageLoggedIn() { | |
return Boolean(Array.from(document.body.querySelectorAll('a, button')).find(el => { | |
return el.innerText && el.innerText.match(/sign out|signout|log out|logout/i) !== null; | |
})); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment