Add (very basic) tag adder

Featuring shitty CSS
feature-show_image_resolution
neobooru 2019-11-10 20:05:20 +01:00
parent 61916415f8
commit 695a842cd3
2 changed files with 20 additions and 3 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "szuru-chrome", "name": "szuru-chrome",
"version": "0.1.3", "version": "0.1.4",
"description": "Import media from various sites into szurubooru", "description": "Import media from various sites into szurubooru",
"author": "neobooru", "author": "neobooru",
"license": "MIT", "license": "MIT",

View File

@ -54,6 +54,15 @@
</div> </div>
<div class="popup-content"> <div class="popup-content">
<div class="popup-block" style="display:flex;">
<input type="text" v-model="addTagInput" v-on:keyup.enter="addTag" />
<button
class="primary"
style="margin-left: 5px; height: auto;"
@click="addTag"
>Add</button>
</div>
<div class="popup-block"> <div class="popup-block">
<ul class="compact-tags"> <ul class="compact-tags">
<li v-for="tag in post.tags" :key="tag.name"> <li v-for="tag in post.tags" :key="tag.name">
@ -74,7 +83,7 @@
<div class="popup-row"> <div class="popup-row">
<div class="popup-column2"> <div class="popup-column2">
<select disabled> <select disabled>
<option>https://szuru.example.com</option> <option>{{ activeSite != null ? activeSite.domain : "(no site available)" }}</option>
</select> </select>
</div> </div>
@ -111,7 +120,8 @@ export default Vue.extend({
activeSite: null as SzuruSiteConfig | null, activeSite: null as SzuruSiteConfig | null,
szuru: null as SzuruWrapper | null, szuru: null as SzuruWrapper | null,
post: new ScrapedPost(), post: new ScrapedPost(),
messages: [] as Message[] messages: [] as Message[],
addTagInput: ""
}; };
}, },
methods: { methods: {
@ -254,6 +264,13 @@ export default Vue.extend({
// Searching for posts with re:zero will show an error message about unknown named token. // Searching for posts with re:zero will show an error message about unknown named token.
// Searching for posts with re\:zero will show posts tagged with re:zero. // Searching for posts with re\:zero will show posts tagged with re:zero.
return encodeURIComponent(tagName.replace(/\:/g, "\\:")); return encodeURIComponent(tagName.replace(/\:/g, "\\:"));
},
addTag() {
const tagName = this.addTagInput;
this.addTagInput = "";
if (this.post.tags.find(x => x.name == tagName) == undefined) {
this.post.tags.push(new ScrapedTag(tagName));
}
} }
}, },
async mounted() { async mounted() {