Skip to content

Commit

Permalink
Split shortcut into shortcutLabel and ariaKeyShortcuts
Browse files Browse the repository at this point in the history
((?://|\s)*)shortcut: "(.*)",
->
$1shortcutLabel: "$2",
$1ariaKeyShortcuts: "$2",

Fix up ariaKeyShortcuts

(?<=ariaKeyShortcuts: ")Ctrl
->
Control

ariaKeyShortcuts: "Alt\+(Left|Right|Up|Down) Arrow"
->
ariaKeyShortcuts: "Alt+Arrow$1"

ariaKeyShortcuts: "Del",
->
ariaKeyShortcuts: "Delete",
  • Loading branch information
1j01 committed Jun 27, 2024
1 parent 3a0c059 commit a61e9f4
Show file tree
Hide file tree
Showing 7 changed files with 104 additions and 52 deletions.
6 changes: 4 additions & 2 deletions programs/calculator/menus.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ var menus = {
"&Edit": [
{
label: "&Copy",
shortcut: "Ctrl+C",
shortcutLabel: "Ctrl+C",
ariaKeyShortcuts: "Control+C",
enabled: () => {
return !!navigator.clipboard.writeText;
},
Expand All @@ -14,7 +15,8 @@ var menus = {
},
{
label: "&Paste",
shortcut: "Ctrl+V",
shortcutLabel: "Ctrl+V",
ariaKeyShortcuts: "Control+V",
enabled: () => {
return !!navigator.clipboard.readText;
},
Expand Down
36 changes: 24 additions & 12 deletions programs/explorer/menus.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,19 +165,22 @@ var menus = {
MENU_DIVIDER,
{
label: "Cu&t",
shortcut: "Ctrl+X",
shortcutLabel: "Ctrl+X",
ariaKeyShortcuts: "Control+X",
enabled: false, // @TODO
description: "Removes the selected items and copies them onto the Clipboard.",
},
{
label: "&Copy",
shortcut: "Ctrl+C",
shortcutLabel: "Ctrl+C",
ariaKeyShortcuts: "Control+C",
enabled: false, // @TODO
description: "Copies the selected items to the Clipboard. To put them in the new location, use the Paste command.",
},
{
label: "&Paste",
shortcut: "Ctrl+V",
shortcutLabel: "Ctrl+V",
ariaKeyShortcuts: "Control+V",
enabled: false, // @TODO
description: "Inserts the items you have copied or cut into the selected location.",
},
Expand All @@ -189,7 +192,8 @@ var menus = {
MENU_DIVIDER,
{
label: "Select &All",
shortcut: "Ctrl+A",
shortcutLabel: "Ctrl+A",
ariaKeyShortcuts: "Control+A",
action: function () {
folder_view.select_all();
folder_view.focus();
Expand Down Expand Up @@ -272,7 +276,8 @@ var menus = {
submenu: [
{
label: "&Search",
shortcut: "Ctrl+E",
shortcutLabel: "Ctrl+E",
ariaKeyShortcuts: "Control+E",
checkbox: {
check: ()=> false,
toggle: ()=> {}, // @TODO
Expand All @@ -282,7 +287,8 @@ var menus = {
},
{
label: "&Favorites",
shortcut: "Ctrl+I",
shortcutLabel: "Ctrl+I",
ariaKeyShortcuts: "Control+I",
checkbox: {
check: ()=> false,
toggle: ()=> {}, // @TODO
Expand All @@ -292,7 +298,8 @@ var menus = {
},
{
label: "&History",
shortcut: "Ctrl+H",
shortcutLabel: "Ctrl+H",
ariaKeyShortcuts: "Control+H",
checkbox: {
check: ()=> false,
toggle: ()=> {}, // @TODO
Expand Down Expand Up @@ -393,7 +400,8 @@ var menus = {
MENU_DIVIDER,
{
label: "&Refresh",
shortcut: "F5",
shortcutLabel: "F5",
ariaKeyShortcuts: "F5",
action: () => {
refresh();
},
Expand All @@ -409,7 +417,8 @@ var menus = {
// description: "Contains commands for browsing to various pages.",
{
label: "&Back",
shortcut: "Alt+Left Arrow",
shortcutLabel: "Alt+Left Arrow",
ariaKeyShortcuts: "Alt+ArrowLeft",
action: () => {
go_back();
},
Expand All @@ -418,7 +427,8 @@ var menus = {
},
{
label: "&Forward",
shortcut: "Alt+Right Arrow",
shortcutLabel: "Alt+Right Arrow",
ariaKeyShortcuts: "Alt+ArrowRight",
action: () => {
go_forward();
},
Expand All @@ -427,7 +437,8 @@ var menus = {
},
{
label: "&Up One Level",
// shortcut: "Alt+Up Arrow",
// shortcutLabel: "Alt+Up Arrow",
// ariaKeyShortcuts: "Alt+ArrowUp",
action: () => {
go_up();
},
Expand All @@ -437,7 +448,8 @@ var menus = {
MENU_DIVIDER,
{
label: "&Home Page",
shortcut: "Alt+Home",
shortcutLabel: "Alt+Home",
ariaKeyShortcuts: "Alt+Home",
action: () => {
go_home();
},
Expand Down
15 changes: 10 additions & 5 deletions programs/js-solitaire/src/menus.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,36 +3,41 @@ var menus = {
"&Game": [
{
label: "&Deal",
shortcut: "F2",
shortcutLabel: "F2",
ariaKeyShortcuts: "F2",
action: ()=> { resetGame(); },
description: "Deal a new game",
},
// Don't want to imply you can undo by showing this option
// {
// label: "&Undo",
// shortcut: "",
// shortcutLabel: "",
// ariaKeyShortcuts: "",
// enabled: false,
// action: ()=> { undo(); },
// description: "Undo last action",
// },
{
label: "De&ck...",
shortcut: "",
shortcutLabel: "",
ariaKeyShortcuts: "",
enabled: false,
action: ()=> {},
description: "Choose new deck back",
},
{
label: "&Options...",
shortcut: "",
shortcutLabel: "",
ariaKeyShortcuts: "",
enabled: false,
action: ()=> {},
description: "Change Solitaire options",
},
MENU_DIVIDER,
{
label: "E&xit",
shortcut: "",
shortcutLabel: "",
ariaKeyShortcuts: "",
action: ()=> {
close();
},
Expand Down
3 changes: 2 additions & 1 deletion programs/minesweeper/menus.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ var menus = {
"&Game": [
{
label: "&New",
// shortcut: "F2", // TODO
// shortcutLabel: "F2",
// ariaKeyShortcuts: "F2", // TODO
action: function(){
minesweeper_.restart();
},
Expand Down
54 changes: 36 additions & 18 deletions programs/notepad/src/menus.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,29 @@ var menus = {
// also, it leaves off periods from the end of the descriptions
{
label: "&New",
shortcut: "Ctrl+N",
shortcutLabel: "Ctrl+N",
ariaKeyShortcuts: "Control+N",
action: file_new,
description: "Creates a new document.",
},
{
label: "&Open...",
shortcut: "Ctrl+O",
shortcutLabel: "Ctrl+O",
ariaKeyShortcuts: "Control+O",
action: file_open,
description: "Opens an existing document.",
},
{
label: "&Save",
shortcut: "Ctrl+S",
shortcutLabel: "Ctrl+S",
ariaKeyShortcuts: "Control+S",
action: file_save,
description: "Saves the active document.",
},
{
label: "Save &As...",
shortcut: "Ctrl+Shift+S",
shortcutLabel: "Ctrl+Shift+S",
ariaKeyShortcuts: "Control+Shift+S",
action: file_save_as,
description: "Saves the active document with a new name.",
},
Expand All @@ -46,7 +50,8 @@ var menus = {
},
{
label: "&Print...",
shortcut: "Ctrl+P",
shortcutLabel: "Ctrl+P",
ariaKeyShortcuts: "Control+P",
action: function () {
print();
},
Expand All @@ -61,7 +66,8 @@ var menus = {
MENU_DIVIDER,
{
label: "E&xit",
// shortcut: "Alt+F4",
// shortcutLabel: "Alt+F4",
// ariaKeyShortcuts: "Alt+F4",
action: function () {
close();
},
Expand All @@ -71,7 +77,8 @@ var menus = {
"&Edit": [
{
label: "&Undo",
shortcut: "Ctrl+Z",
shortcutLabel: "Ctrl+Z",
ariaKeyShortcuts: "Control+Z",
enabled: function () {
return document.queryCommandEnabled("undo");
},
Expand All @@ -83,7 +90,8 @@ var menus = {
// NOTE: Notepad in Windows 98 doesn't actually have a separate Repeat/Redo
{
label: "&Repeat",
shortcut: "Ctrl+Shift+Z", //"F4",
shortcutLabel: "Ctrl+Shift+Z", //"F4",
ariaKeyShortcuts: "Control+Shift+Z", //"F4",
enabled: function () {
return document.queryCommandEnabled("redo");
},
Expand All @@ -98,7 +106,8 @@ var menus = {
// make it so it queries the enabled status of all items before switching focus to the menus.
{
label: "Cu&t",
shortcut: "Ctrl+X",
shortcutLabel: "Ctrl+X",
ariaKeyShortcuts: "Control+X",
enabled: function () {
return document.queryCommandEnabled("cut");
},
Expand All @@ -110,7 +119,8 @@ var menus = {
},
{
label: "&Copy",
shortcut: "Ctrl+C",
shortcutLabel: "Ctrl+C",
ariaKeyShortcuts: "Control+C",
enabled: function () {
return document.queryCommandEnabled("copy");
},
Expand All @@ -122,7 +132,8 @@ var menus = {
},
{
label: "&Paste",
shortcut: "Ctrl+V",
shortcutLabel: "Ctrl+V",
ariaKeyShortcuts: "Control+V",
enabled: function () {
return document.queryCommandEnabled("paste");
},
Expand All @@ -134,7 +145,8 @@ var menus = {
},
{
label: "De&lete",
shortcut: "Del",
shortcutLabel: "Del",
ariaKeyShortcuts: "Delete",
enabled: function () {
var textarea = $textarea.get(0);
var startPos = textarea.selectionStart;
Expand Down Expand Up @@ -163,13 +175,15 @@ var menus = {
{
label: "Select &All",
// NOTE: Notepad in Windows 98 doesn't actually have Ctrl+A as a shortcut
shortcut: "Ctrl+A",
shortcutLabel: "Ctrl+A",
ariaKeyShortcuts: "Control+A",
action: select_all,
description: "Selects the entire document.",
},
{
label: "Time/&Date",
shortcut: "F5",
shortcutLabel: "F5",
ariaKeyShortcuts: "F5",
enabled: function () {
return document.queryCommandEnabled("insertText");
},
Expand All @@ -196,29 +210,33 @@ var menus = {
{
label: "&Find...",
// NOTE: Notepad in Windows 98 doesn't actually have Ctrl+F as a shortcut (although WordPad does)
shortcut: "Ctrl+F",
shortcutLabel: "Ctrl+F",
ariaKeyShortcuts: "Control+F",
action: function () { }, // TODO
enabled: false,
description: "Finds the specified text.",
},
{
label: "Find &Next",
shortcut: "F3",
shortcutLabel: "F3",
ariaKeyShortcuts: "F3",
action: function () { }, // TODO
enabled: false,
description: "Repeats the last find.",
},
// NOTE: Notepad in Windows 98 doesn't have Replace or Go to... options
// {
// label: "&Replace",
// shortcut: "Ctrl+H",
// shortcutLabel: "Ctrl+H",
// ariaKeyShortcuts: "Control+H",
// action: function(){},
// enabled: false,
// description: "Replaces specific text with different text.",
// },
// {
// label: "&Go to",
// shortcut: "Ctrl+G",
// shortcutLabel: "Ctrl+G",
// ariaKeyShortcuts: "Control+G",
// action: function(){},
// enabled: false,
// description: "Goes to a specified line number.", // NOTE: made up text
Expand Down
Loading

0 comments on commit a61e9f4

Please sign in to comment.