PageSourceSearch

http://www.gridrepublic.org/joomla/js/resizeIframe.js

js gridrepublic.org collected 2026-10-02 11:23:11 UTC 3,806 bytes, 125 lines download raw bytes

1/***********************************************
2* IFrame SSI script II- © Dynamic Drive DHTML code library (http://www.dynamicdrive.com)
3* Visit DynamicDrive.com for hundreds of original DHTML scripts
4* This notice must stay intact for legal use
5***********************************************/
6
7//Input the IDs of the IFRAMES you wish to dynamically resize to match its content height:
8//Separate each ID with a comma. Examples: ["myframe1", "myframe2"] or ["myframe"] or [] for none:
9var iframeids=["wikiframe"]
10
11//Should script hide iframe from browsers that don't support this script (non IE5+/NS6+ browsers. Recommended):
12var iframehide="yes"
13
14var getFFVersion=navigator.userAgent.substring(navigator.userAgent.indexOf("Firefox")).split("/")[1]
15var FFextraHeight=parseFloat(getFFVersion) >=0.1? 0 : 0 //extra height in px to add to iframe in FireFox 1.0+ browsers
16
17function resizeCaller()
18{
19    var dyniframe=new Array()
20    for (i=0; i<iframeids.length; i++)
21    {
22        if (document.getElementById)
23        resizeIframe(iframeids[i])
24        //reveal iframe for lower end browsers? (see var above):
25        if ((document.all || document.getElementById) && iframehide=="no")
26        {
27            var tempobj=document.all? document.all[iframeids[i]] : document.getElementById(iframeids[i])
28            tempobj.style.display="block"
29        }
30    }
31}
32function log( msg )
33{
34    if ( window.console )
35    {
36        window.console.log( msg );
37    }
38}
39function resizeIframe(frameid)
40{
41//alert(frameid);
42    var currentfr=document.getElementById(frameid)
43
44    if (!currentfr)
45    {
46        return;
47    }
48            
49            currentfr.style.display="block";
50        
51        if (currentfr.contentDocument && currentfr.contentDocument.body.offsetHeight)
52        {   
53            var firstTable = currentfr.contentDocument.getElementById('globalWrapper');
54            
55            // using firstTable's height inside <body> as safari returns height of the frame
56            // even if the body is smaller
57			if (window.opera) {
58				currentfr.height = firstTable.offsetHeight + 10;
59			} else {
60				currentfr.height = firstTable.offsetHeight + 10 + FFextraHeight;
61			}
62            
63            // scroll to top of iframe contents
64            currentfr.contentDocument.body.scrollTop = 0;
65            // scroll to top of outer page
66            document.scrollTop = 0;
67            
68        }
69        else if (currentfr.Document && currentfr.Document.body.scrollHeight) 
70        {
71            //ie5+ syntax
72            currentfr.height = currentfr.Document.body.scrollHeight;
73            // scroll to top of iframe contents
74//            currentfr.contentDocument.body.scrollTop = 0;
75            // scroll to top of outer page
76            // doesnt work in IE
77            //currentfr.Document.body.scrollTop = 0;
78            //document.scrollTop = 0;
79        }
80        
81        
82        if (currentfr.addEventListener)
83        {
84            currentfr.addEventListener("load", readjustIframe, false)
85        }
86        else if (currentfr.attachEvent)
87        {
88            currentfr.detachEvent("onload", readjustIframe) // Bug fix line
89            currentfr.attachEvent("onload", readjustIframe)
90        }
91}
92
93
94function readjustIframe(loadevt)
95{
96    var crossevt=(window.event)? event : loadevt
97    var iframeroot=(crossevt.currentTarget)? crossevt.currentTarget : crossevt.srcElement
98    if (iframeroot)
99    {
100        resizeIframe(iframeroot.id);
101    }
102}
103
104
105function loadintoIframe(iframeid, url)
106{
107    if (document.getElementById)
108    {
109        document.getElementById(iframeid).src=url
110    }
111}
112
113
114if (window.addEventListener)
115{
116    window.addEventListener("load", resizeCaller, false)
117}
118else if (window.attachEvent)
119{
120    window.attachEvent("onload", resizeCaller)
121}
122else
123{
124    window.onload=resizeCaller
125}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.