与Facebook的Javascript-SDK工作(从服务器asyncronously加载)给出了奇效:如何防止Facebook的SDK(JavaScript)的右移动注销按钮左(“PluginResize”)
后通过SDK成功登录到FB,FB-Logout-Button从右向左移动并返回。
登录/注销按钮被声明为:
<fb:login-button size="large" autologoutlink="true" perms="email,user_birthday,status_update,publish_stream"></fb:login-button>
停止在Firebug的结果脚本称为M6XESwM2V2D.js和JavaScript的文件中,有下面的代码行:
__d("PluginResize",["Log","UnverifiedXD","bind","copyProperties","curry"],function(a,b,c,d,e,f){var g=b('Log'),h=b('UnverifiedXD'),i=b('bind'),j=b('copyProperties'),k=b('curry');function l(o){o=o||document.body;return o.offsetWidth+o.offsetLeft;}function m(o){o=o||document.body;return o.offsetHeight+o.offsetTop;}function n(o,p,event){this.calcWidth=o||l;this.calcHeight=p||m;this.width=undefined;this.height=undefined;this.event=event||'resize';}j(n.prototype,{resize:function(){var o=this.calcWidth(),p=this.calcHeight();if(o!==this.width||p!==this.height){g.debug('Resizing Plugin: (%s, %s, %s)',o,p,this.event);this.width=o;this.height=p;h.send({type:this.event,width:o,height:p});}return this;},auto:function(o){setInterval(i(this,this.resize),o||250);return this;}});n.auto=function(o,p,event){return new n(k(l,o),k(m,o),event).resize().auto(p);};e.exports=n;});
在javascript-debugger中停止代码时,按钮移动将停止(如预期的那样),然后继续执行代码。在上面打印的JavaScript代码中有一个对setInterval-Method的调用。所以,这可以解释这种行为。但为什么他们这样做?
我该如何阻止这种效应?
谢谢,它的作品! – itinance 2012-07-12 17:08:33