Skip to content

Instantly share code, notes, and snippets.

@adamrights
Forked from Jamedjo/livefyre.js
Created May 29, 2014 04:12
Show Gist options
  • Save adamrights/0e57d609b7d4febe8256 to your computer and use it in GitHub Desktop.
Save adamrights/0e57d609b7d4febe8256 to your computer and use it in GitHub Desktop.
myapp.factory('Comments', function ($location) {
var isInitialized = false;
var comments = {};
var getConfig = function(){
var articleId = $location.path();
var defaults = {
articleId: articleId,
collectionMeta: {
articleId: articleId,
url: fyre.conv.load.makeCollectionUrl(null, [], true)
}
};
return defaults;
};
var swapConfig = function(settings_object){};
var init = function () {
isInitialized=true;
fyre.conv.load({
el: 'livefyre-comments',
network: "livefyre.com",
siteId: "123456",
signed: false
}, [getConfig()], function callback(widget) {
swapConfig = widget.changeCollection;
});
};
var swap = function(){
swapConfig(getConfig());
};
comments.run = function(){
if(isInitialized){
swap();
} else {
init();
}
}
return comments;
});
function AppController($scope, Comments) {
Comments.run();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment