/r/GreaseMonkey

Photograph via snooOG

If you make a Grease Monkey script for Reddit, post a link here.

/r/GreaseMonkey

3,843 Subscribers

1

Can anyone make a UserScript for free use of ChatGPT 4o without limits?

0 Comments
2024/05/17
05:23 UTC

1

Script to remove &pp=text tracking parameters from Youtube results

Every time I search for something on Youtube using Firefox the page with the results is full of links that include the pesky pp tracking parameter. I'm trying to write a Tampermonkey JS script to remove that parameter everywhere on those page after it's loaded but unfortunately it doesn't work. This is what I wrote so far:

// ==UserScript==
// @name         Remove BS from YouTube links
// @namespace    https://www.youtube.com
// @version      2024-05-16
// @description  Remove BS from YouTube links
// @author       SG
// @match        https://www.youtube.com/*
// @match        https://m.youtube.com/*
// @icon         https://www.youtube.com/s/desktop/5ee39131/img/favicon.ico
// ==/UserScript==

(function() {
    document.addEventListener("DOMContentLoaded", function() {
        // get all links with the pp parameter
        var links = document.querySelectorAll('a[href*=\\&pp\\=]');

        // remove the pp parameters and update the links
        for (var i = 0; i < links.length; i++) {
            var url = String(links[i].href);
            // get the first part of the url before the pp parameter
            links[i].href = url.split('&pp=')[0];
        }
    });
})();

Any help?

1 Comment
2024/05/17
01:17 UTC

1

"match" is confusing me

Hi all,

I'm trying to run a script ONLY on "https://thing.website.com/account/A-BCDEFGHI/#/something/*"

But if I set MATCH to "https://thing.website.com/account/\*/#/something/*"

It just does not work. I've tried to match just https://thing.website.com/account/* and then use INCLUDE and EXCLUDE to ensure it matches with JUST /something/*, but it still matches on any /account/ pages.

Any help would be greatly appreciated.

1 Comment
2024/05/16
16:55 UTC

0

Is there a script or anything that can speed up deleting sent messages in reddit chat?

.

0 Comments
2024/05/15
03:28 UTC

2

Link Copier with Redirects

Link Copier with Redirects

Description

The Link Copier with Redirects UserScript is designed to help you effortlessly copy all the links from a webpage, including those with redirects, directly to your clipboard. Whether you are a researcher, a developer, a marketer, or anyone who frequently needs to gather links, this script simplifies the process by automating the task and ensuring that you capture the final redirected URLs.

Features

  • Easy to Use: Activate the script by pressing Alt+1 on any webpage.
  • Copies All Links: Collects all unique links present on the webpage.
  • Handles Redirects: Follows redirects and captures the final URLs.
  • Clipboard Integration: Automatically copies the collected links to your clipboard.
  • Notifications: Notifies you when the copying process starts and completes.

How to Use

  1. Install the script using a UserScript manager like Tampermonkey or Greasemonkey.
  2. Navigate to any webpage from which you want to copy links.
  3. Press Alt+1 to start the link copying process.
  4. Receive a notification once the links have been copied to your clipboard.
  5. Paste the links wherever you need them.

Who Should Use This Script?

  • Researchers: Quickly gather sources and references from various websites.
  • Developers: Collect URLs for testing or documentation purposes.
  • Marketers: Compile links for analysis or outreach campaigns.
  • General Users: Anyone who needs an efficient way to collect and manage links from webpages.

Why Use Link Copier with Redirects?

  1. Time-Saving: No more manual copying of links one by one.
  2. Accurate: Ensures you get the final redirected URLs, avoiding dead or temporary links.
  3. Convenient: Simple keyboard shortcut activation and instant clipboard access.
  4. Reliable: Handles large numbers of links and provides clear notifications for user feedback.

Installation

  1. Install a UserScript Manager: If you haven't already, install Tampermonkey or Greasemonkey.
  2. Add the Script: Click on the install button on greasyfork.org and add the Link Copier with Redirects script to your UserScript manager.
  3. Enjoy: Navigate to any webpage and start using the script with Alt+1.

Feedback and Support

If you encounter any issues or have suggestions for improvement, feel free to open an issue on our GitHub repository.


Download the Link Copier with Redirects script now and streamline your workflow!

0 Comments
2024/05/15
02:16 UTC

0

// @match does not seem to work

The following // @match does not seem to work, it does not match https://search.something.custom/something/london any idea? is it because it is not https://search.something.com/something/london ?

// @match        https://*something*/*
// @match        https://*/*something*
1 Comment
2024/05/13
20:42 UTC

1

How Do I Create a Greasemokonkey Script to Block Reddit Promoted Posts

I use Qutebrowser which has really good adblock, but not as good as Ublock Origin. It doesn't remove Reddit promoted posts which makes Reddit nearly unusable. Their used to be a script that would hide Reddit promoted posts, but it is now obsolete.

I am new to programming, and have barely touched Javascript, and I am wondering if someone would be willing to help me out with this.

1 Comment
2024/05/08
02:30 UTC

2

run script on-demand from extension menu

I have a script that I want to run on an as-needed basis. I first set it to "@run-at context-menu", but some sites disable the context menu. I can use "GM_registerMenuCommand" to run from the extension menu, but it seems I need to change "@run-at" and run for every site.

Is there a way to access tampermonkey's context-menu items from the extension menu? Functionally, I'm looking for something like "@run-at extension-menu".

I'm using tampermonkey 5.1.0 on Firefox.

Thanks,

4 Comments
2024/05/07
21:29 UTC

0

But what if I use tapermonkey inside SquareX?

Will it still affect Although I got my AV Some of those userscripts r really fishy I stopped using tapermonkey,these days I just wait someone to crack things ,then I download those things,yeah but u can't get premium sites like quillbot,and what about RAT(remote access Trojan),does greasyfork verify those scripts?

4 Comments
2024/05/07
19:59 UTC

3

Seeking Userscript to Bypass Paywall on The Economist

8 Comments
2024/05/05
23:55 UTC

2

Script Help - Add Param to URL if missing

I grabbed some code I found on StackOverflow that was very close to what I needed and tried to modify it, but it doesn't seem to do anything.

Was hoping someone here could tell me where I screwed up.

The want:
When you load certain docs from HPE's website under the "psnow" section, you get these headers and footers that take way too much space (for my tastes).
Example: https://www.hpe.com/psnow/doc/a00008180enw.pdf?jumpid=in_pdp-psnow-qs

If you add a parameter to the URL "hf=none", then these headers and footers go away and you get a much cleaner look.
Example: https://www.hpe.com/psnow/doc/a00008180enw.pdf?jumpid=in_pdp-psnow-qs?hf=none

I am wanting to check for hf=none and if it's not found as part of window.location.search, then I simply want to add it.
However, as you may know, you need to use ?hf=none if .search is empty, and you need &hf=none if .search is not empty and you are adding a 2nd/3rd/4th param.

Current NOT working Code:

// ==UserScript==
// @name         Remove Header File from psnow
// @namespace    http://tampermonkey.net/
// @version      2024-05-03
// @description  Make all psnow URLs slimmer by removing the large header and footer
// @author       Casper042
// @match        https://www.hpe.com/psnow/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=hpe.com
// @grant        none
// ==/UserScript==

    function share_redirect() {
    var new_url = false;

    if (window.location.hash.length === 0 && window.location.search.length === 0) {
         new_url = window.location.href+"?hf=none"
    } else {

         if (window.location.search.indexOf('hf=none') != -1) {
             return false; // already found
         }

         if (window.location.search.length && window.location.hash.length) {

             new_url = window.location.href.split('#')[0]+"&hf=none"+window.location.hash;
         } else if (window.location.search.length === 0 && window.location.hash.length) {
             new_url = window.location.href.split('#')[0]+"?hf=none"+window.location.hash;
         } else {
             new_url = window.location.href+"&hf=none";
         }
    }
    if (new_url) {
        window.location = new_url;
    }
}

Stolen and modified from this source: https://stackoverflow.com/questions/15256977/how-can-i-add-a-parameter-to-a-url-and-then-reload-the-page-using-greasemonkey

