Created
September 3, 2008 16:16
-
-
Save genki/8616 to your computer and use it in GitHub Desktop.
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: "formula", | |
takes: {"expression in LaTeX": noun_arb_text}, | |
homepage: "http://blog.s21g.com/genki", | |
author: {name: "Genki Takiuchi", homepage: "http://blog.s21g.com/genki"}, | |
license: "MPL", | |
preview: function( pblock, what ) { | |
var base = "https://secure.s21g.com/formula/formulae/preview_with_auth"; | |
var img_url = [base, '?expression=', encodeURIComponent(what.text)].join(''); | |
jQuery.get(img_url, null, function(){ | |
pblock.innerHTML = [ | |
'<div style="height:200px"><img src="', img_url, | |
'" style="display:block;background:#FFF;-moz-border-radius:5px;border:5px solid #FFF" />', | |
'powered by <a href="http://formula.s21g.com/" style="text-decoration:underline">formula.s21g.com</a></div>'].join(''); | |
}); | |
}, | |
execute: function( what, mods ) { | |
Utils.openUrlInBrowser(['https://secure.s21g.com/formula/formulae/create_with_auth?formula[expression]=', | |
encodeURIComponent(what.text), '&base=http%3A%2F%2Fformula.s21g.com%2F'].join('')); | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment