Last active
March 20, 2024 16:05
-
-
Save Leftium/5e1e31dcab4d747d4d9be721bcf53dea to your computer and use it in GitHub Desktop.
Toggle Bookmarklet
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
url = new URL location | |
{host, searchParams} = url | |
params = | |
summary: searchParams.get 'summary' | |
url: searchParams.get 'url' | |
# Not summary | |
if host isnt 'kagi.com' | |
# Go to summary | |
newUrl = "https://kagi.com/summarizer?summary=summary&url=#{location.href}" | |
else | |
# Not summary=takeaway | |
if params.summary is 'summary' | |
# Go to key moments | |
url.searchParams.set 'summary', 'takeaway' | |
newUrl = url | |
else | |
# Key moments | |
# Go to original url | |
newUrl = params.url | |
location.href = newUrl | |
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
switch location.host | |
when 'news.ycombinator.com' | |
location.href = location.href.replace /.*item\?id=/, '//hw.leftium.com/#/item/' | |
when 'hn.leftium.com', 'hw.leftium.com' | |
location.href = location.href.replace /.*\//, '//news.ycombinator.com/item?id=' | |
when 'kagi.com' | |
url = location.href | |
url = url.replace 'kagi.com', 'google.com' | |
window.open url, '_blank' | |
when 'www.google.com' | |
url = location.href | |
url = url.replace 'www.google.com', 'kagi.com' | |
window.open url, '_blank' | |
when 'mail.google.com' | |
url = location.href | |
if url.includes '-label%3Asub' | |
location.href = 'https://mail.google.com/mail/u/0/?zx=kxekeso7ocxx#label/Sub' | |
else | |
location.href = 'https://mail.google.com/mail/u/0/?zx=kxekeso7ocxx#search/-label%3Asub' | |
when 'docs.google.com' | |
location.href= "//g.leftium.com?u=#{location.href}" | |
when 'g.leftium.com' | |
location.href = decodeURIComponent(location.href.replace /.*u=/, '') | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Tip: mail.google.com toggles between important and unimportant emails, as tagged by this simple method: https://blog.leftium.com/2023/11/automatic-inbox-cleanup-with-two-simple.html