From 3930e06f2bff962370f4164b907f52c8d16a8622 Mon Sep 17 00:00:00 2001 From: buzz-lightsnack-2007 <73412182+buzz-lightsnack-2007@users.noreply.github.com> Date: Thu, 28 Mar 2024 11:18:22 +0800 Subject: [PATCH] import everything instead of being inside settings Pretty sure every key is important! --- scripts/fc.js | 94 ++++++++++++++++++++++++--------------------------- 1 file changed, 45 insertions(+), 49 deletions(-) diff --git a/scripts/fc.js b/scripts/fc.js index 7b505be..3e44f94 100644 --- a/scripts/fc.js +++ b/scripts/fc.js @@ -2,61 +2,57 @@ This does not stand for "FamiCom" but instead on Finalization and Completion. This script provides installation run scripts. */ -import {read, write, init} from './secretariat.js'; +import { read, write, init } from "./secretariat.js"; -let config = chrome.runtime.getURL('config/config.json'); +let config = chrome.runtime.getURL("config/config.json"); export default class fc { + /* Start the out of the box experience. */ + static hello() { + // the OOBE must be in the config. + fetch(config) + .then((response) => response.json()) + .then((jsonData) => { + let configuration = jsonData[`OOBE`]; - /* Start the out of the box experience. */ - static hello() { + if (configuration) { + configuration.forEach((item) => { + chrome.tabs.create({ url: item }, function (tab) {}); + }); + } + }) + .catch((error) => { + console.error(error); + }); + } - // the OOBE must be in the config. - fetch(config) - .then((response) => response.json()) - .then((jsonData) => { - let configuration = jsonData[`OOBE`]; + /* Initialize the configuration. */ + static setup() { + // the OOBE must be in the config. + fetch(config) + .then((response) => response.json()) + .then((jsonData) => { + let configuration = jsonData; - if (configuration) { - configuration.forEach((item) => { - chrome.tabs.create({ url: item }, function(tab) {}); - }); - }; - }) - .catch((error) => { - console.error(error); - }); - }; + // Run the storage initialization. + init(configuration); + }) + .catch((error) => { + console.error(error); + }); + } - /* Initialize the configuration. */ - static setup() { + static trigger() { + chrome.runtime.onInstalled.addListener(function (details) { + if (details.reason == chrome.runtime.OnInstalledReason.INSTALL) { + fc.hello(); + } + fc.setup(); + }); + } - // the OOBE must be in the config. - fetch(config) - .then((response) => response.json()) - .then((jsonData) => { - let configuration = jsonData[`settings`]; - - // Run the storage initialization. - init(configuration); - }) - .catch((error) => { - console.error(error); - }); - } - - static trigger() { - chrome.runtime.onInstalled.addListener(function (details) { - if (details.reason == chrome.runtime.OnInstalledReason.INSTALL) { - fc.hello(); - }; - fc.setup(); - }); - } - - /* main function */ - static run() { - - fc.trigger(); - } + /* main function */ + static run() { + fc.trigger(); + } }