/* FILE ARCHIVED ON 2:48:41 Dec 24, 2012 AND RETRIEVED FROM THE AN OPENWAYBACK INSTANCE ON 2:42:55 May 5, 2024. JAVASCRIPT APPENDED BY OPENWAYBACK, COPYRIGHT INTERNET ARCHIVE. ALL OTHER CONTENT MAY ALSO BE PROTECTED BY COPYRIGHT (17 U.S.C. SECTION 108(a)(3)). */ AA.Twitter = { _oauthWindow : null, _successCallback : null, _abortCallback: null, _twitterAccessUrl: null } AA.Twitter.Anywhere = {} AA.Twitter.Anywhere.twitterAccessUrl = function (redirectUrl, popupMode) { $.ajax({ beforeSend: function (xhr) { xhr.setRequestHeader("Connection", "close"); }, type: "POST", url: "/api/internal/pages/userservice.asmx/TwitterAccessUrl", data: "{'redirectUrl':'" + redirectUrl + "', 'popUpMode':" + popupMode + "}", contentType: "application/json; charset=utf-8", dataType: "json", success: function (data) { AA.Twitter._twitterAccessUrl = data; var twitter_btn = $("#twitterBtn"); if (twitter_btn.length > 0){ twitter_btn.attr('href', AA.Twitter._twitterAccessUrl); $("#UpdatingTagsProgressTwitter").hide(); twitter_btn.show(); } } }); } AA.Twitter.Anywhere.successCallback = function (user, bridge) { // check user id in the server side $.ajax({ beforeSend: function (xhr) { xhr.setRequestHeader("Connection", "close"); }, type: "POST", url: "/api/internal/pages/userservice.asmx/TwitterUserRegister", data: "{'twUserIdString':'" + user.id + "', 'bridgeToken':'" + bridge + "'}", contentType: "application/json; charset=utf-8", dataType: "json", success: function (data) { var d = eval("(" + data + ")"); // server side should have set the auth cookie //(close pop up if needed) change user name a signing siginInmode = $("#siginInmode"); var isDirectFromFBLink = siginInmode.length == 0; // this is a function build by the page and user controls (check .cs of MasterPage) //AdjustUIForSignedUser(d); //alert(d.registered + ", isDirectFromFBLink = " + isDirectFromFBLink); var shareOnTwitterElement = $("#CheckBoxShareOnTwitter"); if (shareOnTwitterElement != null) { var shareOnTwitter = shareOnTwitterElement.val(); var curr_date = new Date(); curr_date.setTime(curr_date.getTime() + 60000); AA.Utils.setCookie("TwitterShareCheck", shareOnTwitter, curr_date); } if (!d.registered) { // Show registretion popups //in flat signin page or in signin popup if (d.usedByOther) { // show error message //$("#usedByOtherError").show(); twttr.anywhere.signOut(); } else if (!isDirectFromFBLink) { var isFlatPage = siginInmode.length > 0 && siginInmode.val() == "Embedded"; //alert(d.popUpUrl + " , " + isFlatPage); if (isFlatPage) { var returnUrl = AA.Utils.getQueryVariable("ReturnUrl"); if (!returnUrl) { returnUrl = ""; } window.location = d.flatPageUrl + returnUrl; } else { window.location = d.popUpUrl; } } else { // popup mode var action = "window.location.reload();"; if (AA.Twitter.actionAfterSign != null) { action = AA.Twitter.actionAfterSign; action = action.replace(""", "\""); } //alert(action + ", " + d.popUpUrl); if (d.popUpUrl) { AA.SignPopUpControl.show(d.popUpUrl, action); } else { eval(action); } } //$.facebox(d.popUpHtml); //popup types // concent // -Action - GetForYeddaUserInformationFromFacebook // Topics // -Action - SetTopicsForCurrentUser } else if (!d.yeddaAuthenticated) { if (isDirectFromFBLink) { //alert("isDirectFromFBLink and window.location.reload();"); window.location.reload(); } else { //alert("not from isDirectFromFBLink and d.yeddaAuthenticated"); // in case we aree in the flat page should redirect to the return url var returnUrl = AA.Utils.getQueryVariable("ReturnUrl"); //alert("returnUrl = " + decodeURIComponent(returnUrl)); if (returnUrl) { window.location = decodeURIComponent(returnUrl); } else { window.location = "/"; } } } } }); } AA.Twitter.successCallback = function () { var shareOnTwitterElement = $("#CheckBoxShareOnTwitter"); if (shareOnTwitterElement != null) { var shareOnTwitter = shareOnTwitterElement.val(); var curr_date = new Date(); curr_date.setTime(curr_date.getTime() + 60000); AA.Utils.setCookie("Twitter ShareCheck", shareOnTwitter, curr_date); } var nextPath = AA.Utils.getCookie("ytru"); if (AA.SignPopUpControl._successHash == nextPath) { var newUrl = "blank.html" + AA.SignPopUpControl._successHash; window.location = newUrl; } else { window.location = nextPath; } } AA.Twitter.oauthpopupHandler = function () { var that = this; var hash = null; var protocol = null; var location = AA.Twitter._oauthWindow; if (AA.Twitter._oauthWindow.closed) { eval(AA.Twitter._abortCallback); return; } if (AA.Twitter._oauthWindow.location) { try { hash = AA.Twitter._oauthWindow.location.hash; protocol = AA.Twitter._oauthWindow.location.protocol; } catch (err) { var s = err; } if (hash == AA.SignPopUpControl._successHash || hash == AA.SignPopUpControl._closeHash) { AA.Twitter._oauthWindow.close(); if (hash == AA.SignPopUpControl._successHash) { eval(AA.Twitter._successCallback); } else { eval(AA.Twitter._abortCallback); } } else { that._oauthInterval = setTimeout("AA.Twitter.oauthpopupHandler()", 300); } } } AA.Twitter.oauthpopup = function (options) { options.windowName = options.windowName || 'ConnectWithOAuth'; // should not include space for IE options.windowOptions = options.windowOptions || 'location=0,status=0,width=800,height=400'; AA.Twitter._successCallback = options.successCallback; AA.Twitter._abortCallback = 'window.location.reload();'; var that = this; AA.Twitter._oauthWindow = window.open(options.path, options.windowName, options.windowOptions); that._oauthInterval = setTimeout("AA.Twitter.oauthpopupHandler()", 300); } AA.Facebook = { inPopUp : false, actionAfterSign : null } AA.Facebook.useAutoLogin = function(){ return document.cookie.indexOf("yauc=0") < 0; } AA.Facebook.ConcentToFacebook = function(callBack){ var concented = ($("#CheckBoxUseMyFacebook:checked").length > 0); if (concented){ $.ajax({ beforeSend: function(xhr) { xhr.setRequestHeader("Connection", "close"); }, type: "POST", url: "/api/internal/pages/userservice.asmx/ConcentToFacebookUser", data: "{}", contentType: "application/json; charset=utf-8", dataType: "json", success: function(data){ if (callBack){ eval(callBack); } } }); } } AA.Facebook.login = function (session) { var updatingTagsProgressFacebook = $("#UpdatingTagsProgressFacebook"); if (updatingTagsProgressFacebook != null) { updatingTagsProgressFacebook.show(); } // check user id in the server side //alert("Start Register"); $.ajax({ beforeSend: function (xhr) { xhr.setRequestHeader("Connection", "close"); }, type: "POST", url: "/api/internal/pages/userservice.asmx/FacebookUserRegister", data: "{'fbUserId':'" + session.userID + "', 'accessToken':'" + session.accessToken + "'}", contentType: "application/json; charset=utf-8", dataType: "json", success: function (data) { var d = eval("(" + data + ")"); // server side should have set the auth cookie //(close pop up if needed) change user name a signing siginInmode = $("#siginInmode"); var isDirectFromFBLink = siginInmode.length == 0; // this is a function build by the page and user controls (check .cs of MasterPage) //AdjustUIForSignedUser(d); //alert(d.registered + ", isDirectFromFBLink = " + isDirectFromFBLink); var shareOnFacebookElement = $("#CheckBoxShareOnFacebook"); if (shareOnFacebookElement != null) { var shareOnFacebook = shareOnFacebookElement.val(); var curr_date = new Date(); curr_date.setTime(curr_date.getTime() + 60000); AA.Utils.setCookie("FacebookShareCheck", shareOnFacebook, curr_date); } if (!d.registered) { // Show registretion popups //in flat signin page or in signin popup if (!isDirectFromFBLink) { var isFlatPage = siginInmode.length > 0 && siginInmode.val() == "Embedded"; if (isFlatPage) { window.location = d.flatPageUrl + window.location.search; } else { window.location = d.popUpUrl; } } else { // popup mode var action = "window.location.reload();"; if (AA.Facebook.actionAfterSign != null) { action = AA.Facebook.actionAfterSign; action = action.replace(""", "\""); } //alert(action + ", " + d.popUpUrl); AA.SignPopUpControl.show(d.popUpUrl, action); } //$.facebox(d.popUpHtml); //popup types // concent // -Action - GetForYeddaUserInformationFromFacebook // Topics // -Action - SetTopicsForCurrentUser } else if (!d.yeddaAuthenticated) { if (isDirectFromFBLink) { window.location.reload(); } else { // in case we aree in the flat page should redirect to the return url var returnUrl = AA.Utils.getQueryVariable("ReturnUrl"); if (returnUrl) { window.location = decodeURIComponent(returnUrl); } else { window.location = "/"; } } } var updatingTagsProgressFacebook = $("#UpdatingTagsProgressFacebook"); if (updatingTagsProgressFacebook != null) { AA.Facebook.HideProgress(); } } }); } AA.Facebook.HideProgress = function () { if ($('.fb_button_text').length > 0) { $('#UpdatingTagsProgressFacebook').hide(); } else { setTimeout("AA.Facebook.HideProgress()", 100); } } $(document).ready(function () { window.fbAsyncInit = function () { FB.init({ appId: '146919262012345', status: true, cookie: true, xfbml: true//, //channelUrl: window.location.protocol + "://" + window.location.host + '/channel.html' }); // fix facebook issue with opera (XD Proxy) if (window.opera) { FB.XD._transport = "postmessage"; FB.XD.PostMessage.init(); } FB.Event.subscribe('xfbml.render', function (response) { $('#SocialNetworksDiv').css("visibility", "hidden").slideDown("slow", function () { $(this).css("visibility", "visible").css("opacity", 0).animate({ opacity: 1.0 }) }); }); FB.Event.subscribe('edge.create', function (href, widget) { Yedda.Api.Internal.Tracking.OutgoingLinksTracker.Track(window.location.href, href, 'fblike'); if (typeof (_gaq) != 'undefined') { _gaq.push(['_trackEvent', 'fb:like', 'click']); } }); FB.Event.subscribe('auth.login', function (response) { if (response.status == "connected") { AA.Facebook.login(response.authResponse); } }); FB.getLoginStatus(function (response) { if (response.status == "connected") { var authenticated = AA.Utils.isAuthenticated(); var useAutoLogin = AA.Facebook.useAutoLogin(); if (($("#inPopUp").length == 0)) { if (!authenticated && useAutoLogin) { // logged in and connected user, someone you know AA.Facebook.login(response.authResponse); } else if (!useAutoLogin) { // set on click for the fb:connect... var element = $("#headerFBLogin"); element.click(function () { FB.getLoginStatus(function (response) { if (response.status == "connected") { AA.Facebook.login(response.authResponse); } }); }); var settingsElement = $("#settingsFBLogin"); if (settingsElement != null && settingsElement.length > 0) { settingsElement.click(function () { FB.getLoginStatus(function (response) { if (response.status == "connected") { AA.Facebook.login(response.authResponse); } }); }); } } } else if (!useAutoLogin) { // set on click for the fb:connect... var popupElement = $("#popupFBLogin"); popupElement.click(function () { FB.getLoginStatus(function (response) { if (response.status == "connected") { AA.Facebook.login(response.authResponse); } }); }); } } }); var updatingTagsProgressFacebook = $("#UpdatingTagsProgressFacebook"); if (updatingTagsProgressFacebook != null) { AA.Facebook.HideProgress(); } }; (function () { var e = document.createElement('script'); //e.async = true; e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js'; document.getElementById('fb-root').appendChild(e); } ()); });