Addresses #401, Add keyboard shortcuts
Closes #371, OCLC OpenURL resolver lookup should be a manual operation Closes #341, Switch preferences to use prefwindow with multiple prefpanes - Keyboard shortcuts for various actions and interface elements while Zotero pane is open, editable via new preference pane (which needs a better icon) -- more coming - Switched keyboard shortcuts on Mac (including Zotero pane shortcut) back to Command-Shift, since apparently Command-Option-everything is more or less totally broken on OS X -- this does conflict with Redo on OS X, but people can change one of the two if they care. - Option (on by default) to try to override existing shortcuts, which should help with some conflicts (e.g. Web Developer extension has a lot) - Preferences now use prefwindow, which is totally buggy but when it works makes for a nicer and more platform-specific UI (e.g. preferences take effect immediately on OS X with no OK button) - "Search for Resolvers" button instead of automatic request - Zotero.Prefs.get() now takes a second 'global' param to easily get non-Zotero prefs - Focus tag selector on display
This commit is contained in:
parent
39025ab461
commit
c29a7abc00
|
@ -10,7 +10,7 @@
|
|||
orient="vertical"
|
||||
buttons="accept"
|
||||
buttonlabelaccept="&zotero.about.close;"
|
||||
onload="onLoad();"
|
||||
onload="moveToAlertPosition(); onLoad();"
|
||||
ondialogaccept="return true;">
|
||||
|
||||
<script>
|
||||
|
|
|
@ -177,6 +177,14 @@
|
|||
</body>
|
||||
</method>
|
||||
|
||||
<method name="focusTextbox">
|
||||
<body>
|
||||
<![CDATA[
|
||||
this.id('tags-search').focus();
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="id">
|
||||
<parameter name="id"/>
|
||||
<body>
|
||||
|
|
|
@ -33,6 +33,7 @@ var ZoteroPane = new function()
|
|||
this.onUnload = onUnload;
|
||||
this.toggleDisplay = toggleDisplay;
|
||||
this.fullScreen = fullScreen;
|
||||
this.handleKeyPress = handleKeyPress;
|
||||
this.newItem = newItem;
|
||||
this.newCollection = newCollection;
|
||||
this.newSearch = newSearch;
|
||||
|
@ -138,6 +139,8 @@ var ZoteroPane = new function()
|
|||
|
||||
var menu = document.getElementById("contentAreaContextMenu");
|
||||
menu.addEventListener("popupshowing", ZoteroPane.contextPopupShowing, false);
|
||||
|
||||
Zotero.Keys.windowInit(document);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -161,8 +164,10 @@ var ZoteroPane = new function()
|
|||
document.getElementById('zotero-pane').setAttribute('collapsed',!visible);
|
||||
document.getElementById('zotero-splitter').setAttribute('collapsed',!visible);
|
||||
|
||||
if(!visible)
|
||||
{
|
||||
if (visible) {
|
||||
document.getElementById('zotero-pane').focus();
|
||||
}
|
||||
else {
|
||||
document.getElementById('content').setAttribute('collapsed', false);
|
||||
document.getElementById('zotero-tb-fullscreen').setAttribute('fullscreenmode', false);
|
||||
|
||||
|
@ -180,7 +185,65 @@ var ZoteroPane = new function()
|
|||
document.getElementById('zotero-splitter').setAttribute('collapsed', !collapsed);
|
||||
document.getElementById('zotero-tb-fullscreen').setAttribute('fullscreenmode', !collapsed);
|
||||
}
|
||||
|
||||
|
||||
function handleKeyPress(event) {
|
||||
// Ignore keystrokes if Zotero pane is closed
|
||||
if (document.getElementById('zotero-pane').getAttribute('collapsed') == 'true') {
|
||||
return;
|
||||
}
|
||||
|
||||
var useShift = Zotero.isMac;
|
||||
|
||||
var key = String.fromCharCode(event.which);
|
||||
if (!key) {
|
||||
Zotero.debug('No key');
|
||||
return;
|
||||
}
|
||||
|
||||
// Ignore modifiers other than accel-alt (or accel-shift if useShift is on)
|
||||
if (!((Zotero.isMac ? event.metaKey : event.ctrlKey) &&
|
||||
useShift ? event.shiftKey : event.altKey)) {
|
||||
return;
|
||||
}
|
||||
|
||||
var command = Zotero.Keys.getCommand(key);
|
||||
if (!command) {
|
||||
return;
|
||||
}
|
||||
|
||||
Zotero.debug(command);
|
||||
|
||||
switch (command) {
|
||||
case 'library':
|
||||
document.getElementById('zotero-collections-tree').focus();
|
||||
collectionsView.selection.select(0);
|
||||
break;
|
||||
case 'quicksearch':
|
||||
document.getElementById('zotero-tb-search').focus();
|
||||
break;
|
||||
case 'newItem':
|
||||
newItem(2); // book
|
||||
document.getElementById('zotero-editpane-type-menu').focus();
|
||||
break;
|
||||
case 'newNote':
|
||||
// Use key that's not the modifier as the popup toggle
|
||||
newNote(useShift ? event.altKey : event.shiftKey);
|
||||
break;
|
||||
case 'toggleTagSelector':
|
||||
toggleTagSelector();
|
||||
break;
|
||||
case 'toggleFullscreen':
|
||||
fullScreen();
|
||||
break;
|
||||
default:
|
||||
throw ('Command "' + command + '" not found in ZoteroPane.handleKeyPress()');
|
||||
}
|
||||
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Create a new item
|
||||
*
|
||||
|
@ -252,6 +315,9 @@ var ZoteroPane = new function()
|
|||
tagSelector.init();
|
||||
}
|
||||
tagSelector.setAttribute('collapsed', !collapsed);
|
||||
if (collapsed) {
|
||||
tagSelector.focusTextbox();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -1033,7 +1099,7 @@ var ZoteroPane = new function()
|
|||
{
|
||||
if (!popup)
|
||||
{
|
||||
var item = this.newItem(Zotero.ItemTypes.getID('note'));
|
||||
var item = newItem(Zotero.ItemTypes.getID('note'));
|
||||
var note = document.getElementById('zotero-note-editor');
|
||||
try {
|
||||
// trim
|
||||
|
@ -1049,8 +1115,6 @@ var ZoteroPane = new function()
|
|||
|
||||
if (parent)
|
||||
{
|
||||
Zotero.debug(parent);
|
||||
Zotero.debug(item.getID());
|
||||
item.setSource(parent);
|
||||
selectItem(item.getID());
|
||||
}
|
||||
|
|
|
@ -107,8 +107,9 @@
|
|||
<menuitem id="zotero-tb-actions-export" label="&zotero.toolbar.export.label;" oncommand="Zotero_File_Interface.exportFile();"/>
|
||||
<menuseparator id="zotero-tb-actions-utilities-separator" hidden="true"/>
|
||||
<menuseparator id="zotero-tb-actions-separator"/>
|
||||
<menuitem id="zotero-tb-actions-prefs" label="&zotero.toolbar.preferences.label;" oncommand="window.openDialog('chrome://zotero/content/preferences.xul','zotero-prefs','chrome,modal')"/>
|
||||
<menuitem id="zotero-tb-actions-about" label="&zotero.toolbar.about.label;" oncommand="window.openDialog('chrome://zotero/content/about.xul','about','chrome,left=' + (window.screenX + 200) + ',top=' + (window.screenY + 100))"/>
|
||||
<menuitem id="zotero-tb-actions-prefs" label="&zotero.toolbar.preferences.label;"
|
||||
oncommand="window.openDialog('chrome://zotero/content/preferences.xul', 'zotero-prefs', 'chrome,titlebar,toolbar,' + Zotero.Prefs.get('browser.preferences.instantApply', true) ? 'dialog=no' : 'modal')"/>
|
||||
<menuitem id="zotero-tb-actions-about" label="&zotero.toolbar.about.label;" oncommand="window.openDialog('chrome://zotero/content/about.xul', 'about', 'chrome')"/>
|
||||
</menupopup>
|
||||
</toolbarbutton>
|
||||
</toolbar>
|
||||
|
@ -281,6 +282,8 @@
|
|||
document.getElementById('zotero-status-bar-icon').setAttribute('tooltiptext', 'There was an error starting Zotero.');
|
||||
}
|
||||
}, false);
|
||||
|
||||
document.getElementById('appcontent').addEventListener('keydown', ZoteroPane.handleKeyPress, true);
|
||||
</script>
|
||||
|
||||
<menupopup id="menu_ToolsPopup">
|
||||
|
@ -291,9 +294,13 @@
|
|||
</menupopup>
|
||||
|
||||
<keyset id="mainKeyset">
|
||||
<!--
|
||||
The key can be changed by the pref extensions.zotero.keys.openZotero,
|
||||
but if the values are changed here, the pref won't override them.
|
||||
-->
|
||||
<key id="key_openZotero"
|
||||
key="Z"
|
||||
oncommand="ZoteroPane.toggleDisplay();"
|
||||
modifiers="alt accel" />
|
||||
modifiers="accel alt" />
|
||||
</keyset>
|
||||
</overlay>
|
|
@ -20,13 +20,6 @@
|
|||
***** END LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
var autoUpdateBox;
|
||||
var reportTranslationFailure;
|
||||
var positionMenu;
|
||||
var parseEndnoteBox;
|
||||
var automaticSnapshots;
|
||||
var openURLMenu;
|
||||
var openURLResolvers;
|
||||
var openURLServerField;
|
||||
var openURLVersionMenu;
|
||||
var zoteroPaneOnTopInitial;
|
||||
|
@ -45,58 +38,49 @@ var zoteroPaneOnTopInitial;
|
|||
*/
|
||||
|
||||
function init()
|
||||
{
|
||||
autoUpdateBox = document.getElementById('autoUpdateBox');
|
||||
autoUpdateBox.checked = Zotero.Prefs.get('automaticScraperUpdates');
|
||||
|
||||
reportTranslationFailure = document.getElementById('reportTranslationFailure');
|
||||
reportTranslationFailure.checked = Zotero.Prefs.get('reportTranslationFailure');
|
||||
|
||||
positionMenu = document.getElementById('positionMenu');
|
||||
positionMenu.selectedIndex = zoteroPaneOnTopInitial = Zotero.Prefs.get('zoteroPaneOnTop') ? 0 : 1;
|
||||
|
||||
parseEndnoteBox = document.getElementById('parseEndnoteBox');
|
||||
parseEndnoteBox.checked = Zotero.Prefs.get('parseEndNoteMIMETypes');
|
||||
|
||||
automaticSnapshots = document.getElementById('automaticSnapshots');
|
||||
automaticSnapshots.checked = Zotero.Prefs.get('automaticSnapshots');
|
||||
|
||||
openURLServerField = document.getElementById('openURLServerField');
|
||||
openURLServerField.value = Zotero.Prefs.get('openURL.resolver');
|
||||
openURLVersionMenu = document.getElementById('openURLVersionMenu');
|
||||
openURLVersionMenu.value = Zotero.Prefs.get('openURL.version');
|
||||
|
||||
openURLMenu = document.getElementById('openURLMenu');
|
||||
|
||||
openURLResolvers = Zotero.OpenURL.discoverResolvers();
|
||||
for(var i in openURLResolvers)
|
||||
{
|
||||
openURLMenu.insertItemAt(i,openURLResolvers[i]['name']);
|
||||
if(openURLResolvers[i]['url'] == Zotero.Prefs.get('openURL.resolver') && openURLResolvers[i]['version'] == Zotero.Prefs.get('openURL.version'))
|
||||
openURLMenu.selectedIndex = i;
|
||||
}
|
||||
}
|
||||
|
||||
function accept()
|
||||
{
|
||||
Zotero.Prefs.set('automaticScraperUpdates', autoUpdateBox.checked);
|
||||
Zotero.Prefs.set('reportTranslationFailure', reportTranslationFailure.checked);
|
||||
Zotero.Prefs.set('zoteroPaneOnTop', positionMenu.selectedIndex == 0);
|
||||
|
||||
if(Zotero.Prefs.get('parseEndNoteMIMETypes') != parseEndnoteBox.checked)
|
||||
{
|
||||
Zotero.Prefs.set('parseEndNoteMIMETypes', parseEndnoteBox.checked);
|
||||
Zotero.Ingester.MIMEHandler.init();
|
||||
// Display the appropriate modifier keys for the platform
|
||||
var rows = document.getElementById('zotero-prefpane-keys').getElementsByTagName('row');
|
||||
for (var i=0; i<rows.length; i++) {
|
||||
rows[i].firstChild.nextSibling.value = Zotero.isMac ? 'Cmd+Shift+' : 'Ctrl+Alt+';
|
||||
}
|
||||
|
||||
Zotero.Prefs.set('automaticSnapshots', automaticSnapshots.checked);
|
||||
|
||||
Zotero.Prefs.set('openURL.resolver', openURLServerField.value);
|
||||
Zotero.Prefs.set('openURL.version', openURLVersionMenu.value);
|
||||
zoteroPaneOnTopInitial = Zotero.Prefs.get('zoteroPaneOnTop') ? 0 : 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
function populateOpenURLResolvers() {
|
||||
var openURLMenu = document.getElementById('openURLMenu');
|
||||
|
||||
var openURLResolvers = Zotero.OpenURL.discoverResolvers();
|
||||
for each(var r in openURLResolvers) {
|
||||
openURLMenu.insertItemAt(i, r.name);
|
||||
if (r.url == Zotero.Prefs.get('openURL.resolver') && r.version == Zotero.Prefs.get('openURL.version')) {
|
||||
openURLMenu.selectedIndex = i;
|
||||
}
|
||||
}
|
||||
|
||||
var button = document.getElementById('openURLSearchButton');
|
||||
switch (openURLResolvers.length) {
|
||||
case 0:
|
||||
var num = 'zero';
|
||||
break;
|
||||
case 1:
|
||||
var num = 'singular';
|
||||
break;
|
||||
default:
|
||||
var num = 'plural';
|
||||
}
|
||||
|
||||
button.setAttribute('label', Zotero.getString('zotero.preferences.openurl.resolversFound.' + num, openURLResolvers.length));
|
||||
}
|
||||
|
||||
|
||||
function onOpenURLSelected()
|
||||
{
|
||||
var openURLMenu = document.getElementById('openURLMenu');
|
||||
|
||||
if(openURLMenu.value == "custom")
|
||||
{
|
||||
openURLServerField.focus();
|
||||
|
@ -110,13 +94,13 @@ function onOpenURLSelected()
|
|||
|
||||
function onOpenURLCustomized()
|
||||
{
|
||||
openURLMenu.value = "custom";
|
||||
document.getElementById('openURLMenu').value = "custom";
|
||||
}
|
||||
|
||||
function onPositionChange()
|
||||
{
|
||||
var statusLine = document.getElementById('statusLine');
|
||||
if (positionMenu.selectedIndex != zoteroPaneOnTopInitial)
|
||||
if (document.getElementById('positionMenu').selectedIndex != zoteroPaneOnTopInitial)
|
||||
{
|
||||
statusLine.value = Zotero.getString('zotero.preferences.status.positionChange');
|
||||
}
|
||||
|
|
|
@ -20,68 +20,149 @@
|
|||
|
||||
***** END LICENSE BLOCK *****
|
||||
-->
|
||||
<!DOCTYPE window SYSTEM "chrome://zotero/locale/preferences.dtd">
|
||||
<!DOCTYPE prefwindow SYSTEM "chrome://zotero/locale/preferences.dtd">
|
||||
|
||||
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://global/skin/global.css"?>
|
||||
<?xml-stylesheet href="chrome://browser/skin/preferences/preferences.css"?>
|
||||
<?xml-stylesheet href="chrome://zotero/skin/preferences.css"?>
|
||||
|
||||
<!-- TODO: change to prefWindow? -->
|
||||
<dialog id="winMain" title="&zotero.preferences.title;" style="min-width:400px;"
|
||||
windowtype="zotero:pref" onload="init();" ondialogaccept="accept()"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
|
||||
<script src="preferences.js"/>
|
||||
<script src="include.js"/>
|
||||
|
||||
<dialogheader id="header" title="Zotero" description="&zotero.preferences.title;"/>
|
||||
|
||||
<hbox align="center">
|
||||
<label value="&zotero.preferences.position.label;" control="positionMenu"/>
|
||||
<menulist id="positionMenu" oncommand="onPositionChange()">
|
||||
<menupopup>
|
||||
<menuitem label="&zotero.preferences.position.above;"/>
|
||||
<menuitem label="&zotero.preferences.position.below;"/>
|
||||
</menupopup>
|
||||
</menulist>
|
||||
<label value="&zotero.preferences.position.browser;"/>
|
||||
</hbox>
|
||||
|
||||
<hbox align="center">
|
||||
<checkbox id="autoUpdateBox" label="&zotero.preferences.autoUpdate.label;"/>
|
||||
<button id="updateButton" style="margin-top:0" label="&zotero.preferences.updateNow.label;" oncommand="Zotero.Schema.updateScrapersRemote(true)"/>
|
||||
</hbox>
|
||||
|
||||
<checkbox id="reportTranslationFailure" label="&zotero.preferences.reportTranslationFailure.label;"/>
|
||||
|
||||
<checkbox id="parseEndnoteBox" label="&zotero.preferences.parseEndnote.label;"/>
|
||||
|
||||
<checkbox id="automaticSnapshots" label="&zotero.preferences.automaticSnapshots.label;"/>
|
||||
|
||||
<groupbox>
|
||||
<caption label="&zotero.preferences.openurl.caption;"/>
|
||||
<prefwindow id="zotero-prefs" title="&zotero.preferences.title;" onload="moveToAlertPosition(); init()"
|
||||
windowtype="zotero:pref" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
|
||||
<menulist id="openURLMenu" oncommand="onOpenURLSelected();">
|
||||
<menupopup>
|
||||
<menuseparator/>
|
||||
<menuitem label="Custom..." value="custom" selected="true"/>
|
||||
</menupopup>
|
||||
</menulist>
|
||||
<prefpane id="zotero-prefpane-general" label="&zotero.preferences.prefpane.general;">
|
||||
<preferences>
|
||||
<preference id="pref-zoteroPaneOnTop" name="extensions.zotero.zoteroPaneOnTop" type="bool"/>
|
||||
<preference id="pref-automaticScraperUpdates" name="extensions.zotero.automaticScraperUpdates" type="bool"/>
|
||||
<preference id="pref-reportTranslationFailure" name="extensions.zotero.reportTranslationFailure" type="bool"/>
|
||||
<preference id="pref-parseEndNoteMIMETypes" name="extensions.zotero.parseEndNoteMIMETypes" type="bool" onchange="Zotero.Ingester.MIMEHandler.init()"/>
|
||||
<preference id="pref-automaticSnapshots" name="extensions.zotero.automaticSnapshots" type="bool"/>
|
||||
<preference id="pref-openURL-resolver" name="extensions.zotero.openURL.resolver" type="string"/>
|
||||
<preference id="pref-openURL-version" name="extensions.zotero.openURL.version" type="string"/>
|
||||
</preferences>
|
||||
|
||||
<hbox align="center">
|
||||
<label value="&zotero.preferences.position;" control="positionMenu"/>
|
||||
<menulist id="positionMenu" oncommand="onPositionChange()" preference="pref-zoteroPaneOnTop">
|
||||
<menupopup>
|
||||
<menuitem label="&zotero.preferences.position.above;" value="true"/>
|
||||
<menuitem label="&zotero.preferences.position.below;" value="false"/>
|
||||
</menupopup>
|
||||
</menulist>
|
||||
<label value="&zotero.preferences.position.browser;"/>
|
||||
</hbox>
|
||||
|
||||
<hbox align="center">
|
||||
<checkbox label="&zotero.preferences.autoUpdate;" preference="pref-automaticScraperUpdates"/>
|
||||
<button id="updateButton" style="margin-top:0" label="&zotero.preferences.updateNow;" oncommand="Zotero.Schema.updateScrapersRemote(true)"/>
|
||||
</hbox>
|
||||
|
||||
<checkbox label="&zotero.preferences.reportTranslationFailure;" preference="pref-reportTranslationFailure"/>
|
||||
|
||||
<checkbox label="&zotero.preferences.parseEndnote;" preference="pref-parseEndNoteMIMETypes"/>
|
||||
|
||||
<checkbox label="&zotero.preferences.automaticSnapshots;" preference="pref-automaticSnapshots"/>
|
||||
|
||||
<groupbox>
|
||||
<caption label="&zotero.preferences.openurl.caption;"/>
|
||||
|
||||
<button id="openURLSearchButton" label="Search for resolvers" oncommand="populateOpenURLResolvers()"/>
|
||||
<menulist id="openURLMenu" oncommand="onOpenURLSelected();">
|
||||
<menupopup>
|
||||
<menuseparator/>
|
||||
<menuitem label="&zotero.preferences.openurl.custom;" value="custom" selected="true"/>
|
||||
</menupopup>
|
||||
</menulist>
|
||||
|
||||
<hbox align="center">
|
||||
<label value="&zotero.preferences.openurl.server;"/>
|
||||
<textbox id="openURLServerField" flex="1" oninput="onOpenURLCustomized();" preference="pref-openURL-resolver"/>
|
||||
</hbox>
|
||||
|
||||
<hbox align="center">
|
||||
<label value="&zotero.preferences.openurl.version;" control="openURLVersionMenu"/>
|
||||
<menulist id="openURLVersionMenu" oncommand="onOpenURLCustomized();" preference="pref-openURL-version">
|
||||
<menupopup>
|
||||
<menuitem label="0.1" value="0.1"/>
|
||||
<menuitem label="1.0" value="1.0"/>
|
||||
</menupopup>
|
||||
</menulist>
|
||||
</hbox>
|
||||
</groupbox>
|
||||
|
||||
<label id="statusLine" value=""/>
|
||||
</prefpane>
|
||||
|
||||
<hbox align="center">
|
||||
<label value="&zotero.preferences.openurl.server;"/>
|
||||
<textbox id="openURLServerField" flex="1" oninput="onOpenURLCustomized();"/>
|
||||
</hbox>
|
||||
|
||||
<hbox align="center">
|
||||
<label value="&zotero.preferences.openurl.version;"/>
|
||||
<menulist id="openURLVersionMenu" oncommand="onOpenURLCustomized();">
|
||||
<menupopup>
|
||||
<menuitem label="0.1" value="0.1"/>
|
||||
<menuitem label="1.0" value="1.0"/>
|
||||
</menupopup>
|
||||
</menulist>
|
||||
</hbox>
|
||||
</groupbox>
|
||||
|
||||
<label id="statusLine" value="" style="color:red"/>
|
||||
|
||||
</dialog>
|
||||
<prefpane id="zotero-prefpane-keys" label="&zotero.preferences.prefpane.keys;">
|
||||
<preferences>
|
||||
<preference id="pref-keys-openZotero" name="extensions.zotero.keys.openZotero" type="string"/>
|
||||
<preference id="pref-keys-toggleFullscreen" name="extensions.zotero.keys.toggleFullscreen" type="string"/>
|
||||
<preference id="pref-keys-library" name="extensions.zotero.keys.library" type="string"/>
|
||||
<preference id="pref-keys-quicksearch" name="extensions.zotero.keys.quicksearch" type="string"/>
|
||||
<preference id="pref-keys-newItem" name="extensions.zotero.keys.newItem" type="string"/>
|
||||
<preference id="pref-keys-newNote" name="extensions.zotero.keys.newNote" type="string"/>
|
||||
<preference id="pref-keys-toggleTagSelector" name="extensions.zotero.keys.toggleTagSelector" type="string"/>
|
||||
<preference id="pref-keys-overrideGlobal" name="extensions.zotero.keys.overrideGlobal" type="bool"/>
|
||||
</preferences>
|
||||
|
||||
<grid>
|
||||
<columns>
|
||||
<column flex="1"/>
|
||||
<column/>
|
||||
<column/>
|
||||
</columns>
|
||||
|
||||
<rows>
|
||||
<row>
|
||||
<label value="&zotero.preferences.keys.openZotero;" control="key-textbox-openZotero"/>
|
||||
<label/>
|
||||
<textbox id="textbox-openZotero" maxlength="1" size="1" preference="pref-keys-openZotero"/>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<label value="&zotero.preferences.keys.toggleFullscreen;" control="textbox-toggleFullscreen"/>
|
||||
<label/>
|
||||
<textbox id="textbox-toggleFullscreen" maxlength="1" size="1" preference="pref-keys-toggleFullscreen"/>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<label value="&zotero.preferences.keys.library;" control="textbox-library"/>
|
||||
<label/>
|
||||
<textbox id="textbox-library" maxlength="1" size="1" preference="pref-keys-library"/>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<label value="&zotero.preferences.keys.quicksearch;" control="textbox-quicksearch"/>
|
||||
<label/>
|
||||
<textbox id="textbox-quicksearch" maxlength="1" size="1" preference="pref-keys-quicksearch"/>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<label value="&zotero.preferences.keys.newItem;" control="textbox-newItem"/>
|
||||
<label/>
|
||||
<textbox id="textbox-newItem" maxlength="1" size="1" preference="pref-keys-newItem"/>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<label value="&zotero.preferences.keys.newNote;" control="textbox-newNote"/>
|
||||
<label/>
|
||||
<textbox id="textbox-newNote" maxlength="1" size="1" preference="pref-keys-newNote"/>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<label value="&zotero.preferences.keys.toggleTagSelector;" control="textbox-toggleTagSelector"/>
|
||||
<label/>
|
||||
<textbox id="textbox-toggleTagSelector" maxlength="1" size="1" preference="pref-keys-toggleTagSelector"/>
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
|
||||
<checkbox label="&zotero.preferences.keys.overrideGlobal;" preference="pref-keys-overrideGlobal"/>
|
||||
|
||||
<label class="statusLine" value="&zotero.preferences.keys.changesTakeEffect;"/>
|
||||
</prefpane>
|
||||
|
||||
<!-- These mess up the prefwindow if they come before the prefpanes
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=296418 -->
|
||||
<script src="include.js"/>
|
||||
<script src="preferences.js"/>
|
||||
</prefwindow>
|
|
@ -122,6 +122,8 @@ var Zotero = new function(){
|
|||
.getService(Components.interfaces.nsIStringBundleService);
|
||||
_localizedStringBundle = stringBundleService.createBundle(src, appLocale);
|
||||
|
||||
Zotero.Keys.init();
|
||||
|
||||
// Add notifier queue callbacks to the DB layer
|
||||
Zotero.DB.addCallback('begin', Zotero.Notifier.begin);
|
||||
Zotero.DB.addCallback('commit', Zotero.Notifier.commit);
|
||||
|
@ -356,7 +358,7 @@ var Zotero = new function(){
|
|||
|
||||
function getString(name, params){
|
||||
try {
|
||||
if (params){
|
||||
if (params != undefined){
|
||||
if (typeof params != 'object'){
|
||||
params = [params];
|
||||
}
|
||||
|
@ -543,7 +545,7 @@ Zotero.Prefs = new function(){
|
|||
this.observe = observe;
|
||||
|
||||
// Public properties
|
||||
this.prefBranch; // set in Zotero.init()
|
||||
this.prefBranch;
|
||||
|
||||
function init(){
|
||||
var prefs = Components.classes["@mozilla.org/preferences-service;1"]
|
||||
|
@ -558,8 +560,16 @@ Zotero.Prefs = new function(){
|
|||
/**
|
||||
* Retrieve a preference
|
||||
**/
|
||||
function get(pref){
|
||||
function get(pref, global){
|
||||
try {
|
||||
if (global) {
|
||||
var service = Components.classes["@mozilla.org/preferences-service;1"]
|
||||
.getService(Components.interfaces.nsIPrefService);
|
||||
}
|
||||
else {
|
||||
var service = this.prefBranch;
|
||||
}
|
||||
|
||||
switch (this.prefBranch.getPrefType(pref)){
|
||||
case this.prefBranch.PREF_BOOL:
|
||||
return this.prefBranch.getBoolPref(pref);
|
||||
|
@ -630,6 +640,77 @@ Zotero.Prefs = new function(){
|
|||
}
|
||||
|
||||
|
||||
Zotero.Keys = new function() {
|
||||
this.init = init;
|
||||
this.windowInit = windowInit;
|
||||
this.getCommand = getCommand;
|
||||
|
||||
_actions = ['library', 'quicksearch', 'newItem', 'newNote', 'toggleTagSelector',
|
||||
'toggleFullscreen'];
|
||||
_keys = {};
|
||||
|
||||
|
||||
function init() {
|
||||
// Get the key=>command mappings from the prefs
|
||||
for each (var action in _actions) {
|
||||
_keys[Zotero.Prefs.get('keys.' + action)] = action;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function windowInit(document) {
|
||||
var useShift = Zotero.isMac;
|
||||
|
||||
// Zotero pane shortcut
|
||||
var zKey = Zotero.Prefs.get('keys.openZotero');
|
||||
var keyElem = document.getElementById('key_openZotero');
|
||||
// Only override the default with the pref if the <key> hasn't been manually changed
|
||||
// and the pref has been
|
||||
if (keyElem.getAttribute('key') == 'Z' && keyElem.getAttribute('modifiers') == 'accel alt'
|
||||
&& (zKey != 'Z' || useShift)) {
|
||||
keyElem.setAttribute('key', zKey);
|
||||
if (useShift) {
|
||||
keyElem.setAttribute('modifiers', 'accel shift');
|
||||
}
|
||||
}
|
||||
|
||||
if (Zotero.Prefs.get('keys.overrideGlobal')) {
|
||||
var keys = document.getElementsByTagName('key');
|
||||
for each(var key in keys) {
|
||||
try {
|
||||
var id = key.getAttribute('id');
|
||||
}
|
||||
// A couple keys are always invalid
|
||||
catch (e) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (id == 'key_openZotero') {
|
||||
continue;
|
||||
}
|
||||
|
||||
var mods = key.getAttribute('modifiers').split(/[\,\s]/);
|
||||
var second = useShift ? 'shift' : 'alt';
|
||||
// Key doesn't match a Zotero shortcut
|
||||
if (mods.length != 2 || !((mods[0] == 'accel' && mods[1] == second) ||
|
||||
(mods[0] == second && mods[1] == 'accel'))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (_keys[key.getAttribute('key')] || key.getAttribute('key') == zKey) {
|
||||
Zotero.debug('Removing key ' + id + ' with accesskey ' + key.getAttribute('key'));
|
||||
key.parentNode.removeChild(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function getCommand(key) {
|
||||
return _keys[key] ? _keys[key] : false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Class for creating hash arrays that behave a bit more sanely
|
||||
|
|
|
@ -1,13 +1,27 @@
|
|||
<!ENTITY zotero.preferences.title "Zotero Preferences">
|
||||
<!ENTITY zotero.preferences.autoUpdate.label "Automatically check for updated scrapers">
|
||||
<!ENTITY zotero.preferences.updateNow.label "Update now">
|
||||
<!ENTITY zotero.preferences.reportTranslationFailure.label "Report broken site translators">
|
||||
<!ENTITY zotero.preferences.position.label "Display Zotero">
|
||||
<!ENTITY zotero.preferences.position.above "above">
|
||||
<!ENTITY zotero.preferences.position.below "below">
|
||||
<!ENTITY zotero.preferences.position.browser "browser content">
|
||||
<!ENTITY zotero.preferences.parseEndnote.label "Use Zotero for downloaded EndNote files">
|
||||
<!ENTITY zotero.preferences.automaticSnapshots.label "Automatically take snapshots when creating items from web pages">
|
||||
<!ENTITY zotero.preferences.openurl.caption "OpenURL">
|
||||
<!ENTITY zotero.preferences.openurl.server "Resolver:">
|
||||
<!ENTITY zotero.preferences.openurl.version "Version:">
|
||||
<!ENTITY zotero.preferences.title "Zotero Preferences">
|
||||
|
||||
<!ENTITY zotero.preferences.prefpane.general "General">
|
||||
<!ENTITY zotero.preferences.autoUpdate "Automatically check for updated scrapers">
|
||||
<!ENTITY zotero.preferences.updateNow "Update now">
|
||||
<!ENTITY zotero.preferences.reportTranslationFailure "Report broken site translators">
|
||||
<!ENTITY zotero.preferences.position "Display Zotero">
|
||||
<!ENTITY zotero.preferences.position.above "above">
|
||||
<!ENTITY zotero.preferences.position.below "below">
|
||||
<!ENTITY zotero.preferences.position.browser "browser content">
|
||||
<!ENTITY zotero.preferences.parseEndnote "Use Zotero for downloaded EndNote files">
|
||||
<!ENTITY zotero.preferences.automaticSnapshots "Automatically take snapshots when creating items from web pages">
|
||||
<!ENTITY zotero.preferences.openurl.caption "OpenURL">
|
||||
<!ENTITY zotero.preferences.openurl.custom "Custom...">
|
||||
<!ENTITY zotero.preferences.openurl.server "Resolver:">
|
||||
<!ENTITY zotero.preferences.openurl.version "Version:">
|
||||
|
||||
<!ENTITY zotero.preferences.prefpane.keys "Shortcut Keys">
|
||||
<!ENTITY zotero.preferences.keys.openZotero "Open/Close Zotero Pane">
|
||||
<!ENTITY zotero.preferences.keys.toggleFullscreen "Toggle Fullscreen Mode">
|
||||
<!ENTITY zotero.preferences.keys.library "Library">
|
||||
<!ENTITY zotero.preferences.keys.quicksearch "Quick Search">
|
||||
<!ENTITY zotero.preferences.keys.newItem "Create a new item">
|
||||
<!ENTITY zotero.preferences.keys.newNote "Create a new note">
|
||||
<!ENTITY zotero.preferences.keys.toggleTagSelector "Toggle Tag Selector">
|
||||
<!ENTITY zotero.preferences.keys.overrideGlobal "Try to override conflicting shortcuts">
|
||||
<!ENTITY zotero.preferences.keys.changesTakeEffect "Changes take effect in new windows only">
|
|
@ -213,6 +213,9 @@ zotero.preferences.update.updated = Updated
|
|||
zotero.preferences.update.upToDate = Up to date
|
||||
zotero.preferences.update.error = Error
|
||||
zotero.preferences.status.positionChange = Position change will take effect in new windows only
|
||||
zotero.preferences.openurl.resolversFound.zero = %S resolvers found
|
||||
zotero.preferences.openurl.resolversFound.singular = %S resolver found
|
||||
zotero.preferences.openurl.resolversFound.plural = %S resolvers found
|
||||
|
||||
fileInterface.itemsImported = Importing items...
|
||||
fileInterface.itemsExported = Exporting items...
|
||||
|
|
59
chrome/skin/default/zotero/preferences.css
Normal file
59
chrome/skin/default/zotero/preferences.css
Normal file
|
@ -0,0 +1,59 @@
|
|||
prefwindow .chromeclass-toolbar
|
||||
{
|
||||
display: -moz-box !important; /* Ignore toolbar collapse button on OS X */
|
||||
}
|
||||
|
||||
radio[pane=zotero-prefpane-general]
|
||||
{
|
||||
-moz-image-region: rect(0px, 32px, 32px, 0px);
|
||||
}
|
||||
radio[pane=zotero-prefpane-general]:hover,
|
||||
radio[pane=zotero-prefpane-general]:active,
|
||||
radio[pane=zotero-prefpane-general][selected="true"]
|
||||
{
|
||||
-moz-image-region: rect(32px, 32px, 64px, 0px);
|
||||
}
|
||||
|
||||
/* Use the Gear icon until we find a keyboard icon */
|
||||
radio[pane=zotero-prefpane-keys]
|
||||
{
|
||||
-moz-image-region: rect(0px, 224px, 32px, 192px);
|
||||
}
|
||||
radio[pane=zotero-prefpane-keys]:hover,
|
||||
radio[pane=zotero-prefpane-keys]:active,
|
||||
radio[pane=zotero-prefpane-keys][selected="true"]
|
||||
{
|
||||
-moz-image-region: rect(32px, 224px, 64px, 192px);
|
||||
}
|
||||
|
||||
|
||||
/* General pane */
|
||||
|
||||
#statusLine
|
||||
{
|
||||
margin-bottom:.75em;
|
||||
color: red;
|
||||
}
|
||||
|
||||
|
||||
/* Shortcut Keys pane */
|
||||
#zotero-prefpane-keys row
|
||||
{
|
||||
-moz-box-align: center;
|
||||
}
|
||||
|
||||
#zotero-prefpane-keys textbox
|
||||
{
|
||||
margin-left: -1px;
|
||||
}
|
||||
|
||||
#zotero-prefpane-keys checkbox
|
||||
{
|
||||
margin: .75em 0;
|
||||
}
|
||||
|
||||
#zotero-prefpane-keys .statusLine
|
||||
{
|
||||
margin: .75em 0;
|
||||
font-size: 10px;
|
||||
}
|
|
@ -14,3 +14,13 @@ pref("extensions.zotero.downloadAssociatedFiles",false);
|
|||
pref("extensions.zotero.reportTranslationFailure",true);
|
||||
pref("extensions.zotero.enableMacClipboard",false);
|
||||
pref("extensions.zotero.lastCreatorFieldMode",0);
|
||||
|
||||
// Keyboard shortcuts
|
||||
pref("extensions.zotero.keys.overrideGlobal", true);
|
||||
pref("extensions.zotero.keys.openZotero", 'Z');
|
||||
pref("extensions.zotero.keys.toggleFullscreen", 'F');
|
||||
pref("extensions.zotero.keys.library", 'L');
|
||||
pref("extensions.zotero.keys.quicksearch", 'K');
|
||||
pref("extensions.zotero.keys.newItem", 'N');
|
||||
pref("extensions.zotero.keys.newNote", 'O');
|
||||
pref("extensions.zotero.keys.toggleTagSelector", 'T');
|
||||
|
|
Loading…
Reference in New Issue
Block a user