item setting [ok]

notebook icon [ok]
This commit is contained in:
iiuazz
2014-09-12 11:50:24 +08:00
parent 85fd63baa5
commit a113b9b5e5
11 changed files with 97 additions and 117 deletions

View File

@ -946,9 +946,10 @@ var noteContentJson = json({{.noteContentJson}});
var tagsJson = json({{.tagsJson}});
LEA.locale = "{{.locale}}";
</script>
<!-- 渲染view -->
<script src="/js/jQuery-slimScroll-1.3.0/jquery.slimscroll.js"></script>
<script src="/js/contextmenu/jquery.contextmenu.js"></script>
<script src="js/app/page.js"></script>
<script src="tinymce/tinymce.js"></script>
@ -1003,7 +1004,6 @@ initSlimScroll();
<!-- context-menu -->
<link rel="stylesheet" href="/js/contextmenu/css/contextmenu.css" type="text/css" />
<script src="/js/contextmenu/jquery.contextmenu.js"></script>
<!-- version 2.0 -->
<script src="/js/require.js"></script>

View File

@ -142,7 +142,7 @@
}
// 动画
.open > .dropdown-menu {
.open > .dropdown-menu, .dropdown-submenu:hover > .dropdown-menu {
-webkit-transform: scale(1, 1);
transform: scale(1, 1);
}
@ -200,4 +200,41 @@
margin: 3px auto;
border-color: #ebeff2;
box-shadow: none;
}
// blog
#noteItemList {
.item-setting, .item-blog {
position: absolute;
right: 1px;
font-size: 10px;
z-index: 2;
padding: 3px;
border-radius: 5px;
cursor: pointer;
.fa {
color: #fff !important;
}
width: 20px;
text-align: center;
opacity: 0.5;
&:hover {
opacity: 0.8;
}
background-color: #464C5E;
}
.item-blog {
top: 1px;
}
.item-setting {
bottom: 0;
display: none;
}
}
#noteItemList .item:hover {
.item-setting {
display: block;
}
}

File diff suppressed because one or more lines are too long

View File

@ -617,26 +617,7 @@ a.raw:hover {
color: #666;
}
}
// blog
#noteItemList .item-blog {
position: absolute;
right: 1px;
font-size: 10px;
z-index: 2;
top: 1px;
padding: 3px;
cursor: pointer;
.fa {
color: #fff !important;
}
width: 20px;
text-align: center;
opacity: 0.5;
&:hover {
opacity: 0.8;
}
background-color: #464C5E;
}
.item-title {
/*font-weight: 400;*/
font-size: 16px;

File diff suppressed because one or more lines are too long

View File

@ -582,26 +582,7 @@ border: 1px solid @borderColor;
color: #666;
}
}
// blog
#noteItemList .item-blog {
position: absolute;
right: 1px;
font-size: 10px;
z-index: 2;
top: 1px;
padding: 3px;
cursor: pointer;
.fa {
color: #fff !important;
}
width: 20px;
text-align: center;
opacity: 0.5;
&:hover {
opacity: 0.8;
}
background-color: #464C5E;
}
.item-title {
/*font-weight: 400;*/
font-size: 16px;

View File

@ -114,16 +114,21 @@ ul.ztree.zTreeDragUL {z-index: 333;margin:0; padding:0; position:absolute; width
.ztree.showIcon li a span.button.switch {visibility:visible}
.ztree li a.curSelectedNode {background-color:#eee;border:0;height:30px;}
.ztree li span {line-height:30px;}
.ztree li span.button {margin-top: -7px;}
.ztree li span.button.switch {width: 16px;height: 16px;}
.ztree li span.button {margin-top: -5px;}
.ztree li span.button.switch {width: 16px;height: 30px; line-height: 30px; text-align: center}
.ztree li a.level0 span {font-size: 14px;}
.ztree li span.button {background-image:url("./img/left_menuForOutLook.png");
*background-image:url("./img/left_menuForOutLook.gif")}
.ztree li span.button.switch.level0 {width: 20px; height:20px}
.ztree li span.button.switch.level1 {width: 20px; height:20px}
.ztree li span.button.noline_open {background-position: 0 0;}
.ztree li span.button.noline_close {background-position: -18px 0;}
.ztree li span.button {
background-image: none; /* url("./img/left_menuForOutLook.png"); */
}
.ztree li span.button.switch.level0 {width: 20px;}
.ztree li span.button.switch.level1 {width: 20px;}
.ztree li span.button.noline_open:before {
content: "\f107";
}
.ztree li span.button.noline_close:before {
content: "\f105";
}
.ztree li span.button.noline_open.level0 {background-position: 0 -18px;}
.ztree li span.button.noline_close.level0 {background-position: -18px -18px;}

View File

@ -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);
});
});
// 定时器启动

View File

@ -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();

View File

@ -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);

View File

@ -16,7 +16,7 @@
//default consts of core
_consts = {
className: {
BUTTON: "button",
BUTTON: "button fa",
LEVEL: "level",
ICO_LOADING: "ico_loading",
SWITCH: "switch"