Created
February 14, 2021 20:19
-
-
Save neodigm/f36c8d50919be0706f72d0728e003334 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// Scott C. Krause 👁️ neodigm | 2021 | |
// Wait for Vue.js to mount and make VUEX auth token available to the chrome extension. | |
var _d = document, eScr = _d.createElement("script"); | |
eScr.innerHTML = ` | |
setInterval(() => { | |
var _d = document; | |
if( !_d.querySelector("[data-ext-auth]")){ | |
var eV = _d.querySelector( 'DIV#app' ); | |
if( eV?.__vue__?.$store?.state?.auth?.token ){ | |
eV.dataset.extAuth = eV.__vue__.$store.state.auth.token; | |
} | |
} | |
}, 6000); | |
`;// Content Script | Run at end of doc | once | |
_d.head.appendChild( eScr ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
JavaScript Nullish coalescing operator Chaining
"content_scripts": [ { "matches": [ "https://*/*", "http://*/*" ], "js": ["chrome_extension_vue_auth_token.js"], "run_at": "document_end" } ]