Hi, I've also been having some problems with _IG_AdjustIFrameHeight(). Prior to June, everything worked fine. In the sandbox, everything still works fine. I run into problems outside of the sandbox, however. In Firefox 3.5, the iframe gets resized to 0 height; in Safari 4, it just stays at its default, original size.
Code is below; also http://hosting.gmodules.com/ig/gadgets/file/101461686553963714714/newsagg.xml. It's very possible that I'm doing something wrong, but given the features I'm using, I don't understand the different behavior between the sandbox and the non-sandbox. Thanks in advance for any help. sean ---------------- <?xml version="1.0" encoding="UTF-8" ?> <Module> <ModulePrefs ...snipped...> <Require feature="dynamic-height"/> <Require feature="setprefs"/> <Require feature="analytics"/> </ModulePrefs> <UserPref name="entries" display_name="# of Entries" datatype="enum" default_value="11"> <EnumValue value="5"/> <EnumValue value="6"/> <EnumValue value="7"/> <EnumValue value="8"/> <EnumValue value="9"/> <EnumValue value="10"/> <EnumValue value="11"/> <EnumValue value="12"/> </UserPref> <UserPref name="biashighlight" display_name="Bias highlighting?" datatype="enum" default_value="1"> <EnumValue display_value="Yes" value="1"/> <EnumValue display_value="No" value="0"/> </UserPref> <Content type="html"><![CDATA[ <div id="content_div"></div> <script> var prefs = new _IG_Prefs(__MODULE_ID__); function getColor(bias) { return "#ffffff"; }; function getLinks() { _IG_FetchContent('http://www.smunson.com/bloggregator/bw.csv', function (responseText) { var html = " "; var entries = prefs.getInt("entries"); var biashighlight = prefs.getInt("biashighlight"); var stitle = ''; var bgcolor = '#ffffff'; //chars var framewidth = window.innerWidth? window.innerWidth:document.body.clientWidth; var chars = 37; var workingmargin = framewidth - 250; chars = chars + parseInt(workingmargin/5); // Use the split function to extract substrings separated by comma // delimiters. var links = responseText.split("\n"); // Process array of extracted substrings. for (var i = 0; i < entries; i++) { link = links[i].split(","); if (link[1].length > chars){ stitle = link[1].substring(0,chars-3)+"..."; }else{ stitle = link[1]; } title = link[1].replace("\"","""); if (biashighlight == 0){ html += "<li><a href='" + link[0] + "' title=\""+title+"\" target=\"_top\">"+stitle+"</a></li>\n"; }else{ bgcolor = getColor(link[2]); html += "<li style=\"background-color:"+bgcolor+";\"><a href='" + link[0] + "' title=\""+title+"\" target=\"_top\">"+stitle+"</ a></li>\n"; } }; // Output html in div. _gel('content_div').innerHTML = html; _IG_AdjustIFrameHeight(); },{refreshInterval: (60*5)}); }; _IG_RegisterOnloadHandler(getLinks); _IG_Analytics("UA-85479-7","/newsgadget"); </script> ]]> </Content> On Jun 16, 10:27 pm, Jerome <[email protected]> wrote: > Hi Magnus, > > As far as I can tell, _IG_AdjustIFrameHeight() works great. Please > test for instance this > gadget:http://www.google.com/ig/directory?hl=en&url=www.ljmsite.com%2Fgoogle... > and see if this is resizing properly for you. The issue could be > related to a code change from Google that is not yet visible from > where I am... > > Here is another example, which uses Tabs of slightly different height > (calling the resize on tab > change):http://www.google.com/ig/directory?hl=en&url=www.ljmsite.com%2Fgoogle... > > Please, prefer posting the URL that we can test your gadget in > development directly rather than copying and pasting the complete code > in here. With the line wrapping and all, this is time consuming to get > this running to see how it is actually going. > > Thanks, > > Jerome > > On Jun 16, 4:33 pm, magnus <[email protected]> wrote: > > > I've looked all over the place for info about this issue but found > > nothing instructive. I have written a gadget that is almost ready for > > release, except for an issue with _IG_AdjustIFrameHeight(). It is > > being ignored; no resizing whatsoever. I've tried calling it multiple > > times in the code, used settimer() on it to make sure it's called a > > sufficient time after everything has loaded. I've also cut the code > > down to nothing but the call to _IG_AdjustIFrameHeight and some text > > (so there is a reason to resize the frame), but nothing... The frame > > remains at whatever size it is initialized to. I've tested this in > > FF3, Safari and IE7. > > > One post I found suggests that something on the Google side changed > > earlier this month (Jun 2009) and is causing this, but no repsonses > > have been forthcoming. Nobody else seems to be experiencing this, so > > it must be something in my code. > > > Anyhow, hopefully I'm just missing something and someone will be kind > > enough to point it out to me. > > > Thanks, > > /magnus > > > THE CODE: (Call to _IG_AdjustIFrameHeight() is in red below, for HTML- > > capable clients). > > --------- > > <?xml version="1.0" encoding="UTF-8" ?> > > <Module> > > <ModulePrefs title="__MSG_title__" author="AWI, Inc." author_email="" > > description="__MSG_description__" screenshot="__MSG_screenshot__" > > thumbnail="__MSG_thumbnail__"> > > <Locale messages="http://www.wildlandspress.com/gadget/languages/ > > ALL_ALL.xml"/> > > <Require feature="tabs" /> > > <Require feature="dynamic-height" /> > > <Require feature="settitle"/> > > </ModulePrefs> > > > <Content type="html"> > > <![CDATA[ > > > <style> > > #box { > > height:250px; > > width:100%;} > > > #caption { > > font-size:9pt; > > color:gray;} > > > #description { > > font-size:8pt; > > color:black;} > > > #nav { > > margin:0px auto; > > width:100%;} > > > #nav td { > > font-size:7pt; > > width:33%;} > > > #ge { > > width:100%; > > text-align:center;} > > > #id_map { > > margin:0px auto; > > margin-top:10px;} > > > .left { > > text-align:left;} > > > .center { > > text-align:center;} > > > .right { > > text-align:right;} > > > .copyright { > > color:#cfcfcf; > > font-size:8pt;} > > > </style> > > > <script src="http://maps.google.com/maps?file=js" type="text/ > > javascript"></script> > > <script type="text/javascript"> > > > var position; > > var currDate = ''; > > var host = 'http://www.wildlandspress.com'; > > var imgpath = '/dailypic/images/'; > > var gadgetpath = '/gadget/'; > > > function callback(tabId) { > > //called during tab init and switch > > if(tabId == 'id_map') { > > if (GBrowserIsCompatible()) { > > var geocoder = new GClientGeocoder(); > > geocoder.getLatLng(position, showMap); > > } > > } > > > } //callback > > > function showMap(point) { > > if (point!=null) { > > var map = new GMap2(document.getElementById("id_map")); > > map.setCenter(point, 7); > > map.addControl(new GSmallMapControl()); > > map.addControl(new GMapTypeControl()); > > var marker = new GMarker(point); > > map.addOverlay(marker); > > > _IG_AdjustIFrameHeight(); > > } > > > } //showMap > > > // Initialize tabs, designate the tab named "Photo" as the tab > > selected by default. > > var tabs = new _IG_Tabs(__MODULE_ID__, "Photo"); > > tabs.alignTabs("left", 10); > > > function init() { > > > _IG_SetTitle("__MSG_title__"); > > > tabs.addTab("Photo", {contentContainer: _gel('id_photo'), > > callback: callback > > }) > > tabs.addTab("Map", {contentContainer: _gel('id_map'), > > callback: callback > > }) > > > // Align tabs to the left and offset by 10 pixels > > tabs.alignTabs("left", 10); > > > //fetch pic and data for the current day > > fetchContent('today'); > > > } //init > > > function fetchContent(getDate) { > > > var url = host + gadgetpath + 'dailyPic.php?cr=' + currDate + '&dt=' > > + getDate; > > > _IG_FetchContent(url, function(jsonResponse) { > > > var arrData = eval('(' + jsonResponse + ')'); > > var file_name = arrData['file_name']; > > var caption = arrData['caption']; > > var description = arrData['description']; > > var country = arrData['country']; > > var province = arrData['province']; > > var place = arrData['place']; > > var arrLocation = new Array(country, province, place); > > position = arrLocation.join(', '); > > currDate = arrData['assigned_date']; > > > var heading = document.getElementById("heading"); > > var pCaption = document.getElementById("caption"); > > var pDescription = document.getElementById("description"); > > var box = document.getElementById("box"); > > var img = document.getElementById("picofday"); > > > heading.innerHTML = position; > > pCaption.innerHTML = caption; > > pDescription.innerHTML = description; > > > img.src = host + imgpath + file_name; > > > var imgH = img.clientHeight; > > var imgW = img.clientWidth; > > var boxH = box.clientHeight; > > var boxW = box.clientWidth; > > > // Find which dimension is scaled the most > > var scaleH = boxH / imgH; > > var scaleW = boxW / imgW; > > > // Scale the image > > if (scaleH < scaleW) { > > img.style.height = box.clientHeight + "px"; > > img.style.width = Math.round(imgW * scaleH) + "px"; > > } else { > > img.style.width = boxW + "px"; > > img.style.height = Math.round(imgH * scaleW) + "px"; > > } > > > _IG_AdjustIFrameHeight(); > > > }, > > { refreshInterval: 0 } > > ); > > > } // fetchContent > > > // Call init function to initialize and display tabs. > > _IG_RegisterOnloadHandler(init); > > > </script> > > > <div id="id_photo" style="text-align:center"> > > <h3 id="heading"></h3> > > > <div id="box"> > > <img id="picofday" src="http://www.wildlandspress.com/dailypic/images/ > > ed_blank.gif" /> > > </div> > > > <table id="nav"> > > <tr> > > <td class="left"> > > > <script>document.writeln("<img onclick=\"fetchContent('prev')\" alt= > > \"Prev\" src=\"" + host + gadgetpath + "left.gif\" />");</script> > > > </td> > > <td class="center">Copyright 2009</td> > > <td class="right"> > > <script>document.writeln("<img onclick=\"fetchContent('next') alt= > > \"Prev\" src=\"" + host + gadgetpath + "right.gif\" />");</script> > > </td> > > </tr> > > </table> > > <p id="caption"></p> > > <p id="description"></p> > > <div id="ge"> > > View in Google Earth > > </div> > > </div> <!-- id_photo --> > > > <div id="id_map" style="width:300px;height:400px;text-align:center"> > > </div> <!-- id_map --> > > > ]]> > > </Content> > > </Module> > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "iGoogle Developer Forum" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/Google-Gadgets-API?hl=en -~----------~----~----~----~------~----~------~--~---
