set the window type as popup

This commit is contained in:
buzz-lightsnack-2007 2024-04-28 21:13:51 +08:00
parent 8627a572a4
commit 910cd1f16f
2 changed files with 6 additions and 10 deletions

View file

@ -195,24 +195,21 @@ export default class windowman {
let target = {};
target[`source`] = button.getAttribute(`href`);
target[`dimensions`] = {};
target[`dimensions`][`height`] = (button.getAttribute(`tab-height`)) ? button.getAttribute(`tab-height`)
target[`dimensions`][`height`] = (button.getAttribute(`tab-height`)) ? parseInt(button.getAttribute(`tab-height`))
: null;
target[`dimensions`][`width`] = (button.getAttribute(`tab-width`)) ? button.getAttribute(`tab-width`)
target[`dimensions`][`width`] = (button.getAttribute(`tab-width`)) ? parseInt(button.getAttribute(`tab-width`))
: null;
const event = function () {
// Get the correct path.
target[`path`] = (
!target[`source`].includes(`://`)
? window.location.pathname
.split(`/`)
.slice(0, -1)
.join(`/`)
.concat(`/`)
? window.location.pathname.split(`/`).slice(0, -1).join(`/`).concat(`/`)
: ``
).concat(target[`source`]);
new Window(target[`path`], null, target[`dimensions`]);
// Open the window as a popup.
new Window(target[`path`], Object.assign(target[`dimensions`], {"type": "popup"}));
};
button.addEventListener("click", event);

View file

@ -1,9 +1,8 @@
import Window from "/scripts/GUI/window.js";
import BrowserIcon from '/scripts/GUI/extensionIcon.js';
export default class ManagedWindow {
constructor () {
this.instance = new Window("/pages/popup.htm", null, {"width": "120", "height": "200", "hidden": true});
this.instance = new Window("/pages/popup.htm", {"width": "120", "height": "200", "type": "popup", "hidden": true});
}
/*