userscripts

How to trigger the listen button on the Google-translate page using javascript?

天涯浪子 提交于 2019-12-11 00:19:01
问题 I want to add shortcuts to the Google-translate page. Press Alt c or Esc to clear the textarea ; press Alt j to pronounce. This is the current user script: userscripts.org/scripts/review/110928 I do not know how to trigger the listen button on that page. I tried: var evt = document.createEvent("MouseEvents"); evt.initMouseEvent("click", true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null); var cb = document.getElementById("gt-src-listen"); cb.dispatchEvent(evt); but it does

How to change all links in a page?

可紊 提交于 2019-12-11 00:14:26
问题 For pages like this IP-direct, Google search: http://62.0.54.118/search?&q=42&oq=42&sourceid=chrome&ie=UTF-8&filter=0 How can I change all the links in that page from search?q to search?&q= ? For example, I want to make the link: http://62.0.54.118/search?q=42&ei=Xf5bUqHLOKeQ0AWV4YG4Cg&start=10&sa=N&filter=0 into: http://62.0.54.118/search?&q=42&ei=Xf5bUqHLOKeQ0AWV4YG4Cg&start=10&sa=N&filter=0 How can I make Chrome change the links by automatic script or something like that? 回答1: To change

Does the User Scripts directory still work with Chrome 13.0?

非 Y 不嫁゛ 提交于 2019-12-10 20:43:30
问题 I am using Mac OS X with Google Chrome 13.0.782.107. I'm trying to set up User Scripts as per these instructions. I have created a directory: ~/Library/Application Support/Google/Chrome/Default/User Scripts/ I created a file in that directory: hello.user.js (function() { // ==UserScript== // @name Hello, World // @namespace http://localhost.localdomain // @version 0.0.0 // // @include http://*/* // ==/UserScript== alert('Hello, World!'); })(); I created the following AppleScript to start

Can all keycode events be recognized by a user-script Jquery

人走茶凉 提交于 2019-12-10 18:24:31
问题 I am building a userscript with Tampermonkey that recognizes keycode events and when the key is fired it will do a function. for eg. I want to press Enter and its keycode is 13 so I used this code $(document).keypress(function(event){ var which = (event.which ? event.which : event.keyCode); if(which == '13'){ alert("You Pressed Enter key"); } else if(which == '17'){ alert("You Pressed Control key"); } }); The code works fine with Enter and with 1 but doesn't work with Ctrl nor Shift and other

Userscript - Is there a way to inject jquery code into angularjs dom?

此生再无相见时 提交于 2019-12-10 15:23:21
问题 So I'm trying to create userscript for one website. I cannot change any source code of website as it is not mine. Website is using AngularJS controllers everywhere. I'm researching for couple of days how to do this, but not successful. So I'm trying to inject code $(".nav").after("<div>test</div>"); it is working when I do it via Firefox Developers Console, but why it doesn't work when I'm trying to do it via Userscript. I did add $(function () { ... }); thingy to code so it fires handle

Make my userscript wait for other scripts to load

自闭症网瘾萝莉.ら 提交于 2019-12-10 03:57:55
问题 [ Edit: I'm replacing the original, confusing question with a simplified example demonstrating the problem.] Background I'm trying to write a userscript which will run in Chrome. This script needs to call a JavaScript function AlertMe() that is outside of the userscript -- this function is part of the page and contains variables that are generated dynamically on the server-side, so it isn't possible to re-write this function in my userscript. Code Script on the page (visit the page): <script

Can a webpage detect a tampermonkey userscript?

。_饼干妹妹 提交于 2019-12-09 10:34:17
问题 My question is sort of two-fold. First , how the sandbox model works, how it impacts the userscript, what is accessible / seen from the webpage and userscript point of view, and if using a different sandbox model affects the page being able to notice your script being injected into the page (or not). Second , how scripts are injected into the page, and can the page detect it? First From what I can see, when you use @grant none , the sandbox is disabled and you will have access to the webpage

How to dynamically inject a JavaScript function?

筅森魡賤 提交于 2019-12-09 07:55:57
问题 I am stuck using a product with a horrible UI at work and trying to make it palatable via UserScripts in Chrome. To that end, I am trying to inject a JavaScript function into the page via the UserScripts mechanism: // find the div var dropDown = document.getElementById("tstGlobalNavigation_ddlChooseProject"); // inject function dropDown.innerHTML = dropDown.innerHTML + "<script>function gotoIncident(){alert('111')}</script>"; // inject a button dropDown.innerHTML = dropDown.innerHTML + "   

capture a pages xmlhttp requests with a userscript

橙三吉。 提交于 2019-12-09 00:34:15
问题 I have a user script (for chrome and FF) that adds significant functionality to a page, but has recently been broken because the developers added some AJAX to the page. I would like to modify the script to listen to the pages xmlhttp requests, so that I can update my added content dynamically, based on the JSON formatted responseText that the page is receiving. A search has turned up many functions that SHOULD work, and do work when run in the console. However they do nothing from the context

no-cache script without using Jquery

痞子三分冷 提交于 2019-12-08 03:30:45
问题 Hello I am trying to create a script which inserts into any webpage a meta tag to force no-cache . Currently this is my code and I dont want to use Jquery (as shown in Script to force IE8 cache behaviour). var MAXlen = document.getElementsByTagName('head')[0].childNodes.length; //Get the length of childnodes of head. while(MAXlen--) { document.getElementsByTagName('head')[0].childNodes[MAXlen+1] = document.getElementsByTagName('head')[0].childNodes[MAXlen]; //store every node one place after.