Uncategorized

– Science & Technology News- Gujarat Samachar : World’s Leading Gujarati Newspaper

You are logged in as: ‘ + name + ‘

‘);

//$(‘

You are logged in as: ‘ + name + ‘

‘).prependTo($(‘#fb_reader_content’));

}

});

}

function fb_reader_bootstrap() {

// code for load user settings

var fb_reader_settings = getCookie(cookie_user_settings);

if (fb_reader_settings != 0) {// By default enable auto post

$(‘#gs_reader_status’).attr(‘checked’, true);

save_user_settings(‘gs_reader_status’);

}

// Append to the parent div

$(‘#loading_social_reader’).remove();

$(‘#fb_reader_content’).appendTo($(‘#fb_reader_container’));

// Changes to FB reader strip

//alert(check_fb_login_status());

if (check_fb_login_status()) {

// If posted to FB

if (!check_cookie_if_already_posted(fb_content_type, fb_identifier)) {

setTimeout(function() {fb_reader_post_data();}, 1000);

}

fb_reader_bootstrap_init();

} else {

fb_reader_enable_onload_popup();

}

//$(‘#fb_reader_content’).show(‘slow’);

}

function fb_reader_bootstrap_init() {

// Changes to FB reader strip

//alert(“Out from the function=> “+check_fb_login_status());

var check_status = check_fb_login_status();

//alert(“out of if=> “+check_status);

if (check_fb_login_status()) {

//alert(“in the if=> “+check_fb_login_status());

get_list_articles();

fb_reader_display_profile_data();

$(‘#activity’).show(‘slows’);

$(‘#fb_btn_login’).css(‘display’,’none’);

$(‘#fb_btn_loggedin’).show(‘slows’);

$(‘#fb_btn_loggedout’).show(‘slows’);

$(‘.fb_reader_get_started’).css(‘display’,’none’);

$(‘.fb_reader_login_text’).css(‘display’,’none’);

//enable the delete button

if (!check_cookie_if_fb_content_deleted(fb_identifier)) {

$(‘#fb_btn_remove’).show(‘slow’);

$(‘#fb_btn_login’).css(‘display’,’none’);

}

}

}

function fb_reader_save_fb_content_id(identifier, fb_content_id) {

var json_data = getCookie(cookie_user_posted);

if(!json_data) {

var fb_content_array = new Object();

fb_content_array[identifier.toString()] = fb_content_id;

} else {

var fb_content_array = JSON.parse(json_data);

fb_content_array[identifier.toString()] = fb_content_id;

}

var json_text = JSON.stringify(fb_content_array);

setCookie(cookie_user_posted, json_text, cookie_user_history_expiry_min, cookie_user_history_expiry_hour, cookie_user_history_expiry_days, cookie_path, cookie_domain, false);

}

function fb_reader_remove_fb_content(identifier) {

var json_text = getCookie(cookie_user_posted);

if (json_text) {

var decoded_data = JSON.parse(json_text);

var ids_val = decoded_data[identifier.toString()];

if (ids_val) {

FB.api(‘/’ + ids_val, ‘delete’, function(response) {

if (!response || response.error) {

} else {

delete decoded_data[identifier.toString()];

var json_val = JSON.stringify(decoded_data);

setCookie(cookie_user_posted, json_val, cookie_user_history_expiry_min, cookie_user_history_expiry_hour, cookie_user_history_expiry_days, cookie_path, cookie_domain, false);

$(‘#fb_btn_remove’).hide(‘slow’);

fb_reader_display_message(‘2’);

get_list_articles();

$(‘#fb_btn_login’).show(‘slow’);

}

});

}

}

}

function check_cookie_if_fb_content_deleted(identifier) {

var json_text = getCookie(cookie_user_posted);

if (json_text) {

var decoded_data = JSON.parse(json_text);

var ids_val = decoded_data[identifier.toString()];

if (ids_val) {

return false;

}

}

return true;

}

function fb_reader_display_message(code) {

var message = ”;

var class_name = ‘fb_reader_msg_green’;

switch (code) {

case ‘1’:

if(fb_content_type == ‘article’) {

//message = ‘The article has been posted on your Facebook timeline’;

message=”The article has been posted on your Facebook timeline – Undo”;

} else if (fb_content_type == ‘video’) {

message = ‘The video has been posted on your Facebook timeline’;

} else if (fb_content_type == ‘photo’) {

message = ‘The photo has been posted on your Facebook timeline’;

}

break;

case ‘2’:

if(fb_content_type == ‘article’) {

message = ‘The article has been removed from your Facebook timeline’;

} else if (fb_content_type == ‘video’) {

message = ‘The video has been removed from your Facebook timeline’;

} else if (fb_content_type == ‘photo’) {

message = ‘The album has been removed from your Facebook timeline’;

}

class_name = ‘fb_reader_msg_red’;

break;

case ‘3’:

if(fb_content_type == ‘article’) {

message = ‘Please activate your Facebook Timeline to share this article’;

} else if (fb_content_type == ‘video’) {

message = ‘Please activate your Facebook Timeline to share this video’;

} else if (fb_content_type == ‘photo’) {

message = ‘Please activate your Facebook Timeline to share this album’;

}

class_name = ‘fb_reader_msg_orange’;

break;

default:

message = ‘There is some problem, please try after some time’;

break;

}

$(‘#fb_reader_dynamic_msg’).html(‘

‘ + message + ‘

‘);

//$(‘

‘ + message + ‘

‘).prependTo($(‘#fb_reader_content’));

setTimeout(function() {

$(“#fb_reader_message_box”).remove();

fb_reader_display_profile_data();

}, 5000);

}

function fb_reader_enable_onload_popup() {

var user_cancelled_popup = getCookie(cookie_user_cancelled);

if (user_cancelled_popup != 1) {

fb_reader_cancelled();

fb_reader_info_popup();

}

}

(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);

}());

}