We're cooked. <skull emoji> - Added options page for YAML palette editing, live color preview, and diagnostics. - Implemented theme engine to parse Gogh YAML palettes and derive semantic themes. - Configured TypeScript and Vite for building the extension. - Created new tab and popup HTML pages with corresponding scripts and styles. - Established storage management for user configurations in Chrome storage. - Added icons for the extension and updated manifest for MV3 compatibility.
22 lines
819 B
JavaScript
22 lines
819 B
JavaScript
import { getStorage,setStorage } from "../../common/storage";
|
|
import { PRESET_CONFIGURATION, CHROME_SYNC_STORAGE_KEY } from "../../common/settings";
|
|
|
|
function saveConfiguration() {
|
|
const updatedConfiguration = {
|
|
storageValue: document.getElementById("storageValue").value
|
|
};
|
|
setStorage(CHROME_SYNC_STORAGE_KEY, updatedConfiguration);
|
|
}
|
|
|
|
function loadConfiguration(result) {
|
|
const savedConfiguration = result || PRESET_CONFIGURATION;
|
|
const storageValue = savedConfiguration["storageValue"];
|
|
document.getElementById("storageValue").value = storageValue;
|
|
}
|
|
|
|
window.onload = function() {
|
|
console.info("Options script loaded");
|
|
document.getElementById("SaveConfiguration").addEventListener("click", saveConfiguration);
|
|
getStorage(CHROME_SYNC_STORAGE_KEY, loadConfiguration);
|
|
};
|