Last active
May 24, 2024 04:28
-
-
Save Omochice/f4519ddeef186e80fbc321ff4206079e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
api.unmap("H"); | |
api.unmap("L"); | |
api.unmap("O"); | |
api.unmap("o"); | |
api.unmap("Y"); | |
api.unmap("M"); | |
api.unmap("m"); | |
api.unmap("B"); | |
api.unmap("b"); | |
settings.defaultSearchEngine = "d"; | |
api.map("H", "S"); | |
api.map("L", "D"); | |
api.mapkey("o", "search word in current tab", () => { | |
api.Front.openOmnibar({ | |
type: "URLs", | |
extra: "d", | |
tabbed: false, | |
}); | |
}); | |
api.mapkey("O", "search word in other tab", () => { | |
api.Front.openOmnibar({ | |
type: "URLs", | |
extra: "d", | |
tabbed: true, | |
}); | |
}); | |
api.mapkey("Y", "yank current page as markdown link", () => { | |
const text = `[${document.title}](${window.location.href})`; | |
api.Clipboard.write(text); | |
api.Front.showBanner(`Yank this page as ${text}`); | |
}); | |
api.addSearchAlias( | |
"mdn", | |
"MDN", | |
"https://developer.mozilla.org/ja/search?q=", | |
"s", | |
"https://developer.mozilla.org/api/v1/search/ja?q=", | |
(response) => { | |
const parsed = JSON.parse(response.text); | |
console.log(parsed); | |
return parsed.documents.map(({ title, slug, summary, locale }) => | |
api.createSuggestionItem( | |
` | |
<div> | |
<div class="title"><strong>${title}</strong></div> | |
<div style="font-size:0.8em"><em>${slug}</em></div> | |
<div>${summary}</div> | |
</div> | |
`, | |
{ url: `https://developer.mozilla.org/${locale}/docs/${slug}` }, | |
) | |
); | |
}, | |
); | |
api.addSearchAlias( | |
"android", | |
"Android", | |
"https://developer.android.com/s/results?q=", | |
"s", | |
); | |
api.addSearchAlias( | |
"iosref", | |
"iOSRef", | |
"https://developer.apple.com/search/?type=Documentation&q=", | |
"s", | |
); | |
api.addSearchAlias( | |
"perplexity", | |
"Perplexity", | |
"https://www.perplexity.ai/?q=", | |
"p", | |
); | |
api.mapkey("P", "search word on perplexity in other tab", () => { | |
api.Front.openOmnibar({ | |
type: "SearchEngine", | |
extra: "perplexity", | |
tabbed: true, | |
}); | |
}); | |
api.mapkey("b", "open bookmark in current tab", () => { | |
api.Front.openOmnibar({ | |
type: "Bookmarks", | |
tabbed: false, | |
}); | |
}); | |
api.mapkey("B", "open bookmark in current tab", () => { | |
api.Front.openOmnibar({ | |
type: "Bookmarks", | |
tabbed: true, | |
}); | |
}); | |
api.mapkey("t", "open tab search", () => { | |
api.Front.openOmnibar({ | |
type: "Tabs", | |
tabbed: false, | |
}); | |
}); | |
api.mapkey("T", "open tab search", () => { | |
api.Front.openOmnibar({ | |
type: "Tabs", | |
tabbed: false, | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment