Add tooltip ("Save to Zotero") to the scrape icon, with the translator used in parentheses (e.g. "Save to Zotero (Library Catalog (Voyager))" to help with user debugging
Also added a few things to help with right-to-left languages: - chromedir attribute on zotero-pane - Zotero.dir property containing 'ltr' or 'rtl' - Zotero.localeJoin(arr, separator=' ') to join an array into a string in the proper locale order
This commit is contained in:
parent
4a4577ff5a
commit
f749e5272c
|
@ -420,6 +420,7 @@ var Zotero_Browser = new function() {
|
||||||
var captureIcon = tab.getCaptureIcon();
|
var captureIcon = tab.getCaptureIcon();
|
||||||
if(captureIcon) {
|
if(captureIcon) {
|
||||||
Zotero_Browser.statusImage.src = captureIcon;
|
Zotero_Browser.statusImage.src = captureIcon;
|
||||||
|
Zotero_Browser.statusImage.tooltipText = tab.getCaptureTooltip();
|
||||||
Zotero_Browser.statusImage.hidden = false;
|
Zotero_Browser.statusImage.hidden = false;
|
||||||
} else {
|
} else {
|
||||||
Zotero_Browser.statusImage.hidden = true;
|
Zotero_Browser.statusImage.hidden = true;
|
||||||
|
@ -664,6 +665,19 @@ Zotero_Browser.Tab.prototype.getCaptureIcon = function() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Zotero_Browser.Tab.prototype.getCaptureTooltip = function() {
|
||||||
|
if (this.page.translators && this.page.translators.length) {
|
||||||
|
var arr = [Zotero.getString('ingester.saveToZotero')];
|
||||||
|
if (this.page.translators[0].itemType == 'multiple') {
|
||||||
|
arr.push('...');
|
||||||
|
}
|
||||||
|
arr.push (' ' , '(' + this.page.translators[0].label + ')');
|
||||||
|
return Zotero.localeJoin(arr, '');
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**********CALLBACKS**********/
|
/**********CALLBACKS**********/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -21,7 +21,13 @@
|
||||||
***** END LICENSE BLOCK *****
|
***** END LICENSE BLOCK *****
|
||||||
-->
|
-->
|
||||||
<?xml-stylesheet href="chrome://zotero/skin/overlay.css" type="text/css"?>
|
<?xml-stylesheet href="chrome://zotero/skin/overlay.css" type="text/css"?>
|
||||||
<!DOCTYPE window SYSTEM "chrome://zotero/locale/zotero.dtd">
|
|
||||||
|
<!DOCTYPE window [
|
||||||
|
<!ENTITY % globalDTD SYSTEM "chrome://global/locale/global.dtd">
|
||||||
|
%globalDTD;
|
||||||
|
<!ENTITY % zoteroDTD SYSTEM "chrome://zotero/locale/zotero.dtd">
|
||||||
|
%zoteroDTD;
|
||||||
|
]>
|
||||||
|
|
||||||
<overlay id="zotero"
|
<overlay id="zotero"
|
||||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||||
|
@ -73,7 +79,8 @@
|
||||||
onmouseup="ZoteroPane.updateTagSelectorSize()"/>
|
onmouseup="ZoteroPane.updateTagSelectorSize()"/>
|
||||||
<hbox id="zotero-pane" persist="savedHeight" hidden="true"
|
<hbox id="zotero-pane" persist="savedHeight" hidden="true"
|
||||||
onkeydown="ZoteroPane.handleKeyDown(event, this.id)"
|
onkeydown="ZoteroPane.handleKeyDown(event, this.id)"
|
||||||
onkeyup="ZoteroPane.handleKeyUp(event, this.id)">
|
onkeyup="ZoteroPane.handleKeyUp(event, this.id)"
|
||||||
|
chromedir="&locale.dir;">
|
||||||
<popupset>
|
<popupset>
|
||||||
<popup id="zotero-collectionmenu" onpopupshowing="ZoteroPane.buildCollectionContextMenu();">
|
<popup id="zotero-collectionmenu" onpopupshowing="ZoteroPane.buildCollectionContextMenu();">
|
||||||
<menuitem label="&zotero.toolbar.newCollection.label;" oncommand="ZoteroPane.newCollection()"/>
|
<menuitem label="&zotero.toolbar.newCollection.label;" oncommand="ZoteroPane.newCollection()"/>
|
||||||
|
|
|
@ -48,6 +48,7 @@ var Zotero = new function(){
|
||||||
this.varDump = varDump;
|
this.varDump = varDump;
|
||||||
this.safeDebug = safeDebug;
|
this.safeDebug = safeDebug;
|
||||||
this.getString = getString;
|
this.getString = getString;
|
||||||
|
this.localeJoin = localeJoin;
|
||||||
this.getLocaleCollation = getLocaleCollation;
|
this.getLocaleCollation = getLocaleCollation;
|
||||||
this.setFontSize = setFontSize;
|
this.setFontSize = setFontSize;
|
||||||
this.flattenArguments = flattenArguments;
|
this.flattenArguments = flattenArguments;
|
||||||
|
@ -69,6 +70,7 @@ var Zotero = new function(){
|
||||||
this.version;
|
this.version;
|
||||||
this.platform;
|
this.platform;
|
||||||
this.locale;
|
this.locale;
|
||||||
|
this.dir; // locale direction: 'ltr' or 'rtl'
|
||||||
this.isMac;
|
this.isMac;
|
||||||
this.isWin;
|
this.isWin;
|
||||||
this.initialURL; // used by Schema to show the changelog on upgrades
|
this.initialURL; // used by Schema to show the changelog on upgrades
|
||||||
|
@ -143,8 +145,17 @@ var Zotero = new function(){
|
||||||
var stringBundleService =
|
var stringBundleService =
|
||||||
Components.classes["@mozilla.org/intl/stringbundle;1"]
|
Components.classes["@mozilla.org/intl/stringbundle;1"]
|
||||||
.getService(Components.interfaces.nsIStringBundleService);
|
.getService(Components.interfaces.nsIStringBundleService);
|
||||||
|
|
||||||
_localizedStringBundle = stringBundleService.createBundle(src, appLocale);
|
_localizedStringBundle = stringBundleService.createBundle(src, appLocale);
|
||||||
|
|
||||||
|
// Set the locale direction to Zotero.dir
|
||||||
|
// DEBUG: is there a better way to get the entity from JS?
|
||||||
|
var xmlhttp = Components.classes["@mozilla.org/xmlextras/xmlhttprequest;1"]
|
||||||
|
.createInstance();
|
||||||
|
xmlhttp.open('GET', 'chrome://global/locale/global.dtd', false);
|
||||||
|
xmlhttp.send(null);
|
||||||
|
this.dir = xmlhttp.responseText.match(/(ltr|rtl)/)[0];
|
||||||
|
|
||||||
try {
|
try {
|
||||||
this.getZoteroDirectory();
|
this.getZoteroDirectory();
|
||||||
}
|
}
|
||||||
|
@ -589,6 +600,24 @@ var Zotero = new function(){
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Join the elements of an array into a string using the appropriate
|
||||||
|
* locale direction
|
||||||
|
*
|
||||||
|
* |separator| defaults to a space (not a comma like Array.join()) if
|
||||||
|
* not specified
|
||||||
|
*/
|
||||||
|
function localeJoin(arr, separator) {
|
||||||
|
if (typeof separator == 'undefined') {
|
||||||
|
separator = ' ';
|
||||||
|
}
|
||||||
|
if (this.dir == 'rtl') {
|
||||||
|
str.reverse();
|
||||||
|
}
|
||||||
|
return arr.join(separator);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function getLocaleCollation() {
|
function getLocaleCollation() {
|
||||||
var localeService = Components.classes["@mozilla.org/intl/nslocaleservice;1"]
|
var localeService = Components.classes["@mozilla.org/intl/nslocaleservice;1"]
|
||||||
.getService(Components.interfaces.nsILocaleService);
|
.getService(Components.interfaces.nsILocaleService);
|
||||||
|
|
|
@ -316,6 +316,7 @@ fileTypes.document = Document
|
||||||
save.attachment = Saving Snapshot...
|
save.attachment = Saving Snapshot...
|
||||||
save.link = Saving Link...
|
save.link = Saving Link...
|
||||||
|
|
||||||
|
ingester.saveToZotero = Save to Zotero
|
||||||
ingester.scraping = Saving Item...
|
ingester.scraping = Saving Item...
|
||||||
ingester.scrapeComplete = Item Saved
|
ingester.scrapeComplete = Item Saved
|
||||||
ingester.scrapeError = Could Not Save Item
|
ingester.scrapeError = Could Not Save Item
|
||||||
|
|
Loading…
Reference in New Issue
Block a user