add keyboard shortcut for zen mode
parent
5ba9a2f512
commit
2af36a8edf
|
@ -127,7 +127,7 @@
|
|||
}
|
||||
#dasher_app .selector a:hover::before {
|
||||
opacity: 1;
|
||||
color: #fff;
|
||||
color: #3893E8;
|
||||
}
|
||||
#dasher_app .selector a.active::before {
|
||||
opacity: 1;
|
||||
|
|
|
@ -77,7 +77,10 @@ export default function(ctrl: DasherCtrl): VNode {
|
|||
const zenToggle = ctrl.opts.playing ? h('div.zen.selector', [
|
||||
h('a', {
|
||||
class: { active: !!ctrl.data.zen },
|
||||
attrs: { 'data-icon': ctrl.data.zen ? 'E' : 'K' },
|
||||
attrs: {
|
||||
'data-icon': ctrl.data.zen ? 'E' : 'K',
|
||||
title: 'Keyboard: z'
|
||||
},
|
||||
hook: bind('click', ctrl.toggleZen)
|
||||
}, noarg('zenMode'))
|
||||
]) : null;
|
||||
|
|
|
@ -645,6 +645,14 @@ export default class RoundController {
|
|||
}
|
||||
};
|
||||
|
||||
toggleZen = () => {
|
||||
if (game.isPlayerPlaying(this.data)) {
|
||||
const zen = !$('body').hasClass('zen');
|
||||
$('body').toggleClass('zen', zen)
|
||||
$.post('/pref/zen', { zen: zen ? 1 : 0 });
|
||||
}
|
||||
}
|
||||
|
||||
private delayedInit = () => {
|
||||
if (game.isPlayerPlaying(this.data) && game.nbMoves(this.data, this.data.player.color) === 0 && !this.isSimulHost()) {
|
||||
li.sound.genericNotify();
|
||||
|
|
|
@ -39,4 +39,5 @@ export function init(ctrl: RoundController) {
|
|||
ctrl.redraw();
|
||||
}));
|
||||
k.bind('f', preventing(ctrl.flipNow));
|
||||
k.bind('z', preventing(ctrl.toggleZen));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue