From 48580c49d1e907ff1aca33a639a21de2158bd455 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Thu, 6 Jun 2019 08:47:43 -0400 Subject: [PATCH] Retraction Watch integration - Check for retracted items using data from Retraction Watch - Show an X next to retracted items in the items list, and show a scary message at the top of the item pane with more info and links. - Lookup is done in a privacy-preserving manner using k-anonymity -- the server is unable to determine the specific items that exist in the client, so people who don't sync don't need to share any library data (though the server doesn't log the lookups anyway). TODO: - Pop up an alert when new items are found - Show a confirmation prompt when citing a retracted item - Support items without DOIs or PMIDs - Add a proper PMID field and expand DOI to more item types so these values don't need to be parsed out of Extra - Clear the banner immediately when all possible fields are cleared instead of waiting a few seconds --- chrome/content/zotero/bindings/itembox.xml | 141 +++- chrome/content/zotero/xpcom/data/item.js | 32 +- chrome/content/zotero/xpcom/data/tags.js | 156 +++-- chrome/content/zotero/xpcom/itemTreeView.js | 13 +- chrome/content/zotero/xpcom/retractions.js | 623 ++++++++++++++++++ chrome/content/zotero/xpcom/schema.js | 6 + .../zotero/xpcom/utilities_internal.js | 39 +- chrome/content/zotero/xpcom/zotero.js | 1 + chrome/locale/en-US/zotero/zotero.properties | 6 + chrome/skin/default/zotero/cross.png | Bin 655 -> 476 bytes chrome/skin/default/zotero/cross@1.5x.png | Bin 0 -> 1001 bytes chrome/skin/default/zotero/cross@2x.png | Bin 0 -> 932 bytes chrome/skin/default/zotero/itemPane.css | 50 ++ components/zotero-service.js | 1 + resource/schema/userdata.sql | 8 +- 15 files changed, 969 insertions(+), 107 deletions(-) create mode 100644 chrome/content/zotero/xpcom/retractions.js create mode 100644 chrome/skin/default/zotero/cross@1.5x.png create mode 100644 chrome/skin/default/zotero/cross@2x.png diff --git a/chrome/content/zotero/bindings/itembox.xml b/chrome/content/zotero/bindings/itembox.xml index 3757d28aca..13681c4996 100644 --- a/chrome/content/zotero/bindings/itembox.xml +++ b/chrome/content/zotero/bindings/itembox.xml @@ -28,8 +28,8 @@ + xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" + xmlns:html="http://www.w3.org/1999/xhtml"> @@ -291,6 +291,8 @@ return; } + this.updateRetracted(); + if (this.clickByItem) { var itemBox = document.getAnonymousNodes(this)[0]; itemBox.setAttribute('onclick', @@ -2374,6 +2376,125 @@ + + Retraction Watch' + ); + let parts = Zotero.Utilities.parseMarkup(text); + for (let part of parts) { + if (part.type == 'text') { + creditElem.appendChild(document.createTextNode(part.text)); + } + else if (part.type == 'link') { + let a = document.createElementNS(htmlNS, 'a'); + a.href = part.attributes.href; + a.textContent = part.text; + creditElem.appendChild(a); + } + } + } + + Zotero.Utilities.Internal.updateHTMLInXUL(this._id('retraction-box')); + }.bind(this))(); + ]]> + + + @@ -2484,6 +2605,22 @@ +