CmdUtils.CreateCommand({ name: "r-douban", homepage: "http://www.douban.com/people/aka/", author: { name: "Yu Peng", email: "pengyu.py@gmail.com"}, contributors: ["Yu Peng"], license: "MPL", description: "Recommend the current site to douban", help: "posts the current tab url to douban with the comment input by the user.", _params: function(comment,mods) { var document = context.focusedWindow.document; var params = { uid: document.location, title: (mods.entitled.text || document.title), type: 'I', comment: comment.text, }; return params; }, takes: {"comment": noun_arb_text}, modifiers: {entitled: noun_arb_text}, preview: function(pblock, comment, mods) { var document = context.focusedWindow.document; html = "title: " + (mods.entitled.text || document.title) + "
"; html += "comment: " + comment.text; pblock.innerHTML = html; }, execute: function(comment, mods) { jQuery.ajax({ type: "POST", dataType: "xml", url: "http://www.douban.com/recommend/", data: this._params(comment, mods), }); } }) CmdUtils.CreateCommand({ name: "s-douban", homepage: "http://www.douban.com/people/aka/", author: { name: "Yu Peng", email: "pengyu.py@gmail.com"}, contributors: ["Yu Peng"], license: "MPL", description: "I say to douban", help: "posts saying to douban", takes: {"say": noun_arb_text}, preview: function(pblock, say) { html = "saying: " + say.text; pblock.innerHTML = html; }, execute: function(say) { jQuery.ajax({ type: "POST", dataType: "xml", url: "http://www.douban.com/contacts/", data: {'mb_text':say.text}, }); } })