aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoranekos2008-08-19 12:58:19 +0000
committeranekos2008-08-19 12:58:19 +0000
commitdb5b9fbb7b72b4ae724297995970a3f0957622a6 (patch)
tree383c30a2641630d481527f5f35b227ece90daaac
parent332a3d98292429556710bc68d1baef238e5dd59b (diff)
downloadvimperator-plugins-db5b9fbb7b72b4ae724297995970a3f0957622a6.tar.bz2
isScrollableを修正
git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@17906 d0d07461-0603-4401-acd4-de1884942a52
-rw-r--r--scroll_div.js25
1 files changed, 16 insertions, 9 deletions
diff --git a/scroll_div.js b/scroll_div.js
index dd7bbdf..3eb57cf 100644
--- a/scroll_div.js
+++ b/scroll_div.js
@@ -2,13 +2,17 @@
let re = /auto|scroll/i;
- // FIXME!!!!!!!! Firebug では overflow になってるのに false になったりする。
function isScrollable (e, doc) {
- let s = doc.defaultView.getComputedStyle(e, null);
- for each (let n in ['overflow', 'overflow-x', 'overflow-y']) {
- //if (s[n] && s[n].match(/.+/)) liberator.log(n + ':' + s[n]);
- if (s[n] && s[n].match(re))
- return true;
+ try {
+ let s = doc.defaultView.getComputedStyle(e, '');
+ if (e.scrollHeight <= e.clientHeight)
+ return;
+ for each (let n in ['overflow', 'overflowY', 'overflowX']) {
+ if (s[n] && s[n].match(re))
+ return true;
+ }
+ } catch (e) {
+ liberator.log(e);
}
}
@@ -43,7 +47,7 @@
result.push(e);
}
- liberator.log(result.length);
+ liberator.log('scrollableElements: ' + result.length);
return result;
}
@@ -61,7 +65,6 @@
function currentElement () {
let es = scrollableElements();
let idx = content.document.__div_scroller_index || 0;
- liberator.log("idx: " + idx);
return es[idx];
}
@@ -70,8 +73,11 @@
let elem = currentElement();
if (elem)
elem.scrollTop += dy;
- //for each (let elem in scrollableElements())
+ //for each (let elem in scrollableElements()) {
+ // liberator.log(elem.tagName);
+ // liberator.log(elem.id);
// elem.scrollTop += dy;
+ //}
}
liberator.mappings.addUserMap(
@@ -88,6 +94,7 @@
function () shiftScrollElement()
);
+ scroll(100);