aboutsummaryrefslogtreecommitdiffstats
path: root/src/client/Buttons.hx
diff options
context:
space:
mode:
authorRblSb <msrblsb@gmail.com>2020-05-23 20:31:40 +0300
committerRblSb <msrblsb@gmail.com>2020-05-23 21:15:02 +0300
commita45d0bef0dccb5472bec095d8e00af8647173a56 (patch)
tree356402681516062441c5a61cf9d0cf979ae63ee1 /src/client/Buttons.hx
parent306b5f4194ae40e80f3be00fcfea8614792649a5 (diff)
Restore mobile view
Diffstat (limited to 'src/client/Buttons.hx')
-rw-r--r--src/client/Buttons.hx17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/client/Buttons.hx b/src/client/Buttons.hx
index ffc7667..625a71f 100644
--- a/src/client/Buttons.hx
+++ b/src/client/Buttons.hx
@@ -111,9 +111,13 @@ class Buttons {
}
final fullscreenBtn = ge("#fullscreenbtn");
fullscreenBtn.onclick = e -> {
- final el = ge("#ytapiplayer");
- Utils.toggleFullScreen(el);
+ if (Utils.isTouch() && !Utils.hasFullscreen()) {
+ Utils.requestFullscreen(document.documentElement);
+ } else {
+ Utils.requestFullscreen(ge("#ytapiplayer"));
+ }
}
+ initPageFullscreen();
final getPlaylist = ge("#getplaylist");
getPlaylist.onclick = e -> {
final text = main.getPlaylistLinks().join(",");
@@ -316,4 +320,13 @@ class Buttons {
});
}
+ static function initPageFullscreen():Void {
+ document.onfullscreenchange = e -> {
+ final el = document.documentElement;
+ if (Utils.hasFullscreen()) {
+ if (e.target == el) el.classList.add("mobile-view");
+ } else el.classList.remove("mobile-view");
+ }
+ }
+
}
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage