mirror of
https://github.com/zumbiepig/MineXLauncher.git
synced 2025-06-08 09:24:48 +00:00
no about blank
This commit is contained in:
parent
5a433cca62
commit
9cb8cade57
@ -110,11 +110,12 @@ const game = {
|
||||
if (!window.gameWindow || window.gameWindow.closed) {
|
||||
const noPopup = storage.local.get('noPopup');
|
||||
window.gameWindow = window.open(
|
||||
'about:blank',
|
||||
noPopup ? version : 'about:blank',
|
||||
'_blank',
|
||||
`popup=${noPopup ? 'false' : 'true'}`,
|
||||
);
|
||||
if (window.gameWindow) {
|
||||
if (!noPopup) {
|
||||
window.gameWindow.document.title = 'MineXLauncher';
|
||||
const icon = window.gameWindow.document.createElement('link');
|
||||
icon.rel = 'icon';
|
||||
@ -131,7 +132,16 @@ const game = {
|
||||
iframe.style.border = 'none';
|
||||
window.gameWindow.document.body.append(iframe);
|
||||
|
||||
if (iframe.contentWindow) {
|
||||
['keydown', 'keyup'].forEach((eventType) =>
|
||||
window.gameWindow?.addEventListener(eventType, (event) =>
|
||||
iframe.contentWindow?.dispatchEvent(
|
||||
new KeyboardEvent(eventType, event),
|
||||
),
|
||||
),
|
||||
);
|
||||
window.gameWindowIframe = iframe.contentWindow;
|
||||
} else window.gameWindowIframe = window.gameWindow;
|
||||
if (window.gameWindowIframe) {
|
||||
(
|
||||
['debug', 'log', 'info', 'warn', 'error'] as (
|
||||
| 'debug'
|
||||
@ -141,25 +151,14 @@ const game = {
|
||||
| 'error'
|
||||
)[]
|
||||
).forEach((type) => {
|
||||
if (iframe.contentWindow)
|
||||
iframe.contentWindow.console[type] = (msg: string) =>
|
||||
if (window.gameWindowIframe)
|
||||
window.gameWindowIframe.console[type] = (msg: string) =>
|
||||
consoleLog(type, msg);
|
||||
});
|
||||
|
||||
['keydown', 'keyup'].forEach((eventType) =>
|
||||
window.gameWindow?.addEventListener(eventType, (event) =>
|
||||
iframe.contentWindow?.dispatchEvent(
|
||||
new KeyboardEvent(eventType, event),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
}
|
||||
window.gameWindow.focus();
|
||||
window.gameWindow.document.documentElement.requestFullscreen();
|
||||
}
|
||||
|
||||
window.gameWindowIframe = iframe.contentWindow;
|
||||
}
|
||||
} else {
|
||||
window.gameWindow.focus();
|
||||
const console = document.querySelector(
|
||||
|
Loading…
x
Reference in New Issue
Block a user