Deep thought 💭 on Bookmarklet for Octopress

One of the nice things about Wordpress, or even the previous blog engine I used, staticDimension, I was able to use a bookmarklet to capture ideas on the go. It is not so difficult on a dedicated computer, I always have a text editor and can even upload a file to my Dropbox with out having the client installed. I have even made the process easier by creating few TextExpander snippets.

xblog for filenames:

%Y-%m-%d-%|.markdown

bdate for post dates:

%Y-%m-%d %H:%M

bblog for post header formatting:

---
title: "%|"
layout: post
date: %Y-%m-%d %H:%M
external-url:
categories: []
published: false
---

But on my iPhone and iPad, I have to open up a text editor, like Nebulous Notes (my editor of choice), use the TextExpander snippets, and then go back to Mobile Safari copy the URL, switch back to Nebulous Notes and paste the URL in the external-url: field. If I want to quote anything on the page, that means I have to repeat the process again. Only then can I start writing.

Not every efficient.

So I cobbled together a bookmarklet, with the base code borrowed from Sean Korzdorfer’s iOS Bookmarklet Gist that will add the correct post header formatting and incorporate the page name, URL and date. I have also created a version that will automatically insert the markdown quote (>) and I can paste the content that I found interesting and get to writing.

Quote version:

javascript:var%20d=new%20Date();var%20padded=function(v)%20%7B%20var%20res%20=%20v.toString();while%20(res.length%20%3C%202)%20%7Bres%20=%20'0'%20+%20res;%7D%20return%20res;%7D;var%20dstamp%20=%20%5BString(d.getFullYear()),%20padded(d.getMonth()%20+%201),%20padded(d.getDate())%5D.join('-');var%20tstamp%20=%20%5Bpadded(d.getHours()),%20padded(d.getMinutes()%20+%201)%5D.join(':');window.location='nebulous://new?contents=---'+escape('%5Cn')+'title: "'+encodeURIComponent(document.title)+'"'+escape('%5Cn')+'layout: post'+escape('%5Cn')+'date: '+dstamp+'%20'+tstamp+escape('%5Cn')+'external-url: '+encodeURIComponent(document.location.href)+escape('%5Cn')+'categories: []'+escape('%5Cn')+'published: false'+escape('%5Cn')+'---'+escape('%5Cn%5Cn')+'>%20';

Standard version:

javascript:var%20d=new%20Date();var%20padded=function(v)%20%7B%20var%20res%20=%20v.toString();while%20(res.length%20%3C%202)%20%7Bres%20=%20'0'%20+%20res;%7D%20return%20res;%7D;var%20dstamp%20=%20%5BString(d.getFullYear()),%20padded(d.getMonth()%20+%201),%20padded(d.getDate())%5D.join('-');var%20tstamp%20=%20%5Bpadded(d.getHours()),%20padded(d.getMinutes()%20+%201)%5D.join(':');window.location='nebulous://new?contents=---'+escape('%5Cn')+'title: "'+encodeURIComponent(document.title)+'"'+escape('%5Cn')+'layout: post'+escape('%5Cn')+'date: '+dstamp+'%20'+tstamp+escape('%5Cn')+'external-url: '+encodeURIComponent(document.location.href)+escape('%5Cn')+'categories: []'+escape('%5Cn')+'published: false'+escape('%5Cn')+'---'+escape('%5Cn%5Cn');
Published: Nov 13, 2012 @jeredb →