list.iid.ciirc.cvut.cz
Sign In
Sign Up
Manage this list
Sign In
Sign Up
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
Coffee
Thread
Start a new thread
Download
Threads by
month
----- 2025 -----
May
April
March
February
January
----- 2024 -----
December
November
October
September
August
July
June
May
April
March
February
January
----- 2023 -----
December
November
October
September
August
July
June
May
April
March
February
January
----- 2022 -----
December
November
October
September
August
July
June
May
April
March
February
January
----- 2021 -----
December
November
October
September
August
July
June
May
April
March
February
January
----- 2020 -----
December
November
October
September
August
July
June
May
April
March
February
January
----- 2019 -----
December
November
October
September
August
July
June
May
April
March
February
January
----- 2018 -----
December
November
October
September
coffee@rtime.felk.cvut.cz
February 2019
3 participants
11 discussions
[PATCH] Add last coffee pack button
by Jiri Vlasak
06 Feb '19
06 Feb '19
When clicked, the message notifying Tonda about the lack of coffee is sent to the Slack. --- templates/hello.html | 1 + templates/main.js | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/templates/hello.html b/templates/hello.html index 0e709ce..e8f985d 100644 --- a/templates/hello.html +++ b/templates/hello.html @@ -1,5 +1,6 @@ <center> <div id="user"></div> +<p id="pLastCovfefe"><input type="button" value="The last covfefe pack opened!" onclick="tellCoffeebot('Yay, <@U539N17JL|Tonda>, buy me a new covfefe pack! Thanks!')" /></p> <p>Hack me: <tt>
https://rtime.felk.cvut.cz/gitweb/coffee/main.git
</tt></p> <p>Debug: <span id="log"></span></p> </center> diff --git a/templates/main.js b/templates/main.js index 8135983..3d42820 100644 --- a/templates/main.js +++ b/templates/main.js @@ -205,3 +205,21 @@ function addCoffee(flavor, time = new Date()) { function sendLog(json) { ajax("POST", "log", json, "log"); } + +function tellCoffeebot(what) +{ + var xhr = new XMLHttpRequest(); + xhr.onreadystatechange = function() { + if (this.readyState == 4) { + if (this.status == 200) { + document.getElementById("pLastCovfefe").innerHTML = "Don't worry now! There is a NEW HOPE Tonda is buying NEW PACK!"; + } else { + document.getElementById("pLastCovfefe").innerHTML = "No connection! No covfefe! We all die here!"; + } + } + }; + xhr.open("POST", "
https://hooks.slack.com/services/T53CK6RB3/BC7J3TE94/dDlbPHNVaPILB8LyLHRjAA…
", true); + xhr.setRequestHeader("Content-type", "application/json"); + xhr.send(JSON.stringify({text: what})); + console.log(JSON.stringify({text: what})); +} -- 2.11.0
2
1
0
0
← Newer
1
2
Older →
Jump to page:
1
2
Results per page:
10
25
50
100
200