aboutsummaryrefslogtreecommitdiffstats
path: root/src/client/Buttons.hx
diff options
context:
space:
mode:
authorRblSb <msrblsb@gmail.com>2020-03-04 04:08:22 +0300
committerRblSb <msrblsb@gmail.com>2020-03-04 04:08:22 +0300
commit4155b95cce55e1176aecb1531b9c06344a2e81b5 (patch)
tree102a7693adebde04b9c5a6529753038c8f27c510 /src/client/Buttons.hx
parentdc83e4842f7bb6f8899872c9693ea6170f0b1724 (diff)
Improve iframe handling
Diffstat (limited to 'src/client/Buttons.hx')
-rw-r--r--src/client/Buttons.hx27
1 files changed, 16 insertions, 11 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();
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage