diff options
author | anekos | 2009-12-12 10:42:40 +0000 |
---|---|---|
committer | anekos | 2009-12-12 10:42:40 +0000 |
commit | 32c52d8a9b7821e87fddfc1fc43a8a17bc78094b (patch) | |
tree | 54639e6c0df75a8a97734527911300993db3d831 /amebanow.js | |
parent | fa8cb4788b9500ec49c9d8346201bb97ddb856a1 (diff) | |
download | vimperator-plugins-32c52d8a9b7821e87fddfc1fc43a8a17bc78094b.tar.bz2 |
アメーバなうの変更に手抜き対応
git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@36127 d0d07461-0603-4401-acd4-de1884942a52
Diffstat (limited to 'amebanow.js')
-rwxr-xr-x | amebanow.js | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/amebanow.js b/amebanow.js index f054335..cf93075 100755 --- a/amebanow.js +++ b/amebanow.js @@ -39,7 +39,7 @@ let PLUGIN_INFO = <name lang="ja">Amebaなう</name> <description>nau</description> <description lang="ja">Amebaなうする</description> - <version>1.0.3</version> + <version>1.0.4</version> <author mail="anekos@snca.net" homepage="http://d.hatena.ne.jp/nokturnalmortum/">anekos</author> <license>new BSD License (Please read the source code comments of this plugin)</license> <license lang="ja">修正BSDライセンス (ソースコードのコメントを参照してください)</license> @@ -59,7 +59,7 @@ let PLUGIN_INFO = // }}} // INFO {{{ let INFO = -<plugin name="AmebaNow" version="1.0.0" +<plugin name="AmebaNow" version="1.0.4" href="http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk/amebanow.js" summary="AmebaNau" xmlns="http://vimperator.org/namespaces/liberator"> @@ -83,9 +83,26 @@ let INFO = (function () { - function now (msg) { + function getToken (onSuccess) { + const url = 'http://now.ameba.jp/'; + let req = new plugins.libly.Request(url); + req.addEventListener( + 'onSuccess', + function (res) { + let m = res.responseText.match(/<input id="token" type="hidden" name="token" value="(\w+)"/); + if (m) + onSuccess(m[1]); + } + ); + req.get(); + } + + function now (msg, token) { const url = 'http://ucsnow.ameba.jp/post'; - let data = 'entryText=' + encodeURIComponent(msg) + '&inputBtn=%E6%8A%95%E7%A8%BF'; + let data = + 'entryText=' + encodeURIComponent(msg) + + '&token=' + token + + '&inputBtn=%E6%8A%95%E7%A8%BF'; let req = new plugins.libly.Request( url, @@ -109,7 +126,7 @@ let INFO = let mpCmds = let (gv = liberator.globalVariables.amebanow_multipost) (gv ? gv.split('|') : []); - now(msg); + getToken(function (token) now(msg, token)); mpCmds.forEach(function (cmd) liberator.execute(cmd + ' ' + msg)); }, { |