tampermonkey

Add a JavaScript button using Greasemonkey or Tampermonkey?

时光总嘲笑我的痴心妄想 提交于 2019-11-26 13:19:37
问题 I am fairly new to the world of Greasemonkey and I was wondering how to make a button in JavaScript. Say I wanted to put a button on YouTube or Google for instance? How would I go about calling it or making it? I'm very confused and cant find anything on it. Unless is there someway to interact with the HTML of these sites and add them to Greasemonkey scripts? 回答1: Ok, here's a complete script that adds a live button to SO question pages 1 : // ==UserScript== // @name _Adding a live button //

Detecting combination keypresses (Control, Alt, Shift)?

瘦欲@ 提交于 2019-11-26 12:40:20
问题 I am trying to make a script run when Ctrl + Alt + e is pressed. How can Tampermonkey fire on a simultaneous ctrl, alt, and e key? I have tried ctrlKey , and altKey . I\'ve found nothing that works. How can I edit the script below to fire on Ctrl + Alt + e , instead of just e ? (function() { document.addEventListener(\"keypress\", function(e) { if (e.which == 101) { var xhttp = new XMLHttpRequest; xhttp.onreadystatechange = function() { 4 == xhttp.readyState && 200 == xhttp.status && eval

Userscript to wait for page to load before executing code techniques?

∥☆過路亽.° 提交于 2019-11-26 12:18:11
问题 I\'m writing a Greasemonkey user script, and want the specific code to execute when the page completely finishes loading since it returns a div count that I want to be displayed. The problem is, that this particular page sometimes takes a bit before everything loads. I\'ve tried, document $(function() { }); and $(window).load(function(){ }); wrappers. However, none seem to work for me, though I might be applying them wrong. Best I can do is use a setTimeout(function() { }, 600); which works,

Recall Tampermonkey script when page location changes

跟風遠走 提交于 2019-11-26 11:36:35
问题 Well, I want to know if its possible to recall a Tampermonkey script when a user changes his location (but the match is still active). For example, my scripts hooks youtube website. I need to make that the script recalls itself when I change the video, my actual script is: // ==UserScript== // @name xxx // @namespace xxx // @version 1.0 // @description xxx // @author Ikillnukes // @match https://www.youtube.com/* // @match https://youtu.be/* // @grant none // ==/UserScript== console.log(\

How do I get Greasemonkey to click on a button that only appears after a delay?

送分小仙女□ 提交于 2019-11-26 11:28:17
问题 I\'ve seen a lot of similar questions and I\'ve tried everything I can think of to get this to work on my own. First the relevant code (¿from the target page?): document.getElementById(\'btn_submit\').innerHTML = \'<input type=\"hidden\" value=\"17271\" name=\"idofclick\"> <input type=\"submit\" value=\" Click Me Now! \" name=\"submit_com\" class=\"padding2\">\'; Basically there is a timer on the page and the \"click me now!\" button appears after 3 secs, that\'s the part I want to click on.

How to override the alert function with a userscript?

故事扮演 提交于 2019-11-26 11:24:00
问题 On site there is code like that (its site on LAN) <script language=\"JavaScript\" type=\"text/javascript\"> alert(\"ble\"); </script> I try to disable that alert using GM. I was trying to do this unsafeWindow.alert=function() {}; but I see the alert and get this error Error: uncaught exception: [Exception... \"Component is not available\" nsresult: \"0x80040111 (NS_ERROR_NOT_AVAILABLE)\" location: \"JS frame :: file:///C:/Documents%20and%20Settings/arokitnicki/Dane%20aplikacji/Mozilla/Firefox

Chrome 65 blocks cross-origin <a download>. Client-side workaround to force download?

本小妞迷上赌 提交于 2019-11-26 11:05:22
问题 Chrome 65 removed support for the download attribute on anchor elements with cross-origin href s : Block cross-origin <a download> To avoid what is essentially a user-mediated cross-origin information leakage, Blink will now ignore the presence of the download attribute on anchor elements with cross origin attributes. Note that this applies to HTMLAnchorElement.download as well as to the element itself. Intent to Remove | Chromestatus Tracker | Chromium Bug This breaks serverless downloads

Add parameters to the URL (redirect) via a Greasemonkey/Tampermonkey/Userscript

守給你的承諾、 提交于 2019-11-26 08:34:05
问题 I\'d like to write a Greasemonkey/userscript that automatically adds .compact to URLs starting with https://pay.reddit.com/ so It automatically redirects me to the mobile version. I\'ve been looking at similar userscripts, particularly this one: https://userscripts.org/scripts/review/112568 trying to figure out how to edit the replacement pattern, but I lack skills in this domain. How do I write a Greasemonkey script that redirects me from https://pay.reddit.com/* to https://pay.reddit.com/*

How to exclude iframe in Greasemonkey or Tampermonkey?

霸气de小男生 提交于 2019-11-26 07:43:54
问题 I have created a Greasemonkey script for a website. What the script does is adding a div at the end of the page. document.body.insertBefore(myDiv, document.body.firstChild); But now the site adds an iframe for google-ads, as a result my div appears in the iframe too, which is not what I want. How can I stop the script affecting iframes? 回答1: Greasemonkey now supports the @noframes directive (long supported by Tampermonkey and Scriptish). Use that for a cleaner way to block operation in

Save images to hard disk WITHOUT prompt?

家住魔仙堡 提交于 2019-11-26 06:48:20
问题 I use twitter. Some people\'s tweets contain photos and I want to save them. I checked ifttt, where twitter is not a trigger. Thus, ifttt cannot help me do it. One idea is probably to use JavaScript. I use Firefox and installed Greasemonkey. I can write a Greasemonkey script (JavaScript) running on twitter website. Once I click \"retweet\" link or other button added by my script, my script examines the content of the tweet, find the URL of the photo, and save it to my disk. One problem is how