Advertisement
Guest User

Untitled

a guest
Nov 14th, 2013
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. q={_callbacks:[],_opts:{autoResize:false,allowShrink:true,channelUrl:null,hideOverflow:false,resizeTimeout:1000,resizeWidth:false,expectResizeAck:false,resizeAckTimeout:6000},_lastResizeAckId:0,_resizeCount:0,_resizeTimestamp:0,_shrinker:null,init:function(s){this._opts=m(m({},this._opts),s);if(this._opts.autoResize)this._startResizeMonitor();g.subscribe('Connect.Unsafe.resize.ack',function(t,u){if(!u.id)u.id=this._resizeCount;if(u.id>this._lastResizeAckId)this._lastResizeAckId=u.id;}.bind(this));},send:function(s,t){t=t||this._opts.channelUrl;if(!t)return;var u={},v=new k(t);m(u,s);m(u,l.deserialize(v.getFragment()));var w=k(u.origin).getOrigin(),x=o(u.relation.replace(/^parent\./,'')),y=50,z=function(){var aa=x.frames[p];try{aa.proxyMessage(l.serialize(u),w);}catch(ba){if(--y){setTimeout(z,100);}else j.warn('No such frame "'+p+'" to proxyMessage to');}};z();},_computeSize:function(){var s=i.getDocumentDimensions(),t=0;if(this._opts.resizeWidth){var u=document.body;if(u.clientWidth<u.scrollWidth){t=s.width;}else{var v=u.childNodes;for(var w=0;w<v.length;w++){var x=v[w],y=x.offsetLeft+x.offsetWidth;if(y>t)t=y;}}t=Math.max(t,q.forced_min_width);}s.width=t;if(this._opts.allowShrink)
  2. {if(!this._shrinker)this._shrinker=h.create('div');h.appendContent(document.body,this._shrinker);s.height=Math.max(this._shrinker.offsetTop,0);}return s;},_startResizeMonitor:function(){var s,t=document.documentElement;if(this._opts.hideOverflow){t.style.overflow='hidden';document.body.style.overflow='hidden';}var u=(function(){var v=this._computeSize(),w=Date.now(),x=this._lastResizeAckId<this._resizeCount&&(w-this._resizeTimestamp)>this._opts.resizeAckTimeout;if(!s||(this._opts.expectResizeAck&&x)||(this._opts.allowShrink&&s.width!=v.width)||(!this._opts.allowShrink&&s.width<v.width)||(this._opts.allowShrink&&s.height!=v.height)||(!this._opts.allowShrink&&s.height<v.height)){s=v;this._resizeCount++;this._resizeTimestamp=w;var y={type:'resize',height:v.height,ackData:{id:this._resizeCount}};if(v.width&&v.width!=0)y.width=v.width;try{if(k(document.referrer).isFacebookURI()&&n()&&window.name&&window.parent.location&&window.parent.location.toString&&k(window.parent.location).isFacebookURI()){var aa=window.parent.document.getElementsByTagName('iframe');for(var ba=0;ba<aa.length;ba=ba+1)if(aa[ba].name==window.name){if(this._opts.resizeWidth)aa[ba].style.width=y.width+'px';aa[ba].style.height=y.height+'px';}}this.send(y);}catch(z){this.send(y);}}}).bind(this);u();setInterval(u,this._opts.resizeTimeout);}}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement