Skip to content

Introduction

Witchcraft is a Google Chrome extension for loading custom JavaScript and CSS directly from a folder on your local machine, injecting them into web pages that match specified URL patterns.

Pattern-matching is done using the page’s URL. You can target specific pages, partial or entire domains. For example, navigating to https://google.com will match google.com.js and google.com.css:

Witchcraft screenshot

For the screenshot above, the following scripts were used:

google.com.js
window.addEventListener("load", () => {
document.querySelectorAll("img")
.forEach(img => img.style.transform = "scaleX(-1)");
});
google.com.css
img {
filter: sepia(100%) saturate(2000%) brightness(70%) hue-rotate(90deg);
}

Actual practical uses include getting rid of nasty ads, automating clicks and improving page layouts with your own CSS rules. You’re only limited by what Javascript and CSS can do.

This is what makes Witchcraft different than other similar extensions:

  • JavaScript and CSS injection

    Witchcraft is not only able to run Javascript, but also CSS;

  • editing scripts is easy

    Just edit your scripts in your favorite editor and refresh the page;

  • cross-platform

    Since Witchcraft runs as a Chrome extension, it is runs on any platform that supports Chrome extensions (Linux, Windows, MacOS);

  • runs on all Chromium-based browsers

    Witchcraft should work on any Chromium-based browser that supports extensions, such as Microsoft Edge, Brave and Opera;

  • runs on all frames

    Witchcraft will inject your scripts into all frames of the page, including iframes;

  • runs on the page’s context

    Witchcraft runs your scripts in the page’s context, giving you full access to the page’s JavaScript environment;

  • open source

    Witchcraft is open source and available on GitHub. That means you can load it directly into Chrome as an unpacked extension, if you prefer (which is not the case for other popular extensions like Tampermonkey, which was turned closed source).

For a deeper dive into Witchcraft’s features, check out the user guide.