Greasemonkey - how to display specific href links on page?

Scorpion Ghost

Elite Member
Executive VIP
Jr. VIP
Joined
Mar 22, 2013
Messages
9,150
Reaction score
10,489
So there's a page I visit that has multiple clickable links on it, but the actual URLS of those links are not visible on the page. I want them visible.

Each of the links has this code:

HTML:
<h3 class="media-info-name text-overflow" title="Some Title Here " style="">
<a target="_blank" href="https://somesite.com/blabla/asd/" style="">
Text Here
 </a>
</h3>

The closest I've come to a solution is with this script:

JavaScript:
// ==UserScript==
// @name     Show href
// @include  https://site.com
// @require  http://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js
// @require  https://gist.github.com/raw/2625891/waitForKeyElements.js
// @grant    GM_addStyle
// ==/UserScript==



waitForKeyElements ("a", hideImageExceptForAltText);

function hideImageExceptForAltText (jNode) {
    var imgTitle = jNode.attr("href");

    var newSpan = $("<span></span>");
    newSpan.attr("href", imgTitle);
    newSpan.append(imgTitle);

    jNode.parent().append(newSpan);
}

But this takes all the "a" elements on the page and shows their href, and makes the page look quite ugly. There's lots of "a" elements on it.

---

What I would like is a Greasemonkey script that can use the logic of:

- Find all the "h3" tags
- Find all the "a" tags within those "h3" tags
- Display all the href links from those "a" tags

Thanks
 
use h3 a selector instead of a, should work fine.

e.g. blablawait(‘h3 a’)…

Oh goddamnit. I had tried using "h3" and "h3:a", but didn't try that.

It worked!

Thanks dawg :)
 
Back
Top