/r/userscripts

Photograph via snooOG

A place for discussion of all things related to userscripts.

A place for discussion of all things related to userscripts.


RELATED:

/r/userscripts

4,185 Subscribers

1

My first (noob) userscript : Add to Watch Later button for Invidious

Invidious was missing an add to Watch Later feature so I decided to try to create one

just hover over a thumbnail and click on the button to add the video to add to/remove from your preferred playlist

You can select any of your playlists as the default "WL" playlist and easily add a bunch of videos to it from the thumbnails on any page.

you can find the link in first comment.

I know my code isn't perfect, but it works (I used Gemini to help me with parts of the script and debug issues). Would love for some people to test it and give feedback. thanks.

1 Comment
2024/05/02
21:50 UTC

2

My first (noob) userscript : Add to Watch Later button for Invidious

Invidious was missing an add to Watch Later feature so I decided to try to create one

just hover over a thumbnail and click on the button to add the video to add to/remove from your preferred playlist

You can select any of your playlists as the default "WL" playlist and easily add a bunch of videos to it from the thumbnails on any page.

you can find the link in first comment.

I know my code isn't perfect, but it works (I used Gemini to help me with parts of the script and debug issues). Would love for some people to test it and give feedback. thanks.

0 Comments
2024/05/02
21:50 UTC

1

Timer on webiste need to go faster

