tampermonkey

How to replace lots of words in AJAX-driven page text, and in select attributes — using a Tampermonkey script?

爱⌒轻易说出口 提交于 2019-11-28 14:23:49
I'm translating text/words/terms inside an HTML document using a tree walker to affect only text nodes: var replaceArry = [ [/View your user account/gi, 'Tu cuenta'], // etc. ]; var numTerms = replaceArry.length; var txtWalker = document.createTreeWalker ( document.body, NodeFilter.SHOW_TEXT, { acceptNode: function (node) { //-- Skip whitespace-only nodes if (node.nodeValue.trim() ) return NodeFilter.FILTER_ACCEPT; return NodeFilter.FILTER_SKIP; } }, false ); var txtNode = null; while (txtNode = txtWalker.nextNode () ) { var oldTxt = txtNode.nodeValue; for (var J = 0; J < numTerms; J++) {

Userscript to Loop over several HTTP Requests and combine the results?

跟風遠走 提交于 2019-11-28 14:15:15
I now know how to load columns, of a table, from an external webpage . Now I want to expand on that and: Fetch tabular data from several pages (rankings by player position). Merge it into one master table. This is the URL (http:...fantasysports.yahoo.com...pos=QB) that the script currently fetches. The columns are the team name and the team's rank for the various positions. I want to have it iterate over other positions (i.e. WR, RB, TE). This is done by just changing the last 2 letters of the URL to its respective value. I then want to have all this data in a single array where first column

Tampermonkey select a dropdown value with name

馋奶兔 提交于 2019-11-28 12:03:06
问题 I want Tampermonkey to change a select drop down to a specific country. The HTML is formatted like; <label>Country</label> <span class="select_wrapper"> <select name="shipping_country_id"> <option value="46">Afghanistan</option> <option value="47">Albania</option> <option value="42">United Kingdom</option> <option value="43" selected="">United States</option> </select> <span class="value">United States</span> </span> I have tried; ("select[name='shipping_country_id'] option[value='42']",

Tampermonkey script run before page load

让人想犯罪 __ 提交于 2019-11-28 11:17:49
I need to hide a section from an html page: <h1 data-ng-show="!menuPinned && !isSaaS" class="logo floatLeft" aria-hidden="false"><span>XXX </span><span style="font-weight: bold;">XXX </span><span>XXXXX</span></h1> The following code works fine in Chrome dev. tools var ibmlogo = document.querySelectorAll('h1.logo.floatLeft'); ibmlogo[1].remove(); But when I load the page with the script active, the section (h1) won't disappear. I believe this is because when the script runs, the DOM has not been completed loaded yet, hence the script fails to find the selector. I have tried many different

How to change the name field of an <input> in an AJAX-driven page?

北慕城南 提交于 2019-11-28 10:36:53
问题 For this target page (Sorry but SO doesn't allow hyperlinks to 62.0.54.118): http://62.0.54.118/search?&q=42&oq=42&sourceid=chrome&ie=UTF-8&filter=0 , I want to change the name field of an <input> by default with a userscript. The input is: <input class="gsfi" id="lst-ib" name="q" maxlength="2048" value="42"...> I want to change it to: <input class="gsfi" id="lst-ib" name="&q" maxlength="2048" value="42"...> That is, I Want to change the q into &q in the name field of the input by default. I

tampermonkey script stops working if I change the page

邮差的信 提交于 2019-11-28 10:04:01
问题 I am using Tampermonkey to save time on frequent tasks. The goal is to get content of an element on www.example1.com, navigate to another page, and do stuff there. The starting page is www.example1.com as seen from match . This is the code I am using: //@match http://example1.com var item = document.getElementById("myId").textContent; window.open("http://example2.com","_self"); setTimeOut(function( //perform clicks on this page ){},3000); None of the code after changing URLs ever gets

Redirect faster with Greasemonkey (or similar userscript engine)?

▼魔方 西西 提交于 2019-11-28 08:50:30
I'm using Greasemonkey to redirect certain URLs to another but I would like to redirect before the URL to be redirect loads. Currently I'm using this simple script: //==UserScript== // @name Redirect Google // @description Redirect Google to Yahoo! // @include http://*.google.com/* //==/UserScript== window.location.replace("http://www.yahoo.com") In the above, Google appears for a second and then redirected to Google. I want to go yahoo immediately. Is it possible, and how? user873792 You can use @run-at document-start in the metadata block Doc . EG: //==UserScript== // @name Redirect Google /

How to convert a bookmarklet into a Greasemonkey userscript?

余生颓废 提交于 2019-11-28 07:50:11
Is there a easy way to do this. And is there anything that needs to be changed due to differences in how it is ran? Brock Adams The easiest way to do this: Run the bookmarklet code through a URL decoder . so that javascript:alert%20('Hi%20Boss!')%3B , for example, becomes: javascript:alert ('Hi Boss!'); Strip the leading javascript: off. Result: alert ('Hi Boss!'); Add this code to the end of your Greasemonkey file. For example, create a file named, Hello World.user.js , with this code: // ==UserScript== // @name Hello World! // @description My first GM script from a bookmarklet // @include

How to Use Tampermonkey to reload another tab?

 ̄綄美尐妖づ 提交于 2019-11-28 05:23:41
问题 I want to refresh a certain tab when the current tab changes, using Tampermonkey . I am a user of Duolingo, but I am not happy with their new change of the Crown system, and I don't like their algorithm with the 'Practice' button. So, I use the site duome.eu to choose the weakest to review. Like on this page:     https://duome.eu/example/progress The information on this site was based on the progress of the user on duolingo.com. I click the link on the duome page to open duolingo site to

@require-ing jQuery overwrites the page's $ variable

主宰稳场 提交于 2019-11-28 05:05:53
问题 I'm @require -ing jQuery for my Greasemonkey script with this line in my script file: // @require https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js and it works quite well; I can use $('#id') to access the DOM. However, the $ variable of the 'real' page is modified (where $ is jQuery 1.2.xx): I get an error that $.include is not defined. I thought the sandbox model of Greasemonkey would prevent that the variables of the target-page are overwritten? How can I ensure that the