mirror of
https://github.com/leanote/desktop-app.git
synced 2025-10-15 23:55:50 +00:00
set blog
成功后才显示blog标志, 可点
This commit is contained in:
4
node_modules/api.js
generated
vendored
4
node_modules/api.js
generated
vendored
@@ -507,7 +507,8 @@ var Api = {
|
|||||||
Content: note.Content,
|
Content: note.Content,
|
||||||
IsMarkdown: note.IsMarkdown,
|
IsMarkdown: note.IsMarkdown,
|
||||||
Tags: note.Tags,
|
Tags: note.Tags,
|
||||||
IsBlog: false, // TODO 这里永远设为非blog note.IsBlog,
|
// IsBlog: false, // TODO 这里永远设为非blog note.IsBlog,
|
||||||
|
IsBlog: note.IsBlog,
|
||||||
Files: note.Files,
|
Files: note.Files,
|
||||||
FileDatas: note.FileDatas,
|
FileDatas: note.FileDatas,
|
||||||
}
|
}
|
||||||
@@ -560,6 +561,7 @@ var Api = {
|
|||||||
usn: note.Usn,
|
usn: note.Usn,
|
||||||
isTrash: note.IsTrash,
|
isTrash: note.IsTrash,
|
||||||
content: note.Content,
|
content: note.Content,
|
||||||
|
isBlog: note.IsBlog, // 是否是博客
|
||||||
Files: note.Files,
|
Files: note.Files,
|
||||||
FileDatas: note.FileDatas,
|
FileDatas: note.FileDatas,
|
||||||
tags: note.Tags, // 新添加
|
tags: note.Tags, // 新添加
|
||||||
|
25
node_modules/note.js
generated
vendored
25
node_modules/note.js
generated
vendored
@@ -153,6 +153,24 @@ var Note = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// 公开/取消为博客
|
||||||
|
setNote2Blog: function(noteId, isBlog, callback) {
|
||||||
|
var me = this;
|
||||||
|
me.getNote(noteId, function(note) {
|
||||||
|
if(note) {
|
||||||
|
if(note.IsBlog == isBlog) {
|
||||||
|
return callback && callback(true);
|
||||||
|
}
|
||||||
|
// 更新, 设置isDirty
|
||||||
|
Notes.update({NoteId: noteId}, { $set: {IsBlog: isBlog, IsDirty: true} }, {}, function (err, numReplaced) {
|
||||||
|
return callback && callback(true);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
return callback && callback(false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
// 添加笔记历史
|
// 添加笔记历史
|
||||||
/*
|
/*
|
||||||
type NoteContentHistory struct {
|
type NoteContentHistory struct {
|
||||||
@@ -1102,6 +1120,13 @@ var Note = {
|
|||||||
|
|
||||||
// 处理删除的
|
// 处理删除的
|
||||||
Web.deleteSyncNote(noteSyncInfo.deletes);
|
Web.deleteSyncNote(noteSyncInfo.deletes);
|
||||||
|
|
||||||
|
// 为了博客
|
||||||
|
var changeAdds = noteSyncInfo.changeAdds || [];
|
||||||
|
var changeUpdates = noteSyncInfo.changeUpdates || [];
|
||||||
|
changeAdds = changeAdds.concat(changeUpdates);
|
||||||
|
Web.updateNoteCacheForServer(changeAdds);
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
// 得到所有文件要传的基本信息和传送的数据
|
// 得到所有文件要传的基本信息和传送的数据
|
||||||
|
7
node_modules/sync.js
generated
vendored
7
node_modules/sync.js
generated
vendored
@@ -72,7 +72,7 @@ var Sync = {
|
|||||||
// 同步信息
|
// 同步信息
|
||||||
me._syncInfo = {
|
me._syncInfo = {
|
||||||
notebook: {ok: false, changeAdds: [], changeConflicts: [], changeNeedAdds: [], adds: [], deletes: [], updates: []},
|
notebook: {ok: false, changeAdds: [], changeConflicts: [], changeNeedAdds: [], adds: [], deletes: [], updates: []},
|
||||||
note: {ok: false, adds: [], changeAdds: [], changeConflicts: [], changeNeedAdds: [], deletes: [], updates: [], conflicts: []},
|
note: {ok: false, adds: [], changeAdds: [], changeConflicts: [], changeUpdates:[], changeNeedAdds: [], deletes: [], updates: [], conflicts: []},
|
||||||
tag: {ok: false, adds: [], changeAdds: [], changeConflicts: [], changeNeedAdds: [], deletes: [], updates: [], conflicts: []},
|
tag: {ok: false, adds: [], changeAdds: [], changeConflicts: [], changeNeedAdds: [], deletes: [], updates: [], conflicts: []},
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -736,7 +736,7 @@ var Sync = {
|
|||||||
// 一个一个同步执行, 因为要有
|
// 一个一个同步执行, 因为要有
|
||||||
async.eachSeries(notes, function(note, cb) {
|
async.eachSeries(notes, function(note, cb) {
|
||||||
if(note.LocalIsNew) {
|
if(note.LocalIsNew) {
|
||||||
// 添加
|
// 添加, newNote的返回不会很多值(server端)
|
||||||
Api.addNote(note, function(newNote) {
|
Api.addNote(note, function(newNote) {
|
||||||
if(!Common.isOk(newNote)) {
|
if(!Common.isOk(newNote)) {
|
||||||
return cb();
|
return cb();
|
||||||
@@ -744,6 +744,8 @@ var Sync = {
|
|||||||
|
|
||||||
newNote.ServerNoteId = newNote.NoteId;
|
newNote.ServerNoteId = newNote.NoteId;
|
||||||
newNote.NoteId = note.NoteId;
|
newNote.NoteId = note.NoteId;
|
||||||
|
|
||||||
|
newNote.IsBlog = note.IsBlog; // 前端要用
|
||||||
me._syncInfo.note.changeAdds.push(newNote);
|
me._syncInfo.note.changeAdds.push(newNote);
|
||||||
|
|
||||||
Note.updateNoteForceForSendChange(newNote, true);
|
Note.updateNoteForceForSendChange(newNote, true);
|
||||||
@@ -785,6 +787,7 @@ var Sync = {
|
|||||||
ret.ServerNoteId = ret.NoteId;
|
ret.ServerNoteId = ret.NoteId;
|
||||||
ret.NoteId = note.NoteId;
|
ret.NoteId = note.NoteId;
|
||||||
Note.updateNoteForceForSendChange(ret, false);
|
Note.updateNoteForceForSendChange(ret, false);
|
||||||
|
me._syncInfo.note.changeUpdates.push(note);
|
||||||
|
|
||||||
me.checkNeedIncSyncAgain(ret.Usn);
|
me.checkNeedIncSyncAgain(ret.Usn);
|
||||||
|
|
||||||
|
4
node_modules/web.js
generated
vendored
4
node_modules/web.js
generated
vendored
@@ -74,6 +74,10 @@ var Web = {
|
|||||||
var me = this;
|
var me = this;
|
||||||
me.Note.fixSyncConflict(note, newNote);
|
me.Note.fixSyncConflict(note, newNote);
|
||||||
},
|
},
|
||||||
|
updateNoteCacheForServer: function(notes) {
|
||||||
|
var me = this;
|
||||||
|
me.Note.updateNoteCacheForServer(notes);
|
||||||
|
},
|
||||||
//--------------
|
//--------------
|
||||||
|
|
||||||
syncFinished: function() {
|
syncFinished: function() {
|
||||||
|
@@ -446,7 +446,9 @@ h1, h2, h3 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.item-blog {
|
.item-blog {
|
||||||
top: 1px;
|
// top: 1px;
|
||||||
|
bottom: 0;
|
||||||
|
right: 45px;
|
||||||
// 暂不支持
|
// 暂不支持
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
@@ -484,7 +486,7 @@ h1, h2, h3 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#noteItemList .item:hover {
|
#noteItemList .item:hover {
|
||||||
.item-setting, .item-star {
|
.item-setting, .item-star, .item-blog {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
&.item-conflict {
|
&.item-conflict {
|
||||||
|
@@ -427,7 +427,8 @@ h3 {
|
|||||||
opacity: 0.8;
|
opacity: 0.8;
|
||||||
}
|
}
|
||||||
#noteItemList .item-blog {
|
#noteItemList .item-blog {
|
||||||
top: 1px;
|
bottom: 0;
|
||||||
|
right: 45px;
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
#noteItemList .item-setting {
|
#noteItemList .item-setting {
|
||||||
@@ -454,7 +455,8 @@ h3 {
|
|||||||
color: yellow !important;
|
color: yellow !important;
|
||||||
}
|
}
|
||||||
#noteItemList .item:hover .item-setting,
|
#noteItemList .item:hover .item-setting,
|
||||||
#noteItemList .item:hover .item-star {
|
#noteItemList .item:hover .item-star,
|
||||||
|
#noteItemList .item:hover .item-blog {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
#noteItemList .item:hover.item-conflict .item-conflict-info {
|
#noteItemList .item:hover.item-conflict .item-conflict-info {
|
||||||
|
@@ -1136,10 +1136,10 @@ Note.newNote = function(notebookId, isShare, fromUserId, isMarkdown) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// notebook是否是Blog
|
// notebook是否是Blog
|
||||||
if(!notebook.IsBlog) {
|
// if(!notebook.IsBlog) {
|
||||||
newItem = $(newItem);
|
newItem = $(newItem);
|
||||||
newItem.find(".item-blog").hide();
|
newItem.find(".item-blog").hide();
|
||||||
}
|
// }
|
||||||
|
|
||||||
// 是否在当前notebook下, 不是则切换过去, 并得到该notebook下所有的notes, 追加到后面!
|
// 是否在当前notebook下, 不是则切换过去, 并得到该notebook下所有的notes, 追加到后面!
|
||||||
if(!Notebook.isCurNotebook(notebookId)) {
|
if(!Notebook.isCurNotebook(notebookId)) {
|
||||||
@@ -1462,44 +1462,6 @@ Note.exportPDF = function(target) {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
// 长微博
|
|
||||||
Note.html2Image = function(target) {
|
|
||||||
var noteId = $(target).attr("noteId");
|
|
||||||
showDialog("html2ImageDialog", {title: "分享到社区", postShow: function() {
|
|
||||||
ajaxGet("/note/html2Image", {noteId: noteId}, function(ret) {
|
|
||||||
if (typeof ret == "object" && ret.Ok) {
|
|
||||||
$("#leanoteDialog .weibo span").html("生成成功, 右键图片保存到本地.")
|
|
||||||
$("#leanoteDialog .weibo img").attr("src", ret.Id + "?" + ((new Date()).getTime()));
|
|
||||||
$("#leanoteDialog .btn-share").removeClass("disabled");
|
|
||||||
var note = Note.cache[noteId];
|
|
||||||
var pic = UrlPrefix + ret.Id;
|
|
||||||
var title = encodeURI(note.Title + " (" + UserInfo.Username + "分享. 来自leanote.com)");
|
|
||||||
var windowParam = 'width=700, height=580, top=180, left=320, toolbar=no, menubar=no, scrollbars=no, location=yes, resizable=no, status=no';
|
|
||||||
$("#leanoteDialog .sendWeiboBtn").click(function() {
|
|
||||||
var url = "http://service.weibo.com/share/share.php?title=" + title;
|
|
||||||
url += "&pic=" + pic;
|
|
||||||
window.open(url, '分享到新浪微博', windowParam);
|
|
||||||
});
|
|
||||||
$("#leanoteDialog .sendTxWeiboBtn").click(function() {
|
|
||||||
var _appkey = '801542571';
|
|
||||||
var url = "http://share.v.t.qq.com/index.php?c=share&a=index&appkey=" + _appkey +"&title=" + title +"&url=&pic=" + pic
|
|
||||||
window.open(url, '分享到腾讯微博', windowParam);
|
|
||||||
});
|
|
||||||
$("#leanoteDialog .sendQQBtn").click(function() {
|
|
||||||
var url = 'http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url=' + UrlPrefix + '&title=' + title + '&pics=' + pic;
|
|
||||||
window.open(url, '分享QQ空间', windowParam);
|
|
||||||
});
|
|
||||||
$("#leanoteDialog .sendRRBtn").click(function() {
|
|
||||||
var url = 'http://widget.renren.com/dialog/share?resourceUrl=' + UrlPrefix + '&srcUrl=' + UrlPrefix + '&title=' + title + '&pic=' + pic;
|
|
||||||
window.open(url, '分享人人网', windowParam);
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
$("#leanoteDialog .weibo").html("对不起, 我们出错了!")
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}});
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------
|
//--------------
|
||||||
// read only
|
// read only
|
||||||
|
|
||||||
@@ -1641,18 +1603,37 @@ Note.setNote2Blog = function(target) {
|
|||||||
if(note.IsBlog != undefined) {
|
if(note.IsBlog != undefined) {
|
||||||
isBlog = !note.IsBlog;
|
isBlog = !note.IsBlog;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 标志添加/去掉
|
// 标志添加/去掉
|
||||||
if(isBlog) {
|
function setBlog() {
|
||||||
$(target).find(".item-blog").show();
|
// alert(noteId + " => " + isBlog);
|
||||||
} else {
|
NoteService.setNote2Blog(noteId, isBlog, function(ret) {
|
||||||
$(target).find(".item-blog").hide();
|
if(ret) {
|
||||||
|
// 触发同步
|
||||||
|
incrSync();
|
||||||
|
|
||||||
|
// Note.setNoteCache({NoteId: noteId, IsBlog: isBlog}, false); // 不清空NotesByNotebookId缓存
|
||||||
|
|
||||||
|
// 同步后会设置
|
||||||
|
/*
|
||||||
|
if(isBlog) {
|
||||||
|
$(target).find(".item-blog").removeAttr('style');
|
||||||
|
} else {
|
||||||
|
$(target).find(".item-blog").hide();
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
ajaxPost("/note/setNote2Blog", {noteId: noteId, isBlog: isBlog}, function(ret) {
|
// 是新笔记 或 当前笔记就是它的, 则先保存之
|
||||||
if(ret) {
|
if(note.IsNew || note.curNoteId == noteId) {
|
||||||
Note.setNoteCache({NoteId: noteId, IsBlog: isBlog}, false); // 不清空NotesByNotebookId缓存
|
Note.curChangedSaveIt(true, function(note) {
|
||||||
}
|
setBlog();
|
||||||
});
|
});
|
||||||
}
|
} else {
|
||||||
|
setBlog();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// 设置notebook的blog状态
|
// 设置notebook的blog状态
|
||||||
// 当修改notebook是否是blog时调用
|
// 当修改notebook是否是blog时调用
|
||||||
@@ -1676,7 +1657,7 @@ Note.setAllNoteBlogStatus = function(notebookId, isBlog) {
|
|||||||
notes[i].IsBlog = isBlog;
|
notes[i].IsBlog = isBlog;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
// 移动
|
// 移动
|
||||||
Note.moveNote = function(target, data) {
|
Note.moveNote = function(target, data) {
|
||||||
@@ -1726,7 +1707,7 @@ Note.moveNote = function(target, data) {
|
|||||||
Note.setNoteCache(ret)
|
Note.setNoteCache(ret)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
// 复制
|
// 复制
|
||||||
// data是自动传来的, 是contextmenu数据
|
// data是自动传来的, 是contextmenu数据
|
||||||
@@ -2205,6 +2186,13 @@ Note.initContextmenu = function() {
|
|||||||
Note.deleteNote(self.target);
|
Note.deleteNote(self.target);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
this.publicBlog = new gui.MenuItem({
|
||||||
|
label: getMsg("Public as blog"),
|
||||||
|
click: function(e) {
|
||||||
|
Note.setNote2Blog(self.target);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
this.move = new gui.MenuItem({
|
this.move = new gui.MenuItem({
|
||||||
label: getMsg("move"),
|
label: getMsg("move"),
|
||||||
click: function(e) {
|
click: function(e) {
|
||||||
@@ -2220,6 +2208,7 @@ Note.initContextmenu = function() {
|
|||||||
this.move.submenu = ms[0];
|
this.move.submenu = ms[0];
|
||||||
this.copy.submenu = ms[1];
|
this.copy.submenu = ms[1];
|
||||||
|
|
||||||
|
this.menu.append(this.publicBlog);
|
||||||
this.menu.append(this.del);
|
this.menu.append(this.del);
|
||||||
this.menu.append(this.move);
|
this.menu.append(this.move);
|
||||||
this.menu.append(this.copy);
|
this.menu.append(this.copy);
|
||||||
@@ -2256,6 +2245,12 @@ Note.initContextmenu = function() {
|
|||||||
this.copy.enabled = true;
|
this.copy.enabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(note.IsBlog) {
|
||||||
|
this.publicBlog['label'] = 'Cancel public';
|
||||||
|
} else {
|
||||||
|
this.publicBlog['label'] = 'Public as blog';
|
||||||
|
}
|
||||||
|
|
||||||
this.menu.popup(e.originalEvent.x, e.originalEvent.y);
|
this.menu.popup(e.originalEvent.x, e.originalEvent.y);
|
||||||
|
|
||||||
// notebookMenuForMove.enabled = true;
|
// notebookMenuForMove.enabled = true;
|
||||||
@@ -2672,7 +2667,10 @@ $(function() {
|
|||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
// 得到ID
|
// 得到ID
|
||||||
var noteId = $(this).parent().attr('noteId');
|
var noteId = $(this).parent().attr('noteId');
|
||||||
window.open("/blog/view/" + noteId);
|
var note = Note.getNote(noteId);
|
||||||
|
if(note.ServerNoteId) {
|
||||||
|
openExternal(UserInfo.Host + '/blog/post/' + note.ServerNoteId);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// note setting
|
// note setting
|
||||||
@@ -2756,21 +2754,37 @@ Note.fixSyncConflict = function(note, newNote) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// 添加同步的notes
|
// 设置博客是否可以见
|
||||||
Note.addSync = function(notes) {
|
Note.setNoteBlogVisible = function(noteId, isBlog) {
|
||||||
|
var target = $(tt('[noteId="?"]', noteId));
|
||||||
|
if(target.length) {
|
||||||
|
if(isBlog) {
|
||||||
|
target.find(".item-blog").removeAttr('style');
|
||||||
|
} else {
|
||||||
|
target.find(".item-blog").hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// --> adds
|
||||||
|
// changeAdds 有了serverId
|
||||||
|
Note.updateNoteCacheForServer = function(notes) {
|
||||||
if(isEmpty(notes)) {
|
if(isEmpty(notes)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for(var i in notes) {
|
for(var i in notes) {
|
||||||
var note = notes[i];
|
var note = notes[i];
|
||||||
Note.addNoteCache(note);
|
// alert(note.NoteId + " " + note.IsBlog);
|
||||||
// 添加到当前的笔记列表中
|
Note.addNoteCache({NoteId: note.NoteId,
|
||||||
var newHtmlObject = Note._getNoteHtmlObjct(note);
|
ServerNoteId: note.ServerNoteId,
|
||||||
log(newHtmlObject);
|
IsBlog: note.IsBlog,
|
||||||
$('#noteItemList').prepend(newHtmlObject);
|
});
|
||||||
|
Note.setNoteBlogVisible(note.NoteId, note.IsBlog);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
// 更新
|
// 更新
|
||||||
|
// --> send changes
|
||||||
Note.updateSync = function(notes) {
|
Note.updateSync = function(notes) {
|
||||||
if(isEmpty(notes)) {
|
if(isEmpty(notes)) {
|
||||||
return;
|
return;
|
||||||
@@ -2790,6 +2804,10 @@ Note.updateSync = function(notes) {
|
|||||||
Note.reRenderNote(Note.curNoteId);
|
Note.reRenderNote(Note.curNoteId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 设置当前是否是博客
|
||||||
|
// alert(note.NoteId + " " + note.IsBlog);
|
||||||
|
Note.setNoteBlogVisible(note.NoteId, note.IsBlog);
|
||||||
|
|
||||||
// 如果是trash, 且当前不在trash目录下, 且有该笔记, 则删除之
|
// 如果是trash, 且当前不在trash目录下, 且有该笔记, 则删除之
|
||||||
if(!curNotebookIsTrash && note.IsTrash) {
|
if(!curNotebookIsTrash && note.IsTrash) {
|
||||||
var target = $(tt('[noteId="?"]', note.NoteId));
|
var target = $(tt('[noteId="?"]', note.NoteId));
|
||||||
@@ -2803,6 +2821,25 @@ Note.updateSync = function(notes) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// 添加同步的notes
|
||||||
|
// <-- server
|
||||||
|
Note.addSync = function(notes) {
|
||||||
|
if(isEmpty(notes)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for(var i in notes) {
|
||||||
|
var note = notes[i];
|
||||||
|
Note.addNoteCache(note);
|
||||||
|
// alert(note.ServerNoteId);
|
||||||
|
// 添加到当前的笔记列表中
|
||||||
|
var newHtmlObject = Note._getNoteHtmlObjct(note);
|
||||||
|
$('#noteItemList').prepend(newHtmlObject);
|
||||||
|
|
||||||
|
Note.setNoteBlogVisible(note.NoteId, note.IsBlog);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// 删除
|
// 删除
|
||||||
Note.deleteSync = function(notes) {
|
Note.deleteSync = function(notes) {
|
||||||
if(isEmpty(notes)) {
|
if(isEmpty(notes)) {
|
||||||
|
@@ -1460,10 +1460,7 @@ var Pren = {
|
|||||||
var re = new RegExp("^((https|http|ftp|rtsp|mms|emailto)://).+");
|
var re = new RegExp("^((https|http|ftp|rtsp|mms|emailto)://).+");
|
||||||
return re.test(str_url);
|
return re.test(str_url);
|
||||||
}
|
}
|
||||||
// 浏览器打开
|
|
||||||
function openExternal(url) {
|
|
||||||
gui.Shell.openExternal(url);
|
|
||||||
}
|
|
||||||
// 防止在本窗口打开
|
// 防止在本窗口打开
|
||||||
me.presentationO.on('click', 'a', function(e) {
|
me.presentationO.on('click', 'a', function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
@@ -1519,12 +1516,11 @@ function userMenu() {
|
|||||||
function menu() {
|
function menu() {
|
||||||
var me = this;
|
var me = this;
|
||||||
// this.target = '';
|
// this.target = '';
|
||||||
|
UserInfo.Host = UserInfo.Host || 'http://leanote.com';
|
||||||
var shortHost = UserInfo.Host;
|
var shortHost = UserInfo.Host;
|
||||||
if(shortHost) {
|
var ret = /http(s*):\/\/([a-zA-Z0-9\.\-]+)/.exec(shortHost);
|
||||||
var ret = /http(s*):\/\/([a-zA-Z0-9\.\-]+)/.exec(shortHost);
|
if(ret && ret.length == 3) {
|
||||||
if(ret && ret.length == 3) {
|
shortHost = ret[2];
|
||||||
shortHost = ret[2];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.menu = new gui.Menu();
|
this.menu = new gui.Menu();
|
||||||
@@ -1534,6 +1530,12 @@ function userMenu() {
|
|||||||
click: function(e) {
|
click: function(e) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
this.blog = new gui.MenuItem({
|
||||||
|
label: 'My blog',
|
||||||
|
click: function(e) {
|
||||||
|
openExternal(UserInfo.Host + '/blog/' + UserInfo.UserId);
|
||||||
|
}
|
||||||
|
});
|
||||||
this.switchAccount = new gui.MenuItem({
|
this.switchAccount = new gui.MenuItem({
|
||||||
label: 'Switch account',
|
label: 'Switch account',
|
||||||
click: function(e) {
|
click: function(e) {
|
||||||
@@ -1581,11 +1583,12 @@ function userMenu() {
|
|||||||
this.theme.submenu = themeSubmenus;
|
this.theme.submenu = themeSubmenus;
|
||||||
|
|
||||||
this.menu.append(this.email);
|
this.menu.append(this.email);
|
||||||
|
this.menu.append(this.blog);
|
||||||
this.menu.append(this.switchAccount);
|
this.menu.append(this.switchAccount);
|
||||||
this.menu.append(new gui.MenuItem({ type: 'separator' }));
|
this.menu.append(new gui.MenuItem({ type: 'separator' }));
|
||||||
this.menu.append(this.theme);
|
this.menu.append(this.theme);
|
||||||
|
|
||||||
var height = 130;
|
var height = 150;
|
||||||
if(!isMac()) {
|
if(!isMac()) {
|
||||||
this.menu.append(new gui.MenuItem({ type: 'separator' }));
|
this.menu.append(new gui.MenuItem({ type: 'separator' }));
|
||||||
|
|
||||||
@@ -1598,13 +1601,12 @@ function userMenu() {
|
|||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
*/
|
*/
|
||||||
height = 220;
|
height = 240;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.menu.append(new gui.MenuItem({ type: 'separator' }));
|
this.menu.append(new gui.MenuItem({ type: 'separator' }));
|
||||||
this.menu.append(this.sync);
|
this.menu.append(this.sync);
|
||||||
|
|
||||||
|
|
||||||
this.popup = function(e) {
|
this.popup = function(e) {
|
||||||
this.menu.popup(10, $('body').height() - height);
|
this.menu.popup(10, $('body').height() - height);
|
||||||
}
|
}
|
||||||
|
@@ -1443,6 +1443,11 @@ function getMainWinParams() {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 浏览器打开
|
||||||
|
function openExternal(url) {
|
||||||
|
gui.Shell.openExternal(url);
|
||||||
|
}
|
||||||
|
|
||||||
// loadToolIcons();
|
// loadToolIcons();
|
||||||
|
|
||||||
ContextTips.init();
|
ContextTips.init();
|
Reference in New Issue
Block a user