From 81c5c6f825c9a659ed657ade19bd5c79c906750f Mon Sep 17 00:00:00 2001 From: buzz-lightsnack-2007 <73412182+buzz-lightsnack-2007@users.noreply.github.com> Date: Tue, 23 Apr 2024 17:46:57 +0800 Subject: [PATCH] open pop-ups with settings --- scripts/GUI/window.js | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 scripts/GUI/window.js diff --git a/scripts/GUI/window.js b/scripts/GUI/window.js new file mode 100644 index 0000000..949ebf9 --- /dev/null +++ b/scripts/GUI/window.js @@ -0,0 +1,28 @@ +/* different from windowman.js, just creates window management. */ + +export default class Window { + #features; + + constructor(url, name, options) { + this.url = url; + this.name = name; + + if ((typeof options).includes(`obj`)) { + this.options = options; + this.#features = ``; + + let FEATURES = Object.keys(options); + for (let i = 0; i < FEATURES.length; i++) { + this.#features = this.#features.concat(`${FEATURES[i]}=${options[FEATURES[i]]}`).concat((i == Object.keys(options).length - 1) ? `` : `,`); + } + } + + this.options = options; + + this.show(); + } + + show() { + this.window = window.open(this.url, this.name, this.options); + }; +}; \ No newline at end of file