Stackedit/js/blogger-provider.js

34 lines
989 B
JavaScript
Raw Normal View History

2013-04-21 00:07:27 +00:00
define(["jquery", "core", "google-helper"], function($, core, googleHelper) {
2013-04-15 21:15:15 +00:00
var bloggerProvider = {
providerId: PROVIDER_BLOGGER,
providerName: "Blogger",
defaultPublishFormat: "html"
};
bloggerProvider.publish = function(publishAttributes, title, content, callback) {
googleHelper.uploadBlogger(publishAttributes.blogUrl,
publishAttributes.blogId, publishAttributes.postId, title, content,
2013-04-20 00:14:20 +00:00
function(error, blogId, postId) {
if(error) {
callback(error);
2013-04-15 21:15:15 +00:00
return;
}
publishAttributes.blogId = blogId;
publishAttributes.postId = postId;
callback();
});
};
bloggerProvider.newPublishAttributes = function(event) {
var publishAttributes = {};
publishAttributes.blogUrl = core.getInputValue($("#input-publish-blogger-url"), event);
2013-04-20 00:14:20 +00:00
publishAttributes.postId = $("#input-publish-blogger-postid").val() || undefined;
2013-04-15 21:15:15 +00:00
if(event.isPropagationStopped()) {
return undefined;
}
return publishAttributes;
};
return bloggerProvider;
});