greasemonkey

jQuery conflict between Greasemonkey script and page [duplicate]

吃可爱长大的小学妹 提交于 2019-12-22 18:24:04
问题 This question already has answers here : Can I use multiple versions of jQuery on the same page? (7 answers) jQuery in Greasemonkey 1.0 conflicts with websites using jQuery (3 answers) Closed 6 years ago . I'm writing an add-on for Greasemonkey and using jQuery 1.9.1 (via @require ). But there's already jQuery 1.1.2 on the website: <script type="text/javascript" language="JavaScript" src="jquery.js" >... When I run the script it says "TypeError: jQuery.browser is undefined". I tried adding

Set Variable inside Eval (JavaScript)

牧云@^-^@ 提交于 2019-12-22 13:05:19
问题 i'm writing a GreaseMonkey script (using JQuery), and i need some variables that are set by a script in the original page, like this: <script type="text/javascript"> var rData = {"20982211":[1,0,1],"20981187":[8,0,4]}; </script> I fetch this element from another page and try to eval it, put strangely this doesn't work: $.get(link_url, null, function(data) { alert("1:" + rData); eval($(data).find("script").text()); alert("2:" + rData); } The strange thing is on the firebug console it works (i

How can I play a sound within a Greasemonkey script?

十年热恋 提交于 2019-12-22 10:53:36
问题 How can I play a sound within a Greasemonkey script? What I'm trying to do currently is to play a sound whenever a condition is reached, something like: // ==UserScript== // @name Sound Alert // @namespace example.com // @include example.com/* // @require http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js // @version 1 // @grant none // ==/UserScript== sound = new Audio("https://dl.dropbox.com/u/7079101/coin.mp3"); for (var i = 0; i <= 10; i++) { if (i === 10) { // Play a sound

How can my userscript get a link based on the link's text?

柔情痞子 提交于 2019-12-22 10:45:55
问题 Given this HTML on the target page: <dd class="ddTit"> <a href="http://abc.xxx.com/54781.html" target="_blank">special text words</a> </dd> How can I get the url based on the " special text words ", and do the click in a Greasemonkey script? I tried this: var textlink = document.querySelector ("dd.ddTit a[textContent*='special']"); var clickEvent = document.createEvent ('MouseEvents'); clickEvent.initEvent ('click', true, true); textlink.dispatchEvent (clickEvent); with no luck. How do I

How to make a GreaseMonkey script affect elements in a page before they're displayed?

允我心安 提交于 2019-12-22 10:38:01
问题 I'm trying to ensure that images in a certain website are not displayed, but the alt text is still displayed. Initially I attempted to accomplish this with Stylish (using Firefox) and asked the following question: How to force an image's alt text to display instead of the image? The accepted answer provided me with an alternative solution using Greasemonkey. The script uses waitForKeyElements to hide images even if they're added using AJAX. I changed the given script to the following: // =

Help with hiding DIV tags, based on text content, using Greasemonkey

拥有回忆 提交于 2019-12-22 09:51:22
问题 I am looking for a way to write a Greasemonkey script which will take the following snippet of code and only show the code blocks consisting of <div class="A" where both "passtest" and "State1" are present. <div class="A"> <div class="B"> <a href="/link1"> <img class="imgClass" src="http://link.com/img.img" title="imgTitle"/> </a> </div> <div class="C"> <span class="sc1">passtest</span> <br/> <em class="ec1">City1, State1</em> </div> </div> <div class="A"> <div class="B"> <a href="/link1">

Greasemonkey script to move an element into another element?

做~自己de王妃 提交于 2019-12-22 09:48:54
问题 I want to move <div> elements. In this case, swap the first and last div.clearfix . So this: <fieldset> <div class="clearfix "> <label for="form-title">Title</label> <div class="input"></div> </div> <div class="clearfix "></div> <div class="clearfix "> <label>Verification</label> <div dir="ltr"> recaptcha </div> </div> </fieldset> Would become this: <fieldset> <div class="clearfix "> <label>Verification</label> <div dir="ltr"> recaptcha </div> </div> <div class="clearfix "></div> <div class=

How do I efficiently access gzipped xml from javascript?

百般思念 提交于 2019-12-22 08:19:22
问题 I need to efficently access a large gzipped xml file from javascript (actually from Greasemonkey). Unfortunately, the server doesn't provide a Content-Encoding header, and Content-Type is "application/x-gzip", so firefox will not (as far as I can tell) automatically inflate it. If there's a way to fake firefox out, that would be ideal. Short of that, I need some way to efficiently do the inflation...what I'm using now takes about 30 seconds to deflate the 1.2Mb gzipped file; I'd like to get

'document' is undefined in Greasemonkey

我与影子孤独终老i 提交于 2019-12-22 08:11:39
问题 Not more than ten minutes ago I decided to write my first script for Greasemonkey. I have zero experience with it. Also, my JavaScript is a bit rusty as it's been a while since I last wrote code in it. But I can't figure out why Greasemonkey is giving me this error: Line: 9 Char: 2 Error: 'document' is undefined Code: 800A1391 Source: Microsoft JScript runtime error Here's my script: // ==UserScript== // @name Easier WatchSeries // @namespace n/a // @include http://www.watch-series.com

setTimeout not always working in Greasemonkey

你离开我真会死。 提交于 2019-12-22 08:07:41
问题 I've found a lot of similar problems but none equal and no right solution. This is a very strange issue. I have a simple Greasemonkey script to test the issue: // ==UserScript== // @name testdiddio // @namespace http://userscripts.org/users/useridnumber // @include https://www.google.it/ // @version 1 // ==/UserScript== function wait(){ console.info("wait"); setTimeout(wait,1000); } console.info("start"); wait(); This is the output from firebug: start wait wait wait wait The wait() function