This commit is contained in:
lealife
2015-10-27 23:04:39 +08:00
parent 29244c247e
commit 263c03291e
21 changed files with 1037 additions and 294 deletions

File diff suppressed because it is too large Load Diff

View File

@ -297,7 +297,7 @@ Notebook.cacheAllNotebooks = function(notebooks) {
self.cacheAllNotebooks(notebook.Subs);
}
}
}
};
// 展开到笔记本
Notebook.expandNotebookTo = function(notebookId, userId) {
@ -332,8 +332,7 @@ Notebook.expandNotebookTo = function(notebookId, userId) {
break;
}
}
}
};
// RenderNotebooks调用,
// nav 为了新建, 快速选择, 移动笔记
@ -341,7 +340,7 @@ Notebook.expandNotebookTo = function(notebookId, userId) {
Notebook.renderNav = function(nav) {
var self = this;
self.changeNav();
}
};
// 搜索notebook
Notebook.searchNotebookForAddNote = function(key) {
@ -365,7 +364,7 @@ Notebook.searchNotebookForAddNote = function(key) {
} else {
$("#notebookNavForNewNote").html(self.everNavForNewNote);
}
}
};
// 搜索notebook
Notebook.searchNotebookForList = function(key) {
@ -391,8 +390,7 @@ Notebook.searchNotebookForList = function(key) {
$notebookList.show();
$("#notebookNavForNewNote").html(self.everNavForNewNote);
}
}
};
// 修改,添加,删除notebook后调用
// 改变nav
@ -422,7 +420,7 @@ Notebook.getChangedNotebooks = function(notebooks) {
navForNewNote += eachForNew;
}
return navForNewNote;
}
};
Notebook.everNavForNewNote = "";
Notebook.everNotebooks = [];
@ -438,13 +436,9 @@ Notebook.changeNav = function() {
$("#notebookNavForNewNote").html(html);
// 移动, 复制重新来, 因为nav变了, 移动至-----的notebook导航也变了
// 这里速度很慢
var t1 = (new Date()).getTime();
Note.initContextmenu();
Share.initContextmenu(Note.notebooksCopy);
var t2 = (new Date()).getTime();
log(t2-t1);
}
};
/**
* 我的共享notebooks
@ -573,15 +567,18 @@ Notebook.changeNotebookNav = function(notebookId) {
Notebook.isAllNotebookId = function(notebookId) {
return notebookId == Notebook.allNotebookId;
}
};
Notebook.isTrashNotebookId = function(notebookId) {
return notebookId == Notebook.trashNotebookId;
}
};
// 当前选中的笔记本是否是"所有"
// called by Note
Notebook.curActiveNotebookIsAll = function() {
return Notebook.isAllNotebookId($("#notebookList .active").attr("notebookId"));
}
return Notebook.isAllNotebookId($("#notebookList .curSelectedNode").attr("notebookId"));
};
Notebook.curActiveNotebookIsTrash = function() {
return Notebook.isTrashNotebookId($("#notebookList .curSelectedNode").attr("notebookId"));
};
// 改变笔记本
// 0. 改变样式

View File

@ -58,7 +58,7 @@ editorMode.prototype.changeMode = function(isWritingMode) {
} else {
this.normalMode();
}
}
};
editorMode.prototype.resizeEditor = function() {
// css还没渲染完
@ -93,13 +93,18 @@ editorMode.prototype.normalMode = function() {
$("#noteList").width(UserInfo.NoteListWidth);
$("#note").css("left", UserInfo.NoteListWidth);
}
this.isWritingMode = false;
};
editorMode.prototype.writtingMode = function() {
if (Note.inBatch) {
return;
}
if(this.$themeLink.attr('href').indexOf('writting-overwrite.css') == -1) {
this.$themeLink.attr("href", "/css/theme/writting-overwrite.css");
}
/*
setTimeout(function() {
var $c = $("#editorContent_ifr").contents();
@ -126,7 +131,9 @@ editorMode.prototype.writtingMode = function() {
// 切换到写模式
Note.toggleWriteable();
}
this.isWritingMode = true;
};
editorMode.prototype.getWritingCss = function() {
if(this.isWritingMode) {
@ -681,8 +688,13 @@ function scrollTo(self, tagName, text) {
// 主题
$("#themeForm").on("click", "input", function(e) {
var val = $(this).val();
$("#themeLink").attr("href", "/css/theme/" + val + ".css");
var preHref = $("#themeLink").attr("href"); // default.css?id=7
var arr = preHref.split('=');
var id = 1;
if (arr.length == 2) {
id = arr[1];
}
$("#themeLink").attr("href", "/css/theme/" + val + ".css?id=" + id);
ajaxPost("/user/updateTheme", {theme: val}, function(re) {
if(reIsOk(re)) {
UserInfo.Theme = val
@ -800,6 +812,9 @@ function scrollTo(self, tagName, text) {
if (UserInfo.LeftIsMin) {
minLeft(false);
}
else {
maxLeft(false);
}
// end
// 开始时显示loading......
@ -1104,7 +1119,6 @@ LeaAce = {
return function() {
pre.find('.toggle-raw').remove();
var value = pre.html();
log(value);
value = value.replace(/ /g, "&nbsp;").replace(/\<br *\/*\>/gi,"\n").replace(/</g, '&lt;').replace(/>/g, '&gt;');
pre.html(value);
var id = pre.attr('id');

View File

@ -4,7 +4,7 @@
// 默认共享notebook id
Share.defaultNotebookId = "share0";
Share.defaultNotebookTitle = getMsg("defaulthhare");
Share.defaultNotebookTitle = getMsg("defaultShare");
Share.sharedUserInfos = {}; // userId => {}
// 在render时就创建, 以后复用之
@ -19,12 +19,13 @@ Share.cache = {}; // note的cache
Share.dialogIsNote = true;
// 设置缓存 note
// 弃用
Share.setCache = function(note) {
if(!note || !note.NoteId) {
return;
}
Share.cache[note.NoteId] = note;
}
};
/**
* 我的共享notebooks
@ -296,7 +297,6 @@ Share.changeNotebook = function(userId, notebookId, callback) {
//
// 如果是特定笔记本下的notes, 那么传过来的没有权限信息, 此时权限由notebookId决定
if(param.notebookId) {
}
if(callback) {
callback(ret);
@ -381,10 +381,10 @@ Share.changeNotebookForNewNote = function(notebookId) {
// 删除笔记, 我有权限, 且是我创建的笔记
Share.deleteSharedNote = function(target, contextmenuItem) {
Note.deleteNote(target, contextmenuItem, true);
}
};
Share.copySharedNote = function(target, contextmenuItem) {
Note.copyNote(target, contextmenuItem, true);
}
};
Share.contextmenu = null;
Share.initContextmenu = function(notebooksCopy) {
@ -412,12 +412,13 @@ Share.initContextmenu = function(notebooksCopy) {
}
function applyrule(menu) {
var noteId = $(this).attr("noteId");
var note = Share.cache[noteId];
if(!note) {
return;
}
var note = Note.getNote(noteId);
var items = [];
if(!(note.Perm && note.CreatedUserId == UserInfo.UserId)) {
if(Note.inBatch || !note) {
items.push("delete");
}
// 批量操作时, 不让删除
if(note && !(note.Perm && note.CreatedUserId == UserInfo.UserId)) {
items.push("delete");
}
// 不是自己的创建的不能删除
@ -426,7 +427,6 @@ Share.initContextmenu = function(notebooksCopy) {
disable: true,
items: items
});
}
Share.contextmenu = $("#noteItemList .item-shared").contextmenu(noteListMenu);