summaryrefslogtreecommitdiff
path: root/src/2b2w/index.html
diff options
context:
space:
mode:
author8cy <[email protected]>2020-04-19 06:40:16 -0700
committer8cy <[email protected]>2020-04-19 06:40:16 -0700
commited6e347bbcce356bde0cfeba498dab3d39a6c946 (patch)
tree419225e81e9a3967ccf6f385a6e1c9c204d0b19c /src/2b2w/index.html
parentlink favi, v7.2.4 (diff)
downloaddep-core-test-2b2t.tar.xz
dep-core-test-2b2t.zip
fix on a rainy day, added most of the supporttest-2b2t
issue, TypeError: Cannot read property 'end' of undefined when trying to stop
Diffstat (limited to 'src/2b2w/index.html')
-rw-r--r--src/2b2w/index.html75
1 files changed, 75 insertions, 0 deletions
diff --git a/src/2b2w/index.html b/src/2b2w/index.html
new file mode 100644
index 0000000..f2efe0b
--- /dev/null
+++ b/src/2b2w/index.html
@@ -0,0 +1,75 @@
+<html>
+ <head>
+ <title>2Bored2Wait</title>
+ <link rel="stylesheet" href="index.css">
+ </head>
+ <body>
+ <div class="content">
+ <h1>Place in queue: <div class="place">None</div> </h1>
+ <h1>ETA: <div class="ETA">None</div> </h1>
+ Password (leave blank if none) : <input type="password" class="password"><br>
+ <button id="queueButton" class="start" onclick="start()">Start queuing</button><br><br>
+ <input type="checkbox" class="restartQueue" onchange="toggleRestartQueue()"> Restart the queue if you're not connected at the end of it?
+ </div>
+ <script>
+ setInterval(() => { //each second, update the info.
+ const xhr = new XMLHttpRequest();
+ xhr.open("GET", "/update", true);
+ xhr.onreadystatechange = function() {
+ if (this.readyState == 4 && this.status == 200) {
+ const response = JSON.parse(this.responseText);
+ document.getElementsByClassName("place")[0].innerHTML = response.place;
+ document.getElementsByClassName("ETA")[0].innerHTML = response.ETA;
+ document.getElementsByClassName("restartQueue")[0].checked = response.restartQueue
+ const queueButton = document.getElementById('queueButton');
+ if(response.inQueue){
+ queueButton.innerHTML = "Stop queuing";
+ queueButton.setAttribute('onclick', 'stop()');
+ queueButton.className = 'stop';
+ }else{
+ queueButton.innerHTML = "Start queuing";
+ queueButton.setAttribute('onclick', 'start()');
+ queueButton.className = 'start';
+ }
+ }
+ }
+ xhr.setRequestHeader('XPassword', document.getElementsByClassName('password')[0].value)
+ xhr.send();
+
+ }, 1000);
+
+ function start() {
+ const xhr = new XMLHttpRequest();
+ xhr.open("GET", "/start", true);
+ xhr.setRequestHeader('XPassword', document.getElementsByClassName('password')[0].value)
+ xhr.send();
+ const queueButton = document.getElementById('queueButton');
+ queueButton.innerHTML = "Stop queuing";
+ queueButton.setAttribute('onclick', 'stop()');
+ queueButton.setAttribute('onclick', 'stop()');
+ queueButton.className = 'stop';
+ }
+
+ function stop() {
+ const xhr = new XMLHttpRequest();
+ xhr.open("GET", "/stop", true);
+ xhr.setRequestHeader('XPassword', document.getElementsByClassName('password')[0].value)
+ xhr.send();
+ const queueButton = document.getElementById('queueButton');
+ queueButton.innerHTML = "Start queuing";
+ queueButton.setAttribute('onclick', 'start()');
+ queueButton.className = 'start';
+ document.getElementsByClassName("place")[0].innerHTML = 'None';
+ document.getElementsByClassName("ETA")[0].innerHTML = 'None';
+ }
+
+ function toggleRestartQueue(){
+ const xhr = new XMLHttpRequest();
+ xhr.open("GET", "/togglerestart", true);
+ xhr.setRequestHeader('XPassword', document.getElementsByClassName('password')[0].value)
+ xhr.send();
+ }
+
+ </script>
+ </body>
+</html>