aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoranekos2010-09-16 10:27:51 +0000
committeranekos2010-09-16 10:27:51 +0000
commit79ea7048ae19d0b7b4ce94558aaed1d3972629fd (patch)
tree54f048086596c36a803481845905571542e8fdea
parentb588276ea197ec976d5a3c90a3ad46562f65b62e (diff)
downloadvimperator-plugins-79ea7048ae19d0b7b4ce94558aaed1d3972629fd.tar.bz2
-n オプションをつけたときに削除されない時があるので修正
git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@38477 d0d07461-0603-4401-acd4-de1884942a52
-rw-r--r--readcatlater.js27
1 files changed, 15 insertions, 12 deletions
diff --git a/readcatlater.js b/readcatlater.js
index 90c6702..eace1b2 100644
--- a/readcatlater.js
+++ b/readcatlater.js
@@ -38,13 +38,13 @@ let PLUGIN_INFO =
<name>Read Cat Later</name>
<description>Read it later</description>
<description lang="ja">後で読む</description>
- <version>1.1.2</version>
+ <version>1.1.3</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>http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk/readcatlater.js</updateURL>
<minVersion>2.0pre</minVersion>
- <maxVersion>2.2pre</maxVersion>
+ <maxVersion>2.4</maxVersion>
<detail><![CDATA[
== Usage ==
:readcatlater [TAG]:
@@ -77,8 +77,6 @@ let PLUGIN_INFO =
// }}}
(function () {
- liberator.log('readcatlater.js loading');
-
// このプラグインでブックマークしたときに必ずつくタグ
const RCL_TAG = 'readcatlater';
// このプラグインが保存するブックマークのフォルダ名
@@ -254,12 +252,20 @@ let PLUGIN_INFO =
}
function removeItems (uri) {
+ if (typeof uri === 'number') {
+ bookmarks.removeItem(uri);
+ return true;
+ }
+ if (typeof uri === 'object') {
+ bookmarks.removeItem(uri.id);
+ return true;
+ }
var removed = false;
for each (let id in bookmarks.getBookmarkIdsForURI(makeURI(uri), {}))
- if (folderId == bookmarks.getFolderIdForItem(id)) {
+ if (id && (folderId == bookmarks.getFolderIdForItem(id))) {
removed = true;
bookmarks.removeItem(id);
- }
+ }
return removed;
}
@@ -287,12 +293,11 @@ let PLUGIN_INFO =
function (arg) {
let opennum = arg['-number'];
if (opennum) {
- liberator.log(typeof opennum)
- let us = RCL_Bookmarks(arg.literalArg).reverse().splice(0, opennum).map(function (it) it.URI);
- liberator.open(us, liberator.NEW_BACKGROUND_TAB);
+ let us = RCL_Bookmarks(arg.literalArg).reverse().splice(0, opennum).map(function (it) it);
+ liberator.open(us.map(function (it) it.URI), liberator.NEW_BACKGROUND_TAB);
if (!arg.bang) {
us.forEach(removeItems);
- liberator.echo('[' + us + '] was removed.');
+ liberator.echo(us.length + ' items were removed.');
}
} else {
let uri = arg.string;
@@ -323,6 +328,4 @@ let PLUGIN_INFO =
true
);
- liberator.log('readcatlater.js loaded');
-
})();