Skip to content

Instantly share code, notes, and snippets.

@ayucha7
Last active May 25, 2017 17:57
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 ayucha7/aba02716aea4ca0b87904dc0d2281b70 to your computer and use it in GitHub Desktop.
Save ayucha7/aba02716aea4ca0b87904dc0d2281b70 to your computer and use it in GitHub Desktop.
A Chrome Extension that can remove all the occurance of word Mr. Trump and Trump with CrimeMaster Gogo

Steps to follow for installation of Chrome Extension:

Go to Chrome and navigate to extensions using this chrome://extensions/
Check the development mode
Click on "Load unpacked extension" and then select the folder in which manifest.json and myscripts.js files are.

You're done now just browse any site and all the mention of Mr. Trump, Trump and Donald Trump will be changed with " Crime Master Gogo "

For more detailed instruction visit my site: http://www.struckhigh.com/tips-and-tricks/trump-removal-chrome-extension-build-chrome-extension-9-minutes/

{
"manifest_version": 2,
"name": "Trump Removal",
"version": "1.0",
"description": "Remove Trump",
"content_scripts":
[
{
"matches": ["*://*/*"],
"js": ["myscripts.js"], //Javascript file that will find and replace all the desired words from the page
"run_at": "document_end"
}
],
"browser_action": {
"default_icon": "logo.png" // icon name
}
}
var str = document.body.innerHTML;
var c = (str.match(/\Mr. Trump\b/g) || []).length; //To count the number of occurances of word Mr. Trump
var m = (str.match(/\Trump\b/ig)|| []).length;
var i;
for(i=0;i<c;i++)
{
document.body.innerHTML = document.body.innerHTML.replace(/\Mr. Trump\b/g, 'Crime master Gogo'); //To the word Mr. Trump with Crime master Gogo
i=i+1;
}
for(j=0;j<m;j++)
{
document.body.innerHTML = document.body.innerHTML.replace(/\Trump\b/ig, 'Crime master Gogo');
j=j+1;
}
@ayucha7
Copy link
Author

ayucha7 commented May 25, 2017

logo

@ayucha7
Copy link
Author

ayucha7 commented May 25, 2017

Include logo.png also in the folder otherwise it will generate error to include that file....
follow step by step instructions from here : http://www.struckhigh.com/tips-and-tricks/trump-removal-chrome-extension-build-chrome-extension-9-minutes/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment