Skip to content

Instantly share code, notes, and snippets.

@Ascor8522
Last active June 22, 2018 19:20
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 Ascor8522/2165b250826c02f3abfd2b3163d15db2 to your computer and use it in GitHub Desktop.
Save Ascor8522/2165b250826c02f3abfd2b3163d15db2 to your computer and use it in GitHub Desktop.
Replaces all occurences of "Manu" by "Manu"
// ==UserScript==
// @name Manu
// @author Smrman
// @description Replaces all the occurences of "Emmanuel Macron" by "Manu"
// @version 0.1
// @match *://*/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
window.onload = manu(["Emmanuel Macron", "Monsieur le président", "le président de la République", "Macron"]);
})();
function manu(tabl) {
for(var mot of tabl) {
while(document.getElementsByTagName("body")[0].innerHTML.search(mot) > 0) {
document.getElementsByTagName("body")[0].innerHTML = document.getElementsByTagName("body")[0].innerHTML.replace(mot, "Manu");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment