3 ms·
> sites like github.com which do not allow code running from bookmarklets I tried a variant of it on GitHub.com. It worked fine. This one turns text red, but y
by gabrielsroka 5y ago
> sites like github.com which do not allow code running from bookmarklets
I tried a variant of it on GitHub.com. It worked fine. This one turns text red, but you can change it back to black. You can select the text below and drag it to the bookmark toolbar to create the bookmarklet--at least on Chrome/Firefox on Windows. If that doesn't work, you can copy/paste.
javascript:document.querySelectorAll('*').forEach(elem => elem.style.color = 'red')
This one uses a different approach, it adds a dark mode style sheet.
javascript:/* /Dark Mode# */(function () {document.head.appendChild(document.createElement('style')).innerHTML = '* {background-color: #121212 !important; color: #888 !important;}';})();
- roosgit 5y agoYou are correct, it does work. My mistake was basing my statement on past experiences using an older Firefox ESR version which would give "Content Security Policy: The page’s settings blocked the loading of a resource at inline (“script-src”)." when clicking on a bookmarklet for sites like Twitter or Github.
- gabrielsroka 5y agoThat's what I figured you meant. I used to load scripts from other domains, but now some sites use CSP to block them.