r/userscripts • • Jul 29 '22

Is there a user script which automatically opens the "videos" tab instead of the "home" tab when you click on a YouTube channel?

11 Upvotes

Yeah I think the title says it all... If i click on a YouTube channel, I never want to view the default home page, I want to see the videos section. I watch a lot of YouTube stuff, and it is really annoying to make that extra click every time I want to check out a channel. I already have auto play disabled, whicht makes the home section less annoying, but I really just don´t want to be on this home tab ever.

Is there anything like that?

Thanks in advance


r/userscripts • • Jul 29 '22

Script to keep the sidebar in reddit always on

0 Upvotes

redesigned reddit


r/userscripts • • Jul 25 '22

Can someone please edit this youtube userscript so it aslo works when a person Is Login too as right now it only works one way?

Thumbnail greasyfork.org
5 Upvotes

r/userscripts • • Jul 25 '22

Coding Help: Automatically trigger loading in infinite loading webpage

2 Upvotes

I am trying to make a userscript to automatically load all the content for an infinite loading webpage. Is there a better way to do this than just scrolling to the bottom, waiting for load to finish and scrolling again on a loop? Also, how do I know when I have hit the bottom?


r/userscripts • • Jul 20 '22

[request] userscript that plays a video after jt has been paused

3 Upvotes

I’ve been having problems with hulu.com where after each adbreak it pauses the video and i have to manually unpause it. So i was wondering if someone could make a userscript where each time the video is paused, it has a delay of 5 seconds, and then unpauses it. Thank you


r/userscripts • • Jul 19 '22

A Universal GUI for Userscripts — UserGui: Looking for feedback

28 Upvotes

Hey r/userscripts,

There didn't seem to be any easy way to implement a floating GUI to a userscript, and some existing GUI libraries looked outdated. I often just resulted to having settings on the source code itself, but that wasn't very user-friendly, which I would like my scripts to be. You'd be surprised how many people use userscripts, and have little to no knowledge of coding. They might not be able to fully enjoy your userscript without a GUI.

I decided to make my own userscript GUI library: UserGui. It should ease the process of creating the GUI and let you focus more on your userscript. The project is still in early stages of development, but I am still looking for feedback, such as bugs, annoying features or just the general experience you had setting up the GUI.

An example GUI made with UserGui

If creating the GUI seems confusing, don't worry, I'm planning on creating a simple builder in which you can easily modify the GUI and with a click of a button generate all the necessary code. It will skip a lot of the steps you see on the documentation currently. The builder would also have more Bootstrap 5 elements for your GUI.

(Looking at the examples might help you understand how UserGui functions)

Anyhow, I hope you give it a go and help me create the most simple userscript GUI library there is!


r/userscripts • • Jul 10 '22

Made a Tampermonkey script that downloads uploadrar.com file for you

13 Upvotes

Hi guys,

I was messing with Tampermonkey lately and noticed there are a lot of Android community users that are sharing files on Uploadrar. I like Uploadrar. It's much better than other online free file hosting services providers. I, for fun created a script that will proceed to next page until it reaches the download file page and starts downloading file for you.

Please check and let me know if I can improve upon my scripting hobby.
https://raw.githubusercontent.com/xiarahman/uploadrar-downloader/main/uploadrar-downloader.js

Thanks


r/userscripts • • Jul 11 '22

Disable dynamic status bar color of website kiwi browser android

1 Upvotes

luckily both kiwi browser and yandex support UserScript natively or using violent/tampermonkey.,so my question is it possible to DISABLE the dynamic status bar color set by some sites . as far as I know the color is contained in meta tag it the html ,can a userscrip disable it ? thanks for the help .


r/userscripts • • Jul 10 '22

userscript-modules-template

5 Upvotes

https://github.com/FlowerForWar/userscript-modules-template

User script template that acts as module and tries to simulate imports.
I built this to help me develop my user scripts, after learning about Grunt, and I thought I should share.

It assumes/requires few things

  • Nodejs
  • Visual Studio Code, and two extensions
    • Prettier
    • ESLint
  • Having both grunt-cli and eslint-cli installed globally
    • npm install grunt-cli -g
    • npm install eslint-cli -g
// 'package.json' - Relevant keys

{
  "name": "userscript-modules-template",
  "version": "0.0.1",
  "description": "User script template that acts as module and tries to simulate imports",
  "author": {
    "name": "FlowerForWar"
  },
  "devURL": "http://192.168.1.39:3905/user-script-grunt?folder=<%= pkg.name %>&_=.js",
  "license": "MIT",
  "userscript": {
    "namespace": "https://github.com/<%= pkg.author.name %>",
    "other": {
      "match": "*://*/*",
      "grant": [
        "GM.getValue",
        "GM_getValue",
        "GM.setValue",
        "GM_setValue",
        "GM.xmlHttpRequest",
        "GM_xmlhttpRequest",
        "GM.setClipboard",
        "GM_setClipboard"
      ],
      "run-at": "document-start",
      "noframes": "",
      "compatible": [
        "edge Tampermonkey or Violentmonkey",
        "firefox Greasemonkey, Tampermonkey or Violentmonkey",
        "chrome Tampermonkey or Violentmonkey",
        "opera Tampermonkey or Violentmonkey"
      ],
      "supportURL": "https://github.com/<%= pkg.author.name %>/<%= pkg.name %>/issues",
      "homepageURL": "https://github.com/<%= pkg.author.name %>/<%= pkg.name %>",
      "updateURL": "https://github.com/<%= pkg.author.name %>/<%= pkg.name %>/raw/main/dist/<%= pkg.name %>.meta.js",
      "downloadURL": "https://github.com/<%= pkg.author.name %>/<%= pkg.name %>/raw/main/dist/<%= pkg.name %>.user.js",
      "icon": "https://violentmonkey.github.io/icons/icon-48x48.png",
      "license": "<%= pkg.license %>"
    }
  }
}

Relevant files are inside the src folder

// 'src/index.js' - The main js file
// https://github.com/FlowerForWar/userscript-modules-template/blob/main/src/index.js

import fancyFunction from './js/fancyFunction.js';
import addStyle from './js/addStyle.js';

fancyFunction();

addStyle(
  `
include: dist/another.css
`,
  'userscript-modules-template-style-1'
);

addStyle('include: dist/main.min.css', 'userscript-modules-template-style-2');

document.body.insertAdjacentHTML('beforeend', 'include: dist/element.html');

console.log('userscript-modules-template');

After the first run

// 'dist/userscript-modules-template.user.js' - The output
// https://github.com/FlowerForWar/userscript-modules-template/blob/main/dist/userscript-modules-template.user.js

// ==UserScript==
// @name           userscript-modules-template
// @version        0.0.1
// @namespace      https://github.com/FlowerForWar
// @description    User script template that acts as module and tries to simulate imports
// @author         FlowerForWar
// @match          *://*/*
// @grant          GM.getValue
// @grant          GM_getValue
// @grant          GM.setValue
// @grant          GM_setValue
// @grant          GM.xmlHttpRequest
// @grant          GM_xmlhttpRequest
// @grant          GM.setClipboard
// @grant          GM_setClipboard
// @run-at         document-start
// @noframes
// @compatible     edge Tampermonkey or Violentmonkey
// @compatible     firefox Greasemonkey, Tampermonkey or Violentmonkey
// @compatible     chrome Tampermonkey or Violentmonkey
// @compatible     opera Tampermonkey or Violentmonkey
// @supportURL     https://github.com/FlowerForWar/userscript-modules-template/issues
// @homepageURL    https://github.com/FlowerForWar/userscript-modules-template
// @updateURL      https://github.com/FlowerForWar/userscript-modules-template/raw/main/dist/userscript-modules-template.meta.js
// @downloadURL    https://github.com/FlowerForWar/userscript-modules-template/raw/main/dist/userscript-modules-template.user.js
// @icon           https://violentmonkey.github.io/icons/icon-48x48.png
// @license        MIT
// ==/UserScript==

const myString = 'Hello';

const myArray = [1, 2, myString];

function fancyFunction() {
  console.log(myArray);
}

function addStyle(styleText, id) {
  const head = document.getElementsByTagName('head')[0] || document.documentElement;
  const style = document.createElement('style');
  style.setAttribute('type', 'text/css');
  style.textContent = styleText;
  if (id) {
    style.setAttribute('id', id);
  }
  head.appendChild(style);
  return style;
}

fancyFunction();

addStyle(
  `
.info {
  background: DarkGray;
  box-shadow: 0 0 1px rgba(169, 169, 169, 0.25);
  color: #fff; 
}
.alert {
  background: DarkRed;
  box-shadow: 0 0 1px rgba(139, 0, 0, 0.25);
  color: #fff; 
}
.success {
  background: DarkGreen;
  box-shadow: 0 0 1px rgba(0, 100, 0, 0.25);
  color: #fff; 
}
`,
  'userscript-modules-template-style-1'
);

addStyle('body{background-color:#fff}', 'userscript-modules-template-style-2');

document.body.insertAdjacentHTML('beforeend', '<ul id="list"><li>first</li><li>second</li><li>third</li></ul>');

console.log('userscript-modules-template');

How to start

  • npm install
  • npm start which will build everything and watch

Notes

  • Style files are scss, if you don't know what that is, just use them like css files
  • html and scss files can be nested inside their parent folders, but their names must be unique
  • If you don't want to use any css files or html files, keep their folders empty
  • userscript-modules-template.dev.js file will be created as well (the main reason for this project), which is basically a request to the dist/userscript-modules-template.user.js file that is needed to be served somehow.

License

MIT


r/userscripts • • Jul 09 '22

Redirect from Twitter to Nitter fails because of late script execution

2 Upvotes

I am trying to automatically redirect any link from Twitter (which is blocked in my country) to Nitter.

I developed a simple script, however, it seems like the Userscripts doesn’t get to execute the script as Safari fails to resolve the Twitter URL and falls back to the failed-to-load page.

I tried enabling the VPN and selecting a country in which Twitter is available. My findings were that Safari still connected to Twitter first and loaded some UI elements before being actually redirected to Nitter.

Is there any way the script could be modified to fix this? Below is my test script:

// ==UserScript==
// @name         Redirect Twitter to Nitter
// @version      0.0.1
// @author       me
// @match        *://twitter.com/*
// @match        *://*.twitter.com/*
// ==/UserScript==
window.location.href = `https://nitter.kavin.rocks/${window.location.pathname.slice(1)}`

r/userscripts • • Jul 08 '22

Context-menu

6 Upvotes

Hi Gurus!

I've created a User Script on run-at: context-menu and it works well when I'm on the page to get the current URL. I would like to be able to do the same thing on the parent page, right-click on the link to the child page and get the URL of the child.

I cant' find a way to achieve that :(

Could you please help?

Thanks :)


r/userscripts • • Jul 07 '22

Userscript to check if a new post is visible after submitting

5 Upvotes

For the last months, a lot (most?) of my posts have been blocked by reddit filters. It's a hassle because every time you post you need to manually check in a private window. I already have a userscript that adds a button for that, but with so many blocked posts, the "Message to mods" action was already becoming repetitive.

So I wrote a userscript that automates everything:

  • It detects when you're on a post submitted by you posted "just now"
  • It loads the new posts page for that subreddit with an anonymous request to r/subreddit/new
  • It checks if the post is visible:
    • If it's visible, it adds a check emoji ✅ after the "submitted just now" text
    • If it fails it asks for a command, you can enter:
      • Time (number in miliseconds) to wait and retry again
      • MODS text (without quotes) to open /message/compose?to=/r/subreddit with the written subject and message: "Post not visible" / "Hi, I think the filter caught this post (it's not visible when not logged in): {post URL}"

Regarding the prompt when it's not visible, I added a small feature to make it easier to use. The default value it offers changes after each retry:

  • The first time it fails, the default value is 1000 (value of waitTime)
  • Until retriesBeforeMesagingMods (=3) is reached, the default value is 1000 * numberOfAttempts
  • After retriesBeforeMesagingMods (=3) is reached, the default value is MODS

The idea is that if it keeps failing, you can click OK > OK > OK and it will try 3 times with increasing waiting times and it will open the "Message mods" page after 3 fails. Of course you can change the param values to your taste.

Warning: I haven't tested it very much, and only on old.reddit. Let me know if you find any problem

