1
0
mirror of https://github.com/koloml/furbooru-tagging-assistant.git synced 2026-03-24 23:02:58 +00:00

Added presets and tag editor handling to the image upload page

This commit is contained in:
2026-03-12 00:57:23 +04:00
parent bda707b5ac
commit 2a2a488592
5 changed files with 47 additions and 17 deletions

View File

@@ -50,11 +50,16 @@
"matches": [
"*://*.furbooru.org/images/*"
],
"exclude_matches": [
"*://*.furbooru.org/images/new",
"*://*.furbooru.org/images/new?*"
],
"js": [
"src/content/tags-editor.ts"
],
"css": [
"src/styles/content/tags-editor.scss"
"src/styles/content/tags-editor.scss",
"src/styles/content/tag-presets.scss"
]
},
{
@@ -87,6 +92,17 @@
"css": [
"src/styles/content/posts.scss"
]
},
{
"matches": [
"*://*.furbooru.org/images/new"
],
"js": [
"src/content/upload.ts"
],
"css": [
"src/styles/content/tag-presets.scss"
]
}
],
"action": {

View File

@@ -24,7 +24,7 @@ export class TagsForm extends BaseComponent {
this.#togglePresetsButton.textContent = 'Presets';
this.container
.querySelector('.fancy-tag-edit ~ button:last-of-type')
.querySelector(':is(.fancy-tag-edit, .fancy-tag-upload) ~ button:last-of-type')
?.after(this.#togglePresetsButton, this.#presetsList.container);
this.#plainEditorTextarea = this.container.querySelector('textarea.tagsinput');
@@ -243,4 +243,14 @@ export class TagsForm extends BaseComponent {
(tagEditor as TagsForm).refreshTagColors();
});
}
static initializeUploadEditor() {
const uploadEditorContainer = document.querySelector<HTMLElement>('.field:has(.fancy-tag-upload)');
if (!uploadEditorContainer) {
return;
}
new TagsForm(uploadEditorContainer).initialize();
}
}

3
src/content/upload.ts Normal file
View File

@@ -0,0 +1,3 @@
import { TagsForm } from "$content/components/philomena/TagsForm";
TagsForm.initializeUploadEditor();

View File

@@ -0,0 +1,16 @@
@use '$styles/booru-vars';
.block.tag-presets {
.tag {
cursor: pointer;
&.is-missing {
opacity: 0.5;
}
&:hover {
color: booru-vars.$resolved-tag-background;
background: booru-vars.$resolved-tag-color;
}
}
}

View File

@@ -11,18 +11,3 @@ h2.tag-category-headline {
bottom: calc(#{$base-margin-bottom} - #{booru-vars.$padding-small});
}
}
.block.tag-presets {
.tag {
cursor: pointer;
&.is-missing {
opacity: 0.5;
}
&:hover {
color: booru-vars.$resolved-tag-background;
background: booru-vars.$resolved-tag-color;
}
}
}