From 83edc1e4536d9852d129f26301f225f405c9f1ac Mon Sep 17 00:00:00 2001 From: anekos Date: Wed, 6 Aug 2008 09:07:41 +0000 Subject: getComputedStyle を使うように修正。 git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@17166 d0d07461-0603-4401-acd4-de1884942a52 --- auto_detect_link.js | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'auto_detect_link.js') 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; + } } -- cgit v1.2.3