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" />
</head>
<body>
<span id="artist"></span> - <span id="title"></span>
<br>
<input type="text" name="Comment" id="toot-content" placeholder="Your comment here">
<button id="toot-button">Toot !</button><br>
<span id="toot-info"></span>
<input type="textarea" name="Comment" id="toot-comment" placeholder="Your comment here" cols="20" autofocus><br>
<input type="text" id="toot-hashtags"></span><br>
<button id="toot-button">Toot !</button><br><br>
<br>
<script src="script.js"></script>
</body>

View File

@ -13,9 +13,9 @@ function tootInfo(message) {
})
}
function handleResponse() {
document.getElementById("artist").innerText = message.artist
document.getElementById("title").innerText = message.title
function handleResponse(message) {
document.getElementById("toot-info").innerHTML += message.artist + " - " + message.title
document.getElementById("toot-hashtags").value += "#radio #np #musique #music"
}
function handleError(error) {
@ -31,6 +31,6 @@ function getCurrentInfo () {
}
button = document.getElementById('toot-button')
browser.browserAction.onClicked.addListener(getCurrentInfo)
button.onclick = tootInfo
document.addEventListener("click", getCurrentInfo)
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;
}