diff --git a/templates/index.html b/templates/index.html
index bc9d1d4..92872c6 100644
--- a/templates/index.html
+++ b/templates/index.html
@@ -156,6 +156,14 @@
>
强制刷新
+
@@ -208,6 +216,7 @@
var cards = document.querySelectorAll(".service-card[data-url]");
var btnRefresh = document.getElementById("frame-refresh");
var btnForceRefresh = document.getElementById("frame-force-refresh");
+ var btnOpenTab = document.getElementById("frame-open-tab");
var btnBack = document.getElementById("frame-back-overview");
var btnBackHub = document.getElementById("frame-back-hub");
var btnHubLogin = document.getElementById("frame-hub-login");
@@ -626,6 +635,31 @@
};
}
+ function getCurrentFrameUrl() {
+ var u = "";
+ try {
+ if (
+ frame.contentWindow &&
+ frame.contentWindow.location &&
+ frame.contentWindow.location.href &&
+ frame.contentWindow.location.href !== "about:blank"
+ ) {
+ u = frame.contentWindow.location.href;
+ }
+ } catch (e) {}
+ if (!u || u === "about:blank") {
+ u = frame.src || currentOpenUrl || currentBaseUrl;
+ }
+ if (!u || u === "about:blank") return "";
+ return u;
+ }
+
+ function openInNewTab() {
+ var u = getCurrentFrameUrl();
+ if (!u) return;
+ window.open(u, "_blank", "noopener,noreferrer");
+ }
+
function showDashboard() {
currentBaseUrl = "";
currentOpenUrl = "";
@@ -723,6 +757,12 @@
forceReloadUrl();
});
+ if (btnOpenTab) {
+ btnOpenTab.addEventListener("click", function () {
+ openInNewTab();
+ });
+ }
+
btnBack.addEventListener("click", function () {
showDashboard();
});