greasemonkey

Make Greasemonkey react to ajax change of an element

瘦欲@ 提交于 2019-12-02 02:20:10
问题 There is a page that loads with an empty span like this: <span id="bla"></span> and later fills that span with some text. I need my script to get that text but Greasemonkey runs before it is filled with the text and even the waitForKeyElements function, that I tried to use, is not helping because the element is already there when the page loads. Maybe I need in another way? Currently I am doing: waitForKeyElements ("#bla", get_span_content) 回答1: Since you are already using waitForKeyElements,

Replace the directory of an image src, using Javascript

て烟熏妆下的殇ゞ 提交于 2019-12-02 02:08:06
I'd like to replace the directory of an image src , changing .*pinterest.com/192/ to .*pinterest.com/550/ . I had been trying to modify this code to change the directory name instead of just removing the "_b" part of the filename. document.getElementById("chrome") .addEventListener("DOMNodeInserted", function (a) { if (a.target.tagName && a.target.tagName == "DIV" && /entry\s?/.test(a.target.className)) { var b = a.target.getElementsByTagName("img"); for (var c in b) { var d = b[c]; if (/.*pinterest\.com.*_b\.\w+$/.test(d.src)) { d.style.width = d.style.height = "inherit"; d.src = d.src

Add a draggable window to a page using Greasemonkey

人走茶凉 提交于 2019-12-02 02:06:19
问题 I'm trying to create a Greasemonkey script that adds a draggable div to every web page. For some reason, the div isn't displaying at all. What might be the reason for this? // ==UserScript== // @name Draggable box demo // @namespace http://use.i.E.your.homepage/ // @version 0.1 // @description enter something useful // @match *://www.* // @copyright 2012+, You // @require http://code.jquery.com/jquery-latest.js http://code.jquery.com/ui/1.9.2/jquery-ui.js // ==/UserScript== //alert("Hi!"); $

How can I prevent CSS from affecting certain element?

China☆狼群 提交于 2019-12-02 01:15:15
I am writing a GreaseMonkey script that sometimes creates a modal dialog – something like <div id="dialog"> Foo </div> . But what can I do if the site has something like #dialog { display: none !important; } ? Or maybe the owner of some site is paranoid and has something like div { display: none !important; } div.trusted { display: block !important; } because he doesn't want people like me adding untrusted content to his page. How can I prevent those styles from hiding my dialog? My script runs on all pages, so I can't adapt my code to each case. Is there a way to sandbox my dialog? Actually a

Getting jQuery and GM_addStyle to work in a Chrome userscript based off of a working Greasemonkey script

北慕城南 提交于 2019-12-02 01:05:15
I wrote a simple Greasemonkey script that enlarges thumbnail pictures in a flyover popup. It uses a lot of jQuery in it. It works just fine on Firefox. But not on Chrome since it doesn't support @require. I came across this solution for this matter. But the script didn't work on Chrome even after I integrated it with the get-around code. I just put all my script code inside the solution code's main function. Is it wrong? If anyone can point out where is the problem, and what I can do to get it right, it'll be very much appreciated. function addJQuery(callback) { var script = document

Make Greasemonkey react to ajax change of an element

南楼画角 提交于 2019-12-02 00:59:16
There is a page that loads with an empty span like this: <span id="bla"></span> and later fills that span with some text. I need my script to get that text but Greasemonkey runs before it is filled with the text and even the waitForKeyElements function, that I tried to use, is not helping because the element is already there when the page loads. Maybe I need in another way? Currently I am doing: waitForKeyElements ("#bla", get_span_content) Since you are already using waitForKeyElements , use the action-function's return value to fine tune the results. If the span is only filled/changed once,

Add a draggable window to a page using Greasemonkey

随声附和 提交于 2019-12-02 00:57:22
I'm trying to create a Greasemonkey script that adds a draggable div to every web page. For some reason, the div isn't displaying at all. What might be the reason for this? // ==UserScript== // @name Draggable box demo // @namespace http://use.i.E.your.homepage/ // @version 0.1 // @description enter something useful // @match *://www.* // @copyright 2012+, You // @require http://code.jquery.com/jquery-latest.js http://code.jquery.com/ui/1.9.2/jquery-ui.js // ==/UserScript== //alert("Hi!"); $(document).ready(function() { $(document).append("<div id='dragZone'><div class='draggable'>Drag here!

Modify elements immediately after they are displayed (not after page completely loads) in greasemonkey script?

雨燕双飞 提交于 2019-12-02 00:20:29
I have this script . It applies on RottenTomatoes movie pages , and modifies 3 elements (1 visible text and 2 texts inside tooltips). Currently, (due to greasemonkey's @run-at document-end ) it modifies the elements only after the page has completely loaded . Additionally, there are many times where RottenTomates pages delay loading, up to 20 sec(!), so that's additional delay to my script. This causes two things: a delay in displaying the modified visible text, and that, if you hover your mouse in either of the tooltips before the page is completely loaded, then, after it's loaded, it will

GM_openInTab (or any other GM_ function) is not defined?

坚强是说给别人听的谎言 提交于 2019-12-01 21:30:29
When my GM script does this: var curTab = GM_openInTab(url); it results in a 'GM_openInTab is not defined' JavaScript error in the Browser Console. I also tried using var curWin = window.open(url); instead of GM_openInTab but it had no affect. What I'm trying to do with this GM script is: for a given website (domain name), go through a list (array) of URLs on this domain and look for items of interest. What's wrong with my code or approach? I'm using Greasemonkey 2.3 with Firefox 33.1.1 and Windows XP 32-bit. Brock Adams In order to use any of the GM_ functions, you must set a matching @grant

run user script on chrome://settings and similar urls

只愿长相守 提交于 2019-12-01 21:17:11
问题 Why doesn't tampermonkey work on urls such as chrome://history/ or chrome://settings/ ? Any way to run an user script on this pages as well? 回答1: Unfortunately, this isn't possible, because the chrome scheme ( chrome:// ) isn't supported in @match 's abilities. UserScripts also use Chrome's match spec, so a Chrome extension to do that wouldn't work either. From the linked spec: Host permissions and content script matching are based on a set of URLs defined by match patterns. A match pattern