Convert Figma logo to code with AI

Tampermonkey logotampermonkey

Tampermonkey is the most popular userscript manager, with over 10 million users. It's available for Chrome, Microsoft Edge, Safari, Opera Next, and Firefox.

4,227
418
4,227
228

Top Related Projects

Greasemonkey is a user script manager for Firefox.

Violentmonkey provides userscripts support for browsers. It works on browsers with WebExtensions support.

5,315

Stylus - Userstyles Manager

9,737

Create, read and edit .zip files with Javascript

Fast, small color manipulation and conversion for JavaScript

25,643

Modernizr is a JavaScript library that detects HTML5 and CSS3 features in the user’s browser.

Quick Overview

Tampermonkey is a popular userscript manager that allows users to customize their web browsing experience by running custom JavaScript code on web pages. It's available as a browser extension for various browsers, including Chrome, Firefox, Safari, and Edge, enabling users to enhance website functionality, modify layouts, and automate tasks.

Pros

  • Extensive compatibility with multiple browsers
  • Large community and vast library of user-created scripts
  • Powerful API for creating and managing userscripts
  • Regular updates and active development

Cons

  • Potential security risks if running untrusted scripts
  • Can sometimes interfere with website functionality
  • Learning curve for creating custom scripts
  • Performance impact on browser when running multiple scripts

Code Examples

  1. Basic userscript structure:
// ==UserScript==
// @name         My First Script
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  A simple example script
// @match        https://example.com/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    // Your code here...
    console.log('Hello, Tampermonkey!');
})();
  1. Modifying page content:
// ==UserScript==
// @name         Change Page Background
// @match        https://example.com/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    document.body.style.backgroundColor = 'lightblue';
})();
  1. Adding a new element to the page:
// ==UserScript==
// @name         Add Custom Button
// @match        https://example.com/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    const button = document.createElement('button');
    button.textContent = 'Click me!';
    button.onclick = () => alert('Button clicked!');
    document.body.appendChild(button);
})();

Getting Started

  1. Install the Tampermonkey extension for your browser from the official website or browser extension store.
  2. Click on the Tampermonkey icon in your browser and select "Create a new script."
  3. Copy and paste one of the example scripts above or write your own.
  4. Save the script and navigate to a matching website to see it in action.
  5. To manage your scripts, click on the Tampermonkey icon and select "Dashboard."

For more advanced usage and API documentation, visit the official Tampermonkey website and consult the community forums for support and script sharing.

Competitor Comparisons

Greasemonkey is a user script manager for Firefox.

Pros of Greasemonkey

  • Open-source and community-driven development
  • Tighter integration with Firefox, its primary browser
  • Simpler and more lightweight codebase

Cons of Greasemonkey

  • Limited cross-browser compatibility (primarily Firefox)
  • Less frequent updates and slower feature adoption
  • Smaller user base and fewer available scripts

Code Comparison

Greasemonkey script header:

// ==UserScript==
// @name     My Greasemonkey Script
// @version  1
// @grant    none
// ==/UserScript==

Tampermonkey script header:

// ==UserScript==
// @name     My Tampermonkey Script
// @version  1
// @grant    GM_xmlhttpRequest
// @run-at   document-end
// ==/UserScript==

The main difference in the code examples is that Tampermonkey offers more granular control over script execution and additional built-in functions (like GM_xmlhttpRequest), while Greasemonkey tends to have a simpler structure.

Tampermonkey generally provides more features and better cross-browser support, making it a popular choice for users who need flexibility and advanced functionality. Greasemonkey, on the other hand, remains a solid option for Firefox users who prefer a more streamlined and open-source solution.

Violentmonkey provides userscripts support for browsers. It works on browsers with WebExtensions support.

Pros of Violentmonkey

  • Open-source and more transparent development process
  • Lighter on system resources, potentially better performance
  • Supports a wider range of browsers, including Firefox for Android

Cons of Violentmonkey

  • Smaller user base and community compared to Tampermonkey
  • Fewer advanced features and customization options
  • Less frequent updates and potentially slower bug fixes

Code Comparison

Tampermonkey:

