Last active
August 29, 2019 14:51
-
-
Save CADawg/412da334c8f359cec5903576f110a7fd to your computer and use it in GitHub Desktop.
Converts Flag(s) and Downvote(s) to Downdoots
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== | |
| // @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