From cd857d783514d930aedb34435eaff8089f1c4170 Mon Sep 17 00:00:00 2001 From: Arthur Lu Date: Tue, 14 Feb 2023 05:36:21 +0000 Subject: [PATCH] open console in new window --- scripts/elements.js | 2 +- scripts/utils.js | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/scripts/elements.js b/scripts/elements.js index e49dd4f..c05b582 100644 --- a/scripts/elements.js +++ b/scripts/elements.js @@ -131,7 +131,7 @@ export class Instance extends HTMLElement { handleConsoleButton () { if (this.status === "running") { - goToPage("pve-xtermjs/index.html", {type: this.type, vmid: this.vmid, name: this.name, node: this.node.name, user: getCookie("username"), url: "pve.tronnet.net/api2/json"}); + goToPage("pve-xtermjs/index.html", {type: this.type, vmid: this.vmid, name: this.name, node: this.node.name, user: getCookie("username"), url: "pve.tronnet.net/api2/json"}, true); } } } diff --git a/scripts/utils.js b/scripts/utils.js index 53d27ba..95d84e6 100644 --- a/scripts/utils.js +++ b/scripts/utils.js @@ -148,12 +148,18 @@ async function request (url, content) { return data; } -export function goToPage (page, data={}) { +export function goToPage (page, data={}, newwindow = false) { let url = new URL(`https://client.tronnet.net/${page}`); for(let k in data) { url.searchParams.append(k, data[k]); } - window.location.assign(url.toString()); + + if (newwindow) { + window.open(url, "tronnet - client", "height=480,width=848"); + } + else { + window.location.assign(url.toString()); + } } export function getURIData () {