From 6e2620af791221d0007aaf149d2d01039cb857a2 Mon Sep 17 00:00:00 2001 From: anekos Date: Wed, 25 May 2011 12:28:24 +0900 Subject: typooOooOoo --- usi.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/usi.js b/usi.js index 05567bf..d0664d1 100644 --- a/usi.js +++ b/usi.js @@ -35,7 +35,7 @@ THE POSSIBILITY OF SUCH DAMAGE. // INFO {{{ let INFO = <> - {NAME} login manager hogelog - 0.0.4 + 0.0.5 2.0pre - 2.2pre + 3.1 https://github.com/vimpr/vimperator-plugins/raw/master/loginManger.js public domain {NAME} login manager hogelog - 0.0.5 + 0.0.6 2.0pre 3.1 https://github.com/vimpr/vimperator-plugins/raw/master/loginManger.js @@ -239,7 +239,7 @@ commands.addUserCommand(["login"], "Login", completer: function(context, args){ if (args.completeArg == 0){ context.title = ["service"]; - context.completions = [[s,""] for(s in services)]; + context.completions = [[n,""] for([n,s] in Iterator(services)) if (s.getUsernames().length)]; } else if (args.completeArg == 1){ let service = services[args[0]]; if (!service) return false; @@ -258,7 +258,7 @@ commands.addUserCommand(["logout"], "Logout", }, { completer: function(context, args){ context.title = ["service"]; - context.completions = [[s,""] for(s in services)]; + context.completions = [[n,""] for([n,s] in Iterator(services)) if (s.getUsernames().length)]; }, }, true); // }}} -- cgit v1.2.3 From 819e9895648eb342f2c9da90e01827fe8429c1af Mon Sep 17 00:00:00 2001 From: anekos Date: Thu, 26 May 2011 22:17:50 +0900 Subject: ログアウトできないバグ修正 --- loginManager.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/loginManager.js b/loginManager.js index 8bd4776..b7a6a9f 100644 --- a/loginManager.js +++ b/loginManager.js @@ -145,7 +145,7 @@ function Service(service) //{{{ login(); }; - self.logout = function(){ + self.logout = function(username){ let content = {}; let host = service.HOST[0]; if (service.extraField && !self.setExtraField(content)) return false; -- cgit v1.2.3 From fafc5d2c62456ac852c5ae0ec7b7d098c93b16c1 Mon Sep 17 00:00:00 2001 From: anekos Date: Thu, 26 May 2011 22:28:05 +0900 Subject: logout も一応 --- loginManager.js | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/loginManager.js b/loginManager.js index b7a6a9f..cab59a2 100644 --- a/loginManager.js +++ b/loginManager.js @@ -217,23 +217,29 @@ function tokenGetter(pattern) //{{{ return RegExp.$1; } }; +} +function getServiceAndUsernameFromArgs(args, logout) +{ + let [servicename, username] = args; + let service = services[servicename]; + if (!service) return; + if (!username) { + let names = service.getUsernames(); + if (names.length === 1) + username = names[0]; + } + return [service, username]; } //}}} // Commands // {{{ commands.addUserCommand(["login"], "Login", function(args){ - let [servicename, username] = args; - let service = services[servicename]; - if (!service) return liberator.echoerr("Argument required. Please supply service name."); - if (!username) { - let names = service.getUsernames(); - if (names.length === 1) { - username = names[0]; - } else { - return liberator.echoerr("Argument required. Please supply user name."); - } - } + let [service, username] = getServiceAndUsernameFromArgs(args); + if (!service) + return liberator.echoerr("Argument required. Please supply service name."); + if (!username) + return liberator.echoerr("Argument required. Please supply user name."); service.login(username); }, { completer: function(context, args){ @@ -251,9 +257,9 @@ commands.addUserCommand(["login"], "Login", }, true); commands.addUserCommand(["logout"], "Logout", function(args){ - let [servicename, username] = args; - let service = services[servicename]; - if (!service) return false; + let [service, username] = getServiceAndUsernameFromArgs(args); + if (!service) + return liberator.echoerr("Argument required. Please supply service name."); service.logout(username); }, { completer: function(context, args){ -- cgit v1.2.3 From 049fbb0ad20edb7e037c32374cecb5dfde66a504 Mon Sep 17 00:00:00 2001 From: thinca Date: Fri, 27 May 2011 02:05:23 +0900 Subject: Supported comment for Google Bookmarks. --- direct_bookmark.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/direct_bookmark.js b/direct_bookmark.js index 1d3688b..f58e027 100644 --- a/direct_bookmark.js +++ b/direct_bookmark.js @@ -1,4 +1,4 @@ -// Last Change: 21-Jan-2010. Jan 2008 +// Last Change: 27-May-2011. Jan 2008 var PLUGIN_INFO = {NAME} @@ -490,7 +490,7 @@ for Migemo search: require XUL/Migemo Extension poster:function(user,password,url,title,comment,tags){ var request_url = 'http://www.google.com/bookmarks/mark'; var params = [ - ['bkmk', url], ['title', title], ['labels', tags.join(',')] + ['bkmk', url], ['title', title], ['labels', tags.join(',')], ['annotation', comment] ].map(function(p) p[0] + '=' + encodeURIComponent(p[1])).join('&'); return Deferred.http({ method: "post", -- cgit v1.2.3 From c3b557ff8750c8f482712b599ca15c9b678bf33e Mon Sep 17 00:00:00 2001 From: thinca Date: Fri, 27 May 2011 02:56:35 +0900 Subject: Supported tags for Google Bookmarks. --- direct_bookmark.js | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/direct_bookmark.js b/direct_bookmark.js index f58e027..37f80b6 100644 --- a/direct_bookmark.js +++ b/direct_bookmark.js @@ -28,6 +28,7 @@ for Migemo search: require XUL/Migemo Extension 'h': Hatena Bookmark 'd': del.icio.us 'l': livedoor clip + 'g': Google Bookmarks 'p': Places (Firefox bookmarks) Usage: let g:direct_sbm_use_services_by_tag = "hdl" ||< @@ -503,7 +504,23 @@ for Migemo search: require XUL/Migemo Extension if(xhr.status != 200) throw "Google Bookmarks: failed"; }); }, - tags:function(user,password) [], + tags:function(user,password){ + var returnValue = []; + var xhr = new XMLHttpRequest(); + xhr.open("GET", "https://www.google.com/bookmarks", false, user, password); + xhr.send(null); + + var html = parseHTML(xhr.responseText); + var tags = getElementsByXPath('//a[contains(@id,"lbl_m_")]/text()',html); + + tags.forEach(function(tag){ + var text = tag.textContent; + if(text.match(/\S/)) { + returnValue.push(text); + } + }); + return returnValue; + }, }, 'f': { description:'foves', -- cgit v1.2.3 From 0bababc66bac46a14408cb60e7262bdcb8703005 Mon Sep 17 00:00:00 2001 From: lyrical_logical Date: Sun, 29 May 2011 17:50:01 +0900 Subject: fix for eaa063f66dbb see http://code.google.com/p/vimperator-labs/source/diff?spec=svneaa063f66dbb3bc0d074b290fb79e273e2003fde&r=eaa063f66dbb3bc0d074b290fb79e273e2003fde&format=side&path=/common/modules/storage.jsm --- _libly.js | 2 +- copy.js | 2 +- hatena-bookmark-search.js | 2 +- multi_requester.js | 2 +- nextlink.js | 2 +- pluginManager.js | 2 +- scenario-actor.js | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/_libly.js b/_libly.js index b62e34a..c20d26e 100644 --- a/_libly.js +++ b/_libly.js @@ -682,7 +682,7 @@ libly.Wedata.prototype = { var logger = this.logger; var STORE_KEY = 'plugins-libly-wedata-' + this.dbname + '-items'; - var store = storage.newMap(STORE_KEY, true); + var store = storage.newMap(STORE_KEY, {store: true}); var cache = store && store.get('data'); if (store && cache && new Date(store.get('expire')) > new Date()) { diff --git a/copy.js b/copy.js index 8e353da..b4a57a4 100644 --- a/copy.js +++ b/copy.js @@ -265,7 +265,7 @@ function wedataRegister(item){ return function(value, value2){ var STORE_KEY = 'plugins-copy-ok-func'; - var store = storage.newMap(STORE_KEY, true); + var store = storage.newMap(STORE_KEY, {store: true}); var check = store.get(item.label); var ans; diff --git a/hatena-bookmark-search.js b/hatena-bookmark-search.js index 746843f..22fc58d 100644 --- a/hatena-bookmark-search.js +++ b/hatena-bookmark-search.js @@ -245,7 +245,7 @@ HatenaBookmark.Cache = { get store() { if (!this._store) { let key = 'plugins-hatena-bookmark-search-data'; - this._store = storage.newMap(key, true); + this._store = storage.newMap(key, {store: true}); } return this._store; }, diff --git a/multi_requester.js b/multi_requester.js index 9bfb4c4..305006f 100644 --- a/multi_requester.js +++ b/multi_requester.js @@ -123,7 +123,7 @@ var libly = liberator.plugins.libly; var $U = libly.$U; var logger = $U.getLogger("multi_requester"); var mergedSiteinfo = {}; -var store = storage.newMap('plugins-multi_requester', true); +var store = storage.newMap('plugins-multi_requester', {store: true}); //}}} // Vimperator plugin command register {{{ diff --git a/nextlink.js b/nextlink.js index 00768dd..9149966 100644 --- a/nextlink.js +++ b/nextlink.js @@ -112,7 +112,7 @@ var actpattern = liberator.globalVariables.nextlink_nositeinfo_act || "e"; var nositeinfoAct = nositeinfoActions[actpattern]; -var localSiteinfo = storage.newMap("nextlink-local-siteinfo", false); +var localSiteinfo = storage.newMap("nextlink-local-siteinfo", {store: false}); if (localSiteinfo) localSiteinfo = [ info for ([ i, info ] in localSiteinfo) ]; diff --git a/pluginManager.js b/pluginManager.js index 629a4e7..5cbd940 100644 --- a/pluginManager.js +++ b/pluginManager.js @@ -303,7 +303,7 @@ Plugin.prototype = { // {{{ return template.table(this.name, data); }, // }}} getResourceInfo: function(){ - var store = storage.newMap('plugins-pluginManager', true); + var store = storage.newMap('plugins-pluginManager', {store: true}); var url = this.info.updateURL; var localResource = store.get(this.name) || {}; var serverResource = { diff --git a/scenario-actor.js b/scenario-actor.js index 10735ec..727edb0 100644 --- a/scenario-actor.js +++ b/scenario-actor.js @@ -93,7 +93,7 @@ var $U = libly.$U; var logger = $U.getLogger('scenario-actor'); function ScenarioActor () { //{{{ - let variables = storage.newMap('scenarioactor', true); + let variables = storage.newMap('scenarioactor', {store: true}); function ScenarioContext(event) { //{{{ let triggeredEvent = event; -- cgit v1.2.3 From 174ea598fdf63553c532cd70537f10a6056060cd Mon Sep 17 00:00:00 2001 From: retlet Date: Thu, 2 Jun 2011 19:50:26 +0900 Subject: deliciousとevernote追加 --- loginManager.js | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/loginManager.js b/loginManager.js index cab59a2..2628211 100644 --- a/loginManager.js +++ b/loginManager.js @@ -4,7 +4,7 @@ var PLUGIN_INFO = {NAME} login manager hogelog - 0.0.6 + 0.0.7 2.0pre 3.1 https://github.com/vimpr/vimperator-plugins/raw/master/loginManger.js @@ -109,6 +109,29 @@ var services = { CSRFPROTECT: tokenGetter(/CSRFPROTECT.+value="(.+?)"/), }, }, + delicious: { + HOST: ["https://secure.delicious.com"], + LOGIN: "/login", + LOGOUT: "/logout", + usernameField: "username", + passwordField: "password", + extraField: { + rememberme: "1", + }, + }, + evernote: { + HOST: ["https://www.evernote.com"], + LOGIN: "/Login.action", + LOGOUT: "/Logout.action", + usernameField: "username", + passwordField: "password", + extraField: { + rememberMe: "true", + _sourcePage: tokenGetterLoginURL(/_sourcePage.+value="(.+?)"/), + __fp: tokenGetterLoginURL(/__fp.+value="(.+?)"/), + login: "Sign In", + }, + }, }; for (name in services){ services[name] = new Service(services[name]); @@ -218,6 +241,15 @@ function tokenGetter(pattern) //{{{ } }; } +function tokenGetterLoginURL(pattern) //{{{ +{ + return function(service){ + let res = util.httpGet(service.HOST[0]+service.LOGIN); + if (pattern.test(res.responseText)){ + return RegExp.$1; + } + }; +} function getServiceAndUsernameFromArgs(args, logout) { let [servicename, username] = args; -- cgit v1.2.3 From 764d72b3fd1a9f8f95c427e25e4e29730671d153 Mon Sep 17 00:00:00 2001 From: mitsugu oyama Date: Thu, 2 Jun 2011 22:08:05 +0900 Subject: twaudio modified specifications. --- twaudio.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/twaudio.js b/twaudio.js index 218a365..cddf478 100644 --- a/twaudio.js +++ b/twaudio.js @@ -47,9 +47,9 @@ commands.addUserCommand( null //relatedTarget ); let btnPlay=contents.getElementById('play0'); - if(null==btnPlay.getAttribute('style')){ // for twaud.io's bug - contents.location.reload(); - }else if('display: block;'==btnPlay.getAttribute('style')){ + let btnPause=contents.getElementById('pause0'); + if(('display: block;'==btnPlay.getAttribute('style')) + ||(null==btnPlay.getAttribute('style'))){ btnPlay.dispatchEvent(evt); }else{ let btnPause=contents.getElementById('pause0'); -- cgit v1.2.3 From d047c1c57089b6cc838354d435a4e93f76eee4b2 Mon Sep 17 00:00:00 2001 From: anekos Date: Fri, 3 Jun 2011 01:20:44 +0900 Subject: スクロールしないでも、サムネでるんだよ。 --- stella.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/stella.js b/stella.js index ad82531..9ded68e 100644 --- a/stella.js +++ b/stella.js @@ -39,12 +39,11 @@ let PLUGIN_INFO = すてら For Niconico/YouTube/Vimeo, Add control commands and information display(on status line). ニコニコ動画/YouTube/Vimeo 用。操作コマンドと情報表示(ステータスライン上に)追加します。 - 0.32.7 + 0.32.8 anekos new BSD License (Please read the source code comments of this plugin) 修正BSDライセンス (ソースコードのコメントを参照してください) 2.0 - 3.0 https://github.com/vimpr/vimperator-plugins/raw/master/stella.js > 336 http://hibari.2ch.net/test/read.cgi/software/1282406907/ --- walk-input.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/walk-input.js b/walk-input.js index f788746..77d4caa 100644 --- a/walk-input.js +++ b/walk-input.js @@ -65,7 +65,7 @@ let INFO = var types = [ "text", - "passsword", + "password", "search", "file", "datetime", -- cgit v1.2.3 From 30da375c3b825ee6d5b8ebd74247bd44cda1688f Mon Sep 17 00:00:00 2001 From: anekos Date: Sun, 5 Jun 2011 10:33:20 +0900 Subject: follow gmail changes --- gmail-commando.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gmail-commando.js b/gmail-commando.js index 25ca2a3..9e437b1 100644 --- a/gmail-commando.js +++ b/gmail-commando.js @@ -35,7 +35,7 @@ THE POSSIBILITY OF SUCH DAMAGE. // INFO {{{ let INFO = <> - - td.SA > .iL.B9')), get translateButtons () A(this.doc.querySelectorAll('tr > td.SA > .iL.B9')), -- cgit v1.2.3 From 2b37218f86e9e0e8fabe3dfe35dd86ea7a0757bb Mon Sep 17 00:00:00 2001 From: anekos Date: Mon, 6 Jun 2011 03:38:09 +0900 Subject: Follow buzz --- gmail-commando.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/gmail-commando.js b/gmail-commando.js index 9e437b1..8874567 100644 --- a/gmail-commando.js +++ b/gmail-commando.js @@ -35,7 +35,7 @@ THE POSSIBILITY OF SUCH DAMAGE. // INFO {{{ let INFO = <> - - td.SA > .iL.B9')), get translateButtons () A(this.doc.querySelectorAll('tr > td.SA > .iL.B9')), -- cgit v1.2.3 From 9bd65664fc8064442e36b7957d9c8b72438795da Mon Sep 17 00:00:00 2001 From: anekos Date: Mon, 6 Jun 2011 03:40:17 +0900 Subject: 謎のコメント削除 --- gmail-commando.js | 7 ------- 1 file changed, 7 deletions(-) diff --git a/gmail-commando.js b/gmail-commando.js index 8874567..3798898 100644 --- a/gmail-commando.js +++ b/gmail-commando.js @@ -277,13 +277,6 @@ let INFO = Elements.doc.querySelectorAll('.NRYPqe > .J-Zh-I.J-J5-Ji.J-Zh-I.J-Zh-I-Js-Zq')[2] }; - //'.J-M-JJ > input' - //let (e = Elements.doc.querySelector('.J-LC-Jz')) { - // liberator.log(e); - // buffer.followLink(e); - // //plugins.feedSomeKeys_3.API.feed('', ['keydown'], e) - //} - const Commando = { get inGmail () { try { -- cgit v1.2.3 From 81e28a8887fe99421cdeec3d6a78834b7a93011c Mon Sep 17 00:00:00 2001 From: anekos Date: Mon, 6 Jun 2011 03:40:34 +0900 Subject: ReadItLater 追加 --- loginManager.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/loginManager.js b/loginManager.js index 2628211..70a061d 100644 --- a/loginManager.js +++ b/loginManager.js @@ -4,9 +4,9 @@ var PLUGIN_INFO = {NAME} login manager hogelog - 0.0.7 + 0.0.8 2.0pre - 3.1 + 3.2 https://github.com/vimpr/vimperator-plugins/raw/master/loginManger.js public domain Auto Detect Link Find (next|previous) link, and jump. (次|前)っぽいページへのリンクを探してジャンプ - 1.8.2 + 1.8.3 anekos 2.0pre - 2.4 https://github.com/vimpr/vimperator-plugins/raw/master/auto_detect_link.js Creative Commons Attribution-Share Alike 3.0 Unported @@ -182,7 +181,7 @@ var PLUGIN_INFO = // 要素をクリックする function clickElement (elem) - buffer.followLink(elem); + buffer.followLink(elem, liberator.CURRENT_TAB); // 開いたURIなどの表示 -- cgit v1.2.3 From b533b28d4551f7a33112bdf2c3748f7c3e004b41 Mon Sep 17 00:00:00 2001 From: wlt Date: Mon, 6 Jun 2011 11:16:26 -0700 Subject: Fx 5.0 BetaにしたらRegExp#exec()を間接的に呼び出せなくなったので --- caret-hint.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/caret-hint.js b/caret-hint.js index ba6772e..60c6ec0 100644 --- a/caret-hint.js +++ b/caret-hint.js @@ -288,7 +288,7 @@ let INFO = // Vimperator 3.0 までと 3.1 以降に両対応 const [CaretKey, VisualKey] = - /caret/(mappings.getDefault(modes.NORMAL, 'i').description) ? ['i', 'v'] : ['c', 'v']; + /caret/.exec(mappings.getDefault(modes.NORMAL, 'i').description) ? ['i', 'v'] : ['c', 'v']; function moveCaret (elem, head, select) { let doc = elem.ownerDocument; -- cgit v1.2.3 From 9cfb5d9d53086142ff2d42ae710822f5f2310e5c Mon Sep 17 00:00:00 2001 From: wlt Date: Mon, 6 Jun 2011 12:04:32 -0700 Subject: Fx 5.0 BetaにしたらRegExp#exec()を間接的に呼び出せなくなったので --- appendAnchor.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appendAnchor.js b/appendAnchor.js index 77496e8..f148493 100644 --- a/appendAnchor.js +++ b/appendAnchor.js @@ -73,7 +73,7 @@ let PLUGIN_INFO = // build URL let scheme = RegExp.$1, host = RegExp.$2, lastMatch = RegExp.lastMatch; - if (/^ttps?$/(scheme)) scheme = 'h' + scheme; + if (/^ttps?$/.exec(scheme)) scheme = 'h' + scheme; let href = scheme + '://' + host; // reset range -- cgit v1.2.3 From 7eaf3037a993b72d95f630902a2c19d929ada602 Mon Sep 17 00:00:00 2001 From: anekos Date: Tue, 7 Jun 2011 04:07:34 +0900 Subject: RegExp の関数的な呼び出しができなくなったので修正 for Firefox5 --- appendAnchor.js | 2 +- auto_source.js | 2 +- edit-vimperator-files.js | 2 +- feedSomeKeys_3.js | 2 +- gmail-commando.js | 8 ++++---- google-translator.js | 2 +- hints-for-embedded.js | 4 ++-- pluginManager.js | 4 ++-- session-manager.js | 2 +- stella.js | 8 ++++---- twittperator.js | 12 ++++++------ usi.js | 2 +- zip-de-download.js | 4 ++-- 13 files changed, 27 insertions(+), 27 deletions(-) diff --git a/appendAnchor.js b/appendAnchor.js index f148493..8ca02a2 100644 --- a/appendAnchor.js +++ b/appendAnchor.js @@ -73,7 +73,7 @@ let PLUGIN_INFO = // build URL let scheme = RegExp.$1, host = RegExp.$2, lastMatch = RegExp.lastMatch; - if (/^ttps?$/.exec(scheme)) scheme = 'h' + scheme; + if (/^ttps?$/.test(scheme)) scheme = 'h' + scheme; let href = scheme + '://' + host; // reset range diff --git a/auto_source.js b/auto_source.js index b1ff95f..5b979fd 100644 --- a/auto_source.js +++ b/auto_source.js @@ -135,7 +135,7 @@ let INFO = function source (filepath) { io.source(filepath); - if (/\.js$/(filepath)) { + if (/\.js$/.test(filepath)) { let ctx = liberator.plugins.contexts[filepath]; if (ctx) { if (typeof liberator.plugins[ctx.NAME] === 'undefined') diff --git a/edit-vimperator-files.js b/edit-vimperator-files.js index 0ee97fc..544c562 100644 --- a/edit-vimperator-files.js +++ b/edit-vimperator-files.js @@ -99,7 +99,7 @@ let INFO = [ [file.path, dir] for ([, file] in Iterator(io.File(dir).readDirectory(false))) - if (file.isFile() && /^[\._]vimperatorrc|\.(js|vimp|css)$/(file.leafName)) + if (file.isFile() && /^[\._]vimperatorrc|\.(js|vimp|css)$/.test(file.leafName)) ] for ([, dir] in Iterator(dirs)) ]); diff --git a/feedSomeKeys_3.js b/feedSomeKeys_3.js index e265084..b8891c5 100644 --- a/feedSomeKeys_3.js +++ b/feedSomeKeys_3.js @@ -520,7 +520,7 @@ let INFO = <> const ModeStringsCompleter = [ [name, disp + ' mode' + (char ? ' (alias: ' + char + ')' : '')] for ([n, {name, char, disp, extended}] in Iterator(modes._modeMap)) - if (!extended && /^\D+$/(n)) + if (!extended && /^\D+$/.test(n)) ]; diff --git a/gmail-commando.js b/gmail-commando.js index 3798898..699eeff 100644 --- a/gmail-commando.js +++ b/gmail-commando.js @@ -231,7 +231,7 @@ let INFO = get hasBuzz () !!this.doc.querySelector('input#\\:re'), - get labels() A(this.doc.querySelectorAll('a.n0')).filter(function (it) (/#label/(it.href))), + get labels() A(this.doc.querySelectorAll('a.n0')).filter(function (it) (/#label/.test(it.href))), // 入力欄 と 検索ボタンは Buzz の有効無効によって ID が変わる get input() this.doc.querySelector('input#\\:' + (this.hasBuzz ? 're' : 'rf')), @@ -280,7 +280,7 @@ let INFO = const Commando = { get inGmail () { try { - var result = /^mail\.google\.com$/(Elements.doc.location.hostname) + var result = /^mail\.google\.com$/.test(Elements.doc.location.hostname) } catch (e) {} return result; }, @@ -388,7 +388,7 @@ let INFO = let input = args.string.slice(0, context.caret); let m; - if (m = /([a-z]+):(?:([^\s\(\)\{\}]*)|[\(\{]([^\(\)\{\}]*))$/(input)) { + if (m = /([a-z]+):(?:([^\s\(\)\{\}]*)|[\(\{]([^\(\)\{\}]*))$/.exec(input)) { if (m[2]) { context.advance(input.length - m[2].length); } else { @@ -397,7 +397,7 @@ let INFO = } let key = m[1]; KeywordValueCompleter[key](context, args); - } else if (m = /[-\s]*([^-\s:\(\)\{\}]*)$/(input)) { + } else if (m = /[-\s]*([^-\s:\(\)\{\}]*)$/.exec(input)) { context.advance(input.length - m[1].length); context.completions = [ [v + ':', v] for ([, v] in Iterator(GMailSearchKeyword)) diff --git a/google-translator.js b/google-translator.js index a34819e..49d272b 100644 --- a/google-translator.js +++ b/google-translator.js @@ -201,7 +201,7 @@ let INFO = context.completions = [ [it, ''] for ([, it] in Iterator(getTexts())) - if (it.length > 3 && !/^\s* 3 && !/^\s*]*)?>([\s\S]+?)<\/VimperatorPlugin[ \t\r\n]*>/(source); + let m = /\bPLUGIN_INFO[ \t\r\n]*=[ \t\r\n]*]*)?>([\s\S]+?)<\/VimperatorPlugin[ \t\r\n]*>/.exec(source); if (m){ m = m[1].replace(/(?:))*\]\]|--(?:[^-]|-(?!-))*--)>)+/g, ''); - m = /^[\w\W]*?]*)?>([^<]+)<\/version[ \t\r\n]*>/(m); + m = /^[\w\W]*?]*)?>([^<]+)<\/version[ \t\r\n]*>/.exec(m); if (m){ version = m[1]; } diff --git a/session-manager.js b/session-manager.js index 0e377ba..10a7706 100644 --- a/session-manager.js +++ b/session-manager.js @@ -220,7 +220,7 @@ let INFO = context.completions = [ [file.leafName.replace(/\.session$/, ''), new Date(file.lastModifiedTime)] for ([,file] in Iterator(io.File(gSessionManager.getSessionDir()).readDirectory())) - if (!ignoreAuto || args['-auto'] || !/^(backup(-\d+)?|autosave)\.session$/(file.leafName)) + if (!ignoreAuto || args['-auto'] || !/^(backup(-\d+)?|autosave)\.session$/.test(file.leafName)) ].sort(function ([, a], [, b]) (b - a)); } }, diff --git a/stella.js b/stella.js index 9ded68e..8eb8119 100644 --- a/stella.js +++ b/stella.js @@ -380,11 +380,11 @@ Thanks: // 上手い具合に秒数に直すよ fromTimeCode: function (code, max) { var m; - if (max && (m = /^(-?\d+(?:\.\d)?)%/(code))) + if (max && (m = /^(-?\d+(?:\.\d)?)%/.exec(code))) return Math.round(max * (parseFloat(m[1]) / 100)); - if (m = /^(([-+]?)\d+):(\d+)$/(code)) + if (m = /^(([-+]?)\d+):(\d+)$/.exec(code)) return parseInt(m[1], 10) * 60 + (m[2] == '-' ? -1 : 1) * parseInt(m[3], 10); - if (m = /^([-+]?\d+\.\d+)$/(code)) + if (m = /^([-+]?\d+\.\d+)$/.exec(code)) return Math.round(parseFloat(m[1]) * 60); return parseInt(code, 10); }, @@ -834,7 +834,7 @@ Thanks: } YouTubePlayer.getIDfromURL = function (url) let ([_, r] = url.match(/[?;&]v=([-\w]+)/)) r; - YouTubePlayer.isVideoURL = function (url) /^https?:\/\/(www\.)?youtube\.com\/watch\?.+/(url); + YouTubePlayer.isVideoURL = function (url) /^https?:\/\/(www\.)?youtube\.com\/watch\?.+/.test(url); YouTubePlayer.prototype = { __proto__: Player.prototype, diff --git a/twittperator.js b/twittperator.js index e09a273..fc439db 100644 --- a/twittperator.js +++ b/twittperator.js @@ -1273,7 +1273,7 @@ let PLUGIN_INFO = } for (let [n, v] in Iterator(options)) { - if (/^on[A-Z]/(n) && (v instanceof Function)) + if (/^on[A-Z]/.test(n) && (v instanceof Function)) this.events[n.toLowerCase()] = v; } @@ -1409,7 +1409,7 @@ let PLUGIN_INFO = lines[0] = buf + lines[0]; for (let [, line] in Iterator(lines.slice(0, -1))) { try { - if (/^\s*\{/(line)) + if (/^\s*\{/.test(line)) onMsg(Utils.fixStatusObject(JSON.parse(line)), line); } catch (e) { liberator.log(e); } } @@ -1560,7 +1560,7 @@ let PLUGIN_INFO = } for (let [n, v] in Iterator(st)) { - if (/(^|_)id$/(n)) + if (/(^|_)id$/.test(n)) fixId(result, n); } @@ -1636,7 +1636,7 @@ let PLUGIN_INFO = function loadPluginFromDir(checkGV) { return function(dir) { dir.readDirectory().forEach(function(file) { - if (/\.tw$/(file.path) && (!checkGV || isEnabled(file))) + if (/\.tw$/.test(file.path) && (!checkGV || isEnabled(file))) Twittperator.sourceScriptFile(file); }); } @@ -2004,7 +2004,7 @@ let PLUGIN_INFO = "^" + this.command.map(function(c) let (r = util.escapeRegex(c)) - (/^\W$/(c) ? r : r + "( |$)") + (/^\W$/.test(c) ? r : r + "( |$)") ).join("|") ); }, @@ -2069,7 +2069,7 @@ let PLUGIN_INFO = description: "Open link", action: function(arg) Twittperator.openLink(arg), timelineCompleter: true, - completer: Completers.text(function(s) /https?:\/\//(s.text)) + completer: Completers.text(function(s) /https?:\/\//.test(s.text)) }), SubCommand({ command: ["delete"], diff --git a/usi.js b/usi.js index d0664d1..fe8db8f 100644 --- a/usi.js +++ b/usi.js @@ -700,7 +700,7 @@ let INFO = // FIXME http が補完できない let left = args.string.slice(0, context.caret); - let m = /(?:^|\s)([#!@=*^]|http)([^#!@=*^]*)$/(left); + let m = /(?:^|\s)([#!@=*^]|http)([^#!@=*^]*)$/.exec(left); if (m) { let completer = SmartAddCompleter[m[1]]; if (completer) { diff --git a/zip-de-download.js b/zip-de-download.js index a224011..9658057 100644 --- a/zip-de-download.js +++ b/zip-de-download.js @@ -176,7 +176,7 @@ let SITE_INFO = [ // 連番かもしれない id は無視する let id = elem.getAttribute('id'); - if (id && !/\d/(id)) + if (id && !/\d/.test(id)) return 'id("' + id + '")'; return getXPath(elem.parentNode) + '/' + elem.tagName.toLowerCase(); @@ -205,7 +205,7 @@ let SITE_INFO = [ return result; } function extensionValidator(vs) - vs && vs.every(function (v) /^[\da-zA-Z]+$/(v)); + vs && vs.every(function (v) /^[\da-zA-Z]+$/.test(v)); let self = { downloadZip: function(path, urls, comment, isAppend){ -- cgit v1.2.3 From 9209e9b7306cff9b3db0e79871ff045a512ee05b Mon Sep 17 00:00:00 2001 From: wlt Date: Mon, 6 Jun 2011 12:18:04 -0700 Subject: Fx 5.0Betaのため識別子classエラー回避。使われてない関数extend()削除。 --- sl.js | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/sl.js b/sl.js index 4bf0976..fe322a5 100644 --- a/sl.js +++ b/sl.js @@ -255,22 +255,6 @@ SL.prototype = { // {{{ let luckyStar = (function(){ -function extend(class, obj){ - var flag; - for (let i in obj){ - flag = false; - if (obj.__lookupGetter__(i)){ - class.prototype.__defineGetter__(i, obj.__lookupGetter__(i)); - flag = true; - } - if (obj.__lookupSetter__(i)){ - class..prototype.__defineSetter__(i, obj.__lookupSetter__(i)); - flag = true; - } - if (!flag) class.prototype[i] = obj[i]; - } -} - let colors = [ ["rgba(255,215,0,alpha)", "rgba(255,255,0,alpha)"], //gold, yellow ["rgba(255,20,147,alpha)","rgba(255,0,255, alpha)"], // deeppink, magenta -- cgit v1.2.3 From 10158d82828f4c90d1d416c51cccff81a68a7151 Mon Sep 17 00:00:00 2001 From: mitsugu oyama Date: Sat, 11 Jun 2011 21:20:47 +0900 Subject: Closed twaud.io --- twaudio.js | 81 -------------------------------------------------------------- 1 file changed, 81 deletions(-) delete mode 100644 twaudio.js diff --git a/twaudio.js b/twaudio.js deleted file mode 100644 index cddf478..0000000 --- a/twaudio.js +++ /dev/null @@ -1,81 +0,0 @@ -// INFO // -var INFO = - - Mitsugu Oyama - MIT - -

twaud.io player controller.

- - 'twaudio' - :twplay - - -

twaud.io player controller.

-
-
-
; - -commands.addUserCommand( - ['twp[lay]'], - 'toggle to play button', - function(){ - let contents=gBrowser.selectedBrowser.contentDocument; - // twaud.ioのjQueryの使い方によりマウス・イベントをエミュレート - // するしかないっぽい。 - let evt=contents.createEvent("MouseEvents"); - evt.initMouseEvent( - 'click', - true, // canBubble - true, // cancelable - window, // view - 0, // detail - 0, // screenX - 0, // screenY - 0, // clientX - 0, // clientY - false, // ctrlKey - false, // altKey - false, // shiftKey - false, // metaKey - 0, // button - null //relatedTarget - ); - let btnPlay=contents.getElementById('play0'); - let btnPause=contents.getElementById('pause0'); - if(('display: block;'==btnPlay.getAttribute('style')) - ||(null==btnPlay.getAttribute('style'))){ - btnPlay.dispatchEvent(evt); - }else{ - let btnPause=contents.getElementById('pause0'); - btnPause.dispatchEvent(evt); - } - }, - { - literal: false - }, - true -); - -/* -実装するか未定。jQueryが許さないかも。 -commands.addUserCommand( - ['twv[olume]'], - 'set volume of twaud.io player.', - function(args){ - if(1!=args.length){ - liberator.echoerr('argument error'); - return false; - } - }, - { - literal: false - }, - true -); -*/ -- cgit v1.2.3 From 120d37a31fd7280151e56ea1846bed438c359efc Mon Sep 17 00:00:00 2001 From: anekos Date: Thu, 9 Jun 2011 07:19:01 +0900 Subject: Vimperator の変更に対応 --- migemized_find.js | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/migemized_find.js b/migemized_find.js index 3e9a16b..351d913 100644 --- a/migemized_find.js +++ b/migemized_find.js @@ -578,8 +578,8 @@ let PLUGIN_INFO = MF.cancel(); }, - onKeyPress: function (str) { - liberator.log('onKeyPress'); + onChange: function (str) { + liberator.log('onChange'); if (typeof str == 'string') { liberator.log('findFirst'); _findFirst(str, _backwards); @@ -588,15 +588,21 @@ let PLUGIN_INFO = }, }; - commandline.registerCallback("change", modes.SEARCH_FORWARD, migemized.onKeyPress); - commandline.registerCallback("submit", modes.SEARCH_FORWARD, migemized.onSubmit); - commandline.registerCallback("cancel", modes.SEARCH_FORWARD, migemized.onCancel); - commandline.registerCallback("change", modes.SEARCH_BACKWARD, migemized.onKeyPress); - commandline.registerCallback("submit", modes.SEARCH_BACKWARD, migemized.onSubmit); - commandline.registerCallback("cancel", modes.SEARCH_BACKWARD, migemized.onCancel); - finder.findAgain = migemized.findAgain; + plugins.libly.$U.around( + finder, + 'openPrompt', + function (next, [mode]) { + let res = next(); + plugins.libly.$U.around(commandline._input, 'change', function (next, [str]) migemized.onChange(str)); + plugins.libly.$U.around(commandline._input, 'submit', function (next, [str]) migemized.onSubmit(str)); + plugins.libly.$U.around(commandline._input, 'cancel', function (next, [str]) migemized.onCancel()); + return res; + }, + true + ); + // highlight コマンド commands.addUserCommand( ['ml', 'migelight'], @@ -611,7 +617,8 @@ let PLUGIN_INFO = options: [ [['-color', '-c'], commands.OPTION_STRING, null, colorsCompltions], ] - } + }, + true ); // remove highlight コマンド @@ -647,7 +654,8 @@ let PLUGIN_INFO = [['-backward', '-b'], commands.OPTION_NOARG], [['-color', '-c'], commands.OPTION_STRING, null, colorsCompltions], ] - } + }, + true ); // 外から使えるように -- cgit v1.2.3 From d16ecfbc59d5e4b573946e7185382f6464614a2f Mon Sep 17 00:00:00 2001 From: anekos Date: Thu, 9 Jun 2011 07:19:45 +0900 Subject: いらんログ削除 --- migemized_find.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/migemized_find.js b/migemized_find.js index 351d913..f6f9f4b 100644 --- a/migemized_find.js +++ b/migemized_find.js @@ -39,13 +39,12 @@ let PLUGIN_INFO = Migemized Find Migemize default page search. デフォルトのドキュメント内検索をミゲマイズする。 - 2.10.1 + 2.10.2 anekos new BSD License (Please read the source code comments of this plugin) 修正BSDライセンス (ソースコードのコメントを参照してください) https://github.com/vimpr/vimperator-plugins/raw/master/migemized_find.js 3.0 - 3.0 - - {NAME} login manager hogelog - 0.0.8 + 0.0.9 2.0pre 3.2 https://github.com/vimpr/vimperator-plugins/raw/master/loginManger.js @@ -139,6 +139,15 @@ var services = { usernameField: "feed_id", passwordField: "password", }, + nicovideo: { + HOST: ["https://secure.nicovideo.jp"], + LOGIN: "/secure/login", + usernameField: "mail", + passwordField: "password", + extraField: { + site: "niconico" + } + }, }; for (name in services){ services[name] = new Service(services[name]); -- cgit v1.2.3 From 0280b0de3e2828fcc3006fd9181a09cdaae4ce02 Mon Sep 17 00:00:00 2001 From: anekos Date: Wed, 15 Jun 2011 15:25:38 +0900 Subject: Initial release: IFrame から キーでぬけるだけのプラグイン --- escape-from-iframe.js | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 escape-from-iframe.js diff --git a/escape-from-iframe.js b/escape-from-iframe.js new file mode 100644 index 0000000..7eede18 --- /dev/null +++ b/escape-from-iframe.js @@ -0,0 +1,71 @@ +/* NEW BSD LICENSE {{{ +Copyright (c) 2011, anekos. +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + 3. The names of the authors may not be used to endorse or promote products + derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF +THE POSSIBILITY OF SUCH DAMAGE. + + +################################################################################### +# http://sourceforge.jp/projects/opensource/wiki/licenses%2Fnew_BSD_license # +# に参考になる日本語訳がありますが、有効なのは上記英文となります。 # +################################################################################### + +}}} */ + +// INFO {{{ +let INFO = +<> + + anekos + New BSD License + +

Just install this plugin.

+ + ]]> + <Esc> +

