Skip to content

Instantly share code, notes, and snippets.

@pabloroman
Created March 28, 2012 11:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pabloroman/2225579 to your computer and use it in GitHub Desktop.
Save pabloroman/2225579 to your computer and use it in GitHub Desktop.
TNW init_livefyre
init_livefyre: function() {
TNW.lf_custom_delegate = {
handle_auth_login: function(data) {
//if(typeof(LF.data.user) != 'undefined') {
on_login_open('login', 'refresh_livefyre');
//}
//return false;
},
handle_auth_logout: function(data) {
jQuery.get('/?logout&redirect_to='+encodeURI($_CONFIG['current_url']));
set_menu_logged_out();
},
handle_edit_profile: function() {
var profile_link = LF.Fyre.get("user").get("profile_url");
if (profile_link != "") {
window.open(profile_link +"edit/", "_blank");
}
},
handle_edit_notifications: function() {
var profile_link = LF.Fyre.get("user").get("profile_url");
if (profile_link != "") {
window.open(profile_link +"edit/", "_blank");
}
},
handle_conv: function(data) {
if (typeof data.comments != 'undefined') {
jQuery('.box .comments').html(data.comments);
}
},
handle_stream_ready: function() {
hrefParts = document.location.href.split('#');
if(hrefParts.length > 0 && hrefParts[1] == 'livefyre_auto_follow') {
LF.modules.Follow.send('follow');
//document.location.href= hrefParts[0];
}
}
};
if(typeof(LF) != 'undefined') {
var conv = LF($_CONFIG['lfconfig'], function() {
LF.Dispatcher.addListener(TNW.lf_custom_delegate);
if(TNW.user.id !== 0) {
LF.login({
token: TNW.user.livefyre_token,
profile: {
display_name: TNW.user.display_name
}
});
}
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment