improve the opening of settings
This commit is contained in:
parent
62d6a85d36
commit
6b286eafb9
4 changed files with 23 additions and 11 deletions
|
@ -1,5 +1,5 @@
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<script src="../../scripts/pages/open/popup.js" type="module"></script>
|
<script src="/scripts/pages/open.js" type="module"></script>
|
||||||
</head>
|
</head>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<script
|
<script src="/scripts/pages/open.js" type="module"></script>
|
||||||
src="../../scripts/pages/open/settings.js"
|
|
||||||
type="module"
|
|
||||||
></script>
|
|
||||||
</head>
|
</head>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -9,12 +9,7 @@ let DEBUG = true;
|
||||||
|
|
||||||
export default class windowman {
|
export default class windowman {
|
||||||
static new(URL, height, width) {
|
static new(URL, height, width) {
|
||||||
this.window = chrome.windows.create({
|
this.window = chrome.windows.create({url: (URL.includes(`://`)) ? URL : chrome.runtime.getURL(URL), type: "popup", width: width ? parseInt(width) : 600, height: height ? parseInt(height) : 600});
|
||||||
url: chrome.runtime.getURL(URL),
|
|
||||||
type: "popup",
|
|
||||||
width: width ? parseInt(width) : 600,
|
|
||||||
height: height ? parseInt(height) : 600,
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prepare the window with its metadata.
|
// Prepare the window with its metadata.
|
||||||
|
|
20
scripts/pages/open.js
Normal file
20
scripts/pages/open.js
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
// Open the settings in a pop-up window.
|
||||||
|
|
||||||
|
import windowman from "/scripts/GUI/windowman.JS";
|
||||||
|
|
||||||
|
function redirect() {
|
||||||
|
let location = {};
|
||||||
|
location[`original`] = window.location.href;
|
||||||
|
location[`page`] = [...location[`original`].split(`/`)].pop();
|
||||||
|
location[`target`] = chrome.runtime.getURL("pages/".concat(location[`page`]));
|
||||||
|
|
||||||
|
windowman.new(location[`target`]);
|
||||||
|
|
||||||
|
window.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
function main() {
|
||||||
|
redirect();
|
||||||
|
}
|
||||||
|
|
||||||
|
main();
|
Loading…
Add table
Add a link
Reference in a new issue