greasemonkey

Submit autofill (password input field)

只谈情不闲聊 提交于 2019-12-07 23:54:42
问题 I want to submit an autofilled password form using a userscript/tampermonkey in chrome. However it doesn't work - the fields the password field remains empty (server response or even with alert messages) until the window is actually controlled by a user (any actual keyboard press or mouse click). This seems important if you want a userscript to automate logins without hard-coding the passwords into your userscript. Does anyone have an explanation for that and/or a workaround? I tried all ways

Access an existing copy of jQuery on the target page

こ雲淡風輕ζ 提交于 2019-12-07 23:29:14
问题 I am writing a small userscript to get some content from a server and add it to a tie. The site has jQuery, how can I just use the site's jQuery instead of @require (because Chrome doesn't support this now)? 回答1: Use an existing copy of jQuery with code like this: function main () { /*--- Put all of your code here. Use jquery with $ or however the target page uses it. */ } function addJS_Node (text, s_URL, funcToRun) { var D = document; var scriptNode = D.createElement ('script'); scriptNode

jQuery click() not working in a Greasemonkey/Tampermonkey script

我是研究僧i 提交于 2019-12-07 22:56:25
问题 I am having issues triggering a jQuery click through Greasemonkey/Tampermonkey... jQuery('button').each(function() { jQuery(this).css('background', 'red'); jQuery(this).click(); location.assign("javascript:jQuery(this).click();void(0)"); }​ As you can see I've even tried the location.assign hack but nothing will work, no errors in the console either. Funny thing is that yes, the background colour does change to red so I am assuming it's something in the way .click() works that is different

Greasemonkey script to reload the page every minute

牧云@^-^@ 提交于 2019-12-07 22:19:35
问题 How to reload a page every 60 seconds? My attempt: setTimeout (location.reload, 1 * 60 * 60); I'm not sure what those numbers mean, or how to adapt them to reload after 60 seconds only. 回答1: setTimeout(function(){ location.reload(); }, 60*1000); You have to pass a full function as first argument, and second is the time in millisecond. So in your case, 60 * 1000 回答2: You may give a function name, since it is a callable, however, location.reload is a method of the location object. It is

appendedHow do I extract the text from a (dynamic) div, by class name, using a userscript?

牧云@^-^@ 提交于 2019-12-07 21:03:14
问题 How do I extract the value 2083236893 from the following object using JavaScript? <div class="gwt-Label">2083236893</div> I installed Greasemonkey 3.17 for Firefox 52.2.1 (32-bit) and tested every code example provided and failed. var html = document.getElementsByClassName("gwt-Label")[0]; alert(html.innerHTML); The above example comes from: Accessing Div, by class name, with javascript . Should the code be run on full download of the web page? Appended: var elements = document

Chrome iframe parent is undefined

醉酒当歌 提交于 2019-12-07 12:12:57
问题 I have this script for Gmail. It runs inside the canvas_frame iframe. I want to get a handle to the parent document, using parent.document . But in Chrome tells me that it's undefined. Works fine in Firefox, but blows up on Chrome. So how exactly do I get a handle to the parent document, from within an iframe, in Chrome. Chrome ver: 11.0.686.3 Here's the code that's failing: function init() { try { if(parent == null) { console.log(typeof parent); window.setTimeout(init, 200); return; } //

Have a script simulate a control, keypress sequence?

南笙酒味 提交于 2019-12-07 11:36:53
问题 I've searched and discovered that I can simulate a keypress event using jQuery, but my knowledge about jQuery is poor and I didn't get how exactly. So I have a Greasemonkey script which manages 2 different webpages in 2 tabs. I'd like to simulate/auto-execute Ctrl Shift Tab to go back to the previous tab automatically, this way I could change tabs in Firefox. The problem is that it's not only a plain keypress, I need to simulate a Ctrl and Shift parts too. I've added this to my script: //

Add class in jQuery in Greasemonkey script

非 Y 不嫁゛ 提交于 2019-12-07 07:33:25
I Asked a question earlier and was given a Working solution . One thing I want to do is incorporate jQuery to remove a class F-link-secondary and replace it with F-rank-good/bad/neutral depending on the value of deltaText. On most pages this is what I see: But on a certain page, the F-rank-XXX class is not there and instead there is just a single F-link-secondary which has no style. Here is what I want to do but I am not sure how to incorporate it with the Greasemonkey script. function getRank(deltaText) { if((1 <= deltaText) && (deltaText <= 10)) $("???").removeClass("F-link-secondary")

How does one have Greasemonkey run before *anything* else in the page?

烂漫一生 提交于 2019-12-07 07:09:34
问题 Is it possible to have Greasemonkey scripts run before anything else on the page? I'm aware of @run-at document-start , but this appears to run immediately after the <HTML> tag. Normally this isn't a problem, but if the page is misformatted as in the example below, there doesn't seem to be anything I can do. I'd appreciate any suggestions or ideas. Thanks! <script>alert('This is an annoying message.');</script> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD> ..

Replace javascript function using greasemonkey

荒凉一梦 提交于 2019-12-07 06:07:22
问题 I want to change the script using greasemonkey. But it doesn't work. Please help; original script <script> function abc(){ // SOME STUFF HERE } abc(); window.onload = abc; ..... // OTHER JAVASCRIPT TASK ..... </script> Now I want to change the function abc as my requirement. I tried the following way but doesn't help. // ==UserScript== // @name Test // @namespace UNIQUE_NAMESPACE // @include http://PATH_TO_DOMAIN/* // @version 1 // @grant unsafeWindow // ==/UserScript== unsafeWindow.abc=