aboutsummaryrefslogtreecommitdiffstats
path: root/_libly.js
diff options
context:
space:
mode:
authorsuVene2008-12-12 16:18:24 +0000
committersuVene2008-12-12 16:18:24 +0000
commitb04579fb4b0192962632bd2d34708268c798e740 (patch)
tree74a6f68c01da52bc8b750cd2ffab41c7f5973d7e /_libly.js
parent3b9aa5759f9e313c1f6e98cc6a856cc44f8023a1 (diff)
downloadvimperator-plugins-b04579fb4b0192962632bd2d34708268c798e740.tar.bz2
擬似 Autopagerize
git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@26594 d0d07461-0603-4401-acd4-de1884942a52
Diffstat (limited to '_libly.js')
-rw-r--r--_libly.js20
1 files changed, 19 insertions, 1 deletions
diff --git a/_libly.js b/_libly.js
index aeb5558..9bf09a6 100644
--- a/_libly.js
+++ b/_libly.js
@@ -5,7 +5,7 @@ var PLUGIN_INFO =
<description>vimperator plugins library?</description>
<description lang="ja">適当なライブラリっぽいものたち。</description>
<author mail="suvene@zeromemory.info" homepage="http://zeromemory.sblo.jp/">suVene</author>
- <version>0.1.7</version>
+ <version>0.1.8</version>
<minVersion>1.2</minVersion>
<maxVersion>2.0pre</maxVersion>
<detail><![CDATA[
@@ -66,6 +66,11 @@ createHTMLDocument(str):
引数 str より、HTMLFragment を作成します。
getNodesFromXPath(xpath, doc, callback, obj):
xpath を評価し snapshot の配列を返却します。
+xmlSerialize(xml):
+ xml を文字列化します。
+getElementPosition(elem):
+ elem の offset を返却します。
+ {top: 0, left: 0}
]]></detail>
</VimperatorPlugin>;
//}}}
@@ -244,6 +249,19 @@ libly.$U = {//{{{
.replace(/<!--(?:[^-]|-(?!->))*-->/g, '')
.replace(/<[^>]+>/g, function(all) all.toLowerCase());
} catch (e) { return '' }
+ },
+ getElementPosition: function(elem) {
+ var offsetTrail = elem;
+ var offsetLeft = 0;
+ var offsetTop = 0;
+ while (offsetTrail) {
+ offsetLeft += offsetTrail.offsetLeft;
+ offsetTop += offsetTrail.offsetTop;
+ offsetTrail = offsetTrail.offsetParent;
+ }
+ offsetTop = offsetTop || null;
+ offsetLeft = offsetLeft || null;
+ return {top: offsetTop, left: offsetLeft};
}
// }}}
};