Created
December 27, 2011 03:53
-
-
Save yahelc/1522657 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==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; | |
} | |
} | |
} | |
}()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment