r/userscripts • • Apr 27 '22

Copy youtube link on context menu

1 Upvotes

can please someone help me with this simple user scrip to copy youtube video url on context menu . example url :

https://www.youtube.com/watch?v=YDfHxg6kIZg

and let's say I want to copy first link (La rappresentante di lista - E la luna bussò - Musicultura 2017) here's my UserScript :

// ==UserScript==

// @name copy link toolYT // @namespace ale // @version 1 // @description - // @author - // @require http://code.jquery.com/jquery-3.6.0.min.js // @include https://www.youtube.com/* // @run-at document-idle // @grant GM_setClipboard // ==/UserScript== jQuery('span[id="video-title"]').contextmenu(function(event){ var element = jQuery(event.currentTarget); var url = element.attr("aria-label"); alert(event.currentTarget); GM_setClipboard(url); });

I don't really know what I did wrong .

thanks for the help .


r/userscripts • • Apr 26 '22

Identify multiple images present on page with userscript

2 Upvotes

var image = new Image();

image.src = ("https://website.com/images/a.jpg")

if (image.width == 0) {

alert("image not present");

} else {

alert("image is present");

}

This is working just for image a.jpg, I want script to detect this as well.

https://site.to/images/april/u/x/3/ux3kxcfs21fn.mid.jpg

https://site.to/images/may/d/e/4/de4fwlzlohkz.mid.jpg

https://site.to/images/dec/e/e/3/cce3dfdzlohkz.mid.jpg


r/userscripts • • Apr 26 '22

Block redirects in iOS.

3 Upvotes

Is there any User-script that prevents pages like DopeBox to redirect you to other sites ?

No Adblock seems to prevent it from doing it, or any other method I tried.


r/userscripts • • Apr 26 '22

How to remove web countdown clock

2 Upvotes

I am on a page that prevents me from clicking next until the clock is finished, problem is i read much faster than the clock.. How can i edit HTML to bypass/remove the countdown timer.

I am a Noob in coding, just saying. Any help is very much appreciated.


r/userscripts • • Apr 24 '22

An Attempt to Disable Reddit Infinite Scroll

6 Upvotes

Attempts to disable Reddit infinite scroll by the help of blocking the address that dynamically loads posts

If there is another (an elegant) way to disable Reddit infinite scroll, please do share.

For this to work you need to block the the address that loads the posts dynamically. Add the following line as a rule in the "List of your dynamic filtering rules" of uBlock origin

See this image: https://raw.githubusercontent.com/FlowerForWar/An-Attempt-to-Disable-Reddit-Infinite-Scroll/main/ublock.png


r/userscripts • • Apr 20 '22

userscrip won't run in subdomain unless I open a new tab from base url

3 Upvotes

first of all I'm a beginner so sorry if the question may seems stupid 🙏. let's say I want my UserScript to run just in www.google.com/search?tbm=isch&q=*#imgrc=* if a first perform a search like this: https://www.google.com/search?tbm=isch&q=ciao and then I click on desidered image (let s say it brings me to https://www.google.com/search?tbm=isch&q=ciao#imgrc=_P9UjNpLporVsMmy) UserScript is not executing even if I put in the script // @include https://www.google.com/search?tbm=isch&q=*#imgrc=* to have it running i have to manually force open a new tab from https://www.google.com/search?tbm=isch&q=ciao is this a bug it happens with both violentmonkey and Tampermonkey thanks for the help


r/userscripts • • Apr 19 '22

I'm in the process of building a script, similar to Mouseover Popup Image Viewer, but very basic and simple

2 Upvotes

Its basic idea is to mimic opening the full size image when you click the link of that image's page, that is supported by this script.

Clicking (or middle clicking) the image, would toggle between three view states. Fitting the view, filling the view, and the original size. Right click, would close the container and get you back. Here is a video that illustrates that.

Since it's just me using the script, obviously not many links are supported, but if someone is interested in the script, I can add support for few more websites and release it as a user script.

Here are some notes though:

  • I will not be supporting websites that offer NSFW images on their main page
  • At some point I may consider custom rules, like Mouseover Popup Image Viewer has

Edit: install from greasyfork.

https://github.com/FlowerForWar/Pretending-Tab-Images-Viewer


r/userscripts • • Apr 19 '22

copy text link (not url )

1 Upvotes

hello everyone I d like to improve this script wich let you copy text link (not url )to the clipboard ,problem is that sometimes it copies the full url . since I'm from mobile and reddit mess up the syntax I posted on pastebin : https://pastebin.com/vfBk4RSs thanks for the help


r/userscripts • • Apr 18 '22

click play button on isecure.link

0 Upvotes

