20 lines
551 B
JavaScript
20 lines
551 B
JavaScript
|
|
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 |