Add debug functions to the options page and fix linter warnings

pull/55/head
neobooru 2023-10-04 00:27:07 +02:00
parent ab6b0186ee
commit 335bc6ee2c
2 changed files with 11 additions and 2 deletions

View File

@ -12,8 +12,12 @@ export function refreshTagCategoryColorMap(tagCategories: TagCategoryColor[], st
document.head.appendChild(styleElement); document.head.appendChild(styleElement);
for (const category of tagCategories) { for (const category of tagCategories) {
const ruleName = makeCssName("tag", category.name); const ruleName = makeCssName("tag", category.name);
styleElement.sheet!.insertRule(`.${ruleName} { color: ${category.color} }`, styleElement.sheet!.cssRules.length);
console.log("adding " + category); if (styleElement.sheet) {
styleElement.sheet.insertRule(`.${ruleName} { color: ${category.color} }`, styleElement.sheet.cssRules.length);
} else {
console.error("styleElement.sheet is undefined. This should never happen!");
}
} }
return styleElement; return styleElement;
} }

View File

@ -86,6 +86,11 @@ function resetTagCategories() {
function addTagCategory() { function addTagCategory() {
cfg.value.tagCategories.push(new TagCategoryColor("category", "#abcdef")); cfg.value.tagCategories.push(new TagCategoryColor("category", "#abcdef"));
} }
// For debugging
const wnd = window as any;
wnd.szc_get_config = () => JSON.parse(JSON.stringify(cfg.value));
wnd.szc_set_config_version = (v = 0) => (cfg.value.version = v);
</script> </script>
<template> <template>