diff options
author | anekos | 2008-11-14 22:49:41 +0000 |
---|---|---|
committer | anekos | 2008-11-14 22:49:41 +0000 |
commit | cc712c538070b90c83e11f5aefb1ee2954c318f6 (patch) | |
tree | 6fb19dae1839a8deae263c15abfec441209fbe08 /i_love_echo.js | |
parent | 0d62c1324517e4febea700ed19c45b5a3c37c9b0 (diff) | |
download | vimperator-plugins-cc712c538070b90c83e11f5aefb1ee2954c318f6.tar.bz2 |
指の歪みを防止するオブジェクトを導入した
git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@23741 d0d07461-0603-4401-acd4-de1884942a52
Diffstat (limited to 'i_love_echo.js')
-rw-r--r-- | i_love_echo.js | 42 |
1 files changed, 41 insertions, 1 deletions
diff --git a/i_love_echo.js b/i_love_echo.js index 455b907..1a06b55 100644 --- a/i_love_echo.js +++ b/i_love_echo.js @@ -35,6 +35,14 @@ * とりあえず、http://exapmle.comのDOMドキュメントをstack * :echo $_.cache.last.inspect() * 最後にstackしたものを取り出し、DOM Inspectorが入っている場合はDOM Inspectorに出力 + * + * :echo $('//a').evaluate().grep(/^http/).join("\n").copy() + * リンクを抽出してクリップボードにコピー + * + * :echo $('//a').evaluate().map(function(v)v.href.replace(/.*\//,'')).copy() + * :echo $('//a').evaluate().map($f.href().replace(/.*\//,'')).copy() + * リンクのファイル名部分のみをクリップボードにコピー + * */ (function(){ @@ -59,6 +67,39 @@ function $(arg){ //{{{ return new $o(arg); } } //}}} +liberator.modules.$f = (function () { //{{{ + const pests = [ + '__defineGetter__', '__defineSetter__', 'hasOwnProperty', 'isPrototypeOf', + '__lookupGetter__', '__lookupSetter__', '__parent__', 'propertyIsEnumerable', + '__proto__', 'toSource', 'toString', 'toLocaleString', 'unwatch', 'valueOf', 'watch' + ]; + + function id(value) + value; + + function memfn(parent) + function (name,args) + FFF(function(self) + let (s = parent(self)) + let (f = s[name]) + (f instanceof Function ? s[name].apply(s, args) : f)); + + function mem(parent) + function (name) + FFF(function(self) + parent(self)[name]); + + function FFF(parent) { + parent.__noSuchMethod__ = memfn(parent) + parent.m = {__noSuchMethod__: mem(parent)}; + pests.forEach(function(it) (parent[it] = function() parent.__noSuchMethod__(it, arguments))); + return parent; + }; + + return FFF(id); +})(); //}}} + + liberator.modules.$ = $; liberator.modules.$x = function $x(url, method, user, password){ //{{{ if (!cacheXHR){ @@ -103,7 +144,6 @@ liberator.modules.$_ = { //{{{ return null; } }; // }}} - const DOMINSPECTOR = Application.extensions.has("inspector@mozilla.org") && Application.extensions.get("inspector@mozilla.org").enabled; // ----------------------------------------------------------------------------- |