mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-10-06 05:26:54 +08:00
added a scrollbar to the command line
This commit is contained in:
parent
54038ea427
commit
d4074fffdb
2 changed files with 36 additions and 30 deletions
|
@ -322,6 +322,9 @@ a:hover {
|
|||
line-height: 0.75rem;
|
||||
}
|
||||
.suggestions {
|
||||
display: block;
|
||||
overflow-y: scroll;
|
||||
max-height: calc(100vh - 10rem - 3rem);
|
||||
display: grid;
|
||||
.entry {
|
||||
padding: 0.5rem 1rem;
|
||||
|
|
|
@ -13,6 +13,33 @@ let commands = {
|
|||
restartTest();
|
||||
}
|
||||
},
|
||||
{
|
||||
id: "changeMode",
|
||||
display: "Change mode...",
|
||||
subgroup: true,
|
||||
exec: () => {
|
||||
currentCommands.push(commandsMode);
|
||||
showCommandLine();
|
||||
}
|
||||
},
|
||||
{
|
||||
id: "changeTimeConfig",
|
||||
display: "Change time config...",
|
||||
subgroup: true,
|
||||
exec: () => {
|
||||
currentCommands.push(commandsTimeConfig);
|
||||
showCommandLine();
|
||||
}
|
||||
},
|
||||
{
|
||||
id: "changeWordCount",
|
||||
display: "Change word count...",
|
||||
subgroup: true,
|
||||
exec: () => {
|
||||
currentCommands.push(commandsWordCount);
|
||||
showCommandLine();
|
||||
}
|
||||
},
|
||||
{
|
||||
visible: false,
|
||||
id: "changeTags",
|
||||
|
@ -98,7 +125,7 @@ let commands = {
|
|||
},
|
||||
{
|
||||
id: "toggleColorfulMode",
|
||||
display: "Toggle extra test color",
|
||||
display: "Toggle colorful mode",
|
||||
exec: () => {
|
||||
toggleColorfulMode();
|
||||
}
|
||||
|
@ -114,7 +141,7 @@ let commands = {
|
|||
},
|
||||
{
|
||||
id: "changeCaretStyle",
|
||||
display: "Change caret...",
|
||||
display: "Change caret style...",
|
||||
subgroup: true,
|
||||
exec: () => {
|
||||
currentCommands.push(commandsCaretStyle);
|
||||
|
@ -123,7 +150,7 @@ let commands = {
|
|||
},
|
||||
{
|
||||
id: "changeTimerStyle",
|
||||
display: "Change timer...",
|
||||
display: "Change timer style...",
|
||||
subgroup: true,
|
||||
exec: () => {
|
||||
currentCommands.push(commandsTimerStyle);
|
||||
|
@ -166,33 +193,6 @@ let commands = {
|
|||
showCommandLine();
|
||||
}
|
||||
},
|
||||
{
|
||||
id: "changeMode",
|
||||
display: "Change mode...",
|
||||
subgroup: true,
|
||||
exec: () => {
|
||||
currentCommands.push(commandsMode);
|
||||
showCommandLine();
|
||||
}
|
||||
},
|
||||
{
|
||||
id: "changeTimeConfig",
|
||||
display: "Change time config...",
|
||||
subgroup: true,
|
||||
exec: () => {
|
||||
currentCommands.push(commandsTimeConfig);
|
||||
showCommandLine();
|
||||
}
|
||||
},
|
||||
{
|
||||
id: "changeWordCount",
|
||||
display: "Change word count...",
|
||||
subgroup: true,
|
||||
exec: () => {
|
||||
currentCommands.push(commandsWordCount);
|
||||
showCommandLine();
|
||||
}
|
||||
},
|
||||
{
|
||||
id: "joinDiscord",
|
||||
display: "Join the Discord server",
|
||||
|
@ -700,6 +700,9 @@ $(document).keydown((e) => {
|
|||
hoverId = $(entries[activenum]).attr('command');
|
||||
}
|
||||
}
|
||||
let scroll = Math.abs($('.suggestions').offset().top - $('.entry.activeKeyboard').offset().top - $('.suggestions').scrollTop()) - ($('.suggestions').outerHeight() / 2) + ($($('.entry')[0]).outerHeight());
|
||||
$('.suggestions').scrollTop(scroll);
|
||||
console.log(`scrolling to ${scroll}`);
|
||||
try {
|
||||
let list = currentCommands[currentCommands.length-1];
|
||||
$.each(list.list, (index, obj) => {
|
||||
|
|
Loading…
Add table
Reference in a new issue