From 168fb87e783cbb81df22478b65a899edb6d28823 Mon Sep 17 00:00:00 2001 From: frianasoa Date: Fri, 5 Jan 2024 00:59:46 +0900 Subject: [PATCH] Improving author column rendering. Added a clone "source". --- content/settings/preferences.js | 2 +- core/format.js | 33 ++++++++++++++------------------- install.rdf | 2 +- manifest.json | 2 +- zenote-update.json | 6 +++--- zenote-update.rdf | 6 +++--- 6 files changed, 23 insertions(+), 28 deletions(-) diff --git a/content/settings/preferences.js b/content/settings/preferences.js index a05f944..d649621 100644 --- a/content/settings/preferences.js +++ b/content/settings/preferences.js @@ -14,7 +14,7 @@ Zotero_Preferences.ZeNotes = { } this.savevalues = []; this.tableutils = Zotero_Preferences.ZNTable; - this.defaulthiddentags = ["Id", "itemid", "key", "filekey"]; + this.defaulthiddentags = ["Id", "itemid", "key", "filekey", "source"]; }, async currentcollection() diff --git a/core/format.js b/core/format.js index 7809fbe..05bd91e 100644 --- a/core/format.js +++ b/core/format.js @@ -55,12 +55,11 @@ Format = { } return { data: itemlist, - columns: ["id", "itemid", "key", "title", "date", "journal", "author", "creators", "filekey"], + columns: ["id", "itemid", "key", "title", "date", "journal", "author", "source", "creators", "filekey"], tagged_items: Object.values(tagged_items), } }, - - + async itemnotes(item) { var allnotes = []; @@ -261,6 +260,7 @@ Format = { date: Format.year(item), journal: this.xmlescape(item.getField("publicationTitle")), author: Format.creatorshort(item)+" ("+Format.year(item)+")", + source: Format.creatorshort(item)+" ("+Format.year(item)+")", creators: Format.creators(item), filenames: filenames, filekey: Format.filekey(item), @@ -270,7 +270,16 @@ Format = { }, year(item) { - var y = item.getField("date", true).substr(0, 4); + var date; + for(type of ["date", "issueDate", "dateEnacted", "dateDecided"]) + { + date = item.getField(type, true); + if(date) + { + break; + } + } + var y = date.substr(0, 4); return y; }, @@ -299,21 +308,7 @@ Format = { }, creatorshort(item) { - var creators = item.getCreatorsJSON(); - var author = ""; - if(creators.length==1) - { - author = creators[0].lastName; - } - else if(creators.length==2) - { - author = creators[0].lastName+" and "+creators[1].lastName; - } - else if(creators.length>0) - { - author = creators[0].lastName+" et al." - } - return author; + return Zotero.Items.getFirstCreatorFromData(item.itemTypeID, item.getCreators()); }, creators(item) { diff --git a/install.rdf b/install.rdf index 1d8a145..ac39453 100644 --- a/install.rdf +++ b/install.rdf @@ -5,7 +5,7 @@ zenotes@alefa.net ZeNotes - 0.7.5 + 0.7.6 true https://raw.githubusercontent.com/frianasoa/zenotes/main/zenote-update.json https://github.com/frianasoa/zenotes diff --git a/manifest.json b/manifest.json index b536a0c..5a65aa2 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "manifest_version": 2, "name": "Ze Notes", - "version": "0.7.5", + "version": "0.7.6", "description": "Advanced notes manager", "homepage_url": "https://github.com/frianasoa/zenotes", "author": "Fanantenana Rianasoa Andriariniaina", diff --git a/zenote-update.json b/zenote-update.json index 15fd643..a535377 100644 --- a/zenote-update.json +++ b/zenote-update.json @@ -3,9 +3,9 @@ "zenotes@alefa.net": { "updates": [ { - "version": "0.7.5", - "update_link": "https://github.com/frianasoa/Ze-Notes/releases/download/v0.7.5/zenotes-v0.7.5.xpi", - "update_hash": "sha256:bf8cebdaa6720a60c5a053e30d8f38a81668b7e1b5eaab472853a056dd6a9cb6", + "version": "0.7.6", + "update_link": "https://github.com/frianasoa/Ze-Notes/releases/download/v0.7.6/zenotes-v0.7.6.xpi", + "update_hash": "sha256:ef93bfe98a558526fdfeec367276eb8590070a95ab309606531a7a0694501ce7", "applications": { "gecko": { "strict_min_version": "60.0" diff --git a/zenote-update.rdf b/zenote-update.rdf index 2771bfb..6ca4570 100644 --- a/zenote-update.rdf +++ b/zenote-update.rdf @@ -5,13 +5,13 @@ - 0.7.5 + 0.7.6 zotero@chnm.gmu.edu 5.0.0 6.* - https://github.com/frianasoa/Ze-Notes/releases/download/v0.7.5/zenotes-v0.7.5.xpi + https://github.com/frianasoa/Ze-Notes/releases/download/v0.7.6/zenotes-v0.7.6.xpi @@ -20,7 +20,7 @@ juris-m@juris-m.github.io 4.999 6.* - https://github.com/frianasoa/Ze-Notes/releases/download/v0.7.5/zenotes-v0.7.5.xpi + https://github.com/frianasoa/Ze-Notes/releases/download/v0.7.6/zenotes-v0.7.6.xpi