Add DOI-field context-menu

This commit is contained in:
rmzelle 2015-05-14 20:33:52 -04:00
parent 7a93b132b3
commit 4bdef75074
3 changed files with 24 additions and 1 deletions

View file

@ -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">

View file

@ -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;
}
}
}

View file

@ -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">