item setting [ok]
notebook icon [ok]
This commit is contained in:
@ -11,7 +11,7 @@ Note.curNoteId = "";
|
||||
|
||||
Note.interval = ""; // 定时器
|
||||
|
||||
Note.itemIsBlog = '<div class="item-blog"><i class="fa fa-bold" title="blog"></i></div>';
|
||||
Note.itemIsBlog = '<div class="item-blog"><i class="fa fa-bold" title="blog"></i></div><div class="item-setting"><i class="fa fa-cog" title="setting"></i></div>';
|
||||
// for render
|
||||
Note.itemTplNoImg = '<div href="#" class="item ?" noteId="?">'
|
||||
Note.itemTplNoImg += Note.itemIsBlog +'<div class="item-desc" style="right: 0;"><p class="item-title">?</p><p class="item-text"><i class="fa fa-book"></i> <span class="note-notebook">?</span> <i class="fa fa-calendar"></i> <span class="updated-time">?</span> <br /><span class="desc">?</span></p></div></div>';
|
||||
@ -1152,7 +1152,6 @@ Note.copyNote = function(target, data, isShared) {
|
||||
});
|
||||
}
|
||||
|
||||
Note.contextmenu = null;
|
||||
Note.getContextNotebooks = function(notebooks) {
|
||||
var moves = [];
|
||||
var copys = [];
|
||||
@ -1172,10 +1171,12 @@ Note.getContextNotebooks = function(notebooks) {
|
||||
}
|
||||
return [moves, copys];
|
||||
}
|
||||
// Notebook调用
|
||||
Note.contextmenu = null;
|
||||
Note.initContextmenu = function() {
|
||||
var self = Note;
|
||||
if(Note.contextmenu) {
|
||||
Note.contextmenu.unbind("contextmenu");
|
||||
Note.contextmenu.destroy();
|
||||
}
|
||||
// 得到可移动的notebook
|
||||
var notebooks = Notebook.everNotebooks;
|
||||
@ -1183,17 +1184,6 @@ Note.initContextmenu = function() {
|
||||
var notebooksMove = mc[0];
|
||||
var notebooksCopy = mc[1];
|
||||
|
||||
/*
|
||||
$("#notebookNavForNewNote li div.new-note-left").each(function() {
|
||||
var notebookId = $(this).attr("notebookId");
|
||||
var title = $(this).text();
|
||||
var move = {text: title, notebookId: notebookId, action: Note.moveNote}
|
||||
var copy = {text: title, notebookId: notebookId, action: Note.copyNote}
|
||||
notebooksMove.push(move);
|
||||
notebooksCopy.push(copy);
|
||||
});
|
||||
*/
|
||||
|
||||
//---------------------
|
||||
// context menu
|
||||
//---------------------
|
||||
@ -1229,7 +1219,6 @@ Note.initContextmenu = function() {
|
||||
function menuAction(target) {
|
||||
// $('#myModal').modal('show')
|
||||
showDialog("dialogUpdateNotebook", {title: "修改笔记本", postShow: function() {
|
||||
|
||||
}});
|
||||
}
|
||||
function applyrule(menu) {
|
||||
@ -1273,7 +1262,7 @@ Note.initContextmenu = function() {
|
||||
return this.id != "target3";
|
||||
}
|
||||
|
||||
Note.contextmenu = $("#noteItemList .item").contextmenu(noteListMenu);
|
||||
Note.contextmenu = $("#noteItemList .item-my").contextmenu(noteListMenu);
|
||||
}
|
||||
|
||||
//------------------- 事件
|
||||
@ -1348,7 +1337,7 @@ $(function() {
|
||||
});
|
||||
|
||||
//--------------------
|
||||
Note.initContextmenu();
|
||||
// Note.initContextmenu();
|
||||
|
||||
//------------
|
||||
// 文档历史
|
||||
@ -1368,6 +1357,17 @@ $(function() {
|
||||
var noteId = $(this).parent().attr('noteId');
|
||||
window.open("/blog/view/" + noteId);
|
||||
});
|
||||
|
||||
// note setting
|
||||
$("#noteItemList").on("click", ".item-setting", function(e) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
// 得到ID
|
||||
var $p = $(this).parent();
|
||||
var noteId = $p.attr('noteId');
|
||||
|
||||
Note.contextmenu.showMenu(e, $p);
|
||||
});
|
||||
});
|
||||
|
||||
// 定时器启动
|
||||
|
@ -237,27 +237,6 @@ Notebook.cacheAllNotebooks = function(notebooks) {
|
||||
Notebook.renderNav = function(nav) {
|
||||
var self = this;
|
||||
self.changeNav();
|
||||
return;
|
||||
|
||||
var navForListNote = "";
|
||||
var navForNewNote = "";
|
||||
var navForMoveNote = "";
|
||||
var len = Notebook.notebooks.length-1;
|
||||
var contextmenu = [];
|
||||
for(var i in Notebook.notebooks) {
|
||||
var notebook = Notebook.notebooks[i];
|
||||
var each = t('<li role="presentation"><a role="menuitem" tabindex="-1" href="#" notebookId="?">?</a></li>', notebook.NotebookId, notebook.Title);
|
||||
var eachForNew = t('<li role="presentation" class="clearfix"><div class="new-note-left pull-left" title="为该笔记本新建笔记" href="#" notebookId="?">?</div><div title="为该笔记本新建markdown笔记" class="new-note-right pull-left" notebookId="?">Markdown</div></li>', notebook.NotebookId, notebook.Title, notebook.NotebookId);
|
||||
navForListNote += each;
|
||||
if(i != 0 && i != len) {
|
||||
navForMoveNote += each;
|
||||
navForNewNote += eachForNew;
|
||||
}
|
||||
}
|
||||
|
||||
$("#notebookNavForListNote").html(navForListNote);
|
||||
$("#notebookNavForNewNote").html(navForNewNote);
|
||||
$("#notebookNavForMoveNote").html(navForMoveNote);
|
||||
}
|
||||
|
||||
// 搜索notebook
|
||||
@ -817,30 +796,11 @@ $(function() {
|
||||
var notebookId = $(this).attr("notebookId");
|
||||
return !Notebook.isTrashNotebookId(notebookId) && !Notebook.isAllNotebookId(notebookId);
|
||||
}
|
||||
|
||||
$("#notebookList li a").contextmenu(notebookListMenu);
|
||||
|
||||
$("#notebookListForSearch").contextmenu(notebookListMenu2);
|
||||
|
||||
//------------------
|
||||
// 添加notebook
|
||||
// 右键菜单
|
||||
var addNotebookContextmenu = {
|
||||
width: 150,
|
||||
items: [
|
||||
{ text: "添加笔记本", icon: "", action: Notebook.addNotebook },
|
||||
],
|
||||
parent: "#myNotebooks",
|
||||
children: ""
|
||||
}
|
||||
$("#myNotebooks").contextmenu(addNotebookContextmenu);
|
||||
|
||||
//---------------
|
||||
// 点击中部notebook nav
|
||||
$("#notebookNavForListNote").on("click", "li", function() {
|
||||
var notebookId = $(this).find("a").attr("notebookId");
|
||||
Notebook.changeNotebook(notebookId);
|
||||
});
|
||||
|
||||
// 添加笔记本
|
||||
$("#addNotebookPlus").click(function(e) {
|
||||
e.stopPropagation();
|
||||
|
@ -202,7 +202,8 @@ LEA.cmroot = 1;
|
||||
$(target).addClass("contextmenu-hover");
|
||||
}
|
||||
|
||||
$(document).one('mousedown', function() {
|
||||
// life , 之前是mousedown
|
||||
$(document).one('click', function() {
|
||||
hideMenuPane();
|
||||
// life
|
||||
$(target).removeClass("contextmenu-hover");
|
||||
@ -237,8 +238,7 @@ LEA.cmroot = 1;
|
||||
});
|
||||
*/
|
||||
|
||||
// bind event
|
||||
var me = $(option.parent).on('contextmenu', option.children, function(e) {
|
||||
function onShowMenu(e) {
|
||||
var bShowContext = (option.onContextMenu && $.isFunction(option.onContextMenu)) ? option.onContextMenu.call(this, e) : true;
|
||||
if (bShowContext) {
|
||||
if (option.onShow && $.isFunction(option.onShow)) {
|
||||
@ -247,8 +247,14 @@ LEA.cmroot = 1;
|
||||
root.showMenu(e, this);
|
||||
}
|
||||
// 阻止冒泡, 默认事件
|
||||
e.preventDefault();
|
||||
if(e) {
|
||||
e.preventDefault();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
// bind event
|
||||
var me = $(option.parent).on('contextmenu', option.children, function(e){
|
||||
onShowMenu.call(this, e);
|
||||
});
|
||||
|
||||
//to apply rule
|
||||
@ -259,6 +265,16 @@ LEA.cmroot = 1;
|
||||
addItems = overItem = outItem = null;
|
||||
//CollectGarbage();
|
||||
|
||||
return me;
|
||||
var out = {
|
||||
destroy: function() {
|
||||
me.unbind("contextmenu");
|
||||
},
|
||||
showMenu: function(e, target) {
|
||||
log(e);
|
||||
log(target);
|
||||
onShowMenu.call(target, e);
|
||||
}
|
||||
}
|
||||
return out;
|
||||
}
|
||||
})(jQuery);
|
@ -16,7 +16,7 @@
|
||||
//default consts of core
|
||||
_consts = {
|
||||
className: {
|
||||
BUTTON: "button",
|
||||
BUTTON: "button fa",
|
||||
LEVEL: "level",
|
||||
ICO_LOADING: "ico_loading",
|
||||
SWITCH: "switch"
|
||||
|
Reference in New Issue
Block a user