batch mask contextmenu

This commit is contained in:
life
2015-10-24 19:19:27 +08:00
parent 0b071b7a44
commit e1c75a8861
4 changed files with 30 additions and 12 deletions

View File

@@ -292,7 +292,7 @@ function log(o) {
<div id="batchMask" class="note-mask"> <!-- z-index: 99 --> <div id="batchMask" class="note-mask"> <!-- z-index: 99 -->
<div class="batch-ctn" id="batchCtn"></div> <div class="batch-ctn" id="batchCtn"></div>
<div class="batch-info"> <div class="batch-info">
<span></span> notes selected <div class="batch-status"></div>
<p><i class="fa fa-cog"></i></p> <p><i class="fa fa-cog"></i></p>
</div> </div>
</div> </div>

View File

@@ -363,10 +363,13 @@ Note.curHasChanged = function(force) {
// 由content生成desc // 由content生成desc
// 换行不要替换 // 换行不要替换
Note.genDesc = function(content) { Note.genDesc = function(content, length) {
if(!content) { if(!content) {
return ""; return "";
} }
if (!length) {
length = 20;
}
// 将</div>, </p>替换成\n // 将</div>, </p>替换成\n
/* /*
@@ -401,10 +404,10 @@ Note.genDesc = function(content) {
content = content.replace(/</g, "&lt;"); content = content.replace(/</g, "&lt;");
content = content.replace(/>/g, "&gt;"); content = content.replace(/>/g, "&gt;");
if(content.length < 20) { if(content.length < length) {
return content; return content;
} }
return content.substring(0, 20); return content.substring(0, length);
} }
// 得到摘要 // 得到摘要
@@ -2398,7 +2401,8 @@ Note.initContextmenu = function() {
} }
} }
this.menu.popup(gui.getCurrentWindow(), e.originalEvent.x, e.originalEvent.y); // this.menu.popup(gui.getCurrentWindow(), e.originalEvent.x, e.originalEvent.y);
this.menu.popup(gui.getCurrentWindow(), e.pageX, e.pageY);
} }
} }
@@ -2976,6 +2980,7 @@ Note.batch = {
}); });
me.initContextmenu(); me.initContextmenu();
me.initBatchStatus();
}, },
initContextmenu: function () { initContextmenu: function () {
@@ -2983,19 +2988,19 @@ Note.batch = {
me.$batchMask.on('contextmenu', function (e) { me.$batchMask.on('contextmenu', function (e) {
e.preventDefault(); e.preventDefault();
!Note.nowIsInShared ? Note.contextmenu.showMenu(e) : Share.contextmenu.showMenu(e); Note.noteMenuSys.popup(e, null);
}); });
me.$batchMask.find('.batch-info .fa').click(function (e) { me.$batchMask.find('.batch-info .fa').click(function (e) {
e.preventDefault(); e.preventDefault();
e.pageX -= 90;
e.pageX -= 70;
e.pageY += 10; e.pageY += 10;
// 这导致其它dropdown不能隐藏
e.stopPropagation(); e.stopPropagation();
// 所以 // 所以
$(document).click(); $(document).click();
!Note.nowIsInShared ? Note.contextmenu.showMenu(e) : Share.contextmenu.showMenu(e); Note.noteMenuSys.popup(e, null);
}); });
}, },
@@ -3087,7 +3092,12 @@ Note.batch = {
}, },
$batchMask: $('#batchMask'), $batchMask: $('#batchMask'),
$batchCtn: $('#batchCtn'), $batchCtn: $('#batchCtn'),
$batchNum: $('#batchMask .batch-info span'),
initBatchStatus: function () {
$('#batchMask .batch-status').html(getMsg('<span></span> notes selected'));
this.$batchNum = $('#batchMask .batch-info span');
},
_i: 1, _i: 1,
getRotate: function () { getRotate: function () {
var me = this; var me = this;
@@ -3109,6 +3119,8 @@ Note.batch = {
var note = Note.getNote(noteId); var note = Note.getNote(noteId);
var title = note.Title || getMsg('unTitled'); var title = note.Title || getMsg('unTitled');
var desc = note.Desc || '...'; var desc = note.Desc || '...';
// desc = substr(note.Content, 0, 200);
var $note = $('<div class="batch-note"><div class="title">' + title + '</div><div class="content">' + desc + '</div></div>'); var $note = $('<div class="batch-note"><div class="title">' + title + '</div><div class="content">' + desc + '</div></div>');
me._notes[noteId] = $note; me._notes[noteId] = $note;
var rotate = me.getRotate(); var rotate = me.getRotate();

View File

@@ -203,6 +203,7 @@
"Delete": "删除", "Delete": "删除",
"Remove": "移除", "Remove": "移除",
"Export": "导出", "Export": "导出",
"Export note": "导出笔记",
"Histories": "历史记录", "Histories": "历史记录",
"Created": "创建", "Created": "创建",
"Updated": "更新", "Updated": "更新",
@@ -278,6 +279,8 @@
"Confirm password": "确认密码", "Confirm password": "确认密码",
"Username": "用户名", "Username": "用户名",
"User exists": "用户已存在", "User exists": "用户已存在",
"Local": "本地" "Local": "本地",
"Please select a note firstly.": "请先选择一个笔记",
"<span></span> notes selected": "当前选中了 <span></span> 篇笔记"
} }

View File

@@ -203,6 +203,7 @@
"Delete": "刪除", "Delete": "刪除",
"Remove": "移除", "Remove": "移除",
"Export": "導出", "Export": "導出",
"Export note": "導出筆記",
"Histories": "歷史記錄", "Histories": "歷史記錄",
"Created": "創建", "Created": "創建",
"Updated": "更新", "Updated": "更新",
@@ -278,6 +279,8 @@
"Confirm password": "確認密碼", "Confirm password": "確認密碼",
"Username": "用戶名", "Username": "用戶名",
"User exists": "用戶已存在", "User exists": "用戶已存在",
"Local": "本地" "Local": "本地",
"Please select a note firstly.": "請先選擇壹個筆記",
"<span></span> notes selected": "當前選中了 <span></span> 篇筆記"
} }