Escape from iframe (focus to parent window).

+
+
+; +// }}} + +(function () { + //let map = mappings.getDefault(modes.NORMAL, ''); + mappings.addUserMap( + [modes.NORMAL], + [''], + 'Focus to parent window', + function() { + if (modes.passNextKey || modes.passAllKeys) + return events.onEscape(); + Buffer.focusedWindow = Buffer.focusedWindow.parent; + }, + {} + ); +})(); + +// vim:sw=2 ts=2 et si fdm=marker: -- cgit v1.2.3 From 060fff6544394a7025aba9b1bf6d7c41d567089e Mon Sep 17 00:00:00 2001 From: anekos Date: Fri, 17 Jun 2011 23:06:16 +0900 Subject: responseText が空になるようなので対処 --- "\350\267\263.js" | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git "a/\350\267\263.js" "b/\350\267\263.js" index 0067e54..ef89be4 100644 --- "a/\350\267\263.js" +++ "b/\350\267\263.js" @@ -35,7 +35,7 @@ THE POSSIBILITY OF SUCH DAMAGE. // INFO {{{ let INFO = <> - + Copyright (c) 2008-2011 anekos distributable under the terms of an MIT-style license. http://www.opensource.jp/licenses/mit-license.html @@ -11,10 +12,10 @@ var PLUGIN_INFO = Vimperator plugins library? 適当なライブラリっぽいものたち。 suVene + anekos MIT - 0.1.34 + 0.1.35 2.3pre - 3.0 https://github.com/vimpr/vimperator-plugins/raw/master/_libly.js @@ -232,7 +232,7 @@ let SITE_INFO = [ try { let stream = ch.open(); let entryName = ("000" + ++i).slice(-3) + "-" + getEntryName(ch.URI, ch.contentType); - liberator.echomsg("zip: " + url + " to " + entryName, 3); + liberator.echomsg("zip: " + url + " to " + entryName, commandline.FORCE_SINGLELINE); zipW.addEntryStream(entryName, Date.now() * 1000, Ci.nsIZipWriter.COMPRESSION_DEFAULT, stream, false); } catch (e) { // XXX エラー分を通知すべき? -- cgit v1.2.3 From 71ef6f5a46a02b683972c0191dd872dcfa4b9abc Mon Sep 17 00:00:00 2001 From: mashiro Date: Tue, 21 Jun 2011 11:02:02 +0900 Subject: set ff=unix --- ldrize_cooperation.js | 850 +++++++++++++++++++++++++------------------------- 1 file changed, 425 insertions(+), 425 deletions(-) diff --git a/ldrize_cooperation.js b/ldrize_cooperation.js index 35952e4..f5e79b9 100644 --- a/ldrize_cooperation.js +++ b/ldrize_cooperation.js @@ -1,425 +1,425 @@ -// Vimperator plugin: 'Cooperation LDRize Mappings' -// Version: 0.25 -// Last Change: 07-Jan-2011. Jan 2008 -// License: Creative Commons -// Maintainer: Trapezoid - http://unsigned.g.hatena.ne.jp/Trapezoid -// -// Cooperation LDRize Mappings for Vimperator -// -// Variables: -// g:ldrc_captureMapping -// Specifies keys that capture by LDRize -// usage: let g:ldrc_captureMappings = "['j','k','p','o','?']" -// g:ldrc_enable -// LDRize Cooperation be Enable by default or not -// usage: let g:ldrc_enable = "false" -// default: true -// g:ldrc_hints -// Narrows "hinttags" based on Siteinfo. -// usage: let g:ldrc_hints = "true" -// default: false -// g:ldrc_intelligence_bind -// More inteligence cooperation bind -// usage: let g:ldrc_intelligence_bind = "true" -// default: false -// g:ldrc_skip -// length in which paragraph is skipped (use by inteligence bind mode) -// usage: let g:ldrc_hints = "true" -// default: 0.5 -// Mappings: -// Mappings for LDRize -// default: 'j','k','p','o' -// Commands: -// 'm' or 'mb' or 'minibuffer': -// Execute args as Minibuffer Command -// usage: :minibuffer pinned-link | open | clear-pin -// 'pin': -// View pinned link list -// usage: :pin -// 'pindownload': -// Download View pinned link by handler function or outer promgram. please see 'handlerInfo' also -// usage: :pindownload -// 'ldrc' or 'toggleldrizecooperation': -// Toggle LDRize Cooperation -// usage: :toggleldrizecooperation -// Hints: -// ';l': -// narrow down the candidates to LDRize paragraphes -// ';L': -// narrow down the candidates to LDRize paragraphes (in a new tab) -// Options: -// 'ldrc' -// Enable LDRize Cooperation -// usage: :set ldrc -// 'noldrc' -// Disable LDRize Cooperation -// usage: :set noldrc -// -// 'ldrchints' -// Enable "Narrows Hinttags based on Siteinfo" -// usage: :set ldrchints -// 'noldrchints' -// Disable "Narrows Hinttags based on Siteinfo" -// usage: :set noldrchints -if (liberator.plugins.LDRizeCooperation == undefined) (function(){ - //pattern: wildcard - //include: [regexp,option] or regexp - //handler: [programPath,[args]] or programPath or function(url,title) - var handlerInfo = [ - //{ - // pattern: "http://www.nicovideo.jp/*", - // handler: { - // download: ["c:\\usr\\SmileDownloader\\SmileDownloader.exe",["%URL%"]] - // }, - // wait: 5000 - //}, - //{ - // handler: ["C:\\usr\\irvine\\irvine.exe",["%URL%"]], - //}, - ]; - const DISABLE_ICON = "data:image/png;base64," - +"iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAACXBIWXMAAA7E" - +"AAAOxAGVKw4bAAACL0lEQVR4nF2Sy0tUYRjGf9+Z4/HMjJfjBUZEMM2MSDII" - +"REjSVtVecBFZi6Bdi4RW/SFBq2oR0R8gSaUJhVJIBkEEMZOWl5kuM+fqnPN9" - +"52sxQ4kPv837Pu+zel4xMjkz/3h5p87pbhyDw4o1mzUOkubYbvLo2kVx+4Pe" - +"rAKMdTGQ5YgiWK/8z+QT3yyVUTFAzaBXHQ0IONPKOxepAH65dUOGSB/pM9LC" - +"whjyy/sg4DB3TjGZbjVuVIihQhKfxGdzmzhhNBvGXhr7NDiRY+fr573ibmtC" - +"4pN4GNJDukiXusvbIuMnh9K9YujSYKKPl6vrZu+EI5EuyheG9JEe0qPusfSR" - +"4cGBbPA98og8LMlAPlor2ZEvVIT0kD6G9EhcEpfY58c+xbKYHBaRl4Ye432s" - +"rqyo7pnQo/qTxEW62gy2CKoAbheu4mGGm5eHgsViOTh+5Sp37+2X4gJQC0gU" - +"Otb0j2hhaCG06NfC0K22/radzs6uTM3ojY1SobDcdHNaCC2Mimn2YZmQggEd" - +"kPJ0UczfyOzVWHr1xnVmrS5I0R6pgTC1mXdoUwB2Jj5QFvDsBc8fTCkpL82l" - +"uW6rWWEPQBoL07JwCgAaywbgd8ynIrultTB3wWk73LtWdS3OXtd/fBwH2+Yg" - +"xM4R14kqrzMZzM5pO9dcNlQrl832wTSoGiEok84eOrK0ZGB0+shTJYpyFUv7" - +"In/s/LlbTyq+/ufZFlkTK4MhAJKUMCGs6x473rg/9xe9wS0xVA1n/AAAAABJ" - +"RU5ErkJggg=="; - const ENABLE_ICON = "data:image/png;base64," - +"iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAACXBIWXMAAAsT" - +"AAALEwEAmpwYAAACI0lEQVR4nGWSzU7yQBSGp84UKalDY0MkLsSdYWtCIok3" - +"4YKV7tx7MWy9A6/ABZDgHbhghdFqU9M0FpH57cyUcdFA8Pue3fl5T07Oe5zz" - +"8/PhcEgpbbfbtVoN7LBer9M01VpX4f7+/t3dnfP4+JimKQDg6OgIYwz+UpZl" - +"HMdbjbUWZVkmpQQAEEJc1wX/EYZhHMdlWQIAKKV7cgPG+PLy8uPjg/+l3+/7" - +"vl/1KKVQURRCCABAFEVa6yAIOOeO41Tjj4+PoyiK49h1XSkl53xPbOCcz+fz" - +"bre7WCzYhpOTk+l0GoYhhFAIIaXck1JuNc/Pz51OpyiKahkAAMb49fVVCKGU" - +"qgTw4uKCUqq1RggZY05PT8uyTJJEa312dvby8rJcLq21y+WSUiqlhN1uN89z" - +"xpgxJs9zQkiv1xuNRlmWXV9f39/ff39/53meZRmllBCCZrNZkiTWWowxIWQ6" - +"nV5dXRFCGGOfn59PT0+MMWut67pa6/V6jZrNpjHGWus4TqPRsNaORqPBYCCE" - +"GI/Hvu/7vm+trc4KAEC+71dGQggrdyaTyXA4NMbc3NxsvW82mwCAoihQrVY7" - +"PDzctVYIEUXR29tbo9GAEO6WpJTO7e0tIQRjXK/XhRCe5ymlsiyDEAZB4Hle" - +"lawEX19fqNVqVS/kOE6r1fI8DyHU6XT++ShjzM/Pz8HBAXx/f+/3+9X2WmvO" - +"uVKq3GCMUUoxxlarVb1ef3h4+AWNW50eXTIBjgAAAABJRU5ErkJggg=="; - - var Class = function() function(){this.initialize.apply(this,arguments)}; - - var _isEnable; - - function replaceMap (mode,key,desc,aroundFunc,extra){ - var old = liberator.modules.mappings.getDefault(mode,key); - var oldAction = old.action; - old.description = desc; - old.action = function() - let (self = this,args = arguments) - aroundFunc(function() oldAction.apply(self,args)); - } - - var LDRizeCooperation = new Class(); - LDRizeCooperation.prototype = { - initialize: function(){ - var self = this; - this.LDRize = {getSiteinfo: function() undefined}; - this.Minibuffer = null; - this.handlerInfo = handlerInfo; - - this.LDRizeCooperationPanel = this.setupStatusbarPanel(); - - this.isEnable = liberator.globalVariables.ldrc_enable != undefined ? - window.eval(liberator.globalVariables.ldrc_enable) : true ; - this.isIntelligenceBind = liberator.globalVariables.ldrc_intelligence_bind != undefined ? - window.eval(liberator.globalVariables.ldrc_intelligence_bind) : false ; - this.isModHints = liberator.globalVariables.ldrc_hints != undefined ? - window.eval(liberator.globalVariables.ldrc_hints) : false ; - this.captureMappings = window.eval(liberator.globalVariables.ldrc_captureMappings) || ["j","k","p","o"]; - this.skipHeight = liberator.globalVariables.ldrc_skip != undefined ? - window.eval(liberator.globalVariables.ldrc_skip) : 0.5 ; - - this.convertHandlerInfo(this.handlerInfo); - this.hookGreasemonkey(); - this.initLDRizeCaptureKeys(this.captureMappings); - this.initLDRizeCooperationFuture(); - - - if(liberator.plugins.LDRizeCooperationPlugins != undefined){ - liberator.plugins.LDRizeCooperationPlugins.forEach(function(func){ - func.apply(self,arguments); - }); - delete liberator.plugins.LDRizeCooperationPlugins; - } - }, - setupStatusbarPanel: function(){ - var self = this; - var LDRizeCooperationPanel = document.createElement("statusbarpanel"); - LDRizeCooperationPanel.setAttribute("id","ldrizecopperation-status"); - LDRizeCooperationPanel.setAttribute("class","statusbarpanel-iconic"); - LDRizeCooperationPanel.setAttribute("src",this.isEnable ? ENABLE_ICON : DISABLE_ICON); - LDRizeCooperationPanel.addEventListener("click",function(e){ - self.isEnable = !self.isEnable; - },false); - var ref = document.getElementById("security-button") ? document.getElementById("security-button").nextSibling - : document.getElementById("status-bar").firstChild; - document.getElementById("status-bar").insertBefore(LDRizeCooperationPanel,ref); - - return LDRizeCooperationPanel; - }, - hookGreasemonkey: function(){ - var self = this; - var GreasemonkeyService; - try{ - GreasemonkeyService = Cc["@greasemonkey.mozdev.org/greasemonkey-service;1"].getService().wrappedJSObject; - this.addAfter(GreasemonkeyService,"evalInSandbox",function(){ - var gmVersion = liberator.extensions.filter(function(e)e.name=='Greasemonkey')[0].version; - var versionChecker = Cc["@mozilla.org/xpcom/version-comparator;1"] - .getService(Ci.nsIVersionComparator); - if (versionChecker.compare(gmVersion, "0.8.*") > 0) { - var [code,sandbox] = arguments; - } else { - var [code,codebase,sandbox] = arguments; - } - if(sandbox.window.LDRize != undefined && sandbox.window.Minibuffer != undefined){ - sandbox.window.addEventListener("focus",function(){ - self.LDRize = liberator.eval("self",sandbox.window.LDRize.getSiteinfo); - self.Minibuffer = liberator.eval("command",sandbox.window.Minibuffer.addCommand); - if (typeof self.LDRize.getSiteinfo != 'function') self.LDRize = sandbox.window.LDRize; - if (typeof self.Minibuffer.addCommand != 'function') self.Minibuffer = sandbox.window.Minibuffer.command; - },false); - if(window.content.wrappedJSObject == sandbox.unsafeWindow){ - self.LDRize = liberator.eval("self",sandbox.window.LDRize.getSiteinfo); - self.Minibuffer = liberator.eval("command",sandbox.window.Minibuffer.addCommand); - if (typeof self.LDRize.getSiteinfo != 'function') self.LDRize = sandbox.window.LDRize; - if (typeof self.Minibuffer.addCommand != 'function') self.Minibuffer = sandbox.window.Minibuffer.command; - } - } - }); - }catch(e){ - liberator.log(e); - } - }, - initLDRizeCaptureKeys: function(keys){ - var self = this; - keys.forEach(function(x){ - var map = liberator.modules.mappings.get(null,x) || liberator.modules.mappings.getDefault(null,x); - var oldAction = map.action; - var getter = "getPrev"; - switch(x){ - case "j": getter = "getNext"; - case "k": map.action = function(){ - self.isEnableLDRizeCooperation() ? - self.isIntelligenceBind && self.isScrollOrBind(getter) ? - oldAction.apply(this,arguments) // scroll - : self.sendRawKeyEvent(0,x.charCodeAt(0)) // bind - : oldAction.apply(this,arguments); - }; - break; - case "J": - case "K": map.action = function(){ - self.isEnableLDRizeCooperation() - ? self.sendRawKeyEvent(0,x.charCodeAt(0) + 32) - : oldAction.apply(this,arguments); - }; - break; - default: map.action = function(){ - self.isEnableLDRizeCooperation() - ? self.sendRawKeyEvent(0,x.charCodeAt(0)) - : oldAction.apply(this,arguments); - }; - break; - } - }); - }, - initLDRizeCooperationFuture: function(){ - var self = this; - - //Hints - [ - ["l","LDRize paragraphes",liberator.CURRENT_TAB], - ["L","LDRize paragraphes (in a new tab",liberator.NEW_TAB] - ].forEach(function([mode,prompt,target]){ - liberator.modules.hints.addMode(mode,prompt, - function(elem) liberator.modules.buffer.followLink(elem,target), - function(){ - var siteinfo = self.LDRize.getSiteinfo(); - return siteinfo.paragraph + "/" + siteinfo.link; - }); - - }); - - //Commands - liberator.modules.commands.addUserCommand(["pin"],"LDRize Pinned Links", - function(){ - var links = self.getPinnedItems(); - var showString = links.length + " Items
"; - links.forEach(function(link){ - showString += link + "
"; - }); - liberator.modules.commandline.echo(showString,liberator.modules.commandline.HL_NORMAL,liberator.modules.commandline.FORCE_MULTILINE); - },{}); - liberator.modules.commands.addUserCommand(["mb","m","minibuffer"],"Execute Minibuffer", - function(arg){ self.Minibuffer.execute(arg.string.replace(/\\+/g,"")) }, - { - completer: function(context,arg){ - var filter = context.filter; - var completionList = []; - var command = self.Minibuffer.command; - var alias = self.Minibuffer.alias_getter(); - var tokens = filter.split("|").map(function(str) str.replace(/\s+/g,"")); - var exp = new RegExp("^" + tokens.pop()); - for(let i in command) if(exp.test(i))completionList.push([tokens.concat(i).join(" | "),"MinibufferCommand"]); - for(let i in alias) if(exp.test(i))completionList.push([i,"MinibufferAlias"]); - context.title = ["Minibuffer Command","Description"]; - context.completions = completionList; - } - }); - liberator.modules.commands.addUserCommand(["pindownload"],"Download pinned links by any software", - function(arg){ self.downloadLinksByProgram("download",self.getPinnedItems());},{}); - liberator.modules.commands.addUserCommand(["pindo"],"Do external command, with pinned links", - function(arg){ self.downloadLinksByProgram(arg.string, self.getPinnedItems());},{}); - liberator.modules.commands.addUserCommand(["toggleldrizecooperation","toggleldrc"],"Toggle LDRize Cooperation", - function(arg){ self.isEnable = !self.isEnable},{}); - //Options - liberator.modules.options.add(["ldrc","ldrizecooperation"],"LDRize cooperation","boolean",this.isEnable, - { - setter: function(value){ return self.isEnable = value; }, - getter: function() self.isEnable - } - ); - liberator.modules.options.add(["ldrchints"],"mod hinttags for LDRize","boolean",this.isModHints, - { - setter: function(value){ return self.isModHints = value; }, - getter: function() self.isModHints - } - ); - }, - convertHandlerInfo: function(handlerInfoArray){ - handlerInfoArray.forEach(function(x){ - x.include = typeof x.include != "undefined" - ? typeof x.include == "string" ? new RegExp(x.include) : new RegExp(x.include[0],x.include[1]) - : typeof x.pattern != "undefined" - ? new RegExp("^"+String(x.pattern).replace(/\s+/g,"").replace(/[\\^$.+?|(){}\[\]]/g,"\\$&") - .replace(/(?=\*)/g,".")+"$","i") - : /(?:)/; - delete x.pattern; - }); - }, - - get isEnable() _isEnable, - set isEnable(value){ - this.LDRizeCooperationPanel.setAttribute("src",value ? DISABLE_ICON : ENABLE_ICON); - _isEnable = value; - }, - isEnableLDRize: function() this.LDRize.getSiteinfo() != undefined, - isEnableLDRizeCooperation: function() /^https?:$/.test(content.location.protocol) && this.isEnable && this.isEnableLDRize(), - - //Pin - getPinnedItems: function(){ - var linkXpath = this.LDRize.getSiteinfo()["link"]; - var viewXpath = this.LDRize.getSiteinfo()["view"] || linkXpath + "/text()"; - return this.LDRize.getPinnedItems().map(function(i){ - var linkResult = i.XPath(linkXpath),viewResult = i.XPath(viewXpath); - return [linkResult,viewResult ? viewResult.textContent : null]; - }); - }, - downloadLinksByProgram: function(command, links){ - var self = this; - var count = 0; - links.forEach(function([url,title]){ - for each(let x in self.handlerInfo){ - if(x.include.test(url)){ - setTimeout(function(){ - if(typeof x.handler[command] == "object"){ - let args = x.handler[command][1].map(function(s) s.replace(/%URL%/g,url).replace(/%TITLE%/g,title)); - liberator.modules.io.run(x.handler[command][0],args,false); - }else if(typeof x.handler[command] == "string"){ - liberator.modules.io.run(x.handler[command],[url],false); - }else if(typeof x.handler[command] == "function"){ - x.handler[command](url.toString(),title); - } - },x.wait != undefined ? x.wait * count++ : 0); - return; - } - } - liberator.echoerr("LDRize Cooperation: download pattern not found!!"); - }); - }, - isScrollOrBind: function(getter){ - var self = this; - var paragraphes,paragraph,current,next,innerHeight,scrollY,limit,p,np,cp; - try{ - paragraphes = this.LDRize.getParagraphes(); - paragraph = paragraphes[getter](); - current = paragraphes.current; - next = paragraphes.getNext(); - - innerHeight = window.content.innerHeight; - scrollY = window.content.scrollY; - - limit = window.content.innerHeight * (self.skipHeight + 0.5); - - if(paragraph.paragraph == undefined) return true; // scroll - if(current.paragraph == undefined) return false; // bind - if(current.paragraph.y - window.content.scrollY == this.LDRize.getScrollHeight() - && getter == "getPrev") return false; // bind - - p = this.getClientPosition(paragraph.paragraph.node); - np = next && next.paragraph.node != undefined ? - this.getClientPosition(next.paragraph.node) : - {top: window.content.scrollMaxY + window.content.innerHeight,left: 0}; - cp = this.getClientPosition(current.paragraph.node); - - /* - *log(p); - *log(np); - *log(cp); - */ - - //check current paragraph - if(!(scrollY < np.top && cp.top < scrollY + innerHeight)) return false; // bind - //check next/prev paragraph - if(Math.abs(p.top - (scrollY + innerHeight/2)) < innerHeight * 0.5) return false; // bind - if(Math.abs(p.top - (scrollY + innerHeight/2)) > limit) return true; // scroll - return false; // bind - }catch(e){ - liberator.log(e); - } - }, - - //Utils - addAfter: function(target,name,after){ - var original = target[name]; - target[name] = function(){ - var tmp = original.apply(target,arguments); - after.apply(target,arguments); - return tmp; - }; - }, - getClientPosition: function(elem){ - var position; - try{ - position = elem.getBoundingClientRect(); - }catch(e){ - position = elem.parentNode.getBoundingClientRect(); - } - return { - left: Math.round(window.content.scrollX+position.left), - top: Math.round(window.content.scrollY+position.top) - }; - }, - sendRawKeyEvent: function(keyCode,charCode){ - modes.passAllKeys = true; - var evt = window.content.wrappedJSObject.document.createEvent("KeyEvents"); - evt.initKeyEvent("keypress",false,false,window.content.wrappedJSObject,false,false,false,false,keyCode,charCode); - window.content.wrappedJSObject.document.dispatchEvent(evt); - modes.passAllKeys = false; - }, - }; - - liberator.plugins.LDRizeCooperation = new LDRizeCooperation(); -})(); +// Vimperator plugin: 'Cooperation LDRize Mappings' +// Version: 0.25 +// Last Change: 07-Jan-2011. Jan 2008 +// License: Creative Commons +// Maintainer: Trapezoid - http://unsigned.g.hatena.ne.jp/Trapezoid +// +// Cooperation LDRize Mappings for Vimperator +// +// Variables: +// g:ldrc_captureMapping +// Specifies keys that capture by LDRize +// usage: let g:ldrc_captureMappings = "['j','k','p','o','?']" +// g:ldrc_enable +// LDRize Cooperation be Enable by default or not +// usage: let g:ldrc_enable = "false" +// default: true +// g:ldrc_hints +// Narrows "hinttags" based on Siteinfo. +// usage: let g:ldrc_hints = "true" +// default: false +// g:ldrc_intelligence_bind +// More inteligence cooperation bind +// usage: let g:ldrc_intelligence_bind = "true" +// default: false +// g:ldrc_skip +// length in which paragraph is skipped (use by inteligence bind mode) +// usage: let g:ldrc_hints = "true" +// default: 0.5 +// Mappings: +// Mappings for LDRize +// default: 'j','k','p','o' +// Commands: +// 'm' or 'mb' or 'minibuffer': +// Execute args as Minibuffer Command +// usage: :minibuffer pinned-link | open | clear-pin +// 'pin': +// View pinned link list +// usage: :pin +// 'pindownload': +// Download View pinned link by handler function or outer promgram. please see 'handlerInfo' also +// usage: :pindownload +// 'ldrc' or 'toggleldrizecooperation': +// Toggle LDRize Cooperation +// usage: :toggleldrizecooperation +// Hints: +// ';l': +// narrow down the candidates to LDRize paragraphes +// ';L': +// narrow down the candidates to LDRize paragraphes (in a new tab) +// Options: +// 'ldrc' +// Enable LDRize Cooperation +// usage: :set ldrc +// 'noldrc' +// Disable LDRize Cooperation +// usage: :set noldrc +// +// 'ldrchints' +// Enable "Narrows Hinttags based on Siteinfo" +// usage: :set ldrchints +// 'noldrchints' +// Disable "Narrows Hinttags based on Siteinfo" +// usage: :set noldrchints +if (liberator.plugins.LDRizeCooperation == undefined) (function(){ + //pattern: wildcard + //include: [regexp,option] or regexp + //handler: [programPath,[args]] or programPath or function(url,title) + var handlerInfo = [ + //{ + // pattern: "http://www.nicovideo.jp/*", + // handler: { + // download: ["c:\\usr\\SmileDownloader\\SmileDownloader.exe",["%URL%"]] + // }, + // wait: 5000 + //}, + //{ + // handler: ["C:\\usr\\irvine\\irvine.exe",["%URL%"]], + //}, + ]; + const DISABLE_ICON = "data:image/png;base64," + +"iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAACXBIWXMAAA7E" + +"AAAOxAGVKw4bAAACL0lEQVR4nF2Sy0tUYRjGf9+Z4/HMjJfjBUZEMM2MSDII" + +"REjSVtVecBFZi6Bdi4RW/SFBq2oR0R8gSaUJhVJIBkEEMZOWl5kuM+fqnPN9" + +"52sxQ4kPv837Pu+zel4xMjkz/3h5p87pbhyDw4o1mzUOkubYbvLo2kVx+4Pe" + +"rAKMdTGQ5YgiWK/8z+QT3yyVUTFAzaBXHQ0IONPKOxepAH65dUOGSB/pM9LC" + +"whjyy/sg4DB3TjGZbjVuVIihQhKfxGdzmzhhNBvGXhr7NDiRY+fr573ibmtC" + +"4pN4GNJDukiXusvbIuMnh9K9YujSYKKPl6vrZu+EI5EuyheG9JEe0qPusfSR" + +"4cGBbPA98og8LMlAPlor2ZEvVIT0kD6G9EhcEpfY58c+xbKYHBaRl4Ye432s" + +"rqyo7pnQo/qTxEW62gy2CKoAbheu4mGGm5eHgsViOTh+5Sp37+2X4gJQC0gU" + +"Otb0j2hhaCG06NfC0K22/radzs6uTM3ojY1SobDcdHNaCC2Mimn2YZmQggEd" + +"kPJ0UczfyOzVWHr1xnVmrS5I0R6pgTC1mXdoUwB2Jj5QFvDsBc8fTCkpL82l" + +"uW6rWWEPQBoL07JwCgAaywbgd8ynIrultTB3wWk73LtWdS3OXtd/fBwH2+Yg" + +"xM4R14kqrzMZzM5pO9dcNlQrl832wTSoGiEok84eOrK0ZGB0+shTJYpyFUv7" + +"In/s/LlbTyq+/ufZFlkTK4MhAJKUMCGs6x473rg/9xe9wS0xVA1n/AAAAABJ" + +"RU5ErkJggg=="; + const ENABLE_ICON = "data:image/png;base64," + +"iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAACXBIWXMAAAsT" + +"AAALEwEAmpwYAAACI0lEQVR4nGWSzU7yQBSGp84UKalDY0MkLsSdYWtCIok3" + +"4YKV7tx7MWy9A6/ABZDgHbhghdFqU9M0FpH57cyUcdFA8Pue3fl5T07Oe5zz" + +"8/PhcEgpbbfbtVoN7LBer9M01VpX4f7+/t3dnfP4+JimKQDg6OgIYwz+UpZl" + +"HMdbjbUWZVkmpQQAEEJc1wX/EYZhHMdlWQIAKKV7cgPG+PLy8uPjg/+l3+/7" + +"vl/1KKVQURRCCABAFEVa6yAIOOeO41Tjj4+PoyiK49h1XSkl53xPbOCcz+fz" + +"bre7WCzYhpOTk+l0GoYhhFAIIaXck1JuNc/Pz51OpyiKahkAAMb49fVVCKGU" + +"qgTw4uKCUqq1RggZY05PT8uyTJJEa312dvby8rJcLq21y+WSUiqlhN1uN89z" + +"xpgxJs9zQkiv1xuNRlmWXV9f39/ff39/53meZRmllBCCZrNZkiTWWowxIWQ6" + +"nV5dXRFCGGOfn59PT0+MMWut67pa6/V6jZrNpjHGWus4TqPRsNaORqPBYCCE" + +"GI/Hvu/7vm+trc4KAEC+71dGQggrdyaTyXA4NMbc3NxsvW82mwCAoihQrVY7" + +"PDzctVYIEUXR29tbo9GAEO6WpJTO7e0tIQRjXK/XhRCe5ymlsiyDEAZB4Hle" + +"lawEX19fqNVqVS/kOE6r1fI8DyHU6XT++ShjzM/Pz8HBAXx/f+/3+9X2WmvO" + +"uVKq3GCMUUoxxlarVb1ef3h4+AWNW50eXTIBjgAAAABJRU5ErkJggg=="; + + var Class = function() function(){this.initialize.apply(this,arguments)}; + + var _isEnable; + + function replaceMap (mode,key,desc,aroundFunc,extra){ + var old = liberator.modules.mappings.getDefault(mode,key); + var oldAction = old.action; + old.description = desc; + old.action = function() + let (self = this,args = arguments) + aroundFunc(function() oldAction.apply(self,args)); + } + + var LDRizeCooperation = new Class(); + LDRizeCooperation.prototype = { + initialize: function(){ + var self = this; + this.LDRize = {getSiteinfo: function() undefined}; + this.Minibuffer = null; + this.handlerInfo = handlerInfo; + + this.LDRizeCooperationPanel = this.setupStatusbarPanel(); + + this.isEnable = liberator.globalVariables.ldrc_enable != undefined ? + window.eval(liberator.globalVariables.ldrc_enable) : true ; + this.isIntelligenceBind = liberator.globalVariables.ldrc_intelligence_bind != undefined ? + window.eval(liberator.globalVariables.ldrc_intelligence_bind) : false ; + this.isModHints = liberator.globalVariables.ldrc_hints != undefined ? + window.eval(liberator.globalVariables.ldrc_hints) : false ; + this.captureMappings = window.eval(liberator.globalVariables.ldrc_captureMappings) || ["j","k","p","o"]; + this.skipHeight = liberator.globalVariables.ldrc_skip != undefined ? + window.eval(liberator.globalVariables.ldrc_skip) : 0.5 ; + + this.convertHandlerInfo(this.handlerInfo); + this.hookGreasemonkey(); + this.initLDRizeCaptureKeys(this.captureMappings); + this.initLDRizeCooperationFuture(); + + + if(liberator.plugins.LDRizeCooperationPlugins != undefined){ + liberator.plugins.LDRizeCooperationPlugins.forEach(function(func){ + func.apply(self,arguments); + }); + delete liberator.plugins.LDRizeCooperationPlugins; + } + }, + setupStatusbarPanel: function(){ + var self = this; + var LDRizeCooperationPanel = document.createElement("statusbarpanel"); + LDRizeCooperationPanel.setAttribute("id","ldrizecopperation-status"); + LDRizeCooperationPanel.setAttribute("class","statusbarpanel-iconic"); + LDRizeCooperationPanel.setAttribute("src",this.isEnable ? ENABLE_ICON : DISABLE_ICON); + LDRizeCooperationPanel.addEventListener("click",function(e){ + self.isEnable = !self.isEnable; + },false); + var ref = document.getElementById("security-button") ? document.getElementById("security-button").nextSibling + : document.getElementById("status-bar").firstChild; + document.getElementById("status-bar").insertBefore(LDRizeCooperationPanel,ref); + + return LDRizeCooperationPanel; + }, + hookGreasemonkey: function(){ + var self = this; + var GreasemonkeyService; + try{ + GreasemonkeyService = Cc["@greasemonkey.mozdev.org/greasemonkey-service;1"].getService().wrappedJSObject; + this.addAfter(GreasemonkeyService,"evalInSandbox",function(){ + var gmVersion = liberator.extensions.filter(function(e)e.name=='Greasemonkey')[0].version; + var versionChecker = Cc["@mozilla.org/xpcom/version-comparator;1"] + .getService(Ci.nsIVersionComparator); + if (versionChecker.compare(gmVersion, "0.8.*") > 0) { + var [code,sandbox] = arguments; + } else { + var [code,codebase,sandbox] = arguments; + } + if(sandbox.window.LDRize != undefined && sandbox.window.Minibuffer != undefined){ + sandbox.window.addEventListener("focus",function(){ + self.LDRize = liberator.eval("self",sandbox.window.LDRize.getSiteinfo); + self.Minibuffer = liberator.eval("command",sandbox.window.Minibuffer.addCommand); + if (typeof self.LDRize.getSiteinfo != 'function') self.LDRize = sandbox.window.LDRize; + if (typeof self.Minibuffer.addCommand != 'function') self.Minibuffer = sandbox.window.Minibuffer.command; + },false); + if(window.content.wrappedJSObject == sandbox.unsafeWindow){ + self.LDRize = liberator.eval("self",sandbox.window.LDRize.getSiteinfo); + self.Minibuffer = liberator.eval("command",sandbox.window.Minibuffer.addCommand); + if (typeof self.LDRize.getSiteinfo != 'function') self.LDRize = sandbox.window.LDRize; + if (typeof self.Minibuffer.addCommand != 'function') self.Minibuffer = sandbox.window.Minibuffer.command; + } + } + }); + }catch(e){ + liberator.log(e); + } + }, + initLDRizeCaptureKeys: function(keys){ + var self = this; + keys.forEach(function(x){ + var map = liberator.modules.mappings.get(null,x) || liberator.modules.mappings.getDefault(null,x); + var oldAction = map.action; + var getter = "getPrev"; + switch(x){ + case "j": getter = "getNext"; + case "k": map.action = function(){ + self.isEnableLDRizeCooperation() ? + self.isIntelligenceBind && self.isScrollOrBind(getter) ? + oldAction.apply(this,arguments) // scroll + : self.sendRawKeyEvent(0,x.charCodeAt(0)) // bind + : oldAction.apply(this,arguments); + }; + break; + case "J": + case "K": map.action = function(){ + self.isEnableLDRizeCooperation() + ? self.sendRawKeyEvent(0,x.charCodeAt(0) + 32) + : oldAction.apply(this,arguments); + }; + break; + default: map.action = function(){ + self.isEnableLDRizeCooperation() + ? self.sendRawKeyEvent(0,x.charCodeAt(0)) + : oldAction.apply(this,arguments); + }; + break; + } + }); + }, + initLDRizeCooperationFuture: function(){ + var self = this; + + //Hints + [ + ["l","LDRize paragraphes",liberator.CURRENT_TAB], + ["L","LDRize paragraphes (in a new tab",liberator.NEW_TAB] + ].forEach(function([mode,prompt,target]){ + liberator.modules.hints.addMode(mode,prompt, + function(elem) liberator.modules.buffer.followLink(elem,target), + function(){ + var siteinfo = self.LDRize.getSiteinfo(); + return siteinfo.paragraph + "/" + siteinfo.link; + }); + + }); + + //Commands + liberator.modules.commands.addUserCommand(["pin"],"LDRize Pinned Links", + function(){ + var links = self.getPinnedItems(); + var showString = links.length + " Items
"; + links.forEach(function(link){ + showString += link + "
"; + }); + liberator.modules.commandline.echo(showString,liberator.modules.commandline.HL_NORMAL,liberator.modules.commandline.FORCE_MULTILINE); + },{}); + liberator.modules.commands.addUserCommand(["mb","m","minibuffer"],"Execute Minibuffer", + function(arg){ self.Minibuffer.execute(arg.string.replace(/\\+/g,"")) }, + { + completer: function(context,arg){ + var filter = context.filter; + var completionList = []; + var command = self.Minibuffer.command; + var alias = self.Minibuffer.alias_getter(); + var tokens = filter.split("|").map(function(str) str.replace(/\s+/g,"")); + var exp = new RegExp("^" + tokens.pop()); + for(let i in command) if(exp.test(i))completionList.push([tokens.concat(i).join(" | "),"MinibufferCommand"]); + for(let i in alias) if(exp.test(i))completionList.push([i,"MinibufferAlias"]); + context.title = ["Minibuffer Command","Description"]; + context.completions = completionList; + } + }); + liberator.modules.commands.addUserCommand(["pindownload"],"Download pinned links by any software", + function(arg){ self.downloadLinksByProgram("download",self.getPinnedItems());},{}); + liberator.modules.commands.addUserCommand(["pindo"],"Do external command, with pinned links", + function(arg){ self.downloadLinksByProgram(arg.string, self.getPinnedItems());},{}); + liberator.modules.commands.addUserCommand(["toggleldrizecooperation","toggleldrc"],"Toggle LDRize Cooperation", + function(arg){ self.isEnable = !self.isEnable},{}); + //Options + liberator.modules.options.add(["ldrc","ldrizecooperation"],"LDRize cooperation","boolean",this.isEnable, + { + setter: function(value){ return self.isEnable = value; }, + getter: function() self.isEnable + } + ); + liberator.modules.options.add(["ldrchints"],"mod hinttags for LDRize","boolean",this.isModHints, + { + setter: function(value){ return self.isModHints = value; }, + getter: function() self.isModHints + } + ); + }, + convertHandlerInfo: function(handlerInfoArray){ + handlerInfoArray.forEach(function(x){ + x.include = typeof x.include != "undefined" + ? typeof x.include == "string" ? new RegExp(x.include) : new RegExp(x.include[0],x.include[1]) + : typeof x.pattern != "undefined" + ? new RegExp("^"+String(x.pattern).replace(/\s+/g,"").replace(/[\\^$.+?|(){}\[\]]/g,"\\$&") + .replace(/(?=\*)/g,".")+"$","i") + : /(?:)/; + delete x.pattern; + }); + }, + + get isEnable() _isEnable, + set isEnable(value){ + this.LDRizeCooperationPanel.setAttribute("src",value ? DISABLE_ICON : ENABLE_ICON); + _isEnable = value; + }, + isEnableLDRize: function() this.LDRize.getSiteinfo() != undefined, + isEnableLDRizeCooperation: function() /^https?:$/.test(content.location.protocol) && this.isEnable && this.isEnableLDRize(), + + //Pin + getPinnedItems: function(){ + var linkXpath = this.LDRize.getSiteinfo()["link"]; + var viewXpath = this.LDRize.getSiteinfo()["view"] || linkXpath + "/text()"; + return this.LDRize.getPinnedItems().map(function(i){ + var linkResult = i.XPath(linkXpath),viewResult = i.XPath(viewXpath); + return [linkResult,viewResult ? viewResult.textContent : null]; + }); + }, + downloadLinksByProgram: function(command, links){ + var self = this; + var count = 0; + links.forEach(function([url,title]){ + for each(let x in self.handlerInfo){ + if(x.include.test(url)){ + setTimeout(function(){ + if(typeof x.handler[command] == "object"){ + let args = x.handler[command][1].map(function(s) s.replace(/%URL%/g,url).replace(/%TITLE%/g,title)); + liberator.modules.io.run(x.handler[command][0],args,false); + }else if(typeof x.handler[command] == "string"){ + liberator.modules.io.run(x.handler[command],[url],false); + }else if(typeof x.handler[command] == "function"){ + x.handler[command](url.toString(),title); + } + },x.wait != undefined ? x.wait * count++ : 0); + return; + } + } + liberator.echoerr("LDRize Cooperation: download pattern not found!!"); + }); + }, + isScrollOrBind: function(getter){ + var self = this; + var paragraphes,paragraph,current,next,innerHeight,scrollY,limit,p,np,cp; + try{ + paragraphes = this.LDRize.getParagraphes(); + paragraph = paragraphes[getter](); + current = paragraphes.current; + next = paragraphes.getNext(); + + innerHeight = window.content.innerHeight; + scrollY = window.content.scrollY; + + limit = window.content.innerHeight * (self.skipHeight + 0.5); + + if(paragraph.paragraph == undefined) return true; // scroll + if(current.paragraph == undefined) return false; // bind + if(current.paragraph.y - window.content.scrollY == this.LDRize.getScrollHeight() + && getter == "getPrev") return false; // bind + + p = this.getClientPosition(paragraph.paragraph.node); + np = next && next.paragraph.node != undefined ? + this.getClientPosition(next.paragraph.node) : + {top: window.content.scrollMaxY + window.content.innerHeight,left: 0}; + cp = this.getClientPosition(current.paragraph.node); + + /* + *log(p); + *log(np); + *log(cp); + */ + + //check current paragraph + if(!(scrollY < np.top && cp.top < scrollY + innerHeight)) return false; // bind + //check next/prev paragraph + if(Math.abs(p.top - (scrollY + innerHeight/2)) < innerHeight * 0.5) return false; // bind + if(Math.abs(p.top - (scrollY + innerHeight/2)) > limit) return true; // scroll + return false; // bind + }catch(e){ + liberator.log(e); + } + }, + + //Utils + addAfter: function(target,name,after){ + var original = target[name]; + target[name] = function(){ + var tmp = original.apply(target,arguments); + after.apply(target,arguments); + return tmp; + }; + }, + getClientPosition: function(elem){ + var position; + try{ + position = elem.getBoundingClientRect(); + }catch(e){ + position = elem.parentNode.getBoundingClientRect(); + } + return { + left: Math.round(window.content.scrollX+position.left), + top: Math.round(window.content.scrollY+position.top) + }; + }, + sendRawKeyEvent: function(keyCode,charCode){ + modes.passAllKeys = true; + var evt = window.content.wrappedJSObject.document.createEvent("KeyEvents"); + evt.initKeyEvent("keypress",false,false,window.content.wrappedJSObject,false,false,false,false,keyCode,charCode); + window.content.wrappedJSObject.document.dispatchEvent(evt); + modes.passAllKeys = false; + }, + }; + + liberator.plugins.LDRizeCooperation = new LDRizeCooperation(); +})(); -- cgit v1.2.3 From 14889439ff69b981bfcab2cfc64518b236fa3869 Mon Sep 17 00:00:00 2001 From: mashiro Date: Tue, 21 Jun 2011 11:03:54 +0900 Subject: http://d.hatena.ne.jp/wlt/20110608/1307558426 を適用 --- ldrize_cooperation.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ldrize_cooperation.js b/ldrize_cooperation.js index f5e79b9..7a361c8 100644 --- a/ldrize_cooperation.js +++ b/ldrize_cooperation.js @@ -1,6 +1,6 @@ // Vimperator plugin: 'Cooperation LDRize Mappings' // Version: 0.25 -// Last Change: 07-Jan-2011. Jan 2008 +// Last Change: 09-Jun-2011. Jan 2008 // License: Creative Commons // Maintainer: Trapezoid - http://unsigned.g.hatena.ne.jp/Trapezoid // @@ -315,7 +315,8 @@ if (liberator.plugins.LDRizeCooperation == undefined) (function(){ this.LDRizeCooperationPanel.setAttribute("src",value ? DISABLE_ICON : ENABLE_ICON); _isEnable = value; }, - isEnableLDRize: function() this.LDRize.getSiteinfo() != undefined, + isEnableLDRize: function() this.LDRize.getSiteinfo() != undefined || + window.content.wrappedJSObject.document.getElementById("gm_ldrize") != null, isEnableLDRizeCooperation: function() /^https?:$/.test(content.location.protocol) && this.isEnable && this.isEnableLDRize(), //Pin @@ -422,4 +423,4 @@ if (liberator.plugins.LDRizeCooperation == undefined) (function(){ }; liberator.plugins.LDRizeCooperation = new LDRizeCooperation(); -})(); +})(); \ No newline at end of file -- cgit v1.2.3 From e86099111659d4278123335ebe210c456125d0ec Mon Sep 17 00:00:00 2001 From: mitsugu oyama Date: Tue, 21 Jun 2011 20:53:34 +0900 Subject: modified description --- addhatebu.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addhatebu.js b/addhatebu.js index b45be21..7fff76e 100644 --- a/addhatebu.js +++ b/addhatebu.js @@ -7,7 +7,7 @@ var INFO = Mitsugu Oyama MIT -

Toggle login box of pixiv by this plugin.

+

Add contents to Hatena Bookmarks.

'addhatebu' :addhatebu -- cgit v1.2.3 From 85445f7739ef54ee68f0b97ce2f6689319b5b557 Mon Sep 17 00:00:00 2001 From: anekos Date: Wed, 22 Jun 2011 00:05:01 +0900 Subject: けいこくでとったんや --- zip-de-download.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zip-de-download.js b/zip-de-download.js index 2961154..4a54c85 100644 --- a/zip-de-download.js +++ b/zip-de-download.js @@ -210,7 +210,7 @@ let SITE_INFO = [ let self = { downloadZip: function(path, urls, comment, isAppend){ let zipW = new zipWriter(); - let urls = [url for each(url in urls)]; + urls = [url for each(url in urls)]; liberator.assert(urls.length > 0, "None of URLs"); if (!(/\.zip$/i).test(path)){ -- cgit v1.2.3 From 3659e2ce3d368a08bfc497836a6d00a59df2edab Mon Sep 17 00:00:00 2001 From: anekos Date: Wed, 22 Jun 2011 18:21:10 +0900 Subject: 芋臭い RegExp の仕様変更に対応 --- hints-for-embedded.js | 2 +- stella.js | 4 ++-- twittperator/pong.tw | 2 +- zip-de-download.js | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/hints-for-embedded.js b/hints-for-embedded.js index cf86b4e..061dd7c 100644 --- a/hints-for-embedded.js +++ b/hints-for-embedded.js @@ -201,7 +201,7 @@ let INFO = if (site) { for each (let [n, v] in info) { [n, v] = [String(n), String(v)]; - if (site.name && !site.name(n)) + if (site.name && !site.name.test(n)) continue; let m = n.match(site.value) || v.match(site.value); if (m) diff --git a/stella.js b/stella.js index 8eb8119..6b476cd 100644 --- a/stella.js +++ b/stella.js @@ -999,7 +999,7 @@ Thanks: } YouTubeUserChannelPlayer.getIDfromURL = function (url) let ([_, r] = url.match(/\/([^\/]+)($|[\?]+)/)) r; - YouTubeUserChannelPlayer.isVideoURL = function (url) /^https?:\/\/(www\.)?youtube\.com\/watch\?.+/(url); + YouTubeUserChannelPlayer.isVideoURL = function (url) /^https?:\/\/(www\.)?youtube\.com\/watch\?.+/.test(url); YouTubeUserChannelPlayer.prototype = { __proto__: YouTubePlayer.prototype, @@ -1798,7 +1798,7 @@ Thanks: return U.raiseNotSupportedPage(); let arg = args.literalArg; - let index = (/^\d+:/)(arg) && parseInt(arg, 10); + let index = /^\d+:/.test(arg) && parseInt(arg, 10); if (index > 0) arg = lastCompletions[index - 1].command; let url = self.player.has('makeURL', 'x') ? makeRelationURL(self.player, arg) : arg; diff --git a/twittperator/pong.tw b/twittperator/pong.tw index dae2e15..9f3f381 100644 --- a/twittperator/pong.tw +++ b/twittperator/pong.tw @@ -12,7 +12,7 @@ plugins.twittperator.ChirpUserStream.addListener( function onMsg (msg, raw) { function negi (pattern, reply) { - if (RegExp('^\\s*@' + screenName + '\\s+' + pattern + '\s*$')(msg.text.trim())) { + if (RegExp('^\\s*@' + screenName + '\\s+' + pattern + '\s*$').test(msg.text.trim())) { plugins.twittperator.Twitter.say('@' + msg.user.screen_name + ' ' + reply, msg.id_str); return true; } diff --git a/zip-de-download.js b/zip-de-download.js index 4a54c85..4d60266 100644 --- a/zip-de-download.js +++ b/zip-de-download.js @@ -186,7 +186,7 @@ let SITE_INFO = [ let links = Array.slice( content.document.querySelectorAll('a')).filter( - function (link) (link.href && extPattern(link.href))); + function (link) (link.href && extPattern.test(link.href))); let xs = {}; for each(let link in links){ -- cgit v1.2.3 From 04462e4bee76682f39f70748e1f0a1909d57e97b Mon Sep 17 00:00:00 2001 From: anekos Date: Wed, 22 Jun 2011 18:22:12 +0900 Subject: callback でのエラーは捕まえないようにした --- twittperator.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/twittperator.js b/twittperator.js index fc439db..969bd56 100644 --- a/twittperator.js +++ b/twittperator.js @@ -1237,8 +1237,9 @@ let PLUGIN_INFO = url + '.json', query, function (text) { + let json; try { - return callback(JSON.parse(text)); + json = JSON.parse(text); } catch (e) { (onError || @@ -1248,6 +1249,7 @@ let PLUGIN_INFO = throw e; })(e); } + return callback(json); } ); }; -- cgit v1.2.3 From efa0c787787c5a108a48bce21bd1274ea1dd48b7 Mon Sep 17 00:00:00 2001 From: Jagua Date: Wed, 22 Jun 2011 19:50:49 +0900 Subject: compatible with Fx5.0 (rename class identifier) --- twittperator/twlist-win.tw | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/twittperator/twlist-win.tw b/twittperator/twlist-win.tw index 674f4f3..939e472 100644 --- a/twittperator/twlist-win.tw +++ b/twittperator/twlist-win.tw @@ -193,10 +193,10 @@ let winXML = <> function getCurrentListBox(){ return tabBox.tabpanels.selectedPanel.firstChild; } - function getParent(node, class){ + function getParent(node, klass){ let elm = node; while (elm != document.documentElement){ - if (elm instanceof class) + if (elm instanceof klass) return elm; elm = elm.parentNode; } -- cgit v1.2.3 From d4e2c5327d707808086d3c1f020e884972698b21 Mon Sep 17 00:00:00 2001 From: anekos Date: Thu, 23 Jun 2011 23:43:36 +0900 Subject: プロテクトユーザ確認時のプロンプトにスクリーンネームがでていなかったのを修正 --- twittperator.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/twittperator.js b/twittperator.js index 969bd56..7b6da40 100644 --- a/twittperator.js +++ b/twittperator.js @@ -1855,10 +1855,9 @@ let PLUGIN_INFO = } }, // }}} withProtectedUserConfirmation: function(check, actionName, action) { // {{{ - let protectedUserName = Twittperator.isProtected(check); - if (protectedUserName) { + if (Twittperator.isProtected(check)) { Twittperator.confirm( - protectedUserName + " is protected user! Do you really want to " + actionName + '?', + check.screenName + " is protected user! Do you really want to " + actionName + '?', action ); } else { -- cgit v1.2.3