Changeset 34522
- Timestamp:
- 07/22/09 06:10:09 (4 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
lang/javascript/vimperator-plugins/trunk/auto-focus-frame.js
r32501 r34522 39 39 <description>Automatically focus to largest frame.</description> 40 40 <description lang="ja">最も大きなフレームに自動的にフォーカスする。</description> 41 <version>1.0. 5</version>41 <version>1.0.6</version> 42 42 <author mail="anekos@snca.net" homepage="http://d.hatena.ne.jp/nokturnalmortum/">anekos</author> 43 43 <license>new BSD License (Please read the source code comments of this plugin)</license> … … 45 45 <updateURL>http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk/auto-focus-frame.js</updateURL> 46 46 <minVersion>2.0</minVersion> 47 <maxVersion>2. 1pre</maxVersion>47 <maxVersion>2.2pre</maxVersion> 48 48 <detail><![CDATA[ 49 49 == Usage == … … 63 63 '.*', 64 64 function () { 65 function doFocus () { 66 let [maxSize, maxFrame] = [-1, null]; 67 for (let frame in util.Array.itervalues(content.frames)) { 68 try { 69 if (!(frame.frameElement instanceof HTMLFrameElement)) 70 continue; 71 if (frame.scrollMaxX <= 0 && frame.scrollMaxY <= 0) 72 continue; 73 let size = frame.innerWidth * frame.innerHeight; 74 if (maxSize < size) { 75 maxSize = size; 76 maxFrame = frame; 77 } 78 } catch (e) { 79 liberator.log(e) 80 continue; 81 } 82 } 83 if (maxFrame) 84 maxFrame.focus(); 85 } 86 87 65 88 if (!(window.content.document instanceof HTMLDocument)) 66 89 return; 67 90 if (content.frames.length <= 1) 68 91 return; 69 let [maxSize, maxFrame] = [-1, null]; 92 93 let nframes = content.frames.length; 70 94 for (let frame in util.Array.itervalues(content.frames)) { 71 try { 72 if (!(frame.frameElement instanceof HTMLFrameElement)) 73 continue; 74 if (frame.scrollMaxX <= 0 && frame.scrollMaxY <= 0) 75 continue; 76 let size = frame.innerWidth * frame.innerHeight; 77 if (maxSize < size) { 78 maxSize = size; 79 maxFrame = frame; 80 } 81 } catch (e) { 82 liberator.log(e) 83 continue; 95 if (frame.frameElement instanceof HTMLFrameElement) { 96 frame.addEventListener( 97 'DOMContentLoaded', 98 function () { 99 frame.removeEventListener('DOMContentLoaded', arguments.callee, true); 100 if (!--nframes) 101 doFocus(); 102 }, 103 true 104 ); 84 105 } 85 106 } 86 if (maxFrame) 87 maxFrame.focus(); 107 88 108 } 89 109 );
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)