aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoranekos2008-08-06 09:07:41 +0000
committeranekos2008-08-06 09:07:41 +0000
commit83edc1e4536d9852d129f26301f225f405c9f1ac (patch)
treee7a719650f19808f369369321fe86836f9710efe
parent008ba0490fe9f1e2c13d6c3493eebc6078f99b59 (diff)
downloadvimperator-plugins-83edc1e4536d9852d129f26301f225f405c9f1ac.tar.bz2
getComputedStyle を使うように修正。
git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@17166 d0d07461-0603-4401-acd4-de1884942a52
-rw-r--r--auto_detect_link.js17
1 files changed, 13 insertions, 4 deletions
diff --git a/auto_detect_link.js b/auto_detect_link.js
index 55627d9..1c03f1b 100644
--- a/auto_detect_link.js
+++ b/auto_detect_link.js
@@ -34,15 +34,19 @@
// force:
// (次|前)っぽいURIを捏造してそこに移動します。
//
+// example:
+// :js liberator.globalVariables.autoDetectLink = {nextPatterns: [/next/, /次/]}
+//
// Function:
// (次|前)へのリンクを検出する。
// liberator.plugins.autoDetectLink.detect(next, setting)
// next: 次のリンクを探すときは、true。
// setting: 設定を一時的に上書きする。省略可。
// return: リンクのURIなどを含んだオブジェクト
-// uri: アドレス。
-// text: リンクテキストなど。
-// frame: リンクの存在するフレームの Window オブジェクト。
+// uri: アドレス。
+// text: リンクテキストなど
+// frame: リンクの存在するフレームの Window オブジェクト
+// element: リンクの要素
//
// (次|前)へのリンクに移動。
// liberator.plugins.autoDetectLink.go(next, setting)
@@ -240,7 +244,12 @@
// 要素が表示されているか?
function isVisible (element) {
- return !(element.style && element.style.display.match(/none/)) && (!element.parentNode || isVisible(element.parentNode))
+ try {
+ let st = content.document.defaultView.getComputedStyle(element, null);
+ return !(st.display && st.display.match(/none/)) && (!element.parentNode || isVisible(element.parentNode))
+ } catch {
+ return true;
+ }
}