Guys, i use thus website called Wintub which pays you money to watch videos (don't ask or judge)

But you can't do it repeatedly; there is a 24-hour timer per video. But I don't want to wait and I have been using the script called timerhooker but it is not working. A crucial fact about the timer is that it is not live so you have to refresh the page for it to show the latest time left. Pls can someone help me and maybe try to see the website and its code to help me pls.

5 Comments
2024/05/01
07:48 UTC

6

Reddit Mail Redirect Cleaner - Automatically clean and redirect from tracking URLs in Reddit mail links

Reddit Mail Redirect Cleaner

Automatically clean and redirect from tracking URLs in Reddit mail links.

Title: Reddit Mail Redirect Cleaner

Description:
This userscript enhances your browsing experience by automatically cleaning and redirecting from tracking URLs found in Reddit mail links. When clicking on a Reddit mail link that routes through click.redditmail.com
, this script intercepts the link, removes tracking parameters, and directly navigates to the intended Reddit message. This not only speeds up your access but also protects your privacy by avoiding unnecessary tracking.

Features:

  • Auto-Redirect: Bypasses the tracking redirect to immediately open the intended Reddit message.
  • Enhanced Privacy: Reduces exposure to tracking URLs.
  • Ease of Use: Works seamlessly in the background; no manual intervention required.

Installation:

  1. Ensure you have Tampermonkey installed in your browser.
  2. Add the script to Tampermonkey.
  3. Enjoy browsing Reddit mails without redirects!

This script is particularly useful for Reddit users who frequently check private messages and want to avoid the clutter of tracking URLs. It's designed to work silently in the background, providing a cleaner and faster browsing experience.

License: MIT

GreasyFork: https://greasyfork.org/en/scripts/493675-reddit-mail-redirect-cleaner

https://preview.redd.it/n2vcpgeh18xc1.jpg?width=1262&format=pjpg&auto=webp&s=629125c7db2a964c6dfb69cfc81af24844404f4a

Do y'all have suggestions to make this better? It works for me but maybe I am missing corner-cases or not optimizing it as best I could; so suggestions are 100% welcomed. Thanks!

0 Comments
2024/04/28
13:24 UTC

7

For those that still use The Pirate Bay ...

For about 13 years I've been maintaining this userscript. I've just released an update after 3 years after I was contacted about it again. I'll probably refactor it and optimise it more, but I just wanted to see if I could achieve what I wanted to succeed at 10 years ago 😅

You can find it here: https://greasyfork.org/en/scripts/1573-the-pirate-bay-cleaner

5 Comments
2024/04/27
01:17 UTC

1

Has anyone written a userscript that converts 24 hour UTC dates on Old Reddit with Reddit Enhancement Suite to AM/PM local dates?

I tried to get Phind to write me a script for this earlier but none of the scripts it generated for me worked. I didn't tell it that I was using Reddit Enhancement Suite though, so I suspect that might be why.

I've even tried disabling the local date hover option in RES and it still didn't help.

I should also mention that I have relative post dates disabled in RES, and that I can't set Reddit's interface language to "English [en-us]". Whenever I try doing that, it always resets to "English [en]". It might be because I have my location set to Canada, but that would be weird since there's an "English (Canadian) [en-ca]" option that doesn't work for me either.

EDIT: Looks like /u/1Zen's revised script works! Thanks for all the help. :D

Anyway, to use it you have to disable the "Show Timestamp Posts" option in RES. I also disabled "Show Timestamp Comments". I'll have to try disabling "Show Timestamp Sidebar" too.

10 Comments
2024/04/26
10:26 UTC

2

Need Help confirming a Script is Safe

Hello,

This is my first time using userscripts. I was browsing another subreddit when I found a script I would like to use. However, I am completely new to this and would really appreciate if someone could confirm that the script is safe to use!

Here is the link to the other reddit post: https://www.reddit.com/r/Mcat/comments/60tc4v/script_for_kaplan_fl_reviews_to_hide_answers/

Thanks in advance

4 Comments
2024/04/23
17:42 UTC

2

A noob needs help making simple script

Hello there, I am a first time userscript maker but a long time user, I have a script that makes my life easier in a home school site called acellus, but I need a script that signs me in just once when the page loads. The page is https://signin.acellus.com/sign-in/student/ , can anyone help me write or just make it.

https://preview.redd.it/ak8ohb03gpvc1.png?width=2255&format=png&auto=webp&s=9c780eeb8da11907b2d7ac6542024e84010f1ccb

5 Comments
2024/04/20
21:26 UTC

2

Disable pull to refresh (ios Safrai)

Can someone help me with a disable pull to refresh userscript for ios cause I have a extension called refresh all that refreshes all my tabs from the Safrai menu (only usually have only one open tab at a time) preferablely with the refresh animation gone also

0 Comments
2024/04/20
01:12 UTC

1

[Request] Search filter for lazada.vn

Hi there, could someone help me create a search filer for lazada.vn, similar to this script Shopee Advanced Search.

I want to exclude some terms from search hits, and only show hits with at least X number of purchase orders.

Note, language can be switched to English from the top right corner dropdown menu.

Thanks in advance.

7 Comments
2024/04/17
11:37 UTC

2

Userscript not matching page using "@include *" in Tampermonkey

I'm really at my wit's end with this! I have a deliberately basic userscript which is using "@include *" in the metadata just for the purposes of testing. It is matching every web page I can find except the one I actually need!

// ==UserScript==
// @name         Test_1
// @description  Test
// @version      1.0
// @include      *
// ==/UserScript==

(function() {
    'use strict';

    console.log('Script is running!');
})();

I am using Firefox 124.0.2 and Tampermonkey 5.1.0, but try as I might, the script does not load against the following URL: https://conocybe.us-west.host.bsky.network/xrpc/com.atproto.sync.getBlob?did=did:plc:cslxjqkeexku6elp5xowxkq7&cid=bafkreifhy4gmtrfp3ax7wx2l7ojabjabhcnxvieumend3iu3ghlpp4fuiq

Could anyone please suggest why this might be?

5 Comments
2024/04/17
09:46 UTC

0

RedGifs in fullscreen?

It is possible to have the gif (RedGifs) in an entire page?

9 Comments
2024/04/16
13:27 UTC

2

Disable specific BroadcastChannel?

There's a site that uses:

let chan = new BroadcastChannel('chat-coms')
....```  
  and then sends a message to that channel via `chan.postMessage`. I want to prevent other open tabs from that site from receiving the message, how would I go about that?  
I tried this, but it didn't work:

(function() { 'use strict'; const chan = null; })();

6 Comments
2024/04/15
17:57 UTC

4

Help me read JSON from ng-init

Complete beginner frankensteining together a userscript to get images and info from WikiArt. I want to extract some information contained in a div:

<div class="wiki-layout-painting-info-bottom" ng-init="paintingJson = {
    '_t' : 'PaintingForGalleryNew', '_id' : '62483e4f9e43633310aa36ab',
    'title' : 'Untitled', 'year' : '1972', 'width' : 1200, 'height' : 982,
    'artistName' : 'Zdzislaw Beksinski', 'image' : 'https://uploads2.wikiart.org/00387/images/zdzislaw-beksinski/zdzislaw-beksinski.jpg',
    'map' : '01234*67*', 'paintingUrl' : '/en/zdzislaw-beksinski/untitled-1972-0',
    'artistUrl' : '/en/zdzislaw-beksinski', 'albums' : [], 'flags' : 2,
    'images' : null }">

https://www.wikiart.org/en/zdzislaw-beksinski/untitled-1972-0

All the info I want is in the JSON, and I know how to handle that:

var myPaintingJSON = '{ "_t" : "PaintingForGalleryNew", '
                 + '"_id" : "62483e4f9e43633310aa36ab", "title" : "Untitled", '
                 + '"year" : "1972", "width" : 1200, '
                 + '"height" : 982, "artistName" : "Zdzislaw Beksinski" //...etc
var obj = JSON.parse(myPaintingJSON);
alert(obj.title + ' - ' + obj.year + ' (' + obj.artistName + ')') // do stuff

...but I have no idea how to get at the JSON itself, as I know nothing about ng-init or AngularJS and, let's be honest, very little about javascript outside the couple of simple userscripts I've put together. Can someone point me in the right direction, or at least help me understand what's going on here?

Tampermonkey on Firefox, if it makes a difference.

11 Comments
2024/04/11
12:54 UTC

0

[Search] Twitch userscript to allow spam

Hi I search a Userscript that allows me to spam the same message mutiple times. In the Music Category of Twitch it's quite a normal thing to spam Emotes during Music content, however Twitch blocks after like the second time:

https://preview.redd.it/2icsdn4i74tc1.png?width=336&format=png&auto=webp&s=7a4c99e8e644ed7a052f055547878da21f359d06

Clients like Chatterino and Chatty work, and extensions like 7tv have found workarounds, so the restriction seems to be client side.

Now does anyone know a userscript for this?

2 Comments
2024/04/07
20:12 UTC

0

I asked Phind to write me a userscript that will remove the "&si=" section from YouTube URLs. Will this work?

Here's a link to my query: https://www.phind.com/search?cache=svggur5jny3b8drhb7ymka0x

Here's the script in question (it's the fourth script down in the link):

// ==UserScript==
// @name         YouTube Link Cleaner
// @version      1.0
// @description Removes source identifier from all YouTube links containing "&si=" or "si="
// @author       Your Name
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // Function to clean YouTube URLs
    function cleanYouTubeURL(url) {
        // Regular expression to match YouTube video IDs
        const videoIdRegex = /(?:v=|\/)([A-Za-z0-9_-]{11})/;
        const match = url.match(videoIdRegex);
        if (match) {
            // Construct a clean URL using the video ID
            return `https://www.youtube.com/watch?v=${match[1]}`;
        }
        return url; // Return the original URL if no video ID is found
    }

    // Function to process all links on the page
    function processLinks() {
        const links = document.querySelectorAll('a[href]');
        links.forEach(link => {
            const href = link.getAttribute('href');
            if (href && href.includes('youtube.com') && (href.includes('&si=') || href.includes('si='))) {
                link.setAttribute('href', cleanYouTubeURL(href));
            }
        });
    }

    // Run the link processing function on page load
    processLinks();

    // Listen for changes to the DOM to handle dynamically loaded content
    const observer = new MutationObserver(processLinks);
    observer.observe(document.body, { childList: true, subtree: true });
})();

EDIT: Decided to test it myself. Needed to remove the // @match *://*.youtube.com/* line from the header to get it working on Reddit. Seems to work well!

I'm also using this script, which is supposed to remove the tracking parameter, but it doesn't actually change the URL on the page: https://greasyfork.org/en/scripts/482977-remove-youtube-tracking-parameters-and-convert-share-links

As well, I'm using this one to convert YouTube Shorts links: https://greasyfork.org/en/scripts/474490-unshort-youtube

Hopefully these don't all conflict.

EDIT2: Clarification.

EDIT3: Updated the script somewhat.

2 Comments
2024/04/06
14:24 UTC

8

YouTube Play All now supports Shorts!

Here's a small update on my YouTube Play All userscript:

You can now play all YouTube Shorts sorted by newest or most popular!

Available on:

Play All Shorts

2 Comments
2024/03/31
08:51 UTC

3

Automatically select an option on a select menu? (I know it should be easy, but I assume there is some javascript stuff taking place)

It's this site: https://labs.perplexity.ai/

I would like to automatically select "claude-3-haiku-20240307", which is the best model. But it's not the ones default. I would like to, whenever I run a page, the browser selects this option.

And it apparently works, but as soon as I start to type, it reverts back to the original.

// Find the "lamma-select" element
var lammaSelect = document.querySelector('#lamma-select');

