greasemonkey

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

删除回忆录丶 提交于 2019-12-09 12:33:25
问题 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? 回答1: 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

Greasemonkey Script and Function Scope

一曲冷凌霜 提交于 2019-12-09 11:25:13
问题 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

Storing data when using Greasemonkey

邮差的信 提交于 2019-12-09 11:13:46
问题 Is there a good way to store an extensive amount of data when using Greasemonkey for when GM_setValue just doesn't cut it? 回答1: Well here are the options: Setup a server to save the data for the user, and use xhr to create/edit/remove data (Google App Engine (GAE) offers a lot of free storage space). Use Web Storage which is implemented in Firefox. Use Flash Local Storage. Wait until Web SQL Database is implemented in Firefox.. A mixture of all of the above. If you write a Firefox extension

why does this setTimeout() call work in the console but not as a greasemonkey script?

余生长醉 提交于 2019-12-09 03:29:04
问题 When I use a setTimeout() in a for() loop in a greasemonkey script, it doesn't appear to work at all. However, the exact same code works fine if I run it in the Firebug console. Here's the code: // ==UserScript== // @name setTimeout test // @include * // @run-at document-end // ==/UserScript= function test(delaytime) { alert("test called with "+delaytime); } function test2() { for( var i = 0; i < 100; i+= 10 ) { setTimeout('test('+i+');', i); } } setTimeout(test2,10); If I replace the for()

Replaceing/swapping JavaScript file in html using Greasemonkey

余生颓废 提交于 2019-12-08 14:24:33
问题 My goal is to replace an original JavaScript file from a web-page with my home-made file that I have locally. I have found an interesting script here which I repurposed to fit my objective. // ==UserScript== // @name JS_tamper // @namespace namespace // @include http://192.168.1.1/* // @version 1 // @grant none // @run-at document-start // ==/UserScript== var newJSFile = "http://localhost:8080/tamper.js"; //The JS file to load in replacment of old JS file var oldJSFile = "http://192.168.1.1

Can Scriptish inject scripts into other chrome: windows?

試著忘記壹切 提交于 2019-12-08 13:34:31
问题 As we know Scriptish has the support for the chrome: scheme (although disabled by default), but it failed to inject a user script into other chrome: window (for example, download window, or about window). Writing a script using @include chrome://foo/bar only works when the browser window opens this page as a tab, but not for a new window with this URL, except the browser window itself, use @include chrome://browser/content/browser.xul does work. Is there any way to let Scriptish do this just

How to change a link's text based on different phrasing of the link's title attribute?

99封情书 提交于 2019-12-08 13:10:38
In my Fantasy football page, it gives stats about the opposing team and when you mouseover it tells you how many points they give up (See picture). Here is the relevant code pertaining to this: <a class="Inline F-rank-good" title="WAS gives up the 3rd most fantasy points to the QB position." target="_blank" href="/f1/777400/pointsagainst?pos=QB&ntid=28">Was</a> How do I create a Greasemonkey script that will add the # to the end of the team name (i.e. "Was" becomes "Was - 3" One problem there is, is that sometimes the rank says it gives up the "2nd fewest points", in which case you would have

Dynamically change the HTML source using native JavaScript?

可紊 提交于 2019-12-08 10:43:24
问题 I was trying to change my HTML files. Please see this to get a better understanding of what I am up to. Every thing worked fine but as I viewed the source it was not changed. The changes I was trying to make were only reflected on the web-page I had opened on my browser. Is it by any way possible to change the actual source of the HTML page? I am using IE8 and GreaseMonkey4IE to run my JavaScript on the web pages I want to manipulate, just in case you are interested. There is a similar

Run my script on each page load, *including* AJAX page-loads?

大兔子大兔子 提交于 2019-12-08 09:24:14
问题 I want to delay the page-load time for a specific web page - in this case, Google - so that users can't see the web page until a count-down timer has completed. This question was inspired xkcd, and a similar question is "Javascript page load delay of specific set of pages". I've tried a modified version of Jonathan's Greasemonkey script (see below), but this script only delays the Google page load the first time Google is used in a particular tab. If Google is opened in a new tab, or the user

JQuery automatic click after 4 sec

允我心安 提交于 2019-12-08 09:03:22
问题 I'm not an programmer, but I know something. I need very simple script for GreaseMonkey (JQuery). Script which after 4 sec click on link (http://ptzplace.eu/login.php here is it). I need script which click on "Login click" after 4 sec. BTW. It's simulator and u can put in login and password anything u want for test. Regards 回答1: setTimeout() && jQuerys .trigger() should do it: setTimeout(function() { $('#login_button_id').trigger('click'); }, 4e3); Demo : http://jsfiddle.net/WTJgt/9/ update