commit dc8998c5bc1e582173420efae7647c3add82d62c
parent f0c5c50bd4949e68b5b7dd1d954a9034d16fe844
Author: Dan Stillman <dstillman@zotero.org>
Date: Wed, 31 Jul 2013 23:19:19 -0400
Add Firefox-wide shortcut (Ctrl/Cmd-Shift-S) for "Save to Zotero"
Also: Don't show Firefox-specific shortcut keys in Standalone prefs
Diffstat:
8 files changed, 108 insertions(+), 48 deletions(-)
diff --git a/chrome.manifest b/chrome.manifest
@@ -54,6 +54,7 @@ overlay chrome://zotero/content/preferences/preferences.xul chrome://zotero/cont
overlay chrome://zotero/content/preferences/preferences.xul#cite chrome://zotero/content/preferences/preferences_firefox.xul application={ec8030f7-c20a-464f-9b0e-13a3a9e97384}
overlay chrome://zotero/content/preferences/preferences_general.xul chrome://zotero/content/preferences/preferences_general_firefox.xul application={ec8030f7-c20a-464f-9b0e-13a3a9e97384}
overlay chrome://zotero/content/preferences/preferences_export.xul chrome://zotero/content/preferences/preferences_export_firefox.xul application={ec8030f7-c20a-464f-9b0e-13a3a9e97384}
+overlay chrome://zotero/content/preferences/preferences_keys.xul chrome://zotero/content/preferences/preferences_keys_firefox.xul application={ec8030f7-c20a-464f-9b0e-13a3a9e97384}
overlay chrome://zotero/content/preferences/preferences_advanced.xul chrome://zotero/content/preferences/preferences_advanced_firefox.xul application={ec8030f7-c20a-464f-9b0e-13a3a9e97384}
overlay chrome://zotero/content/preferences/preferences_advanced.xul chrome://zotero/content/preferences/preferences_advanced_standalone.xul application=zotero@chnm.gmu.edu
diff --git a/chrome/content/zotero/overlay.xul b/chrome/content/zotero/overlay.xul
@@ -95,5 +95,9 @@
key="Z"
oncommand="ZoteroOverlay.toggleDisplay();"
modifiers="accel shift" />
+ <key id="key_saveToZotero"
+ key="S"
+ oncommand="Zotero_Browser.scrapeThisPage();"
+ modifiers="accel shift" />
</keyset>
</overlay>
diff --git a/chrome/content/zotero/preferences/preferences_keys.js b/chrome/content/zotero/preferences/preferences_keys.js
@@ -27,9 +27,9 @@
Zotero_Preferences.Keys = {
init: function () {
- // 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++) {
+ // Display the appropriate modifier keys for the platform
rows[i].firstChild.nextSibling.value = Zotero.isMac ? 'Cmd+Shift+' : 'Ctrl+Shift+';
}
}
diff --git a/chrome/content/zotero/preferences/preferences_keys.xul b/chrome/content/zotero/preferences/preferences_keys.xul
@@ -31,38 +31,45 @@
helpTopic="shortcut_keys">
<preferences>
<preference id="pref-keys-openZotero" name="extensions.zotero.keys.openZotero" type="string"/>
+ <preference id="pref-keys-saveToZotero" name="extensions.zotero.keys.saveToZotero" 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-toggleTagSelector" name="extensions.zotero.keys.toggleTagSelector" 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-importFromClipboard" name="extensions.zotero.keys.importFromClipboard" type="string"/>
<preference id="pref-keys-copySelectedItemCitationsToClipboard" name="extensions.zotero.keys.copySelectedItemCitationsToClipboard" type="string"/>
<preference id="pref-keys-copySelectedItemsToClipboard" name="extensions.zotero.keys.copySelectedItemsToClipboard" type="string"/>
- <preference id="pref-keys-importFromClipboard" name="extensions.zotero.keys.importFromClipboard" type="string"/>
</preferences>
- <grid>
+ <grid id="zotero-keys-grid">
<columns>
<column flex="1"/>
<column/>
<column/>
</columns>
- <rows>
- <row>
- <label value="&zotero.preferences.keys.openZotero;" control="key-textbox-openZotero"/>
+ <rows id="zotero-keys-rows">
+ <row id="zotero-keys-new-item">
+ <label value="&zotero.preferences.keys.newItem;" control="textbox-newItem"/>
<label/>
- <textbox id="textbox-openZotero" maxlength="1" size="1" preference="pref-keys-openZotero"/>
+ <textbox id="textbox-newItem" maxlength="1" size="1" preference="pref-keys-newItem"/>
</row>
<row>
- <label value="&zotero.preferences.keys.toggleFullscreen;" control="textbox-toggleFullscreen"/>
+ <label value="&zotero.preferences.keys.newNote;" control="textbox-newNote"/>
<label/>
- <textbox id="textbox-toggleFullscreen" maxlength="1" size="1" preference="pref-keys-toggleFullscreen"/>
+ <textbox id="textbox-newNote" maxlength="1" size="1" preference="pref-keys-newNote"/>
</row>
<row>
+ <label value="&zotero.preferences.keys.importFromClipboard;" control="textbox-importFromClipboard"/>
+ <label/>
+ <textbox id="textbox-importFromClipboard" maxlength="1" size="1" preference="pref-keys-importFromClipboard"/>
+ </row>
+
+ <row id="zotero-keys-focus-libraries-pane">
<label value="&zotero.preferences.keys.focusLibrariesPane;" control="textbox-library"/>
<label/>
<textbox id="textbox-library" maxlength="1" size="1" preference="pref-keys-library"/>
@@ -75,24 +82,6 @@
</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>
-
- <row>
<label value="&zotero.preferences.keys.copySelectedItemCitationsToClipboard;" control="textbox-copySelectedItemCitationsToClipboard"/>
<label/>
<textbox id="textbox-copySelectedItemCitationsToClipboard" maxlength="1" size="1"
@@ -109,9 +98,9 @@
</row>
<row>
- <label value="&zotero.preferences.keys.importFromClipboard;" control="textbox-importFromClipboard"/>
+ <label value="&zotero.preferences.keys.toggleTagSelector;" control="textbox-toggleTagSelector"/>
<label/>
- <textbox id="textbox-importFromClipboard" maxlength="1" size="1" preference="pref-keys-importFromClipboard"/>
+ <textbox id="textbox-toggleTagSelector" maxlength="1" size="1" preference="pref-keys-toggleTagSelector"/>
</row>
</rows>
</grid>
diff --git a/chrome/content/zotero/preferences/preferences_keys_firefox.xul b/chrome/content/zotero/preferences/preferences_keys_firefox.xul
@@ -0,0 +1,52 @@
+<?xml version="1.0"?>
+<!--
+ ***** BEGIN LICENSE BLOCK *****
+
+ Copyright © 2006–2013 Center for History and New Media
+ George Mason University, Fairfax, Virginia, USA
+ http://zotero.org
+
+ This file is part of Zotero.
+
+ Zotero is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ Zotero is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with Zotero. If not, see <http://www.gnu.org/licenses/>.
+
+ ***** END LICENSE BLOCK *****
+-->
+<!DOCTYPE prefwindow SYSTEM "chrome://zotero/locale/preferences.dtd">
+
+<overlay xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+ <prefpane id="zotero-prefpane-keys">
+ <grid id="zotero-keys-grid">
+ <rows id="zotero-keys-rows">
+ <row position="1">
+ <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 position="2">
+ <label value="&zotero.preferences.keys.toggleFullscreen;" control="textbox-toggleFullscreen"/>
+ <label/>
+ <textbox id="textbox-toggleFullscreen" maxlength="1" size="1" preference="pref-keys-toggleFullscreen"/>
+ </row>
+
+ <row insertbefore="zotero-keys-new-item">
+ <label value="&zotero.preferences.keys.saveToZotero;" control="key-textbox-saveToZotero"/>
+ <label/>
+ <textbox id="textbox-saveToZotero" maxlength="1" size="1" preference="pref-keys-saveToZotero"/>
+ </row>
+ </rows>
+ </grid>
+ </prefpane>
+</overlay>
diff --git a/chrome/content/zotero/xpcom/zotero.js b/chrome/content/zotero/xpcom/zotero.js
@@ -2294,6 +2294,7 @@ Zotero.Keys = new function() {
// Get the key=>command mappings from the prefs
for each(var action in actions) {
var action = action.substr(5); // strips 'keys.'
+ // Remove old pref
if (action == 'overrideGlobal') {
Zotero.Prefs.clear('keys.overrideGlobal');
continue;
@@ -2307,18 +2308,30 @@ Zotero.Keys = new function() {
* Called by ZoteroPane.onLoad()
*/
function windowInit(document) {
- // Zotero pane shortcut
- var keyElem = document.getElementById('key_openZotero');
- if(keyElem) {
- var zKey = Zotero.Prefs.get('keys.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 shift'
- && zKey != 'Z') {
- keyElem.setAttribute('key', zKey);
+ var globalKeys = [
+ {
+ name: 'openZotero',
+ defaultKey: 'Z'
+ },
+ {
+ name: 'saveToZotero',
+ defaultKey: 'S'
}
- }
+ ];
+
+ globalKeys.forEach(function (x) {
+ let keyElem = document.getElementById('key_' + x.name);
+ if (keyElem) {
+ let prefKey = Zotero.Prefs.get('keys.' + x.name);
+ // Only override the default with the pref if the <key> hasn't
+ // been manually changed and the pref has been
+ if (keyElem.getAttribute('key') == x.defaultKey
+ && keyElem.getAttribute('modifiers') == 'accel shift'
+ && prefKey != x.defaultKey) {
+ keyElem.setAttribute('key', prefKey);
+ }
+ }
+ });
}
diff --git a/chrome/locale/en-US/zotero/preferences.dtd b/chrome/locale/en-US/zotero/preferences.dtd
@@ -126,16 +126,16 @@
<!ENTITY zotero.preferences.prefpane.keys "Shortcuts">
<!ENTITY zotero.preferences.keys.openZotero "Open/Close Zotero Pane">
+<!ENTITY zotero.preferences.keys.saveToZotero "Save to Zotero (address bar icon)">
<!ENTITY zotero.preferences.keys.toggleFullscreen "Toggle Fullscreen Mode">
<!ENTITY zotero.preferences.keys.focusLibrariesPane "Focus Libraries Pane">
<!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.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.copySelectedItemCitationsToClipboard "Copy Selected Item Citations to Clipboard">
<!ENTITY zotero.preferences.keys.copySelectedItemsToClipboard "Copy Selected Items to Clipboard">
<!ENTITY zotero.preferences.keys.importFromClipboard "Import from Clipboard">
-<!ENTITY zotero.preferences.keys.overrideGlobal "Try to override conflicting shortcuts">
<!ENTITY zotero.preferences.keys.changesTakeEffect "Changes take effect in new windows only">
<!ENTITY zotero.preferences.prefpane.proxies "Proxies">
diff --git a/defaults/preferences/zotero.js b/defaults/preferences/zotero.js
@@ -65,14 +65,15 @@ pref("extensions.zotero.tagCloud", false);
// Keyboard shortcuts
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.saveToZotero", 'S');
pref("extensions.zotero.keys.newItem", 'N');
pref("extensions.zotero.keys.newNote", 'O');
-pref("extensions.zotero.keys.toggleTagSelector", 'T');
+pref("extensions.zotero.keys.importFromClipboard", 'V');
+pref("extensions.zotero.keys.library", 'L');
+pref("extensions.zotero.keys.quicksearch", 'K');
pref("extensions.zotero.keys.copySelectedItemCitationsToClipboard", 'A');
pref("extensions.zotero.keys.copySelectedItemsToClipboard", 'C');
-pref("extensions.zotero.keys.importFromClipboard", 'V');
+pref("extensions.zotero.keys.toggleTagSelector", 'T');
// Fulltext indexing
pref("extensions.zotero.fulltext.textMaxLength", 500000);