Hey there!
I'm trying to make a chrome extension for the fun of it that replaces the words Package, Shipment, parcel and etc in our main language to the Meme Pakig:
https://i.imgur.com/4HxWLpK.jpg[
^]
With little to no coding experience. (I can make an html page that's it lmao)
From the tutorials that I have found I came up with some JS stuff
Sadly all I get are issues that makes EVERY WORDS PAKIG, I mean it's fun but uhh... that's not what I had in mind...
Tell me how I could improve that so I could say that I didn't effortlessly made some s*itposting and actually made something fun! :^p
Thanks!
What I have tried:
Content.js
var elements = document.getElementsByTagName('*');
for (var i = 0; i < elements.length; i++) {
var element = elements[i];
for (var j = 0; j < element.childNodes.length; j++) {
var node = element.childNodes[j];
if (node.nodeType === 3) {
var text = node.nodeValue;
var replacedText = text.replace(/[package|colis|parcel|packidj|shipment]/gi, '[pakig]');
if (replacedText !== text) {
element.replaceChild(document.createTextNode(replacedText), node);
}
}
}
}
manifest.js
{
"manifest_version": 2,
"name": "[The Pakig Maker]",
"description": "[Replaces words like package, parcel and so on with the Pakig Meme, yes I really took time to make this.]",
"version": "1.0",
"content_scripts": [
{
"matches": [
"*://*/*"
],
"js": [
"content.js"
],
"run_at": "document_end"
}
]
}