greasemonkey

UserScripts & Greasemonkey: calling a website's JavaScript functions

南楼画角 提交于 2019-12-17 04:14:48
问题 I'm creating a UserScript extension for Firefox & Chrome and I'm trying to use some of the code in the website's JavaScript, e.g.: function: myFunction(){ return Grooveshark.playNextSong(); } The problem is when I test this code, Grooveshark is a null reference. I know there are other people who have done it: see BetterGrooveshark But I don't know why my simple extension can't call Grooveshark's JavaScript functions. Do I need to 'append' my script to the document in order for this to work?:

Storing user login/password input in a Greasemonkey script on install

折月煮酒 提交于 2019-12-17 03:43:03
问题 I'm doing a Greasemonkey script that communicates with the Redmine ticket manager through the REST API. As the user needs to login to get the data from Redmine, I need a way to ask the user for his credentials at script installation and save them to the script. Can this be achieved without asking the user to edit the values directly in the script itself? EDIT: Since there is already an answer to this question I will validate the answer given just below as it is a very good framework. 回答1:

Storing user login/password input in a Greasemonkey script on install

五迷三道 提交于 2019-12-17 03:41:37
问题 I'm doing a Greasemonkey script that communicates with the Redmine ticket manager through the REST API. As the user needs to login to get the data from Redmine, I need a way to ask the user for his credentials at script installation and save them to the script. Can this be achieved without asking the user to edit the values directly in the script itself? EDIT: Since there is already an answer to this question I will validate the answer given just below as it is a very good framework. 回答1:

Can a website know if I am running a userscript?

青春壹個敷衍的年華 提交于 2019-12-17 03:34:07
问题 Can, for example, Facebook.com run a version control script on my browser and find out if I am running altered HTML code with the use of a script? Could that be done with a script that can read the HTML code in the cache and produce some kind of hash tag that is sent back to the server and compared with the code that was sent to the client? 回答1: Yes, in theory, a site can deduce the presence of scripts in various situations. This is not foolproof and usually is way too much trouble for the

Injecting JS functions into the page from a Greasemonkey script on Chrome

99封情书 提交于 2019-12-17 03:01:25
问题 I have a Greasemonkey script that works just fine in Firefox and Opera. I struggle with getting it to work in Chrome, however. The problem is injecting a function into the page that can be invoked by code from the page. Here's what I'm doing so far: First, I get a helper reference to the unsafeWindow for Firefox. This allows me to have the same code for FF and Opera (and Chrome, I thought). var uw = (this.unsafeWindow) ? this.unsafeWindow : window; Next, I inject a function into the page. It

Injecting JS functions into the page from a Greasemonkey script on Chrome

♀尐吖头ヾ 提交于 2019-12-17 03:00:04
问题 I have a Greasemonkey script that works just fine in Firefox and Opera. I struggle with getting it to work in Chrome, however. The problem is injecting a function into the page that can be invoked by code from the page. Here's what I'm doing so far: First, I get a helper reference to the unsafeWindow for Firefox. This allows me to have the same code for FF and Opera (and Chrome, I thought). var uw = (this.unsafeWindow) ? this.unsafeWindow : window; Next, I inject a function into the page. It

Transferring information between userscripts in Chrome

丶灬走出姿态 提交于 2019-12-14 04:19:33
问题 I need to have a function execute on a page in one tab when certain conditions are met in another tab. All I need to do is send some kind of nudge to the other tab. I've tried many things already in conjunction with a timer to keep polling: GM_setValue (not supported in Chrome apparently) Setting top.item (apparently doesn't work between tabs) Cookies (even though my userscripts are running in two tabs on the same domain, this doesn't seem to work) Any other ideas? And yes, I do need to use

How to set two inputs and ungrey a button?

爱⌒轻易说出口 提交于 2019-12-14 04:05:53
问题 I'm looking for a way to automatically fill in a username/password in a webpage using Greasemonkey. The two tags are inputs, they have no ID but they're the only two inputs in the page, which appear when a 'log in' button is pressed. I am a beginner in Greasemonkey (and javascript) and I was wondering how I could wait for these two inputs to appear. Then there's two buttons, an 'ok' and a 'cancel' button. The 'ok' button is greyed, and setting the inputs with element0.value="password" doesn't

Trying to keep track of number of outstanding AJAX requests in firefox

孤人 提交于 2019-12-14 03:41:50
问题 I am using Selenium to test a web application and am not allowed to modify the application's javascript code. I am trying to track the number of outstanding AJAX requests by using GreaseMonkey to override XMLHttpRequest.send. The new send() will basically wrap what was set as the onreadystatechange callback, check the readyState, incrementing or decrementing the counter as appropriate, and calling the original callback function. The problem that I'm having appears to be a privilege issue

How to insert a Google map in a webpage using GreaseMonkey?

橙三吉。 提交于 2019-12-14 03:25:11
问题 Nothing I've tried seems to work. I found these two links and thought they'd be helpful, but that hasn't worked either. Dynamically load JavaScript with JavaScript https://developers.google.com/loader/ Here's roughly what my Greasemonkey script looks like currently: var init_map = function() { new google.maps.Geocoder().geocode({address:'1125 NW 12th Ave, Portland, OR'},function(result){ alert(result); }); } function loadMaps() { GM_log("loadMaps called"); google.load("maps", "3", {"callback"