r/tampermonkey

Is there a way to put a lot of @resource statements into a separate local file?

I'm trying to create a script that compares information between some text files I have locally on my PC and a website. The general idea is that the files are categories for items on the website, and I want to be able to display the category on the website.

There are over 70 of these files, and the list may change, so rather than hard-code the filenames into @ resource lines in my script, I would prefer to have a local file that has all the @ resource lines in it, that I could (maybe) script up automatically from a list of the files I want to include into something like a script? I tried putting @ resource statements into a js file and did a @ require of that file, but the resources didn't seem to get loaded.

Or am I going about this the wrong way? Is there a better way to read the information from 70+ local files to have available in my script?

Please let me know if you have any ideas or need clarification

reddit.com
u/JackofAll99Trades — 4 days ago
▲ 18 r/tampermonkey+2 crossposts

[Userscript] Make Chrome use Lanczos3 to upscale images instead of whatever blurry nonsense it uses. Also has Fit-to-width and Integer-fit-to-width capabilities! Particularly good for 4K displays set to over 100% scaling.

GitHub link.

Controls

Key What it does
Alt+H Show or hide the info overlay. Remembered per site
Alt+M Size: fit the window width → biggest whole-number zoom → one image pixel per screen pixel
Alt+Q Filter: Lanczos3 → nearest → browser. Same size each time, so you can compare
Alt+P Turn on or off for the site you're on. Remembered per site
Alt + left clickon an image Show that one image at one image pixel per screen pixel
Alt + right clickon an image Show that one image at twice its own resolution
Alt+G Show or hide the overlay's diagnostic rows (size, factor, status, memory)

I'd attach images, but I'm pretty sure reddit will compress them, so go check them out here.

u/Ikkoru — 6 days ago

Problem creating a very simple autoclicker

First off: I'm not a programmer and I barely know any JavaScript. I want to use Tampermonkey to create an automation that clicks a button called PROCESS on a page with multiple identical buttons (in name). When I click one, it disappears (the page doesn't refresh), and what I want is for them to be clicked one after the other with a 60-second interval (the order of the buttons doesn't matter).

The buttons are identified by `type="button" value="PROCESS"`.

I asked Gemini for help, and they gave me some code that seems correct, but somehow it doesn't work. Any idea?

// ==UserScript==
//  60 seconds
//  website url
//  0.1
//  try to take over the world!
//  You
//  *://*/*
//  none
// ==/UserScript==

(function() {
'use strict';

const INTERVAL_MS = 60000; // 60 seconds

function pressNextButton() {
// Selects exactly the button inputs with the value PROCESS
const buttons = document.querySelectorAll('input[type="button"][value="PROCESS"]');

if (buttons.length > 0) {
console.log(`[Autoclicker] ${buttons.length} buttons remain. Clicking the first one...`);

// Triggers the native click event
buttons[0].click();

} else {
console.log('[Autoclicker] No more PROCESS buttons were found. Process completed.');

}
}

// Waits 3 seconds for the page to load the elements before the first click
setTimeout(() => {
pressNextButton();
setInterval(pressNextButton, INTERVAL_MS);

}, 3000);

})();
reddit.com
u/De-monV — 8 days ago

What are your favorite Tampermonkey userscripts? Looking for useful scripts as a beginner

Hey everyone!

I’m pretty new to Tampermonkey and I’m currently looking for useful and interesting userscripts to try. There are so many scripts available that it’s a little difficult to know which ones are actually worth installing.

I’d love to hear about your favorite Tampermonkey scripts — especially ones you use regularly or would recommend to someone who is just getting started.

If possible, could you list the name of the script and briefly explain what it does and why you like/use it? It would be really helpful to see not just the popular scripts, but also some lesser-known ones that you personally find useful.

For example:

  • Script name — What it does
  • Why you use it — What problem it solves or what makes it useful
  • Websites it works on — If it’s specific to certain sites

I’m interested in anything useful: productivity, improving websites, adding missing features, customization, YouTube, Reddit, downloading/media, shopping, automation, quality-of-life improvements, etc.

Basically, what are the Tampermonkey scripts you personally wouldn’t want to browse the web without?

Feel free to share as many as you want. I’d really appreciate a list of your favorites with a short explanation of each one!

Thanks!

reddit.com
u/317seref — 10 days ago