Convert Figma logo to code with AI

greasemonkey logogreasemonkey

Greasemonkey is a user script manager for Firefox.

2,424
335
2,424
63

Top Related Projects

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

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

An open-source userscript manager for Safari

5,746

Stylus - Userstyles Manager

Quick Overview

Greasemonkey is a popular Firefox extension that allows users to customize the way webpages look and function. It enables users to install and manage user scripts, which are small JavaScript programs that can modify web pages on-the-fly, adding new features or altering existing ones.

Pros

  • Highly customizable, allowing users to tailor their browsing experience
  • Large community with a vast library of user scripts available
  • Supports a wide range of websites and applications
  • Open-source project with active development and maintenance

Cons

  • Limited to Firefox browser (though alternatives exist for other browsers)
  • Potential security risks if installing scripts from untrusted sources
  • Some websites may implement measures to prevent script modifications
  • Learning curve for creating custom scripts

Code Examples

Here are a few examples of Greasemonkey user scripts:

  1. Adding a custom CSS style to a webpage:
// ==UserScript==
// @name         Custom Style Example
// @match        https://example.com/*
// ==/UserScript==

(function() {
    'use strict';
    const style = document.createElement('style');
    style.textContent = `
        body {
            background-color: #f0f0f0;
            font-family: Arial, sans-serif;
        }
    `;
    document.head.appendChild(style);
})();
  1. Adding a new button to a webpage:
// ==UserScript==
// @name         Add Custom Button
// @match        https://example.com/*
// ==/UserScript==

(function() {
    'use strict';
    const button = document.createElement('button');
    button.textContent = 'Click me!';
    button.onclick = () => alert('Hello from Greasemonkey!');
    document.body.appendChild(button);
})();
  1. Modifying existing content on a webpage:
// ==UserScript==
// @name         Modify Page Content
// @match        https://example.com/*
// ==/UserScript==

(function() {
    'use strict';
    const headings = document.querySelectorAll('h1, h2, h3');
    headings.forEach(heading => {
        heading.style.color = 'blue';
        heading.textContent = 'Modified: ' + heading.textContent;
    });
})();

Getting Started

To get started with Greasemonkey:

  1. Install the Greasemonkey extension for Firefox from the official add-ons store.
  2. Find a user script you want to install or create your own.
  3. Click on the script link or copy its source code.
  4. Greasemonkey will detect the script and prompt you to install it.
  5. Once installed, the script will run automatically on matching web pages.

To create your own script, click the Greasemonkey icon in Firefox, select "New user script," and start writing your JavaScript code using the examples above as a guide.

Competitor Comparisons

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

Pros of Violentmonkey

  • Cross-browser compatibility (Chrome, Firefox, Edge, and more)
  • Better performance and resource management
  • More frequent updates and active development

Cons of Violentmonkey

  • Slightly less mature ecosystem compared to Greasemonkey
  • Some advanced features may require additional configuration

Code Comparison

Violentmonkey:

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

Greasemonkey:

// @grant GM.xmlHttpRequest
(async () => {
  let response = await GM.xmlHttpRequest({
    method: "GET",
    url: "https://example.com"
  });
  console.log(response.responseText);
})();

Both Violentmonkey and Greasemonkey are popular userscript managers, but Violentmonkey offers broader browser support and better performance. Greasemonkey, being older, has a more established ecosystem. The code comparison shows that Violentmonkey uses a callback-based approach for HTTP requests, while Greasemonkey supports async/await syntax. Both projects continue to evolve, with Violentmonkey showing more frequent updates in recent times.

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

  • Cross-browser compatibility (Chrome, Firefox, Safari, Edge, etc.)
  • More frequent updates and active development
  • Enhanced script management features and user interface

Cons of Tampermonkey

  • Closed-source, which may raise privacy concerns for some users
  • Slightly more complex for beginners due to additional features

Code Comparison

Greasemonkey:

// ==UserScript==
// @name     My Script
// @include  http://example.com/*
// ==/UserScript==

console.log("Hello from Greasemonkey!");

Tampermonkey:

// ==UserScript==
// @name     My Script
// @match    http://example.com/*
// @grant    GM_addStyle
// ==/UserScript==

GM_addStyle("body { background-color: #f0f0f0; }");
console.log("Hello from Tampermonkey!");

The main differences in the code examples are:

  • Tampermonkey uses @match instead of @include for URL matching
  • Tampermonkey provides additional APIs like GM_addStyle for extended functionality
  • Both extensions use similar metadata blocks, but Tampermonkey offers more options

Overall, Tampermonkey provides more features and broader browser support, while Greasemonkey remains open-source and simpler for basic userscript needs.

An open-source userscript manager for Safari

Pros of userscripts

  • More active development with frequent updates and contributions
  • Broader browser compatibility, supporting Chrome, Firefox, and Safari
  • Cleaner and more modern user interface for managing scripts

Cons of userscripts

  • Less established community and ecosystem compared to Greasemonkey
  • Fewer advanced features for power users
  • Limited documentation and tutorials for new users

Code Comparison

Greasemonkey:

// ==UserScript==
// @name     My Greasemonkey Script
// @include  http://example.com/*
// ==/UserScript==

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

userscripts:

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

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

The main difference in the code structure is the use of @include in Greasemonkey versus @match in userscripts for specifying target URLs. Both projects use similar metadata blocks and self-executing function wrappers for script execution.

5,746

Stylus - Userstyles Manager

Pros of Stylus

  • Focused specifically on CSS styling, providing a more streamlined experience for users primarily interested in customizing website appearances
  • Offers a built-in style editor with syntax highlighting and live preview
  • Supports importing styles from popular userstyle websites like userstyles.org

Cons of Stylus

  • Limited to CSS modifications, lacking the full scripting capabilities of Greasemonkey
  • May have a steeper learning curve for users unfamiliar with CSS

Code Comparison

Stylus (CSS-based customization):

body {
  background-color: #f0f0f0;
  font-family: Arial, sans-serif;
}

Greasemonkey (JavaScript-based customization):

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

document.body.style.backgroundColor = '#f0f0f0';
document.body.style.fontFamily = 'Arial, sans-serif';

Stylus focuses on CSS-based customization, while Greasemonkey allows for more complex JavaScript-based modifications. Stylus is ideal for users primarily interested in visual customization, whereas Greasemonkey offers broader functionality for advanced users who need to modify website behavior beyond just styling.

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

Greasemonkey is a user script manager for Firefox. User scripts are small browser extensions that let you customize your web browsing experience.