Added Blogger labels
This commit is contained in:
parent
d3f490f0a1
commit
003c082a73
@ -1 +1 @@
|
||||
CACHE MANIFEST
# v9
CACHE:
index.html
css/main-min.css
js/main-min.js
js/require.js
img/ajax-loader.gif
img/glyphicons-halflings.png
img/glyphicons-halflings-white.png
img/icons.png
img/stackedit-32.ico
img/stackedit-promo.png
NETWORK:
*
|
||||
CACHE MANIFEST
# v10
CACHE:
index.html
css/main-min.css
js/main-min.js
js/require.js
img/ajax-loader.gif
img/glyphicons-halflings.png
img/glyphicons-halflings-white.png
img/icons.png
img/stackedit-32.ico
img/stackedit-promo.png
NETWORK:
*
|
||||
|
@ -318,6 +318,13 @@
|
||||
placeholder="Post ID">
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group modal-publish-blogger">
|
||||
<label class="control-label" for="input-publish-blogger-labels">Labels (comma separated)</label>
|
||||
<div class="controls">
|
||||
<input type="text" id="input-publish-blogger-labels"
|
||||
placeholder="Label1, Label2">
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group modal-publish-dropbox">
|
||||
<label class="control-label" for="input-publish-dropbox-path">File
|
||||
path</label>
|
||||
|
@ -11,6 +11,7 @@ define(["jquery", "core", "google-helper"], function($, core, googleHelper) {
|
||||
publishAttributes.blogUrl,
|
||||
publishAttributes.blogId,
|
||||
publishAttributes.postId,
|
||||
publishAttributes.labelList,
|
||||
title,
|
||||
content,
|
||||
function(error, blogId, postId) {
|
||||
@ -27,8 +28,19 @@ define(["jquery", "core", "google-helper"], function($, core, googleHelper) {
|
||||
|
||||
bloggerProvider.newPublishAttributes = function(event) {
|
||||
var publishAttributes = {};
|
||||
publishAttributes.blogUrl = core.getInputValue($("#input-publish-blogger-url"), event);
|
||||
var blogUrl = core.getInputValue($("#input-publish-blogger-url"), event);
|
||||
if(blogUrl !== undefined) {
|
||||
publishAttributes.blogUrl = core.checkUrl(blogUrl);
|
||||
}
|
||||
publishAttributes.postId = $("#input-publish-blogger-postid").val() || undefined;
|
||||
publishAttributes.labelList = [];
|
||||
var labels = $("#input-publish-blogger-labels").val() || undefined;
|
||||
if(labels !== undefined) {
|
||||
publishAttributes.labelList = _.chain(labels.split(","))
|
||||
.map(function(label) {
|
||||
return core.trim(label);
|
||||
}).compact().value();
|
||||
}
|
||||
if(event.isPropagationStopped()) {
|
||||
return undefined;
|
||||
}
|
||||
|
22
js/core.js
22
js/core.js
@ -77,7 +77,7 @@ define(
|
||||
return undefined;
|
||||
}
|
||||
// trim
|
||||
value = value.replace(/^\s+|\s+$/g, '');
|
||||
value = core.trim(value);
|
||||
if((value.length === 0)
|
||||
|| (validationRegex !== undefined && !value.match(validationRegex))) {
|
||||
inputError(element, event);
|
||||
@ -102,6 +102,15 @@ define(
|
||||
core.resetModalInputs = function() {
|
||||
$(".modal input[type=text]:not([disabled])").val("");
|
||||
};
|
||||
core.trim = function(str) {
|
||||
return str.replace(/^\s+|\s+$/g, '');
|
||||
};
|
||||
core.checkUrl = function(url) {
|
||||
if(url.indexOf("http") !== 0) {
|
||||
return "http://" + url;
|
||||
}
|
||||
return url;
|
||||
};
|
||||
|
||||
// Used by asyncRunner
|
||||
core.showWorkingIndicator = function(show) {
|
||||
@ -571,6 +580,17 @@ define(
|
||||
});
|
||||
version = "v3";
|
||||
}
|
||||
|
||||
// Upgrade from v3 to v4
|
||||
if(version == "v3") {
|
||||
var currentFileIndex = localStorage["file.current"];
|
||||
if(currentFileIndex !== undefined &&
|
||||
localStorage["file.list"].indexOf(";" + currentFileIndex + ";") === -1)
|
||||
{
|
||||
localStorage.removeItem("file.current");
|
||||
}
|
||||
version = "v4";
|
||||
}
|
||||
localStorage["version"] = version;
|
||||
}
|
||||
// Setup the localStorage when starting
|
||||
|
@ -414,7 +414,7 @@ define(["jquery", "core", "async-runner"], function($, core, asyncRunner) {
|
||||
asyncRunner.addTask(task);
|
||||
};
|
||||
|
||||
googleHelper.uploadBlogger = function(blogUrl, blogId, postId, title, content, callback) {
|
||||
googleHelper.uploadBlogger = function(blogUrl, blogId, postId, labelList, title, content, callback) {
|
||||
var task = asyncRunner.createTask();
|
||||
connect(task);
|
||||
authenticate(task);
|
||||
@ -428,6 +428,7 @@ define(["jquery", "core", "async-runner"], function($, core, asyncRunner) {
|
||||
var data = {
|
||||
kind: "blogger#post",
|
||||
blog: { id: blogId },
|
||||
labels: labelList,
|
||||
title: title,
|
||||
content: content
|
||||
};
|
||||
|
2
js/main-min.js
vendored
2
js/main-min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user