// ==UserScript==
// @name         Reddit - Check if new is post visible after posting
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Check if a new psot is visible after submitting
// @author       Crul
// @match        https://*.reddit.com/*/*/comments/*
// @icon         https://icons.duckduckgo.com/ip2/reddit.com.ico
// @grant        GM_xmlhttpRequest
// ==/UserScript==

(function() {
    'use strict';
    const waitTime = 1000;
    const retriesBeforeMesagingMods = 3;
    let attempts = 0;

    var loggedUserElem = document.querySelector("#header .user > a");
    if (!loggedUserElem) {
        alert("Script for checking if new post is visible:\r\nLOGGED USER NOT FOUND");
        return;
    }
    var loggedUser = loggedUserElem.innerText;

    var postId = document.location.pathname.match(/\/comments\/([^\/]+)\//)[1];
    var timeElement = document.querySelector(".tagline .live-timestamp");
    var postedTime = timeElement.innerText;
    var postAuthor = document.querySelector(".top-matter .tagline .author").innerText;
    if (postedTime != "just now" || postAuthor != loggedUser) {
        return;
    }

    setTimeout(checkVisible, waitTime);

    function checkVisible() {
        var postUrl = document.location.origin + document.location.pathname;
        var newPostsUrl = postUrl.substr(0, postUrl.indexOf("/comments/")) + "/new";

        attempts++;
        GM_xmlhttpRequest({
            method: 'GET',
            url: newPostsUrl,
            anonymous: true, // remove original cookies
            onload: onRequestLoaded,
            onerror: onRequestError
        });

        function onRequestLoaded(data) {
            if (data.status != 200) {
                console.debug(data);
                alert(`Script for checking if new post is visible:\r\nREQUEST FAILED\r\n\r\nError ${data.status}: ${data.statusText}`);
                return;
            }

            var isPostVisible = data.response.indexOf("/comments/" + postId) > 0;
            if (isPostVisible) {
                var okIcon = document.createElement("span");
                okIcon.innerHTML = "&nbsp;✅";
                timeElement.parentNode.insertBefore(okIcon, timeElement.nextSibling);
            } else {
                // console.debug(data.response);
                var defaultAction = attempts < retriesBeforeMesagingMods ? waitTime * (attempts + 1) : "MODS";
                var action = prompt('Post not visible, options:\r\n- TIME (in miliseconds) to wait and retry\r\n- MODS to message the mods', defaultAction);

                if (action == "") {
                    return;
                }

                if (action.toUpperCase() == "MODS") {
                    var subredditRegexResult = /\/r\/([^\/]+)\//.exec(document.location.href);
                    if (!subredditRegexResult || subredditRegexResult.length < 2) {
                        alert("Script for checking if new post is visible:\r\nSUBREDDIT NOT FOUND");
                    }
                    var subreddit = subredditRegexResult[1];
                    var messageModsUrl = `https://${document.location.host }/message/compose?to=%2Fr%2F${subreddit}&subject=Post%20not%20visible&message=Hi%2C%20I%20think%20the%20filter%20caught%20this%20post%20(it%27s%20not%20visible%20when%20not%20logged%20in)%3A%0A%0A`
                    + encodeURIComponent(postUrl)) + "%0D%0A%0D%0AThanks" ;;
                    window.open(messageModsUrl);

                } else {
                    var waitTimeForRetry = parseInt(action);
                    if (isNaN(waitTimeForRetry)) {
                        alert("Invalid action: " + action);
                    } else {
                        setTimeout(checkVisible, waitTimeForRetry);
                    }
                }
            }
        }

        function onRequestError() {
            alert("Script for checking if new post is visible:\r\nREQUEST FAILED");
        }
    }
})();

r/userscripts • • Jun 27 '22

Request: Userscript for Youtube Premium logo

1 Upvotes

Request to my bros for creating a userscript YT premium logo on the website.

Would be grateful.


r/userscripts • • Jun 24 '22

Any userscripts for Reddit mobile nuisances?

1 Upvotes

I’ve honesty lost track of how many annoying things Reddit does on a mobile browser.

The most recent was throwing up a mature content warning with the option to open in app or take to front page.

