From aac90a4418d6b4a3776ea24a0322802dcfe2d302 Mon Sep 17 00:00:00 2001 From: mattn Date: Tue, 5 Aug 2008 11:22:19 +0000 Subject: とりあえずポスト出来たのでcommit git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@17112 d0d07461-0603-4401-acd4-de1884942a52 --- mixiecho.js | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'mixiecho.js') diff --git a/mixiecho.js b/mixiecho.js index 77d9ed4..2854b15 100644 --- a/mixiecho.js +++ b/mixiecho.js @@ -1,4 +1,12 @@ +// Vimperator plugin: "Update mixi echo" +// Last Change: 05-Aug-2008. Jan 2008 +// License: Creative Commons +// Maintainer: mattn - http://mattn.kaoriya.net/ + (function(){ + var ucnv = Components.classes["@mozilla.org/intl/scriptableunicodeconverter"] + .createInstance(Components.interfaces.nsIScriptableUnicodeConverter); + ucnv.charset = "EUC-JP"; function sprintf(format){ var i = 1, re = /%s/, result = "" + format; while (re.test(result) && i < arguments.length) result = result.replace(re, arguments[i++]); @@ -91,7 +99,6 @@ liberator.echo(html, true); } function sayEcho(text){ - /* FIXME TODO: does not work!!!!!!!!!!!!!!!!!!!! var xhr = new XMLHttpRequest(); xhr.open("GET", "http://mixi.jp/recent_echo.pl", false); xhr.send(null); @@ -101,18 +108,17 @@ input.value = text; var params = []; var inputs = getElementsByXPath('.//*[contains(" INPUT TEXTAREA SELECT ", concat(" ", local-name(), " "))]', form); - inputs.forEach(function(input) { params.push(input.name + '=' + encodeURIComponent(input.value)); }); + inputs.forEach(function(input) { if (input.name.length) params.push(input.name + '=' + escape(ucnv.ConvertFromUnicode(input.value))); }); xhr.open("POST", "http://mixi.jp/add_echo.pl", false); xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xhr.send(params.join('&')); - */ } liberator.commands.addUserCommand(["mixiecho"], "Change mixi echo", function(arg, special){ if (special || arg.length == 0) showFollowersStatus() - //else - //sayTwitter(username, password, arg); + else + sayEcho(arg); }, { }); })(); -- cgit v1.2.3