I want this to happen on page load and redirect to the newly written URL immediately.
This could be from clicked links or new tabs/windows spawned in from an outside application.
I only want it to happen when the URL starts with https://www.hpe.com/psnow/

Thanks

8 Comments
2024/05/03
17:20 UTC

0

Script Help - looping through, capturing text from "<a target="_blank" href=" and removing if...

I would like to remove all ratings 5.9 and below but I'm not sure how to do this. I've tried a lot of different code but the most I've managed to do is remove all ratings using:

$("div[style*='text-align:right;margin-right:3px;width:50px']").remove();

The html code where the ratings are stored is:

<a target="_blank" href="https://www.imdb.com/title/tt259711/"><img src="/pic/icon-imdb.png" height="16px" width="16px"> 6.9</a>

Each page has 100 films listed with ratings. Can anyone offer advice with this?

Image link:

https://www.reddit.com/media?url=https%3A%2F%2Fi.redd.it%2Fmdqabuwqkxxc1.jpg

https://preview.redd.it/mdqabuwqkxxc1.jpg?width=1325&format=pjpg&auto=webp&s=e536c6c839d5ede6f23050419655d48fdbe99ceb

5 Comments
2024/05/02
03:14 UTC

0

Send email via GreaseMonkey?

Couldnt find in search bar, has anyone been able to figure out a way to send an email via GM or has any resources that might be helpful to look into? Thanks!

2 Comments
2024/04/29
22:52 UTC

0

need to fix a script for reddit. suppose to prevent reddit from opening reddit link in new tab. error on line 43. enlist: no-redeclare - lin is already defined.

// ==UserScript==

// u/nameReddit Links Open in Same Tab

// u/namespaceultrabenosaurus.Reddit

// u/version1.8

// u/description Enforce `target="_self"` on links within Reddit posts and messages on desktop, delevoped for next chapter links on r/HFY.

// u/authorUltrabenosaurus

// u/licenseGNU AGPLv3

// u/sourcehttps://greasyfork.org/en/users/437117-ultrabenosaurus?sort=name

// u/matchhttps://www.reddit.com/r/*

// u/matchhttps://www.reddit.com/message/*

// u/matchhttps://old.reddit.com/r/*

// u/matchhttps://old.reddit.com/message/*

// u/iconhttps://www.google.com/s2/favicons?sz=64&domain=reddit.com

// u/grantnone

// u/downloadURL https://update.greasyfork.org/scripts/464674/Reddit%20Links%20Open%20in%20Same%20Tab.user.js

// u/updateURL https://update.greasyfork.org/scripts/464674/Reddit%20Links%20Open%20in%20Same%20Tab.meta.js

// ==/UserScript==

(function() {

'use strict';

if("https://www.reddit.com"==location.origin && -1<location.search.indexOf("share_id=")){

location.href = location.href.replace(location.search, '').replace("www.reddit.com", "old.reddit.com");

}

setTimeout(function(){

RemoveTargetFromLinks();

}, 1000);

})();

function RemoveTargetFromLinks(){

//console.log("RemoveTargetFromLinks", location.origin);

var links=null;

if("https://www.reddit.com"==location.origin){

links=document.querySelectorAll('div[data-test-id="post-content"] div.RichTextJSON-root p > a[target="_blank"], div.content div.md-container a[href*="www.reddit.com"]');

for (var lin in links) {

if (links.hasOwnProperty(lin)) {

links[lin].removeAttribute('target');

links[lin].setAttribute('target', '_self');

}

}

} else if("https://old.reddit.com"==location.origin){

links=document.querySelectorAll('div.content div.usertext-body a[href], div.content div.md-container a[href*="www.reddit.com"]');

for (var lin in links) {

if (links.hasOwnProperty(lin)) {

try{

var linClone=links[lin].cloneNode(true);

linClone.removeAttribute('target');

linClone.setAttribute('target', '_self');

//console.log(linClone.attributes.href);

if(-1==linClone.attributes.href.nodeValue.indexOf("/s/")){

if(-1<linClone.attributes.href.nodeValue.indexOf("//www.reddit.com")){

linClone.attributes.href.nodeValue = linClone.attributes.href.nodeValue.replace("www.reddit.com", "old.reddit.com");

}

if(-1<linClone.attributes.href.nodeValue.indexOf("//reddit.com")){

linClone.attributes.href.nodeValue = linClone.attributes.href.nodeValue.replace("reddit.com", "old.reddit.com");

}

if(-1<linClone.attributes.href.nodeValue.indexOf("//redd.it/")){

linClone.attributes.href.nodeValue = linClone.attributes.href.nodeValue.replace("redd.it", "old.reddit.com/comments");

}

}

links[lin].parentNode.insertBefore(linClone, links[lin]);

links[lin].remove();

}catch(e){

console.log(e);

}

}

}

}

}

