diff options
-rw-r--r-- | auto_reload.js | 2 | ||||
-rw-r--r-- | autopagerize_controll.js | 4 | ||||
-rw-r--r-- | cookieManager.js | 6 | ||||
-rw-r--r-- | foxage2ch.js | 153 | ||||
-rw-r--r-- | function-template.js | 4 | ||||
-rw-r--r-- | hints-for-embedded.js | 16 | ||||
-rw-r--r-- | i_love_echo.js | 8 | ||||
-rw-r--r-- | ldrize_cooperation.js | 22 | ||||
-rw-r--r-- | nextlink.js | 11 | ||||
-rw-r--r-- | panorama.js | 22 | ||||
-rw-r--r-- | pixiv.js | 17 | ||||
-rw-r--r-- | pluginManager.js | 17 | ||||
-rw-r--r-- | readcatlater.js | 32 | ||||
-rw-r--r-- | sbmcommentsviewer.js | 53 | ||||
-rwxr-xr-x | statusbar_panel.js | 151 | ||||
-rw-r--r-- | stella.js | 28 | ||||
-rw-r--r-- | twittperator.js | 35 | ||||
-rw-r--r-- | 跳.js | 12 |
18 files changed, 425 insertions, 168 deletions
diff --git a/auto_reload.js b/auto_reload.js index af02616..64dcf69 100644 --- a/auto_reload.js +++ b/auto_reload.js @@ -63,7 +63,7 @@ let PLUGIN_INFO = 'Auto reload current tab', function (args) { let tab = gBrowser.mCurrentTab; - let storage = tab[this.uuid] || (tab[this.uuid] = {}); + let storage = tab[uuid] || (tab[uuid] = {}); let reload; let func = reload = function () tabs.reload(tab); let time = parseInt(parseFloat(args[0] || 1) * 1000); diff --git a/autopagerize_controll.js b/autopagerize_controll.js index 50b40a0..51b8719 100644 --- a/autopagerize_controll.js +++ b/autopagerize_controll.js @@ -16,9 +16,9 @@ enable mapping key like ||< == Commands == -autopagerize_next: +nextpage: paging next page -autopagerize_prev: +prevpage: paging prev page == TODO == diff --git a/cookieManager.js b/cookieManager.js index fb3c8d8..f1c0cb9 100644 --- a/cookieManager.js +++ b/cookieManager.js @@ -49,9 +49,9 @@ const PM = Cc["@mozilla.org/permissionmanager;1"].getService(Ci.nsIPermissionMan const I_CPM = Ci.nsICookiePermission; const PERM_TYPE = "cookie"; -function getIterator(enum, interface){ - while (enum.hasMoreElements()){ - let obj = enum.getNext().QueryInterface(interface); +function getIterator(_enum, interface){ + while (_enum.hasMoreElements()){ + let obj = _enum.getNext().QueryInterface(interface); yield obj; } } diff --git a/foxage2ch.js b/foxage2ch.js index 7ed240f..1c5cc63 100644 --- a/foxage2ch.js +++ b/foxage2ch.js @@ -1,5 +1,5 @@ /* NEW BSD LICENSE {{{ -Copyright (c) 2010, anekos. +Copyright (c) 2010-2011, anekos. All rights reserved. Redistribution and use in source and binary forms, with or without modification, @@ -37,13 +37,13 @@ let PLUGIN_INFO = <VimperatorPlugin> <name>FoxAge2ch</name> <description>for FoxAge2ch</description> - <version>1.0.3</version> + <version>1.3.0</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>https://github.com/vimpr/vimperator-plugins/raw/master/foxage2ch.js</updateURL> <minVersion>2.4</minVersion> - <maxVersion>2.4</maxVersion> + <maxVersion>3.0</maxVersion> <detail><![CDATA[ for FoxAge2ch ]]></detail> @@ -55,7 +55,7 @@ let PLUGIN_INFO = // INFO {{{ let INFO = <> - <plugin name="FoxAge2ch" version="1.0.3" + <plugin name="FoxAge2ch" version="1.2.0" href="http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk/foxage2ch.js" summary="for FoxAge2ch addon" lang="en-US" @@ -74,7 +74,7 @@ let INFO = </description> </item> </plugin> - <plugin name="FoxAge2ch" version="1.0.3" + <plugin name="FoxAge2ch" version="1.2.0" href="http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk/foxage2ch.js" summary="FoxAge2ch アドオン用" lang="ja" @@ -137,8 +137,24 @@ let INFO = return thread; } return; + }, + titleToId: function (title) { + for ([, thread] in Iterator(FA.threads)) { + if (thread.title === title) + return thread; + } + return; + }, + findThread: function (threadId) { + window.openDialog( + 'chrome://foxage2ch/content/findThread.xul', + 'FoxAge2ch:FindThread', + 'chrome,centerscreen,modal,all', + threadId + ); } } + __context__.utils = FA; function threadCompleter (context, args) { context.compare = void 0; @@ -172,9 +188,72 @@ let INFO = if (typeof v === 'number') ]); - SubCommands = Commands(); + SubCommands = [ + new Command( + ['openu[pdates]', 'ou[pdates]'], + 'Open updated threads', + function () { + svc.openUpdates("root") + }, + { + }, + true + ), + + new Command( + ['c[heckupdates]'], + 'Check updated threads', + function () { + svc.checkUpdates("root") + }, + { + }, + true + ), + + new Command( + ['a[ddthread]'], + 'Add a threadii', + function (args) { + let url = FoxAge2chUtils.unwrapURL(args.literalArg || buffer.URL); + let addedItem = svc.addFavorite(url); + if (addedItem) + liberator.echo('Added: ' + url); + }, + { + literal: 0, + completer: function (context, args) { + context.completions = [ + [FoxAge2chUtils.unwrapURL(buffer.URL), 'Current Buffer'] + ]; + } + }, + true + ), + + new Command( + ['f[indthread]'], + 'Find thread', + function (args) { + let threadId = args.literalArg; + if (!threadId) { + let thread = FA.titleToId(buffer.title); + if (!thread) + return; + threadId = thread.id; + } + FA.findThread(threadId); + }, + { + literal: 0, + completer: threadCompleter + }, + true + ) + ]; + [true, false].forEach(function (tab) { - SubCommands.addUserCommand( + SubCommands.push(new Command( (tab ? ['t[open]', 'tabo[pen]'] : ['o[pen]']), 'Openthe borard from FoxAge2ch' + (tab ? ' in new tab' : 'in current tab'), function (args) { @@ -187,65 +266,21 @@ let INFO = options: threadCommandOptions, completer: threadCompleter, } - ); + )); }); - SubCommands.addUserCommand( - ['openu[pdates]', 'ou[pdates]'], - 'Open updated threads', - function () { - svc.openUpdates("root") - }, - { - }, - true - ); - - SubCommands.addUserCommand( - ['c[heckupdates]'], - 'Check updated threads', - function () { - svc.checkUpdates("root") - }, + commands.addUserCommand( + 'foxage', + 'Control FoxAge2ch', + function (args) (0 - 0), { + bang: true, + literal: 1, + subCommands: SubCommands, }, true ); - let mainCommand = - commands.addUserCommand( - 'foxage', - 'Control FoxAge2ch', - function (args) { - let ([count, name, bang, args] = SubCommands.parseCommand(args.string)) { - let cmd = SubCommands.getUserCommand(name); - liberator.assert(cmd, 'Unknown sub command: ' + name); - cmd.execute(args, bang, count); - } - }, - { - bang: true, - literal: 1, - completer: function (context, args) { - let [_, name, _, _] = SubCommands.parseCommand(args.string); - let cmd = SubCommands.getUserCommand(name); - - if (args.length === 2 && cmd) { - mainCommand.options = cmd.options; - context.offet = args.string.indexOf(name); - cmd.completer(context, args); - } else { - mainCommand.options = []; - context.completions = [ - [cmd.names.filter(function (it) it.length > 1)[0], cmd.description] - for (cmd in Iterator(SubCommands)) - ] - } - } - }, - true - ); - })(); // vim:sw=2 ts=2 et si fdm=marker: diff --git a/function-template.js b/function-template.js index f7017e1..0621d9f 100644 --- a/function-template.js +++ b/function-template.js @@ -104,8 +104,8 @@ let PLUGIN_INFO = 'string', // type: string, stringlist, charlist, boolean 'defaultValue', { - scope: options.OPTION_SCOPE_GLOBAL, // <- default - // or OPTION_SCOPE_LOCAL, OPTION_SCOPE_BOTH + scope: Option.SCOPE_GLOBAL, // <- default + // or Option.SCOPE_LOCAL, Option.SCOPE_BOTH setter: function (value) { /* mozo mozo */ return value; diff --git a/hints-for-embedded.js b/hints-for-embedded.js index e1703d3..38c5fbb 100644 --- a/hints-for-embedded.js +++ b/hints-for-embedded.js @@ -38,13 +38,13 @@ let PLUGIN_INFO = <name>Hints For Embedded Objects</name> <description>Add the hints mode for Embedded objects.</description> <description lang="ja">埋め込み(embed)オブジェクト用ヒントモード</description> - <version>1.3.1</version> + <version>1.4.0</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>https://github.com/vimpr/vimperator-plugins/raw/master/hints-for-embedded.js</updateURL> <minVersion>2.3</minVersion> - <maxVersion>2.3</maxVersion> + <maxVersion>2.4</maxVersion> <detail><![CDATA[ :embhint: Show hints for embedded objects. @@ -176,6 +176,12 @@ let INFO = value: /youtube\.com\/v\/([-a-zA-Z0-9_]+)/, url: function (id) ('http://www.youtube.com/watch?v=' + id) }, + youtube_image: { + site: /ytimg\.com/, + name: /^flashvars$/, + value: /video_id=([-a-zA-Z0-9_]+)/, + url: function (id) ('http://www.youtube.com/watch?v=' + id) + }, vimeo: { site: /vimeo/, name: /.*/, @@ -212,12 +218,14 @@ let INFO = (function () { for (let [,site] in Iterator(sites)) if (info.some(function (nv) nv.some(function (v) site.site.test(v)))) - return site;})(); + return site; + })(); if (site) { for each (let [n, v] in info) { + if (site.name && !site.name(n)) + continue; let m = n.match(site.value) || v.match(site.value); - liberator.log(v); if (m) return site.url(Array.slice(m, 1)); } diff --git a/i_love_echo.js b/i_love_echo.js index 87dee9b..41de89b 100644 --- a/i_love_echo.js +++ b/i_love_echo.js @@ -532,19 +532,19 @@ createPrototype($e4x, { }); // }}} -function createPrototype(class, obj){ +function createPrototype(_class, obj){ var flag; for (let i in obj){ flag = false; if (obj.__lookupGetter__(i)){ - class.prototype.__defineGetter__(i, obj.__lookupGetter__(i)); + _class.prototype.__defineGetter__(i, obj.__lookupGetter__(i)); flag = true; } if (obj.__lookupSetter__(i)){ - class..prototype.__defineSetter__(i, obj.__lookupSetter__(i)); + _class..prototype.__defineSetter__(i, obj.__lookupSetter__(i)); flag = true; } - if (!flag) class.prototype[i] = obj[i]; + if (!flag) _class.prototype[i] = obj[i]; } } })(); diff --git a/ldrize_cooperation.js b/ldrize_cooperation.js index 5fe7f97..94944df 100644 --- a/ldrize_cooperation.js +++ b/ldrize_cooperation.js @@ -1,6 +1,6 @@ // Vimperator plugin: 'Cooperation LDRize Mappings'
// Version: 0.25
-// Last Change: 22-Jan-2010. Jan 2008
+// Last Change: 07-Jan-2011. Jan 2008
// License: Creative Commons
// Maintainer: Trapezoid <trapezoid.g@gmail.com> - http://unsigned.g.hatena.ne.jp/Trapezoid
//
@@ -164,7 +164,9 @@ if (liberator.plugins.LDRizeCooperation == undefined) (function(){ LDRizeCooperationPanel.addEventListener("click",function(e){
self.isEnable = !self.isEnable;
},false);
- document.getElementById("status-bar").insertBefore(LDRizeCooperationPanel,document.getElementById("security-button").nextSibling);
+ 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;
},
@@ -173,8 +175,16 @@ if (liberator.plugins.LDRizeCooperation == undefined) (function(){ var GreasemonkeyService;
try{
GreasemonkeyService = Cc["@greasemonkey.mozdev.org/greasemonkey-service;1"].getService().wrappedJSObject;
- this.addAfter(GreasemonkeyService,"evalInSandbox",function(code,codebase,sandbox){
- if(sandbox.window.LDRize != undefined && sandbox.window.Minibuffer != undefined){
+ 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.LDRize != undefined && sandbox.Minibuffer != undefined){
sandbox.window.addEventListener("focus",function(){
self.LDRize = liberator.eval("self",sandbox.LDRize.getSiteinfo);
self.Minibuffer = liberator.eval("command",sandbox.Minibuffer.addCommand);
@@ -277,13 +287,13 @@ if (liberator.plugins.LDRizeCooperation == undefined) (function(){ //Options
liberator.modules.options.add(["ldrc","ldrizecooperation"],"LDRize cooperation","boolean",this.isEnable,
{
- setter: function(value){ self.isEnable = value; },
+ 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){ self.isModHints = value; },
+ setter: function(value){ return self.isModHints = value; },
getter: function() self.isModHints
}
);
diff --git a/nextlink.js b/nextlink.js index b1b23c5..00768dd 100644 --- a/nextlink.js +++ b/nextlink.js @@ -156,13 +156,14 @@ NextLink.prototype = { $U.bind(this, function(isSuccess, data) { if (!isSuccess) return; this.siteinfo = data.map(function(item) item.data); + + if (localSiteinfo) + this.siteinfo = this.siteinfo.concat(localSiteinfo); + this.siteinfo = this.siteinfo.sort(function(a, b) b.url.length - a.url.length); // sort url.length desc + + this.initialized = true; }) ); - if (localSiteinfo) - this.siteinfo = this.siteinfo.concat(localSiteinfo); - this.siteinfo = this.siteinfo.sort(function(a, b) b.url.length - a.url.length); // sort url.length desc - - this.initialized = true; this.customizeMap(this); }, diff --git a/panorama.js b/panorama.js index 7757cd6..aa1e793 100644 --- a/panorama.js +++ b/panorama.js @@ -2,7 +2,7 @@ * Use at your OWN RISK. */ let INFO = <> -<plugin name="panorama" version="0.6.3" +<plugin name="panorama" version="0.6.6" href="https://github.com/vimpr/vimperator-plugins/blob/master/panorama.js" summary="Add supports for Panorama" lang="en-US" @@ -71,13 +71,15 @@ let INFO = <> </description> </item> <item> - <tags>switchgroup swg</tags> + <tags>switchgroup swg g</tags> <spec>switchgroup <a>GroupName</a></spec> <spec>swg <a>GroupName</a></spec> + <spec>g <a>GroupName</a></spec> <spec><oa>count</oa>switchgroup</spec> <spec><oa>count</oa>swg</spec> + <spec><oa>count</oa>g</spec> <description> - <p>Switch group to <a>GroupName</a></p> + <p>Switch group to <a>GroupName</a></p> </description> </item> <item> @@ -102,8 +104,8 @@ let INFO = <> </description> </item> <item> - <tags>settitle</tags> - <spec>settitle <a>title</a> <oa>GroupName</oa></spec> + <tags>title</tags> + <spec>t<oa>itle</oa> <a>title</a> <oa>GroupName</oa></spec> <description> <p>update <a>GroupName</a>'s title to <a>title</a>.</p> <p>if omitted <a>GroupName</a>, update the current group.</p> @@ -601,7 +603,7 @@ let subCmds = [ * swtich to the {group} * if {count} exists, switch to relative {count} */ - new Command(["switchgroup", "swg"], "Switch Group", + new Command(["switchgroup", "swg", "g"], "Switch Group", function (args) { if (args.count > 0) { switchToGroup("+" + args.count, true); @@ -718,9 +720,9 @@ let subCmds = [ }, true) // }}} , /** - * SubCommand settitle {{{ + * SubCommand title {{{ */ - new Command(["settitle"], "set group title", + new Command(["t[itle]"], "set group title", function (args) { let title = args[0], groupName = args.literalArg; @@ -844,8 +846,8 @@ completion.tabgroup = function TabGroupCompleter (context, excludeActiveGroup) { url = getURLFromTab(tab), index = (tab._tPos + 1) + ": "; let item = createItem(index, label, url, indicator, tab.image); - if (!tab.pinned && tab.tabItem && tab.tabItem.parent) { - let groupName = tab.tabItem.parent.getTitle(); + if (!tab.pinned && tab._tabViewTabItem && tab._tabViewTabItem.parent) { + let groupName = tab._tabViewTabItem.parent.getTitle(); if (groupName) { let prefix = groupName + " " + (i + 1) + ": "; item.text.push(prefix + label); @@ -1,6 +1,6 @@ // INFO // var INFO = -<plugin name="pixiv.js" version="0.3" +<plugin name="pixiv.js" version="0.4" summary="Download image from pixiv" href="http://github.com/vimpr/vimperator-plugins/blob/master/pixiv.js" xmlns="http://vimperator.org/namespaces/liberator"> @@ -181,11 +181,16 @@ commands.addUserCommand( let i; let htmldoc=getDOMHtmlDocument(pageContents); if(htmldoc){ - for(i=0;;i++){ - tblElm=htmldoc.getElementById('page'+i); - if(!tblElm) break; - url.push(tblElm.getElementsByTagName('tr').item(1) - .getElementsByTagName('img').item(0).getAttribute('src')); + let max=htmldoc.getElementsByClassName('image-container').length; + let strScript; + let st,end; + for(i=0;i<max;i++){ + strScript=htmldoc.getElementsByClassName('image-container').item(i) + .getElementsByTagName('script').item(0) + .childNodes.item(0).nodeValue; + st=strScript.substr(strScript.search(/unshift/i)+'unshift'.length+2); + end=st.substr(0,st.indexOf("'")); + url.push(end); } }else{ url.length=0; diff --git a/pluginManager.js b/pluginManager.js index 8e520ec..f28590a 100644 --- a/pluginManager.js +++ b/pluginManager.js @@ -4,7 +4,7 @@ var PLUGIN_INFO = <description>Manage Vimperator Plugins</description> <description lang="ja">Vimpeatorプラグインの管理</description> <author mail="teramako@gmail.com" homepage="http://d.hatena.ne.jp/teramako/">teramako</author> -<version>0.6.6</version> +<version>0.6.7</version> <minVersion>2.3</minVersion> <maxVersion>2.4</maxVersion> <updateURL>https://github.com/vimpr/vimperator-plugins/raw/master/pluginManager.js</updateURL> @@ -190,8 +190,19 @@ for (let it in Iterator(tags)){ }; } function makeLink(str, withLink){ - var href = withLink ? '$&' : '#'; - return XMLList(str.replace(/(?:https?:\/\/|mailto:)\S+/g, '<a href="' + href + '" highlight="URL">$&</a>')); + let s = str; + let result = XMLList(); + while (s.length > 0) { + let m = s.match(/(?:https?:\/\/|mailto:)\S+/); + if (m) { + result += <>{s.slice(0, m.index)}<a href={withLink ? m[0] : '#'} highlight="URL">{m[0]}</a></>; + s = s.slice(m.index + m[0].length); + } else { + result += <>{s}</>; + break; + } + } + return result; } function fromUTF8Octets(octets){ return decodeURIComponent(octets.replace(/[%\x80-\xFF]/g, function(c){ diff --git a/readcatlater.js b/readcatlater.js index de36b70..60ce3f1 100644 --- a/readcatlater.js +++ b/readcatlater.js @@ -1,5 +1,5 @@ /* {{{ -Copyright (c) 2008-2009, anekos. +Copyright (c) 2008-2011, anekos. All rights reserved. Redistribution and use in source and binary forms, with or without modification, @@ -38,13 +38,13 @@ let PLUGIN_INFO = <name>Read Cat Later</name> <description>Read it later</description> <description lang="ja">後で読む</description> - <version>1.1.4</version> + <version>1.1.5</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>https://github.com/vimpr/vimperator-plugins/raw/master/readcatlater.js</updateURL> <minVersion>2.4</minVersion> - <maxVersion>2.4</maxVersion> + <maxVersion>3.0</maxVersion> <detail><![CDATA[ == Usage == :readcatlater [TAG]: @@ -137,9 +137,6 @@ let PLUGIN_INFO = }; - const migemo = Cc['@piro.sakura.ne.jp/xmigemo/factory;1']. - getService(Components.interfaces.pIXMigemoFactory). - getService("ja"); const tagssvc = Cc["@mozilla.org/browser/tagging-service;1"]. getService(Ci.nsITaggingService); const IOService = Cc["@mozilla.org/network/io-service;1"]. @@ -198,26 +195,10 @@ let PLUGIN_INFO = return [it for each (it in str.split(/\s+/)) if (/\w/.test(it))]; } - function RCL_Bookmarks (terms) { try { + function RCL_Bookmarks () { try { let query = history.getNewQuery(); query.setFolders([folderId], 1); - let m; - if (terms) { - let ts = splitBySpaces(terms).map(function (it) { - var re = new RegExp(migemo.getRegExp(it), 'i'); - var f = function (it) re.exec(it); - return {s: it, r: f}; - }); - m = function (it) - ts.some(function (t) - (it.URI.indexOf(t.s) >= 0 || it.title.indexOf(t.s) >= 0 || - t.r(it.URI) || t.r(it.title)) - ? true : false); - } else { - m = function () true; - } - let result = []; let qres = history.executeQueries([query], 1, history.getNewQueryOptions()); let folderNode = qres.root; @@ -232,8 +213,7 @@ let PLUGIN_INFO = let it = {id: node.itemId, title: node.title, URI: node.uri }; - if (m(it)) - result.push(it); + result.push(it); } } @@ -247,7 +227,7 @@ let PLUGIN_INFO = context.compare = void 'meow'; context.title = ['URL', 'Title']; context.filters = [CompletionContext.Filter.textDescription]; - context.completions = RCL_Bookmarks(context.filter). + context.completions = RCL_Bookmarks(). filter(function (it) it.id). map(function (it) [it.URI, bookmarks.getItemTitle(it.id)]). reverse(); diff --git a/sbmcommentsviewer.js b/sbmcommentsviewer.js index fd18c53..c7d10f6 100644 --- a/sbmcommentsviewer.js +++ b/sbmcommentsviewer.js @@ -3,7 +3,7 @@ var PLUGIN_INFO = <name>SBM Comments Viewer</name> <description>List show Social Bookmark Comments</description> <description lang="ja">ソーシャル・ブックマーク・コメントを表示します</description> - <version>0.2.1</version> + <version>0.2.2</version> <minVersion>2.0pre</minVersion> <maxVersion>3.0</maxVersion> <updateURL>https://github.com/vimpr/vimperator-plugins/raw/master/sbmcommentsviewer.js</updateURL> @@ -32,6 +32,7 @@ viewSBMComments [url] [options] - d : Delicious - l : livedoor clip - z : Buzzurl +- t : Topsy - XXX:今後増やしていきたい >|| @@ -125,8 +126,21 @@ function SBMEntry(id, timestamp, comment, tags, extra){ //{{{ } //}}} SBMEntry.prototype = { //{{{ toHTML: function(format){ - function makeLink(str) - XMLList(str.replace(/(?:https?:\/\/|mailto:)\S+/g, '<a href="$&" highlight="URL">$&</a>')); + function makeLink(str, withLink){ + let s = str; + let result = XMLList(); + while (s.length > 0) { + let m = s.match(/(?:https?:\/\/|mailto:)\S+/); + if (m) { + result += <>{s.slice(0, m.index)}<a href={withLink ? m[0] : '#'} highlight="URL">{m[0]}</a></>; + s = s.slice(m.index + m[0].length); + } else { + result += <>{s}</>; + break; + } + } + return result; + } var xml = <tr/>; var self = this; @@ -138,7 +152,8 @@ SBMEntry.prototype = { //{{{ </td>; break; case 'timestamp': - xml.* += <td class="liberator-sbmcommentsviewer-timestamp">{self.formatDate()}</td>; break; + xml.* += <td class="liberator-sbmcommentsviewer-timestamp">{self.formatDate()}</td>; + break; case 'tags': xml.* += <td class="liberator-sbmcommentsviewer-tags">{self.tags.join(',')}</td>; break; case 'comment': @@ -338,6 +353,33 @@ var SBM = { //{{{ liberator.log('Faild: Buzzurl'); } } + }, //}}} + topsy: { //{{{ + getURL: function(url){ + var urlPrefix = 'http://otter.topsy.com/trackbacks.json?perpage=50&infonly=0&tracktype=tweet&url='; + return urlPrefix + encodeURIComponent(url.replace(/%23/g,'#')); + }, + parser: function(xhr){ + var json = jsonDecode(xhr.responseText); + if (json && json.response){ + let c = new SBMContainer('t', json.response.trackback_total, { + faviconURL: 'http://topsy.com/favicon.ico', + pageURL: json.response.topsy_trackback_url + }); + json.response.list.forEach(function(entry){ + c.add( entry.author.nick, new Date(entry.date*1000), + entry.content, null, + { + userIcon: entry.author.photo_url, + link: entry.author.topsy_author_url + } + ); + }); + return c; + } else { + liberator.echo('Faild: Topsy'); + } + } } //}}} }; //}}} @@ -423,7 +465,8 @@ var manager = { h: 'hatena', d: 'delicious', l: 'livedoorclip', - z: 'buzzurl' + z: 'buzzurl', + t: 'topsy' }, format: { id: 'ID', diff --git a/statusbar_panel.js b/statusbar_panel.js new file mode 100755 index 0000000..7180890 --- /dev/null +++ b/statusbar_panel.js @@ -0,0 +1,151 @@ +let INFO = //{{{ +<plugin name="statusbar panel" version="0.1" + href="https://github.com/vimpr/vimperator-plugins/raw/master/statusbar_panel.js" + summary="Click statusbar panel" + lang="ja" + xmlns="http://vimperator.org/namespaces/liberator"> + <author href="http://d.hatena.ne.jp/wlt/" email="wltlain@gmail.com">wlt</author> + <license href="http://www.opensource.org/licenses/mit-license.php">MIT License</license> + <project name="vimperator" minVersion="2.3.1"/> + <p> + ステータスバー(アドオンバー)にあるパネル(アイコン)をクリックするコマンドを提供します。 + </p> + <item> + <tags>:statusbarpanel</tags> + <spec>:statusbarpanel <oa>-button=<a>l | m | r</a></oa> <oa>-double-click</oa> <a>panel-id</a></spec> + <description> + <p> + <a>panel-id</a>で指定するID属性を持つステータスバーパネル(アイコン)をクリックします。 + クリックするボタンは<oa>-button=</oa>で指定できます: + </p> + <dl> + <dt>l</dt> + <dd>左ボタン(デフォルト)</dd> + <dt>m</dt> + <dd>中ボタン(スクロールボタン)</dd> + <dt>r</dt> + <dd>右ボタン</dd> + </dl> + <p><oa>-double-click</oa>を指定するとダブルクリックになります。</p> + </description> + </item> +</plugin>; +//}}} + +let MOUSE_BUTTON_LEFT = 0; +let MOUSE_BUTTON_MIDDLE = 1; +let MOUSE_BUTTON_RIGHT = 2; + +function getImages(panel) { + var images = []; + // 普通の子孫要素のimage要素探索 + for (let [k, node] in Iterator(panel.getElementsByTagName('image'))) images.push(node); + // 匿名コンテントの子孫要素のimage要素探索 + var anonymousNodes = document.getAnonymousNodes(panel); + for (let [k, anonymousNode] in Iterator(anonymousNodes)) { + let node; + let result = document.evaluate('descendant-or-self::xul:image', anonymousNode, function() XUL.uri, XPathResult.ORDERED_NODE_ITERATOR_TYPE, null); + while ((node = result.iterateNext())) images.push(node); + } + + return images; +} + +function makeIcon(panel) { + var icon = <image xmlns={XUL.uri}/>; + var image = getImages(panel)[0]; + + if (image) { + let style = window.getComputedStyle(image, null); + let src = image.src || style.listStyleImage.replace(/^url\("(.+)"\)$/, '$1'); + if (src != '') { + icon.@style = 'list-style-image: url("' + src + '");' + + '-moz-image-region: ' + style.MozImageRegion; + } + } + return icon; +} + +function generateStatusbarpaneIDlList(filter) { + var panels = document.getElementsByTagNameNS(XUL.uri, 'statusbarpanel'); + for ([k, p] in Iterator(panels)) { + if (p.hidden != true) { + yield { + text: p.id, + desc: 'statusbarpanel', + icon: makeIcon(p) + }; + } + } +} + +function createAndDispatchEvent(target, type, detail, screenX, screenY, button) { + var ev = document.createEvent('MouseEvents'); + ev.initMouseEvent(type, true, true, window, detail, screenX, screenY, 0, 0, false, false, false, false, button, null); + target.dispatchEvent(ev); +} + +function clickStatusIcon(panel, button, doubleClick) { + var target = getImages(panel)[0] || panel; + if (!target) return; + var x = target.boxObject.screenX; + var y = target.boxObject.screenY; + x += target.clientWidth / 2; + y += target.clientHeight / 2; + + // イベントの発生順序 http://www.quirksmode.org/dom/events/click.html + createAndDispatchEvent(target, 'mousedown', 0, x, y, button); + createAndDispatchEvent(target, 'mouseup', 0, x, y, button); + createAndDispatchEvent(target, 'click', 1, x, y, button); + + if (doubleClick) { + createAndDispatchEvent(target, 'mousedown', 0, x, y, button); + createAndDispatchEvent(target, 'mouseup', 0, x, y, button); + createAndDispatchEvent(target, 'click', 1, x, y, button); + createAndDispatchEvent(target, 'dblclick', 2, x, y, button); + } else if (button == MOUSE_BUTTON_RIGHT) { + createAndDispatchEvent(target, 'contextmenu', 1, x, y, button); + } +} + +commands.addUserCommand(['statusbarpanel'],'click statusbar panel', + function(args) { + var id = args[0]; + var panel = document.getElementById(id); + if (!panel) { + liberator.echoerr('No such statusbar panel: ' + id); + return; + } + var button = MOUSE_BUTTON_LEFT; + switch (args['-button']) { + case 'm': button = MOUSE_BUTTON_MIDDLE; break; + case 'r': button = MOUSE_BUTTON_RIGHT; break; + case 'l': default: button = MOUSE_BUTTON_LEFT; break; + } + clickStatusIcon(panel, button, args['-double-click']); + }, { + argCount: '1', + options: [ + [['-button', '-b'], commands.OPTION_STRING, + function(arg) /^[lmr]$/.test(arg), + [['l', 'Left click (default)'], + ['m', 'Middle click'], + ['r', 'Right click']]], + [['-double-click', '-d'], commands.OPTION_NOARG] + ], + completer: function(context, args) { + var arg = args[0]; + context.anchored = false; + context.title = ['Panel ID']; + context.keys = { text: 'text', description: 'desc', icon: 'icon' }; + context.compare = CompletionContext.Sort.unsorted; + context.process = [function (item, text) { + return <><span highlight="CompIcon">{item.icon ? item.icon : <></>}</span><span class="td-strut"/>{text}</> + }]; + + var list = generateStatusbarpaneIDlList(arg); + context.completions = list; + } + }, true); + +// vim: set sw=4 ts=4 et fdm=marker : @@ -1,5 +1,5 @@ /* {{{ -Copyright (c) 2008-2010, anekos. +Copyright (c) 2008-2011, anekos. All rights reserved. Redistribution and use in source and binary forms, with or without modification, @@ -39,7 +39,7 @@ let PLUGIN_INFO = <name lang="ja">すてら</name> <description>For Niconico/YouTube/Vimeo, Add control commands and information display(on status line).</description> <description lang="ja">ニコニコ動画/YouTube/Vimeo 用。操作コマンドと情報表示(ステータスライン上に)追加します。</description> - <version>0.32.4</version> + <version>0.32.5</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> @@ -883,10 +883,7 @@ Thanks: get pageinfo () { let doc = content.document; - let wd = doc.querySelector('#watch-description > div > span > span.watch-video-date'); - let desc = wd.nextSibling; - while (desc && desc.tagName != 'SPAN') - desc = desc.nextSibling; + let desc = doc.querySelector('#eow-description'); return [ [ 'comment', @@ -894,7 +891,10 @@ Thanks: ], [ 'tags', - U.toXML(doc.querySelector('#watch-tags > div').innerHTML) + XMLList([ + <span>[<a href={v.href}>{v.textContent}</a>]</span> + for ([, v] in Iterator(doc.querySelectorAll('#eow-tags > li > a'))) + ].join('')) ], [ 'quality', @@ -1556,7 +1556,7 @@ Thanks: 'play', 'pause', 'comment', - 'repeat', + 'repeating', 'fullscreen', 'fetch', { @@ -1858,13 +1858,13 @@ Thanks: let self = this; function setEvents (name, elem) { - ['click', 'popupshowing'].forEach(function (eventName) { + ['click', 'command', 'popupshowing'].forEach(function (eventName) { let onEvent = self['on' + U.capitalize(name) + U.capitalize(eventName)]; onEvent && elem.addEventListener(eventName, function (event) { - if (eventName != 'click' || event.button == 0) { - onEvent.apply(self, arguments); - self.update(); - } + if (eventName == 'click' && event.button != 0) + return; + onEvent.apply(self, arguments); + self.update(); }, false); }); } @@ -2104,7 +2104,7 @@ Thanks: rel instanceof RelatedTag ? 'Tag: ' : ''; elem.setAttribute('label', prefix + rel.description); - elem.addEventListener('click', clickEvent(rel.command), false); + elem.addEventListener('command', clickEvent(rel.command), false); relmenu.appendChild(elem); }, this); }, diff --git a/twittperator.js b/twittperator.js index 038a9f1..c0e56bd 100644 --- a/twittperator.js +++ b/twittperator.js @@ -28,7 +28,7 @@ let PLUGIN_INFO = <name>Twittperator</name> <description>Twitter Client using OAuth and Streaming API</description> <description lang="ja">OAuth/StreamingAPI対応Twitterクライアント</description> - <version>1.13.1</version> + <version>1.13.2</version> <minVersion>2.3</minVersion> <maxVersion>3.0</maxVersion> <author mail="teramako@gmail.com" homepage="http://d.hatena.ne.jp/teramako/">teramako</author> @@ -1815,9 +1815,16 @@ let PLUGIN_INFO = let ugly = { __noSuchMethod__: function (name, args) originalPath[name].apply(originalPath, args), - toString: - function() - (parseInt(Error().stack.match(/io.js:(\d+)/)[1], 10) < 100 ? originalPath : hackedPath) + toString: function() { + function isFile (caller) { + if (!caller) + return false; + if (caller === io.File) + return true; + return isFile(caller.caller); + } + return isFile(arguments.callee.caller) ? originalPath : hackedPath; + } }; try { @@ -1911,14 +1918,18 @@ let PLUGIN_INFO = function rt(st) ("retweeted_status" in st ? st.retweeted_status : st); - function removeNewLine (text) + function removeNewLine(text) text.replace(/\r\n|[\r\n]/g, ' '); - function completer(generator) - function(filter) - makeTimelineCompleter( - filter ? function(context, args) context.completions = history.map(rt).filter(filter).map(generator) - : function(context, args) context.completions = history.map(rt).map(generator)); + function completer(generator, nort) { + let getHistory = nort ? function() history + : function() history.map(rt); + return function(filter) { + return makeTimelineCompleter( + filter ? function(context, args) context.completions = getHistory().filter(filter).map(generator) + : function(context, args) context.completions = getHistory().map(generator)); + } + } return { name: @@ -1929,6 +1940,8 @@ let PLUGIN_INFO = completer(function(s) [removeNewLine(s.text), s]), id: completer(function(s) [s.id, s]), + rawid: + completer(function(s) [s.id, s], true), name_id: completer(function(s) ["@" + s.user.screen_name + "#" + s.id, s]), name_id_text: @@ -2061,7 +2074,7 @@ let PLUGIN_INFO = history.filter(function(st) st.id === id).map(dtdd).forEach(liberator.echo); }, timelineCompleter: true, - completer: Completers.id() + completer: Completers.rawid(function(st) st.id) }), SubCommand({ command: ["track"], @@ -1,5 +1,5 @@ /* NEW BSD LICENSE {{{ -Copyright (c) 2010, anekos. +Copyright (c) 2010-2011, anekos. All rights reserved. Redistribution and use in source and binary forms, with or without modification, @@ -35,7 +35,7 @@ THE POSSIBILITY OF SUCH DAMAGE. // INFO {{{ let INFO = <> - <plugin name="跳.jp" version="1.0.0" + <plugin name="跳.jp" version="1.0.1" href="http://vimpr.github.com/" summary="跳ねます" lang="ja" @@ -59,19 +59,17 @@ let INFO = (function () { function getc (url, callback) { function toResult (html) { - let [, c] = html.match(/\/\/([^.]+)\.\u8DF3/); - return ['http://' + c + '.\u8DF3.jp/', c]; + return [html, html.match('http://(.+).\u8DF3.jp')[1]]; } let req = new plugins.libly.Request( - 'http://xn--vt3a.jp/entry/new', + 'http://xn--vt3a.jp/api?url=' + encodeURIComponent(url), { 'X-Requested-With': 'XMLHttpRequest', Referer : 'http://xn--vt3a.jp/' }, { - asynchronous: !!callback, - postBody: 'utf8=%E2%9C%93&url=' + encodeURIComponent(url) + asynchronous: !!callback } ); req.addEventListener( |