Created
April 1, 2012 17:51
-
-
Save rocktronica/2277362 to your computer and use it in GitHub Desktop.
Search and highlight HackerNews comments
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
// Paste this into your JS console, love. | |
var sNeedle = prompt("Find what?").toLowerCase(); | |
var tds = document.getElementsByClassName("default"); | |
var iTdCount = tds.length; | |
for (var i = 0; i < iTdCount; i++) { | |
var td = tds[i]; | |
var sHtml = td.innerHTML.toLowerCase(); | |
if (sHtml.indexOf(sNeedle) > -1) { | |
td.setAttribute( | |
"style", | |
(td.getAttribute("style") || "") + "background: yellow; box-shadow: 0 0 0 10px yellow;" | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment