aboutsummaryrefslogtreecommitdiffstats
path: root/src/client/MobileView.hx
blob: 52d06f9e0551be774f416bfd0b8329ac1c64a4ee (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package client;

import js.Browser.document;
import client.Main.ge;

class MobileView {

	public static function init():Void {
		final mvbtn = ge("#mv_btn");
		mvbtn.onclick = e -> {
			final hasMobileView = Utils.toggleFullScreen(document.documentElement);
			final vwrap = ge("#videowrap");
			if (hasMobileView) {
				document.body.classList.add("mobile-view");
				mvbtn.classList.add("active");
				if (vwrap.children[0].id == "currenttitle") {
					vwrap.appendChild(vwrap.children[0]);
				}
			} else {
				document.body.classList.remove("mobile-view");
				mvbtn.classList.remove("active");
				if (vwrap.children[0].id != "currenttitle") {
					vwrap.insertBefore(vwrap.children[1], vwrap.children[0]);
				}
			}
		}
	}

}
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage