aboutsummaryrefslogtreecommitdiffstats
path: root/static/scripts
diff options
context:
space:
mode:
authorLeonardo Bishop <me@leonardobishop.com>2023-08-05 21:11:48 +0100
committerLeonardo Bishop <me@leonardobishop.com>2023-08-05 21:11:48 +0100
commit18cc5f69129615850e48a995f7c3406b74d8d2f4 (patch)
tree1fdc6eadae4b0a6da69319f9b6733379ced2e4c2 /static/scripts
parent64c36dcef8ab1c0b985d79da627cecd30fd50336 (diff)
Redesign website
Diffstat (limited to 'static/scripts')
-rw-r--r--static/scripts/purge.js15
-rw-r--r--static/scripts/rebuild.js14
-rw-r--r--static/scripts/spotify.js12
3 files changed, 12 insertions, 29 deletions
diff --git a/static/scripts/purge.js b/static/scripts/purge.js
deleted file mode 100644
index 5ee34f0..0000000
--- a/static/scripts/purge.js
+++ /dev/null
@@ -1,15 +0,0 @@
-$(() => {
- $('#confirm').click(() => {
- let page = $('#confirm').data('page');
- $.ajax({
- type: 'GET',
- url: `/special/purge/${page}/confirm`,
- success: () => {
- $('#response').html('<div class=\'box\'>Successfully purged page.</div>');
- },
- error: () => {
- $('#response').html('<div class=\'box\'>Could not purge page. Try again later.</div>');
- }
- });
- });
-});
diff --git a/static/scripts/rebuild.js b/static/scripts/rebuild.js
deleted file mode 100644
index 8fd0e2e..0000000
--- a/static/scripts/rebuild.js
+++ /dev/null
@@ -1,14 +0,0 @@
-$(() => {
- $('#confirm').click(() => {
- $.ajax({
- type: 'GET',
- url: `/special/rebuild/confirm`,
- success: () => {
- $('#response').html('<div class=\'box\'>Successfully rebuilt page directory.</div>');
- },
- error: () => {
- $('#response').html('<div class=\'box\'>Could not rebuild page directory. Try again later.</div>');
- }
- });
- });
-});
diff --git a/static/scripts/spotify.js b/static/scripts/spotify.js
new file mode 100644
index 0000000..e6551a8
--- /dev/null
+++ b/static/scripts/spotify.js
@@ -0,0 +1,12 @@
+const connectWebsocket = () => {
+ document.getElementById('connection-status').innerHTML = "Connecting...";
+ let url = new URL(window.location.href);
+ url.protocol = url.protocol.replace('http', 'ws');
+ const socket = new WebSocket(url);
+ socket.onmessage = (event) => {
+ const data = JSON.parse(event.data);
+ console.log(data);
+ }
+}
+
+document.addEventListener("DOMContentLoaded", connectWebsocket);