diff --git a/content/notes/notes.js b/content/notes/notes.js index 3c36dff..c58342d 100644 --- a/content/notes/notes.js +++ b/content/notes/notes.js @@ -1,9 +1,15 @@ Notes = { init() { + var fontsize = Zotero.ZeNotes.Prefs.get("font-size"); this.tableutils = Zotero_Preferences.ZNTable; this.body = document.getElementById("zn-body"); this.infotags = ["id", "key", "title", "date", "journal", "author", "creators", "itemid", "filekey"]; this.body.focus(); + if(fontsize) + { + this.body.style.fontSize = fontsize+"px"; + } + }, isvertical() diff --git a/content/settings/display.xhtml b/content/settings/display.xhtml index eb669ba..99a045d 100644 --- a/content/settings/display.xhtml +++ b/content/settings/display.xhtml @@ -4,6 +4,7 @@ Highlight opacityLorem ipsum Header size Column width (for vertical) + Font size Filter html (replace) diff --git a/content/settings/preferences.js b/content/settings/preferences.js index 0576f58..d935e5c 100644 --- a/content/settings/preferences.js +++ b/content/settings/preferences.js @@ -166,6 +166,16 @@ Zotero_Preferences.ZeNotes = { }); } } + if(elid.includes("-val")) + { + el.addEventListener("keyup", function(e){ + let value = e.target.value; + let id = e.target.id.replace("-val", ""); + let cevent = new Event('change'); + document.getElementById(id).value = value; + document.getElementById(id).dispatchEvent(cevent); + }) + } } }, @@ -261,7 +271,9 @@ Zotero_Preferences.ZeNotes = { ["column-width", "zn-column-width-val"], ["header-size", "zn-header-size"], ["header-size", "zn-header-size-val"], - ["vertical-table", "zn-vertical-table"] + ["vertical-table", "zn-vertical-table"], + ["font-size", "zn-font-size"], + ["font-size", "zn-font-size-val"] ]; break; diff --git a/core/format.js b/core/format.js index b1c1399..c1d079e 100644 --- a/core/format.js +++ b/core/format.js @@ -217,7 +217,7 @@ Format = { annotationtext = this.escapehtml(annotationtext); } - var contents = "‟"+annotationtext+"” ("+Format.creatorshort(item)+" "+Format.year(item)+", p. "+note["annotationPageLabel"]+")"; + var comment = note["annotationComment"]; @@ -226,6 +226,9 @@ Format = { comment = ""; } + + + if(!this.isvalidxhtml(comment)) { comment = this.escapehtml(comment); @@ -233,11 +236,26 @@ Format = { comment = comment.split("\n").join("
\n"); + var contents = "‟"+annotationtext+"” ("+Format.creatorshort(item)+" "+Format.year(item)+", p. "+note["annotationPageLabel"]+")"; + + var img = ""; + if(note.annotationType=="image") + { + var json = await Zotero.Annotations.toJSON(note); + if(annotationtext) + { + annotationtext = "‟"+annotationtext+"”"; + } + var img = ""; + + var contents = annotationtext+"
Source: "+Format.creatorshort(item)+" "+Format.year(item)+", p. "+note["annotationPageLabel"]+""; + } + var annotationpage = JSON.parse(note["annotationPosition"])["pageIndex"]; var color = Zotero.ZeNotes.Utils.addopacity(note["annotationColor"], Zotero.ZeNotes.Prefs.get("bg-opacity")); - let note_ = "
"+comment+"

"+contents+"

"; + let note_ = "
"+comment+"

"+img+ contents+"

"; notetext+=note_; } else diff --git a/core/utils.js b/core/utils.js index cfaa7a0..353fed7 100644 --- a/core/utils.js +++ b/core/utils.js @@ -1,3 +1,4 @@ +var window = Zotero.getMainWindow(); Utils = { tohex(d) { @@ -93,6 +94,7 @@ Utils = { } return arr; }, + displayjson(json) { if (typeof json != 'string') { json = JSON.stringify(json, undefined, 2); @@ -116,5 +118,13 @@ Utils = { json = json.split("\n").join("
").split(" ").join("  "); return json; + }, + + bin2b64(bin, mime="png"){ + var uint8Array = new TextEncoder().encode(bin); + var base64String = btoa(String.fromCharCode.apply(null, uint8Array)); + return base64String; + // return "data:image/"+mime+";base64,"+window.btoa(encodeURIComponent(bin)); } + } \ No newline at end of file diff --git a/install.rdf b/install.rdf index 4d03817..c03738f 100644 --- a/install.rdf +++ b/install.rdf @@ -5,7 +5,7 @@ zenotes@alefa.net ZeNotes - 0.7.7 + 0.7.8 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 fd4fcbc..0151b26 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "manifest_version": 2, "name": "Ze Notes", - "version": "0.7.7", + "version": "0.7.8", "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 060031e..1b7ce37 100644 --- a/zenote-update.json +++ b/zenote-update.json @@ -3,9 +3,9 @@ "zenotes@alefa.net": { "updates": [ { - "version": "0.7.7", - "update_link": "https://github.com/frianasoa/Ze-Notes/releases/download/v0.7.7/zenotes-v0.7.7.xpi", - "update_hash": "sha256:5c7573098676a08d4b1839548caa33fb33aadcc910ef50ae82ef6ecc9d2b256d", + "version": "0.7.8", + "update_link": "https://github.com/frianasoa/Ze-Notes/releases/download/v0.7.8/zenotes-v0.7.8.xpi", + "update_hash": "sha256:2d45d794a0b648399351af95f6990342d3c5ebb78188462a5880c8bc431215e2", "applications": { "gecko": { "strict_min_version": "60.0" diff --git a/zenote-update.rdf b/zenote-update.rdf index 6637db4..b870d85 100644 --- a/zenote-update.rdf +++ b/zenote-update.rdf @@ -5,13 +5,13 @@ - 0.7.7 + 0.7.8 zotero@chnm.gmu.edu 5.0.0 6.* - https://github.com/frianasoa/Ze-Notes/releases/download/v0.7.7/zenotes-v0.7.7.xpi + https://github.com/frianasoa/Ze-Notes/releases/download/v0.7.8/zenotes-v0.7.8.xpi @@ -20,7 +20,7 @@ juris-m@juris-m.github.io 4.999 6.* - https://github.com/frianasoa/Ze-Notes/releases/download/v0.7.7/zenotes-v0.7.7.xpi + https://github.com/frianasoa/Ze-Notes/releases/download/v0.7.8/zenotes-v0.7.8.xpi