www.lurk.org

LURK www landing page
git clone https://git.lurk.org/repos/www.lurk.org.git
Log | Files | Refs

commit 95adf869b02210a6ce2720d3edbbbd8adfa0d64b
parent fc5aca804420db15ed2c5e736260f42e102a1324
Author: ugrnm <ultrageranium@bleu255.com>
Date:   Fri Apr  3 22:43:56 +0200

audio player poc
Diffstat:
muc/player.js | 24+++++++++++++++++++++++-
1 file changed, 23 insertions(+), 1 deletion(-)
diff --git a/muc/player.js b/muc/player.js
@@ -1,3 +1,25 @@
 (function(){
-  alert("Hi this is a test, ignore, sorry :)")
+
+  function waitForIt(selector, time) {
+    if(document.querySelector(selector)!=null) {
+
+      var chat_title = document.getElementsByClassName("chatbox-title__text")[0];
+      var element = document.createElement("span");
+
+      element.innerHTML = '<audio id="player" preload="none" src="https://echo.lurk.org:999/echochamber"></audio><div><button onclick="document.getElementById(\'player\').play()">Play</button><button onclick="document.getElementById(\'player\').pause()">Pause</button><button onclick="document.getElementById(\'player\').volume += 0.1">Vol +</button><button onclick="document.getElementById(\'player\').volume -= 0.1">Vol -</button></div>';
+
+      chat_title.insertAdjacentElement('afterend', element);
+
+      return;
+    }
+    else {
+      setTimeout(function() {
+
+        waitForIt(selector, time);
+
+      }, time);
+    }
+  }
+
+  waitForIt(".chat-head__desc", 1000);
 })();