greasemonkey

javascript on page load check if a span (under <tr>) with a specific class exist, if does not exist remove the entire <tr>

蹲街弑〆低调 提交于 2019-12-02 11:22:30
I am trying to create my own greasemonkey script for my favorite directory listing site :) The thing is not everything it list is beneficial to me, I inspected the website code and as it seems, each entry is under Now, and as it seems, I am only interested with those which have this format: <tr class="project-description"> <td colspan="6"> <div class="project-desc-inner"> <div class="project-synopsis"> <p class="trunk8">This is an entry</p> </div> <div class="project-verification"> <span class="verfied-badge"> <~~~~~~~~~~ THIS SPAN <span class="currency-symbol">$</span> <span class="icon-tick"

How can I modify the title of a site using JavaScript?

烈酒焚心 提交于 2019-12-02 08:47:50
When viewing a torrent page, the title of the tab is: Bitsoup.org The Best site for your Torrent appetite :: Details for torrent "ABC" where "ABC" is the name of the torrent file. Unfortunately, when I have 3+ tabs open, I can not see what the name of the torrent file is. I am attempting to create a Greasemonkey script to truncate, or split, the title, so that it only displays the torrent-name, and not the beginning part. I am aware that you can modify the title associated with a page by using document.title = ... but I am unsure of what to assign it to. You could use a regular expression,

Javascript variable scope in a JS URI, or how to write page-scope objects?

流过昼夜 提交于 2019-12-02 08:12:08
问题 I'm writing a Greasemonkey script that I'm trying to use in Chrome and Firefox. I know you can't use unsafewindow in Chrome like you can in Firefox, so I've been attempting to use jS-uris like in the answer for: Greasemonkey, Chrome and unsafeWindow.foo(). when I try the following: location.assign("javascript:var tutu = 'oscar';"); location.assign("alert('1:' + tutu);"); alert('2:' + tutu); I receive an error showing that "tutu" is undefined. Obviously what I'm not understanding is the scope

Writing a userscript that replaces a background image

笑着哭i 提交于 2019-12-02 07:33:42
This is the code // ==UserScript== // @name Wood Background // @namespace http://www.nationstates.net/nation=ellorn // @description Changes background to wood finish // @include http:*//w11.zetaboards.com/Allied_Republics/* // ==/UserScript== function addCss(cssString) { var head = document.getElementsByTagName('head')[0]; return unless head; var newCss = document.createElement('style'); newCss.type = "text/css"; newCss.innerHTML = cssString; head.appendChild(newCss); } addCss ( '* { background: #00ff00 url('http://awesomewallpapers.files.wordpress.com/2010/01 /wooden_top.jpg') no-repeat fixed

Greasemonkey is unable to find/modify/delete content? (on Twitch.tv)

╄→尐↘猪︶ㄣ 提交于 2019-12-02 07:07:47
I'm trying to remove various games off the twitch sub-page "Game List" (twitch.tv/directory) but I'm getting nowhere. I've debugged with alert, timers and @run-at document-end to no avail, the script reaches the page correctly but once I try to manipulate content nothing happens. This is what I use to test it: // ==UserScript== // @name TwitchDeleteTest // @namespace to.be.continued // @include http*://*twitch.tv/directory* // @version 1 // @grant none // ==/UserScript== var rmLoL = document.querySelector("a[title='League of Legends']"); var grandParent = rmLoL.parentNode.parentNode;

Use greasemonkey to add HTML before table

江枫思渺然 提交于 2019-12-02 07:04:33
I am using greasemonkey to edit a page. I need to add my own table between the two tables that are already on the page and then remove the second table. There is nothing really setting the two existing tables apart, so I am having trouble with the function to insertBefore . <h3>Table 1</h3> <table class="details" border="1" cellpadding="0" cellspacing="0"> <tbody><tr> <th>1</th> <td>2</td> </tr> </tbody></table> <h3>Table 2</h3> <table class="details" border="1"> <tbody><tr> <th>1</th> <td>2</td> </tr><tr> <th>3</th> <td>4</td> </tr> </tbody></table> I have found the below code helpful in

Modify elements immediately after they are displayed (not after page completely loads) in greasemonkey script?

流过昼夜 提交于 2019-12-02 05:55:30
问题 I have this script. It applies on RottenTomatoes movie pages , and modifies 3 elements (1 visible text and 2 texts inside tooltips). Currently, (due to greasemonkey's @run-at document-end ) it modifies the elements only after the page has completely loaded . Additionally, there are many times where RottenTomates pages delay loading, up to 20 sec(!), so that's additional delay to my script. This causes two things: a delay in displaying the modified visible text, and that, if you hover your

how to enter a random value in a textarea without an id?

 ̄綄美尐妖づ 提交于 2019-12-02 05:33:16
I have to enter a random value in a textarea of a web site by using grease monkey script the text area didn't have an id so document.getElementById doesn't work. Can I use another method to do that? My current HTML showing my textarea : <tr> <td class="tdv pd5"><span class="tbg"> Message</span> </span> </td> <td class="pd5"> <textarea name="inpx_msg" class="msgbox"></textarea> <br /> <div class="tsm">140 characters max.</div> </td> </tr> You could use element.querySelector if you want to be able to specifically target an element using a CSS selector, similar to this: var textArea = document

How to replace image links with img src url in Greasemonkey

丶灬走出姿态 提交于 2019-12-02 05:17:41
From the title this may sound like a duplicate question. But what I am asking for is help writing a Greasemonkey script that takes all images containing the word "thumbnails" in the src url, replaces "thumbnails" with "images" but then putting the new url into the href (target) url. What I have so far is: for(var iImage=0;iImage<document.images.length;iImage++){ var imageUrl = document.images[iImage].src; if (imageUrl.indexOf("thumbnails") != -1) { imageUrl = imageUrl.replace("thumbnails","images") document.images[iImage].href = imageUrl; } } Any help would be appreciated. Amjad Masad img tags

Creating a JQueryscript for GM - Trouble by rewriting the JS code

爷,独闯天下 提交于 2019-12-02 05:14:49
after trying to solve the problem without and with help I'm still stuck. My aim was writing a GM-script with JS. Someone told me to use jQuery because of its simplicity. Well, I started learning JS last week and my head is full of information. What I need is hint/start/beginning/whatever telling me how to rewrite the script into a fine working jQuery-script. Well, I read some manuals, but somehow I just cannot figure it out. It might be that I misunderstood the syntax of jQuery which can't be hard to unserstand. At least I relived the manuals... This is how the script should work: 1. I created