53

Since Elon Musk became Twitter’s CEO, he’s been pushing through a lot of changes to the social network. But perhaps...

you are viewing a single comment's thread
view the rest of the comments
[-] peter@feddit.uk 20 points 1 year ago

Someone please make a lemmy client with a word filtering option so I can stop hearing about elmo

[-] crowsby@kbin.social 14 points 1 year ago* (last edited 1 year ago)

I can do you one better with a Tampermonkey script that will replace every reference to his name on every webpage to either "the biggest twat on the planet" or "this dipshit", depending on which works better syntactically.

// ==UserScript==
// @name         Text Replace
// @version      0.1
// @description  Text Replace
// @author       SiameseDream
// @include     *
// @grant        none
// @namespace beepboop
// ==/UserScript==

(function() {
    'use strict';

var replaceArry = [
    [/ Elon Musk/gi,' the biggest twat on the planet'],
    [/Elon Musk/gi,'The biggest twat on the planet'],
    [/ Mr. Musk/gi,' this dipshit'],
    [/ Musk/gi,' this dipshit'],
    [/Mr. Musk/gi,'This dipshit'],
    [/Musk/gi,'This dipshit'],
    // etc.
];
var numTerms    = replaceArry.length;
var txtWalker   = document.createTreeWalker (
    document.body,
    NodeFilter.SHOW_TEXT,
    {   acceptNode: function (node) {
            //-- Skip whitespace-only nodes
            if (node.nodeValue.trim() )
                return NodeFilter.FILTER_ACCEPT;

            return NodeFilter.FILTER_SKIP;
        }
    },
    false
);
var txtNode     = null;

while (txtNode  = txtWalker.nextNode () ) {
    var oldTxt  = txtNode.nodeValue;

    for (var J  = 0;  J < numTerms;  J++) {
        oldTxt  = oldTxt.replace (replaceArry[J][0], replaceArry[J][1]);
    }
    txtNode.nodeValue = oldTxt;
}
})();

In practice it looks like this

load more comments (18 replies)
this post was submitted on 27 Jul 2023
53 points (100.0% liked)

Technology

2 readers
2 users here now

This magazine is dedicated to discussions on the latest developments, trends, and innovations in the world of technology. Whether you are a tech enthusiast, a developer, or simply curious about the latest gadgets and software, this is the place for you. Here you can share your knowledge, ask questions, and engage in discussions on topics such as artificial intelligence, robotics, cloud computing, cybersecurity, and more. From the impact of technology on society to the ethical considerations of new technologies, this category covers a wide range of topics related to technology. Join the conversation and let's explore the ever-evolving world of technology together!

founded 1 year ago