Skip to content

Instantly share code, notes, and snippets.

@satyr
Created September 15, 2009 22:36
Show Gist options
  • Save satyr/187722 to your computer and use it in GitHub Desktop.
Save satyr/187722 to your computer and use it in GitHub Desktop.
Thank You Mario!
const TYM = 'http://wigflip.com/thankyoumario/';
CmdUtils.CreateCommand({
name: 'thank you mario',
description: 'Thank You Mario!'.link(TYM),
icon: 'http://wigflip.com/favicon.ico',
author: {name: 'satyr', email: '[email protected]'},
license: 'MIT',
arguments: {
object_message: noun_arb_text,
instrument_title: noun_arb_text,
alias_name: noun_arb_text,
},
execute: function(args){
this._post(args, function(gif){
CmdUtils.setSelection(
<img src={gif}/>.toXMLString(),
{text: Utils.clipboard.text = gif});
});
},
preview: function(pb, args){
this._post(args, function(gif){
pb.innerHTML = <center><img src={gif}/></center>;
}, pb);
},
_post: function({object, instrument, alias}, cb, pb){
var params = {
url: TYM,
type: 'post',
data: {
name: alias.text,
lines: object.text.replace(/;;/g, '\n'),
title: instrument.text,
double: pb ? 'n' : 'y',
},
success: function(htm){
cb(/\bhttp:\/\/attach\.tym\.wigflip\.com\/\S+?\.gif/(htm) +'');
},
};
pb ? CmdUtils.previewAjax(pb, params) : $.ajax(params);
},
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment