diff --git a/package.json b/package.json index c17511b..4ca2226 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "szuru-chrome", - "version": "0.7.8", + "version": "0.8.0", "description": "Import media from various sites into szurubooru.", "author": "neobooru", "license": "MIT", @@ -16,11 +16,13 @@ }, "dependencies": { "axios": "^0.23.0", + "markdown-it": "^12.3.2", "neo-scraper": "^0.5.3", "vue": "^2.6.14", "webextension-polyfill": "^0.8.0" }, "devDependencies": { + "@types/markdown-it": "^12.2.3", "archiver": "^5.3.0", "copy-webpack-plugin": "^9.0.1", "css-loader": "^6.4.0", diff --git a/src/popup/App.vue b/src/popup/App.vue index d397780..57c0aca 100644 --- a/src/popup/App.vue +++ b/src/popup/App.vue @@ -70,7 +70,7 @@ @click="onClickAutocompleteTagItem(tag)" :key="tag.name" :class="{ - active: idx == autocompleteIndex, + active: idx == autocompleteIndex }" > {{ tag.name }} @@ -116,10 +116,15 @@ @@ -135,8 +140,10 @@ import { ImageSearchResult, Post } from "../SzuruTypes"; import { Config, SzuruSiteConfig } from "../Config"; import { BrowserCommand, Message, getUrl, isChrome, encodeTagName } from "../Common"; import { PostViewModel, TagViewModel } from "../ViewModels"; +import PostNotes from "./components/PostNotes.vue"; export default Vue.extend({ + components: { PostNotes }, data() { return { config: null as Config | null, @@ -151,7 +158,7 @@ export default Vue.extend({ cancelSource: null as CancelTokenSource | null, autocompleteIndex: -1, showTagUsages: false, - showFindSimilarButton: true, + showFindSimilarButton: true }; }, watch: { @@ -160,13 +167,13 @@ export default Vue.extend({ // No need to check if any vars are unset, findSimilar does that internally this.findSimilar(); } - }, + } }, methods: { async getActiveTabId() { const activeTabs = await browser.tabs.query({ active: true, - currentWindow: true, + currentWindow: true }); if (activeTabs.length > 0) return activeTabs[0].id!; @@ -301,7 +308,7 @@ export default Vue.extend({ addTag(tag: TagViewModel) { if (this.selectedPost) { // Only add tag if it doesn't already exist - if (tag.name.length > 0 && this.selectedPost.tags.find((x) => x.name == tag.name) == undefined) { + if (tag.name.length > 0 && this.selectedPost.tags.find(x => x.name == tag.name) == undefined) { this.selectedPost.tags.push(tag); // Add implications for the tag @@ -368,12 +375,12 @@ export default Vue.extend({ return undefined; }, async loadTagCounts() { - const allTags = this.posts.flatMap((x) => x.tags); + const allTags = this.posts.flatMap(x => x.tags); for (let i = 0; i < allTags.length; i += 100) { const query = allTags .slice(i, i + 101) - .map((x) => encodeTagName(x.name)) + .map(x => encodeTagName(x.name)) .join(); const resp = await this.szuru?.getTags(query); @@ -460,9 +467,9 @@ export default Vue.extend({ this.cancelSource.token ); - this.autocompleteTags = resp!.results.map((x) => TagViewModel.fromTag(x)); + this.autocompleteTags = resp!.results.map(x => TagViewModel.fromTag(x)); if (this.autocompleteTags.length > 0) this.autocompleteShown = true; - }, + } }, async mounted() { this.config = await Config.load(); @@ -509,7 +516,7 @@ export default Vue.extend({ } return { - requestHeaders, + requestHeaders }; }, { urls: [""] }, @@ -518,7 +525,7 @@ export default Vue.extend({ // Always call grabPost, even when there is no activeSite await this.grabPost(); - }, + } }); @@ -532,7 +539,7 @@ video { display: grid; } -/* +/* Override for firefox. This is needed because `width: 780px` shows horizontal scrollbars, where `width: auto` does not. Chrome(-likes) do need the explicit `width: 780px`, which is why we need to have different rules for each of them. @@ -634,4 +641,16 @@ video { min-width: 5ch; /* 5 character width */ display: inline-block; } + +.post-container { + position: relative; + display: flex; +} + +.post-overlay { + position: absolute; + width: 100%; + height: 100%; + /* z-index: 2; */ +} diff --git a/src/popup/components/Markdown.vue b/src/popup/components/Markdown.vue new file mode 100644 index 0000000..9e959ff --- /dev/null +++ b/src/popup/components/Markdown.vue @@ -0,0 +1,38 @@ + + + + + diff --git a/src/popup/components/PostNotes.vue b/src/popup/components/PostNotes.vue new file mode 100644 index 0000000..1d4af11 --- /dev/null +++ b/src/popup/components/PostNotes.vue @@ -0,0 +1,143 @@ + + + + + diff --git a/yarn.lock b/yarn.lock index 51bb7f1..69afab7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -62,6 +62,24 @@ resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.9.tgz#97edc9037ea0c38585320b28964dde3b39e4660d" integrity sha512-qcUXuemtEu+E5wZSJHNxUXeCZhAfXKQ41D+duX+VYPde7xyEVZci+/oXKJL13tnRs9lR2pr4fod59GT6/X1/yQ== +"@types/linkify-it@*": + version "3.0.2" + resolved "https://registry.yarnpkg.com/@types/linkify-it/-/linkify-it-3.0.2.tgz#fd2cd2edbaa7eaac7e7f3c1748b52a19143846c9" + integrity sha512-HZQYqbiFVWufzCwexrvh694SOim8z2d+xJl5UNamcvQFejLY/2YUtzXHYi3cHdI7PMlS8ejH2slRAOJQ32aNbA== + +"@types/markdown-it@^12.2.3": + version "12.2.3" + resolved "https://registry.yarnpkg.com/@types/markdown-it/-/markdown-it-12.2.3.tgz#0d6f6e5e413f8daaa26522904597be3d6cd93b51" + integrity sha512-GKMHFfv3458yYy+v/N8gjufHO6MSZKCOXpZc5GXIWWy8uldwfmPn98vp81gZ5f9SVw8YYBctgfJ22a2d7AOMeQ== + dependencies: + "@types/linkify-it" "*" + "@types/mdurl" "*" + +"@types/mdurl@*": + version "1.0.2" + resolved "https://registry.yarnpkg.com/@types/mdurl/-/mdurl-1.0.2.tgz#e2ce9d83a613bacf284c7be7d491945e39e1f8e9" + integrity sha512-eC4U9MlIcu2q0KQmXszyn5Akca/0jrQmwDRgpAMJai7qBWq4amIQhZyNau4VYGtCeALvW1/NtjzJJ567aZxfKA== + "@types/minimatch@*": version "3.0.5" resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-3.0.5.tgz#1001cc5e6a3704b83c236027e77f2f58ea010f40" @@ -337,6 +355,11 @@ archiver@^5.3.0: tar-stream "^2.2.0" zip-stream "^4.1.0" +argparse@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/argparse/-/argparse-2.0.1.tgz#246f50f3ca78a3240f6c997e8a9bd1eac49e4b38" + integrity sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q== + array-union@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/array-union/-/array-union-1.0.2.tgz#9a34410e4f4e3da23dea375be5be70f24778ec39" @@ -767,6 +790,11 @@ enhanced-resolve@^5.0.0, enhanced-resolve@^5.8.3: graceful-fs "^4.2.4" tapable "^2.2.0" +entities@~2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/entities/-/entities-2.1.0.tgz#992d3129cf7df6870b96c57858c249a120f8b8b5" + integrity sha512-hCx1oky9PFrJ611mf0ifBLBRW8lUUVRlFolb5gWRfIELabBlbp9xZvrqZLZAs+NxFnbfQoeGd8wDkygjg7U85w== + envinfo@^7.7.3: version "7.8.1" resolved "https://registry.yarnpkg.com/envinfo/-/envinfo-7.8.1.tgz#06377e3e5f4d379fea7ac592d5ad8927e0c4d475" @@ -1310,6 +1338,13 @@ lazystream@^1.0.0: dependencies: readable-stream "^2.0.5" +linkify-it@^3.0.1: + version "3.0.3" + resolved "https://registry.yarnpkg.com/linkify-it/-/linkify-it-3.0.3.tgz#a98baf44ce45a550efb4d49c769d07524cc2fa2e" + integrity sha512-ynTsyrFSdE5oZ/O9GEf00kPngmOfVwazR5GKDq6EYfhlpFug3J2zybX56a2PRRpc9P+FuSoGNAwjlbDs9jJBPQ== + dependencies: + uc.micro "^1.0.1" + loader-runner@^4.2.0: version "4.2.0" resolved "https://registry.yarnpkg.com/loader-runner/-/loader-runner-4.2.0.tgz#d7022380d66d14c5fb1d496b89864ebcfd478384" @@ -1406,6 +1441,22 @@ lru-cache@^6.0.0: dependencies: yallist "^4.0.0" +markdown-it@^12.3.2: + version "12.3.2" + resolved "https://registry.yarnpkg.com/markdown-it/-/markdown-it-12.3.2.tgz#bf92ac92283fe983fe4de8ff8abfb5ad72cd0c90" + integrity sha512-TchMembfxfNVpHkbtriWltGWc+m3xszaRD0CZup7GFFhzIgQqxIfn3eGj1yZpfuflzPvfkt611B2Q/Bsk1YnGg== + dependencies: + argparse "^2.0.1" + entities "~2.1.0" + linkify-it "^3.0.1" + mdurl "^1.0.1" + uc.micro "^1.0.5" + +mdurl@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/mdurl/-/mdurl-1.0.1.tgz#fe85b2ec75a59037f2adfec100fd6c601761152e" + integrity sha1-/oWy7HWlkDfyrf7BAP1sYBdhFS4= + merge-source-map@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/merge-source-map/-/merge-source-map-1.1.0.tgz#2fdde7e6020939f70906a68f2d7ae685e4c8c646" @@ -2162,6 +2213,11 @@ typescript@^4.4.4: resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.4.4.tgz#2cd01a1a1f160704d3101fd5a58ff0f9fcb8030c" integrity sha512-DqGhF5IKoBl8WNf8C1gu8q0xZSInh9j1kJJMqT3a94w1JzVaBU4EXOSMrz9yDqMT0xt3selp83fuFMQ0uzv6qA== +uc.micro@^1.0.1, uc.micro@^1.0.5: + version "1.0.6" + resolved "https://registry.yarnpkg.com/uc.micro/-/uc.micro-1.0.6.tgz#9c411a802a409a91fc6cf74081baba34b24499ac" + integrity sha512-8Y75pvTYkLJW2hWQHXxoqRgV7qb9B+9vFEtidML+7koHUFapnVJAZ6cKs+Qjz5Aw3aZWHMC6u0wJE3At+nSGwA== + uri-js@^4.2.2: version "4.4.1" resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.4.1.tgz#9b1a52595225859e55f669d928f88c6c57f2a77e"