User:Chrissy/projects/Trump=Turd: Difference between revisions
< User:Chrissy | projects
No edit summary |
|||
Line 4: | Line 4: | ||
on the base of Josephs's Extension I asked for an easy script to change specific words into other words. In this example on every webpage the Word "Trump" to "Turd". | on the base of Josephs's Extension I asked for an easy script to change specific words into other words. In this example on every webpage the Word "Trump" to "Turd". | ||
[[File:Turd-icon.png|right]] | [[File:Turd-icon.png|right|frameless]] | ||
==preview== | ==preview== |
Latest revision as of 14:33, 20 March 2025
Description
Firefox Extension to exchange specific words in browser.
on the base of Josephs's Extension I asked for an easy script to change specific words into other words. In this example on every webpage the Word "Trump" to "Turd".
preview
Code
manifest.json
{
"manifest_version": 3,
"name": "xyz",
"version": "1.0",
"permissions": [
"activeTab",
"storage",
"scripting"
],
"description": "make the internet great again",
"content_scripts": [
{
"matches": [
"*://*/*"
],
"js": [
"extra.js"
]
}
],
"icons": {
"48": "turd-icon.png"
}
}
javascript
console.log("hello worldldskdsklmdfklds");
var elements = document.body.getElementsByTagName("*");
console.log(elements);
for (var counter = 0; counter < elements.length; counter++) {
var text = elements[counter].innerHTML;
if (text && text.includes("Trump")) {
console.log("Trump found");
elements[counter].innerHTML = text.replace("Trump", "Turd");
}
if (text && text.includes("TRUMP")) {
console.log("Turd found");
elements[counter].innerHTML = text.replace("TRUMP", "Turd");
}
}