violentmonkey
Violentmonkey provides userscripts support for browsers. It works on browsers with WebExtensions support.
Top Related Projects
Greasemonkey is a user script manager for Firefox.
Tampermonkey is the most popular userscript manager, with over 10 million users. It's available for Chrome, Microsoft Edge, Safari, Opera Next, and Firefox.
Stylus - Userstyles Manager
An open-source userscript manager for Safari
Quick Overview
Violentmonkey is an open-source userscript manager that supports multiple browsers. It allows users to install and manage userscripts, which are small JavaScript programs that can modify web pages and enhance browser functionality. Violentmonkey is compatible with most userscripts written for Greasemonkey and Tampermonkey.
Pros
- Cross-browser compatibility (Chrome, Firefox, Edge, and more)
- Supports a wide range of userscript features and APIs
- Active development and community support
- Lightweight and efficient performance
Cons
- May have occasional compatibility issues with some complex userscripts
- Less popular than Tampermonkey, resulting in fewer resources and tutorials
- Some advanced features may require a learning curve for new users
Getting Started
To get started with Violentmonkey:
- Install the Violentmonkey extension for your browser from the official store (e.g., Chrome Web Store, Firefox Add-ons).
- Visit a userscript hosting site like Greasy Fork or OpenUserJS.
- Find a userscript you want to install and click the "Install" button.
- Violentmonkey will prompt you to confirm the installation. Review the script and click "Confirm installation."
- The userscript is now installed and will run automatically on matching web pages.
To create your own userscript:
- Click the Violentmonkey icon in your browser toolbar.
- Select "Create a new script."
- Edit the script metadata and add your JavaScript code.
- Save the script, and it will be active immediately.
Example of a basic userscript structure:
// ==UserScript==
// @name My First Script
// @namespace http://example.com
// @match https://example.com/*
// @grant none
// @version 1.0
// @author Your Name
// @description A simple example userscript
// ==/UserScript==
(function() {
'use strict';
// Your code here
console.log('Hello, Violentmonkey!');
})();
This userscript will run on all pages of example.com and log a message to the console.
Competitor Comparisons
Greasemonkey is a user script manager for Firefox.
Pros of Greasemonkey
- Longer history and established user base
- More extensive documentation and community support
- Better integration with Firefox, its primary browser
Cons of Greasemonkey
- Limited cross-browser compatibility (primarily Firefox-focused)
- Less frequent updates and slower development cycle
- More restrictive in terms of script capabilities and API access
Code Comparison
Greasemonkey:
// ==UserScript==
// @name My Greasemonkey Script
// @include http://example.com/*
// @grant GM_setValue
// ==/UserScript==
GM_setValue("key", "value");
Violentmonkey:
// ==UserScript==
// @name My Violentmonkey Script
// @match *://example.com/*
// @grant GM_setValue
// ==/UserScript==
GM_setValue("key", "value");
The code structure is similar, but Violentmonkey supports more modern metadata like @match
and has broader compatibility across browsers. Violentmonkey also offers a more permissive environment for script execution, allowing for greater flexibility in userscript development.
Tampermonkey is the most popular userscript manager, with over 10 million users. It's available for Chrome, Microsoft Edge, Safari, Opera Next, and Firefox.
Pros of Tampermonkey
- More extensive documentation and user guides
- Larger user base, potentially leading to better community support
- Advanced features like cloud storage sync and backup options
Cons of Tampermonkey
- Closed-source, which may raise privacy concerns for some users
- More resource-intensive, potentially impacting browser performance
- Some features are locked behind a paid "Pro" version
Code Comparison
Violentmonkey uses a more modern JavaScript approach:
export async function getTab(tabId) {
const tabs = await browser.tabs.query({ currentWindow: true });
return tabs.find(tab => tab.id === tabId);
}
Tampermonkey tends to use older JavaScript conventions:
function getTab(tabId, callback) {
chrome.tabs.query({ currentWindow: true }, function(tabs) {
callback(tabs.find(function(tab) { return tab.id === tabId; }));
});
}
Both extensions offer similar core functionality for userscript management, but Violentmonkey is open-source and generally lighter on system resources. Tampermonkey, while closed-source, provides more advanced features and has a larger user community. The choice between them often comes down to personal preference and specific feature requirements.
Stylus - Userstyles Manager
Pros of Stylus
- Specialized for CSS styling, offering a more focused and user-friendly interface for managing custom styles
- Supports advanced CSS features like variables and preprocessors (SCSS, Less)
- Lighter weight and potentially faster performance due to its specific focus on styles
Cons of Stylus
- Limited to CSS modifications, lacking the versatility of full userscript support
- Smaller community and fewer available styles compared to Violentmonkey's userscript ecosystem
- Less frequent updates and potentially slower bug fixes
Code Comparison
Stylus (CSS-focused):
@-moz-document domain("example.com") {
body {
background-color: #f0f0f0;
font-family: Arial, sans-serif;
}
}
Violentmonkey (JavaScript-based):
// ==UserScript==
// @name Example Script
// @match https://example.com/*
// ==/UserScript==
document.body.style.backgroundColor = '#f0f0f0';
document.body.style.fontFamily = 'Arial, sans-serif';
The code comparison illustrates the different approaches: Stylus uses pure CSS with @-moz-document
for targeting, while Violentmonkey employs JavaScript to modify styles dynamically. Violentmonkey's approach is more flexible but potentially more complex for simple style changes.
An open-source userscript manager for Safari
Pros of Userscripts
- Native macOS application with a sleek, user-friendly interface
- Supports iCloud sync for seamless script management across devices
- Offers a built-in script editor with syntax highlighting
Cons of Userscripts
- Limited to macOS, not available on other platforms
- Smaller community and fewer available scripts compared to Violentmonkey
- Less frequent updates and potentially slower bug fixes
Code Comparison
Violentmonkey (JavaScript):
// @grant GM_xmlhttpRequest
GM_xmlhttpRequest({
method: "GET",
url: "https://example.com",
onload: function(response) {
console.log(response.responseText);
}
});
Userscripts (JavaScript):
// @grant GM.xmlHttpRequest
(async () => {
const response = await GM.xmlHttpRequest({
method: "GET",
url: "https://example.com"
});
console.log(response.responseText);
})();
Both repositories support userscript management, but they differ in implementation and target platforms. Violentmonkey is a cross-platform browser extension, while Userscripts is a native macOS application. The code comparison shows that both support similar functionality, but Userscripts tends to use more modern JavaScript syntax with async/await patterns. Violentmonkey has a larger user base and more extensive script compatibility, while Userscripts offers a native macOS experience with iCloud sync capabilities.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
Violentmonkey
Violentmonkey provides userscripts support for browsers. It works on browsers with WebExtensions support.
More details can be found here.
Join our Discord server:
Automated Builds for Testers
A test build is generated automatically for changes between beta releases. It can be installed as an unpacked extension in Chrome and Chromium-based browsers or as a temporary extension in Firefox. It's likely to have bugs so do an export in Violentmonkey settings first. This zip is available only if you're logged-in on GitHub site. Open an entry in the CI workflows table and click the Violentmonkey-...
link at the bottom to download it.
Environment Variables
The following environment variables will be injected at compilation time for some features to work:
SYNC_GOOGLE_CLIENT_ID
/SYNC_GOOGLE_CLIENT_SECRET
- Google sync serviceSYNC_ONEDRIVE_CLIENT_ID
/SYNC_ONEDRIVE_CLIENT_SECRET
- OneDrive sync service
Workflows
Development
Install Node.js and Yarn v1.x.
The version of Node.js should match "node"
key in package.json
.
# Install dependencies
$ yarn
# Watch and compile
$ yarn dev
Then load the extension from 'dist/'.
Build
To release a new version, we must build the assets and upload them to web stores.
# Build for normal releases
$ yarn build
# Build for self-hosted release that has an update_url
$ yarn build:selfHosted
Release
See RELEASE for the release flow.
Related Projects
Top Related Projects
Greasemonkey is a user script manager for Firefox.
Tampermonkey is the most popular userscript manager, with over 10 million users. It's available for Chrome, Microsoft Edge, Safari, Opera Next, and Firefox.
Stylus - Userstyles Manager
An open-source userscript manager for Safari
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot