Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 19e9fcb
Showing
12 changed files
with
165 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
browser.runtime.onMessage.addListener(message => { | ||
let { | ||
idea, | ||
charge | ||
} = message | ||
|
||
if (idea == 'person did a do') { | ||
let { | ||
host, | ||
javascript | ||
} = charge | ||
|
||
browser.storage.local.set({ | ||
[host]: javascript | ||
}) | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<!doctype html> | ||
<meta charset=utf-8> | ||
<link href=style.css rel=stylesheet> | ||
|
||
<p> | ||
javascript | ||
</p> | ||
|
||
<textarea id=javascript rows=20> | ||
</textarea> | ||
|
||
<script src=script.js></script> |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
let javascript = document.getElementById('javascript') | ||
let defaultCode = | ||
`// enter some | ||
// javascript here | ||
// and it will | ||
// run on every page | ||
// on this domain (location.host)` | ||
|
||
async function getActiveTab () { | ||
let tabs = await browser.tabs.query({ | ||
active: true, | ||
currentWindow: true | ||
}) | ||
|
||
return tabs[0] | ||
} | ||
|
||
async function getHost () { | ||
let {url} = await getActiveTab() | ||
let {host} = new URL(url) | ||
return host | ||
} | ||
|
||
getHost().then(async host => { | ||
let store = await browser.storage.local.get() | ||
let code = store[await getHost()] || defaultCode | ||
javascript.value = code | ||
}) | ||
|
||
javascript.addEventListener('input', async event => { | ||
let host = await getHost() | ||
browser.storage.local.set({ | ||
[host]: javascript.value | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
@font-face { | ||
font-family: "Reem Kufi"; | ||
font-style: normal; | ||
font-display: swap; | ||
font-weight: 400; | ||
src: | ||
local('Reem Kufi Regular '), | ||
local('Reem Kufi-Regular'), | ||
url('./reem-kufi.woff2') format('woff2'); | ||
} | ||
|
||
* { | ||
box-sizing: border-box; | ||
} | ||
|
||
body { | ||
background: #f7df1e; | ||
font-family: neutra text, neutra text bold, reem kufi, sans-serif; | ||
font-weight: 900; | ||
min-width: 25vw; | ||
} | ||
|
||
textarea { | ||
border: none; | ||
width: 100%; | ||
background: #f7df1e; | ||
font-weight: bold; | ||
border: 2px dotted black; | ||
padding: .5em; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
browser.storage.local.get().then(store => { | ||
let javascript = store[location.host] | ||
|
||
if (!javascript) { | ||
return | ||
} | ||
|
||
let script = document.createElement('script') | ||
script.textContent = javascript | ||
document.body.append(script) | ||
}) |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
{ | ||
"manifest_version": 2, | ||
"name": "javascript", | ||
"description": "add javascript that will run on this domain", | ||
"version": "0.0.1", | ||
"icons": { | ||
"64": "icons/icon.png" | ||
}, | ||
"permissions": [ | ||
"activeTab", | ||
"storage", | ||
"unlimitedStorage" | ||
], | ||
"background": { | ||
"scripts": [ | ||
"background_script.js" | ||
] | ||
}, | ||
"content_scripts": [ | ||
{ | ||
"matches": [ | ||
"*://*/*" | ||
], | ||
"js": [ | ||
"content_script.js" | ||
] | ||
} | ||
], | ||
"browser_action": { | ||
"default_icon": { | ||
"64": "icons/icon.png" | ||
}, | ||
"default_popup": "browserAction/index.html", | ||
"default_title": "javascript" | ||
}, | ||
"options_ui": { | ||
"page": "options/index.html" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<meta charset="UTF-8"> | ||
<link href="style.css" rel="stylesheet" /> | ||
<h1 id="myHeading">My content</h1> | ||
<script src="script.js"></script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
document.getElementById('myHeading').style.color = 'red' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
h1 { | ||
font-style: italic; | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.