aboutsummaryrefslogtreecommitdiffstats
path: root/bitly.js
diff options
context:
space:
mode:
authoranekos2011-07-27 13:46:26 +0900
committeranekos2011-07-27 13:46:26 +0900
commit8caa9763f1ca9f6675b7591ab21f25bcf3fd9fb3 (patch)
tree0445fe726286983e926d58ad02ee022ffebc1c83 /bitly.js
parent5d0291eaf96c1c72315573a6047b4ed7df022b9b (diff)
downloadvimperator-plugins-8caa9763f1ca9f6675b7591ab21f25bcf3fd9fb3.tar.bz2
改行コードがコールバックで除去されないバグを修正
Diffstat (limited to 'bitly.js')
-rw-r--r--bitly.js10
1 files changed, 6 insertions, 4 deletions
diff --git a/bitly.js b/bitly.js
index 37d4d86..426d242 100644
--- a/bitly.js
+++ b/bitly.js
@@ -38,13 +38,12 @@ let PLUGIN_INFO =
<name>bit.ly</name>
<description>Get short alias by bit.ly and j.mp</description>
<description lang="ja">bit.ly や j.mp で短縮URLを得る</description>
- <version>2.1.0</version>
+ <version>2.1.1</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>
<updateURL>https://github.com/vimpr/vimperator-plugins/raw/master/bitly.js</updateURL>
<minVersion>2.0pre</minVersion>
- <maxVersion>2.4</maxVersion>
<detail><![CDATA[
== Commands ==
:bitly [<URL>]
@@ -96,13 +95,16 @@ let PLUGIN_INFO =
}
function shorten (url, domain, command, callback) {
+ function fixResponseText (s)
+ s.trim();
+
function get () {
let req = new XMLHttpRequest();
req.onreadystatechange = function () {
if (req.readyState != 4)
return;
if (req.status == 200)
- return callback && callback(req.responseText, req);
+ return callback && callback(fixResponseText(req.responseText), req);
else
return liberator.echoerr(req.statusText);
};
@@ -115,7 +117,7 @@ let PLUGIN_INFO =
'format=txt';
req.open('GET', requestUri, callback);
req.send(null);
- return !callback && req.responseText.trim();
+ return !callback && fixResponseText(req.responseText);
}
if (!url)