mirror of
https://github.com/js0ny/dotfiles.git
synced 2025-12-21 08:43:00 +00:00
feat(doom): (Maybe temporary) switch to doom emacs
* Surfingkeys: Add pixiv site specific keymaps * Emacs: (Maybe temporary) switch to doom emacs * Hyprland: Add shortcuts to screenshot * nvim: Conceal on Zero-Width Space
This commit is contained in:
parent
5533374bc3
commit
c353d008a2
10 changed files with 472 additions and 3 deletions
|
|
@ -499,6 +499,9 @@ mapkey(",r", "Change model to regenerate last output", function () {
|
|||
// Use site-specific paging method
|
||||
unmap("[[", /pixiv.net/);
|
||||
unmap("]]", /pixiv.net/);
|
||||
unmap(",", /pixiv.net/);
|
||||
const isArtwork = (url) => /pixiv.net\/artworks/.test(url.href)
|
||||
|
||||
mapkey("[[", "Previous Page", function () {
|
||||
const url = new URL(window.location.href);
|
||||
if (url.href === url.origin) {
|
||||
|
|
@ -520,6 +523,32 @@ mapkey("]]", "Next Page", function () {
|
|||
url.searchParams.set("p", newPage);
|
||||
window.location.href = url.href;
|
||||
}, { domain: /pixiv.net/ });
|
||||
mapkey(",b", "Add to [b]ookmark", function () {
|
||||
const url = new URL(window.location.href);
|
||||
if (!isArtwork(url)) { return; }
|
||||
const toolbar = q('section [class$="Toolbar"]')
|
||||
toolbar.querySelectorAll("div")[2].querySelector("button").click()
|
||||
}, { domain: /pixiv.net/ });
|
||||
mapkey(",B", "Add to private [B]ookmark", function () {
|
||||
const url = new URL(window.location.href);
|
||||
if (!isArtwork(url)) { return; }
|
||||
const toolbar = q('section [class$="Toolbar"]')
|
||||
toolbar.querySelectorAll("div")[0].querySelector("button").click()
|
||||
setTimeout(() => { // Wait for the DOM to update
|
||||
q("div[role=menu]").querySelector("li").click()
|
||||
}, 100);
|
||||
}, { domain: /pixiv.net/ });
|
||||
mapkey(",v", "Up[v]ote Artwork", function () {
|
||||
const url = new URL(window.location.href);
|
||||
if (!isArtwork(url)) { return; }
|
||||
const toolbar = q('section [class$="Toolbar"]')
|
||||
toolbar.querySelectorAll("div")[3].querySelector("button").click()
|
||||
}, { domain: /pixiv.net/ });
|
||||
mapkey(",f", "Toggle [f]ollow the author", function () {
|
||||
const url = new URL(window.location.href)
|
||||
if (!isArtwork(url)) { return; }
|
||||
q("aside").querySelector("section").querySelector("button").click()
|
||||
}, { domain: /pixiv.net/ });
|
||||
// #endregion
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue