greasemonkey

Greasemonkey - replace javascript src to load custom JS instead the one of the page

旧城冷巷雨未停 提交于 2019-12-03 16:33:55
There's specific webpage with variable in .js file. I want to rewrite the URL to be loaded with Greasemonkey, but still haven't got any results.The code I use is: window.addEventListener( 'load', function() { allTextareas = document.getElementsByTagName('script'); for (thisTextarea in allTextareas) { if( allTextareas[thisTextarea].getAttribute('src') == 'some url.js' ){ //allTextareas[thisTextarea].setAttribute('src', 'http://my custom url.js'); } } }, true); but it's not working. Can you help me, or just tell me a way to edit JS files on specific page.. A couple things, easy one first... (1)

setTimeout not working in Greasemonkey user script when JS disabled in browser

筅森魡賤 提交于 2019-12-03 15:07:55
I'm working on a project that requires my user script be run on pages as they are rendered without executing any of the page's JavaScript. That is to say, we need to browse with JavaScript disabled. I've encountered a problem though when I try to delay execution of a function within my script. Whenever I make a call to window.setTimeout , the function I pass in never gets executed. I think maybe this function is actually getting called on unsafeWindow instead of window. Is there any workaround for this? I should mention that calls to setTimeout work fine when JavaScript is enabled and

Javascript: Function is defined, but Error says.. Function is not found ! (Strange)

倖福魔咒の 提交于 2019-12-03 14:59:36
This is my code : function mark() { alert("This is a test box.."); } setTimeout("mark()",5000); Error : Function mark() is not found !! There is some other issue.. as it works on http://jsfiddle.net/russcam/6EXa9/ but its not working in my application.. so can you help me debug this ? What else can be the reason.. By the way I am running this inside a GreaseMonkey script ! If you are using GreaseMonkey, any functions you define are sandboxed by GM and not available in the main window. When you use any of the native functions however, like setTimeout or alert , they are called in the context of

How to test a Greasemonkey script, especially on a local copy of a webpage?

不想你离开。 提交于 2019-12-03 14:47:39
I have my own javascript that I need to test with Greasemonkey. I've never worked with Greasemonkey before; How do I test the script? I am not testing it on the World Wide Web, I have saved the target page ( Firefox > Save page as > Web page, complete ), so I am testing it locally. What is the process? How do I test the script? Brock Adams Here are some guidelines for troubleshooting Greasemonkey scripts, both in general, and on local copies of webpages. For testing on local pages (without a local web-server), you must change a setting of Greasemonkey. Open about:config and set greasemonkey

Greasemonkey Script and Function Scope

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-03 13:40:27
Here is my script code: // ==UserScript== // @name test // @description test // @include http://* // @copyright Bruno Tyndall // ==/UserScript== var main = function() { var b = document.getElementsByTagName('body')[0]; var t = document.createElement('div'); t.innerHTML = '<a href="javascript:void(0);" style="color:white;">Hello World</a>'; t.style.position = 'absolute'; t.style.zIndex = 1000; t.style.bottom = '5px'; t.style.right = '5px'; t.firstChild.setAttribute('onclick', 'test();'); b.appendChild(t); } var test = function() { alert("Hello World"); } main(); The only issue I have is when

How to use angularjs with greasemonkey to modify web pages?

ⅰ亾dé卋堺 提交于 2019-12-03 13:27:14
问题 I want to modify web pages' behavior using angularjs and greasemonkey. I want to know, what's the best way to do it? Should I use jquery to inject attributes like "ng- * " to DOM elements before I can write some angular code? Or can I solely stick to angularjs? Thanks. 回答1: There's a general answer about dynamically modifying AngularJS content in the DOM from JavaScript code here: AngularJS + JQuery : How to get dynamic content working in angularjs To sum up, when you put ng-* attributes into

Recommendations for a “Getting started with Greasemonkey” tutorial [closed]

倾然丶 夕夏残阳落幕 提交于 2019-12-03 11:11:04
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. I'm interested in writing some Chrome compatible Greasemonkey scripts, but I'm finding that there are few updated tutorials on how to really get started properly with writing userscripts. Dive Into Greasemonkey by Mark Pilgrim is five years old now and hasn

How to implement “DOM Ready” event in a GreaseMonkey script?

我与影子孤独终老i 提交于 2019-12-03 09:51:45
I'm trying to modify my GreaseMonkey script from firing on window.onload to window.DOMContentLoaded, but this event never fires. I'm using FireFox 2.0.0.16 / GreaseMonkey 0.8.20080609 This is the full script that I'm trying to modify, changing: window.addEventListener ("load", doStuff, false); to window.addEventListener ("DOMContentLoaded", doStuff, false); So I googled greasemonkey dom ready and the first result seemed to say that the greasemonkey script is actually running at "DOM ready" so you just need to remove the onload call and run the script straight away. I removed the window

How do I change a filename on-download with javascript?

坚强是说给别人听的谎言 提交于 2019-12-03 09:38:52
问题 The script adds a download link for videos (on a specific site). How do I change the filename to something else while downloading? Example URL: "http://website.com/video.mp4" Example of what I want the filename to be saved as during download: "The_title_renamed_with_javascript.mp4" 回答1: This actually is possible with JavaScript, though browser support would be spotty. You can use XHR2 to download the file from the server to the browser as a Blob, create a URL to the Blob, create an anchor

Open a new tab with custom HTML instead of a URL

我只是一个虾纸丫 提交于 2019-12-03 08:16:42
问题 I'm making a Greasemonkey script and would like to open a new tab which will not display a URL but some HTML that is part of the script. So basically I want to do something like this (which is obviously not working): window.open('<html><head></head><body></body></html>'); or GM_openInTab('<html><head></head><body></body></html>'); Any hints are welcome! 回答1: You can do this: var newWindow = window.open(); and then do newWindow.document.write("ohai"); 回答2: If the other answer gives you Error: