[src/keys:feat] toggle speed reader on page

using squirt.io
This commit is contained in:
Maddison Hellstrom 2020-06-18 13:35:09 -07:00
parent 233707c5df
commit 015d236886
2 changed files with 24 additions and 0 deletions

View File

@ -75,6 +75,24 @@ const rssSubscribeUrl = "https://feedrabbit.com/subscriptions/new?url="
actions.rssSubscribe = ({ href = util.getCurrentLocation("href") } = {}) => actions.rssSubscribe = ({ href = util.getCurrentLocation("href") } = {}) =>
() => actions.openLink(`${rssSubscribeUrl}${encodeURIComponent(href)}`, { newTab: true })() () => actions.openLink(`${rssSubscribeUrl}${encodeURIComponent(href)}`, { newTab: true })()
actions.showSpeedReader = () => {
const script = document.createElement("script")
script.innerHTML = `(() => {
const sq = window.sq || {}
window.sq = sq
if (sq.script) {
sq.again()
} else if (sq.context !== "inner") {
sq.bookmarkletVersion = "0.3.0"
sq.iframeQueryParams = { host: "//squirt.io" }
sq.script = document.createElement("script")
sq.script.src = \`\${sq.iframeQueryParams.host}/bookmarklet/frame.outer.js\`
document.body.appendChild(sq.script)
}
})()`
document.body.appendChild(script)
}
// Surfingkeys-specific actions // Surfingkeys-specific actions
// ---------------------------- // ----------------------------
actions.createHint = (selector, action) => () => { actions.createHint = (selector, action) => () => {

View File

@ -159,6 +159,12 @@ const maps = {
description: "Subscribe to RSS feed for page", description: "Subscribe to RSS feed for page",
callback: actions.rssSubscribe(), callback: actions.rssSubscribe(),
}, },
{
alias: "=s",
category: categories.misc,
description: "Speed read page",
callback: actions.showSpeedReader,
},
{ {
alias: ";pd", alias: ";pd",
category: categories.misc, category: categories.misc,