@@ -460,11 +460,11 @@ Notebook.renderShareNotebooks = function(sharedUserInfos, shareNotebooks) {
if(isEmpty(sharedUserInfos)) {
return;
}
-
+
if(!shareNotebooks || typeof shareNotebooks != "object" || shareNotebooks.length < 0) {
return;
}
-
+
var $shareNotebooks = $("#shareNotebooks");
var user2ShareNotebooks = {};
for(var i in shareNotebooks) {
@@ -474,7 +474,7 @@ Notebook.renderShareNotebooks = function(sharedUserInfos, shareNotebooks) {
for(var i in sharedUserInfos) {
var userInfo = sharedUserInfos[i];
var userNotebooks = user2ShareNotebooks[userInfo.UserId] || {ShareNotebooks:[]};
-
+
userNotebooks.ShareNotebooks = [{NotebookId: "-2", Title: "默认共享"}].concat(userNotebooks.ShareNotebooks)
var username = userInfo.Username || userInfo.Email;
@@ -482,10 +482,10 @@ Notebook.renderShareNotebooks = function(sharedUserInfos, shareNotebooks) {
var body = '
';
for(var j in userNotebooks.ShareNotebooks) {
var notebook = userNotebooks.ShareNotebooks[j];
- body += tt('- ?
', notebook.NotebookId, notebook.Title)
+ body += tt('- ?
', notebook.NotebookId, Note._toHtmlEntity(notebook.Title))
}
body += "
";
-
+
$shareNotebooks.append(header + body + "
")
}
}
@@ -509,9 +509,9 @@ Notebook.changeNotebookNavForNewNote = function(notebookId, title) {
var notebook = Notebook.cache[0];
title = notebook.Title;
}
-
+
if(!Notebook.isAllNotebookId(notebookId) && !Notebook.isTrashNotebookId(notebookId)) {
- $("#curNotebookForNewNote").html(title).attr("notebookId", notebookId);
+ $("#curNotebookForNewNote").text(title).attr("notebookId", notebookId);
} else if(!$("#curNotebookForNewNote").attr("notebookId")) {
// 但又没有一个笔记, 默认选第一个吧
// 这里很可能会死循环, 万一用户没有其它笔记呢?
@@ -527,36 +527,36 @@ Notebook.changeNotebookNavForNewNote = function(notebookId, title) {
// 改变导航, 两处
// 单击左侧, 单击新建下拉时调用
-// 1 选中左侧导航,
+// 1 选中左侧导航,
// 2 notelist上面 >
// 3 新建笔记 - js >
// 转成我的nav <-> 共享
Notebook.toggleToMyNav = function(userId, notebookId) {
$("#sharedNotebookNavForListNav").hide();
$("#myNotebookNavForListNav").show();
-
+
$("#newMyNote").show();
$("#newSharedNote").hide();
-
+
// 搜索tag隐藏
$("#tagSearch").hide();
}
Notebook.changeNotebookNav = function(notebookId) {
Notebook.curNotebookId = notebookId;
Notebook.toggleToMyNav();
-
+
// 1 改变当前的notebook
Notebook.selectNotebook($(tt('#notebook [notebookId="?"]', notebookId)));
-
+
var notebook = Notebook.cache[notebookId];
-
+
if(!notebook) {
return;
}
-
+
// 2
- $("#curNotebookForListNote").html(notebook.Title);
-
+ $("#curNotebookForListNote").text(notebook.Title);
+
// 3
Notebook.changeNotebookNavForNewNote(notebookId, notebook.Title);
}
@@ -582,18 +582,18 @@ Notebook.curActiveNotebookIsAll = function() {
Notebook.changeNotebook = function(notebookId, callback) {
var me = this;
Notebook.changeNotebookNav(notebookId);
-
+
Notebook.curNotebookId = notebookId;
-
+
// 1
Note.curChangedSaveIt();
-
+
// 2 先清空所有
Note.clearAll();
-
+
var url = "/note/listNotes/";
var param = {notebookId: notebookId};
-
+
// 废纸篓
if(Notebook.isTrashNotebookId(notebookId)) {
url = "/note/listTrashNotes";
@@ -621,11 +621,11 @@ Notebook.changeNotebook = function(notebookId, callback) {
return;
}
}
-
+
// 2 得到笔记本
// 这里可以缓存起来, note按notebookId缓存
me.showNoteAndEditorLoading();
- ajaxGet(url, param, function(cacheNotes) {
+ ajaxGet(url, param, function(cacheNotes) {
if(callback) {
callback(cacheNotes);
} else {
@@ -657,13 +657,13 @@ Notebook.changeNotebookForNewNote = function(notebookId) {
if(Notebook.isTrashNotebookId(notebookId) || Notebook.isAllNotebookId(notebookId)) {
return;
}
-
+
Notebook.changeNotebookNav(notebookId, true);
Notebook.curNotebookId = notebookId;
-
+
var url = "/note/listNotes/";
var param = {notebookId: notebookId};
-
+
// 2 得到笔记本
// 这里可以缓存起来, note按notebookId缓存
ajaxGet(url, param, function(ret) {
@@ -686,7 +686,7 @@ Notebook.shareNotebooks= function(target) {
$("#friendsEmail").focus();
}, 500);
var notebookId = $(target).attr("notebookId");
-
+
shareNoteOrNotebook(notebookId, false);
}
@@ -699,7 +699,7 @@ Notebook.setNotebook2Blog = function(target) {
if(notebook.IsBlog != undefined) {
isBlog = !notebook.IsBlog;
}
-
+
// 那么, 如果当前是该notebook下, 重新渲染之
if(Notebook.curNotebookId == notebookId) {
if(isBlog) {
@@ -707,7 +707,7 @@ Notebook.setNotebook2Blog = function(target) {
} else {
$("#noteList .item-blog").hide();
}
-
+
// 如果当前在所有笔记本下
} else if(Notebook.curNotebookId == Notebook.allNotebookId){
$("#noteItemList .item").each(function(){
@@ -734,7 +734,7 @@ Notebook.setNotebook2Blog = function(target) {
Notebook.updateNotebookTitle = function(target) {
var self = Notebook;
var notebookId = $(target).attr("notebookId");
-
+
if(self.tree2) {
self.tree2.editName(self.tree2.getNodeByTId(notebookId));
} else {
@@ -748,7 +748,7 @@ Notebook.doUpdateNotebookTitle = function(notebookId, newTitle) {
Notebook.cache[notebookId].Title = newTitle;
// 改变nav
Notebook.changeNav();
-
+
// 同步
if(self.tree2) {
var notebook = self.tree.getNodeByTId(notebookId);
@@ -768,7 +768,7 @@ Notebook.addNotebook = function() {
if($("#myNotebooks").hasClass("closed")) {
$("#myNotebooks .folderHeader").trigger("click");
}
-
+
// 添加并修改
self.tree.addNodes(null, {Title: "", NotebookId: getObjectId(), IsNew: true}, true, true);
}
@@ -782,10 +782,10 @@ Notebook.doAddNotebook = function(notebookId, title, parentNotebookId) {
var notebook = self.tree.getNodeByTId(notebookId);
$.extend(notebook, ret);
notebook.IsNew = false;
-
+
// 选中之
Notebook.changeNotebook(notebookId);
-
+
// 改变nav
Notebook.changeNav();
}
@@ -799,9 +799,9 @@ Notebook.addChildNotebook = function(target) {
if($("#myNotebooks").hasClass("closed")) {
$("#myNotebooks .folderHeader").trigger("click");
}
-
+
var notebookId = $(target).attr("notebookId");
-
+
// 添加并修改
self.tree.addNodes(self.tree.getNodeByTId(notebookId), {Title: "", NotebookId: getObjectId(), IsNew: true}, false, true);
}
@@ -810,12 +810,12 @@ Notebook.addChildNotebook = function(target) {
// 删除
Notebook.deleteNotebook = function(target) {
var self = Notebook;
-
+
var notebookId = $(target).attr("notebookId");
if(!notebookId) {
return;
}
-
+
ajaxGet("/notebook/deleteNotebook", {notebookId: notebookId}, function(ret) {
if(ret.Ok) {
/*
@@ -826,7 +826,7 @@ Notebook.deleteNotebook = function(target) {
self.tree2.removeNode(self.tree2.getNodeByTId(notebookId));
}
delete Notebook.cache[notebookId];
-
+
// 改变nav
Notebook.changeNav();
} else {
@@ -849,17 +849,17 @@ $(function() {
var notebookId = $(this).find("a").attr("notebookId");
Notebook.changeNotebook(notebookId);
});
-
+
// 修改笔记本标题, blur后修改标题之
/*
enterBlur("#notebookList", "input#editNotebookTitle");
$("#notebookList").on("blur", "input#editNotebookTitle", Notebook.doUpdateNotebookTitle);
*/
-
+
//-------------------
// 右键菜单
var notebookListMenu = {
- width: 180,
+ width: 180,
items: [
{ text: getMsg("shareToFriends"), alias: 'shareToFriends', icon: "", faIcon: "fa-share-square-o", action: Notebook.listNotebookShareUserInfo},
{ type: "splitLine" },
@@ -875,10 +875,10 @@ $(function() {
parent: "#notebookList ",
children: "li a"
}
-
+
// for search
var notebookListMenu2 = {
- width: 180,
+ width: 180,
items: [
{ text: getMsg("shareToFriends"), alias: 'shareToFriends', icon: "", faIcon: "fa-share-square-o", action: Notebook.listNotebookShareUserInfo},
{ type: "splitLine" },
@@ -893,7 +893,7 @@ $(function() {
parent: "#notebookListForSearch ",
children: "li a"
}
-
+
function applyrule(menu) {
var notebookId = $(this).attr("notebookId");
var notebook = Notebook.cache[notebookId];
@@ -923,17 +923,17 @@ $(function() {
var notebookId = $(this).attr("notebookId");
return !Notebook.isTrashNotebookId(notebookId) && !Notebook.isAllNotebookId(notebookId);
}
-
+
Notebook.contextmenu = $("#notebookList li a").contextmenu(notebookListMenu);
-
+
Notebook.contextmenuSearch = $("#notebookListForSearch li a").contextmenu(notebookListMenu2);
-
+
// 添加笔记本
$("#addNotebookPlus").click(function(e) {
e.stopPropagation();
Notebook.addNotebook();
});
-
+
// notebook setting
$("#notebookList").on("click", ".notebook-setting", function(e) {
e.preventDefault();
diff --git a/public/js/app/tag-min.js b/public/js/app/tag-min.js
index 0b50a63..a12e773 100644
--- a/public/js/app/tag-min.js
+++ b/public/js/app/tag-min.js
@@ -1 +1 @@
-Tag.classes={"蓝色":"label label-blue","红色":"label label-red","绿色":"label label-green","黄色":"label label-yellow",blue:"label label-blue",red:"label label-red",green:"label label-green",yellow:"label label-yellow"};Tag.mapCn2En={"蓝色":"blue","红色":"red","绿色":"green","黄色":"yellow"};Tag.mapEn2Cn={blue:"蓝色",red:"红色",green:"绿色",yellow:"黄色"};Tag.t=$("#tags");Tag.getTags=function(){var tags=[];Tag.t.children().each(function(){var text=$(this).text();text=text.substring(0,text.length-1);text=Tag.mapCn2En[text]||text;tags.push(text)});return tags};Tag.clearTags=function(){Tag.t.html("")};Tag.renderTags=function(tags){Tag.t.html("");if(isEmpty(tags)){return}for(var i=0;i
?',classes,text);$("#noteReadTags").append(tag)}};Tag.appendTag=function(tag){var isColor=false;var classes,text;if(typeof tag=="object"){classes=tag.classes;text=tag.text;if(!text){return}}else{tag=$.trim(tag);text=tag;if(!text){return}var classes=Tag.classes[text];if(classes){isColor=true}else{classes="label label-default"}}if(LEA.locale=="zh"){text=Tag.mapEn2Cn[text]||text}tag=tt('?X',classes,text);$("#tags").children().each(function(){if(isColor){var tagHtml=$("").append($(this).clone()).html();if(tagHtml==tag){$(this).remove()}}else if(text+"X"==$(this).text()){$(this).remove()}});$("#tags").append(tag);hideTagList();if(!isColor){reRenderTags()}};function reRenderTags(){var defautClasses=["label label-default","label label-info"];var i=0;$("#tags").children().each(function(){var thisClasses=$(this).attr("class");if(thisClasses=="label label-default"||thisClasses=="label label-info"){$(this).removeClass(thisClasses).addClass(defautClasses[i%2]);i++}})}Tag.renderTagNav=function(tags){tags=tags||[];for(var i in tags){var tag=tags[i];if(tag=="red"||tag=="blue"||tag=="yellow"||tag=="green"){continue}var text=Tag.mapEn2Cn[tag]||tag;var classes=Tag.classes[tag]||"label label-default";$("#tagNav").append(tt(' ?',text,classes,text))}};$(function(){$("#addTagTrigger").click(function(){$(this).hide();$("#addTagInput").show().focus().val("")});$("#addTagInput").click(function(event){showTagList(event)});$("#addTagInput").blur(function(){var val=$(this).val();if(val){Tag.appendTag(val,true)}return;$("#addTagTrigger").show();$("#addTagInput").hide()});$("#addTagInput").keydown(function(e){if(e.keyCode==13){hideTagList();if($("#addTagInput").val()){$(this).trigger("blur");$("#addTagTrigger").trigger("click")}else{$(this).trigger("blur")}}});$("#tagColor li").click(function(event){var a;if($(this).attr("role")){a=$(this).find("span")}else{a=$(this)}Tag.appendTag({classes:a.attr("class"),text:a.text()})});$("#tags").on("click","i",function(){$(this).parent().remove();reRenderTags()});function searchTag(){var tag=$.trim($(this).data("tag"));Note.curChangedSaveIt();Note.clearAll();$("#tagSearch").html($(this).html()).show();showLoading();ajaxGet("/note/searchNoteByTags",{tags:[tag]},function(notes){hideLoading();if(notes){Note.renderNotes(notes);if(!isEmpty(notes)){Note.changeNote(notes[0].NoteId)}}})}$("#myTag .folderBody").on("click","li",searchTag);$("#minTagNav").on("click","li",searchTag)});
\ No newline at end of file
+Tag.classes={"蓝色":"label label-blue","红色":"label label-red","绿色":"label label-green","黄色":"label label-yellow",blue:"label label-blue",red:"label label-red",green:"label label-green",yellow:"label label-yellow"};Tag.mapCn2En={"蓝色":"blue","红色":"red","绿色":"green","黄色":"yellow"};Tag.mapEn2Cn={blue:"蓝色",red:"红色",green:"绿色",yellow:"黄色"};Tag.t=$("#tags");Tag.getTags=function(){var tags=[];Tag.t.children().each(function(){var text=$(this).text();text=text.substring(0,text.length-1);text=Tag.mapCn2En[text]||text;tags.push(text)});return tags};Tag.clearTags=function(){Tag.t.html("")};Tag.renderTags=function(tags){Tag.t.html("");if(isEmpty(tags)){return}for(var i=0;i?',classes,text);$("#noteReadTags").append(tag)}};Tag.appendTag=function(tag){var isColor=false;var classes,text;if(typeof tag=="object"){classes=tag.classes;text=tag.text;if(!text){return}}else{tag=$.trim(tag);text=tag;if(!text){return}var classes=Tag.classes[text];if(classes){isColor=true}else{classes="label label-default"}}if(LEA.locale=="zh"){text=Tag.mapEn2Cn[text]||text}tag=tt('?X',classes,Note._toHtmlEntity(text));$("#tags").children().each(function(){if(isColor){var tagHtml=$("").append($(this).clone()).html();if(tagHtml==tag){$(this).remove()}}else if(text+"X"==$(this).text()){$(this).remove()}});$("#tags").append(tag);hideTagList();if(!isColor){reRenderTags()}};function reRenderTags(){var defautClasses=["label label-default","label label-info"];var i=0;$("#tags").children().each(function(){var thisClasses=$(this).attr("class");if(thisClasses=="label label-default"||thisClasses=="label label-info"){$(this).removeClass(thisClasses).addClass(defautClasses[i%2]);i++}})}Tag.renderTagNav=function(tags){tags=tags||[];for(var i in tags){var tag=tags[i];if(tag=="red"||tag=="blue"||tag=="yellow"||tag=="green"){continue}var text=Note._toHtmlEntity(Tag.mapEn2Cn[tag]||tag);var classes=Tag.classes[tag]||"label label-default";$("#tagNav").append(tt(' ?',text,classes,text))}};$(function(){$("#addTagTrigger").click(function(){$(this).hide();$("#addTagInput").show().focus().val("")});$("#addTagInput").click(function(event){showTagList(event)});$("#addTagInput").blur(function(){var val=$(this).val();if(val){Tag.appendTag(val,true)}return;$("#addTagTrigger").show();$("#addTagInput").hide()});$("#addTagInput").keydown(function(e){if(e.keyCode==13){hideTagList();if($("#addTagInput").val()){$(this).trigger("blur");$("#addTagTrigger").trigger("click")}else{$(this).trigger("blur")}}});$("#tagColor li").click(function(event){var a;if($(this).attr("role")){a=$(this).find("span")}else{a=$(this)}Tag.appendTag({classes:a.attr("class"),text:a.text()})});$("#tags").on("click","i",function(){$(this).parent().remove();reRenderTags()});function searchTag(){var tag=$.trim($(this).data("tag"));Note.curChangedSaveIt();Note.clearAll();$("#tagSearch").html($(this).html()).show();showLoading();ajaxGet("/note/searchNoteByTags",{tags:[tag]},function(notes){hideLoading();if(notes){Note.renderNotes(notes);if(!isEmpty(notes)){Note.changeNote(notes[0].NoteId)}}})}$("#myTag .folderBody").on("click","li",searchTag);$("#minTagNav").on("click","li",searchTag)});
\ No newline at end of file
diff --git a/public/js/app/tag.js b/public/js/app/tag.js
index 0a8c27f..f18352f 100644
--- a/public/js/app/tag.js
+++ b/public/js/app/tag.js
@@ -89,7 +89,7 @@ Tag.renderReadOnlyTags = function(tags) {
if(isEmpty(tags)) {
$("#noteReadTags").html(getMsg("noTag"));
}
-
+
var i = true;
function getNextDefaultClasses() {
if (i) {
@@ -100,7 +100,7 @@ Tag.renderReadOnlyTags = function(tags) {
return "label label-info";
}
}
-
+
for(var i in tags) {
var text = tags[i];
text = Tag.mapEn2Cn[text] || text;
@@ -109,7 +109,7 @@ Tag.renderReadOnlyTags = function(tags) {
classes = getNextDefaultClasses();
}
tag = tt('?', classes, text);
-
+
$("#noteReadTags").append(tag);
}
}
@@ -120,7 +120,7 @@ Tag.renderReadOnlyTags = function(tags) {
Tag.appendTag = function(tag) {
var isColor = false;
var classes, text;
-
+
if (typeof tag == "object") {
classes = tag.classes;
text = tag.text;
@@ -140,11 +140,11 @@ Tag.appendTag = function(tag) {
classes = "label label-default";
}
}
-
+
if(LEA.locale == "zh") {
text = Tag.mapEn2Cn[text] || text;
}
- tag = tt('?X', classes, text);
+ tag = tt('?X', classes, Note._toHtmlEntity(text));
// 避免重复
$("#tags").children().each(function() {
@@ -192,9 +192,9 @@ Tag.renderTagNav = function(tags) {
if(tag == "red" || tag == "blue" || tag == "yellow" || tag == "green") {
continue;
}
- var text = Tag.mapEn2Cn[tag] || tag;
+ var text = Note._toHtmlEntity(Tag.mapEn2Cn[tag] || tag);
var classes = Tag.classes[tag] || "label label-default";
- $("#tagNav").append(tt(' ?', text, classes, text));
+ $("#tagNav").append(tt(' ?', text, classes, text));
}
}
@@ -206,11 +206,11 @@ $(function() {
$(this).hide();
$("#addTagInput").show().focus().val("");
});
-
+
$("#addTagInput").click(function(event) {
showTagList(event);
});
-
+
$("#addTagInput").blur(function() {
var val = $(this).val();
if(val) {
@@ -258,27 +258,27 @@ $(function() {
// event.stopPropagation();
});
*/
-
+
$("#tags").on("click", "i", function() {
$(this).parent().remove();
reRenderTags();
});
-
+
//-------------
// nav 标签搜索
function searchTag() {
var tag = $.trim($(this).data("tag"));
// tag = Tag.mapCn2En[tag] || tag;
-
+
// 学习changeNotebook
-
+
// 1
Note.curChangedSaveIt();
-
+
// 2 先清空所有
// 也会把curNoteId清空
Note.clearAll();
-
+
$("#tagSearch").html($(this).html()).show();
showLoading();
ajaxGet("/note/searchNoteByTags", {tags: [tag]}, function(notes) {
@@ -287,7 +287,7 @@ $(function() {
// 和note搜索一样
// 设空, 防止发生上述情况
// Note.curNoteId = "";
-
+
Note.renderNotes(notes);
if(!isEmpty(notes)) {
Note.changeNote(notes[0].NoteId);
From 419585ff7d011bc71f3f19c4c4b952b76ba5d990 Mon Sep 17 00:00:00 2001
From: yfqin
Date: Tue, 20 Jan 2015 11:31:17 +0800
Subject: [PATCH 3/3] =?UTF-8?q?=5FtoHtmlEntity=20=E5=AF=B9=E5=8F=8C?=
=?UTF-8?q?=E5=BC=95=E5=8F=B7=E8=BF=9B=E8=A1=8C=E8=BD=AC=E4=B9=89=20?=
=?UTF-8?q?=E5=AF=B9=E5=85=B6=E4=BB=96=E5=9C=B0=E6=96=B9=E4=B8=AD=E6=9C=89?=
=?UTF-8?q?=E5=8F=AF=E8=83=BD=E4=BA=A7=E7=94=9FXSS=E7=9A=84=E5=9C=B0?=
=?UTF-8?q?=E6=96=B9=E8=BF=9B=E8=A1=8C=E4=BF=AE=E8=A1=A5?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
public/js/app/note-min.js | 2 +-
public/js/app/note.js | 2 +-
public/js/app/notebook-min.js | 2 +-
public/js/app/notebook.js | 2 +-
public/js/app/tag-min.js | 2 +-
public/js/app/tag.js | 2 +-
6 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/public/js/app/note-min.js b/public/js/app/note-min.js
index ada2ce0..bed6f4d 100644
--- a/public/js/app/note-min.js
+++ b/public/js/app/note-min.js
@@ -1 +1 @@
-Note.curNoteId="";Note.interval="";Note.itemIsBlog='
';Note.itemTplNoImg='';Note.itemTplNoImg+=Note.itemIsBlog+'';Note.itemTpl='';Note.itemTpl+=Note.itemIsBlog+'';Note.newItemTpl='';Note.newItemTpl+=Note.itemIsBlog+'';Note.noteItemListO=$("#noteItemList");Note.cacheByNotebookId={all:{}};Note.notebookIds={};Note.isReadOnly=false;Note.intervalTime=6e5;Note.startInterval=function(){Note.interval=setInterval(function(){log("自动保存开始...");changedNote=Note.curChangedSaveIt(false)},Note.intervalTime)};Note.stopInterval=function(){clearInterval(Note.interval);setTimeout(function(){Note.startInterval()},Note.intervalTime)};Note.addNoteCache=function(note){Note.cache[note.NoteId]=note;Note.clearCacheByNotebookId(note.NotebookId)};Note.setNoteCache=function(content,clear){if(!Note.cache[content.NoteId]){Note.cache[content.NoteId]=content}else{$.extend(Note.cache[content.NoteId],content)}if(clear==undefined){clear=true}if(clear){Note.clearCacheByNotebookId(content.NotebookId)}};Note.getCurNote=function(){var self=this;if(self.curNoteId==""){return null}return self.cache[self.curNoteId]};Note.getNote=function(noteId){var self=this;return self.cache[noteId]};Note.clearCacheByNotebookId=function(notebookId){if(notebookId){Note.cacheByNotebookId[notebookId]={};Note.cacheByNotebookId["all"]={};Note.notebookIds[notebookId]=true}};Note.notebookHasNotes=function(notebookId){var notes=Note.getNotesByNotebookId(notebookId);return!isEmpty(notes)};Note.getNotesByNotebookId=function(notebookId,sortBy,isAsc){if(!sortBy){sortBy="UpdatedTime"}if(isAsc=="undefined"){isAsc=false}if(!notebookId){notebookId="all"}if(!Note.cacheByNotebookId[notebookId]){return[]}if(Note.cacheByNotebookId[notebookId][sortBy]){return Note.cacheByNotebookId[notebookId][sortBy]}else{}var notes=[];var sortBys=[];for(var i in Note.cache){if(!i){continue}var note=Note.cache[i];if(note.IsTrash||note.IsShared){continue}if(notebookId=="all"||note.NotebookId==notebookId){notes.push(note)}}notes.sort(function(a,b){var t1=a[sortBy];var t2=b[sortBy];if(isAsc){if(t1t2){return 1}}else{if(t1t2){return-1}}return 0});Note.cacheByNotebookId[notebookId][sortBy]=notes;return notes};Note.renderNotesAndFirstOneContent=function(ret){if(!isArray(ret)){return}Note.renderNotes(ret);if(!isEmpty(ret[0])){Note.changeNoteForPjax(ret[0].NoteId,true,false)}else{}};Note.curHasChanged=function(force){if(force==undefined){force=true}var cacheNote=Note.cache[Note.curNoteId]||{};var title=$("#noteTitle").val();var tags=Tag.getTags();var contents=getEditorContent(cacheNote.IsMarkdown);var content,preview;var contentText;if(isArray(contents)){content=contents[0];preview=contents[1];contentText=content;if(content&&previewIsEmpty(preview)&&Converter){preview=Converter.makeHtml(content)}if(!content){preview=""}cacheNote.Preview=preview}else{content=contents;try{contentText=$(content).text()}catch(e){}}var hasChanged={hasChanged:false,IsNew:cacheNote.IsNew,IsMarkdown:cacheNote.IsMarkdown,FromUserId:cacheNote.FromUserId,NoteId:cacheNote.NoteId,NotebookId:cacheNote.NotebookId};if(hasChanged.IsNew){$.extend(hasChanged,cacheNote)}if(cacheNote.Title!=title){hasChanged.hasChanged=true;hasChanged.Title=title;if(!hasChanged.Title){}}if(!arrayEqual(cacheNote.Tags,tags)){hasChanged.hasChanged=true;hasChanged.Tags=tags}if(force&&cacheNote.Content!=content||!force&&(!cacheNote.IsMarkdown&&$(cacheNote.Content).text()!=contentText||cacheNote.IsMarkdown&&cacheNote.Content!=contentText)){hasChanged.hasChanged=true;hasChanged.Content=content;var c=preview||content;if(!cacheNote.HasSelfDefined||!cacheNote.IsBlog){hasChanged.Desc=Note.genDesc(c);hasChanged.ImgSrc=Note.getImgSrc(c);hasChanged.Abstract=Note.genAbstract(c)}}else{log("text相同");log(cacheNote.Content==content)}hasChanged["UserId"]=cacheNote["UserId"]||"";return hasChanged};Note.genDesc=function(content){if(!content){return""}content=content.replace(/
/g,"
");content=content.replace(/<\/p>/g," ");content=content.replace(/<\/div>/g," ");content=$("