public
Last active

  • Download Gist
show-full-hn-domains.user.js
JavaScript
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
// ==UserScript==
// @name Show Full Domain on Hacker News posts
// @description Sets full domain on hacker news posts.
// @namespace http://userscripts.org/users/119115
// @include http://news.ycombinator.com/*
// @include https://news.ycombinator.com/*
// @match https://news.ycombinator.com/*
// @match http://news.ycombinator.com/*
// ==/UserScript==
 
(function(){
var stories = document.getElementsByClassName("title");
for(var i=0; i<stories.length; i++){
var url = stories[i].getElementsByTagName("a"),
domain = stories[i].getElementsByClassName("comhead")[0];
if(domain && domain.className === "comhead"){
var fulldomain = " (" + url[0].hostname.replace(/^www\./,"") + ") ";
if(fulldomain !== domain.innerHTML ){
domain.innerHTML = fulldomain;
}
}
}
}());

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.