Skip to content

Instantly share code, notes, and snippets.

@curtisj44
Last active March 15, 2022 09:04
Show Gist options
  • Save curtisj44/10052727 to your computer and use it in GitHub Desktop.
Save curtisj44/10052727 to your computer and use it in GitHub Desktop.
Pesticide CSS bookmarklet
var link,
id = 'Pesticide';
pesticide = document.getElementById(id);
if (pesticide === null) {
console.log(id + ' added');
link = document.createElement('link');
link.id = id;
link.rel = 'stylesheet';
// Using jsdelivr link since raw CSS from GitHub doesn't seem to work
// (https://raw.githubusercontent.com/mrmrs/pesticide/master/css/pesticide.min.css)
link.href = 'https://cdn.jsdelivr.net/npm/pesticide@1.3.1/css/pesticide.min.css';
document.body.appendChild(link);
} else {
console.log(id + ' removed');
document.body.removeChild(pesticide);
}
@philsmithies
Copy link

Any idea how to get this to work with safari? It's working great in Brave but I already have a chrome extension for that.

@maxfenton
Copy link

maxfenton commented Mar 14, 2022

@philsmithies In theory it’s as easy as making any bookmarklet:

  1. make a new bookmark.
  2. edit the url of that bookmark to be the whole javascript snippet above

But these days with any bookmarketl (in Safari or otherwise) you're likely to hit one of these:

Refused to load https://cdn.jsdelivr.net/npm/pesticide@1.3.1/css/pesticide.min.css because it does not appear in the style-src directive of the Content Security Policy.

@philsmithies
Copy link

philsmithies commented Mar 15, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment