diff --git a/package.json b/package.json index 460364e..4caf9a7 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,8 @@ "build:dev": "webpack --config webpack.dev.js", "build-zip": "node scripts/build-zip.js", "sign-xpi": "node scripts/sign-xpi.js", - "watch": "webpack --watch --config webpack.dev.js" + "watch": "webpack --watch --config webpack.dev.js", + "prepare": "npm run build" }, "dependencies": { "axios": "^0.23.0", diff --git a/src/SzuruWrapper.ts b/src/SzuruWrapper.ts index c587347..71af247 100644 --- a/src/SzuruWrapper.ts +++ b/src/SzuruWrapper.ts @@ -90,7 +90,7 @@ export default class SzuruWrapper { return (await this.apiPost("posts/reverse-search", obj)).data; } - static async createFromConfig(siteConfig: SzuruSiteConfig): Promise { + static createFromConfig(siteConfig: SzuruSiteConfig): SzuruWrapper | null { return new SzuruWrapper(siteConfig.domain, siteConfig.username, siteConfig.authToken); } diff --git a/src/ViewModels.ts b/src/ViewModels.ts index ac9e634..f123022 100644 --- a/src/ViewModels.ts +++ b/src/ViewModels.ts @@ -35,6 +35,7 @@ export class PostViewModel { rating: BooruTypes.SafetyRating; source: string | undefined; referrer: string | undefined; + resolution: [number, number] | undefined; constructor(post: ScrapedPost) { this.contentUrl = post.contentUrl; @@ -45,5 +46,6 @@ export class PostViewModel { this.referrer = post.referrer; this.tags = post.tags.map(x => TagViewModel.fromScapedTag(x)); this.notes = post.notes; + this.resolution = post.resolution; } } diff --git a/src/css/style.css b/src/css/style.css index 0b2215f..252d0ba 100644 --- a/src/css/style.css +++ b/src/css/style.css @@ -48,6 +48,7 @@ select { width: 100%; } +ul.compact, .compact-tags { list-style-type: none; padding: 0; diff --git a/src/popup/App.vue b/src/popup/App.vue index ff91161..9ecd3e6 100644 --- a/src/popup/App.vue +++ b/src/popup/App.vue @@ -18,6 +18,12 @@ +
+ +
+
@@ -236,6 +242,12 @@ export default Vue.extend({ // Based on https://stackoverflow.com/a/6316913 return tagName.replace(/\_/g, "_"); }, + resolutionToString(resolution: [number, number]) { + if (resolution && resolution.length == 2) { + return resolution[0] + "x" + resolution[1]; + } + return ""; + }, // Remove tag from post's taglist removeTag(tag: TagViewModel) { if (this.selectedPost) { @@ -442,9 +454,11 @@ export default Vue.extend({ if (!this.activeSite) { this.pushError("No szurubooru server configured!"); } else { - this.szuru = await SzuruWrapper.createFromConfig(this.activeSite); + this.szuru = SzuruWrapper.createFromConfig(this.activeSite); } + console.log("hello") + browser.runtime.onMessage.addListener((cmd: BrowserCommand, sender: Runtime.MessageSender) => { switch (cmd.name) { case "push_message": @@ -486,7 +500,7 @@ export default Vue.extend({ ); // Always call grabPost, even when there is no activeSite - await this.grabPost(); + // await this.grabPost(); }, }); @@ -556,6 +570,10 @@ video { margin: 0 0 5px 0; } +.section-block { + display: block; +} + .cursor-pointer { cursor: pointer; }