greasemonkey

Running custom Javascript on every page in Mozilla Firefox

不问归期 提交于 2019-12-01 03:49:24
I have a custom piece of Javascript which I would like to run on every web page from specific domains, or perhaps simply on every web page. (If you are wondering: it is not malicious. It allows to display formulas by using MathJax.) Is that possible? I tried including it in userContent.css, that of course did not work. A simple Greasemonkey script I tried did not insert it. Is it because of the security precautions? (Which would be very logical). Still, there should be a way to do it on the machine I physically control, by changing something in Mozilla chrome directory, shouldn't it? Anyway,

How do I access an iframe's javascript from a userscript?

冷暖自知 提交于 2019-12-01 03:23:15
问题 I'm trying to use a Chrome userscript or a Tampermonkey script to modify a page with this structure: <body> content up here <iframe id="main" src="foo.dat"></iframe> </body> The iframe is same-origin. I need to access a function that's in iframe#main . I thought I could use unsafeWindow to get it but I keep getting nothing or undefined returned. I've tried a slew of things: Tried creating a new script element in the iframe , but it attaches to the parent even with $('frame#main').contents()

Attempt to add a rule to a CSS stylesheet gives “The operation is insecure” in Firefox

╄→尐↘猪︶ㄣ 提交于 2019-12-01 02:50:09
I'm using Greasemonkey and trying to add a rule in a specific domain. But it results in an error saying The operation is insecure . The code works fine on Chrome. The script runs on http://mydomain.com/test/test.php And the CSS file is http://cdn.mydomain.com/test/css/global.css My function: function css(selector, property, value) { for (var i=0; i<document.styleSheets.length;i++) { try { document.styleSheets[i].insertRule(selector+ ' {'+property+':'+value+'}', document.styleSheets[i].cssRules.length); } catch(err) { try // IE { document.styleSheets[i].addRule(selector, property+':'+value); }

GM_xmlhttpRequest data is being placed in the wrong places

六眼飞鱼酱① 提交于 2019-12-01 01:51:54
I am using the following excellent userscript (for Chrome, Chrome's Tampermonkey and Firefox Greasemonkey). It's supposed to display movie ratings next to each IMDb movie link, but it stopped working properly. This is the complete script: // ==UserScript== // @name Add IMDb rating next to all IMDb links (+voter count) // @author Ali // @description Adds movie ratings and number of voters to any IMDb link. Modified version of http://userscripts.org/scripts/show/9174 // @include * // @version 2013-05-12 // @namespace http://userscripts.org/scripts/show/96884 // @grant GM_xmlhttpRequest //

addEventListener memory leak due to frames

三世轮回 提交于 2019-12-01 00:24:55
I have a GreaseMonkey script that works on a site that uses frames as an integral part of its interface. This script leaks memory like a sieve, and I believe it is due to my use of addEventListener within one of the frames. Quite simply, I attach a variety of event listeners, then the frame reloads and I attach the event listeners, and then the frame reloads, around and around for hundreds or possibly thousands of iterations as you interact with various elements in this frame or others. By the end of it, Firefox has gone from ~300M of memory to as much as 2G (or crashes before it gets there).

Running custom Javascript on every page in Mozilla Firefox

空扰寡人 提交于 2019-12-01 00:10:59
问题 I have a custom piece of Javascript which I would like to run on every web page from specific domains, or perhaps simply on every web page. (If you are wondering: it is not malicious. It allows to display formulas by using MathJax.) Is that possible? I tried including it in userContent.css, that of course did not work. A simple Greasemonkey script I tried did not insert it. Is it because of the security precautions? (Which would be very logical). Still, there should be a way to do it on the

Can I get the data of a cross-site <img/> tag as a blob?

こ雲淡風輕ζ 提交于 2019-11-30 23:48:05
I am trying to save a couple of images that are linked to by a webpage to offline storage. I'm using IndexedDB on Firefox and FileSystem API on Chrome. My code is actually an extension, so on Firefox I'm running on Greasemonkey, and on Chrome as a content script. I want this to be automated. I am running into problem when I retrieve the image file. I'm using example code from the article titled Storing images and files in IndexedDB , but I get an error: the images I'm trying to download are on a different subdomain and the XHR fails. XMLHttpRequest cannot load http://...uxgk.JPG. Origin http:/

Are Chrome user-scripts separated from the global namespace like Greasemonkey scripts?

痴心易碎 提交于 2019-11-30 21:39:29
I know Greasemonkey scripts are automatically wrapped in anonymous functions isolated in some way in order to prevent them conflicting with scripts in the page. Does the same happen with Chrome user-scripts? Yes, Greasemonkey scripts are normally wrapped in an anonymous function . And, Chrome userscripts apparently are too . But, more importantly, Greasemonkey scripts are usually 1 wrapped in an XPCNativeWrapper sandbox, while Google Chrome converts userscripts into extensions, and they operate in an arena that Google calls an "isolated world" 2 . So, you don't need to wrap your script code in

Why does jQuery load twice in my GreaseMonkey Script

两盒软妹~` 提交于 2019-11-30 21:27:42
for some reason my Firefox4+GreaseMonkey Script loads jQuery twice. I copy'n'pasted the following snippet, the "test" alert shows twice. Regards var $; // Add jQuery (function(){ if (typeof unsafeWindow.jQuery == 'undefined') { var GM_Head = document.getElementsByTagName('head')[0] || document.documentElement, GM_JQ = document.createElement('script'); GM_JQ.src = 'http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js'; GM_JQ.type = 'text/javascript'; GM_JQ.async = true; GM_Head.insertBefore(GM_JQ, GM_Head.firstChild); } GM_wait(); })(); // Check if jQuery's loaded function GM_wait() { if

GM_xmlhttpRequest data is being placed in the wrong places

痞子三分冷 提交于 2019-11-30 21:12:11
问题 I am using the following excellent userscript (for Chrome, Chrome's Tampermonkey and Firefox Greasemonkey). It's supposed to display movie ratings next to each IMDb movie link, but it stopped working properly. This is the complete script: // ==UserScript== // @name Add IMDb rating next to all IMDb links (+voter count) // @author Ali // @description Adds movie ratings and number of voters to any IMDb link. Modified version of http://userscripts.org/scripts/show/9174 // @include * // @version