aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsnaka2009-05-31 00:27:22 +0000
committersnaka2009-05-31 00:27:22 +0000
commit51a2631196aedc8cdd15934528dd660a41264c95 (patch)
tree9a2221f212d356de5b2eff64886195650cbdf01a
parentc682c41e911f5246ca4f71857ea3e4e38b3bf1b3 (diff)
downloadvimperator-plugins-51a2631196aedc8cdd15934528dd660a41264c95.tar.bz2
ログインされていない場合の判定を追加
git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@33682 d0d07461-0603-4401-acd4-de1884942a52
-rw-r--r--pino.js15
1 files changed, 10 insertions, 5 deletions
diff --git a/pino.js b/pino.js
index 4e36a46..d903389 100644
--- a/pino.js
+++ b/pino.js
@@ -41,7 +41,7 @@ var PLUGIN_INFO =
<require type="plugin">_libly.js</require>
<author mail="snaka.gml@gmail.com" homepage="http://vimperator.g.hatena.ne.jp/snaka72/">snaka</author>
<license>MIT style license</license>
- <version>1.3.0</version>
+ <version>1.3.1</version>
<detail><![CDATA[
== Subject ==
Open livedoor Reader pinned items.
@@ -147,7 +147,7 @@ let self = liberator.plugins.pino = (function() {
function(args) {
let pins = new Pins();
let items = pins.items();
- if (items.length == 0) {
+ if (!items || items.length == 0) {
liberator.echo("Pinned item doesn't exists.");
return;
}
@@ -225,7 +225,7 @@ let self = liberator.plugins.pino = (function() {
let result = this.cache
? this.cache
: this.cache = this._getPinnedItems();
- return result.sort(this.sortOrder);
+ return (result || []).sort(this.sortOrder);
},
shift : function() {
@@ -270,12 +270,14 @@ let self = liberator.plugins.pino = (function() {
);
request.addEventListener("onSuccess", function(data) {
- liberator.log(data);
+ if (isLoginPage(data)) {
+ liberator.echoerr("Can't get pinned list. Maybe you should login to livedoor.");
+ return;
+ }
result = liberator.eval(data.responseText);
});
request.addEventListener("onFailure", function(data) {
liberator.echoerr("Can't get pinned list!!!");
- liberator.log(data);
});
request.post();
@@ -315,6 +317,9 @@ let self = liberator.plugins.pino = (function() {
for (i in source)
].join('&');
+ function isLoginPage(response)
+ response.responseText.substr(0, 5) == '<?xml'
+
// }}}
// API /////////////////////////////////////////////////////////// {{{
return {