adding Firefox extension containing browser action to toot stuff

This commit is contained in:
theo1 2020-09-29 16:22:09 +02:00
parent 8e8e75d7d5
commit da88659dd5
9 changed files with 78 additions and 0 deletions

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

View 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

View File

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

View 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"
}
}

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

View File

@ -0,0 +1 @@
document.getElementById('myHeading').style.color = 'red'

View File

@ -0,0 +1,3 @@
h1 {
font-style: italic;
}