Skip to content

Instantly share code, notes, and snippets.

@dsample
Created November 18, 2008 00:44
Show Gist options
  • Save dsample/26007 to your computer and use it in GitHub Desktop.
Save dsample/26007 to your computer and use it in GitHub Desktop.
CmdUtils.CreateCommand({
name: "mobilecode",
homepage: "http://mobib.org/",
author: { name: "Duncan Sample" },
description: "Shows a mobile code for the current page.",
license: "MPL",
preview: function( pblock ) {
var document = context.focusedWindow.document;
var style = Application.prefs.getValue("mobilebarcode.style", "QR");
var size = Application.prefs.getValue("mobilebarcode.size", "M");
var msg = '<div style="background-color:white;padding:20px;text-align:center;"><img src="http://mobilecodes.nokia.com/qr?DATA=${url}&MODULE_SIZE=6&name=&MARGIN=2&ENCODING=BYTE&NDEF_DATA=&MODE=TEXT&a=view" /></div>';
pblock.innerHTML = CmdUtils.renderTemplate( msg, {url: document.location} );
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment