feat(qmk): Add QMK layout

This commit is contained in:
js0ny 2025-02-20 01:52:43 +00:00
parent fa89edab18
commit 4c0ec74a3d
2 changed files with 79 additions and 7 deletions

View file

@ -478,19 +478,16 @@ mapkey(",S", "Open Source in GitHub (New Page)", function () {
* 1 - 学术
* 2 - 社交
*/
const perplexityFocusOn = function (n) {
q("div.rounded-md").querySelectorAll("span")[1].click()
setTimeout(() => { // Wait for the DOM to update
qs("div.shadow-subtle div.group\\/item")[n].click();
}, 100);
};
unmap("<Ctrl-i>", /perplexity.ai/); // allows to use perplexity web keybindings
mapkey(",b", "Add Perplexity [b]ookmark", function () {
// button.border:nth-child(2)
q("div.sticky.left-0").querySelectorAll("button")[2].click()
}, { domain: /perplexity.ai/ });
mapkey(",w", "Toggle [w]riting/[w]eb Search", function () {
perplexityFocusOn(0);
q("div.rounded-md").querySelectorAll("span")[1].click()
setTimeout(() => { // Wait for the DOM to update
qs("div.shadow-subtle div.group\\/item")[0].click();
}, 100);
}, { domain: /perplexity.ai/ });
mapkey(",s", "[s]tart Generating", function () {
var btns = qs("span.grow button");
@ -605,6 +602,17 @@ mapkey(",c", "toggle [c]aptions", function () {
}, { domain: /youtube.com/ });
// #endregion
//#region zhihu.com
mapkey(",d", "Toggle [d]ark mode", function () {
const url = new URL(window.location.href);
if (url.searchParams.get("theme") === "dark") {
url.searchParams.set("theme", "light");
} else {
url.searchParams.set("theme", "dark");
}
window.location.href = url.href;
}, { domain: /zhihu.com/ });
//#endregion
// #endregion
// #region ACE Editor