Skip to content

Instantly share code, notes, and snippets.

@readysetawesome
Forked from nerd0/gist:2176155
Created April 3, 2012 00:28
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 readysetawesome/2288256 to your computer and use it in GitHub Desktop.
Save readysetawesome/2288256 to your computer and use it in GitHub Desktop.
Invocation of Livefyre commenting and Livefyre Simple Profiles (bolt-on for existing init)
var engage = new fyre.sp.app.Engage({app: '{!! name of your engage app here !!}');
var profiles = new fyre.sp.app.Profile({});
var delegates = {
'handle_auth_login': function() {
engage.signIn();
},
'handle_auth_logout': function() {
engage.signOut();
},
'handle_edit_profile': function(user) {
profiles.editProfile();
},
'handle_view_profile': function(user) {
var id = user.jid.split('@')[0];
profiles.viewProfile(id);
},
'handle_email_notifications': function(user) {
}
};
fyre.sp.on('auth_logout_complete', function() {
LF.modules.Auth.logoutSuccess();
});
fyre.sp.on('profile_submit_complete', function(data) {
LF.Fyre.get('user').set({display_name: data.displayName});
});
fyre.sp.on('auth_login_complete', function(data) {
LF.ready(function() {
LF.login({
token: (data.token || data.accessCredentials[0].value),
profile: {display_name: data.displayName}
})
}
);
});
LF.ready(function() {
LF.Dispatcher.addListener(delegates);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment