Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function checkSocialAuthStatus() {
- if (!(do_submit | 0) || !((surveyObj[0].flag | 0) & REQUIRE_FACEBOOK_AUTH || (surveyObj[0].flag | 0) & REQUIRE_TWITTER_AUTH == 0)) return true;
- if ($.cookie('access_token') != null && $.cookie('access_token_secret') != null) return true;
- if (socialAuthA.length) {
- var i = socialAuthA.length;
- while (i--) {
- if (typeof socialAuthA[i] != 'undefined' && socialAuthA[i] != '') return true;
- }
- }
- return false;
- }
- function showSocialAuthDiv() {
- if ($('#overlay').hasClass('socialAuthDiv')) return;
- $('#overlay').addClass('socialAuthDiv').css('display', 'block').append($('#templates').find('.socialAuthLinksDiv').clone().click(function(e) {
- e.stopPropagation();
- }));
- if (typeof surveyObj[0].customFields == 'string') {
- try {
- surveyObj[0].customFields = JSON.parse(surveyObj[0].customFields);
- } catch (e) {
- surveyObj[0].customFields = {};
- }
- }
- $('#overlay').find('.saTitleSpan').text((typeof surveyObj[0].customFields.socialAuthPaneTitle == 'undefined') ? 'Authentication Required' : surveyObj[0].customFields.socialAuthPaneTitle.v);
- $('#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 />'));
- $('#overlay').find('.facebookAuthButton').css('display', ((surveyObj[0].flag | 0) & REQUIRE_FACEBOOK_AUTH) ? 'block' : 'none').click(function(e) {
- e.stopPropagation();
- 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');
- });
- $('#overlay').find('.twitterAuthButton').css('display', ((surveyObj[0].flag | 0) & REQUIRE_TWITTER_AUTH) ? 'block' : 'none').click(function(e) {
- e.stopPropagation();
- window.open('auth_twitter.php?auth=1&k=' + encodeURIComponent(surveyObj[0]['socialKeys'][1]), 'pinnionTwitterAuth_' + surveyId, 'dependent,width=800,height=605,location=yes');
- });
- $('#overlay, .socialAuthTitleCloseX').click(hideSocialAuthDiv);
- if (!postMessageToHandle) postMessageToHandle = setTimeout(function() {
- doPostMessage(['height_change'], qPos);
- }, 750);
- }
- function hideSocialAuthDiv(authType, encAuthTandS) {
- $('#overlay').removeClass('socialAuthDiv').css('display', 'none').unbind('click').find('.socialAuthLinksDiv').remove();
- if (typeof authType == 'number') {
- socialAuthA[authType] = encAuthTandS;
- if (saQueuedActionA != false) {
- if (saQueuedActionA.action == 'click') saQueuedActionA.jqObj.click();
- saQueuedActionA = false;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement