www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit 4bdef75074bdf453950fdbd34bc00009a08ea13c
parent 7a93b132b348ebb1c6634d8f83ab95dff0f209ee
Author: rmzelle <rintze.zelle@gmail.com>
Date:   Thu, 14 May 2015 20:33:52 -0400

Add DOI-field context-menu

Diffstat:
Mchrome/content/zotero/bindings/itembox.xml | 11+++++++++++
Mchrome/content/zotero/xpcom/utilities_internal.js | 13+++++++++++--
Mchrome/locale/en-US/zotero/zotero.dtd | 2++
3 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/chrome/content/zotero/bindings/itembox.xml b/chrome/content/zotero/bindings/itembox.xml @@ -413,6 +413,13 @@ label.setAttribute("isButton", true); label.setAttribute("onclick", "ZoteroPane_Local.loadURI('" + doi + "', event)"); label.setAttribute("tooltiptext", Zotero.getString('locate.online.tooltip')); + valueElement.setAttribute('contextmenu', 'zotero-doi-menu'); + + var openURLMenuItem = document.getElementById('zotero-doi-menu-view-online'); + openURLMenuItem.setAttribute("oncommand", "ZoteroPane_Local.loadURI('" + doi + "', event)"); + + var copyMenuItem = document.getElementById('zotero-doi-menu-copy'); + copyMenuItem.setAttribute("oncommand", "Zotero.Utilities.Internal.copyTextToClipboard('" + doi + "')"); } } else if (fieldName == 'abstractNote') { @@ -2479,6 +2486,10 @@ <menuitem label="&zotero.item.creatorTransform.nameSwap;" oncommand="document.getBindingParent(this).swapNames();"/> </menupopup> + <menupopup id="zotero-doi-menu"> + <menuitem id="zotero-doi-menu-view-online" label="&zotero.item.viewOnline;"/> + <menuitem id="zotero-doi-menu-copy" label="&zotero.item.copyAsURL;"/> + </menupopup> <zoteroguidancepanel id="zotero-author-guidance" about="authorMenu" position="after_end" x="-25"/> </popupset> <grid flex="1"> diff --git a/chrome/content/zotero/xpcom/utilities_internal.js b/chrome/content/zotero/xpcom/utilities_internal.js @@ -30,6 +30,16 @@ * @class Utility functions not made available to translators */ Zotero.Utilities.Internal = { + + /** + * Unicode normalization + */ + "copyTextToClipboard":function(str) { + Components.classes["@mozilla.org/widget/clipboardhelper;1"] + .getService(Components.interfaces.nsIClipboardHelper) + .copyString(str); + }, + /* * Adapted from http://developer.mozilla.org/en/docs/nsICryptoHash * @@ -571,4 +581,4 @@ Zotero.Utilities.Internal.Base64 = { return string; } - } -\ No newline at end of file + } diff --git a/chrome/locale/en-US/zotero/zotero.dtd b/chrome/locale/en-US/zotero/zotero.dtd @@ -126,6 +126,8 @@ <!ENTITY zotero.item.textTransform.titlecase "Title Case"> <!ENTITY zotero.item.textTransform.sentencecase "Sentence case"> <!ENTITY zotero.item.creatorTransform.nameSwap "Swap First/Last Names"> +<!ENTITY zotero.item.viewOnline "View Online"> +<!ENTITY zotero.item.copyAsURL "Copy as URL"> <!ENTITY zotero.toolbar.newNote "New Note"> <!ENTITY zotero.toolbar.note.standalone "New Standalone Note">