Skip to content

Commit

Permalink
use <esc> for full-page menu
Browse files Browse the repository at this point in the history
  • Loading branch information
ornicar committed Mar 30, 2015
1 parent d76ce83 commit 4d38a22
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
1 change: 1 addition & 0 deletions app/views/base/layout.scala.html
Expand Up @@ -50,6 +50,7 @@
ctx.pref.destination ?? "destination",
ctx.blindMode ?? "blind_mode",
"coords_" + ctx.pref.coords).mkString(" ")"
data-user="@ctx.userId"
data-piece-set="@ctx.currentPieceSet"
data-sound-dir="@routes.Assets.at("sound")"
data-ports="@portsString"
Expand Down
24 changes: 13 additions & 11 deletions public/javascripts/big.js
Expand Up @@ -961,20 +961,22 @@ lichess.storage = {
$('#hamburger').click(function() {
document.body.classList.toggle('fpmenu');
});
Mousetrap.bind('space', function() {
Mousetrap.bind('esc', function() {
$('#hamburger').click();
return false;
});
if (!lichess.storage.get('ham')) {
var $help = $('<span class="help">' +
'← Click the menu icon or press the space key!' +
'</span>');
$('#ham-plate').append($help.fadeIn(2000));
$('#hamburger').click(function() {
$help.remove();
lichess.storage.set('ham', 1);
});
}
(function(key) {
if (!lichess.storage.get(key)) {
var $help = $('<span class="help">' +
'← Click the menu icon or press the &lt;escape&gt; key!' +
'</span>');
$('#ham-plate').append($help.fadeIn(2000));
$('#hamburger').click(function() {
$help.remove();
lichess.storage.set(key, 1);
});
}
})('ham-' + document.body.getAttribute('data-user'));
});

$.lazy = function(factory) {
Expand Down

0 comments on commit 4d38a22

Please sign in to comment.