4 Comments
2024/04/29
07:54 UTC

1

Are there any recommendations for error handling?

Are there any recommendations for error handling?

A particular failure is that the script clicks a link or button but the webpage does not navigate to the next one because there is another field that needs input and was left blank.

Any recommendation on how to identify and prevent that so that the script does not keep clicking forever?

2 Comments
2024/04/28
18:47 UTC

1

Accidentally uninstalled Tampermonkey, any way to get my scripts back?

Accidentally uninstalled Tampermonkey and now I've lost all my scripts, and I was wondering if there is any way to get them back. I use brave, and was trying to find a backup of my profile but not sure where that would be? All my 000003.log files that I could find for Tampermonkey look like they were wiped also. I'm on windows 11. Any help here would be a life saver!

12 Comments
2024/04/27
19:52 UTC

1

Request: Script to automatically click a radio button followed by a second regular button.

TLDR; I need a script that can do two separate clicks. I use a web based EMR (electronic medical records) and I need an automated way to clean out a clinical inbox that will select a radio button that says "send to staff for labeling" followed by a regular button that says "close and next." Then I can just let this run and clear out this annoying inbox.

Is something like this possible?

If you can create it, I will pay for it!

Thanks in advance.

5 Comments
2024/04/27
16:18 UTC

0

Use tampermonkey to disable/enable a chrome extension..?

Bitwarden doesn't offer any sort of "blacklist" feature, i.e. don't do anything on x, y, or z domain. You can whitelist, sure, but that's a couple hundred domains. A blacklist would be, like, two, and the developers have shown no willingness to even consider a blacklist feature - they just offer a workaround that sucks.

Can tampermonkey disable/enable a chrome extension? Could I use it to create my own blacklist-style functionality?

3 Comments
2024/04/23
18:17 UTC

2

Script request : open javascript click intercept links in new tab

A couple of sites I use a lot recently updated their interface. Previously thumbnail images and article titles were standard links and ctrl-clicking operated as expected but the new design uses javascript interception instead so now they just open in the same window. This is incredibly annoying. It's probably a bandwidth saving exercise.

Unfortunately I can't just turn off JS as there is no alternate version of the sites so then the text and images don't link to the onward-page at all.

Is there a script that will find JS-click interception and open it in a new tab?

5 Comments
2024/04/23
11:34 UTC

1

Stack Overflow - onetrust f*uck off

yea, yea, fucking pop ups, can fuck right off

// @match       https://*.stackoverflow.com/*
waitForKeyElements ("div.onetrust-content-sdk", deleteNotX);
function deleteNotX (jNode) {
    if (jNode.has("div.onetrust-content-sdk").length) {
        jNode.remove ();
    }

}

1 Comment
2024/04/21
13:02 UTC

0

I need help clicking a button

I need a script that clicks a button to sign in on a site called acellus, idk how to do it cuz its just a image but acts like a button. can anyone help?

5 Comments
2024/04/20
22:38 UTC

0

Youtube one-click downloader

Is there any scripts allowing me to download Youtube videos in various formats right on the website?

Have been using YoutubeDL untill it no longer works.

2 Comments
2024/04/18
04:01 UTC

1

Alert for website change

I'm seeking a solution for what is apparently a somewhat complicated problem. I use a password protected website at work which shows the status of shipping containers that we are responsible for picking up from a port. The current procedure is that when we know a container is due to become available, we continuously refresh the website, looking for the status to change from "not ready" to "ready". So it seems to me that it should be possible to have an algorithm of some sort auto refresh the website, and then send an email when the change happens. I've made 2 attempts to pay for a solution on r/slavelabour to get either a script or browser extension to do this, but neither have worked. One issue is that I can't give someone else the login credentials, but I have the complete website saved in both the "not ready" and "ready" status.
I'm looking for any and all suggestions.

  • a ready made app or script
  • a recommendation of someone that could produce an app or script or extension to do this
  • suggestions to what other forums I could go to

Thank you

2 Comments
2024/04/17
09:22 UTC

4

Robust Popup Blocker with Whitelist

Description

This user script for Tampermonkey blocks all unwanted popups on websites unless they originate from a predefined list of whitelisted domains. It's designed to enhance your browsing experience by preventing intrusive popups while allowing necessary ones from trusted sources. This script is ideal for users who frequently encounter annoying popups but still require functionality from certain trusted sites.

Features

  • Popup Blocking: Automatically blocks all popup windows except those opened by whitelisted domains.
  • Whitelist Management: Includes an extensive list of popular and trusted domains. Users can easily add more domains to the whitelist according to their preferences.
  • Dynamic Handling: Disables inline event handlers that might trigger popups, ensuring that even dynamically generated popups are blocked.
  • Enhanced Security: Overrides traditional popup methods such as window.alert, window.confirm, and window.prompt to prevent their misuse for displaying unwanted content.

How to Use

  1. Install Tampermonkey: Ensure that you have the Tampermonkey extension installed in your browser. If not, download and install it from Tampermonkey's official website.
  2. Add the Script: Copy the script provided above.
  3. Create a New Script: Go to the Tampermonkey dashboard and click on Create a new script.
  4. Paste and Save: Paste the copied script into the new script template in Tampermonkey. Save the script by clicking on the disk icon or pressing Ctrl+S.
  5. Adjust the Whitelist as Needed: Modify the whitelist array within the script to include or remove domains based on your specific needs.
  6. Enjoy Browsing: Browse the internet with fewer interruptions. Popups from non-whitelisted sites will be automatically blocked.

Example of Adding to the Whitelist

To add a new domain to the whitelist, simply append it to the whitelist array in the script. For example, to add example.com, you would modify the array like this:

const whitelist = [
    '500px.com',
    'adobe.com',
    // other domains
    'example.com' // newly added domain
];

Make sure to regularly update and manage your whitelist to fit your browsing habits and security preferences.

You can get the script on greasyfork here.

0 Comments
2024/04/15
14:23 UTC

4

Stack Overflow Code Copy Tampermonkey Script

The "Stack Overflow Code Copy" Tampermonkey script enhances the Stack Overflow website by adding a convenient "Copy" button to each code block within the questions pages. This simple yet powerful functionality improves the user experience by allowing developers and other users to quickly and easily copy code snippets without having to manually select and copy the content.

You can obtain this script at Greasyfork

Features

Copy Button

  • Easy Access: Each code block on the question pages is equipped with a "Copy" button positioned at the top-right corner.
  • Instant Copy: By clicking the "Copy" button, the code within that block is instantly copied to the clipboard, making it easy to paste elsewhere.

Seamless Integration

  • Unobtrusive Design: The button is styled to fit naturally within the Stack Overflow interface, ensuring it does not distract from the content.
  • Efficient Interaction: The script operates efficiently without impacting the loading times or performance of the Stack Overflow pages.

Why Use This Script?

Convenience

This script eliminates the need to manually select code text, which can be cumbersome and error-prone, especially with longer snippets or those that include special characters that might not select correctly.

Time-Saving

By reducing the steps needed to copy code, this script saves time for users who are looking to quickly gather solutions from Stack Overflow and apply them directly to their projects.

Accuracy

Ensures that the entire code block content is copied exactly as is, without missing any parts or adding any extra whitespace or characters that sometimes occurs with manual copying.

How It Works

Upon visiting a question page on Stack Overflow, the script automatically scans for code blocks (contained within <pre>
tags). For each code block found, it:

  1. Creates a new "Copy" button.
  2. Positions this button within the top-right corner of the code block for easy access.
  3. Sets up the button to copy the content of the code block to the clipboard when clicked.

Installation

To use this script, follow these steps:

  1. Install the Tampermonkey extension for your browser.
  2. Create a new script in Tampermonkey and paste the entire content of this script into the editor.
  3. Save the script and navigate to any question page on Stack Overflow to see it in action.

By enhancing Stack Overflow with this script, users can focus more on solving problems and less on the mechanics of transferring code, leading to a more productive and satisfying experience.

0 Comments
2024/04/14
04:24 UTC

0

anyone able to make a updated spoiler remover for reddit? - Tampermonkey

I was using this script for a while to help remove spoiler blurs since I personally find them annoying. It seams to not work now on reddit. I tried tweaking it myself but I'm not familiar with javascript so it didn't really work. Can someone help make a updated version of this script? Thanks!

Link to script: https://greasyfork.org/en/scripts/416091-reddit-spoiler-blur-remover

2 Comments
2024/04/13
05:05 UTC

7

Nefarious URL Redirect Blocker - A Tampermonkey Script

Nefarious URL Redirect Blocker - A Tampermonkey Script

Description

Nefarious URL Redirect Blocker is a Tampermonkey script that detects and stops URL redirections, ensuring that you stay on the original URL and avoid being redirected to unintended websites. It provides a seamless browsing experience by preventing unwanted redirects and keeping you on the webpage you initially visited.

Features

  • Detects and stops URL redirections in real-time
  • Loads the original URL when a redirect is detected
  • Works in both forward and backward navigation scenarios
  • Logs actions in the browser console for debugging purposes
  • Easy to install and use with Tampermonkey browser extension

How It Works

The Nefarious URL Redirect Blocker script utilizes JavaScript to monitor URL changes and intercept redirection attempts. Here's a breakdown of how the script functions:

  1. The script starts by storing the original URL of the webpage you are currently on.
  2. It sets up event listeners for the beforeunload and popstate events, which are triggered when a page is about to be unloaded or when the browser history changes (e.g., when navigating forward or backward).
  3. The script continuously checks for URL changes by comparing the current URL with the stored original URL.
  4. If a URL change is detected and the script has not already been activated, it means a redirection attempt has been made.
  5. The script then takes the following actions:
  • It stops the redirection by preventing the default behavior of the event and stopping event propagation.
  • It pushes the original URL into the browser history using window.history.pushState(), creating a new history entry.
  • It replaces the current URL displayed in the browser's address bar with the original URL using window.history.replaceState().
  • It logs the action in the browser console, indicating that a redirection has been stopped and the original URL has been loaded.
  1. The script resets its activation flag and schedules the next check for URL changes after a short delay (100 milliseconds).
  2. This process continues, enabling the script to continuously monitor and prevent redirections throughout your browsing session.

Installation and Usage

To use the Nefarious URL Redirect Blocker script, follow these steps:

  1. Install the Tampermonkey browser extension in your preferred web browser (e.g., Chrome, Firefox).
  2. Open the Tampermonkey dashboard and click on the "+" button to create a new script.
  3. Copy and paste the entire code of the Stop Redirects script into the Tampermonkey editor.
  4. Customize the u/match directives in the script header to specify the websites or URL patterns where you want the script to be active. By default, it matches all HTTP and HTTPS URLs.
  5. Save the script in Tampermonkey.
  6. The script will now be active and will automatically detect and stop redirects on the specified websites.
  7. To view the script's actions and logs, open the browser console (usually by pressing F12 or right-clicking and selecting "Inspect" > "Console").

That's it! With the Nefarious URL Redirect Blocker script installed and active, you can browse the web without worrying about unwanted redirects. The script will silently work in the background, ensuring that you stay on the original URLs you visit.

You can get the script at greasyfork

6 Comments
2024/04/09
00:28 UTC

0

Script to expand all sentences at Engoo

Hello everyone.

Coud anybody please help me write a script automatically expand all the sentences in Vocabulary section at Engoo website?

Here is the sample link: https://engoo.com/app/lessons/business-business-situations-handling-customer-complaints/zv6sIjcvEee9Fh9qKijPIw

2 Comments
2024/04/05
15:51 UTC

Back To Top