From 8caa9763f1ca9f6675b7591ab21f25bcf3fd9fb3 Mon Sep 17 00:00:00 2001 From: anekos Date: Wed, 27 Jul 2011 13:46:26 +0900 Subject: 改行コードがコールバックで除去されないバグを修正 --- bitly.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'bitly.js') 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 = bit.ly Get short alias by bit.ly and j.mp bit.ly や j.mp で短縮URLを得る - 2.1.0 + 2.1.1 anekos new BSD License (Please read the source code comments of this plugin) 修正BSDライセンス (ソースコードのコメントを参照してください) https://github.com/vimpr/vimperator-plugins/raw/master/bitly.js 2.0pre - 2.4 ] @@ -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) -- cgit v1.2.3