Created
December 29, 2018 17:41
-
-
Save luelista/985152f88b851f9ef95a0a0a78f387fe to your computer and use it in GitHub Desktop.
Colors tweets with hex color hashtags
This file contains 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 HexTweets | |
// @version 1 | |
// @grant none | |
// @match https://twitter.com/* | |
// ==/UserScript== | |
var re = /^#[a-fA-F0-9]{6}$/; | |
var hashtags = document.querySelectorAll("div.tweet a.twitter-hashtag"); | |
for(var i in hashtags) { | |
var hashtag = hashtags[i].innerText; | |
if (re.test(hashtag)) { | |
hashtags[i].closest("div.tweet").style.backgroundColor = hashtag; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment