Created
May 2, 2010 12:19
-
-
Save esquifit/387092 to your computer and use it in GitHub Desktop.
Inserts an QRCode image of the selection
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CmdUtils.CreateCommand({ | |
name: "qr_code", | |
homepage: "http://yonen.ca/", | |
author: { name: "Jessy Ouellette", email: "jessy.ouellette@gmail.com"}, | |
takes: {"text": noun_arb_text}, | |
_getQRCodeUrl: function(QRText) { | |
var QRCodeUrl = "http://qrcode.kaywa.com/code/"; | |
return QRCodeUrl + QRText.text; | |
}, | |
preview: function( pblock, QRText ) { | |
var msg = "Inserts an QRCode image of the selection: <br/>"; | |
msg += "<img src='%s'/>".replace( /%s/, this._getQRCodeUrl(QRText) ); | |
pblock.innerHTML = msg; | |
}, | |
execute: function( QRText) { | |
CmdUtils.setSelection( "<img src='" + this._getQRCodeUrl(QRText) +"'/>"); | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment