greasemonkey

Get clipboard contents with Greasemonkey

陌路散爱 提交于 2019-12-01 12:06:47
Is there the possbility to get the textual content of the clipboard to paste it automatically into a textarea clicking a button? Just found a method to copy data to it, but not to read data from it. Brock Adams No, you cannot do this in javascript because it has proven to be a huge security hole. Likewise, the developers of Greasemonkey are unlikely to add this capability for the same reasons. You can write a Firefox add-on that does this, but I've never seen a (legit) use case. A technique that works well for me is to have the Greasemonkey script set focus to the textarea (or input) and then

Code works in console/scratchpad but not in a Greasemonkey script? [duplicate]

大城市里の小女人 提交于 2019-12-01 11:51:02
问题 This question already has an answer here : Code working in browser console but not in tampermonkey (1 answer) Closed 7 months ago . I'm trying to write a script to make the map larger on Google Flights. I've got the jQuery working in the Firefox scratchpad. This script does exactly what I am trying to accomplish: $('div').filter(function(){ return $(this).css('width') == '648px' }).css({"width":"900px","height":"550px"}); but when I paste that into a Greasemonkey script, it doesn't work. If I

javascript: call an embedded function from a GM script

末鹿安然 提交于 2019-12-01 11:37:40
On a webpage there's <script> function fn982734() { // some code } </script> In my Greasemonkey script, I have the following code: var fn = fields[5].getElementsByTagName("a")[0].getAttribute('onclick').substr(7,11); console.log(fn); // outputs fn982734 to the firebug console window[fn](); This code does not work, and spawns an error in the error console: window[fn] is not a function. However, typing directly into firebug: var fn = 'fn982734'; window[fn](); works perfectly. What's going on? The Greasemonkey script is inside a sandbox and Firebug is not. See: "Avoid Common Pitfalls" (in

document.write() not working in userscript with Firefox

混江龙づ霸主 提交于 2019-12-01 11:30:29
问题 I have some userscripts that use var tab = window.open('', '_blank'); tab.document.write(myCustomHtml); tab.document.close(); to show an output to the user (myCustomHtml being some valid HTML I defined previously in the code). It sopped working in Firefox since version 27, now I only get an empty document. No console errors whatsoever. The newly opened document has only this content when inspected with Firefox' console <html> <head></head> <body> </body> </html> while the source code is empty

Greasemonkey Jquery interference? [duplicate]

戏子无情 提交于 2019-12-01 11:29:34
Possible Duplicate: jQuery in Greasemonkey 1.0 conflicts with websites using jQuery It appears that if any of my greasemonkey scripts have the line like the below i get errors on sites that include jquery. I'm not sure why but i do notice some javascript events outright not firing. (For example on SO i cant add a comment). I could exclude SO in the script but is there a nicer solution? Maybe i should dynamically add jquery after testing if jquery exist. How do I solve this problem and how do I add the jquery script tags to a body without using jquery? // @require http://ajax.googleapis.com

jQuery .get for non https, in a userscript

旧时模样 提交于 2019-12-01 10:45:33
I made a script on my website that accesses a table on a different website. However, the other website is HTTP so chrome is telling me "This request has been blocked; the content must be served over HTTPS." $.get('http://www.kanjidamage.com/kanji', null, function searchKD () { /*function*/ }); So what I'm asking is: how can I access elements on a different website even if it's not HTTPS. You have this tagged as tampermonkey . If that is the case, use it. Tampermonkey allows one to bypass "mixed active content" restrictions by using GM_xmlhttpRequest Doc . So this complete Greasemonkey

Multiple Greasemonkey Metablocks

别等时光非礼了梦想. 提交于 2019-12-01 10:39:23
问题 I'm trying to write a Greasemonkey script for a hierarchy of websites such that I have a bunch of code modifications for http://www.foo.com/*, then more specific ones for http://www.foo.com/bar/*, and still others for http://www.foo.com/foobar/*. Is there anyway for me to write all these in the same script, or do I have to make multiple? 回答1: Is there anyway for me to write all these in the same script, or do I have to make multiple? Yes, just use those three @includes, then in your user

Add a Date Picker to a textbox using Greasemonkey

≡放荡痞女 提交于 2019-12-01 10:36:52
There is a textbox that requires a date but has no date picker. I would like to add one with Greasemonkey. I looked for an example but could not find one. Is this possible? Is there an example for doing this? It doesn't need to be fancy. I like to use jQuery UI's datepicker() because I usually have jQuery UI loaded anyway, and it's fairly well-known/supported. Unfortunately, the datepicker functionality uses some criminally-bad event code, which requires a little fudging to work in a sandboxed environment. Still, its not too difficult. Here is a complete Greasemonkey script: // ==UserScript==

Greasemonkey Jquery interference? [duplicate]

时光毁灭记忆、已成空白 提交于 2019-12-01 09:19:20
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: jQuery in Greasemonkey 1.0 conflicts with websites using jQuery It appears that if any of my greasemonkey scripts have the line like the below i get errors on sites that include jquery. I'm not sure why but i do notice some javascript events outright not firing. (For example on SO i cant add a comment). I could exclude SO in the script but is there a nicer solution? Maybe i should dynamically add jquery after

javascript: call an embedded function from a GM script

青春壹個敷衍的年華 提交于 2019-12-01 09:15:23
问题 On a webpage there's <script> function fn982734() { // some code } </script> In my Greasemonkey script, I have the following code: var fn = fields[5].getElementsByTagName("a")[0].getAttribute('onclick').substr(7,11); console.log(fn); // outputs fn982734 to the firebug console window[fn](); This code does not work, and spawns an error in the error console: window[fn] is not a function. However, typing directly into firebug: var fn = 'fn982734'; window[fn](); works perfectly. What's going on?