aboutsummaryrefslogtreecommitdiffstats
path: root/_libly.js
diff options
context:
space:
mode:
authoranekos2009-01-08 08:16:41 +0000
committeranekos2009-01-08 08:16:41 +0000
commit5c02a3de739ef767e6cac803654cf88330ef6cf0 (patch)
tree67371c67266dd9386420dbb7170c8a8c7ca5354b /_libly.js
parentab5c06adb52da536bc2e9d38dddd2e0d5a5b5f0f (diff)
downloadvimperator-plugins-5c02a3de739ef767e6cac803654cf88330ef6cf0.tar.bz2
add toStyleText(style)
関数名がアレでしたら変更してください。 git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@28166 d0d07461-0603-4401-acd4-de1884942a52
Diffstat (limited to '_libly.js')
-rw-r--r--_libly.js21
1 files changed, 19 insertions, 2 deletions
diff --git a/_libly.js b/_libly.js
index d9e793f..915e17e 100644
--- a/_libly.js
+++ b/_libly.js
@@ -12,7 +12,7 @@ var PLUGIN_INFO =
<description lang="ja">適当なライブラリっぽいものたち。</description>
<author mail="suvene@zeromemory.info" homepage="http://zeromemory.sblo.jp/">suVene</author>
<license>MIT</license>
- <version>0.1.19</version>
+ <version>0.1.20</version>
<minVersion>1.2</minVersion>
<maxVersion>2.0pre</maxVersion>
<updateURL>http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk/_libly.js</updateURL>
@@ -95,6 +95,13 @@ xmlToDom(node, doc, nodes):
getElementPosition(elem):
elem の offset を返却します。
return {top: 0, left: 0}
+toStyleText(style):
+ スタイルが格納されているオブジェクトを
+ >||
+ position: fixed;
+ left: 10px;
+ ||<
+ のような文字列に変換します。
]]></detail>
</VimperatorPlugin>;
//}}}
@@ -127,7 +134,7 @@ libly.$U = {//{{{
extend: function(dst, src) {
for (let prop in src)
dst[prop] = src[prop];
- return dst;
+ return dst;
},
A: function(iterable) {
var ret = [];
@@ -342,6 +349,16 @@ libly.$U = {//{{{
offsetTop = offsetTop || null;
offsetLeft = offsetLeft || null;
return {top: offsetTop, left: offsetLeft};
+ },
+ toStyleText: function(style) {
+ var result = '';
+ for (let name in style) {
+ result += name.replace(/[A-Z]/g, function (c) ('-' + c.toLowerCase())) +
+ ': ' +
+ style[name] +
+ ';\n';
+ }
+ return result;
}
// }}}
};