/r/userscripts
A place for discussion of all things related to userscripts.
A place for discussion of all things related to userscripts.
RELATED:
/r/userscripts
Hi!
Can someone help me create a script that automatically expands "Show more" in the youtube sideba. I found this script but it no longer works. I tried to edit it but unfortunately I'm not good at javascript
YouTube - automatically expand subscription list
Thanks in advance for reading.
Recently Artstation has made a bizarre change in making a once persistent icon that shows if a gallery has multiple images to one that shows up on mouse hover.
Example gallery https://www.artstation.com/felixriano
Before Hover
After Hover (note the image preview hover is a extension)
It appears that simply changing a style from display: none to display: block lets the icon appear. But it has been many years since I've worked on this stuff and I am unsure how to apply this.
Example - Display: block;
I am not sure how to target the entire gallery in a way that the icon is persistent despite any new instances of the mouse hovering over a thumbnail. As with just changing the display from none to block is only temporary till you hover over the thumbnail.
This script assigns a unique background color to each username based on their name. Makes it easier to differentiate users on the page (only works in old.reddit)
// ==UserScript==
// @name Random Colors for Users On Reddit
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://old.reddit.com/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=reddit.com
// @grant none
// ==/UserScript==
let authorColors = new Map();
function Main() {
let _authors = document.getElementsByClassName('author');
for (let i = 0; i < _authors.length; i++) {
let authorName = _authors[i].innerText;
if (!authorColors.has(authorName)) {
let color = stringToColour(authorName);
authorColors.set(authorName, color);
_authors[i].style.color = color;
} else {
_authors[i].style.color = authorColors.get(authorName);
}
}
setTimeout(Main, 500);
}
function stringToColour(str) {
let hash = 0;
for (let i = 0; i < str.length; i++) {
hash = str.charCodeAt(i) + ((hash << 5) - hash);
}
let colour = '#';
for (let i = 0; i < 3; i++) {
let value = (hash >> (i * 8)) & 0xFF;
colour += ('00' + value.toString(16)).substr(-2);
}
return colour;
}
Main();
I recently found this userscript that adds a speed playback to yt music, I love it, however I have two problems, I would like to disable the pitch correction when changing the speed, I tried this but it didn't work.
(function() {
'use strict';
const originalPlaybackRate = HTMLMediaElement.prototype.playbackRate;
Object.defineProperty(HTMLMediaElement.prototype, 'playbackRate', {
set(value) {
// Set the playback rate without pitch correction
this.defaultPlaybackRate = value;
this.playbackRate = value;
},
get() {
return originalPlaybackRate.get.call(this);
}
});
})();
The second thing is that when I click to change the speed it also clicks on the player and it closes and I don't know how to fix it.
I prefer to view/read Reddit via new.reddit.com
interface, but do all the moderation stuff from reddit.com
(aka sh.reddit.com
) version. This includes the mod queue, which I open by clicking the little shield icon and selecting 'Mod Queue' there. It opens https:///new.reddit.com/r/mod/about/modqueue and I want to use https://www.reddit.com/mod/queue, so I wrote this very basic script:
// ==UserScript==
// @name Always New ModQueue
// @namespace 9bf36c681d35d52913b3bda74ddf6127318ed7b0
// @version 0.1
// @description Forces opening mod queue in sh.reddit
// @author /u/eftepede
// @match *://new.reddit.com/r/mod/about/modqueue
// @grant none
// @run-at document-start
// ==/UserScript==
(function () {
'use strict';
top.location.replace("https://www.reddit.com/mod/queue");
})();
Unfortunately, it doesn't work when I click the icon (or even right-click it and try opening in a new tab). I always get the new.reddit...
page, but when I refresh it via standard Ctrl+r, the redirection works.
What am I doing wrong?
Hi!
I'm aware that there's subreddits that allow users to upload pictures in a post directly. However, this feature seems to be restricted to the new/beta Reddit design though, which I don't really like. It's a lot more wasteful in terms of how much meaningful content is packed at any given time on screen.
So yeah, I figured I'd check over here and see if anyone could make a userscript that allows something like drag-and-dropping an image into the comment box on Old Reddit to post images directly, to avoid constantly having to go back and forth between the new and the old Reddit designs.
Thanks in advance for reading.
An unofficial script collection created using the cobalt.tools API.
Currently available scripts:
When using Google Sheets on MacOS with a Scandinavian keyboard layout, it unfortunately hijacks several keyboard combinations required to type in crucial characters, such as $, { and }.
I made this workaround to allow typing in the missing characters and have been using it a while with great effect.
The workaround may work for other country-specific keyboard layouts. It’s been very thoroughly been tested with the Danish keyboard.
Note: Google Sheets use these keys for range selecting etc. and those functions are not remapped to other keyboard combinations. Not a loss at all, IMHO.
https://gist.github.com/f-steff/ace84434e1ee4e1107bcf0ba8d72ed2b
ok, i'm pretty sure that you guys are going to pile on and eviscerate me for asking this, but I've got a number of userscripts running for youtube - normally everything is fine/great. All of a sudden (translation: no idea why; didn't change anything) it is playing 5 seconds of each track and skipping to the next one in the queue or playlist - whichever you're in! SO unbelievably frustrating. I've tried disabling all the scripts and turning them on one at a time, but as soon as I get the two functions i require (working ad skip+local download) - here comes the bullshit skipping. I'm in Edge. Also tried turning on dev tools, hoping I could figure out how to get it to stack trace in realtime, but honestly, I don't know how to use this very well. All my debugging/QA experience is multi decades old. I'm hoping that after I wade through the 35 oblgatory assholes calling me every kind of stupid for asking the question, some kind person will have perhaps heard of this behavior and tell me how to get it to stop. Thanks!
Spotify Enhancer is a set of userscripts that enhance the5. Spotify Web Player by adding download buttons for tracks and playlists, along with an overlay button to view and download full-sized 2000px album cover art.
Currently available scripts:
I'm using voilent monkey in kiwi browser (android), i want to bypass NSFW links but when i use bypasser script it bypasses but redirects to a scam video page and not the actual content is there and script that works as good as bypass.city??
YouTube Enhancer is a set of userscripts that enhance your YouTube experience with features like a screenshot button, loop button, channel ID reveal, live video view count, and revealing the hidden upload date/time, among other features.
Currently available scripts:
Hi all, brand new to Userscripts and terrible at code.
I am trying to find a way to highlight specific words or characters on an HTML/CSS/JS page in Safari. Has to be Safari due to company requirements.
A good example of what I want to do it like the find command. I found Multi Find for other browsers and that’s almost perfect but doesn’t work in Safari
I’m trying to highlight things like “.co” “app.” Or “+44” these are often mid line so only wanting to highlight parts of elements.
Unfortunately I can’t upload an example of the page for privacy reasons, but would really appreciate and guidance, dumbed way down if possible.
Is Userscripts the right tool to even be looking at?
I've recently been directing the development of TeXSend, which is intended to eventually be a suite of userscripts for adding LaTeX compiling to popular email services. Right now, TeXSend-Gmail is in a good place, and I'd like to port this over to work with Outlook.
The programmer who I've relied on for the majority of the coding for TeXSend-Gmail has some other responsibilities that they need to attend to for a while, and so will be unavailable to continue working on this. I'm hoping to find someone who is able to work on this port. I'm able to do testing and minor JS adjustments, but I'm far from a skilled JS programmer myself.
I need to clarify, this is non-profit work being distributed under an MIT license. As such, I cannot offer any compensation other than credit as a contributor. This is a suite that will hopefully prove beneficial to many people in STEM (academia in particular), and I hope that alone is sufficient encouragement for someone to volunteer.
Thank you.
Note: Title should have said "TeXSend". "TeXMail" was a working title.
This user script adds a floating panel to Google Maps place pages, allowing you to scrape and export reviews easily.
URL: https://greasyfork.org/en/scripts/510952-google-maps-reviews-scraper-exporter
Google Maps Reviews Scraper & Exporter in Action
For each review, the script collects:
Enjoy more accessible access to Google Maps review data with this handy user script!
I have a very specific use case for a tampermonkey userscript. I need an inactive tab on my firefox browser to get a looping key presses and mouse clicks at a specific coordinate while I browse the net on another tab. Is this possible?
Obviously, this is for some idle game that I am running in a background tab while I do something else. Idle Wizard on kongregate is what I'm playing.
More specifically, the parameters I need are something like this.
Every 5 seconds:
Loop this indefinitely until i disable it.
I tried to do it on AHK which has a simplified code that a random dude like me can understand, but I'm finding that AHK cannot really distinguish a specific firefox tab that is running in the background. As for userscript code system, it's way too complicated for me to understand without any programming knowledge.
Edit: Solved! See comments.
function addShortcuts() {
const keyHandler = (e) => {
if (e.shiftKey && e.code === 'KeyL') {
toggleLatex()
} else if (e.shiftKey && e.code === 'Slash') {
waitForElement('body > div.wa:not(.aou) > div[role=alert]', 5).then(d => {
const xpath = '//tr[th/text()="Formatting"]/following-sibling::tr';
const row = document.evaluate(xpath, d, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
const html = '<td class="wg Dn"><span class="wh">Shift</span> <span class="wb">+</span> <span class="wh">L</span> :</td><td class="we Dn">Toggle LaTeX</td>';
row.innerHTML = html;
});
}
}
window.addEventListener('keypress', keyHandler);
}
I can make this "shift + [alphanumeric]", but nothing else actually works.
I'd particularly like like do "ctrl+alt+L".
The userscript in question: https://github.com/LoganJFisher/LaTeX-for-Gmail
If you want the buttons to look prettier you can edit the add_button
function
Edit: This has gradually evolved into this project: https://github.com/LoganJFisher/LaTeX-for-Gmail?tab=readme-ov-file
I'm looking to find a way to add LaTeX equation rendering to Gmail in Firefox. Could someone create such a userscript please?
I've tried searching for Gmail add-ons, Firefox extensions, and userscripts (using Greasemonkey and ViolentMonkey). I even tried editing the MathJax for Reddit userscript by changing its @match URL to https://mail.google.com/*, 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 userscript "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
I'm getting desperate and frustrated that my attempts keep failing ad I don't understand why.
Replace the YouTube logo with a custom logo styled to resemble the original logo but with the text “FuckYou” or "Fuck YouTube".
Fuck YouTube - https://greasyfork.org/en/scripts/508890-youtube-logo
FuckYou - https://greasyfork.org/en/scripts/508696-you-logo-on-youtube
Tried making my first user script (i had few for personal use before), let me know if I made any mistakes or if this kind of scripts even allowed or not lol.
https://greasyfork.org/en/scripts/451541-instagram-video-controls no longer works or FOSS extension
i'm bored and enjoy javascript challenges, if theres anyone who needs any scripts that are time-consuming or just difficult in general, send it over so i can have something to do
I am a new MacBook user, trying to stick with Safari as my browser. In Windows, I used to customize a couple of web pages with Stylebot and Stylish. They had visual interfaces with an element picker, and didn't require any coding knowledge to use. The few apps/extensions I've seen for MacOS Safari don't seem to have that kind of interface; you have to know how to create the code.
My preference would be to use a GUI Safari extension, if one exists, to create my own style sheet, picking elements and previewing changes directly on the page. But if that's not possible, I'd be content with installing styles from other users. I have the Userscripts extension, and I've tried installing some scripts from the Greasy Fork site, but I can't seem to add them via the green "install" button per the instructions; that only brings up the page with the code. I've tried copying and pasting the code via the "create" function in Userscripts, while on the website I want to change. I've also tried the built-in stylesheet field in the advanced Safari settings, which seems like it might be a way to install styles without the use of a separate extension, but haven't had any luck with that. (Maybe it won't work for a per-site script?)
Any help would be appreciated.
I'm excited to introduce a new userscript I've developed called 1337x - Combined Enhancements 2025 (v11) - Configurable. This script aims to enhance your browsing experience on the 1337x torrent site with various configurable features that improve both usability and aesthetics.
Download: https://greasyfork.org/en/scripts/483602-1337x-combined-enhancements-2025-v11-configurable
The script is available on GreasyFork and can be easily installed using Tampermonkey or other userscript managers. You can find it here: 1337x - Combined Enhancements 2025 (v11) - Configurable.
I'd love to hear your thoughts, suggestions, or any issues you encounter. Feel free to ask questions, post reviews, or report issues directly on GreasyFork or here in this thread.
Enjoy a more efficient and visually pleasing way to use 1337x!
I have been locally building it and finally released the prototype to Greasy Fork: https://greasyfork.org/en/scripts/506067-pluto-tv-m3u8-grabber
I suck at making ui’s for Userscripts anyone knows a site where u make it there?
I'm sort of poking around learning more about JS and webdev (so far I know nothing 😅) and I recently came across xmlhttprequests which I thought were really quite cool. I want to make a sort of semi-automated scraper thing. Like maybe add a button to a page, and if you click it it'll grab some data from the page, and then send off the xhr request and... do something with the results. Maybe save it to a file or something, I haven't thought that far yet to be honest.
Could anyone help explain how I might do this? I have come across some of the specification on xhrs and it's still a bit dense for me to follow. And I'm also not sure how to translate all of that into something I could run from a userscript. I have Violentmonkey if that matters any.
I have a user script for the passbolt website. Initially it was supposed to be a user stylesheet, but somehow that stylesheet has no effect. I will post it all.
The annoying thing on that website is, that I cannot resize the left sidebar/panel. This requires me to have the browser window fullscreen, to be able to read all labels fully in the left panel. The left panel is a kind of folder tree, that lets you browse all the secrets you have access to. The silly styling of passbolt sets this left panel to a width of exactly 18%.
Here is my apparently ignored user stylesheet, which already tells what I want to achieve ultimately:
.page .panel.left {
width: 24% !important;
}
.page .panel.middle {
left: 24% !important;
width: 76% !important;
}
This user stylesheet is also shown as "active" by the Stylus extension of Firefox, yet the set styles are not shown in the browser inspector, when I select the div
that has the classes panel
and left
.
So I figured, that this is a shitty website, that requires me to use mutation observer and such, to wait until the site has fully loaded, because it might set style using JS. I searched around for a bit and found a solution for waiting until an element appears. At least I think it should work that way. I also added a maximum time, that it waits for the element to appear. Here is my code:
// ==UserScript==
// @name New script passbolt.com
// @namespace Violentmonkey Scripts
// @match https://cloud.passbolt.com/*
// @grant none
// @version 1.0
// @author -
// @description 8/1/2024, 11:31:18 AM
// ==/UserScript==
const waitForElementTimerDuration = 10000;
function waitForElm(selector) {
return new Promise((resolve, reject) => {
// create a timer to wait for the element for a maximum duration
const timeoutTimer = setTimeout(
(selector) => {
reject("element selected by", selector, "could not be found in time (", waitForElementTimerDuration, ")")
},
waitForElementTimerDuration,
selector
);
// initially check, whether the element already exists
if (document.querySelector(selector)) {
// deactivate/disarm the timeoutTimer
clearInterval(timeoutTimer);
return resolve(document.querySelector(selector));
}
// create an observer, that checks for the element
const observer = new MutationObserver((mutations) => {
// if the element can be found stop observing and the timeoutTimer
if (document.querySelector(selector)) {
// deactivate/disarm the timeoutTimer
clearInterval(timeoutTimer);
// stop observing
observer.disconnect();
resolve(document.querySelector(selector));
}
});
// If you get "parameter 1 is not of type 'Node'" error, see https://stackoverflow.com/a/77855838/492336
// start observing the whole document body for changes
observer.observe(document.body, {
childList: true,
subtree: true
});
});
}
const left_pane_width = 24;
const main_pane_width = 100 - left_pane_width;
const awaited_selector = ".panel.main .panel.left";
waitForElm(awaited_selector)
.then((success) => {
const main_panel = document.querySelector(".panel.main");
const left_pane = main_panel.querySelector(".left");
const middle_pane = main_panel.querySelector(".middle");
left_pane.style.width = left_pane_width.toString().concat("%");
middle_pane.style.width = (100 - left_pane_width).toString().concat("%");
middle_pane.style.left = left_pane_width.toString().concat("%");
})
.catch((error) => {
console.error("failed to find element with selector:", awaited_selector);
});
Feel free to copy and use whatever you need, if you find it useful.
However, this doesn't seem to work. I always run into the timeout, as if the element never appeared. This is weird, because I can see the element in the browser inspector as <div class="panel left">
. But document.querySelector(".panel.left")
still returns null
. I also don't understand, why my user stylesheet is not working, since it should always be active, regardless of how long the site takes to build its DOM or sets styles using script. It should at the very least be shown as strikedthrough rules in the inspector, but I don't see any of that.
Are they f'ing with the document.querySelector
in weird ways? Or am I having a mistake somewhere?