Deprecated: Return type of I::current() should either be compatible with Iterator::current(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/public/kirby/toolkit/lib/i.php on line 62

Deprecated: Return type of I::next() should either be compatible with Iterator::next(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/public/kirby/toolkit/lib/i.php on line 91

Deprecated: Return type of I::key() should either be compatible with Iterator::key(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/public/kirby/toolkit/lib/i.php on line 71

Deprecated: Return type of I::valid() should either be compatible with Iterator::valid(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/public/kirby/toolkit/lib/i.php on line 101

Deprecated: Return type of I::rewind() should either be compatible with Iterator::rewind(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/public/kirby/toolkit/lib/i.php on line 53

Deprecated: Return type of Collection::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/public/kirby/toolkit/lib/collection.php on line 80

Deprecated: parse_str(): Passing null to parameter #1 ($string) of type string is deprecated in /home/public/kirby/toolkit/lib/url.php on line 135
One Tap Less | Safari bookmarklet to create Kirby posts

Safari bookmarklet to create Kirby posts

A few days ago, I introduced you to Ashes, the Fever client for iPhone with actions. Soon after, I went deeper and used Pythonista to create Kirby-ready blog posts directly from selected text in Ashes. Not everyone has either Fever or Kirby, however, I'll show you the bookmarklets required to trigger this action from Safari.

If you want to use this action on iPad Safari, the script remains the same because you can select text and call a bookmarklet on the iPad. The script is long and this is supposed to be a short article, so grab it in this post. The bookmarklet you must add to Safari is the following:

javascript:window.location='pythonista://QuoteArticle?action=run&argv='+encodeURIComponent(window.getSelection())+'&argv='+encodeURIComponent(document.title)+'&argv='+encodeURIComponent(location.href)

If you forgot how to add a bookmarklet, just bookmark any page, then edit and replace the url with the javascript code above. You can only edit the url after you added the bookmark, not as you add it.

If you're on the iPhone, you must use the clipboard. This needs a different bookmarklet and changes to our Pythonista script. First, the bookmarklet:

javascript:window.location='pythonista://QuoteArticle?action=run&argv='+encodeURIComponent(document.title)+'&argv='+encodeURIComponent(location.href)

And now a few changes to our Pythonista script, please open it as I won't paste everything here. It's just a few lines, I promise. You gotta replace this part of the script:

quote = sys.argv[1]
title = sys.argv[2]
link = sys.argv[3]

For this one:

from clipboard import get

quote = get()
title = sys.argv[1]
link = sys.argv[2]

I didn't play much with it, but so far, so good. If it screws up with you somehow, try replacing get() with str(get()) or send me a message at App.net or Twitter and I'll come for the rescue.