- if (!window.FB)window.FB = {_apiKey:null,_session:null,_userStatus:'unknown',_logging:true,_inCanvas:((window.location.search.indexOf('fb_sig_in_iframe=1') > -1) || (window.location.search.indexOf('session=') > -1) || (window.location.search.indexOf('signed_request=') > -1)),_https:(window.name.indexOf('_fb_https') > -1),_domain:{api:'https://api.facebook.com/',api_read:'https://api-read.facebook.com/',cdn:'http://static.ak.fbcdn.net/',https_cdn:'https://s-static.ak.fbcdn.net/',graph:'https://graph.facebook.com/',staticfb:'http://static.ak.facebook.com/',https_staticfb:'https://s-static.ak.facebook.com/',www:window.location.protocol + '//www.facebook.com/',https_www:'https://www.facebook.com/'},_locale:null,_localeIsRtl:false,getDomain:function(a) {
- switch (a) {case 'api':return FB._domain.api;case 'api_read':return FB._domain.api_read;case 'cdn':return (window.location.protocol == 'https:' || FB._https) ? FB._domain.https_cdn : FB._domain.cdn;case 'graph':return FB._domain.graph;case 'staticfb':return FB._https ? FB._domain.https_staticfb : FB._domain.staticfb;case 'https_staticfb':return FB._domain.https_staticfb;case 'www':return FB._https ? FB._domain.https_www : FB._domain.www;case 'https_www':return FB._domain.https_www;
- }
- },copy:function(d, c, b, e) {
- for (var a in c)if (b || typeof d[a] === 'undefined')d[a] = e ? e(c[a]) : c[a];
- return d;
- },create:function(c, h) {
- var e = window.FB,d = c ? c.split('.') : [],a = d.length;
- for (var b = 0; b < a; b++) {
- var g = d[b];
- var f = e[g];
- if (!f) {
- f = (h && b + 1 == a) ? h : {};
- e[g] = f;
- }
- e = f;
- }
- return e;
- },provide:function(c, b, a) {
- return FB.copy(typeof c == 'string' ? FB.create(c) : c, b, a);
- },guid:function() {
- return 'f' + (Math.random() * (1 << 30)).toString(16).replace('.', '');
- },log:function(a) {
- if (FB._logging)if (window.Debug && window.Debug.writeln) {
- window.Debug.writeln(a);
- } else if (window.console)window.console.log(a);
- if (FB.Event)FB.Event.fire('fb.log', a);
- },$:function(a) {
- return document.getElementById(a);
- }};
- FB.provide('Array', {indexOf:function(a, c) {
- if (a.indexOf)return a.indexOf(c);
- var d = a.length;
- if (d)for (var b = 0; b < d; b++)if (a[b] === c)return b;
- return -1;
- },merge:function(c, b) {
- for (var a = 0; a < b.length; a++)if (FB.Array.indexOf(c, b[a]) < 0)c.push(b[a]);
- return c;
- },filter:function(a, c) {
- var b = [];
- for (var d = 0; d < a.length; d++)if (c(a[d]))b.push(a[d]);
- return b;
- },keys:function(c, d) {
- var a = [];
- for (var b in c)if (d || c.hasOwnProperty(b))a.push(b);
- return a;
- },map:function(a, d) {
- var c = [];
- for (var b = 0; b < a.length; b++)c.push(d(a[b]));
- return c;
- },forEach:function(c, a, f) {
- if (!c)return;
- if (Object.prototype.toString.apply(c) === '[object Array]' || (!(c instanceof Function) && typeof c.length == 'number')) {
- if (c.forEach) {
- c.forEach(a);
- } else for (var b = 0,e = c.length; b < e; b++)a(c[b], b, c);
- } else for (var d in c)if (f || c.hasOwnProperty(d))a(c[d], d, c);
- }});
- FB.provide('QS', {encode:function(c, d, a) {
- d = d === undefined ? '&' : d;
- a = a === false ? function(e) {
- return e;
- } : encodeURIComponent;
- var b = [];
- FB.Array.forEach(c, function(f, e) {
- if (f !== null && typeof f != 'undefined')b.push(a(e) + '=' + a(f));
- });
- b.sort();
- return b.join(d);
- },decode:function(f) {
- var a = decodeURIComponent,d = {},e = f.split('&'),b,c;
- for (b = 0; b < e.length; b++) {
- c = e[b].split('=', 2);
- if (c && c[0])d[a(c[0])] = a(c[1] || '');
- }
- return d;
- }});
- FB.provide('Content', {_root:null,_hiddenRoot:null,_callbacks:{},append:function(a, c) {
- if (!c)if (!FB.Content._root) {
- FB.Content._root = c = FB.$('fb-root');
- if (!c) {
- FB.log('The "fb-root" div has not been created.');
- return;
- } else c.className += ' fb_reset';
- } else c = FB.Content._root;
- if (typeof a == 'string') {
- var b = document.createElement('div');
- c.appendChild(b).innerHTML = a;
- return b;
- } else return c.appendChild(a);
- },appendHidden:function(a) {
- if (!FB.Content._hiddenRoot) {
- var b = document.createElement('div'),c = b.style;
- c.position = 'absolute';
- c.top = '-10000px';
- c.width = c.height = 0;
- FB.Content._hiddenRoot = FB.Content.append(b);
- }
- return FB.Content.append(a, FB.Content._hiddenRoot);
- },insertIframe:function(e) {
- e.id = e.id || FB.guid();
- e.name = e.name || FB.guid();
- var a = FB.guid(),f = false,d = false;
- FB.Content._callbacks[a] = function() {
- if (f && !d) {
- d = true;
- e.onload && e.onload(e.root.firstChild);
- }
- };
- if (document.attachEvent) {
- var b = ('<iframe' + ' id="' + e.id + '"' + ' name="' + e.name + '"' + (e.title ? ' title="' + e.title + '"' : '') + (e.className ? ' class="' + e.className + '"' : '') + ' style="border:none;' + (e.width ? 'width:' + e.width + 'px;' : '') + (e.height ? 'height:' + e.height + 'px;' : '') + '"' + ' src="' + e.url + '"' + ' frameborder="0"' + ' scrolling="no"' + ' allowtransparency="true"' + ' onload="FB.Content._callbacks.' + a + '()"' + '></iframe>');
- e.root.innerHTML = '<iframe src="javascript:false"' + ' frameborder="0"' + ' scrolling="no"' + ' style="height:1px"></iframe>';
- f = true;
- window.setTimeout(function() {
- e.root.innerHTML = b;
- }, 0);
- } else {
- var c = document.createElement('iframe');
- c.id = e.id;
- c.name = e.name;
- c.onload = FB.Content._callbacks[a];
- c.scrolling = 'no';
- c.style.border = 'none';
- c.style.overflow = 'hidden';
- if (e.title)c.title = e.title;
- if (e.className)c.className = e.className;
- if (e.height)c.style.height = e.height + 'px';
- if (e.width)c.style.width = e.width + 'px';
- e.root.appendChild(c);
- f = true;
- c.src = e.url;
- }
- },postTarget:function(b) {
- var a = document.createElement('form');
- a.action = b.url;
- a.target = b.target;
- a.method = 'POST';
- FB.Content.appendHidden(a);
- FB.Array.forEach(b.params, function(e, d) {
- if (e !== null && e !== undefined) {
- var c = document.createElement('input');
- c.name = d;
- c.value = e;
- a.appendChild(c);
- }
- });
- a.submit();
- a.parentNode.removeChild(a);
- }});
- FB.provide('Flash', {_minVersions:[
- [9,0,159,0],
- [10,0,22,87]
- ],_swfPath:'swf/XdComm.swf',_callbacks:[],init:function() {
- if (FB.Flash._init)return;
- FB.Flash._init = true;
- window.FB_OnFlashXdCommReady = function() {
- FB.Flash._ready = true;
- for (var d = 0,e = FB.Flash._callbacks.length; d < e; d++)FB.Flash._callbacks[d]();
- FB.Flash._callbacks = [];
- };
- var a = !!document.attachEvent,c = FB.getDomain('cdn') + FB.Flash._swfPath,b = ('<object ' + 'type="application/x-shockwave-flash" ' + 'id="XdComm" ' + (a ? 'name="XdComm" ' : '') + (a ? '' : 'data="' + c + '" ') + (a ? 'classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" ' : '') + 'allowscriptaccess="always">' + '<param name="movie" value="' + c + '"></param>' + '<param name="allowscriptaccess" value="always"></param>' + '</object>');
- FB.Content.appendHidden(b);
- },hasMinVersion:function() {
- if (typeof FB.Flash._hasMinVersion === 'undefined') {
- var i,a,b,h = [];
- try {
- i = new ActiveXObject('ShockwaveFlash.ShockwaveFlash').GetVariable('$version');
- } catch(j) {
- if (navigator.mimeTypes.length > 0) {
- var mimeType = 'application/x-shockwave-flash';
- if (navigator.mimeTypes[mimeType].enabledPlugin) {
- var name = 'Shockwave Flash';
- i = (navigator.plugins[name + ' 2.0'] || navigator.plugins[name]).description;
- }
- }
- }
- if (i) {
- var f = i.replace(/\D+/g, ',').match(/^,?(.+),?$/)[1].split(',');
- for (a = 0,b = f.length; a < b; a++)h.push(parseInt(f[a], 10));
- }
- FB.Flash._hasMinVersion = false;
- majorVersion:for (a = 0,b = FB.Flash._minVersions.length; a < b; a++) {
- var g = FB.Flash._minVersions[a];
- if (g[0] != h[0])continue;
- for (var c = 1,d = g.length,e = h.length; (c < d && c < e); c++)if (h[c] < g[c]) {
- FB.Flash._hasMinVersion = false;
- continue majorVersion;
- } else {
- FB.Flash._hasMinVersion = true;
- if (h[c] > g[c])break majorVersion;
- }
- }
- ;
- }
- return FB.Flash._hasMinVersion;
- },onReady:function(a) {
- FB.Flash.init();
- if (FB.Flash._ready) {
- window.setTimeout(a, 0);
- } else FB.Flash._callbacks.push(a);
- }});
- if (!this.JSON)this.JSON = {};
- (function() {
- function f(n) {
- return n < 10 ? '0' + n : n;
- }
- if (typeof Date.prototype.toJSON !== 'function') {
- Date.prototype.toJSON = function(key) {
- return isFinite(this.valueOf()) ? this.getUTCFullYear() + '-' + f(this.getUTCMonth() + 1) + '-' + f(this.getUTCDate()) + 'T' + f(this.getUTCHours()) + ':' + f(this.getUTCMinutes()) + ':' + f(this.getUTCSeconds()) + 'Z' : null;
- };
- String.prototype.toJSON = Number.prototype.toJSON = Boolean.prototype.toJSON = function(key) {
- return this.valueOf();
- };
- }
- var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta = {'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','"':'\\"','\\':'\\\\'},rep;
- function quote(string) {
- escapable.lastIndex = 0;
- return escapable.test(string) ? '"' + string.replace(escapable, function(a) {
- var c = meta[a];
- return typeof c === 'string' ? c : '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
- }) + '"' : '"' + string + '"';
- }
- function str(key, holder) {
- var i,k,v,length,mind = gap,partial,value = holder[key];
- if (value && typeof value === 'object' && typeof value.toJSON === 'function')value = value.toJSON(key);
- if (typeof rep === 'function')value = rep.call(holder, key, value);
- switch (typeof value) {case 'string':return quote(value);case 'number':return isFinite(value) ? String(value) : 'null';case 'boolean':case 'null':return String(value);case 'object':if (!value)return 'null';gap += indent;partial = [];if (Object.prototype.toString.apply(value) === '[object Array]') {
- length = value.length;
- for (i = 0; i < length; i += 1)partial[i] = str(i, value) || 'null';
- v = partial.length === 0 ? '[]' : gap ? '[\n' + gap + partial.join(',\n' + gap) + '\n' + mind + ']' : '[' + partial.join(',') + ']';
- gap = mind;
- return v;
- }if (rep && typeof rep === 'object') {
- length = rep.length;
- for (i = 0; i < length; i += 1) {
- k = rep[i];
- if (typeof k === 'string') {
- v = str(k, value);
- if (v)partial.push(quote(k) + (gap ? ': ' : ':') + v);
- }
- }
- } else for (k in value)if (Object.hasOwnProperty.call(value, k)) {
- v = str(k, value);
- if (v)partial.push(quote(k) + (gap ? ': ' : ':') + v);
- }v = partial.length === 0 ? '{}' : gap ? '{\n' + gap + partial.join(',\n' + gap) + '\n' + mind + '}' : '{' + partial.join(',') + '}';gap = mind;return v;
- }
- }
- if (typeof JSON.stringify !== 'function')JSON.stringify = function(value, replacer, space) {
- var i;
- gap = '';
- indent = '';
- if (typeof space === 'number') {
- for (i = 0; i < space; i += 1)indent += ' ';
- } else if (typeof space === 'string')indent = space;
- rep = replacer;
- if (replacer && typeof replacer !== 'function' && (typeof replacer !== 'object' || typeof replacer.length !== 'number'))throw new Error('JSON.stringify');
- return str('', {'':value});
- };
- if (typeof JSON.parse !== 'function')JSON.parse = function(text, reviver) {
- var j;
- function walk(holder, key) {
- var k,v,value = holder[key];
- if (value && typeof value === 'object')for (k in value)if (Object.hasOwnProperty.call(value, k)) {
- v = walk(value, k);
- if (v !== undefined) {
- value[k] = v;
- } else delete value[k];
- }
- return reviver.call(holder, key, value);
- }
- cx.lastIndex = 0;
- if (cx.test(text))text = text.replace(cx, function(a) {
- return '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
- });
- if (/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@').replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']').replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
- j = eval('(' + text + ')');
- return typeof reviver === 'function' ? walk({'':j}, '') : j;
- }
- throw new SyntaxError('JSON.parse');
- };
- }());
- FB.provide('JSON', {stringify:function(a) {
- if (window.Prototype && Object.toJSON) {
- return Object.toJSON(a);
- } else return JSON.stringify(a);
- },parse:function(a) {
- return JSON.parse(a);
- },flatten:function(c) {
- var a = {};
- for (var b in c)if (c.hasOwnProperty(b)) {
- var d = c[b];
- if (null === d || undefined === d) {
- continue;
- } else if (typeof d == 'string') {
- a[b] = d;
- } else a[b] = FB.JSON.stringify(d);
- }
- return a;
- }});
- FB.provide('', {api:function() {
- if (typeof arguments[0] === 'string') {
- FB.ApiServer.graph.apply(FB.ApiServer, arguments);
- } else FB.ApiServer.rest.apply(FB.ApiServer, arguments);
- }});
- FB.provide('ApiServer', {METHODS:['get','post','delete','put'],_callbacks:{},_readOnlyCalls:{fql_query:true,fql_multiquery:true,friends_get:true,notifications_get:true,stream_get:true,users_getinfo:true},graph:function() {
- var a = Array.prototype.slice.call(arguments),f = a.shift(),d = a.shift(),c,e,b;
- while (d) {
- var g = typeof d;
- if (g === 'string' && !c) {
- c = d.toLowerCase();
- } else if (g === 'function' && !b) {
- b = d;
- } else if (g === 'object' && !e) {
- e = d;
- } else {
- FB.log('Invalid argument passed to FB.api(): ' + d);
- return;
- }
- d = a.shift();
- }
- c = c || 'get';
- e = e || {};
- if (f[0] === '/')f = f.substr(1);
- if (FB.Array.indexOf(FB.ApiServer.METHODS, c) < 0) {
- FB.log('Invalid method passed to FB.api(): ' + c);
- return;
- }
- FB.ApiServer.oauthRequest('graph', f, c, e, b);
- },rest:function(e, a) {
- var c = e.method.toLowerCase().replace('.', '_');
- if (FB.Auth && c === 'auth_revokeauthorization') {
- var d = a;
- a = function(f) {
- if (f === true)FB.Auth.setSession(null, 'notConnected');
- d && d(f);
- };
- }
- e.format = 'json-strings';
- e.api_key = FB._apiKey;
- var b = FB.ApiServer._readOnlyCalls[c] ? 'api_read' : 'api';
- FB.ApiServer.oauthRequest(b, 'restserver.php', 'get', e, a);
- },oauthRequest:function(b, f, c, e, a) {
- if (FB._session && FB._session.access_token && !e.access_token)e.access_token = FB._session.access_token;
- e.sdk = 'joey';
- e.pretty = 0;
- var d = a;
- a = function(h) {
- if (FB.Auth && h && FB._session && FB._session.access_token == e.access_token && (h.error_code === '190' || (h.error && (h.error === 'invalid_token' || h.error.type === 'OAuthException'))))FB.getLoginStatus(null, true);
- d && d(h);
- };
- try {
- FB.ApiServer.jsonp(b, f, c, FB.JSON.flatten(e), a);
- } catch(g) {
- if (FB.Flash.hasMinVersion()) {
- FB.ApiServer.flash(b, f, c, FB.JSON.flatten(e), a);
- } else throw new Error('Flash is required for this API call.');
- }
- },jsonp:function(b, f, d, e, a) {
- var c = FB.guid(),g = document.createElement('script');
- if (b === 'graph' && d !== 'get')e.method = d;
- e.callback = 'FB.ApiServer._callbacks.' + c;
- var h = (FB.getDomain(b) + f + (f.indexOf('?') > -1 ? '&' : '?') + FB.QS.encode(e));
- if (h.length > 2000)throw new Error('JSONP only support a maximum of 2000 bytes of input.');
- FB.ApiServer._callbacks[c] = function(i) {
- a && a(i);
- delete FB.ApiServer._callbacks[c];
- g.parentNode.removeChild(g);
- };
- g.src = h;
- document.getElementsByTagName('head')[0].appendChild(g);
- },flash:function(b, e, c, d, a) {
- if (!window.FB_OnXdHttpResult)window.FB_OnXdHttpResult = function(g, f) {
- FB.ApiServer._callbacks[g](decodeURIComponent(f));
- };
- FB.Flash.onReady(function() {
- var h = FB.getDomain(b) + e,f = FB.QS.encode(d);
- if (c === 'get') {
- if (h.length + f.length > 2000) {
- if (b === 'graph')d.method = 'get';
- c = 'post';
- f = FB.QS.encode(d);
- } else {
- h += (h.indexOf('?') > -1 ? '&' : '?') + f;
- f = '';
- }
- } else if (c !== 'post') {
- if (b === 'graph')d.method = c;
- c = 'post';
- f = FB.QS.encode(d);
- }
- var g = document.XdComm.sendXdHttpRequest(c.toUpperCase(), h, f, null);
- FB.ApiServer._callbacks[g] = function(i) {
- a && a(FB.JSON.parse(i));
- delete FB.ApiServer._callbacks[g];
- };
- });
- }});
- FB.provide('EventProvider', {subscribers:function() {
- if (!this._subscribersMap)this._subscribersMap = {};
- return this._subscribersMap;
- },subscribe:function(b, a) {
- var c = this.subscribers();
- if (!c[b]) {
- c[b] = [a];
- } else c[b].push(a);
- },unsubscribe:function(b, a) {
- var c = this.subscribers()[b];
- FB.Array.forEach(c, function(e, d) {
- if (e == a)c[d] = null;
- });
- },monitor:function(d, a) {
- if (!a()) {
- var b = this,c = function() {
- if (a.apply(a, arguments))b.unsubscribe(d, c);
- };
- this.subscribe(d, c);
- }
- },clear:function(a) {
- delete this.subscribers()[a];
- },fire:function() {
- var a = Array.prototype.slice.call(arguments),b = a.shift();
- FB.Array.forEach(this.subscribers()[b], function(c) {
- if (c)c.apply(this, a);
- });
- }});
- FB.provide('Event', FB.EventProvider);
- FB.provide('Intl', {_punctCharClass:('[' + '.!?' + '\u3002' + '\uFF01' + '\uFF1F' + '\u0964' + '\u2026' + '\u0EAF' + '\u1801' + '\u0E2F' + '\uFF0E' + ']'),_endsInPunct:function(a) {
- if (typeof a != 'string')return false;
- return a.match(new RegExp(FB.Intl._punctCharClass + '[' + ')"' + "'" + '\u00BB' + '\u0F3B' + '\u0F3D' + '\u2019' + '\u201D' + '\u203A' + '\u3009' + '\u300B' + '\u300D' + '\u300F' + '\u3011' + '\u3015' + '\u3017' + '\u3019' + '\u301B' + '\u301E' + '\u301F' + '\uFD3F' + '\uFF07' + '\uFF09' + '\uFF3D' + '\s' + ']*$'));
- },_tx:function(d, a) {
- if (a !== undefined)if (typeof a != 'object') {
- FB.log('The second arg to FB.Intl._tx() must be an Object for ' + 'tx(' + d + ', ...)');
- } else {
- var c;
- for (var b in a)if (a.hasOwnProperty(b)) {
- if (FB.Intl._endsInPunct(a[b])) {
- c = new RegExp('\{' + b + '\}' + FB.Intl._punctCharClass + '*', 'g');
- } else c = new RegExp('\{' + b + '\}', 'g');
- d = d.replace(c, a[b]);
- }
- }
- return d;
- },tx:function(b, a) {
- function c(e, d) {
- void(0);
- }
- if (!FB.Intl._stringTable)return null;
- return FBIntern.Intl._tx(FB.Intl._stringTable[b], a);
- }});
- FB.provide('String', {trim:function(a) {
- return a.replace(/^\s*|\s*$/g, '');
- },format:function(a) {
- if (!FB.String.format._formatRE)FB.String.format._formatRE = /(\{[^\}^\{]+\})/g;
- var b = arguments;
- return a.replace(FB.String.format._formatRE, function(e, d) {
- var c = parseInt(d.substr(1), 10),f = b[c + 1];
- if (f === null || f === undefined)return '';
- return f.toString();
- });
- },escapeHTML:function(b) {
- var a = document.createElement('div');
- a.appendChild(document.createTextNode(b));
- return a.innerHTML.replace(/"/g, '"').replace(/'/g, ''');
- },quote:function(c) {
- var a = /["\\\x00-\x1f\x7f-\x9f]/g,b = {'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','"':'\\"','\\':'\\\\'};
- return a.test(c) ? '"' + c.replace(a, function(d) {
- var e = b[d];
- if (e)return e;
- e = d.charCodeAt();
- return '\\u00' + Math.floor(e / 16).toString(16) + (e % 16).toString(16);
- }) + '"' : '"' + c + '"';
- }});
- FB.provide('Dom', {containsCss:function(c, a) {
- var b = ' ' + c.className + ' ';
- return b.indexOf(' ' + a + ' ') >= 0;
- },addCss:function(b, a) {
- if (!FB.Dom.containsCss(b, a))b.className = b.className + ' ' + a;
- },removeCss:function(b, a) {
- if (FB.Dom.containsCss(b, a)) {
- b.className = b.className.replace(a, '');
- FB.Dom.removeCss(b, a);
- }
- },getStyle:function(a, c) {
- var d = false,b = a.style;
- if (a.currentStyle) {
- FB.Array.forEach(c.match(/\-([a-z])/g), function(e) {
- c = c.replace(e, e.substr(1, 1).toUpperCase());
- });
- d = a.currentStyle[c];
- } else {
- FB.Array.forEach(c.match(/[A-Z]/g), function(e) {
- c = c.replace(e, '-' + e.toLowerCase());
- });
- if (window.getComputedStyle) {
- d = document.defaultView.getComputedStyle(a, null).getPropertyValue(c);
- if (c == 'background-position-y' || c == 'background-position-x')if (d == 'top' || d == 'left')d = '0px';
- }
- }
- if (c == 'opacity') {
- if (a.filters && a.filters.alpha)return d;
- return d * 100;
- }
- return d;
- },setStyle:function(a, c, d) {
- var b = a.style;
- if (c == 'opacity') {
- if (d >= 100)d = 99.999;
- if (d < 0)d = 0;
- b.opacity = d / 100;
- b.MozOpacity = d / 100;
- b.KhtmlOpacity = d / 100;
- if (a.filters)if (a.filters.alpha == undefined) {
- a.filter = "alpha(opacity=" + d + ")";
- } else a.filters.alpha.opacity = d;
- } else b[c] = d;
- },addScript:function(b) {
- var a = document.createElement('script');
- a.type = "text/javascript";
- a.src = b;
- return document.getElementsByTagName('head')[0].appendChild(a);
- },addCssRules:function(e, c) {
- if (!FB.Dom._cssRules)FB.Dom._cssRules = {};
- var a = true;
- FB.Array.forEach(c, function(f) {
- if (!(f in FB.Dom._cssRules)) {
- a = false;
- FB.Dom._cssRules[f] = true;
- }
- });
- if (a)return;
- if (FB.Dom.getBrowserType() != 'ie') {
- var d = document.createElement('style');
- d.type = 'text/css';
- d.textContent = e;
- document.getElementsByTagName('head')[0].appendChild(d);
- } else try {
- document.createStyleSheet().cssText = e;
- } catch(b) {
- if (document.styleSheets[0])document.styleSheets[0].cssText += e;
- }
- },getBrowserType:function() {
- if (!FB.Dom._browserType) {
- var d = window.navigator.userAgent.toLowerCase(),b = ['msie','firefox','safari','gecko'],c = ['ie','mozilla','safari','mozilla'];
- for (var a = 0; a < b.length; a++)if (d.indexOf(b[a]) >= 0) {
- FB.Dom._browserType = c[a];
- break;
- }
- }
- return FB.Dom._browserType;
- },getViewportInfo:function() {
- var a = (document.documentElement && document.compatMode == 'CSS1Compat') ? document.documentElement : document.body;
- return {scrollTop:a.scrollTop,scrollLeft:a.scrollLeft,width:self.innerWidth ? self.innerWidth : a.clientWidth,height:self.innerHeight ? self.innerHeight : a.clientHeight};
- },ready:function(a) {
- if (FB.Dom._isReady) {
- a();
- } else FB.Event.subscribe('dom.ready', a);
- }});
- (function() {
- function domReady() {
- FB.Dom._isReady = true;
- FB.Event.fire('dom.ready');
- FB.Event.clear('dom.ready');
- }
- if (FB.Dom._isReady || document.readyState == 'complete')return domReady();
- if (document.addEventListener) {
- document.addEventListener('DOMContentLoaded', domReady, false);
- } else if (document.attachEvent)document.attachEvent('onreadystatechange', domReady);
- if (FB.Dom.getBrowserType() == 'ie' && window === top)(function() {
- try {
- document.documentElement.doScroll('left');
- } catch(error) {
- setTimeout(arguments.callee, 0);
- return;
- }
- domReady();
- })();
- var oldonload = window.onload;
- window.onload = function() {
- domReady();
- if (oldonload)if (typeof oldonload == 'string') {
- eval(oldonload);
- } else oldonload();
- };
- })();
- FB.provide('Dialog', {_loaderEl:null,_stack:[],_active:null,_findRoot:function(a) {
- while (a) {
- if (FB.Dom.containsCss(a, 'fb_dialog'))return a;
- a = a.parentNode;
- }
- },_showLoader:function(a, c) {
- if (!FB.Dialog._loaderEl) {
- c = parseInt(c, 10);
- c = c ? c : 460;
- FB.Dialog._loaderEl = FB.Dialog._findRoot(FB.Dialog.create({content:('<div class="dialog_title">' + ' <a id="fb_dialog_loader_close">' + ' <div class="fb_dialog_close_icon"></div>' + ' </a>' + ' <span>Facebook</span>' + ' <div style="clear:both;"></div>' + '</div>' + '<div class="dialog_content"></div>' + '<div class="dialog_footer"></div>'),width:c}));
- }
- if (!a)a = function() {
- };
- var b = FB.$('fb_dialog_loader_close');
- FB.Dom.removeCss(b, 'fb_hidden');
- b.onclick = function() {
- FB.Dialog._hideLoader();
- a();
- };
- FB.Dialog._makeActive(FB.Dialog._loaderEl);
- },_hideLoader:function() {
- if (FB.Dialog._loaderEl && FB.Dialog._loaderEl == FB.Dialog._active)FB.Dialog._loaderEl.style.top = '-10000px';
- },_makeActive:function(b) {
- FB.Dialog._lowerActive();
- var a = {width:parseInt(b.offsetWidth, 10),height:parseInt(b.offsetHeight, 10)},e = FB.Dom.getViewportInfo(),c = (e.scrollLeft + (e.width - a.width) / 2),d = (e.scrollTop + (e.height - a.height) / 2.5);
- b.style.left = (c > 0 ? c : 0) + 'px';
- b.style.top = (d > 0 ? d : 0) + 'px';
- FB.Dialog._active = b;
- },_lowerActive:function() {
- if (!FB.Dialog._active)return;
- FB.Dialog._active.style.top = '-10000px';
- FB.Dialog._active = null;
- },_removeStacked:function(a) {
- FB.Dialog._stack = FB.Array.filter(FB.Dialog._stack, function(b) {
- return b != a;
- });
- },create:function(e) {
- e = e || {};
- if (e.loader)FB.Dialog._showLoader(e.onClose, e.loaderWidth);
- var d = document.createElement('div'),c = document.createElement('div'),a = 'fb_dialog';
- if (e.closeIcon && e.onClose) {
- var b = document.createElement('a');
- b.className = 'fb_dialog_close_icon';
- b.onclick = e.onClose;
- d.appendChild(b);
- }
- if (FB.Dom.getBrowserType() == 'ie') {
- a += ' fb_dialog_legacy';
- FB.Array.forEach(['vert_left','vert_right','horiz_top','horiz_bottom','top_left','top_right','bottom_left','bottom_right'], function(g) {
- var h = document.createElement('span');
- h.className = 'fb_dialog_' + g;
- d.appendChild(h);
- });
- } else a += ' fb_dialog_advanced';
- if (e.content)FB.Content.append(e.content, c);
- d.className = a;
- var f = parseInt(e.width, 10);
- if (!isNaN(f))d.style.width = f + 'px';
- c.className = 'fb_dialog_content';
- d.appendChild(c);
- FB.Content.append(d);
- if (e.visible)FB.Dialog.show(d);
- return c;
- },show:function(a) {
- a = FB.Dialog._findRoot(a);
- if (a) {
- FB.Dialog._removeStacked(a);
- FB.Dialog._hideLoader();
- FB.Dialog._makeActive(a);
- FB.Dialog._stack.push(a);
- }
- },remove:function(a) {
- a = FB.Dialog._findRoot(a);
- if (a) {
- var b = FB.Dialog._active == a;
- FB.Dialog._removeStacked(a);
- FB.Dialog._hideLoader();
- if (b)if (FB.Dialog._stack.length > 0) {
- FB.Dialog.show(FB.Dialog._stack.pop());
- } else FB.Dialog._lowerActive();
- window.setTimeout(function() {
- a.parentNode.removeChild(a);
- }, 3000);
- }
- }});
- FB.provide('XD', {_origin:null,_transport:null,_callbacks:{},_forever:{},init:function(a) {
- if (FB.XD._origin)return;
- if (window.addEventListener && !window.attachEvent && window.postMessage) {
- FB.XD._origin = (window.location.protocol + '//' + window.location.host + '/' + FB.guid());
- FB.XD.PostMessage.init();
- FB.XD._transport = 'postmessage';
- } else if (!a && FB.Flash.hasMinVersion()) {
- FB.XD._origin = (window.location.protocol + '//' + document.domain + '/' + FB.guid());
- FB.XD.Flash.init();
- FB.XD._transport = 'flash';
- } else {
- FB.XD._transport = 'fragment';
- FB.XD.Fragment._channelUrl = a || window.location.toString();
- }
- },resolveRelation:function(b) {
- var g,d,f = b.split('.'),e = window;
- for (var a = 0,c = f.length; a < c; a++) {
- g = f[a];
- if (g === 'opener' || g === 'parent' || g === 'top') {
- e = e[g];
- } else if (d = /^frames\[['"]?([a-zA-Z0-9-_]+)['"]?\]$/.exec(g)) {
- e = e.frames[d[1]];
- } else throw new SyntaxError('Malformed id to resolve: ' + b + ', pt: ' + g);
- }
- return e;
- },handler:function(a, e, b) {
- if (window.location.toString().indexOf(FB.XD.Fragment._magic) > 0)return 'javascript:false;//';
- var f = FB.getDomain('cdn') + 'connect/xd_proxy.php#',c = FB.guid();
- if (FB.XD._transport == 'fragment') {
- f = FB.XD.Fragment._channelUrl;
- var d = f.indexOf('#');
- if (d > 0)f = f.substr(0, d);
- f += ((f.indexOf('?') < 0 ? '?' : '&') + FB.XD.Fragment._magic + '#?=&');
- }
- if (b)FB.XD._forever[c] = true;
- FB.XD._callbacks[c] = a;
- return f + FB.QS.encode({cb:c,origin:FB.XD._origin,relation:e || 'opener',transport:FB.XD._transport});
- },recv:function(b) {
- if (typeof b == 'string')b = FB.QS.decode(b);
- var a = FB.XD._callbacks[b.cb];
- if (!FB.XD._forever[b.cb])delete FB.XD._callbacks[b.cb];
- a && a(b);
- },PostMessage:{init:function() {
- var a = FB.XD.PostMessage.onMessage;
- window.addEventListener ? window.addEventListener('message', a, false) : window.attachEvent('onmessage', a);
- },onMessage:function(event) {
- FB.XD.recv(event.data);
- }},Flash:{init:function() {
- FB.Flash.onReady(function() {
- document.XdComm.postMessage_init('FB.XD.Flash.onMessage', FB.XD._origin);
- });
- },onMessage:function(a) {
- FB.XD.recv(decodeURIComponent(a));
- }},Fragment:{_magic:'fb_xd_fragment',checkAndDispatch:function() {
- var b = window.location.toString(),a = b.substr(b.indexOf('#') + 1),c = b.indexOf(FB.XD.Fragment._magic);
- if (c > 0) {
- FB.init = FB.getLoginStatus = FB.api = function() {
- };
- document.documentElement.style.display = 'none';
- FB.XD.resolveRelation(FB.QS.decode(a).relation).FB.XD.recv(a);
- }
- }}});
- FB.XD.Fragment.checkAndDispatch();
- FB.provide('Arbiter', {inform:function(c, e, f, b) {
- if (window.name.indexOf('app_runner_') === 0) {
- var d = FB.JSON.stringify({method:c,params:e});
- if (window.postMessage) {
- FB.XD.resolveRelation(f || 'parent').postMessage(d, '*');
- return;
- } else try {
- window.opener.postMessage(d);
- return;
- } catch(a) {
- }
- }
- var h = (FB.getDomain((b ? 'https_' : '') + 'staticfb') + 'connect/canvas_proxy.php#' + FB.QS.encode({method:c,params:FB.JSON.stringify(e || {}),relation:f}));
- var g = FB.Content.appendHidden('');
- FB.Content.insertIframe({url:h,root:g,width:1,height:1,onload:function() {
- setTimeout(function() {
- g.parentNode.removeChild(g);
- }, 10);
- }});
- }});
- FB.provide('', {ui:function(e, b) {
- if (!e.method) {
- FB.log('"method" is a required parameter for FB.ui().');
- return;
- }
- var a = FB.UIServer.prepareCall(e, b);
- if (!a)return;
- var d = a.params.display;
- if (d == 'dialog')d = 'iframe';
- var c = FB.UIServer[d];
- if (!c) {
- FB.log('"display" must be one of "popup", "iframe" or "hidden".');
- return;
- }
- c(a);
- }});
- FB.provide('UIServer', {Methods:{},_active:{},_defaultCb:{},_resultToken:'"xxRESULTTOKENxx"',genericTransform:function(a) {
- if (a.params.display == 'dialog' || a.params.display == 'iframe') {
- a.params.display = 'iframe';
- a.params.channel = FB.UIServer._xdChannelHandler(a.id, 'parent.parent');
- }
- return a;
- },prepareCall:function(h, b) {
- var g = h.method.toLowerCase(),f = FB.UIServer.Methods[g] || {size:{width:575,height:240}},e = FB.guid(),d = FB._https || (g !== 'auth.status');
- FB.copy(h, {api_key:FB._apiKey,app_id:FB._apiKey,locale:FB._locale,sdk:'joey',access_token:d && FB._session && FB._session.access_token || undefined});
- h.display = FB.UIServer.getDisplayMode(f, h);
- if (!f.url) {
- f.url = 'dialog/' + g;
- delete h.method;
- }
- var a = {cb:b,id:e,size:f.size || {},url:FB.getDomain(d ? 'https_www' : 'www') + f.url,params:h};
- var j = f.transform ? f.transform : FB.UIServer.genericTransform;
- if (j) {
- a = j(a);
- if (!a)return;
- }
- var i = FB.UIServer.getXdRelation(a.params.display);
- if (!(a.id in FB.UIServer._defaultCb) && !('next' in a.params))a.params.next = FB.UIServer._xdResult(a.cb, a.id, i, true);
- if (i === 'parent')a.params.channel_url = FB.UIServer._xdChannelHandler(e, 'parent.parent');
- a.params = FB.JSON.flatten(a.params);
- var c = FB.QS.encode(a.params);
- if ((a.url + c).length > 2000) {
- a.post = true;
- } else if (c)a.url += '?' + c;
- return a;
- },getDisplayMode:function(a, b) {
- if (b.display === 'hidden')return 'hidden';
- if (window.name.indexOf('app_runner_') === 0)return 'async';
- if (!FB._session && b.display == 'dialog' && !a.loggedOutIframe) {
- FB.log('"dialog" mode can only be used when the user is connected.');
- return 'popup';
- }
- return b.display || (FB._session ? 'dialog' : 'popup');
- },getXdRelation:function(a) {
- if (a === 'popup')return 'opener';
- if (a === 'dialog' || a === 'iframe')return 'parent';
- if (a === 'async')return 'parent.frames[' + window.name + ']';
- },popup:function(b) {
- var a = typeof window.screenX != 'undefined' ? window.screenX : window.screenLeft,i = typeof window.screenY != 'undefined' ? window.screenY : window.screenTop,g = typeof window.outerWidth != 'undefined' ? window.outerWidth : document.documentElement.clientWidth,f = typeof window.outerHeight != 'undefined' ? window.outerHeight : (document.documentElement.clientHeight - 22),k = b.size.width,d = b.size.height,h = (a < 0) ? window.screen.width + a : a,e = parseInt(h + ((g - k) / 2), 10),j = parseInt(i + ((f - d) / 2.5), 10),c = ('width=' + k + ',height=' + d + ',left=' + e + ',top=' + j + ',scrollbars=1');
- if (b.params.method == 'permissions.request')c += ',location=1,toolbar=0';
- if (b.post) {
- FB.UIServer._active[b.id] = window.open('about:blank', b.id, c);
- FB.Content.postTarget({url:b.url,target:b.id,params:b.params});
- } else FB.UIServer._active[b.id] = window.open(b.url, b.id, c);
- if (b.id in FB.UIServer._defaultCb)FB.UIServer._popupMonitor();
- },hidden:function(a) {
- a.className = 'FB_UI_Hidden';
- a.root = FB.Content.appendHidden('');
- FB.UIServer._insertIframe(a);
- },iframe:function(a) {
- a.className = 'FB_UI_Dialog';
- a.root = FB.Dialog.create({onClose:function() {
- FB.UIServer._triggerDefault(a.id);
- },loader:true,loaderWidth:a.size.width,closeIcon:true});
- FB.Dom.addCss(a.root, 'fb_dialog_iframe');
- FB.UIServer._insertIframe(a);
- },async:function(a) {
- a.frame = window.name;
- delete a.url;
- delete a.size;
- FB.Arbiter.inform('showDialog', a);
- },_insertIframe:function(b) {
- FB.UIServer._active[b.id] = false;
- var a = function(c) {
- if (b.id in FB.UIServer._active)FB.UIServer._active[b.id] = c;
- };
- if (b.post) {
- FB.Content.insertIframe({url:'about:blank',root:b.root,className:b.className,width:b.size.width,height:b.size.height,onload:function(c) {
- a(c);
- FB.Content.postTarget({url:b.url,target:c.name,params:b.params});
- }});
- } else FB.Content.insertIframe({url:b.url,root:b.root,className:b.className,width:b.size.width,height:b.size.height,onload:a});
- },_triggerDefault:function(a) {
- FB.UIServer._xdRecv({frame:a}, FB.UIServer._defaultCb[a] || function() {
- });
- },_popupMonitor:function() {
- var a;
- for (var b in FB.UIServer._active)if (FB.UIServer._active.hasOwnProperty(b) && b in FB.UIServer._defaultCb) {
- var c = FB.UIServer._active[b];
- try {
- if (c.tagName)continue;
- } catch(d) {
- }
- try {
- if (c.closed) {
- FB.UIServer._triggerDefault(b);
- } else a = true;
- } catch(e) {
- }
- }
- if (a && !FB.UIServer._popupInterval) {
- FB.UIServer._popupInterval = window.setInterval(FB.UIServer._popupMonitor, 100);
- } else if (!a && FB.UIServer._popupInterval) {
- window.clearInterval(FB.UIServer._popupInterval);
- FB.UIServer._popupInterval = null;
- }
- },_xdChannelHandler:function(a, b) {
- return FB.XD.handler(function(c) {
- var d = FB.UIServer._active[a];
- if (!d)return;
- if (c.type == 'resize') {
- if (c.height)d.style.height = c.height + 'px';
- if (c.width)d.style.width = c.width + 'px';
- FB.Arbiter.inform('resize.ack', {}, 'parent.frames[' + d.name + ']', true);
- FB.Dialog.show(d);
- }
- }, b, true);
- },_xdNextHandler:function(a, b, d, c) {
- if (c)FB.UIServer._defaultCb[b] = a;
- return FB.XD.handler(function(e) {
- FB.UIServer._xdRecv(e, a);
- }, d) + '&frame=' + b;
- },_xdRecv:function(b, a) {
- var c = FB.UIServer._active[b.frame];
- try {
- if (FB.Dom.containsCss(c, 'FB_UI_Hidden')) {
- window.setTimeout(function() {
- c.parentNode.parentNode.removeChild(c.parentNode);
- }, 3000);
- } else if (FB.Dom.containsCss(c, 'FB_UI_Dialog'))FB.Dialog.remove(c);
- } catch(d) {
- }
- try {
- if (c.close) {
- c.close();
- FB.UIServer._popupCount--;
- }
- } catch(e) {
- }
- delete FB.UIServer._active[b.frame];
- delete FB.UIServer._defaultCb[b.frame];
- a(b);
- },_xdResult:function(a, b, d, c) {
- return (FB.UIServer._xdNextHandler(function(e) {
- a && a(e.result && e.result != FB.UIServer._resultToken && FB.JSON.parse(e.result));
- }, b, d, c) + '&result=' + encodeURIComponent(FB.UIServer._resultToken));
- }});
- FB.provide('', {getLoginStatus:function(a, b) {
- if (!FB._apiKey) {
- FB.log('FB.getLoginStatus() called before calling FB.init().');
- return;
- }
- if (a)if (!b && FB.Auth._loadState == 'loaded') {
- a({status:FB._userStatus,session:FB._session});
- return;
- } else FB.Event.subscribe('FB.loginStatus', a);
- if (!b && FB.Auth._loadState == 'loading')return;
- FB.Auth._loadState = 'loading';
- var c = function(d) {
- FB.Auth._loadState = 'loaded';
- FB.Event.fire('FB.loginStatus', d);
- FB.Event.clear('FB.loginStatus');
- };
- FB.ui({method:'auth.status',display:'hidden'}, c);
- },getSession:function() {
- return FB._session;
- },login:function(a, b) {
- FB.ui(FB.copy({method:'permissions.request',display:'popup'}, b || {}), a);
- },logout:function(a) {
- FB.ui({method:'auth.logout',display:'hidden'}, a);
- }});
- FB.provide('Auth', {_callbacks:[],setSession:function(e, g) {
- var b = !FB._session && e,c = FB._session && !e,a = FB._session && e && FB._session.uid != e.uid,f = b || c || (FB._session && e && FB._session.access_token != e.access_token),h = g != FB._userStatus;
- var d = {session:e,status:g};
- FB._session = e;
- FB._userStatus = g;
- if (f && FB.Cookie && FB.Cookie.getEnabled())FB.Cookie.set(e);
- if (h)FB.Event.fire('auth.statusChange', d);
- if (c || a)FB.Event.fire('auth.logout', d);
- if (b || a)FB.Event.fire('auth.login', d);
- if (f)FB.Event.fire('auth.sessionChange', d);
- if (FB.Auth._refreshTimer) {
- window.clearTimeout(FB.Auth._refreshTimer);
- delete FB.Auth._refreshTimer;
- }
- if (FB.Auth._loadState && e && e.expires)FB.Auth._refreshTimer = window.setTimeout(function() {
- FB.getLoginStatus(null, true);
- }, 1200000);
- return d;
- },xdHandler:function(a, b, f, c, e, d) {
- return FB.UIServer._xdNextHandler(FB.Auth.xdResponseWrapper(a, e, d), b, f, c);
- },xdResponseWrapper:function(a, c, b) {
- return function(d) {
- try {
- b = FB.JSON.parse(d.session);
- } catch(f) {
- }
- if (b)c = 'connected';
- if (d.fb_https && !FB._https)FB._https = true;
- var e = FB.Auth.setSession(b || null, c);
- e.perms = d && d.perms || null;
- a && a(e);
- };
- }});
- FB.provide('UIServer.Methods', {'permissions.request':{size:{width:627,height:326},transform:function(a) {
- if (!FB._apiKey) {
- FB.log('FB.login() called before calling FB.init().');
- return;
- }
- if (FB._session && !a.params.perms) {
- FB.log('FB.login() called when user is already connected.');
- a.cb && a.cb({status:FB._userStatus,session:FB._session});
- return;
- }
- a = FB.UIServer.genericTransform(a);
- a.cb = FB.Auth.xdResponseWrapper(a.cb, FB._userStatus, FB._session);
- a.params.method = 'permissions.request';
- FB.copy(a.params, {fbconnect:FB._inCanvas ? 0 : 1,return_session:1,session_version:3});
- return a;
- }},'auth.logout':{url:'logout.php',transform:function(a) {
- if (!FB._apiKey) {
- FB.log('FB.logout() called before calling FB.init().');
- } else if (!FB._session) {
- FB.log('FB.logout() called without a session.');
- } else {
- a.params.next = FB.Auth.xdHandler(a.cb, a.id, 'parent', false, 'unknown');
- return a;
- }
- }},'auth.status':{url:'extern/login_status.php',transform:function(a) {
- var b = a.cb,c = a.id,d = FB.Auth.xdHandler;
- delete a.cb;
- FB.copy(a.params, {no_session:d(b, c, 'parent', false, 'notConnected'),no_user:d(b, c, 'parent', false, 'unknown'),ok_session:d(b, c, 'parent', false, 'connected'),session_version:3,extern:FB._inCanvas ? 0 : 2});
- return a;
- }}});
- FB.provide('Canvas', {_timer:null,_lastSize:{},setSize:function(b) {
- if (typeof b != "object")b = {};
- b = FB.copy(b || {}, FB.Canvas._computeContentSize());
- b = FB.copy(b, {frame:window.name || 'iframe_canvas'});
- if (FB.Canvas._lastSize[b.frame]) {
- var a = FB.Canvas._lastSize[b.frame].height;
- if (FB.Canvas._lastSize[b.frame].width == b.width && (b.height <= a && (a - b.height <= 16)))return false;
- }
- FB.Canvas._lastSize[b.frame] = b;
- FB.Arbiter.inform('setSize', b);
- return true;
- },setAutoResize:function(b, a) {
- if (a === undefined && typeof b == "number") {
- a = b;
- b = true;
- }
- if (b === undefined || b) {
- if (FB.Canvas._timer === null)FB.Canvas._timer = window.setInterval(FB.Canvas.setSize, a || 100);
- FB.Canvas.setSize();
- } else if (FB.Canvas._timer !== null) {
- window.clearInterval(FB.Canvas._timer);
- FB.Canvas._timer = null;
- }
- },_computeContentSize:function() {
- var a = document.body,c = document.documentElement,d = 0,b = Math.max(Math.max(a.offsetHeight, a.scrollHeight) + a.offsetTop, Math.max(c.offsetHeight, c.scrollHeight) + c.offsetTop);
- if (a.offsetWidth < a.scrollWidth) {
- d = a.scrollWidth + a.offsetLeft;
- } else FB.Array.forEach(a.childNodes, function(e) {
- var f = e.offsetWidth + e.offsetLeft;
- if (f > d)d = f;
- });
- if (c.clientLeft > 0)d += (c.clientLeft * 2);
- if (c.clientTop > 0)b += (c.clientTop * 2);
- return {height:b,width:d};
- }});
- FB.provide('UIServer.Methods', {'stream.share':{size:{width:575,height:380},url:'sharer.php',transform:function(a) {
- if (!a.params.u)a.params.u = window.location.toString();
- return a;
- }},'fbml.dialog':{size:{width:575,height:300},url:'render_fbml.php',loggedOutIframe:true,transform:function(a) {
- return a;
- }},'auth.logintofacebook':{size:{width:530,height:287},url:'login.php',transform:function(a) {
- a.params.skip_api_login = 1;
- var c = FB.UIServer.getXdRelation(a.params.display);
- var b = FB.UIServer._xdResult(a.cb, a.id, c, true);
- a.params.next = FB.getDomain(FB._https ? 'https_www' : 'www') + "login.php?" + FB.QS.encode({api_key:FB._apiKey,next:b,skip_api_login:1});
- return a;
- }}});
- FB.provide('', {share:function(a) {
- FB.log('FB.share() has been deprecated. Please use FB.ui() instead.');
- FB.ui({display:'popup',method:'stream.share',u:a});
- },publish:function(b, a) {
- FB.log('FB.publish() has been deprecated. Please use FB.ui() instead.');
- b = b || {};
- FB.ui(FB.copy({display:'popup',method:'stream.publish',preview:1}, b || {}), a);
- },addFriend:function(b, a) {
- FB.log('FB.addFriend() has been deprecated. Please use FB.ui() instead.');
- FB.ui({display:'popup',id:b,method:'friend.add'}, a);
- }});
- FB.UIServer.Methods['auth.login'] = FB.UIServer.Methods['permissions.request'];
- FB.provide('XFBML', {_renderTimeout:30000,parse:function(c, a) {
- c = c || document.body;
- var b = 1,d = function() {
- b--;
- if (b === 0) {
- a && a();
- FB.Event.fire('xfbml.render');
- }
- };
- FB.Array.forEach(FB.XFBML._tagInfos, function(f) {
- if (!f.xmlns)f.xmlns = 'fb';
- var g = FB.XFBML._getDomElements(c, f.xmlns, f.localName);
- for (var e = 0; e < g.length; e++) {
- b++;
- FB.XFBML._processElement(g[e], f, d);
- }
- });
- window.setTimeout(function() {
- if (b > 0)FB.log(b + ' XFBML tags failed to render in ' + FB.XFBML._renderTimeout + 'ms.');
- }, FB.XFBML._renderTimeout);
- d();
- },registerTag:function(a) {
- FB.XFBML._tagInfos.push(a);
- },_processElement:function(dom, tagInfo, cb) {
- var element = dom._element;
- if (element) {
- element.subscribe('render', cb);
- element.process();
- } else {
- var processor = function() {
- var fn = eval(tagInfo.className);
- var getBoolAttr = function(attr) {
- var attr = dom.getAttribute(attr);
- return (attr && FB.Array.indexOf(['true','1','yes','on'], attr.toLowerCase()) > -1);
- };
- var isLogin = false;
- var showFaces = true;
- var renderInIframe = false;
- if (tagInfo.className === 'FB.XFBML.LoginButton') {
- renderInIframe = getBoolAttr('render-in-iframe');
- showFaces = getBoolAttr('show-faces') || getBoolAttr('show_faces');
- isLogin = renderInIframe || showFaces;
- if (isLogin)fn = FB.XFBML.Login;
- }
- element = dom._element = new fn(dom);
- if (isLogin) {
- var extraParams = {show_faces:showFaces};
- var perms = dom.getAttribute('perms');
- if (perms)extraParams.perms = perms;
- element.setExtraParams(extraParams);
- }
- element.subscribe('render', cb);
- element.process();
- };
- if (FB.CLASSES[tagInfo.className.substr(3)]) {
- processor();
- } else FB.log('Tag ' + tagInfo.className + ' was not found.');
- }
- },_getDomElements:function(a, e, d) {
- var c = e + ':' + d;
- switch (FB.Dom.getBrowserType()) {case 'mozilla':return a.getElementsByTagNameNS(document.body.namespaceURI, c);case 'ie':try {
- var docNamespaces = document.namespaces;
- if (docNamespaces && docNamespaces[e]) {
- var nodes = a.getElementsByTagName(d);
- if (!document.addEventListener || nodes.length > 0)return nodes;
- }
- } catch(b) {
- }return a.getElementsByTagName(c);default:return a.getElementsByTagName(c);
- }
- },_tagInfos:[
- {localName:'activity',className:'FB.XFBML.Activity'},
- {localName:'add-profile-tab',className:'FB.XFBML.AddProfileTab'},
- {localName:'bookmark',className:'FB.XFBML.Bookmark'},
- {localName:'comments',className:'FB.XFBML.Comments'},
- {localName:'connect-bar',className:'FB.XFBML.ConnectBar'},
- {localName:'fan',className:'FB.XFBML.Fan'},
- {localName:'like',className:'FB.XFBML.Like'},
- {localName:'like-box',className:'FB.XFBML.LikeBox'},
- {localName:'live-stream',className:'FB.XFBML.LiveStream'},
- {localName:'login',className:'FB.XFBML.Login'},
- {localName:'login-button',className:'FB.XFBML.LoginButton'},
- {localName:'facepile',className:'FB.XFBML.Facepile'},
- {localName:'friendpile',className:'FB.XFBML.Friendpile'},
- {localName:'name',className:'FB.XFBML.Name'},
- {localName:'profile-pic',className:'FB.XFBML.ProfilePic'},
- {localName:'recommendations',className:'FB.XFBML.Recommendations'},
- {localName:'registration',className:'FB.XFBML.Registration'},
- {localName:'send',className:'FB.XFBML.Send'},
- {localName:'serverfbml',className:'FB.XFBML.ServerFbml'},
- {localName:'share-button',className:'FB.XFBML.ShareButton'},
- {localName:'social-bar',className:'FB.XFBML.SocialBar'}
- ]});
- (function() {
- try {
- if (document.namespaces && !document.namespaces.item.fb)document.namespaces.add('fb');
- } catch(a) {
- }
- }());
- FB.provide('XFBML', {set:function(b, c, a) {
- FB.log('FB.XFBML.set() has been deprecated.');
- b.innerHTML = c;
- FB.XFBML.parse(b, a);
- }});
- FB.provide('', {bind:function() {
- var a = Array.prototype.slice.call(arguments),c = a.shift(),b = a.shift();
- return function() {
- return c.apply(b, a.concat(Array.prototype.slice.call(arguments)));
- };
- },Class:function(b, a, d) {
- if (FB.CLASSES[b])return FB.CLASSES[b];
- var c = a || function() {
- };
- c.prototype = d;
- c.prototype.bind = function(e) {
- return FB.bind(e, this);
- };
- c.prototype.constructor = c;
- FB.create(b, c);
- FB.CLASSES[b] = c;
- return c;
- },subclass:function(d, b, c, e) {
- if (FB.CLASSES[d])return FB.CLASSES[d];
- var a = FB.create(b);
- FB.copy(e, a.prototype);
- e._base = a;
- e._callBase = function(g) {
- var f = Array.prototype.slice.call(arguments, 1);
- return a.prototype[g].apply(this, f);
- };
- return FB.Class(d, c ? c : function() {
- if (a.apply)a.apply(this, arguments);
- }, e);
- },CLASSES:{}});
- FB.provide('Type', {isType:function(a, b) {
- while (a)if (a.constructor === b || a === b) {
- return true;
- } else a = a._base;
- return false;
- }});
- FB.Class('Obj', null, FB.copy({setProperty:function(a, b) {
- if (FB.JSON.stringify(b) != FB.JSON.stringify(this[a])) {
- this[a] = b;
- this.fire(a, b);
- }
- }}, FB.EventProvider));
- FB.subclass('Waitable', 'Obj', function() {
- }, {set:function(a) {
- this.setProperty('value', a);
- },error:function(a) {
- this.fire("error", a);
- },wait:function(a, b) {
- if (b)this.subscribe('error', b);
- this.monitor('value', this.bind(function() {
- if (this.value !== undefined) {
- a(this.value);
- return true;
- }
- }));
- }});
- FB.subclass('Data.Query', 'Waitable', function() {
- if (!FB.Data.Query._c)FB.Data.Query._c = 1;
- this.name = 'v_' + FB.Data.Query._c++;
- }, {parse:function(a) {
- var b = FB.String.format.apply(null, a),d = (/^select (.*?) from (\w+)\s+where (.*)$/i).exec(b);
- this.fields = this._toFields(d[1]);
- this.table = d[2];
- this.where = this._parseWhere(d[3]);
- for (var c = 1; c < a.length; c++)if (FB.Type.isType(a[c], FB.Data.Query))a[c].hasDependency = true;
- return this;
- },toFql:function() {
- var a = 'select ' + this.fields.join(',') + ' from ' + this.table + ' where ';
- switch (this.where.type) {case 'unknown':a += this.where.value;break;case 'index':a += this.where.key + '=' + this._encode(this.where.value);break;case 'in':if (this.where.value.length == 1) {
- a += this.where.key + '=' + this._encode(this.where.value[0]);
- } else a += this.where.key + ' in (' + FB.Array.map(this.where.value, this._encode).join(',') + ')';break;
- }
- return a;
- },_encode:function(a) {
- return typeof(a) == 'string' ? FB.String.quote(a) : a;
- },toString:function() {
- return '#' + this.name;
- },_toFields:function(a) {
- return FB.Array.map(a.split(','), FB.String.trim);
- },_parseWhere:function(s) {
- var re = (/^\s*(\w+)\s*=\s*(.*)\s*$/i).exec(s),result,value,type = 'unknown';
- if (re) {
- value = re[2];
- if (/^(["'])(?:\\?.)*?\1$/.test(value)) {
- value = eval(value);
- type = 'index';
- } else if (/^\d+\.?\d*$/.test(value))type = 'index';
- }
- if (type == 'index') {
- result = {type:'index',key:re[1],value:value};
- } else result = {type:'unknown',value:s};
- return result;
- }});
- FB.provide('Data', {query:function(c, a) {
- var b = new FB.Data.Query().parse(arguments);
- FB.Data.queue.push(b);
- FB.Data._waitToProcess();
- return b;
- },waitOn:function(dependencies, callback) {
- var result = new FB.Waitable(),count = dependencies.length;
- if (typeof(callback) == 'string') {
- var s = callback;
- callback = function(args) {
- return eval(s);
- };
- }
- FB.Array.forEach(dependencies, function(item) {
- item.monitor('value', function() {
- var done = false;
- if (FB.Data._getValue(item) !== undefined) {
- count--;
- done = true;
- }
- if (count === 0) {
- var value = callback(FB.Array.map(dependencies, FB.Data._getValue));
- result.set(value !== undefined ? value : true);
- }
- return done;
- });
- });
- return result;
- },_getValue:function(a) {
- return FB.Type.isType(a, FB.Waitable) ? a.value : a;
- },_selectByIndex:function(a, d, b, e) {
- var c = new FB.Data.Query();
- c.fields = a;
- c.table = d;
- c.where = {type:'index',key:b,value:e};
- FB.Data.queue.push(c);
- FB.Data._waitToProcess();
- return c;
- },_waitToProcess:function() {
- if (FB.Data.timer < 0)FB.Data.timer = setTimeout(FB.Data._process, 10);
- },_process:function() {
- FB.Data.timer = -1;
- var c = {},e = FB.Data.queue;
- FB.Data.queue = [];
- for (var a = 0; a < e.length; a++) {
- var b = e[a];
- if (b.where.type == 'index' && !b.hasDependency) {
- FB.Data._mergeIndexQuery(b, c);
- } else c[b.name] = b;
- }
- var d = {method:'fql.multiquery',queries:{}};
- FB.copy(d.queries, c, true, function(f) {
- return f.toFql();
- });
- d.queries = FB.JSON.stringify(d.queries);
- FB.api(d, function(f) {
- if (f.error_msg) {
- FB.Array.forEach(c, function(g) {
- g.error(Error(f.error_msg));
- });
- } else FB.Array.forEach(f, function(g) {
- c[g.name].set(g.fql_result_set);
- });
- });
- },_mergeIndexQuery:function(a, d) {
- var b = a.where.key,f = a.where.value;
- var e = 'index_' + a.table + '_' + b;
- var c = d[e];
- if (!c) {
- c = d[e] = new FB.Data.Query();
- c.fields = [b];
- c.table = a.table;
- c.where = {type:'in',key:b,value:[]};
- }
- FB.Array.merge(c.fields, a.fields);
- FB.Array.merge(c.where.value, [f]);
- c.wait(function(g) {
- a.set(FB.Array.filter(g, function(h) {
- return h[b] == f;
- }));
- });
- },timer:-1,queue:[]});
- FB.provide('Cookie', {_domain:null,_enabled:false,setEnabled:function(a) {
- FB.Cookie._enabled = a;
- },getEnabled:function() {
- return FB.Cookie._enabled;
- },load:function() {
- var a = document.cookie.match('\\bfbs_' + FB._apiKey + '="([^;]*)\\b'),b;
- if (a) {
- b = FB.QS.decode(a[1]);
- b.expires = parseInt(b.expires, 10);
- FB.Cookie._domain = b.base_domain;
- }
- return b;
- },setRaw:function(c, b, a) {
- document.cookie = 'fbs_' + FB._apiKey + '="' + c + '"' + (c && b == 0 ? '' : '; expires=' + new Date(b * 1000).toGMTString()) + '; path=/' + (a ? '; domain=.' + a : '');
- FB.Cookie._domain = a;
- },set:function(a) {
- a ? FB.Cookie.setRaw(FB.QS.encode(a), a.expires, a.base_domain) : FB.Cookie.clear();
- },clear:function() {
- FB.Cookie.setRaw('', 0, FB.Cookie._domain);
- }});
- FB.provide('', {init:function(a) {
- a = FB.copy(a || {}, {logging:true,status:true});
- FB._apiKey = a.appId || a.apiKey;
- if (!a.logging && window.location.toString().indexOf('fb_debug=1') < 0)FB._logging = false;
- FB.XD.init(a.channelUrl);
- if (FB._apiKey) {
- FB.Cookie.setEnabled(a.cookie);
- a.session = a.session || FB.Cookie.load();
- FB.Auth.setSession(a.session, a.session ? 'connected' : 'unknown');
- if (a.status)FB.getLoginStatus();
- }
- if (a.xfbml)window.setTimeout(function() {
- if (FB.XFBML)FB.Dom.ready(FB.XFBML.parse);
- }, 0);
- }});
- window.setTimeout(function() {
- var a = /(connect.facebook.net|facebook.com\/assets.php).*?#(.*)/;
- FB.Array.forEach(document.getElementsByTagName('script'), function(d) {
- if (d.src) {
- var b = a.exec(d.src);
- if (b) {
- var c = FB.QS.decode(b[2]);
- FB.Array.forEach(c, function(f, e) {
- if (f == '0')c[e] = 0;
- });
- FB.init(c);
- }
- }
- });
- if (window.fbAsyncInit)fbAsyncInit();
- }, 0);
- FB.provide('UIServer.Methods', {'pay.prompt':{transform:function(a) {
- var b = FB.XD.handler(function(c) {
- a.cb(FB.JSON.parse(c.response));
- }, 'parent.frames[' + (window.name || 'iframe_canvas') + ']');
- a.params.channel = b;
- a.params.appId = FB._apiKey;
- FB.Arbiter.inform('Pay.Prompt', a.params);
- return false;
- }}});
- FB.Class('XFBML.Element', function(a) {
- this.dom = a;
- }, FB.copy({getAttribute:function(b, a, c) {
- var d = (this.dom.getAttribute(b) || this.dom.getAttribute(b.replace(/-/g, '_')) || this.dom.getAttribute(b.replace(/-/g, '')));
- return d ? (c ? c(d) : d) : a;
- },_getBoolAttribute:function(b, a) {
- return this.getAttribute(b, a, function(c) {
- c = c.toLowerCase();
- return c == 'true' || c == '1' || c == 'yes' || c == 'on';
- });
- },_getPxAttribute:function(b, a) {
- return this.getAttribute(b, a, function(c) {
- var d = parseInt(c.replace('px', ''), 10);
- if (isNaN(d)) {
- return a;
- } else return d;
- });
- },_getAttributeFromList:function(c, b, a) {
- return this.getAttribute(c, b, function(d) {
- d = d.toLowerCase();
- if (FB.Array.indexOf(a, d) > -1) {
- return d;
- } else return b;
- });
- },isValid:function() {
- for (var a = this.dom; a; a = a.parentNode)if (a == document.body)return true;
- },clear:function() {
- this.dom.innerHTML = '';
- }}, FB.EventProvider));
- FB.subclass('XFBML.IframeWidget', 'XFBML.Element', null, {_showLoader:true,_refreshOnAuthChange:false,_allowReProcess:false,_fetchPreCachedLoader:false,_visibleAfter:'load',getUrlBits:function() {
- throw new Error('Inheriting class needs to implement getUrlBits().');
- },setupAndValidate:function() {
- return true;
- },oneTimeSetup:function() {
- },getSize:function() {
- },getIframeName:function() {
- },getIframeTitle:function() {
- },getChannelUrl:function() {
- if (!this._channelUrl) {
- var a = this;
- this._channelUrl = FB.XD.handler(function(b) {
- a.fire('xd.' + b.type, b);
- }, 'parent.parent', true);
- }
- return this._channelUrl;
- },getIframeNode:function() {
- return this.dom.getElementsByTagName('iframe')[0];
- },process:function(a) {
- if (this._done) {
- if (!this._allowReProcess && !a)return;
- this.clear();
- } else this._oneTimeSetup();
- this._done = true;
- if (!this.setupAndValidate()) {
- this.fire('render');
- return;
- }
- if (this._showLoader)this._addLoader();
- FB.Dom.addCss(this.dom, 'fb_iframe_widget');
- if (this._visibleAfter != 'immediate') {
- FB.Dom.addCss(this.dom, 'fb_hide_iframes');
- } else this.subscribe('iframe.onload', FB.bind(this.fire, this, 'render'));
- var c = this.getSize() || {};
- var d = this._getURL();
- if (!this._fetchPreCachedLoader)d += '?' + FB.QS.encode(this._getQS());
- if (d.length > 2000) {
- d = 'about:blank';
- var b = FB.bind(function() {
- this._postRequest();
- this.unsubscribe('iframe.onload', b);
- }, this);
- this.subscribe('iframe.onload', b);
- }
- FB.Content.insertIframe({url:d,root:this.dom.appendChild(document.createElement('span')),name:this.getIframeName(),title:this.getIframeTitle(),className:FB._localeIsRtl ? 'fb_rtl' : 'fb_ltr',height:c.height,width:c.width,onload:FB.bind(this.fire, this, 'iframe.onload')});
- },_oneTimeSetup:function() {
- this.subscribe('xd.resize', FB.bind(this._handleResizeMsg, this));
- if (FB.getLoginStatus) {
- this.subscribe('xd.refreshLoginStatus', FB.bind(FB.getLoginStatus, FB, function() {
- }, true));
- this.subscribe('xd.logout', FB.bind(FB.logout, FB, function() {
- }));
- }
- if (this._refreshOnAuthChange)this._setupAuthRefresh();
- if (this._visibleAfter == 'load')this.subscribe('iframe.onload', FB.bind(this._makeVisible, this));
- this.oneTimeSetup();
- },_makeVisible:function() {
- this._removeLoader();
- FB.Dom.removeCss(this.dom, 'fb_hide_iframes');
- this.fire('render');
- },_setupAuthRefresh:function() {
- FB.getLoginStatus(FB.bind(function(b) {
- var a = b.status;
- FB.Event.subscribe('auth.statusChange', FB.bind(function(c) {
- if (!this.isValid())return;
- if (a == 'unknown' || c.status == 'unknown')this.process(true);
- a = c.status;
- }, this));
- }, this));
- },_handleResizeMsg:function(b) {
- if (!this.isValid())return;
- var a = this.getIframeNode();
- a.style.height = b.height + 'px';
- if (b.width)a.style.width = b.width + 'px';
- a.style.border = 'none';
- this._makeVisible();
- },_addLoader:function() {
- if (!this._loaderDiv) {
- FB.Dom.addCss(this.dom, 'fb_iframe_widget_loader');
- this._loaderDiv = document.createElement('div');
- this._loaderDiv.className = 'FB_Loader';
- this.dom.appendChild(this._loaderDiv);
- }
- },_removeLoader:function() {
- if (this._loaderDiv) {
- FB.Dom.removeCss(this.dom, 'fb_iframe_widget_loader');
- if (this._loaderDiv.parentNode)this._loaderDiv.parentNode.removeChild(this._loaderDiv);
- this._loaderDiv = null;
- }
- },_getQS:function() {
- return FB.copy({api_key:FB._apiKey,locale:FB._locale,sdk:'joey',session_key:FB._session && FB._session.session_key,ref:this.getAttribute('ref')}, this.getUrlBits().params);
- },_getURL:function() {
- var a = 'www',b = '';
- if (this._fetchPreCachedLoader) {
- a = 'cdn';
- b = 'static/';
- }
- return FB.getDomain(a) + 'plugins/' + b + this.getUrlBits().name + '.php';
- },_postRequest:function() {
- FB.Content.postTarget({url:this._getURL(),target:this.getIframeNode().name,params:this._getQS()});
- }});
- FB.subclass('XFBML.Activity', 'XFBML.IframeWidget', null, {_visibleAfter:'load',_refreshOnAuthChange:true,setupAndValidate:function() {
- this._attr = {border_color:this.getAttribute('border-color'),colorscheme:this.getAttribute('color-scheme'),filter:this.getAttribute('filter'),font:this.getAttribute('font'),header:this._getBoolAttribute('header'),height:this._getPxAttribute('height', 300),recommendations:this._getBoolAttribute('recommendations'),site:this.getAttribute('site', location.hostname),width:this._getPxAttribute('width', 300)};
- return true;
- },getSize:function() {
- return {width:this._attr.width,height:this._attr.height};
- },getUrlBits:function() {
- return {name:'activity',params:this._attr};
- }});
- FB.subclass('XFBML.ButtonElement', 'XFBML.Element', null, {_allowedSizes:['icon','small','medium','large','xlarge'],onClick:function() {
- throw new Error('Inheriting class needs to implement onClick().');
- },setupAndValidate:function() {
- return true;
- },getButtonMarkup:function() {
- return this.getOriginalHTML();
- },getOriginalHTML:function() {
- return this._originalHTML;
- },process:function() {
- if (!('_originalHTML' in this))this._originalHTML = FB.String.trim(this.dom.innerHTML);
- if (!this.setupAndValidate()) {
- this.fire('render');
- return;
- }
- var d = this._getAttributeFromList('size', 'medium', this._allowedSizes),a = '',b = '';
- if (d == 'icon') {
- a = 'fb_button_simple';
- } else {
- var c = FB._localeIsRtl ? '_rtl' : '';
- b = this.getButtonMarkup();
- a = 'fb_button' + c + ' fb_button_' + d + c;
- }
- this.dom.innerHTML = ('<a class="' + a + '">' + '<span class="fb_button_text">' + b + '</span>' + '</a>');