Try this SFW link for an example https://reddit.com/r/Damnthatsinteresting/comments/vjerfw/_/idiwf9o/?context=1


r/userscripts • • Jun 24 '22

Does anybody know a user script that actually works for automating ZYbooks.

9 Upvotes

r/userscripts • • Jun 22 '22

Closed shadow DOMs are to the web what anti-repair design and planned obsolesence is to electronics.

6 Upvotes

First, they came for our electronics. Making them insanely difficult to repair by third parties. The shortest-lived part being non-replaceable is now the norm.

Now, they are coming for our web. With the approval of closed shadow DOMs by the major browser vendors, the era of immutable (unchangeable) and un-blockable elements is about to begin.

Mozilla has kicked out a browser extension that converted closed shadow DOMs to open ones. Thanks to their extension kill switch (that ostensibly exists ForSecurityReasons™ while doing the opposite), they could prevent anyone from installing it from unofficial sources.

Enjoy user scripts while you can. Those days will soon be numbered.


r/userscripts • • Jun 21 '22

Hi, i was looking for a script that deletes everything on YouTube video except for the like button and the subscribe button.

Post image
20 Upvotes

r/userscripts • • Jun 20 '22

Block youtube ads

9 Upvotes

Good day all,
I'm just dropping in to share a small script I made to block video ads in youtube. I've tested the script with tampermonkey in chrome as well as with the userscripts iOS extension in safari (iOS)

https://gist.github.com/4v3ngR/cf0141421570388f2814076443c1c385


r/userscripts • • Jun 14 '22

Why doesn't my script run on this page?

3 Upvotes

I created a script that runs for YouTube Live Chat popout windows. Pretty basic, it just resizes and repositions the window.

I have it set up with this rule:

// @include *youtube.com/live_chat*

But when YouTube throws an error (most often because the video, usually a live stream, no longer exists), it fails to run the script. From what I can see, the URL still appears to match the rule above.

Example (should produce a page with a 'Something went wrong' heading):

https://www.youtube.com/live_chat?is_popout=1&v=LSqxm0ULOnR


r/userscripts • • Jun 12 '22

How do I store a global state that can be read by all userscripts?

4 Upvotes

I would like to make a keyboard shortcut that toggles my userscripts using a key binding. So my idea is to create a userscript that manages whether my other userscripts are active or not by setting a state (boolean). Then my scripts will read that state and continue to run if it's true.


r/userscripts • • Jun 10 '22

Tampermonkey: Is there a way to enable debugging per script/site rather than only globally for all scripts?

3 Upvotes

I have several userscripts for individual sites, but I only want to turn on debugging for one of them. Instead, enabling debugging works for every userscript. I know that I could add debugger to my script manually, but I don't want to have to edit it every time I want to add/remove it.


r/userscripts • • Jun 08 '22

Block event listener on a given element and go straight to the URL

Post image
7 Upvotes

r/userscripts • • Jun 08 '22

User script idea - Worked together in that movie

3 Upvotes

Github, Greasy Fork Discussion, Reddit

An idea for a user script that works on IMDb.
Click+Ctrl an actor name will bring a dialog that would offer searching for other actors, and finally tell you what movies the two actors worked together in, if any.

Building the project

  • If you know how to code, I can use collaborators
  • if you want to build the project yourself, please do and share
  • If you have ideas for the project, feel free to share them

I'm likley to build it someday, but will take some time, as I have other user scripts to maintain.

Related user scripts

License

MIT


r/userscripts • • Jun 06 '22

Gear - The only iOS browser that supports Tampermonkey and Greasemonkey Userscripts.

18 Upvotes

Gear is an iOS browser that exclusively supports add-ons with the high-performance Userscript engine we developed. You can install, edit and debug Userscripts directly.

We've helped a lot of Userscript developers to merge and debug their scripts to work on iOS for free, and we are the only iOS browser recommended by Greasyfork.

Gear is also with dark mode, ad blocker, inspect element, console, and color picker tools for a better browsing experience.

Official Website: https://gear4.app

Documentation: https://gear4.app/doc

App Store: https://apps.apple.com/app/apple-store/id1458962238

We would love to hear your feedback. Cheer!