Last active
March 25, 2020 01:06
-
-
Save catherineomega/cf9d829876bd12395664a60cd11ddfad to your computer and use it in GitHub Desktop.
A userscript to blur all tweets on Tweetdeck, then selectively unblur those that DON'T talk about the pandemic as you hover over them.
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 Safety Dance | |
// @namespace http://catherinewinters.com/ | |
// @version 0.1 | |
// @description Take a breath from The Problem. It's okay to prioritize your mental health. | |
// @author Catherine Winters | |
// @match https://tweetdeck.twitter.com/ | |
// @require https://code.jquery.com/jquery-1.12.4.min.js | |
// @grant none | |
// ==/UserScript== | |
(function ($, undefined) { | |
$(function () { | |
const substrings = ["covid","corona","virus", | |
"trump","cuomo","biden","glenn beck","president","liberal","coulter","governor","trudeau","administration", | |
"reopenamerica", | |
"bonnie henry","rent freeze", | |
"death","murder","killed","sick","people's lives", | |
"trolley","toilet paper","stonks", | |
"apocalypse","aids","end times", | |
"glove","n95","mask","hospital","pharma","vaccine","testing","medication","healthcare","icu","ppe", | |
"cruise", | |
"dow","stock market","stocks","markets","the economy","slavery","libertarian","economic", | |
"boeing","disney", | |
"epidemiolog","fatalities","evicted","laid off","layoffs","unemployed", | |
"lifesaving","social distancing","save lives","hand wash","wash your hand","wash hand","quarantine"]; | |
// Setup | |
console.log("Substrings: " + substrings.join(",")); | |
$('body').append('<style>.js-tweet { filter: blur(4px); } .js-tweet-unblurred { filter: blur(0); } </style>'); | |
$(document).on({ | |
mouseenter: function () { | |
//stuff to do on mouse enter | |
var text_to_search = $(this).text().toLowerCase(); | |
if (!substrings.some(v => text_to_search.includes(v))) { | |
console.log($(this).text()); | |
$(this).addClass('js-tweet-unblurred'); | |
} | |
}, | |
mouseleave: function () { | |
//stuff to do on mouse leave | |
} | |
}, ".js-tweet"); //pass the element as an argument to .on | |
}); | |
})(window.jQuery.noConflict(true)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment