greasemonkey

Changing a page's URL parameters

我们两清 提交于 2019-11-26 22:09:45
问题 I want to add the parameter &vhs=1 at the end of each YouTube video URL on my browser. I have tried using the following script but it gets stuck in a loop (keeps adding &vhs=1 &vhs=1... ). // ==UserScript== // @name Youtube Tape Mode // @namespace _pc // @match *://*.youtube.com/watch?* // @run-at document-start // ==/UserScript== var oldUrlPath = window.location.pathname; /*--- Test that "&vhs=1" is at end of URL, excepting any "hashes" or searches. */ if ( ! /\&vhs=1$/.test (oldUrlPath) ) {

How to change a class CSS with a Greasemonkey/Tampermonkey script?

耗尽温柔 提交于 2019-11-26 22:06:38
I'm trying to set the background image of the body, but only where it uses the class banner_url . The HTML is as follows: <body id="app_body" class="banner_url desktopapp" data-backdrop-limit="1"> Basically, I would like to force the page to use the following CSS instead: .banner_url { background: url('http://www.pxleyes.com/images/contests/kiwis/fullsize/sourceimage.jpg') no-repeat center center fixed; -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; background-size: cover; } I am trying to do this using Greasemonkey if it makes any difference. Does

Get 2 userscripts to interact with each other?

怎甘沉沦 提交于 2019-11-26 21:52:39
问题 I have two scripts. I put them in the same namespace (the @namespace field). I'd like them to interactive with another. Specifically I want script A to set RunByDefault to 123. Have script B check if RunByDefault==123 or not and then have script A using a timeout or anything to call a function in script B . How do I do this? I'd hate to merge the scripts. 回答1: The scripts cannot directly interact with each other and // @namespace is just to resolve script name conflicts. (That is, you can

How can I handle multiple AJAX results in a userscript?

荒凉一梦 提交于 2019-11-26 21:41:41
问题 I'm currently developing a Greasemonkey script to translate <textarea> fields in an Intranet app, using Google Translation API. But some texts are way too large to be translated with only one request. I get this error when trying : Request entity too large Anyway, I found a way to cut the texts in fragments, and send them in separate requests. Where it gets tricky, is how I should replace those fragments in their original textareas, and especially at the right place. After trying several

Why doesn't document.addEventListener('load', function) work in a greasemonkey script?

你说的曾经没有我的故事 提交于 2019-11-26 20:51:16
问题 It doesn't give an error, and I put a console.log('loaded userscript wifi-autologin') , the console.log works, but the intended effect of the document.addEventListener doesn't happen. After doing a bit more debugging, making it print that the addEventListener was called, I discovered that it wasn't being called. Source of script: // ==UserScript== // @name wifi-autologin // @namespace lf-ns // @description Hopefully autologins to a captive portal // @include *://1.1.1.1/* // @version 1 //

IE9 HTTPS security is compromised by my Greasemonkey script?

廉价感情. 提交于 2019-11-26 20:37:54
问题 I’ve got a Greasemonkey-for-IE script in IE9 that’s importing jQuery. But on secure pages it doesn’t work. I’m getting: SEC7111: HTTPS security is compromised by http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js The code that fails is: var script = document.createElement("script"); script.setAttribute("src", "http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"); How can I make this work? The script doesn’t cause a problem in Firefox. 回答1: Presumably: Use https:/

Run a Greasemonkey script only once per page load?

怎甘沉沦 提交于 2019-11-26 20:23:32
问题 If you create a Greasemonkey script with @include * and go to a site like youtube, it runs the script 20+ times every time you refresh. This is on Firefox, not sure about Chrome. Is there a way to prevent this? 回答1: First, you probably don't want the script to run in iFrames. You can block that using the @noframes directive which now works in both Greasemonkey and Tampermonkey as of October, 2014. For older versions, or for script engines that don't support @noframes , you can use this code,

How can I detect visited and unvisited links on a page?

£可爱£侵袭症+ 提交于 2019-11-26 19:01:26
My aim is to detect the unvisited links on a webpage and then create a greasemonkey script to click on those links. By unvisited links here I mean the links which are not opened by me. Since I can see all the browser provide capability to change the color of visited and unvisited link is it possible to detect these links in any manner. While searching I came upon this link: http://www.mozdev.org/pipermail/greasemonkey/2005-November/006821.html but someone here told me that this is no longer possible. Please help. Correct, it is not possible for javascript to detect if a link is visited in

How can I load a shared web worker with a user-script?

*爱你&永不变心* 提交于 2019-11-26 18:57:51
I want to load a shared worker with a user-script. The problem is the user-script is free, and has no business model for hosting a file - nor would I want to use a server, even a free one, to host one tiny file. Regardless, I tried it and I (of course) get a same origin policy error: Uncaught SecurityError: Failed to construct 'SharedWorker': Script at 'https://cdn.rawgit.com/viziionary/Nacho-Bot/master/webworker.js' cannot be accessed from origin 'http://stackoverflow.com'. There's another way to load a web worker by converting the worker function to a string and then into a Blob and loading

Greasemonkey to change value of Radio buttons in a form?

时间秒杀一切 提交于 2019-11-26 18:36:18
问题 I am writing a Greasemonkey/Tampermonkey script and I need to turn on radio buttons depending on the name and value of the radio control. This is how it looks: <input type="radio" name="11" value="XXX" class="radio"> <input type="radio" name="11" value="zzzz" class="radio"> So I want to set those buttons that have name of 11 and a value of zzzz to be checked. 回答1: This is super easy when you use jQuery. Here's a complete script: // ==UserScript== // @name _Radio button check // @include http: