mirror of
https://github.com/miljegen/browser-milje.git
synced 2025-04-11 12:25:07 +00:00
Compare commits
8 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
aa71f952ec | ||
|
31b725dfc6 | ||
|
a009f6425c | ||
ddfe7e7a91 | |||
|
ff839b5333 | ||
|
6355d4f6a6 | ||
|
78b6ce361e | ||
|
f68d9dad91 |
18
.gitignore
vendored
Normal file
18
.gitignore
vendored
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
### VisualStudioCode ###
|
||||||
|
.vscode/*
|
||||||
|
!.vscode/settings.json
|
||||||
|
!.vscode/tasks.json
|
||||||
|
!.vscode/launch.json
|
||||||
|
!.vscode/extensions.json
|
||||||
|
!.vscode/*.code-snippets
|
||||||
|
|
||||||
|
# Local History for Visual Studio Code
|
||||||
|
.history/
|
||||||
|
|
||||||
|
# Built Visual Studio Code Extensions
|
||||||
|
*.vsix
|
||||||
|
|
||||||
|
### VisualStudioCode Patch ###
|
||||||
|
# Ignore all local history of files
|
||||||
|
.history
|
||||||
|
.ionide
|
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"editor.maxTokenizationLineLength": 100000000000000000000
|
|
||||||
}
|
|
13
Makefile
Normal file
13
Makefile
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
ENCODED_IMAGES := $(wildcard assets/*.png.64)
|
||||||
|
IMAGES := $(patsubst assets/%.png.64, images/%.png, $(ENCODED_IMAGES))
|
||||||
|
|
||||||
|
out: $(IMAGES)
|
||||||
|
|
||||||
|
images/:
|
||||||
|
mkdir $@
|
||||||
|
echo '*' > images/.gitignore
|
||||||
|
images/%.png: assets/%.png.64 | images/
|
||||||
|
base64 -d $< > $@
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -2,11 +2,15 @@
|
|||||||
"manifest_version": 3,
|
"manifest_version": 3,
|
||||||
"name": "browser-milje",
|
"name": "browser-milje",
|
||||||
"description": "adds a milje table cloth on top of your browser viewport",
|
"description": "adds a milje table cloth on top of your browser viewport",
|
||||||
"version": "0.0.1",
|
"version": "0.0.2",
|
||||||
|
"permissions": ["storage", "activeTab", "scripting"],
|
||||||
"action": {
|
"action": {
|
||||||
"default_popup": "popup.html",
|
"default_popup": "popup.html",
|
||||||
"default_icon": "assets/browser-milje.png"
|
"default_icon": "assets/browser-milje.png"
|
||||||
},
|
},
|
||||||
|
"background": {
|
||||||
|
"service_worker": "background.js"
|
||||||
|
},
|
||||||
"icons": {
|
"icons": {
|
||||||
"16": "assets/icon-16.png",
|
"16": "assets/icon-16.png",
|
||||||
"32": "assets/icon-32.png",
|
"32": "assets/icon-32.png",
|
||||||
@ -15,8 +19,13 @@
|
|||||||
},
|
},
|
||||||
"content_scripts": [
|
"content_scripts": [
|
||||||
{
|
{
|
||||||
"js": ["scripts/milje.js"],
|
"matches": ["<all_urls>", "file:///"],
|
||||||
"matches": ["<all_urls>", "file:///"]
|
"js": ["scripts/milje.js", "scripts/contentScript.js"]
|
||||||
}
|
}
|
||||||
]
|
],
|
||||||
|
"browser_specific_settings": {
|
||||||
|
"gecko": {
|
||||||
|
"id": ""
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,6 +25,11 @@
|
|||||||
<body>
|
<body>
|
||||||
<h1>browser-milje!</h1>
|
<h1>browser-milje!</h1>
|
||||||
<img id="milje" src="assets/milje.png" alt="this should represent the milje">
|
<img id="milje" src="assets/milje.png" alt="this should represent the milje">
|
||||||
|
<input type="file" id="fileInput" accept="image/*">
|
||||||
|
<button id="uploadButton">upload milje!</button>
|
||||||
|
<div id="miljeGallery">
|
||||||
|
|
||||||
|
</div>
|
||||||
<script src="milje.js"></script>
|
<script src="milje.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
5
scripts/contentScript.js
Normal file
5
scripts/contentScript.js
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
chrome.runtime.onMessage.addListener((message, sender, sendResponse) => {
|
||||||
|
if (message.type === "setMilje") {
|
||||||
|
document.body.style.background = `url(${message.milje})`;
|
||||||
|
}
|
||||||
|
});
|
112
scripts/milje.js
112
scripts/milje.js
File diff suppressed because one or more lines are too long
13
scripts/popup.js
Normal file
13
scripts/popup.js
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
document.getElementById('uploadButton').addEventListener('click', async () => {
|
||||||
|
const miljeInput = document.getElementById('fileInput');
|
||||||
|
const milje = miljeInput.files[0];
|
||||||
|
|
||||||
|
if(!milje) {
|
||||||
|
alert("Please select a milje.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const base64Milje = await convertImageToBase64(milje);
|
||||||
|
await saveImage(base64Milje);
|
||||||
|
await displayImage(base64Milje);
|
||||||
|
})
|
Loading…
x
Reference in New Issue
Block a user