aboutsummaryrefslogtreecommitdiffstats
path: root/src/client/Main.hx
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/Main.hx')
-rw-r--r--src/client/Main.hx40
1 files changed, 38 insertions, 2 deletions
diff --git a/src/client/Main.hx b/src/client/Main.hx
index 9d9b90d..f32a80c 100644
--- a/src/client/Main.hx
+++ b/src/client/Main.hx
@@ -113,9 +113,20 @@ class Main {
ge("#queue_next").onclick = e -> addVideoUrl(false);
ge("#queue_end").onclick = e -> addVideoUrl(true);
- ge("#mediaurl").onkeydown = function(e:KeyboardEvent) {
+ ge("#mediaurl").onkeydown = (e:KeyboardEvent) -> {
if (e.keyCode == 13) addVideoUrl(true);
}
+
+ ge("#ce_queue_next").onclick = e -> addIframe(false);
+ ge("#ce_queue_end").onclick = e -> addIframe(true);
+ ge("#customembed-title").onkeydown = (e:KeyboardEvent) -> {
+ if (e.keyCode == 13) {
+ addIframe(true);
+ e.preventDefault();
+ }
+ }
+ ge("#customembed-content").onkeydown =
+ ge("#customembed-title").onkeydown;
}
public inline function isUser():Bool {
@@ -178,7 +189,8 @@ class Main {
title: data.title,
author: personal.name,
duration: data.duration,
- isTemp: isTemp
+ isTemp: isTemp,
+ isIframe: false
},
atEnd: atEnd
}});
@@ -186,6 +198,30 @@ class Main {
});
}
+ function addIframe(atEnd:Bool):Void {
+ final iframeCode:InputElement = cast ge("#customembed-content");
+ final iframe = iframeCode.value;
+ if (iframe.length == 0) return;
+ iframeCode.value = "";
+ final mediaName:InputElement = cast ge("#customembed-title");
+ final name = mediaName.value.length == 0 ? "Custom Media" : mediaName.value;
+ mediaName.value = "";
+ final checkbox:InputElement = cast ge("#customembed").querySelector(".add-temp");
+ final isTemp = checkbox.checked;
+ send({
+ type: AddVideo, addVideo: {
+ item: {
+ url: iframe,
+ title: name,
+ author: personal.name,
+ duration: 99 * 60 * 60,
+ isTemp: isTemp,
+ isIframe: true
+ },
+ atEnd: atEnd
+ }});
+ }
+
public function toggleVideoElement():Bool {
if (player.hasVideo()) player.removeVideo();
else if (!player.isListEmpty()) {
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage