Smaller ui adjustments

This commit is contained in:
Masu-Baumgartner
2024-10-29 16:13:53 +01:00
parent 324bf6891a
commit 6d0c75ceff
3 changed files with 28 additions and 20 deletions

View File

@@ -1,11 +1,24 @@
window.moonlight = {
window: {
open: function (url, title, w, h) {
let height = w;
let width = h;
var left = (screen.width - width) / 2;
var top = (screen.height - height) / 2;
var newWindow = window.open(url, title, 'resizable = yes, width=' + width + ', height=' + height + ', top=' + top + ', left=' + left);
open: function (url, title, h, w) {
const dualScreenLeft = window.screenLeft !== undefined ? window.screenLeft : window.screenX;
const dualScreenTop = window.screenTop !== undefined ? window.screenTop : window.screenY;
const width = window.innerWidth ? window.innerWidth : document.documentElement.clientWidth ? document.documentElement.clientWidth : screen.width;
const height = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document.documentElement.clientHeight : screen.height;
const systemZoom = width / window.screen.availWidth;
const left = (width - w) / 2 / systemZoom + dualScreenLeft
const top = (height - h) / 2 / systemZoom + dualScreenTop
const newWindow = window.open(url, title,
`
scrollbars=yes,
width=${w / systemZoom},
height=${h / systemZoom},
top=${top},
left=${left}
`
)
if (window.focus) newWindow.focus();
},