/r/GreaseMonkey

Photograph via snooOG

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

/r/GreaseMonkey

4,081 Subscribers

1

TM YouTube Scripts Not Working?

I noticed yesterday when I was trying to use Tom Saleeba's custom YouTube speeds TM script in Chrome that the script was not (working/loading/running?).

I wanted to make a post in case anyone else is having trouble, or is this something on my end?

1 Comment
2024/10/31
18:37 UTC

1

Opening YouTube links on Reddit that lead to age restricted videos makes Chrome turn OFF Developer mode for TamperMonkey.

Any remedy for this?

1 Comment
2024/10/31
14:02 UTC

0

Script works but tampermonkey randomly stops loading it after refresh

Script works but tampermonkey randomly stops loading it after refresh, basically i have to create new one and paste the code then it works, browser restart/pc restart doesnt fix, im using Brave, tampermonkey is freshly installed and browser up to date

Edit: I have dev mode enabled too

2 Comments
2024/10/29
21:20 UTC

1

danbooru page limit bypass?

is it possible for someone to create a script that can bypass the page browsing limit of 1000 pages on https://danbooru.donmai.us/ ? for 2 years now danbooru hasn't been able to let people sign up for Gold membership

7 Comments
2024/10/29
19:23 UTC

1

help with nexusmods tamper monkey

Hey guys , so i am still new to using tamper monkey , i have used it to download like 2 collections on nexusmods and it was working good , now for some reason when i try to download a collection it asks me for a place to download for every mod , so when i tried to download a collection with 500 mods i needed to press save for all the 500 , does anyone know the reason ? thanks for advance

0 Comments
2024/10/23
22:10 UTC

1

Old-reddit: A script to hide subreddit feeds?

Hi all,

I enjoy using old reddit over new reddit - I've gone ahead blocked the home-feed with a different extension (Undistracted). I know SocialFocus (another distraction blocking extension) blocks subreddit feeds for new-reddit. Is there some tampermonkey script that does this but for old-reddit?

0 Comments
2024/10/23
21:46 UTC

6

What coding languages does tampermonkey supports?

Simple question, i want to know, please. I want to became a young developer and i want to code scripts

4 Comments
2024/10/23
19:05 UTC

0

requesting a script for auto doing schoolwork

im currently doing an online school called K12 and i have hundereds of assignments and i want to figure out how to auto do all my assignments please help🙏🙏

2 Comments
2024/10/23
07:21 UTC

1

Why is the handling of iframes so ridiculus?

I am on a page, where I want to redirect myself to a certain stream. The stream is the source attribute of an iframe inside an iframe. So far so good. My tampermonkey script correctly detects the location and for debugging purpose I logged it successfully. Now trying to redirect, it appears, that my query on this Iframe has shifted the document reference to the innermost iframe. So the location.replace(stream) actually loads the stream again in the iframe in the iframe. You want to know, what the solution to this issue is?

window.top.document.location.replace(stream);

I only figured it out, because suddenly the debug console of the browser was not able to document.querySelector the iframe anymore. It was returning null. But window.top.document.querySelector("iframe") found it again. What is going on here? Since when does the definition of "document" suddenly change completely and can only be referenced by window.top.document? HUH?

Untill now I did not even know of window.top.document or even window.top. Explain this ridiculessnes to me!

8 Comments
2024/10/22
15:54 UTC

1

Request for an Amazon script. (Purchase selection.)

Hello there.

I looked online for a script but sadly found nothing. I figure it should be possible because I currently use scripts that does similar things, though I know close to nothing about code, so maybe I’m mistaking. ^^

I’m tired of Amazon selecting the subscription option by default when buying an item… I’d love to automatize the switch to the « buy one » option. ( I tried asking GPT, which was friendly helping, but for a noob like me, an epistolary code course was a hell of a useless ride lol )

Here’s a picture about the devil thing, found on another Reddit. ( I use French Amazon though. )

If it’s an easy thing to do, I’m all ears !
Regards.

0 Comments
2024/10/22
13:03 UTC

2

Where are TamperMonkey/GreaseMonkey scripts stored?

I have written some TamperMonkey scripts on Brave, and would like to back them up with my regular backups. Where are they stored? I tried to find them in Windows/users/<myusername>/AppData with no success.

1 Comment
2024/10/22
02:11 UTC

2

tampermonkey changes made my cose stop working

Hello, today i got a tab automatically open on my mobile kiwi browser that showed some changes have been done in tampermonkey extension. At the same time, my code that switches a sites backround according to device theme, stopped working.

I keep getting a warning that i need to enable developer mode even thou its already enabled. I disabled it and re enabled it to no avail. ChatGPT didn't help. I would appreciate if anyone has any ideas.

edit: code*

4 Comments
2024/10/21
07:42 UTC

1

Changing the way youtube works? (Is my goal even feasible with this tool?)

So I've been doing modifications for youtube for a while now, altering some of the functionality here and there.
I don't typically like my algorithm. I automated some things to "reset" what the algorithm shows me.
But I was thinking of something that's somewhat "big" and I don't know how feasible this is going to be with tempermonkey or if I should look for a different method or tool altogether.

I wanted to completely change what the homepage shows me.

I have two specific goals in mind of what I ideally want to achieve:

Number 1 - I want my subscribed channels to be the priority
Number 2 - From those videos I wanna see the ones I haven't watched yet

The question that I have:
Would tampermonkey be a feasible tool for that?

I think getting the info whether or not I'm subscribed to a youtuber or if I have watched the video, aren't too difficult in principle.
The difficult question for me is rather how do I proceed if I manage to get these two infos?

And that kinda made me question if tampermonkey is even the right tool.

2 Comments
2024/10/20
02:30 UTC

0

Chatgpt output getting blocked

Hi

Is there any change in the script needed so that the output of chatgpt is not blocked?

0 Comments
2024/10/15
19:05 UTC

0

replace target="_self" with target="_blank"

I'm completely new to GreaseMonkey and don't really know what I'm doing.
I'm just trying to create a simple script that will replace all instances of target="_self" in the html with target="_blank"
So that (hopefully,) any links that have been insructed to open in the current frame or tab will instead be opened in a new one.
Can somebody tell me if this is even possible before I waste any time on it?

7 Comments
2024/10/13
18:52 UTC

1

Script to test 100 codes by pasting in input field one by one ?

I have 100 alphanumeric codes. I want to paste them 1 by 1 in a given input field on a website to test which of those 100 codes are valid (not expired). Website gives error if a code is expired.

How to do this vai Tapermonkey / Greasemonkey script?

3 Comments
2024/10/13
04:16 UTC

3

Tampermonkey - Script Only Runs When Dev Tools Open

I have a script that makes walmart.com/orders a little more usable. When I visit walmart.com/orders, tampermonkey shows no script running: https://imgur.com/a/tdN4ACQ

I do see an error in the console that might be related?

Refused to execute inline script because it violates the following Content Security Policy directive:
"script-src 'self' 'strict-dynamic' 'wasm-unsafe-eval' *.1worldsync.com [...] b.www-teflon.walmart.com
b.www.walmart.com [...] www.recaptcha.net 'nonce-S78vcgfF_9-erKKs'". Either the 'unsafe-inline'
keyword, a hash ('sha256-8DMu3WpuBSmw0gnunMS0zKIoXzKd0yl/czlzzh1lfXg='), or a nonce ('nonce-...') is
required to enable inline execution.

but that may be a walmart.com error?

After I press F12 (to open Chromium DevTools) then reload the page, my script runs: https://imgur.com/a/Egb8KAF

Is this expected behavior (this is my first time using tampermonkey)? How do I make the script run without opening DevTools?

1 Comment
2024/10/12
09:24 UTC

5 Comments
2024/10/11
23:46 UTC

0

Modify CSS does not work

Can someone tell me why this simple script does not work?

// ==UserScript==
// @name         Fix Ars Technica width
// @namespace    http://arstechnica.com
// @version      1.0
// @description  Change span to allow wider column width
// @author       Me
// @match        *://*.arstechnica.com/*
// @grant        GM_addStyle
// @run-at       document-idle
//
// ==/UserScript==

(function () {
    'use strict';
     GM_addStyle(`
    .col-span-2 {
        grid-column: span 3/span 2 !important; }
    `)
console.log('Set col-span-2 to span 3/span 2');
})();
5 Comments
2024/10/11
10:21 UTC

0

well i wanted to know to remove youtube charpted

well its those gaPs that show the charpter but it makes the custom player script i use break like in this pic

https://preview.redd.it/vxl7xa31hztd1.png?width=877&format=png&auto=webp&s=dabcc0070cb3d3690692c31a1502373b04ec106c

1 Comment
2024/10/10
19:50 UTC

0

Weibo login bypass script?

Hi all, I've been annoyed with weibo forcing me to log in when I scroll down too much or just trying to look into someone's profile. I've gotten banned from weibo for "suspicious activitiy with account" so I cannot log in.
does anyone know script that does this, I could not find anything similar

1 Comment
2024/10/05
08:07 UTC

1

Can tampermonkey access the Chrome Extension API?

I want to download files to certain locations depending on site. GM_download seems to only let me download to browser set location. So I want to change that and it looks like the chromes.download api allows me to set location on a per site basis.

https://developer.chrome.com/docs/extensions/reference/api/downloads
Anyone try this before? Have any tips or suggestions?

2 Comments
2024/09/27
04:42 UTC

0

Help with script

Hi guys, I'm currently in need of a way to add an element to a website, I was already able to add it on the page I wanted to see it without any problems, but I now need to make it permanent and not change it back everytime I reload it again. I'm pretty new to this but a friend told me that a script made with tanpermonkey could do that, so I'm trying with that now, but I have no idea on how to do it.

Is there a guide or something I can look into to help me with that? Thank you in advance.

7 Comments
2024/09/24
12:02 UTC

0

User script to return comment editing functionality to the mobile version of YouTube

As the title says. YouTube removed the edit button from the site on mobile, and switching to desktop is really buggy. Has anyone found a good solution for tbis

0 Comments
2024/09/23
06:16 UTC

2

Is there a way to run a TamperMonkey script in Python?

I am currently running the following script: Internet Marketing Ninjas SERP Extractor from Tamper Monkey in my browser and manually copying the results into Excel across multiple pages. Is there a way to do this in python such that I can have an input query and the TamperMonkey output?

4 Comments
2024/09/22
14:04 UTC

0

A script to remove stupid pronouns from outlook!

Note - be advised, this will remove them if you reply as well.
This removes pronouns from email messages (usually in peoples signatures) in outlook for web.

// ==UserScript==
// @name         TruthAndLight
// @namespace    http://truthandlight/
// @version      2024-09-19
// @description  Remove paganism
// @author       You
// @match        https://outlook.office.com/mail/
// @icon         https://www.google.com/s2/favicons?sz=64&domain=office.com
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    const res = [
        new RegExp("\\(she/her[a-z()/]*", "ig"),
        new RegExp("\\(he/him[a-z()/]*", "ig"),
        ];

    let timer = null;

    const destroyEvil = () => {
        console.log("destroyEvil()");
        timer = null;

        let allSpans = document.getElementsByTagName('span');
        for (const span of allSpans) {
            for (const re of res) {
                if (span.innerText.search(re) >= 0) {
                    console.log(`Blocking ${span.innerText}`);
                    span.innerText = span.innerText.replaceAll(re, "");
                 }
            }
        }
    }

    // Callback function to execute when mutations are observed
    const callback = (mutationList, observer) => {
        if (timer == null) {
            timer = setTimeout(destroyEvil, 100);
        }
    };

    console.log("TruthAndLight started");

    // Observe all dom changes
    const observer = new MutationObserver(callback);
    const config = { childList: true, subtree: true };
    observer.observe(document, config);
})();
8 Comments
2024/09/19
21:48 UTC

4

Please help with script that replaces IMDB synopsis with Wikipedia one

Code works in some pages but not in others and i'm struggling to identify the problem. [Example page](https://www.imdb.com/title/tt8550732/) where it does not work, despite there being a valid wikipedia entry for the IMDB title.

// ==UserScript==

// @name IMDb Synopsis Replacer with Wikipedia (with Fallback)

// @namespace http://tampermonkey.net/

// @version 1.9

// @description Replace IMDb movie synopsis with Wikipedia's synopsis, falling back to IMDb synopsis if Wikipedia fetch fails

// @author You

// @match https://www.imdb.com/title/\*

// @grant none

// ==/UserScript==

(function() {

'use strict';

// Function to fetch Wikipedia page directly

function fetchWikipediaPage(title, mediaType) {

// Construct Wikipedia URL with title and media type in parentheses

const wikipediaUrl = `https://en.wikipedia.org/wiki/${encodeURIComponent(title)}\_(${encodeURIComponent(mediaType)})\`;

return fetch(wikipediaUrl)

.then(response => response.text())

.then(pageContent => {

// Check if it's a disambiguation page

if (pageContent.includes("may refer to:")) {

return "Disambiguation page found. Could not fetch the synopsis.";

}

// Try to locate the synopsis or plot section

const synopsisMatch = pageContent.match(/<span class="mw-headline" id="(Plot|Synopsis)">(.+?)<\/span>[\s\S]*?<p>(.+?)<\/p>/);

return synopsisMatch ? synopsisMatch[3] : "Synopsis not found on Wikipedia.";

})

.catch(error => {

console.error("Error fetching Wikipedia page:", error);

return null; // Return null on failure

});

}

// Function to get media type from IMDb and determine if it's TV series or movie

function getMediaType() {

// IMDb lists the media type in <li role="presentation" class="ipc-inline-list\_\_item">

const mediaTypeElement = document.querySelectorAll('li[role="presentation"].ipc-inline-list__item');

let mediaType = "Movie"; // Default to Movie

// Loop through all the list items to check for "tv"

mediaTypeElement.forEach(item => {

const text = item.innerText.toLowerCase();

if (text.includes("tv")) {

mediaType = "TV series"; // Change to TV series if 'tv' is found

}

});

return mediaType;

}

// Function to replace IMDb synopsis, with a fallback in case Wikipedia fetch fails

function replaceIMDBSynopsis() {

// IMDb movie title (assuming it's in the <h1> tag)

const movieTitle = document.querySelector('h1').innerText.trim();

// Get media type (e.g., TV series or Movie)

const mediaType = getMediaType();

// Target the element with 'data-testid="plot-xl"' and 'role="presentation"'

const synopsisElement = document.querySelector('span[data-testid="plot-xl"][role="presentation"]');

// Save the original IMDb synopsis as a fallback

const originalIMDBSynopsis = synopsisElement.innerHTML;

if (synopsisElement) {

// Fetch the Wikipedia page and replace IMDb's synopsis

fetchWikipediaPage(movieTitle, mediaType).then(synopsis => {

if (synopsis && !synopsis.includes("Disambiguation") && synopsis !== "Synopsis not found on Wikipedia.") {

synopsisElement.innerHTML = synopsis; // Replace with Wikipedia synopsis if successful

} else {

// Fallback to IMDb synopsis if Wikipedia fetch fails

synopsisElement.innerHTML = originalIMDBSynopsis;

}

}).catch(() => {

// In case of any fetch error, fallback to IMDb synopsis

synopsisElement.innerHTML = originalIMDBSynopsis;

});

}

}

// Run the script after the page loads

window.addEventListener('load', replaceIMDBSynopsis);

})();

4 Comments
2024/09/19
06:16 UTC

1

Does the script allow variables?

// u/version1.11

// ==/UserScript==

const myVersion = '<$version>"

or

let var = "Your version is <$version>"

3 Comments
2024/09/18
21:52 UTC

1

[Request] MathJax for Gmail

I'm looking to find a way to add LaTeX equation rendering to Gmail in Firefox. Could someone create such a Grease script please?

I've tried searching for Gmail add-ons, Firefox extensions, and Greasy Fork scripts (using Greasemonkey). I even tried editing the MathJax for Reddit Greasy Fork script by changing its match URL, but that didn't work (the script triggers, but doesn't solve the issue).

I just need a solution that can handle equations. I don't need it to be capable of rendering whole documents right in Gmail. I need it to be for Firefox though, not Chrome.

Example: If you look at the sidebar of /r/askphysics, you'll see this. If you install the Grease script "MathJax for Reddit" that they recommend, you'll then instead see this. I want the same thing for sent and received emails viewed on https://mail.Google.com

2 Comments
2024/09/16
01:22 UTC

0

Is there a way to create a prompt for an artificial UI which looks exactly like the new.reddit ?

Is there a way to create a prompt for an artificial UI which looks exactly like the new.reddit for when you have the www.reddit ? i mean something to modify the colors, the side bars, the shape, etc, to be exactly like the new.reddit, because, as it was stated on r/help, "new.reddit" will be down soon

0 Comments
2024/09/15
22:53 UTC

Back To Top