adding Firefox extension containing browser action to toot stuff
This commit is contained in:
parent
8e8e75d7d5
commit
da88659dd5
14
deezer-tooter/browserAction/index.html
Normal file
14
deezer-tooter/browserAction/index.html
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<link href="style.css" rel="stylesheet" />
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<input type="text" name="Content" id="toot-content">
|
||||||
|
<button id="toot-button">Toot !</button><br>
|
||||||
|
<br>
|
||||||
|
<span id='track-link'>Gemini</span>
|
||||||
|
<script src="script.js"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
20
deezer-tooter/browserAction/script.js
Normal file
20
deezer-tooter/browserAction/script.js
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
|
||||||
|
function tootButtonHandler() {
|
||||||
|
// TODO : add content script to get the pages' HTML elements
|
||||||
|
tootContent = "Now playing awesome stuff !"
|
||||||
|
url = "http://localhost:5000/toot?content="
|
||||||
|
console.log(tootContent)
|
||||||
|
fetch(url)
|
||||||
|
.then(function (response) {
|
||||||
|
return response;
|
||||||
|
})
|
||||||
|
.then(function (response) {
|
||||||
|
console.log("Got response : " + response);
|
||||||
|
})
|
||||||
|
.catch(function (error) {
|
||||||
|
console.log("Error while tooting: " + error);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
button = document.getElementById('toot-button')
|
||||||
|
button.onclick = tootButtonHandler
|
0
deezer-tooter/browserAction/style.css
Normal file
0
deezer-tooter/browserAction/style.css
Normal file
0
deezer-tooter/content_script.js
Normal file
0
deezer-tooter/content_script.js
Normal file
BIN
deezer-tooter/icons/icon.png
Normal file
BIN
deezer-tooter/icons/icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.0 KiB |
29
deezer-tooter/manifest.json
Normal file
29
deezer-tooter/manifest.json
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
{
|
||||||
|
"manifest_version": 2,
|
||||||
|
"name": "Deezer Tooter",
|
||||||
|
"description": "Toots currently playing track from Deezer",
|
||||||
|
"version": "0.1",
|
||||||
|
"icons": {
|
||||||
|
"64": "icons/icon.png"
|
||||||
|
},
|
||||||
|
"content_scripts": [
|
||||||
|
{
|
||||||
|
"matches": [
|
||||||
|
"*://*.mozilla.org/*"
|
||||||
|
],
|
||||||
|
"js": [
|
||||||
|
"content_script.js"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"browser_action": {
|
||||||
|
"default_icon": {
|
||||||
|
"64": "icons/icon.png"
|
||||||
|
},
|
||||||
|
"default_popup": "browserAction/index.html",
|
||||||
|
"default_title": "Deezer Tooter"
|
||||||
|
},
|
||||||
|
"options_ui": {
|
||||||
|
"page": "options/index.html"
|
||||||
|
}
|
||||||
|
}
|
11
deezer-tooter/options/index.html
Normal file
11
deezer-tooter/options/index.html
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<link href="style.css" rel="stylesheet" />
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1 id="myHeading">My content</h1>
|
||||||
|
<script src="script.js"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
1
deezer-tooter/options/script.js
Normal file
1
deezer-tooter/options/script.js
Normal file
@ -0,0 +1 @@
|
|||||||
|
document.getElementById('myHeading').style.color = 'red'
|
3
deezer-tooter/options/style.css
Normal file
3
deezer-tooter/options/style.css
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
h1 {
|
||||||
|
font-style: italic;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user