// Check if the "#lamma-select" element exists
if (lammaSelect) {
  // Find the "claude-3-haiku-20240307" option
  var option = lammaSelect.querySelector('option[value="claude-3-haiku-20240307"]');

  // Check if the option exists
  if (option) {
    // Select the "claude-3-haiku-20240307" option
    lammaSelect.value = "claude-3-haiku-20240307";
  } else {
    console.error('Option "claude-3-haiku-20240307" not found in "lamma-select"');
  }
  } else {
    console.error('"lamma-select" element not found on the page');
  }

Any idea? Thanks.

4 Comments
2024/03/29
21:51 UTC

4

writing a script to download pdf from goodreads, stuck, help

// ==UserScript==

// u/nameGoodreads PDF Downloader

// u/namespacehttp://tampermonkey.net/

// u/version1.2

// u/description Display a PDF download button next to the ISBN number on Goodreads pages

// u/authorYour Name

// u/matchhttps://www.goodreads.com/book/*

// u/grantnone

// ==/UserScript==

(function() {

'use strict';

// Function to extract ISBN from the page

function extractISBN() {

const isbnElement = document.querySelector('div[data-testid="contentContainer"]');

if (isbnElement) {

const isbnText = isbnElement.textContent.trim();

const isbnMatch = isbnText.match(/\d{13}/); // Match 13-digit ISBN

if (isbnMatch) {

return isbnMatch[0];

}

}

return null;

}

// Function to open Google search results for PDFs

function openGoogleSearchForPDF(isbn) {

const query = encodeURIComponent(`${isbn} PDF`);

const searchUrl = `https://www.google.com/search?q=${query}\`;

window.open(searchUrl, '_blank');

}

// Function to add PDF link button

function addPDFLinkButton() {

const isbn = extractISBN();

if (isbn) {

const pdfLinkButton = document.createElement('button');

pdfLinkButton.innerText = 'Download PDF';

pdfLinkButton.style.backgroundColor = 'green';

pdfLinkButton.style.color = 'white';

pdfLinkButton.style.border = 'none';

pdfLinkButton.style.borderRadius = '5px';

pdfLinkButton.style.padding = '5px 10px';

pdfLinkButton.style.cursor = 'pointer';

pdfLinkButton.addEventListener('click', () => {

openGoogleSearchForPDF(isbn);

});

const isbnElement = document.querySelector('div[data-testid="contentContainer"]');

isbnElement.innerHTML += '<br>'; // Add a line break before the button

isbnElement.appendChild(pdfLinkButton);

} else {

console.error('ISBN not found on the page');

const isbnElement = document.querySelector('div[data-testid="contentContainer"]');

const errorButton = document.createElement('button');

errorButton.innerText = 'No PDF Available';

errorButton.style.backgroundColor = 'red';

errorButton.style.color = 'white';

errorButton.style.border = 'none';

errorButton.style.borderRadius = '5px';

errorButton.style.padding = '5px 10px';

errorButton.style.cursor = 'pointer';

isbnElement.innerHTML += '<br>'; // Add a line break before the button

isbnElement.appendChild(errorButton);

}

}

// Add PDF link button when the DOM content is loaded

document.addEventListener('DOMContentLoaded', () => {

addPDFLinkButton();

});

})();

i have written a script this script to download pdfs of the books from good reads can anyone see what's wrong with this, unable to debug and see what the problem is

thanks in advance

7 Comments
2024/03/27
06:10 UTC

3

Paywall Mittelbayerische Zeitung

Hallo, kann mir bitte jemand mit einem Script helfen, um die Paywall bei der Webseite der Mittelbayerischen Zeitung zu umgehen, damit ich darauf die News lesen kann? Alle Scripte oder Add-ons die ich für Firefox finde, sind alle nur für die größeren Portale. Ich lese aber eigentlich nur Mittelbayerische oder BR.

https://www.mittelbayerische.de/

Eng:

Hello, can someone please help me with a script to bypass the paywall on the Mittelbayerische Zeitung website so that I can read the news on it? All the scripts or add-ons I can find for Firefox are only for the larger portals. But I actually only read Mittelbayerische or BR.

4 Comments
2024/03/26
16:06 UTC

6

Keyboard navigation for the latest reddit?

Has anybody seen anything that could introduce the keyboard navigation to the latest reddit layout? The new.reddit.com version has this but the latest version aka www.reddit.com still hasn't, unfortunately (or, at least, it doesn't work for me).

I'm basically interested only in j / k to scroll the posts and h to hide the currently selected one, so may be that's possible to implement via a userscript? Would be so grateful :)

Thanks.

1 Comment
2024/03/25
15:57 UTC

1

Vsol router v2802ACT

Hello, is there any available userscripts for vsol v2802ACT router? I just need to make it bridge mode but ISP doesnt want to give the admin priviledges of the router.

2 Comments
2024/03/25
13:15 UTC

2

Bringing back the YouTube "Play All" button

Recently, I got fed up by the lack of "play all videos from this user" functionality on channels that do not manually add the Videos playlist to their home section.

Introducing: YouTube Play All (install by clicking here)

Your one click solution to this minor inconvenience.

\"Play All\" button, right where it should be

A simple userscript fixing YouTubes lack of UX competence.

2 Comments
2024/03/23
19:17 UTC

1

Looking for a script that forces Github to show exact dates instead of relative dates.

It's annoying when I I'm trying to see when something was uploaded to Github, and it says "a month ago" or whatever instead of "February 23rd, 2024".

This is especially annoying on mobile, because I can't hover my cursor over the relative dates to uncover the exact dates like I can on desktop.

I imagine this is likely something you can change in your account settings, but I'm not always logged in, so a userscript would make this easier for me.

3 Comments
2024/03/23
07:04 UTC

2

Help me removing this EventListener

Excuse me I'm a noob, i'm trying to remove the "click" EventListener for this button (practicing with tampermonkey), but it seems that the eventlistener is global, when I click remove (to test) every clickable button on the website stops working, I can't find a way to target / block the eventlistener from running on this specific button without affecting other buttons.

every eventlistener on the website, is bringing to the same function.
anyway to block the EventListener for the specific button with javascript ?

https://preview.redd.it/4gzuv66zhmpc1.png?width=1899&format=png&auto=webp&s=08b708e7dd26e9e675fdc35602eb4fc49792363a

https://preview.redd.it/9xrthevzhmpc1.png?width=1920&format=png&auto=webp&s=4fa87ba110d1ea3212fdad430160b4a4d7bf7370

5 Comments
2024/03/21
05:27 UTC

2

userscript to rewrite url on click

Looking for some pointers on creating a script to substitute all youtube link's url handler, eg:

https://www.youtube.com/watch?whatever to yt://www.youtube.com/watch?whatever

I have a ghetto working one that only convert the ones in buffer on pageload but for ajax/perpetual/infinite loading pages like reddit, it wont continuosly rewrite.

Ideally it would convert it on click, is something like this possible?

4 Comments
2024/03/21
03:12 UTC

Back To Top