// @grant GM_xmlhttpRequest
GM_xmlhttpRequest({
  method: "GET",
  url: "https://example.com",
  onload: function(response) {
    console.log(response.responseText);
  }
});

Violentmonkey:

// @grant GM.xmlHttpRequest
GM.xmlHttpRequest({
  method: "GET",
  url: "https://example.com",
  onload: function(response) {
    console.log(response.responseText);
  }
});

The main difference in the code is the use of GM_xmlhttpRequest in Tampermonkey versus GM.xmlHttpRequest in Violentmonkey. Violentmonkey follows the newer GM4 API standard, while Tampermonkey supports both old and new API styles for better compatibility with existing scripts.

5,315

Stylus - Userstyles Manager

Pros of Stylus

  • Focused specifically on CSS styling, making it more lightweight and efficient for this purpose
  • Offers a user-friendly interface for creating and managing custom styles
  • Supports importing styles from popular userstyle websites like userstyles.org

Cons of Stylus

  • Limited to CSS modifications, lacking the versatility of full JavaScript scripting
  • Smaller user base and community compared to Tampermonkey
  • Fewer advanced features for complex web page modifications

Code Comparison

Stylus (CSS-based styling):

body {
  background-color: #000;
  color: #fff;
}

Tampermonkey (JavaScript-based scripting):

// ==UserScript==
// @name         Custom Style
// @match        https://example.com/*
// ==/UserScript==

(function() {
    document.body.style.backgroundColor = '#000';
    document.body.style.color = '#fff';
})();

While Stylus focuses on CSS-based styling, Tampermonkey allows for more complex JavaScript-based modifications. Stylus is ideal for users primarily interested in customizing website appearances, while Tampermonkey offers broader functionality for advanced web page manipulation and automation.

9,737

Create, read and edit .zip files with Javascript

Pros of jszip

  • Focused library for creating, reading, and editing ZIP files in JavaScript
  • Lightweight and can be used in both browser and Node.js environments
  • Supports various compression methods and encryption

Cons of jszip

  • Limited to ZIP file operations, unlike Tampermonkey's broader userscript capabilities
  • Requires additional setup and integration for web-based use cases
  • Less active community and fewer updates compared to Tampermonkey

Code Comparison

jszip:

var zip = new JSZip();
zip.file("Hello.txt", "Hello World\n");
zip.generateAsync({type:"blob"}).then(function(content) {
    saveAs(content, "example.zip");
});

Tampermonkey:

// ==UserScript==
// @name     My Script
// @match    https://example.com/*
// ==/UserScript==

(function() {
    console.log("Hello from Tampermonkey!");
})();

While jszip focuses on ZIP file manipulation, Tampermonkey is designed for injecting and running custom scripts on web pages. The code examples highlight their different purposes: jszip for file compression and Tampermonkey for webpage modification.

Fast, small color manipulation and conversion for JavaScript

Pros of TinyColor

  • Lightweight and focused on color manipulation
  • Easy to use API for color conversion and modification
  • Supports various color formats (RGB, HSL, HEX, etc.)

Cons of TinyColor

  • Limited functionality compared to Tampermonkey's userscript capabilities
  • Not designed for browser extension or userscript management
  • Lacks features for DOM manipulation or cross-site scripting

Code Comparison

TinyColor:

var color = tinycolor("red");
var lighterColor = color.lighten(20);
var rgbColor = lighterColor.toRgbString();

Tampermonkey:

// ==UserScript==
// @name     My Script
// @match    https://example.com/*
// ==/UserScript==

console.log("Hello, world!");

While TinyColor focuses on color manipulation, Tampermonkey is designed for creating and managing userscripts that can modify web pages. TinyColor is more suitable for projects requiring color-related operations, whereas Tampermonkey is ideal for enhancing browser functionality and customizing web experiences.

25,643

Modernizr is a JavaScript library that detects HTML5 and CSS3 features in the user’s browser.

Pros of Modernizr

  • Lightweight and modular, allowing developers to include only needed features
  • Extensive feature detection for HTML5 and CSS3 capabilities
  • Well-maintained and widely adopted in the web development community

Cons of Modernizr

  • Primarily focused on feature detection, not user script management
  • May require additional setup and configuration for optimal use
  • Less suitable for end-users looking to customize their browsing experience

Code Comparison

Modernizr:

Modernizr.on('webp', function(result) {
  if (result) {
    // Browser supports WebP
  } else {
    // Browser doesn't support WebP
  }
});

Tampermonkey:

// ==UserScript==
// @name     My Script
// @match    https://example.com/*
// ==/UserScript==

(function() {
    // Your custom JavaScript code here
})();

While Modernizr focuses on feature detection and browser capability testing, Tampermonkey is designed for injecting custom scripts into web pages. Modernizr is more suited for web developers ensuring cross-browser compatibility, whereas Tampermonkey caters to users who want to modify website behavior. The code examples highlight their different purposes: Modernizr checks for specific features, while Tampermonkey allows for custom script injection.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

This repository contains the source of the Tampermonkey extension up to version 2.9. All newer versions are distributed under a proprietary license.

Tampermonkey is the most popular userscript manager for Google Chrome.

Features:

  • manage and edit all your userscripts
  • enable and disable your scripts with 2 clicks
  • easily sync you scripts between different Chrome instances
  • search scripts from userscripts.org by URL (with TamperFire enabled)

Beneath of other tags, functions and features the following ones are supported:

  • full unsafeWindow access
  • all GM_* functions including (GM_registerMenuCommand, GM_getResourceText, GM_getResourceURL, GM_notification)
  • a lot of tags supported by Greasemonkey and Scriptish (like @resource, @require, ...)

For a full overview please take a look at the FAQ or just install TM. ;)


This code is provided entirely free of charge by the programmer in his spare time so donations would be greatly appreciated. Please consider a donation.

http://tampermonkey.net/donate.html


DOWNLOADS:

Tampermonkey (stable): https://chrome.google.com/webstore/detail/dhdgffkkebhmkfjojejmpbldmpobfkfo

Tampermonkey (beta): developer version, might contain bugs! https://chrome.google.com/webstore/detail/gcalenpjmijncebpfijmoaglllgpjagf

Tampermonkey (Legacy - Manifest version 1): for browsers based on Chromimum 17. http://tampermonkey.net/crx/tm_legacy.crx

Tampermonkey (retro): very old version 1.1.2190, no support! http://tampermonkey.net/crx/tampermonkey_retro.crx


SOURCE:

http://code.google.com/p/tampermonkey/


SUPPORT:

FAQ: http://tampermonkey.net/faq API: http://tampermonkey.net/api Meta Data Block: http://tampermonkey.net/metadata

Report Bugs: http://tampermonkey.net/bug


LICENSE:

GPLv3. See COPYING for details.


DEPENDENCIES:

Google Chrome or Chromium 17 or higher

BASIC BUILD INSTRUCTIONS:

  • install Google Chrome or Chromium
  • install Cygwin when using Windows
  • open a konsole/terminal, and type:

cd svn checkout http://tampermonkey.googlecode.com/svn/trunk/ tampermonkey-read-only cd tampermonkey-read-only ln -s build_sys/mkcrxfolder.sh . ./mkcrxfolder.sh -e0

Depending on your installed browser and OS (I hope this makes the overall scheme clear ;)

chrome.exe --pack-extension=rel/ chromium.exe --pack-extension=rel/

coogle-chrome --pack-extension=rel/ chromium-browser --pack-extension=rel/

ls -la now shows two new files:

-rw-r--r-- 1 user user 305170 Aug 29 09:09 rel.crx -rw-r--r-- 1 user user 916 Aug 29 09:09 rel.pem

rel.crx is the Chrome extension, rel.pem the key to create another Tampermonkey extension file with the same extension ID

You can install rel.crx by drag'n'drop or (depending on your OS)

chrome.exe rel.crx chromium.exe rel.crx

coogle-chrome rel.crx chromium-browser rel.crx


This code is provided entirely free of charge by the programmer in his spare time so donations would be greatly appreciated. Please consider a donation.

Jan Biniok jan@biniok.net http://tampermonkey.net/donate.html