/[drupal]/contributions/modules/smfforum/smfframe.js
ViewVC logotype

Contents of /contributions/modules/smfforum/smfframe.js

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.2 - (show annotations) (download) (as text)
Wed Apr 2 18:13:02 2008 UTC (19 months, 3 weeks ago) by vb
Branch: MAIN
CVS Tags: DRUPAL-6--1-1-dev, DRUPAL-6--1-0, DRUPAL-6--1-1, DRUPAL-6--1-2, DRUPAL-6--1-23, DRUPAL-6--1-22, DRUPAL-6--1-21, HEAD
Branch point for: DRUPAL-6--1
Changes since 1.1: +75 -0 lines
File MIME type: text/javascript
1.0 release
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:
9 var iframeids=["forumFrame"]
10
11 //Should script hide iframe from browsers that don't support this script (non IE5+/NS6+ browsers. Recommended):
12 var iframehide="yes"
13
14 var getFFVersion=navigator.userAgent.substring(navigator.userAgent.indexOf("Firefox")).split("/")[1]
15 var FFextraHeight=parseFloat(getFFVersion)>=0.1? 16 : 0 //extra height in px to add to iframe in FireFox 1.0+ browsers
16
17 function 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 }
32
33 function resizeIframe(frameid)
34 {
35 var currentfr=document.getElementById(frameid)
36 if (currentfr && !window.opera)
37 {
38 currentfr.style.display="block"
39 if (currentfr.contentDocument && currentfr.contentDocument.body.offsetHeight) //ns6 syntax
40 currentfr.height = currentfr.contentDocument.body.offsetHeight+FFextraHeight;
41 else if (currentfr.Document && currentfr.Document.body.scrollHeight) //ie5+ syntax
42 currentfr.height = currentfr.Document.body.scrollHeight;
43 if (currentfr.addEventListener)
44 currentfr.addEventListener("load", readjustIframe, false)
45 else if (currentfr.attachEvent)
46 {
47 currentfr.detachEvent("onload", readjustIframe) // Bug fix line
48 currentfr.attachEvent("onload", readjustIframe)
49 }
50 }
51 // Scrolls the page to the top once the iframe is adjusted-- effectively after a link is clicked. Improvement by Daen.
52 window.scrollTo(0, 0);
53 }
54
55 function readjustIframe(loadevt)
56 {
57 var crossevt=(window.event)? event : loadevt
58 var iframeroot=(crossevt.currentTarget)? crossevt.currentTarget : crossevt.srcElement
59
60 if (iframeroot)
61 resizeIframe(iframeroot.id);
62 }
63
64 function loadintoIframe(iframeid, url)
65 {
66 if (document.getElementById)
67 document.getElementById(iframeid).src=url
68 }
69
70 if (window.addEventListener)
71 window.addEventListener("load", resizeCaller, false)
72 else if (window.attachEvent)
73 window.attachEvent("onload", resizeCaller)
74 else
75 window.onload=resizeCaller

  ViewVC Help
Powered by ViewVC 1.1.2