Advertisement
Guest User

Untitled

a guest
Nov 26th, 2014
779
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function checkSocialAuthStatus() {
  2.     if (!(do_submit | 0) || !((surveyObj[0].flag | 0) & REQUIRE_FACEBOOK_AUTH || (surveyObj[0].flag | 0) & REQUIRE_TWITTER_AUTH == 0)) return true;
  3.     if ($.cookie('access_token') != null && $.cookie('access_token_secret') != null) return true;
  4.     if (socialAuthA.length) {
  5.         var i = socialAuthA.length;
  6.         while (i--) {
  7.             if (typeof socialAuthA[i] != 'undefined' && socialAuthA[i] != '') return true;
  8.         }
  9.     }
  10.     return false;
  11. }
  12.  
  13. function showSocialAuthDiv() {
  14.     if ($('#overlay').hasClass('socialAuthDiv')) return;
  15.     $('#overlay').addClass('socialAuthDiv').css('display', 'block').append($('#templates').find('.socialAuthLinksDiv').clone().click(function(e) {
  16.         e.stopPropagation();
  17.     }));
  18.     if (typeof surveyObj[0].customFields == 'string') {
  19.         try {
  20.             surveyObj[0].customFields = JSON.parse(surveyObj[0].customFields);
  21.         } catch (e) {
  22.             surveyObj[0].customFields = {};
  23.         }
  24.     }
  25.     $('#overlay').find('.saTitleSpan').text((typeof surveyObj[0].customFields.socialAuthPaneTitle == 'undefined') ? 'Authentication Required' : surveyObj[0].customFields.socialAuthPaneTitle.v);
  26.     $('#overlay').find('.socialAuthText').html((typeof surveyObj[0].customFields.socialAuthPaneDesc == 'undefined') ? 'This poll requires that you authenticate yourself before you can submit your response.<br /><br />Please authenticate yourself.' : surveyObj[0].customFields.socialAuthPaneDesc.v.replace(/\n/g, '<br />'));
  27.     $('#overlay').find('.facebookAuthButton').css('display', ((surveyObj[0].flag | 0) & REQUIRE_FACEBOOK_AUTH) ? 'block' : 'none').click(function(e) {
  28.         e.stopPropagation();
  29.         window.open('auth_facebook.php?k=' + surveyObj[0]['socialKeys'][0].replace(/\+/g, '.').replace(/\//g, '-').replace(/=/g, '_'), 'pinnionFacebookAuth_' + surveyId, 'dependent,width=400,height=300,location=yes');
  30.     });
  31.     $('#overlay').find('.twitterAuthButton').css('display', ((surveyObj[0].flag | 0) & REQUIRE_TWITTER_AUTH) ? 'block' : 'none').click(function(e) {
  32.         e.stopPropagation();
  33.         window.open('auth_twitter.php?auth=1&k=' + encodeURIComponent(surveyObj[0]['socialKeys'][1]), 'pinnionTwitterAuth_' + surveyId, 'dependent,width=800,height=605,location=yes');
  34.     });
  35.     $('#overlay, .socialAuthTitleCloseX').click(hideSocialAuthDiv);
  36.     if (!postMessageToHandle) postMessageToHandle = setTimeout(function() {
  37.         doPostMessage(['height_change'], qPos);
  38.     }, 750);
  39. }
  40.  
  41. function hideSocialAuthDiv(authType, encAuthTandS) {
  42.     $('#overlay').removeClass('socialAuthDiv').css('display', 'none').unbind('click').find('.socialAuthLinksDiv').remove();
  43.     if (typeof authType == 'number') {
  44.         socialAuthA[authType] = encAuthTandS;
  45.         if (saQueuedActionA != false) {
  46.             if (saQueuedActionA.action == 'click') saQueuedActionA.jqObj.click();
  47.             saQueuedActionA = false;
  48.         }
  49.     }
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement