feat: add Wikipedia shortcut to toggle simple version of current article

Adds shortcut `<leader>s` which toggles between normal articles and their "simple" counterparts. For
more information about Simple Wikipedia, see
https://simple.wikipedia.org/wiki/Wikipedia:Simple_English_Wikipedia
This commit is contained in:
Maddison Hellstrom 2018-08-23 02:15:43 -07:00
parent cb60c972c6
commit 850fad820a
1 changed files with 14 additions and 0 deletions

14
conf.js
View File

@ -302,6 +302,20 @@ mapsitekeys("dribbble.com", [
["z", "Zoom shot", Hint(".single-img picture, .detail-shot img")],
])
const wpToggleSimple = () => {
window.location.hostname = window.location.hostname.split(".")
.map((s, i) => {
if (i === 0) {
return s === "simple" ? "" : "simple"
}
return s
}).filter(s => s !== "").join(".")
}
mapsitekeys("wikipedia.org", [
["s", "Toggle simple version of current article", wpToggleSimple],
])
// ---- Search & completion ----//
// Search leader
const sl = "a"