diff --git a/chrome/content/zotero/bindings/itembox.xml b/chrome/content/zotero/bindings/itembox.xml index 05f4fd559d..80df2452e8 100644 --- a/chrome/content/zotero/bindings/itembox.xml +++ b/chrome/content/zotero/bindings/itembox.xml @@ -2387,8 +2387,12 @@ return (async function () { var htmlNS = 'http://www.w3.org/1999/xhtml'; - var data = await Zotero.Retractions.getData(this.item); - if (!data) { + var show = Zotero.Retractions.isRetracted(this.item); + var data; + if (show) { + data = await Zotero.Retractions.getData(this.item); + } + if (!show || !data) { this._id('retraction-box').hidden = true; return; } @@ -2410,6 +2414,7 @@ } // Reasons + var allowHiding = false; if (data.reasons.length) { let elem = this._id('retraction-reasons'); elem.hidden = false; @@ -2423,6 +2428,10 @@ elem.appendChild(dt); elem.appendChild(dd); + + if (reason == 'Retract and Replace') { + allowHiding = true; + } } } else { @@ -2494,6 +2503,13 @@ } } + let hideElem = this._id('retraction-hide'); + hideElem.firstChild.textContent = Zotero.getString('retraction.replacedItem.hide'); + hideElem.hidden = !allowHiding; + hideElem.firstChild.onclick = (event) => { + ZoteroPane.promptToHideRetractionForReplacedItem(this.item); + }; + Zotero.Utilities.Internal.updateHTMLInXUL(this._id('retraction-box')); }.bind(this))(); ]]> @@ -2626,6 +2642,7 @@ diff --git a/chrome/content/zotero/zoteroPane.js b/chrome/content/zotero/zoteroPane.js index 3fea489dca..a6c8724d0d 100644 --- a/chrome/content/zotero/zoteroPane.js +++ b/chrome/content/zotero/zoteroPane.js @@ -4823,6 +4823,30 @@ var ZoteroPane = new function() }; + this.promptToHideRetractionForReplacedItem = function (item) { + var ps = Services.prompt; + var buttonFlags = ps.BUTTON_POS_0 * ps.BUTTON_TITLE_IS_STRING + + ps.BUTTON_POS_1 * ps.BUTTON_TITLE_CANCEL; + let index = ps.confirmEx( + null, + Zotero.getString('retraction.replacedItem.title'), + Zotero.getString('retraction.replacedItem.text1') + + "\n\n" + + Zotero.getString('retraction.replacedItem.text2'), + buttonFlags, + Zotero.getString('retraction.replacedItem.button'), + null, + null, + null, + {} + ); + if (index == 0) { + Zotero.Retractions.hideRetraction(item); + this.hideRetractionBanner(); + } + }; + + /** * Sets the layout to either a three-vertical-pane layout and a layout where itemsPane is above itemPane */ diff --git a/chrome/locale/en-US/zotero/zotero.properties b/chrome/locale/en-US/zotero/zotero.properties index 483ff4574c..3ef849dcaa 100644 --- a/chrome/locale/en-US/zotero/zotero.properties +++ b/chrome/locale/en-US/zotero/zotero.properties @@ -1209,6 +1209,11 @@ retraction.date = Retracted on %S retraction.notice = Retraction Notice retraction.details = More details: retraction.credit = Data from %S +retraction.replacedItem.hide = Hide warning for replaced work… +retraction.replacedItem.title = Retracted and Replaced Work +retraction.replacedItem.text1 = This work has been retracted and replaced by its publisher, and this item may not represent the final version. +retraction.replacedItem.text2 = Unfortunately, some publishers incorrectly reuse the original DOI and/or PMID when replacing a work. If you’ve checked that this is the latest version, you can permanently hide the retraction warning for this item. +retraction.replacedItem.button = Hide Retraction Warning retraction.citeWarning.text1 = The item you are citing has been retracted. Do you still want to add it to your document? retraction.citeWarning.text2 = You can view the item in your library for further details on the retraction. retraction.citationWarning = A citation in your document has been retracted: diff --git a/chrome/skin/default/zotero/itemPane.css b/chrome/skin/default/zotero/itemPane.css index c8d9c64199..28e1eb103f 100644 --- a/chrome/skin/default/zotero/itemPane.css +++ b/chrome/skin/default/zotero/itemPane.css @@ -97,6 +97,23 @@ margin-bottom: .2em; } +#retraction-hide { + text-align: right; + margin-top: .3em; + margin-right: -1.2em; + margin-bottom: .3em; +} + +#retraction-hide button { + background: none; + margin: 0; + padding: 0; + cursor: pointer; + display: inline; + text-decoration: underline; + border-style: none; +} + /* Buttons in trash and feed views */ .zotero-item-pane-top-buttons { -moz-appearance: toolbar;