CmdUtils.CreateCommand({ name: "lastfm", icon: "http://cdn.last.fm/flatness/favicon.2.ico", // homepage: "http://example.com/", author: { name: "eric casteleijn", email: "thisfred@gmail.com"}, license: "GPL", description: "Looks up artists or tracks on last.fm", takes: {"input": noun_arb_text}, preview: function( pblock, input ) { var msg = 'Looks up "${inputText}" on lastfm.'; var subs = {inputText: input.text}; pblock.innerHTML = CmdUtils.renderTemplate( msg, subs ); }, execute: function(input) { arr = input.text.split(' - '); url = 'http://www.last.fm/music/' + arr[0]; if (arr.length > 1) { url = url + '/_/' + arr[1]; } url = url.replace(' ', '+'); Utils.openUrlInBrowser(url) } });