Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (function (k) {
- window.k = k;
- k.___doc = k.document;
- k.Exec = function () {
- args = arguments;
- var e = function () {}, t = function () {
- if (typeof args[0] === "function") {
- hasParameters = false;
- e = args[0];
- } else if (typeof args[1] === "function") {
- hasParameters = true;
- e = args[1]
- } else {
- e = undefined
- }
- }();
- if (e === undefined) return zkyFacebook.debug.log("Callback is undefined", 2);
- if (hasParameters) e(args[0]);
- else e();
- zkyFacebook.debug.log("Callback called - at: " + Date.now(), 2)
- };
- k.zkyFacebook = function () {
- return {
- Init: function () {
- k.appId = arguments[0] || "0", k.cURL = arguments[1] || "cH.html", k.rstatus = arguments[2] || true, k.bCookie = arguments[3] || true, k.bxfbml = arguments[4] || true;
- d = ___doc.createElement("div");
- d.id = "fb-root";
- ___doc.body.appendChild(d);
- k.fbAsyncInit = function () {
- FB.init({
- appId: appId,
- channelUrl: cURL,
- status: rstatus,
- cookie: bCookie,
- xfbml: bxfbml
- });
- zkyFacebook.debug.log("Facebook auth loaded", 2);
- (k.zkyLoad)?zkyLoad():null;
- };
- this.LoadSDK()
- },
- LoadSDK: function () {
- var e, t = "facebook-jssdk",
- n = ___doc.getElementsByTagName("script")[0];
- if (___doc.getElementById(t)) return;
- e = ___doc.createElement("script");
- e.id = t;
- e.async = true;
- e.src = "//connect.facebook.net/en_US/all.js";
- n.parentNode.insertBefore(e, n);
- zkyFacebook.debug.log("SDK loaded", 1)
- }
- }
- }();
- k.zkyFacebook.utils = function () {
- return {
- printf: function (e) {
- len = e.match(/%/gi);
- for (i = 0; i <= len.length; i++) e = e.replace(/%/, arguments[i + 1]);
- return e
- }
- }
- }();
- k.zkyFacebook.debug = function __this() {
- return {
- log: function () {
- t = arguments[1] || 0;
- mth = ["log", "info", "warn", "error"][t] || "log";
- eval(zkyFacebook.utils.printf("console.%('%');", mth, (new Date).getHours() + ":" + (new Date).getMinutes() + ":" + (new Date).getSeconds() + " - " + arguments[0]))
- }
- }
- }();
- k.zkyFacebook.me = function () {
- return {
- getLoginStatus: function () {
- FB.getLoginStatus(function (e) {
- if (e.status === "connected") {
- return false
- } else if (e.status === "not_authorized") {
- return true
- } else {
- return true
- }
- });
- zkyFacebook.debug.log("Getting login status", 1)
- },
- login: function () {
- if (this.getLoginStatus()) {
- FB.login(function (e) {
- if (e.authResponse) {
- Exec(arguments[0]);
- zkyFacebook.debug.log("User is authed with FB", 1)
- } else {
- zkyFacebook.debug.log("User cancelled logging", 1)
- }
- })
- } else {
- Exec(arguments[0]);
- zkyFacebook.debug.log("User is already authed with FB", 1)
- }
- }
- }
- }();
- k.zkyFacebook.me.user = function () {
- return {
- name:(function () {
- FB.api("/me", function (e) {
- for (var t in e) alert(e[t] + " = " + t);
- window.fbUserName = e.name;
- return e.name
- })
- })
- }
- }
- })(window);
- zkyFacebook.Init("164762683678240");
- k.zkyLoad = function (){
- zkyFacebook.me.login(zkyFacebook.me.user.name);
- alert("Loaded");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement