Skip to content

Commit

Permalink
v3.4.0
Browse files Browse the repository at this point in the history
* [+] 快捷键信息文字增加“内部超链”功能
  • Loading branch information
cataerogong committed Feb 28, 2024
1 parent f22ade7 commit b429e5f
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 56 deletions.
50 changes: 37 additions & 13 deletions keymap.html
Original file line number Diff line number Diff line change
Expand Up @@ -1101,6 +1101,13 @@
display: none;
}

.ilink {
cursor: pointer;
/* color: blue; */
text-decoration: dashed underline var(--c2);
text-underline-offset: 3px;
}

/* exe mode */
/* [data-launch-mode="exe"] :is(#btn_load_file, #btn_save_file, #btn_save_as_img) {
display: none;
Expand Down Expand Up @@ -1642,6 +1649,18 @@
* 启用修饰键颜色后,所有修饰键显示均会使用定义的背景颜色
对未设置颜色的修饰键,默认为透明背景
* 颜色和显示模式可以随意组合
【内部超链】
快捷键信息文字增加“内部超链”功能,可以跳转到键盘层或打开快捷键编辑窗口。
格式类似于 markdown 的超链:[文字](链接)
"[]" 中是内部超链的显示文字,可以为空,为空时显示层名+组合键
"()" 中为链接,格式:"(L层号, 组合键)"
例:
[](L1)
[](L1, Ctrl+1)
[层2](L2)
[层2-键](L2, Alt+1)
`;
const KeymapHelp = {
"#NAME": HELP_KEYMAP,
Expand Down Expand Up @@ -1745,22 +1764,13 @@
"Ctrl+Shift+Q": "组1\n\n但不是主快捷键::g1",
"RCtrl+Shift+Win+T": "组4\n::g4",
"Ctrl+RShift+Win+T": "组5\n::g5",
"L": "内部超链\n\n[](L1)\n[](L1, Ctrl+1)\n[层2](L2)\n[层2-键](L2, Alt+1)",
"#comment": HELP2
},
"#3": {
"#name": "新增功能",
"Ctrl+1": "第1个键谱",
"Ctrl+2": "第2个键谱",
"Ctrl+3": "第3个键谱",
"Ctrl+4": "第4个键谱",
"Ctrl+5": "第5个键谱",
"Ctrl+6": "第6个键谱",
"Ctrl+7": "第7个键谱",
"Ctrl+8": "第8个键谱",
"Ctrl+9": "第9个键谱",
",": "上一个键谱",
".": "下一个键谱",
"#comment": `<Ctrl>+<1~9> 快速切换键谱列表中的第 1~9 个键谱\n\n<,> 切换上一个键谱\n\n<.> 切换下一个键谱`,
"L": "内部超链\n\n[](L1)\n[](L1, Ctrl+1)\n[层2](L2)\n[层2-键](L2, Alt+1)",
"#comment": `【内部超链】\n 快捷键信息文字增加“内部超链”功能,可以跳转到键盘层或打开快捷键编辑窗口。\n 格式类似于 markdown 的超链:[文字](链接)\n "[]" 中是内部超链的显示文字,可以为空,为空时显示层名+组合键\n "()" 中为链接,格式:"(L层号, 组合键)"\n\n例:\n[](L1)\n[](L1, Ctrl+1)\n[层2](L2)\n[层2-键](L2, Alt+1)`,
},
};

Expand Down Expand Up @@ -2078,6 +2088,20 @@
}
}
ret.digest = ret.digest.trim();
// 处理内部超链宏 "[文字](Ln)", "[文字](Ln,A+B+C)"
function replacer(match, p1, p2, p3, p4, offset, string, groups) {
let ln = Keymap.getLayerName(parseInt(groups.layer));
let txt = "L" + groups.layer + (ln ? ":" + ln : "") + (groups.combo ? "&lt;" + groups.combo + "&gt;" : "");
let js = `UI.Keyboard.clearTips();UI.changeLayer(${groups.layer});UI.update();` + (groups.combo ? `setmapping_dlg('${groups.combo}');` : "");
return `<a class="ilink" onclick="${js}" title="${txt}">${groups.text || txt}</a>`
}
re = /\[(?<text>[^\]]*)\]\(L(?<layer>\d+)(\s*,\s*(?<combo>[^\)]+))?\)/g
ret.digest = ret.digest.replaceAll(re, replacer);
ret.body = ret.body.replaceAll(re, replacer);
// ret.body = mi.body.replaceAll(/\[(?<text>.*)\]\(L(?<layer>\d+)\)/g,
// `<a class="ilink" onclick="UI.Keyboard.clearTips();UI.changeLayer($<layer>);UI.update();">$<text></a>`);
// ret.body = mi.body.replaceAll(/\[(?<text>.*)\]\(L(?<layer>\d+),\s*(?<combo>.+)\)/g,
// `<a class="ilink" onclick="UI.Keyboard.clearTips();UI.changeLayer($<layer>);UI.update();setmapping_dlg('$<combo>');">$<text></a>`);
return ret;
},

Expand Down Expand Up @@ -4343,7 +4367,7 @@ <h3>简易操作指南</h3>
window.on_webwin_loaded = webwin_init;

var __appname__ = "键谱";
var __version__ = "3.3.0";
var __version__ = "3.4.0";
var __homepage__ = "https://github.com/cataerogong/keymap";
var __loader__ = "";

Expand Down
61 changes: 18 additions & 43 deletions release.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -5,56 +5,31 @@ echo release version: %__version__%
echo.
pause

if not exist release mkdir release

if "%~1" neq "" goto :%~1

call :html
call :clean
call :exe
call :tray

exit /b

:html
if exist release\keymap-%__version__%-html.zip del release\keymap-%__version__%-html.zip
zip release\keymap-%__version__%-html.zip keymap.html README.md MANUAL.md LICENSE js\* *.example.* keymaps\*
exit /b

:clean
pushd exe
call build clean
call build
popd
if exist pack_tmp rmdir /s /q pack_tmp
exit /b

:exe
pushd exe
call build exe
popd
if not exist pack_tmp\data mkdir pack_tmp\data
::copy /y keymap.html pack_tmp\
::copy /y README.md pack_tmp\
::copy /y MANUAL.md pack_tmp\
if exist pack_tmp rmdir /s /q pack_tmp
mkdir pack_tmp\data
copy /y keymap.html pack_tmp\
copy /y README.md pack_tmp\
copy /y MANUAL.md pack_tmp\
copy /y LICENSE pack_tmp\
copy /y *.example.* pack_tmp\
xcopy /y /s js\ pack_tmp\js\
xcopy /y /s keymaps\ pack_tmp\keymaps\
copy /y exe\dist\keymap\keymap.exe pack_tmp\
xcopy /y /s exe\dist\keymap\_runtime\ pack_tmp\_runtime\
copy /y exe\README.md pack_tmp\README-keymap-exe.md
if exist release\keymap-%__version__%-exe-x64.zip del release\keymap-%__version__%-exe-x64.zip
cd pack_tmp
zip -r ..\release\keymap-%__version__%-exe-x64.zip keymap.* README-keymap-exe.md LICENSE _runtime\ data\
cd ..
exit /b

:tray
pushd exe
call build tray
popd
if not exist pack_tmp mkdir pack_tmp
copy /y exe\dist\keymap\keymapTray.exe pack_tmp\
copy /y exe\dist\keymap\keymapTray.ini pack_tmp\
if exist release\keymap-%__version__%-tray-x64.zip del release\keymap-%__version__%-tray-x64.zip
cd pack_tmp
zip -r ..\release\keymap-%__version__%-tray-x64.zip keymapTray.* LICENSE
cd ..

if not exist release mkdir release
if exist release\keymap-%__version__%-all.zip del release\keymap-%__version__%-all.zip
if exist release\keymap-%__version__%-html.zip del release\keymap-%__version__%-html.zip
pushd pack_tmp
zip -r ..\release\keymap-%__version__%-html.zip keymap.html README.md MANUAL.md LICENSE *.example.* js\ keymaps\
zip -r ..\release\keymap-%__version__%-all.zip *
popd

exit /b

0 comments on commit b429e5f

Please sign in to comment.