Skip to content

Commit

Permalink
Add debug functions to the options page and fix linter warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
neobooru committed Oct 3, 2023
1 parent ab6b018 commit 335bc6e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/dynamicStyle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,12 @@ export function refreshTagCategoryColorMap(tagCategories: TagCategoryColor[], st
document.head.appendChild(styleElement);
for (const category of tagCategories) {
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;
}
5 changes: 5 additions & 0 deletions src/options/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,11 @@ function resetTagCategories() {
function addTagCategory() {
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>

<template>
Expand Down

0 comments on commit 335bc6e

Please sign in to comment.