Skip to content

Instantly share code, notes, and snippets.

@ChewingPencils
Created May 2, 2012 19:02
Show Gist options
  • Star 9 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save ChewingPencils/2579288 to your computer and use it in GitHub Desktop.
Save ChewingPencils/2579288 to your computer and use it in GitHub Desktop.
Bookmarklets for Drafts App
/*
Drafts App Bookmarklets (http://agiletortoise.com/drafts)
Author: Sean Korzdorfer
Date: 14:01:43 Wed May 02 2012
Nota Bene: It's probably best to have the bookmarklet create a script tag that includes an external JS.
See: https://gist.github.com/2777049
Sends the current Mobile Safari Tab to Drafts app as Markdown link with date and time stamps
Format:
[Document Title](URL)
YYYY-MM-DD HH:MM
*/
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='drafts://x-callback-url/create?text=%5B'+encodeURIComponent(document.title)+'%5D('+encodeURIComponent(document.location.href)+')'+escape('%5Cn%5Cn')+dstamp+'%20'+tstamp
/*
Sends the current Mobile Safari Tab to Drafts app as Markdown link
*/
javascript:window.location='drafts://x-callback-url/create?text=%5B'+encodeURIComponent(document.title)+'%5D('+encodeURIComponent(document.location.href)+')'
/*
Sends the URL of the current Mobile Safari Tab to Drafts app
*/
javascript:window.location='drafts://x-callback-url/create?text='+encodeURIComponent(document.location.href)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment