aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/client/Buttons.hx27
-rw-r--r--src/client/Main.hx4
-rw-r--r--src/client/Player.hx2
-rw-r--r--src/client/players/Iframe.hx3
4 files changed, 24 insertions, 12 deletions
diff --git a/src/client/Buttons.hx b/src/client/Buttons.hx
index dec8f04..318ba9a 100644
--- a/src/client/Buttons.hx
+++ b/src/client/Buttons.hx
@@ -132,23 +132,28 @@ class Buttons {
}
final showMediaUrl = ge("#showmediaurl");
- showMediaUrl.onclick = e -> {
- showMediaUrl.classList.toggle("collapsed");
- showMediaUrl.classList.toggle("active");
- ge("#addfromurl").classList.toggle("collapse");
- }
+ showMediaUrl.onclick = e -> showPlayerGroup(showMediaUrl);
final showCustomEmbed = ge("#showcustomembed");
- showCustomEmbed.onclick = e -> {
- showCustomEmbed.classList.toggle("collapsed");
- showCustomEmbed.classList.toggle("active");
- ge("#customembed").classList.toggle("collapse");
- }
+ showCustomEmbed.onclick = e -> showPlayerGroup(showCustomEmbed);
window.onresize = onVideoResize;
initSplit();
}
+ static function showPlayerGroup(el:Element):Void {
+ final groups:Array<Element> = cast document.querySelectorAll('[data-target]');
+ for (group in groups) {
+ if (el == group) continue;
+ group.classList.add("collapsed");
+ group.classList.remove("active");
+ ge(group.dataset.target).classList.add("collapse");
+ }
+ el.classList.toggle("collapsed");
+ el.classList.toggle("active");
+ ge(el.dataset.target).classList.toggle("collapse");
+ }
+
static function initSplit(swapped = false):Void {
if (split != null) split.destroy();
final divs = ["#chatwrap", "#videowrap"];
@@ -245,7 +250,7 @@ class Buttons {
final removeBtn = ge("#removeVideoBtn");
removeBtn.onclick = e -> {
final has = main.toggleVideoElement();
- if (has) removeBtn.innerText = Lang.get("removeVideo");
+ if (has || main.isListEmpty()) removeBtn.innerText = Lang.get("removeVideo");
else removeBtn.innerText = Lang.get("addVideo");
removeBtn.blur();
hideMenus();
diff --git a/src/client/Main.hx b/src/client/Main.hx
index f32a80c..a5fe9bb 100644
--- a/src/client/Main.hx
+++ b/src/client/Main.hx
@@ -230,6 +230,10 @@ class Main {
return player.hasVideo();
}
+ public function isListEmpty():Bool {
+ return player.isListEmpty();
+ }
+
public function refreshPlayer():Void {
player.refresh();
}
diff --git a/src/client/Player.hx b/src/client/Player.hx
index 7088580..4f1ecf6 100644
--- a/src/client/Player.hx
+++ b/src/client/Player.hx
@@ -293,7 +293,7 @@ class Player {
}
public function hasVideo():Bool {
- return player != null;
+ return playerEl.children.length != 0;
}
public function play():Void {
diff --git a/src/client/players/Iframe.hx b/src/client/players/Iframe.hx
index 37d2fe6..f0a04c5 100644
--- a/src/client/players/Iframe.hx
+++ b/src/client/players/Iframe.hx
@@ -37,6 +37,9 @@ class Iframe implements IPlayer {
video = null;
return;
}
+ if (video.firstChild.nodeName == "IFRAME") {
+ video.setAttribute("sandbox", "allow-scripts");
+ }
playerEl.appendChild(video);
}
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage