This commit is contained in:
Tommy Parnell
2019-08-28 09:42:28 -04:00
commit 2dcd6e6b83
21 changed files with 4178 additions and 0 deletions

3
.gitignore vendored Normal file
View File

@@ -0,0 +1,3 @@
node_modules/
dist/
packages/

29
README.md Normal file
View 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)

View 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

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

BIN
app/images/icon-16.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 758 B

BIN
app/images/icon-19.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

BIN
app/images/icon-38.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

32
app/manifest.json Normal file
View 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
View 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>

View 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
View File

@@ -0,0 +1 @@
console.log(`'Allo 'Allo! Popup`)

18
app/scripts/running.js Normal file
View 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
View File

12
package.json Normal file
View 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"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 921 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

4044
yarn.lock Normal file

File diff suppressed because it is too large Load Diff