Skip to content

Instantly share code, notes, and snippets.

@ErikDeBruijn
Created January 27, 2010 23:01
Show Gist options
  • Save ErikDeBruijn/288250 to your computer and use it in GitHub Desktop.
Save ErikDeBruijn/288250 to your computer and use it in GitHub Desktop.
CmdUtils.makeSearchCommand({
name: "qrcode",
description: "Generates a QR Code from the current document URL or what you've tpyed after the command. Useful to quickly get something onto your phone.",
homepage: "http://www.erikdebruijn.nl/",
author: {name: "Erik de Bruijn", email: "ubiquity@erikdebruijn.nl"},
license: "GPLv2",
takes: {"input": /.*/},
preview: function(pblock, input) {
var atext;
atext = input.object.html.toString();
if(!atext)
atext = context.focusedWindow.document.location;
pblock.innerHTML = "<div style='width:100%;height:100%;background:white;'><img src=\"http://chart.apis.google.com/chart?cht=qr&chld=M|4&chs=150x150&chl="+ atext + "\"><br><br>URL: "+ atext + "<br><br><br></div>";
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment