Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Converts Flag(s) and Downvote(s) to Downdoots
// ==UserScript==
// @supports TamperMonkey
// @name DownDootJS
// @namespace tools.steem.downdootjs
// @version 1
// @description Downdoot Everything!
// @author Professional DownDooters™ (@cadawg)
// @match http*://*/*
// @grant none
// @require http://code.jquery.com/jquery-3.4.1.min.js
// ==/UserScript==
function toDoot(dootable) {
return dootable.replace(/flagg|flag|downvote/gi, function(x) {
var xss = x.substring(0,1);
if (xss.toUpperCase() == xss) {
return "Downdoot";
} else {
return "downdoot";
}
});
}
function checkDootable() {
$('[href*=downdoot_challenge]').replaceWith("DownDootJS is installed and active!")
var paras = document.getElementsByTagName('div');
for (var i = 0; i < paras.length; i++) {
console.log($(paras[i]));
try {
if (/flagg|flag|downvote/gi.test($(paras[i]).contents().filter(function(){return this.nodeType == 3;})[0].nodeValue)) {
$(paras[i]).contents().filter(function(){
return this.nodeType == 3;
})[0].nodeValue =toDoot($(paras[i]).contents().filter(function(){
return this.nodeType == 3;
})[0].nodeValue);
}
} catch (err) {}
/*if (/flag|downvote/gi.test($(paras[i]).text())) {
paras[i].textContent = toDoot(paras[i].textContent);
}*/
};
}
(function() {
'use strict';
window.addEventListener("load", function(event) {
var s = document.createElement("script");
s.type = "text/javascript";
s.src = "http://code.jquery.com/jquery-3.4.1.min.js";
document.getElementByTagName("head")[0].append(s);
checkDootable();
});
setInterval(checkDootable, 1000);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.