Skip to content

Instantly share code, notes, and snippets.

@dhoepfl
Created January 3, 2018 12:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dhoepfl/7b3c132e8f8556732b1ebc66ebdd3c2c to your computer and use it in GitHub Desktop.
Save dhoepfl/7b3c132e8f8556732b1ebc66ebdd3c2c to your computer and use it in GitHub Desktop.
Tampermonkey script that removes '*' from kwerfeldein.
// ==UserScript==
// @name Closing the Gender*Gap
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Removes '*' and '_' gender gaps to make the text more readable.
// @author Daniel Höpfl
// @match https://kwerfeldein.de/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
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()) != undefined) {
var oldTxt = txtNode.nodeValue;
oldTxt = oldTxt.replace(/[*_]([a-z]+)/g, '$1');
txtNode.nodeValue = oldTxt;
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment