disable pgn4web hotkeys

This commit is contained in:
Thibault Duplessis 2014-03-18 14:23:04 +01:00
parent 84ff5bf4e5
commit c3d42f707c
2 changed files with 6 additions and 256 deletions

View file

@ -24,10 +24,10 @@
<div class="shortcuts">
<p class="title">Shortcuts</p>
<ul>
<li><strong>h</strong> or <strong>arrow-up</strong> go to game start</li>
<li><strong>j</strong> or <strong>arrow-left</strong> move backward</li>
<li><strong>k</strong> or <strong>arrow-right</strong> move forward</li>
<li><strong>l</strong> or <strong>arrow-down</strong> go to game end</li>
<li><strong>j</strong>/<strong>k</strong> or <strong></strong>/<strong></strong> move backward/forward</li>
<li><strong>h</strong>/<strong>l</strong> or <strong>↑/</strong><strong></strong> go to start/end</li>
<li><strong>i</strong>/<strong>o</strong> go to previous/next mistake</li>
<li><strong>p</strong> show/hide comments</li>
</ul>
You can also scroll over the board to move in the game.
</div>

View file

@ -290,48 +290,7 @@ function pgn4web_handleKey(e) {
switch (keycode) {
case 8: // backspace
case 9: // tab
case 16: // shift
case 17: // ctrl
case 18: // alt
case 32: // space
case 33: // page-up
case 34: // page-down
case 35: // end
case 36: // home
case 92: // super
case 93: // menu
case 188: // comma
return true;
case 27: // escape
if (e.shiftKey) {
interactivelyToggleShortcutKeys();
} else {
displayHelp();
}
break;
case 189: // dash
if (colRowList = prompt("Enter shortcut square coordinates to click:", "")) {
colRowList = colRowList.toUpperCase().replace(/[^A-Z0-9]/g, "");
while (colRow = colRowFromSquare(colRowList)) {
boardOnClick[colRow.col][colRow.row]({
"id": "img_tcol" + colRow.col + "trow" + colRow.row
}, e);
colRowList = colRowList.substr(2);
}
}
break;
case 90: // z
if (e.shiftKey) {
window.open(pgn4web_project_url);
} else {
displayDebugInfo();
}
break;
// thib hack: removed lots of key bindings
case 37: // left-arrow
case 74: // j
@ -361,217 +320,8 @@ function pgn4web_handleKey(e) {
MoveToNextComment(e.shiftKey);
break;
case 190: // dot
if (e.shiftKey) {
goToFirstChild();
} else {
goToNextVariationSibling();
}
break;
case 85: // u
if (e.shiftKey) {
undoStackRedo();
} else {
undoStackUndo();
}
break;
case 45: // insert
undoStackRedo();
break;
case 46: // delete
undoStackUndo();
break;
case 83: // s
if (e.shiftKey) {
searchPgnGame("");
} else {
searchPgnGamePrompt();
}
break;
case 13: // enter
if (e.shiftKey) {
searchPgnGame(lastSearchPgnExpression, true);
} else {
searchPgnGame(lastSearchPgnExpression);
}
break;
case 68: // d
if (e.shiftKey) {
displayFenData();
} else {
displayPgnData(true);
}
break;
case 187: // equal
SwitchAutoPlay();
break;
case 65: // a
GoToMove(CurrentPly + 1);
SetAutoPlay(true);
break;
case 48: // 0
if (e.shiftKey) {
customShortcutKey_Shift_0();
} else {
SetAutoPlay(false);
}
break;
case 49: // 1
if (e.shiftKey) {
customShortcutKey_Shift_1();
} else {
SetAutoplayDelayAndStart(1 * 1000);
}
break;
case 50: // 2
if (e.shiftKey) {
customShortcutKey_Shift_2();
} else {
SetAutoplayDelayAndStart(2 * 1000);
}
break;
case 51: // 3
if (e.shiftKey) {
customShortcutKey_Shift_3();
} else {
SetAutoplayDelayAndStart(3 * 1000);
}
break;
case 52: // 4
if (e.shiftKey) {
customShortcutKey_Shift_4();
} else {
SetAutoplayDelayAndStart(4 * 1000);
}
break;
case 53: // 5
if (e.shiftKey) {
customShortcutKey_Shift_5();
} else {
SetAutoplayDelayAndStart(5 * 1000);
}
break;
case 54: // 6
if (e.shiftKey) {
customShortcutKey_Shift_6();
} else {
SetAutoplayDelayAndStart(6 * 1000);
}
break;
case 55: // 7
if (e.shiftKey) {
customShortcutKey_Shift_7();
} else {
SetAutoplayDelayAndStart(7 * 1000);
}
break;
case 56: // 8
if (e.shiftKey) {
customShortcutKey_Shift_8();
} else {
SetAutoplayDelayAndStart(8 * 1000);
}
break;
case 57: // 9
if (e.shiftKey) {
customShortcutKey_Shift_9();
} else {
setCustomAutoplayDelay();
}
break;
case 81: // q
SetAutoplayDelayAndStart(10 * 1000);
break;
case 87: // w
SetAutoplayDelayAndStart(20 * 1000);
break;
case 69: // e
SetAutoplayDelayAndStart(30 * 1000);
break;
case 82: // r
pauseLiveBroadcast();
break;
case 84: // t
if (e.shiftKey) {
LiveBroadcastSteppingMode = !LiveBroadcastSteppingMode;
} else {
refreshPgnSource();
}
break;
case 89: // y
restartLiveBroadcast();
break;
case 70: // f
if (!e.shiftKey || IsRotated) {
FlipBoard();
}
break;
case 71: // g
SetHighlight(!highlightOption);
break;
case 88: // x
randomGameRandomPly();
break;
case 67: // c
if (numberOfGames > 1) {
Init(Math.floor(Math.random() * numberOfGames));
}
break;
case 86: // v
if (numberOfGames > 1) {
Init(0);
}
break;
case 66: // b
Init(currentGame - 1);
break;
case 78: // n
Init(currentGame + 1);
break;
case 77: // m
if (numberOfGames > 1) {
Init(numberOfGames - 1);
}
break;
case 80: // p
if (e.shiftKey) {
SetCommentsOnSeparateLines(!commentsOnSeparateLines);
} else {
SetCommentsIntoMoveText(!commentsIntoMoveText);
}
SetCommentsIntoMoveText(!commentsIntoMoveText);
oldPly = CurrentPly;
oldVar = CurrentVar;
Init();