[+] Links

This commit is contained in:
Hykilpikonna
2021-12-25 14:17:13 -05:00
parent ca5d4ab225
commit c1ef02d3b4
3 changed files with 71 additions and 14 deletions
+3
View File
@@ -36,9 +36,12 @@ export default class MetaTable extends Vue
</script> </script>
<style lang="sass" scoped> <style lang="sass" scoped>
@import "src/css/colors"
.meta .meta
td:first-child td:first-child
text-align: right text-align: right
color: $color-text-light
td:last-child td:last-child
display: inline-block display: inline-block
+61 -13
View File
@@ -8,7 +8,17 @@
</div> </div>
</div> </div>
<div id="details"> <div id="details">
<MetaTable :table="tableData"/> <MetaTable id="table" :table="tableData"/>
<div id="abstract">
<div class="label">Abstract</div>
<div class="content">{{d.abstractNote}}</div>
</div>
<div id="attachments" v-if="item.attachments">
<div class="label">Attachments</div>
<div class="content" v-for="a of item.attachments" :key="a.data.key">
<a :href="a.links['enclosure'].href">{{a.data.title}}</a>
</div>
</div>
</div> </div>
</div> </div>
</template> </template>
@@ -29,6 +39,8 @@ export interface ZoteroLink
type: string // 'text/html' type: string // 'text/html'
attachmentType?: string // 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' attachmentType?: string // 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'
attachmentSize?: number // bytes? attachmentSize?: number // bytes?
title?: string
length?: string
} }
export type ZoteroLinks = {[id: string]: ZoteroLink} export type ZoteroLinks = {[id: string]: ZoteroLink}
@@ -61,22 +73,45 @@ export interface ZoteroData
extra?: string extra?: string
} }
export interface ZoteroLibrary
{
type: string // 'user'
id: number
name: string
links: ZoteroLinks
}
export interface ZoteroMeta
{
creatorSummary: string // Gui and Burton
parsedDate: string // 2021-12-09
numChildren: number
}
export interface ZoteroItem export interface ZoteroItem
{ {
key: string key: string
version: number version: number
library: { library: ZoteroLibrary
type: string // 'user' meta: ZoteroMeta
id: number
name: string
links: ZoteroLinks
}
meta: {
creatorSummary: string // Gui and Burton
parsedDate: string // 2021-12-09
numChildren: 1
}
data: ZoteroData data: ZoteroData
attachments: ZoteroAttachment[]
}
export interface ZoteroAttachment
{
links: ZoteroLinks
data: {
key: string
parentItem: string
itemType: string // == 'attachment'
title: string
contentType: string
fileName: string
md5: string
mtime: number
}
} }
@Options({components: {MetaTable}}) @Options({components: {MetaTable}})
@@ -95,6 +130,7 @@ export default class ZoteroPublicationView extends Vue
delete t.key delete t.key
delete t.version delete t.version
delete t.title delete t.title
delete t.abstractNote
if (t.itemType) t.itemType = capitalize(t.itemType as string) if (t.itemType) t.itemType = capitalize(t.itemType as string)
if (t.url) t.url = linkifyUrls(t.url as string) if (t.url) t.url = linkifyUrls(t.url as string)
return t return t
@@ -102,7 +138,8 @@ export default class ZoteroPublicationView extends Vue
mounted(): void mounted(): void
{ {
$('.publication').accordion({collapsible: true, header: 'div.header', active: false}) $('.publication').accordion({collapsible: true, header: 'div.header', active: false,
heightStyle: "content"})
} }
} }
</script> </script>
@@ -122,6 +159,17 @@ export default class ZoteroPublicationView extends Vue
#details #details
padding-left: calc(1.6em + 6px) padding-left: calc(1.6em + 6px)
> div
margin-bottom: 1em
#table
margin: 1em 0
.label
font-weight: bold
font-size: 0.8em
.header .header
align-items: center align-items: center
+7 -1
View File
@@ -13,7 +13,7 @@ import emojiRegex from 'emoji-regex';
import {parseExtensions} from '@/scripts/extended_markdown' import {parseExtensions} from '@/scripts/extended_markdown'
import $ from 'jquery' import $ from 'jquery'
import 'jqueryui' import 'jqueryui'
import ZoteroPublication, {ZoteroItem} from "@/components/ZoteroPublication.vue"; import ZoteroPublication, {ZoteroAttachment, ZoteroItem} from "@/components/ZoteroPublication.vue";
@Options({components: {ZoteroPublication}}) @Options({components: {ZoteroPublication}})
export default class About extends Vue export default class About extends Vue
@@ -33,8 +33,14 @@ export default class About extends Vue
fetch('https://api.zotero.org/users/8463157/publications/items?linkwrap=1&order=date&sort=desc&start=0&include=data&limit=100') fetch('https://api.zotero.org/users/8463157/publications/items?linkwrap=1&order=date&sort=desc&start=0&include=data&limit=100')
.then(it => it.json()).then(it => .then(it => it.json()).then(it =>
{ {
// Filter out publications and attachments
this.publications = it this.publications = it
let files: ZoteroAttachment[] = it
files = files.filter(it => it.data.itemType === 'attachment')
this.publications = this.publications.filter(it => it.data.itemType !== 'attachment') this.publications = this.publications.filter(it => it.data.itemType !== 'attachment')
// Add attachments to
this.publications.forEach(it => it.attachments = files.filter(a => a.data.parentItem == it.key))
}) })
} }