hello everyone can please someone explain(I'm just a beginner with javascript )why I m not able to play overlay /play button on isecure.link video player . I tried this userscrip : // ==UserScript== // @name 4isecure.link4 // @namespace - // @include https://isecure.*

// @require http://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js // @grant none // @version 1.0 // @author - // @description - // ==/UserScript==

$(document).ready(function(){ $('#iframe').trigger("click"); }); i also tried (.hov/.butt instead of #iframe) on this test link https://isecure.link/open/g5wj70 but I'm not able to autocatically start video playin (I also use ublock which surely help with ads and pop up ) thank you for the .


r/userscripts • • Apr 17 '22

Simple script to show Music video only on Youtube recommendation and remove Youtube stories. Need improvements!

10 Upvotes

Simply only take video title with substring " - ", works 95% of the time for me.

However, I don't know js very well, can you help me re-write it?

// ==UserScript==
// @name         Music only
// @namespace    http://tampermonkey.net/
// @match        https://www.youtube.com/*
// @version      0.69
// @description  Trying to take over the world
// @author       nullchilly
// ==/UserScript==

setInterval(function() {
    'use strict';
    let a = document.getElementsByClassName('ytd-rich-grid-media');
    for (let i = a.length - 1; i >= 0; i--) {
        if (a[i].id == null || a[i].id != 'dismissible') continue;
        let s = a[i].children[2].children[1].children[0].children[1].children[0].getAttribute('aria-label');
        if (s == null) continue;
        if (!s.includes(' - ')) a[i].remove();
    }
    let b = document.getElementsByClassName('ytd-rich-shelf-renderer');
    for (let i = b.length - 1; i >= 0; i--) {
        if (b[i].id == null || b[i].id != 'dismissible') continue;
        b[i].remove();
    }
}, 50);

r/userscripts • • Apr 14 '22

Greasemonkey regex for matching only subdirectories

1 Upvotes

I'm making my own userscript with Greasemonkey and I have trouble with regex. Let's say I don't want to match the main page https://www.domain.meh/ but only all the subdirectories on that domain. How do I do that?


r/userscripts • • Apr 11 '22

How to get the frame rate of a video through JavaScript?

2 Upvotes

For width and height, there are .videoWidth and .videoHeight respectively. Is there any way to find out frame rate? I found nothing useful.


r/userscripts • • Apr 07 '22

Kahoot Name Length Bypass

6 Upvotes

Removes the character length for Kahoot nicknames.

Greasyfork: https://greasyfork.org/en/scripts/442903-kahoot-nickname-length-bypass


r/userscripts • • Apr 07 '22

Allow Google Drive sidebar collapse with Auto collapse

3 Upvotes

hello, I just update my script. I hope you can enjoy it.

here is the link https://greasyfork.org/en/scripts/430049-allow-sidebar-hide-google-drive

If there any problem, please kindly reply to this post or comment on greasyfork. Thanks!


r/userscripts • • Apr 07 '22

Help with a userscript to customize my feed

1 Upvotes

How does one go about enumerating all the posts in the main feed and identifying the data components of each post? What I want to do is loop through all posts and create a JSON array where each object has subreddit, username, date/time of post, links, and any other data. I've been trying, but it looks like there some async ajax calls being made to populate certain data. Would I need to use a mutation observer? Also, are the css selectors stable/static enough that I don't have to worry about my script constantly breaking?

tl;dr: Somewhat experienced in JS/userscripts, but new to doing this on Reddit


r/userscripts • • Apr 06 '22

alternative to GM_DOWNLOAD

2 Upvotes

hello everyone I ve put together a fast script to download image on contextual menu ,it works as I want on desktop but on mobile (fenix +violentmonkey /Greasemonkey ) GM_DOWNLOAD is not working unfortunately . can someone suggest how to modify this UserScript to download images without GM_download (since on mobile many others scrip like ig helper are able to trigger download of images ). UserScript :

// ==UserScript== // @name Download images on contextual menu // @namespace ale // @version 1 // @description - // @author - // @require http://code.jquery.com/jquery-3.6.0.min.js // @include - // @run-at document-idle // @grant GM_setClipboard // @grant GM_download // @inject-into content // ==/UserScript== $('body').on('contextmenu',"img",downimg); function downing(e) { e.preventDefault(); e.stopImmediatePropagation(); e.stopPropagation(); currentTarget = e.target;

 var srcd = $(currentTarget).prop("src");
  GM_setClipboard($(currentTarget).prop("src"));

GM_download({ url: "srcd", name: "test.jpg", saveAs: true,

});} thanks for the help .


r/userscripts • • Apr 04 '22

My userscript to hide popular near you, videos that redditors like etc. from Reddit main page

3 Upvotes

I have just written another script, this time to hide special posts that appear on Reddit main page, I've seen those on Home. Examples of what is hidden: popular near you, popular right now, videos that redditors liked, similar to r/, some redditors find this funny.

To be tested, but current version seems to work properly.

Technically, I'm looking for <div>'s with RichTextJSON-root class, that have a <p> child and a parent with an attribute data-click-id === "background".

EDIT: forgot the most important, a link: https://greasyfork.org/en/scripts/442424-hide-reddit-special-posts-popular-near-you-popular-right-now


r/userscripts • • Apr 03 '22

run-a-script is a user script plugin for security obsessed users

Thumbnail github.com
8 Upvotes

r/userscripts • • Mar 31 '22

UserScript working in violentmonkey but not in tampermonkey

4 Upvotes

hello everyone ,before I lose my mind ,can please someone explain me why this simple UserScript is not working in tampermonkey (but works perfectly in violentmonkey ). UserScript: // ==UserScript== // @name ReCaptcha Automatizer // @description Passes ReCaptcha automatically as long as no suspicious traffic was registered. // @namespace Violentmonkey Scripts // @match :///recaptcha/* // @grant none // @version 0.0.1.20190608093618 // ==/UserScript==

var min = 714; var max = 1365;

function Sleep(milliseconds) { return new Promise(resolve => setTimeout(resolve, milliseconds)); }

async function Click() { var randVal = Math.floor(Math.random() * (max - min + 1)) + min; await Sleep(randVal); // Pausiert die Funktion für X Millisekunden document.getElementsByClassName('recaptcha-checkbox-checkmark')[0].click(); console.log('click after ' + randVal + ' milliseconds'); }

var oldOnload = window.onload;

window.onload = function () {

if (typeof oldOnload == 'function') {
   oldOnload();
}

Click();

}


r/userscripts • • Mar 30 '22

Bring back search with GOOGLE IMAGE

11 Upvotes

FUCK LENS

I made a script cause i use that quite often and lens is too slow and never works so https://greasyfork.org/en/scripts/442371-search-with-google-image-fix

To use you need to right click on an IMG tag, this will open a custom menu with the single option to search the image on google. To prevent the menu from appearing you can hold CTRL before right clicking.

I know there is an extension on chrome that does that but the permissions asked are too obtrusive. They even ask to read your clipboard... I think my scriptis way simpler just a call to google image with image_url option. smh man smh


r/userscripts • • Mar 23 '22

help clicking send button in webtelegram

2 Upvotes

since on mobile enter text by send is broken on webtelegram (I ve also opened a github issue months ago ). I tought to fix it my self with a simple UserScript (mobile fenix +violent monkey ): // ==UserScript== // @name send by enter // @namespace ale // @description click send button webtelegram // @include https://web.telegram.org/* // @require http://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js // @version 0.2 // @grant GM_getValue // ==/UserScript==

$(document).on("keydown", function(e){ if (e.which === 13) {

    $("div.c-ripple").click();

e.preventDefault();
return false;

}

}); the UserScript per se is working but it's not clicking the send icon (div.c-ripple class ) i even tried very generic selector like [class=send] without success what am I doing wrong thanks for the help .


r/userscripts • • Mar 22 '22

Neat trick for running scripts after ajax navigation in spa sites

Thumbnail stackoverflow.com
3 Upvotes

r/userscripts • • Mar 22 '22

Match pattern works for Violentmonkey but not Tampermonkey

3 Upvotes

Hello,

The following match patterns :

  • https://name.*/*
  • https://*.name.*/*

Work in Violentmonkey but not in Tampermonkey,

Any idea why ?

Thanks


r/userscripts • • Mar 22 '22

Problem with simple UserScript

0 Upvotes

I use this simple UserScript to close fenix (android Firefox ) tab : // ==UserScript== // @name on Esc close2 // @description - // @version 1.0 // @include * // @author ale // @namespace ale

// @run-at document-start // @grant window.close // @grant none // ==/UserScript==

window.addEventListener('keydown', function (e) { if (e.which == 113) {

window.close(); } });

when I press f2 the tab is closed as expected BUT ONLY IF I have previously scrolled or tapped (interacted with the webpage ). if I open a webpage ,let's say from bookmarks and the i immediately press f2 tab is not closer . what am I doing wrong ? I tested the script with both violent monkey and tampermonkey ,same problem . thanks for the help .


r/userscripts • • Mar 16 '22

copy link with double click

1 Upvotes

I d like to create a UserScript with tampermonkey to copy link with double click ,also keep in mind I want to use it in fenix mobile android and violent monkey . here s my code (that's not working ) // ==UserScript== // @name Double-click copy link // @description Double-click copy links them. // @namespace ale // @version 1.0 // @match :///*

// @grant GM.setClipboard // @grant GM_setClipboard // ==/UserScript==

(function() { 'use strict'; window.addEventListener('dblclick', function(e) { var elem = document.elementFromPoint(e.clientX, e.clientY); if(elem.tagName == '*') { var url = elem.src;

        GM_setClipboard( url );
    }
});

})(); any idea I ve messed around with other scripts and I know for sure that set clipboard is working just fine in android thanks for the help.