init
3
.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
node_modules/
|
||||
dist/
|
||||
packages/
|
||||
29
README.md
Normal file
@@ -0,0 +1,29 @@
|
||||
# OrangeMan
|
||||
|
||||
OrangeMan - a browser extension that replaces any text with trump to 'Orange Man'
|
||||
|
||||
## Install
|
||||
|
||||
$ npm install
|
||||
|
||||
## Development
|
||||
|
||||
npm run dev chrome
|
||||
npm run dev firefox
|
||||
npm run dev opera
|
||||
npm run dev edge
|
||||
|
||||
## Build
|
||||
|
||||
npm run build chrome
|
||||
npm run build firefox
|
||||
npm run build opera
|
||||
npm run build edge
|
||||
|
||||
## Environment
|
||||
|
||||
The build tool also defines a variable named `process.env.NODE_ENV` in your scripts.
|
||||
|
||||
## Docs
|
||||
|
||||
* [webextension-toolbox](https://github.com/HaNdTriX/webextension-toolbox)
|
||||
18
app/_locales/en/messages.json
Normal file
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"appName": {
|
||||
"message": "OrangeMan",
|
||||
"description": "The name of the application"
|
||||
},
|
||||
"appShortName": {
|
||||
"message": "OrangeMan",
|
||||
"description": "The short_name (maximum of 12 characters recommended) is a short version of the app's name."
|
||||
},
|
||||
"appDescription": {
|
||||
"message": "OrangeMan",
|
||||
"description": "The description of the application"
|
||||
},
|
||||
"browserActionTitle": {
|
||||
"message": "OrangeMan",
|
||||
"description": "The title of the browser action button"
|
||||
}
|
||||
}
|
||||
BIN
app/images/icon-128.png
Normal file
|
After Width: | Height: | Size: 5.2 KiB |
BIN
app/images/icon-16.png
Normal file
|
After Width: | Height: | Size: 758 B |
BIN
app/images/icon-19.png
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
BIN
app/images/icon-38.png
Normal file
|
After Width: | Height: | Size: 4.2 KiB |
32
app/manifest.json
Normal file
@@ -0,0 +1,32 @@
|
||||
{
|
||||
"name": "__MSG_appName__",
|
||||
"short_name": "__MSG_appShortName__",
|
||||
"description": "__MSG_appDescription__",
|
||||
"version": "0.0.0",
|
||||
"manifest_version": 2,
|
||||
"default_locale": "en",
|
||||
"icons": {
|
||||
"16": "images/icon-16.png",
|
||||
"128": "images/icon-128.png"
|
||||
},
|
||||
"background": {
|
||||
"scripts": [
|
||||
"scripts/background.js"
|
||||
]
|
||||
},
|
||||
"content_scripts": [
|
||||
{
|
||||
"matches": ["https://*/*", "http://*/*"],
|
||||
"all_frames": true,
|
||||
"js": ["scripts/running.js"]
|
||||
}
|
||||
],
|
||||
"browser_action": {
|
||||
"default_icon": {
|
||||
"19": "images/icon-19.png",
|
||||
"38": "images/icon-38.png"
|
||||
},
|
||||
"default_title": "__MSG_browserActionTitle__",
|
||||
"default_popup": "pages/popup.html"
|
||||
}
|
||||
}
|
||||
14
app/pages/popup.html
Normal file
@@ -0,0 +1,14 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>Popup</title>
|
||||
<link rel="stylesheet" type="text/css" href="../styles/popup.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h1>Popup</h1>
|
||||
|
||||
<script src="../scripts/popup.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
7
app/scripts/background.js
Normal file
@@ -0,0 +1,7 @@
|
||||
browser.runtime.onInstalled.addListener((details) => {
|
||||
console.log('previousVersion', details.previousVersion)
|
||||
})
|
||||
|
||||
browser.browserAction.setBadgeText({
|
||||
text: 'running'
|
||||
})
|
||||
1
app/scripts/popup.js
Normal file
@@ -0,0 +1 @@
|
||||
console.log(`'Allo 'Allo! Popup`)
|
||||
18
app/scripts/running.js
Normal file
@@ -0,0 +1,18 @@
|
||||
function getChildTextNodes(el){
|
||||
let n, a=[], walk=document.createTreeWalker(el,NodeFilter.SHOW_TEXT,null,false);
|
||||
while(n=walk.nextNode()) a.push(n);
|
||||
return a;
|
||||
}
|
||||
|
||||
function ReplaceTrump() {
|
||||
const textNodes = getChildTextNodes(document);
|
||||
textNodes.forEach(node => {
|
||||
const replacementContent = node.nodeValue.replace(/(donald trump|donald john trump|trump|president trump|donald j trump|donaldj trump|donald j. trump)/gi, "Orange Man");
|
||||
node.nodeValue = replacementContent;
|
||||
})
|
||||
}
|
||||
|
||||
document.body.addEventListener('change', ReplaceTrump);
|
||||
window.addEventListener('load', ReplaceTrump);
|
||||
window.addEventListener('DOMContentLoaded', ReplaceTrump);
|
||||
ReplaceTrump();
|
||||
0
app/styles/popup.css
Normal file
12
package.json
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"name": "OrangeMan",
|
||||
"version": "0.0.1",
|
||||
"description": "OrangeMan",
|
||||
"scripts": {
|
||||
"dev": "webextension-toolbox dev",
|
||||
"build": "webextension-toolbox build"
|
||||
},
|
||||
"devDependencies": {
|
||||
"webextension-toolbox": "latest"
|
||||
}
|
||||
}
|
||||
BIN
promo/Chrome-Webstore-Icon_128x128.png
Normal file
|
After Width: | Height: | Size: 921 B |
BIN
promo/Promo-Image-Large_920x680.png
Normal file
|
After Width: | Height: | Size: 35 KiB |
BIN
promo/Promo-Image-Marquee_1400x560.png
Normal file
|
After Width: | Height: | Size: 36 KiB |
BIN
promo/Promo-Image-Small_440x280.png
Normal file
|
After Width: | Height: | Size: 24 KiB |
BIN
promo/Screenshot_1280x800.png
Normal file
|
After Width: | Height: | Size: 54 KiB |
BIN
promo/Screenshot_640x400.png
Normal file
|
After Width: | Height: | Size: 26 KiB |