diff options
author | anekos | 2008-08-05 11:19:38 +0000 |
---|---|---|
committer | anekos | 2008-08-05 11:19:38 +0000 |
commit | bcf9ba015056057e613bc970863e944a785e42d4 (patch) | |
tree | 054d47a8b20aa20f8cb87ced3bcb5149dffeaccf | |
parent | 15430b78c6fd521438c686cda3d57fe939ad2f49 (diff) | |
download | vimperator-plugins-bcf9ba015056057e613bc970863e944a785e42d4.tar.bz2 |
・見えていない要素は無視するようにした。
git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@17111 d0d07461-0603-4401-acd4-de1884942a52
-rw-r--r-- | auto_detect_link.js | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/auto_detect_link.js b/auto_detect_link.js index e5b3e30..55627d9 100644 --- a/auto_detect_link.js +++ b/auto_detect_link.js @@ -238,9 +238,15 @@ } + // 要素が表示されているか? + function isVisible (element) { + return !(element.style && element.style.display.match(/none/)) && (!element.parentNode || isVisible(element.parentNode)) + } + + // リンクのフィルタ - function linkFilter (link) { - return link.href && !link.href.match(/@/) && link.href.match(/^((https?|file|ftp):\/\/|javascript:)/) && link.textContent; + function linkElementFilter (elem) { + return isVisible(elem) && elem.href && !elem.href.match(/@/) && elem.href.match(/^((https?|file|ftp):\/\/|javascript:)/) && elem.textContent; } @@ -250,7 +256,7 @@ var result = []; // Anchor for each (let it in content.document.links) { - if (linkFilter(it)) + if (linkElementFilter(it)) result.push({ type: 'link', frame: content, |