Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make HTML mobile friendly #35

Open
rchoz opened this issue Jan 7, 2022 · 2 comments
Open

Make HTML mobile friendly #35

rchoz opened this issue Jan 7, 2022 · 2 comments

Comments

@rchoz
Copy link

rchoz commented Jan 7, 2022

Would love to have a mobile friendly layout. Thanks!

@xiexuyuyan
Copy link

xiexuyuyan commented Nov 18, 2023

I wrote some clumsy code and hope it can be useful.

	<script>
		if (
			navigator.userAgent.match(/Mobi/i) ||
			navigator.userAgent.match(/Android/i) ||
			navigator.userAgent.match(/iPhone/i)
		) {
			console.log("HTML mobile friendly");
			const addMeta = (name, content) => {
				const meta = document.createElement('meta');
				meta.content = content;
				meta.name = name;
				document.getElementsByTagName('head')[0].appendChild(meta);
			};

			addMeta(
				'viewport',
				'width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no,viewport-fit=cover',
			);
		}


		var mWidth = 0;
		$('.app_header_icon').click(function () {
			console.log("hello");
			var zindex = document.getElementById("treeview").style.zIndex;

			if (zindex == 1) {
				mWidth = document.getElementById("list_container").style.width;
				document.getElementById("list_container").style.width = 100 + "%";
			} else {
				console.log("mWidth: " + mWidth);
				document.getElementById("list_container").style.width = mWidth;
			}

			var newzindex = zindex == 1 ? -1 : 1;
			var newLeft = zindex == 1 ? 0 : 205;
			document.getElementById("treeview").style.zIndex = newzindex;
			document.getElementsByClassName("vsplitbar")[0].style.zIndex = newzindex;
			document.getElementById("list_container").style.left = newLeft + "px";

			console.log("zindex: " + zindex);
			console.log("newzindex: " + newzindex);
			console.log("newLeft: " + newLeft);

		});
	</script>

@xiexuyuyan
Copy link

Would love to have a mobile friendly layout. Thanks!

I wrote some clumsy code, append to the end of the generated HTML file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants