diff --git a/css/app.css b/css/app.css
index 355fd7262..44d7d7dbf 100644
--- a/css/app.css
+++ b/css/app.css
@@ -1333,7 +1333,6 @@ a.success-action {
color: #222;
font-size: 10px;
padding: 0px 7px;
- text-transform: uppercase;
font-weight: bold;
display: inline-block;
border-radius: 2px;
diff --git a/index.html b/index.html
index 08cd1c9db..8c084cf77 100644
--- a/index.html
+++ b/index.html
@@ -60,6 +60,7 @@
+
diff --git a/js/id/ui.js b/js/id/ui.js
index ecab88470..7214628b4 100644
--- a/js/id/ui.js
+++ b/js/id/ui.js
@@ -200,20 +200,14 @@ iD.ui = function(context) {
}
}
- var mod = {
- 'mac': '⌘',
- 'win': 'Ctrl',
- 'linux': 'Ctrl'
- }[iD.detect().os];
-
limiter.select('#undo')
.classed('disabled', !undo)
- .attr('data-original-title', hintprefix(mod + ' + Z', undo || t('nothing_to_undo')))
+ .attr('data-original-title', hintprefix(iD.ui.cmd('⌘Z'), undo || t('nothing_to_undo')))
.call(refreshTooltip);
limiter.select('#redo')
.classed('disabled', !redo)
- .attr('data-original-title', hintprefix(mod + ' + ⇧ + Z', redo || t('nothing_to_redo')))
+ .attr('data-original-title', hintprefix(iD.ui.cmd('⌘⇧Z'), redo || t('nothing_to_redo')))
.call(refreshTooltip);
});
@@ -232,16 +226,14 @@ iD.ui = function(context) {
var pa = 5;
var keybinding = d3.keybinding('main')
- .on('⌘+Z', function() { history.undo(); })
- .on('⌃+Z', function() { history.undo(); })
- .on('⌘+⇧+Z', function() { history.redo(); })
- .on('⌃+⇧+Z', function() { history.redo(); })
+ .on(iD.ui.cmd('⌘Z'), function() { history.undo(); })
+ .on(iD.ui.cmd('⌘⇧Z'), function() { history.redo(); })
.on('⌫', function() { d3.event.preventDefault(); })
.on('←', pan([pa, 0]))
.on('↑', pan([0, pa]))
.on('→', pan([-pa, 0]))
.on('↓', pan([0, -pa]))
- .on('⇧+=', function() { map.zoomIn(); })
+ .on('⇧=', function() { map.zoomIn(); })
.on('+', function() { map.zoomIn(); })
.on('-', function() { map.zoomOut(); })
.on('dash', function() { map.zoomOut(); });
diff --git a/js/id/ui/cmd.js b/js/id/ui/cmd.js
new file mode 100644
index 000000000..9876da236
--- /dev/null
+++ b/js/id/ui/cmd.js
@@ -0,0 +1,22 @@
+// Translate a MacOS key command into the appropriate Windows/Linux equivalent.
+// For example, ⌘Z -> Ctrl+Z
+iD.ui.cmd = function(code) {
+ if (iD.detect().os === 'mac')
+ return code;
+
+ var modifiers = {
+ '⌘': 'Ctrl',
+ '⇧': 'Shift',
+ '⌥': 'Alt'
+ }, keys = [];
+
+ for (var i = 0; i < code.length; i++) {
+ if (code[i] in modifiers) {
+ keys.push(modifiers[code[i]]);
+ } else {
+ keys.push(code[i]);
+ }
+ }
+
+ return keys.join('+');
+};
diff --git a/js/lib/d3.keybinding.js b/js/lib/d3.keybinding.js
index b1106c976..6aa39fb39 100644
--- a/js/lib/d3.keybinding.js
+++ b/js/lib/d3.keybinding.js
@@ -63,7 +63,7 @@ d3.keybinding = function(namespace) {
callback: callback
};
- code = code.toLowerCase().match(/(?:(?:[^+])+|\+\+|^\+$)/g);
+ code = code.toLowerCase().match(/(?:(?:[^+⇧⌃⌥⌘])+|[⇧⌃⌥⌘]|\+\+|^\+$)/g);
for (var i = 0; i < code.length; i++) {
// Normalise matching errors