contexmenu dynamic
This commit is contained in:
2
public/js/app/note-min.js
vendored
2
public/js/app/note-min.js
vendored
File diff suppressed because one or more lines are too long
@ -1152,6 +1152,7 @@ Note.copyNote = function(target, data, isShared) {
|
||||
});
|
||||
}
|
||||
|
||||
// 这里速度不慢, 很快
|
||||
Note.getContextNotebooks = function(notebooks) {
|
||||
var moves = [];
|
||||
var copys = [];
|
||||
@ -1166,9 +1167,12 @@ Note.getContextNotebooks = function(notebooks) {
|
||||
move.items = mc[0];
|
||||
copy.items = mc[1];
|
||||
copy2.items = mc[2];
|
||||
$.extend(move, {type: "group", width: 150});
|
||||
$.extend(copy, {type: "group", width: 150});
|
||||
$.extend(copy2, {type: "group", width: 150});
|
||||
move.type = "group";
|
||||
move.width = 150;
|
||||
copy.type = "group";
|
||||
copy.width = 150;
|
||||
copy2.type = "group";
|
||||
copy2.width = 150;
|
||||
}
|
||||
moves.push(move);
|
||||
copys.push(copy);
|
||||
@ -1187,6 +1191,7 @@ Note.initContextmenu = function() {
|
||||
// 得到可移动的notebook
|
||||
var notebooks = Notebook.everNotebooks;
|
||||
var mc = self.getContextNotebooks(notebooks);
|
||||
|
||||
var notebooksMove = mc[0];
|
||||
var notebooksCopy = mc[1];
|
||||
self.notebooksCopy = mc[2];
|
||||
@ -1269,6 +1274,7 @@ Note.initContextmenu = function() {
|
||||
return this.id != "target3";
|
||||
}
|
||||
|
||||
// 这里很慢!!
|
||||
Note.contextmenu = $("#noteItemList .item-my").contextmenu(noteListMenu);
|
||||
}
|
||||
|
||||
|
2
public/js/app/notebook-min.js
vendored
2
public/js/app/notebook-min.js
vendored
File diff suppressed because one or more lines are too long
@ -95,14 +95,14 @@ Notebook.getTreeSetting = function(isSearch, isShare){
|
||||
// 成为子节点, 那么只需要得到targetNode下所有的子结点即可
|
||||
if(moveType == "inner") {
|
||||
parentNode = targetNode;
|
||||
// 在targetNode之前或之后,
|
||||
// 那么: 1) 需要将该parentNode下所有的node重新排序即可; 2) treeNodes[0]为parentNode的子
|
||||
} else {
|
||||
parentNode = targetNode.getParentNode();
|
||||
}
|
||||
|
||||
// 在targetNode之前或之后,
|
||||
// 那么: 1) 需要将该parentNode下所有的node重新排序即可; 2) treeNodes[0]为parentNode的子
|
||||
if(!parentNode) {
|
||||
var nodes = treeObj.getNodes();
|
||||
var nodes = treeObj.getNodes(); // 得到所有nodes
|
||||
} else {
|
||||
ajaxData.parentNotebookId = parentNode.NotebookId;
|
||||
var nextLevel = parentNode.level+1;
|
||||
@ -119,9 +119,13 @@ Notebook.getTreeSetting = function(isSearch, isShare){
|
||||
ajaxData.siblings.push(notebookId);
|
||||
}
|
||||
}
|
||||
|
||||
ajaxPost("/notebook/dragNotebooks", {data: JSON.stringify(ajaxData)});
|
||||
|
||||
Notebook.changeNav();
|
||||
// 这里慢!
|
||||
setTimeout(function() {
|
||||
Notebook.changeNav();
|
||||
}, 100);
|
||||
}
|
||||
|
||||
if(!isShare) {
|
||||
@ -303,6 +307,7 @@ Notebook.searchNotebookForList = function(key) {
|
||||
$notebookList.hide();
|
||||
|
||||
var notebooks = self.tree.getNodesByParamFuzzy("Title", key);
|
||||
log('search');
|
||||
log(notebooks);
|
||||
if(isEmpty(notebooks)) {
|
||||
$search.html("");
|
||||
@ -353,7 +358,6 @@ Notebook.everNavForNewNote = "";
|
||||
Notebook.everNotebooks = [];
|
||||
Notebook.changeNav = function() {
|
||||
var self = Notebook;
|
||||
|
||||
var notebooks = Notebook.tree.getNodes();
|
||||
var pureNotebooks = notebooks.slice(1, -1); // 不含新和垃圾
|
||||
var html = self.getChangedNotebooks(pureNotebooks);
|
||||
@ -364,8 +368,12 @@ 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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user