Friday, May 10, 2024

Another try at a Pinboard bookmarklet

I asked ChatGPT to write a bookmarklet that would add a URL to Pinboard and paste in text copied from the clipboard as a description. Here’s what I got:

javascript:(function(){ var url = encodeURIComponent(window.location.href); var title = document.title.replace(/^.*?-/, '').trim(); var description = prompt('Enter description (Ctrl+V to paste from clipboard):'); if (!description) { return; } description = encodeURIComponent(description.trim()); var pinboardURL = 'https://pinboard.in/add?url=' + url + '&title=' + title + '&description=' + description; window.open(pinboardURL, '_blank'); })();
I know — huh? But it works. It doesn’t do exactly what I’d like it to do: I cannot add a blog post’s URL to Pinboard without having my blog’s name show up as part of the post title, so I just delete the prefatory Orange Crate Art. (I’m not sure it‘s even possible to remove the blog name automatically.) Two advantages of this bookmarklet: it allows text from the clipboard to be pasted in as a description, and it shows existing tags when I begin typing a tag name. For those reasons, this bookmarklet beats other bookmarklets and a Safari extension that I’ve tried.

[It works!]

With Alfred workflows and, now, a bookmarklet, ChatGPT does what I’d never be able to do on my own.

A related post
Adding links to Pinboard

comments: 0