aboutsummaryrefslogtreecommitdiffstats
path: root/auto-focus-frame.js
diff options
context:
space:
mode:
authoranekos2009-03-31 19:13:40 +0000
committeranekos2009-03-31 19:13:40 +0000
commit81d5d2673828d72cc52cd2ae2039916ed7c708a4 (patch)
tree4242c193f08a7049ef55255ae2c0a028a16cd9f4 /auto-focus-frame.js
parentcdb8a0f0de9307f8f568ac451e27bf48eaa1f5da (diff)
downloadvimperator-plugins-81d5d2673828d72cc52cd2ae2039916ed7c708a4.tar.bz2
typo とか色々修正
git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@31756 d0d07461-0603-4401-acd4-de1884942a52
Diffstat (limited to 'auto-focus-frame.js')
-rw-r--r--auto-focus-frame.js21
1 files changed, 13 insertions, 8 deletions
diff --git a/auto-focus-frame.js b/auto-focus-frame.js
index adc9be1..3d49ff8 100644
--- a/auto-focus-frame.js
+++ b/auto-focus-frame.js
@@ -38,7 +38,7 @@ let PLUGIN_INFO =
<name>Auto focus frame</name>
<description>Automatically focus to largest frame.</description>
<description lang="ja">最も大きなフレームに自動的にフォーカスする。</description>
- <version>1.0.0</version>
+ <version>1.0.1</version>
<author mail="anekos@snca.net" homepage="http://d.hatena.ne.jp/nokturnalmortum/">anekos</author>
<license>new BSD License (Please read the source code comments of this plugin)</license>
<license lang="ja">修正BSDライセンス (ソースコードのコメントを参照してください)</license>
@@ -68,13 +68,18 @@ let PLUGIN_INFO =
return;
let [maxSize, maxFrame] = [-1, content.frames[0]];
for (let frame in util.Array.iterator(content.frames)) {
- let size = frame.innerHeight * frame.innerWidth;
- win = window.content;
- if (win.scrollMaxX <= 0 && win.scrollMaxY <= 0)
- continue;
- if (maxSize < size) {
- maxSize = size;
- maxFrame = frame;
+ try {
+ if (frame.scrollMaxX <= 0 && frame.scrollMaxY <= 0)
+ continue;
+ let doc = frame.document;
+ let size = doc.width * doc.height;
+ if (maxSize < size) {
+ maxSize = size;
+ maxFrame = frame;
+ }
+ } catch (e) {
+ liberator.log(e)
+ continue;
}
}
maxFrame.focus();