Manu Auto Correct

Changer toute référence à "Emmanuel Macron" en "Manu".

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         Manu Auto Correct
// @description  Changer toute référence à "Emmanuel Macron" en "Manu".
// @namespace    https://greasyfork.org/users/94925
// @version      0.4
// @author       Wonderclod | Maxime Bouveron | Roubou | ReActif (Tampermonkey)
// @include      *
// @grant        none
// ==/UserScript==

// Source
// ------
// Github  : https://github.com/Bo-Duke/Manu-Auto-Correct

// Extensions
// ----------
// Chrome  : https://chrome.google.com/webstore/detail/manu-auto-correct/eamgamedjemopbnggghghnciejnbdpoe
// Firefox : https://addons.mozilla.org/fr/firefox/addon/manu-auto-correct/

// Guide (noeuds TEXT uniquement)
var textNode, walk = document.createTreeWalker(document.body, NodeFilter.SHOW_TEXT, null, false);

// Expressions à remplacer par 'Manu'
const rExp1 = new RegExp(
      'Emmanuel Macron|'
	+ 'EmmanuelMacron|'
	+ 'M[\.r] le Président de la République|' // En cas de 'Mr' ou 'M.'
    + 'le Président de la République|'
	+ 'Monsieur le Président de la République|'
	+ 'Monsieur le Président|'
	+ 'Président de la République française|'
	+ 'Président de la République|'
    + 'Le Chef de l\'Etat|'
	+ 'Le Président Macron|'
	+ 'Emmanuel Jean-Michel Frédéric Macron|'
	+ 'M[\.r] Macron'
    , 'gi' // Recherche 'g'lobal et 'i'nsensible à la casse
);

// Expressions "que/qu'" à remplacer par 'que Manu'
const rExp2 = new RegExp(
      'qu\'Manu|' // Au cas où le nom ai déjà été changé par 'rExp1'
    + 'que Macron|'
    + 'qu\'Emmanuel Macron|'
    + 'qu\'Emmanuel Jean-Michel Frédéric Macron'
    , 'gi' // Recherche 'g'lobal et 'i'nsensible à la casse
);

// Expressions "de/d'" à remplacer par 'de Manu'
const rExp3 = new RegExp(
      'd\'Manu|' // Au cas où le nom ai déjà été changé par 'rExp1'
    + 'de Macron|'
    + 'd\'Emmanuel Macron|'
    + 'd\'Emmanuel Jean-Michel Frédéric Macron'
    , 'gi' // Recherche 'g'lobal et 'i'nsensible à la casse
);

// Appliquer les changements dans la page
while(textNode=walk.nextNode()) {
    textNode.nodeValue = textNode.nodeValue.replace(rExp1, 'Manu');
    textNode.nodeValue = textNode.nodeValue.replace(rExp2, 'que Manu');
    textNode.nodeValue = textNode.nodeValue.replace(rExp3, 'de Manu');
}

// Appliquer les changement dans la barre de titre
document.title = document.title.replace(rExp1, 'Manu');
document.title = document.title.replace(rExp2, 'que Manu');
document.title = document.title.replace(rExp3, 'de Manu');