This commit is contained in:
theo1 2020-09-30 09:14:04 +02:00
parent 5edb172617
commit 518e70ccb3
3 changed files with 13 additions and 8 deletions

View File

@ -5,10 +5,10 @@
<link href="style.css" rel="stylesheet" /> <link href="style.css" rel="stylesheet" />
</head> </head>
<body> <body>
<span id="artist"></span> - <span id="title"></span> <span id="toot-info"></span>
<br> <input type="textarea" name="Comment" id="toot-comment" placeholder="Your comment here" cols="20" autofocus><br>
<input type="text" name="Comment" id="toot-content" placeholder="Your comment here"> <input type="text" id="toot-hashtags"></span><br>
<button id="toot-button">Toot !</button><br> <button id="toot-button">Toot !</button><br><br>
<br> <br>
<script src="script.js"></script> <script src="script.js"></script>
</body> </body>

View File

@ -13,9 +13,9 @@ function tootInfo(message) {
}) })
} }
function handleResponse() { function handleResponse(message) {
document.getElementById("artist").innerText = message.artist document.getElementById("toot-info").innerHTML += message.artist + " - " + message.title
document.getElementById("title").innerText = message.title document.getElementById("toot-hashtags").value += "#radio #np #musique #music"
} }
function handleError(error) { function handleError(error) {
@ -31,6 +31,6 @@ function getCurrentInfo () {
} }
button = document.getElementById('toot-button') button = document.getElementById('toot-button')
browser.browserAction.onClicked.addListener(getCurrentInfo)
button.onclick = tootInfo button.onclick = tootInfo
document.addEventListener("click", getCurrentInfo)
browser.tabs.executeScript(null, { file: "/content_script.js" }); browser.tabs.executeScript(null, { file: "/content_script.js" });

View File

@ -0,0 +1,5 @@
#toot-content {
height: 100px;
max-width: 100px;
white-space: pre-wrap;
}