From c682c41e911f5246ca4f71857ea3e4e38b3bf1b3 Mon Sep 17 00:00:00 2001 From: snaka Date: Sat, 30 May 2009 23:31:14 +0000 Subject: Add '-open' commandline option to open ta-da list page. git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@33681 d0d07461-0603-4401-acd4-de1884942a52 --- tada.js | 134 ++++++++++++++++++++++++++++++++++++++-------------------------- 1 file changed, 79 insertions(+), 55 deletions(-) (limited to 'tada.js') diff --git a/tada.js b/tada.js index 9e81cd9..a02afbe 100644 --- a/tada.js +++ b/tada.js @@ -19,7 +19,8 @@ var PLUGIN_INFO = http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk/tada.js snaka MIT style license - 0.8.1 + 0.9.0 + _libly.js 0) sendEmail([getListId(args[0]), args[0]]); - } }, { completer: tadaListCompleter, argCount: "*" @@ -148,10 +173,11 @@ liberator.plugins.tada = (function(){ commands.addUserCommand( ["tadaclearcache"], "Clear Ta-da lists cache", - function() cachedLists = [] + function() + cachedLists = [] ); // }}} -// PRIVATE {{{ +// PRIVATE ////////////////////////////////////////////////////////////{{{ function tadaListCompleter(context, args) { if (args.length > 1) @@ -161,9 +187,8 @@ liberator.plugins.tada = (function(){ } function getURI() { - if (userId = g('tada_userId')) + if (userId = $g('tada_userId')) return "http://" + userId + ".tadalist.com/lists/"; - throw "Please specify your user id to global variable 'tada_userId'."; } @@ -171,7 +196,6 @@ liberator.plugins.tada = (function(){ let m; if (m = source.match(/\/lists\/([0-9]+)/)) return m[1]; - return source; } @@ -180,7 +204,6 @@ liberator.plugins.tada = (function(){ for(var i in list) { if (list[i][1] == name) return list[i][0]; } - return null; } @@ -189,11 +212,11 @@ liberator.plugins.tada = (function(){ // 1.Use global variable g:tadaDefaultListName if specified. // 2.Use first list if global variable not specified or specified list name is not // exist in your lists. - function getDefaultListId() { + function getDefaultListIdName() { var defaultId; var defaultName; - if (defaultName = g('tadaDefaultListName')) + if (defaultName = $g('tadaDefaultListName')) if (defaultId = getListId(defaultName)) return [defaultId, defaultName]; @@ -287,12 +310,13 @@ liberator.plugins.tada = (function(){ } // Utilities - function g(str) liberator.globalVariables[str]; + function $s(obj) util.objectToString(obj); + function $g(str) liberator.globalVariables[str]; function $LXs(a,b) libly.$U.getNodesFromXPath(a, b); function $LX(a,b) libly.$U.getFirstNodeFromXPath(a, b); // }}} -// PUBLIC {{{ +// API ////////////////////////////////////////////////////////////////{{{ return { getLists: getLists, getTodoItems: getTodoItems, -- cgit v1.2.3