Resize External Url In I-frame

Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Reply

Join Date: Mar 2008
Posts: 36
Reputation: lonestar23 is an unknown quantity at this point 
Solved Threads: 0
lonestar23 lonestar23 is offline Offline
Light Poster

Resize External Url In I-frame

 
0
  #1
Nov 15th, 2008
Hello, I need to resize an I-fame according to the height of an external page. I have found some google code that does what I need but it is way bloated. Anyone how to do what this code does but with less bloat? Thanks in Advance!

JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
  1. (
  2. function(){
  3. var e=null,a=window,l="sitesearch",r=a.googleSearchResizeIframe||a.googleSearchPath&&a.googleSearchPath=="/cse"&&typeof a.googleSearchResizeIframe=="undefined",p,n,i;function s(c,b,j,m){
  4.  
  5. var f={},g=c.split(j);for(var d=0;d<g.length;d++){
  6. var h=g[d],o=h.indexOf(b);if(o>0){
  7. var k=h.substring(0,o);k=m?k.toUpperCase():k.toLowerCase();var u=h.substring(o+1,h.length);f[k]=u}}return f}function v(){
  8. var c=document.location.search;if(c.length<1)return"";c=c.substring(1,c.length);var b=s(c,"=","&",
  9.  
  10. false);if(a.googleSearchQueryString!="e"&&b[a.googleSearchQueryString]){
  11. b.q=b[a.googleSearchQueryString];delete b[a.googleSearchQueryString]}if(b.cof){
  12.  
  13. var j=s(decodeURIComponent(b.cof),"-",";",true),m=j.FORID;if(m)p=parseInt(m,10)}
  14. var f=document.getElementById(a.googleSearchFormName);
  15. if(f){if(f.q&&b.q&&(!b.ie||b.ie.toLowerCase()=="utf-8"))f.q.value=decodeURIComponent(b.q.replace(/\+/g," "));
  16. if(f[l])for(var g=0;g<f[l].length;g++)f[l][g].checked=b[l]==e&&f[l][g].value==""?true:f[l][g].value==b[l]?true:false}var d="";
  17.  
  18. for(var h in b)d+="&"+h+"="+b[h];return d.substring(1,d.length)}function q(c,b){return b?"&"+c+"="+encodeURIComponent(b):""}function t(c,b){return c?Math.max(c,b):b}function w(){
  19.  
  20. var c="http://";c+=a.googleSearchDomain?a.googleSearchDomain:"";c+=a.googleSearchPath?a.googleSearchPath:"";c+="?";
  21. if(a.googleSearchQueryString)a.googleSearchQueryString=a.googleSearchQueryString.toLowerCase();c+=v();c+=q("ad","w"+n);c+=q("num",i);c+="&submit=search";if(r){
  22.  
  23. var b= a.location.href,j=b.indexOf("#");if(j!=-1)b=b.substring(0,j);c+=q("rurl",b)}return c}function x(){
  24.  
  25. //n=a.googleSearchNumAds;n||(n=9);
  26. i=a.googleNumSearchResults;i=i?Math.min(i,20):10;
  27. var c={};c[5]=795;c[10]=795;c[11]=500;
  28. var b={};
  29.  
  30. b[5]=300+90*i;b[10]=300+50*Math.min(n,4)+90*i;b[11]=300+50*n+90*i;
  31. //b[5] = 390+90*i;
  32.  
  33. var j=w();if(!a.googleSearchFrameborder)a.googleSearchFrameborder="0";
  34. var m=document.getElementById(a.googleSearchIframeName);if(m&&c[p]){
  35. var f=t(a.googleSearchFrameWidth,c[p]),g=t(a.googleSearchFrameHeight,b[p]),
  36. d=document.createElement("iframe"),h={
  37.  
  38. name:"googleSearchFrame",src:j,frameBorder:a.googleSearchFrameborder,width:f,height:g,marginWidth:"0",marginHeight:"0",hspace:"0",vspace:"0",allowTransparency:"true",scrolling:"no"};for(var o in h)d.setAttribute(o,h[o]);m.appendChild(d);d.attachEvent?d.attachEvent("onload",
  39. function(){
  40. window.scrollTo(0,0)}):d.addEventListener("load",function(){
  41. window.scrollTo(0,0)},false);r&&a.setInterval(
  42. function(){
  43. if(a.location.hash&&a.location.hash!="#"){
  44. var k=a.location.hash.substring(1)+"px";
  45.  
  46. if(d.height!=k&&k!="0px")d.height=k}},10)}a.googleSearchIframeName=e;a.googleSearchFormName=e;a.googleSearchResizeIframe=e;a.googleSearchQueryString=e;a.googleSearchDomain=e;a.googleSearchPath=e;a.googleSearchFrameborder=e;a.googleSearchFrameWidth=e;a.googleSearchFrameHeight=e;a.googleNumSearchResults=e;a.googleAdtest=e}x()
  47. })();
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the JavaScript / DHTML / AJAX Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC