diff --git a/node_modules/note.js b/node_modules/note.js index c16a3e5e..8c4e27ab 100644 --- a/node_modules/note.js +++ b/node_modules/note.js @@ -10,6 +10,8 @@ var Notebook = require('notebook'); var Server = require('server'); var Common = require('common'); var Web = require('web'); +var async = require('async'); + // var Notes = db.notes; var Api = null; // require('api') @@ -368,22 +370,44 @@ var Note = { // 移动note // 重新统计另一个notebookId的笔记数 - moveNote: function(noteId, notebookId, callback) { + moveNote: function(noteIds, notebookId, callback) { var me = this; - me.getNote(noteId, function(note) { - if(note) { - var to = !note.Star; - var preNotebookId = note.NotebookId; - note.NotebookId = notebookId; - db.notes.update({_id: note._id}, {$set: {IsDirty: true, NotebookId: notebookId, IsTrash: false, LocalIsDelete: false, UpdatedTime: new Date()}}, function(err, n) { - // 重新统计 - Notebook.reCountNotebookNumberNotes(preNotebookId); - Notebook.reCountNotebookNumberNotes(notebookId); - callback(note); - }); - } else { - callback(false); + if (!noteIds) { + callback(false); + return; + } + + var preNotebookIds = {}; + async.eachSeries(noteIds, function(noteId, cb) { + me.getNote(noteId, function(note) { + if(note) { + // var to = !note.Star; + // 是原笔记本 + var preNotebookId = note.NotebookId; + if (preNotebookId == notebookId && !note.IsTrash) { + cb(); + return; + } + preNotebookIds[preNotebookId] = true; + note.NotebookId = notebookId; + db.notes.update({_id: note._id}, {$set: {IsDirty: true, NotebookId: notebookId, IsTrash: false, LocalIsDelete: false, UpdatedTime: new Date()}}, function(err, n) { + cb(); + }); + } else { + cb(); + } + }); + + }, function () { + // 重新统计 + for (var i in preNotebookIds) { + Notebook.reCountNotebookNumberNotes(i); } + if (!preNotebookIds[notebookId]) { + Notebook.reCountNotebookNumberNotes(notebookId); + } + + callback(true); }); }, diff --git a/note.html b/note.html index 128ce023..d0b53b33 100755 --- a/note.html +++ b/note.html @@ -272,13 +272,13 @@ function log(o) {
-
+

loading...
-
+
noNoteNewNoteTips

@@ -288,6 +288,15 @@ function log(o) {
canntNewNoteTips
+ +
+
+
+ notes selected +

+
+
+
diff --git a/public/js/app/note.js b/public/js/app/note.js index 757cc5aa..1a7d03f1 100644 --- a/public/js/app/note.js +++ b/public/js/app/note.js @@ -15,18 +15,19 @@ Note.interval = ""; // 定时器 Note.itemIsBlog = '
'; // for render -Note.itemTplNoImg = '
  • ' +Note.itemTplNoImg = '
  • ' Note.itemTplNoImg += Note.itemIsBlog +'

    ?

    ? ?

    ?

  • '; // 有image -Note.itemTpl = '
  • ' +Note.itemTpl = '
  • ' Note.itemTpl +=Note.itemIsBlog + '

    ?

    ? ?

    ?

  • '; // for new -Note.newItemTpl = '
  • ' +Note.newItemTpl = '
  • ' Note.newItemTpl += Note.itemIsBlog + '

    ?

    ? ?

    ?

  • '; Note.noteItemListO = $("#noteItemList"); +Note.$itemList = $('#noteItemList'); // notbeookId => {"updatedTime" => [noteId1, noteId2], "title" => [noteId1, noteId2...]} 排序方式分组 // 一旦某notebook改变了就清空, 重新排序之. (用js排) @@ -85,7 +86,14 @@ Note.setNoteCache = function(content, clear) { // 删除缓存 Note.deleteCache = function(noteId) { delete this.cache[noteId]; -} +}; + +Note.setCurNoteId = function (noteId) { + this.curNoteId = noteId; +}; +Note.clearCurNoteId = function () { + this.curNoteId = null; +}; // 得到当前的笔记 Note.getCurNote = function() { @@ -98,7 +106,11 @@ Note.getCurNote = function() { Note.getNote = function(noteId) { var self = this; return self.cache[noteId]; -} +}; + +Note.getTargetById = function(noteId) { + return this.$itemList.find('li[noteId="' + noteId + '"]'); +}; // 每当有notebookId相应的note改变时都要重新清空之 // 并设置该notebookId有值 @@ -568,23 +580,24 @@ Note.startUpdatePoolNoteInterval = function() { }, 1000); }; - -// 选中note -Note.selectTarget = function(target) { +Note.clearSelect = function(target) { $(".item").removeClass("item-active"); +}; +Note.selectTarget = function(target) { + this.clearSelect(); $(target).addClass("item-active"); // 判断是否在star中 var noteId = $(target).attr('noteId'); Note.selectStar(noteId); -} +}; // 改变note // 可能改变的是share note // 1. 保存之前的note // 2. ajax得到现在的note Note.showContentLoading = function() { - $("#noteMaskForLoading").css("z-index", 99999); + $("#noteMaskForLoading").css("z-index", 11); }; Note.hideContentLoading = function() { $("#noteMaskForLoading").css("z-index", -1); @@ -620,6 +633,9 @@ Note.directToNote = function(noteId) { // needTargetNobook默认为false, 在点击notebook, renderfirst时为false Note.changeNoteForPjax = function(noteId, mustPush, needTargetNotebook) { var me = this; + if (!noteId) { + return; + } var note = me.getNote(noteId); if(!note) { return; @@ -674,12 +690,14 @@ Note.setCurNoteId = function(noteId) { }; Note.changeNote = function(selectNoteId, isShare, needSaveChanged, callback) { var self = this; - + if (!selectNoteId) { + return; + } // -1 停止定时器 Note.stopInterval(); // 0 - var target = $(tt('[noteId="?"]', selectNoteId)) + var target = self.getTargetById(selectNoteId); Note.selectTarget(target); // 1 之前的note, 判断是否已改变, 改变了就要保存之 @@ -697,7 +715,10 @@ Note.changeNote = function(selectNoteId, isShare, needSaveChanged, callback) { // 2 得到现在的 // ajax之 - var cacheNote = Note.cache[selectNoteId]; + var cacheNote = self.getNote(selectNoteId); + if (!cacheNote) { + return; + } var hasPerm = true; // !isShare || Share.hasUpdatePerm(selectNoteId); // 不是共享, 或者是共享但有权限 @@ -932,13 +953,16 @@ Note.showEditorMask = function() { } Note.hideEditorMask = function() { $("#editorMask").css("z-index", -10).hide(); -} +}; // 这里如果notes过多>100个将会很慢!!, 使用setTimeout来分解 Note.renderNotesC = 0; Note.renderNotes = function(notes, forNewNote, isShared) { var renderNotesC = ++Note.renderNotesC; + this.clearSeqForNew(); + this.batch.reset(); + // 手机端不用 // slimScroll使得手机端滚动不流畅 if(!LEA.isMobile && !Mobile.isMobile()) { @@ -1045,9 +1069,9 @@ Note._renderNotes = function(notes, forNewNote, isShared, tang) { // 第几趟 var tmp; if(note.ImgSrc) { - tmp = tt(Note.itemTpl, classes, note.NoteId, note.ImgSrc, note.Title, Notebook.getNotebookTitle(note.NotebookId), goNowToDatetime(note.UpdatedTime), note.Desc); + tmp = tt(Note.itemTpl, classes, i, note.NoteId, note.ImgSrc, note.Title, Notebook.getNotebookTitle(note.NotebookId), goNowToDatetime(note.UpdatedTime), note.Desc); } else { - tmp = tt(Note.itemTplNoImg, classes, note.NoteId, note.Title, Notebook.getNotebookTitle(note.NotebookId), goNowToDatetime(note.UpdatedTime), note.Desc); + tmp = tt(Note.itemTplNoImg, classes, i, note.NoteId, note.Title, Notebook.getNotebookTitle(note.NotebookId), goNowToDatetime(note.UpdatedTime), note.Desc); } if(!note.IsBlog) { tmp = $(tmp); @@ -1087,7 +1111,15 @@ Note._renderNotes = function(notes, forNewNote, isShared, tang) { // 第几趟 } */ } -} +}; + +Note._seqForNew = 0; +Note.clearSeqForNew = function () { + this._seqForNew = 0; +}; +Note.newNoteSeq = function () { + return --this._seqForNew; +}; // 新建一个笔记 // 要切换到当前的notebook下去新建笔记 @@ -1133,9 +1165,9 @@ Note.newNote = function(notebookId, isShare, fromUserId, isMarkdown) { var notebookTitle = notebook ? notebook.Title : ""; var curDate = getCurDatetime(); if(isShare) { - newItem = tt(Note.newItemTpl, baseClasses, fromUserId, note.NoteId, note.Title, notebookTitle, curDate, ""); + newItem = tt(Note.newItemTpl, baseClasses, this.newNoteSeq(), fromUserId, note.NoteId, note.Title, notebookTitle, curDate, ""); } else { - newItem = tt(Note.newItemTpl, baseClasses, "", note.NoteId, note.Title, notebookTitle, curDate, ""); + newItem = tt(Note.newItemTpl, baseClasses, this.newNoteSeq(), "", note.NoteId, note.Title, notebookTitle, curDate, ""); } // notebook是否是Blog @@ -1320,7 +1352,59 @@ Note.changeToNext = function(target) { } Note.changeNote(next.attr("noteId")); -} +}; + +// 要删除noteIds, 找下一个可以的 +Note.changeToNextSkipNotes = function(noteIds) { + var me = Note; + if (isEmpty(noteIds)) { + return; + } + + // 全删除了 + if (me.$itemList.find('li').length == noteIds.length) { + me.showEditorMask(); + return; + } + + // 如果只有一个笔记, 且当前活跃的又不是要删除的, 则不用change + if (noteIds.length == 1) { + var $actives = me.$itemList.find('.item-active'); + if ($actives.length == 1 && $actives.attr('noteId') != noteIds[0]) { + return; + } + } + + var $start = me.getTargetById(noteIds[0]); + var $next = $start.next(); + var i = 1; + var len = noteIds.length; + var find = false; + while($next.length) { + // 超出了noteIds + if (i >= len) { + find = true; + break; + } + // 不在删除的列表中 + if ($next.attr('noteId') != me.getTargetById(noteIds[i]).attr('noteId')) { + find = true; + break; + } + + $next = $next.next(); + i++; + } + + // 找不到, 证明是要到前一个了 + if (!find) { + $next = $start.prev(); + } + + if ($next) { + me.changeNote($next.attr("noteId")); + } +}; // 删除笔记 // 1. 先隐藏, 成功后再移除DOM @@ -1608,6 +1692,85 @@ Note.setAllNoteBlogStatus = function(notebookId, isBlog) { // 移动 Note.moveNote = function(target, data) { + var me = Note; + // 批量操作 + var noteIds; + if (Note.inBatch) { + noteIds = me.getBatchNoteIds(); + } + else { + noteIds = [$(target).attr('noteId')]; + } + + // 当前在该笔记本下 + var toNotebookId = data.notebookId; + if (Notebook.getCurNotebookId() == toNotebookId) { + return; + } + + if (noteIds.length == 1) { + var note = me.getNote(noteIds[0]); + if(!note.IsTrash && note.NotebookId == toNotebookId) { + return; + } + } + + NoteService.moveNote(noteIds, toNotebookId, function(ret) { + if(ret) { + me.clearCacheByNotebookId(toNotebookId); + + for (var i = 0; i < noteIds.length; ++i) { + var noteId = noteIds[i]; + var note = me.getNote(noteId); + if (note) { + // 修改笔记数量 + if (note.NotebookId != toNotebookId) { + Notebook.incrNotebookNumberNotes(toNotebookId); + if (!note.IsTrash) { + Notebook.minusNotebookNumberNotes(note.NotebookId); + } + } + else if (note.IsTrash) { + Notebook.incrNotebookNumberNotes(note.NotebookId); + } + + me.clearCacheByNotebookId(note.NotebookId); + + // 设置缓存 + note.NotebookId = toNotebookId; + note.IsTrash = false; + note.UpdatedTime = new Date(); + me.setNoteCache(note); + } + } + + var $actives; + if(noteIds.length == 1) { + $actives = target; + } + else { + $actives = me.$itemList.find('.item-active'); + } + // 不在all下, 就删除之 + if(!Notebook.curActiveNotebookIsAll()) { + me.changeToNextSkipNotes(noteIds); + $actives.remove(); + } + // 在all下, 不要删除 + else { + // 不移动, 那么要改变其notebook title + $actives.find(".note-notebook").html(Notebook.getNotebookTitle(toNotebookId)); + + me.changeNote($actives.eq(0).attr('noteId')); + } + } + }); + + // 重置, 因为可能移动后笔记下没笔记了 + me.batch.reset(); + + return; + var noteId = $(target).attr("noteId"); var note = Note.cache[noteId]; var notebookId = data.notebookId; @@ -2563,41 +2726,429 @@ var Attach = { } } } -} +}; + +//=============== + +// 批量操作 +Note.inBatch = false; +Note.getBatchNoteIds = function () { + var noteIds = []; + var items = Note.$itemList.find('.item-active'); + for (var i = 0; i < items.length; ++i) { + noteIds.push(items.eq(i).attr('noteId')); + } + return noteIds; +}; +Note.batch = { + $noteItemList: $("#noteItemList"), + + cancelInBatch: function () { + Note.inBatch = false; + }, + setInBatch: function () { + Note.inBatch = true; + }, + + // 是否是多选, 至少选了2个 + isInBatch: function () { + var me = this; + var items = me.$noteItemList.find('.item-active'); + if (items.length >= 2) { + return true; + } + return false; + }, + + // 得到开始的笔记 + _startNoteO: null, // 开始选择的笔记 + getStartNoteO: function () { + var me = this; + if (!me._startNoteO) { + me._startNoteO = me.getCurSelected(); + } + return me._startNoteO; + }, + + // 清空以start开头已选择的 + // 用于shift + _selectByStart: {}, // start.NoteId => [target1, target2] + clearByStart: function (noteId) { + var me = this; + if (!noteId) { + return; + } + var targets = this._selectByStart[noteId]; + if (isEmpty(targets)) { + return; + } + for(var i = 0; i < targets.length; ++i) { + me.clearTarget(targets[i]); + } + }, + selectTo: function ($to) { + var $start = this.getStartNoteO(); + if (!$start) { + alert('nono start'); + } + + var startSeq = +$start.data('seq'); + var toSeq = +$to.data('seq'); + + var $start2, $to2, startSeq2, toSeq2; + if (startSeq < toSeq) { + $start2 = $start; + $to2 = $to; + startSeq2 = startSeq; + toSeq2 = toSeq; + } + else { + $start2 = $to; + $to2 = $start; + startSeq2 = toSeq; + toSeq2 = startSeq; + } + + // 先清空之 + // 清空以$start为首的, 已选的笔记 + var startNoteId = $start.attr('noteId'); + this.clearByStart(startNoteId); + + var $now = $start2; + this._selectByStart[startNoteId] = []; + for (var i = startSeq2; i <= toSeq2; ++i) { + this.selectTarget($now); + this._selectByStart[startNoteId].push($now); + $now = $now.next(); + } + }, + + selectAll: function () { + this.$noteItemList.find('li').addClass('item-active'); + }, + + clearAllSelect: function () { + Note.clearSelect(); + }, + + selectTarget: function ($target) { + if ($target) { + $target.addClass('item-active'); + } + }, + clearTarget: function ($target) { + if ($target) { + $target.removeClass('item-active'); + } + }, + + // multi操作 + // 选择之某一 + // 如果之前已选择了, 则取消选择 + select: function ($target) { + var me = this; + // 之前已选中 + if ($target.hasClass('item-active')) { + var isInBatch = this.isInBatch(); + if (isInBatch) { + $target.removeClass('item-active'); + } + } + else { + me._startNoteO = $target; + this.selectTarget($target); + } + }, + + // 得到当前选中的元素 + getCurSelected: function () { + return this.$noteItemList.find('.item-active'); + }, + + // 当重新render后 + reset: function () { + this.cancelInBatch(); + this._selectByStart = {}; + this._startMove = false; + this._startNoteO = null; + this.clearRender(); + }, + + // 可以多选 + canBatch: function () { + return !Writting.isWriting(); + }, + + init: function() { + var me = this; + me.$noteItemList.on("click", ".item", function(e) { + var $this = $(this); + var noteId = $this.attr("noteId"); + if(!noteId) { + return; + } + + var isMulti = false; + var isConti= false; + if (me.canBatch()) { + if (e.shiftKey) { + isConti = true; + } + else { + isMulti = e.metaKey || e.ctrlKey; + } + } + + //---------- + // 多选操作 + //---------- + + if (isMulti || isConti) { + Note.curChangedSaveIt(); + } + + // 多选 + if (isMulti) { + me.select($this); + + // 连续选 + } else if (isConti) { + // 选择 开始位置到结束位置 + // 当前点击的是结束位置 + me.selectTo($this); + } + + //--------- + // 单选 + //--------- + + // 否则, 不是多选, 清空item-active + else { + Note.selectTarget($this); + } + + me.finalFix(); + }); + + //---------- + + // 鼠标拖动开始 + me._startMove = false; + me.$noteItemList.on("mousedown", ".item", function(e) { + if (!me.canBatch()) { + return; + } + + // 右键 + if (me.isContextMenu(e)) { + return; + } + + if (!me._startMove && (e.metaKey || e.ctrlKey || e.shiftKey)) { + return; + } + + me._startNoteO = $(this); + me._startMove = true; + }); + + // 鼠标正在拖动 + me.$noteItemList.on("mousemove", ".item", function(e) { + if (me.canBatch() && me._startMove) { + + Note.curChangedSaveIt(); + + me.clearAllSelect(); + + me.selectTo($(this)); + + me.finalFix(true); + } + }); + + var $body = $('body'); + $body.on('mouseup', function() { + me._startMove = false; + }); + + // ctrl + all + $body.keydown(function (e) { + if (e.target && e.target.nodeName === 'BODY') { + if ((e.ctrlKey || e.metaKey) && e.which === 65) { + e.preventDefault(); + + if(me.canBatch()) { + Note.curChangedSaveIt(); + + me.selectAll(); + me.finalFix(); + } + } + } + }); + + // 不让拖动 + me.$noteItemList.on("dragstart", function(e) { + e.preventDefault(); + e.stopPropagation(); + }); + + me.initContextmenu(); + }, + + initContextmenu: function () { + var me = this; + + me.$batchMask.on('contextmenu', function (e) { + e.preventDefault(); + !Note.nowIsInShared ? Note.contextmenu.showMenu(e) : Share.contextmenu.showMenu(e); + }); + + me.$batchMask.find('.batch-info .fa').click(function (e) { + e.preventDefault(); + e.pageX -= 90; + e.pageY += 10; + + // 这导致其它dropdown不能隐藏 + e.stopPropagation(); + // 所以 + $(document).click(); + !Note.nowIsInShared ? Note.contextmenu.showMenu(e) : Share.contextmenu.showMenu(e); + }); + }, + + $body: $('body'), + finalFix: function (isMove) { + var me = this; + // 选择了几个? 如果 >= 2则是批量操作 + if (me.isInBatch()) { + // 清空当前笔记, 不让自动保存 + Note.clearCurNoteId(); + + me.$body.addClass('batch'); + me.renderBatchNotes(); + + me.setInBatch(); + + // 单个处理 + } else { + me.$body.removeClass('batch'); + me.clearRender(); + me.cancelInBatch(); + + // 为什么还要得到当前选中的, 因为有可能是取消选择 + // 得到当前选中的 + var $target = me.getCurSelected(); + if ($target) { + var noteId = $target.attr('noteId'); + + if (!isMove) { + me._startNoteO = $target; + } + + // 手机端处理 + Mobile.changeNote(noteId); + // 当前的和所选的是一个, 不改变 + if(Note.curNoteId != noteId) { + // 不用重定向到notebook + Note.changeNoteForPjax(noteId, true, false); + } + } + } + }, + + // 判断是否是右击 + isContextMenu: function(evt) { + if((evt.which != undefined && evt.which==1) || evt.button == 1) + return false; + else if((evt.which != undefined && evt.which == 3) || evt.button == 2) + return true; + return false; + }, + + //========== + _notes: {}, + clearRender: function () { + this._notes = {}; + this.$batchCtn.html(''); + this.hideMask(); + }, + showMask: function () { + this.$batchMask.css({'z-index': 99}).show(); + }, + hideMask: function () { + this.$batchMask.css({'z-index': -2}).hide(); + }, + renderBatchNotes: function () { + var me = this; + me.showMask(); + + var selectedTargets = me.$noteItemList.find('.item-active'); + me.$batchNum.html(selectedTargets.length); + + var ids = {}; + for (var i = 0; i < selectedTargets.length; ++i) { + var noteId = selectedTargets.eq(i).attr('noteId'); + me.addTo(noteId); + ids[noteId] = 1; + } + for (var noteId in me._notes) { + if (!ids[noteId]) { + var $tmp = me._notes[noteId]; + $tmp.css({'margin-left': '-800px'/*, 'margin-top': '100px'*/}); + setTimeout(function() { + $tmp.remove(); + }, 500); + delete me._notes[noteId]; + } + } + }, + $batchMask: $('#batchMask'), + $batchCtn: $('#batchCtn'), + $batchNum: $('#batchMask .batch-info span'), + _i: 1, + getRotate: function () { + var me = this; + var time = me._i++; + var e = time % 2 === 0 ? 1 : -1; + var rotate = e * Math.random() * 70; + var margins = [0, 10, 20, 30, 40]; + var margin = e * margins[time % 5] * 3; + // if (e < 0) { + margin -= 80; + // } + return [e * Math.random() * 30, margin]; + }, + addTo: function(noteId) { + var me = this; + if (me._notes[noteId]) { + return; + } + var note = Note.getNote(noteId); + var title = note.Title || getMsg('unTitled'); + var desc = note.Desc || '...'; + var $note = $('
    ' + title + '
    ' + desc + '
    '); + me._notes[noteId] = $note; + var rotate = me.getRotate(); + me.$batchCtn.append($note); + setTimeout(function () { + $note.css({transform: 'rotate(' + rotate[0] + 'deg)', 'margin-left': rotate[1] + 'px'}); + }); + } +}; //------------------- 事件 $(function() { // 附件初始化 Attach.init(); - $("#noteItemList").on("click", ".item", function(event) { - // event.stopPropagation(); - var noteId = $(this).attr("noteId"); - - // 手机端处理 - // Mobile.changeNote(noteId); - - if(!noteId) { - return; - } - // 当前的和所选的是一个, 不改变 - if(Note.curNoteId != noteId) { - // 不用重定向到notebook - Note.changeNoteForPjax(noteId, true, false); - } - }); + Note.batch.init(); // 当前笔记可以已修改 $('#editorContent, #wmd-input, #noteTitle').keyup(function() { Note.curNoteIsDirtied(); }); - /* - $('#addTagInput').click(function() { - Note.curNoteIsDirtied(); - }); - */ - //------------------ // 新建笔记 // 1. 直接点击新建 OR @@ -2646,15 +3197,6 @@ $(function() { } }); - //-------------------- - // Note.initContextmenu(); - - //------------ - // 文档历史 - // $("#contentHistory").click(function() { - // Note.listNoteContentHistories() - // }); - $("#saveBtn").click(function() { Note.curChangedSaveIt(true); }); diff --git a/public/js/app/notebook.js b/public/js/app/notebook.js index ab194830..233769fd 100644 --- a/public/js/app/notebook.js +++ b/public/js/app/notebook.js @@ -632,7 +632,8 @@ Notebook.toggleToMyNav = function(userId, notebookId) { // 搜索tag隐藏 $("#tagSearch").hide(); -} +}; + Notebook.changeNotebookNav = function(notebookId) { Notebook.curNotebookId = notebookId; Notebook.toggleToMyNav(); @@ -651,19 +652,22 @@ Notebook.changeNotebookNav = function(notebookId) { // 3 Notebook.changeNotebookNavForNewNote(notebookId, notebook.Title); -} +}; Notebook.isAllNotebookId = function(notebookId) { return notebookId == Notebook.allNotebookId; -} +}; Notebook.isTrashNotebookId = function(notebookId) { return notebookId == Notebook.trashNotebookId; -} +}; // 当前选中的笔记本是否是"所有" // called by Note Notebook.curActiveNotebookIsAll = function() { - return Notebook.isAllNotebookId($("#notebookList .active").attr("notebookId")); -} + return Notebook.isAllNotebookId($("#notebookList .curSelectedNode").attr("notebookId")); +}; +Notebook.curActiveNotebookIsTrash = function() { + return Notebook.isTrashNotebookId($("#notebookList .curSelectedNode").attr("notebookId")); +}; // 改变笔记本 // 0. 改变样式 diff --git a/public/themes/basic.less b/public/themes/basic.less index b3f94229..e7cd7b6e 100644 --- a/public/themes/basic.less +++ b/public/themes/basic.less @@ -469,7 +469,20 @@ h1, h2, h3 { } // blog +#noteItemList .item:hover { + .item-setting, .item-star, .item-blog { + display: block; + } + &.item-conflict { + .item-conflict-info { + display: block; + } + } +} #noteItemList { + user-select: none; + -webkit-user-select: none; + -moz-user-select: none; .item-setting, .item-blog, .item-star, .item-conflict-info { position: absolute; right: 1px; @@ -527,18 +540,25 @@ h1, h2, h3 { color: yellow !important; } } - } } -#noteItemList .item:hover { - .item-setting, .item-star, .item-blog { - display: block; - } - &.item-conflict { - .item-conflict-info { - display: block; - } - } + +// 当是批量操作时, 隐藏之 +.batch { + #noteItemList { + .item-active, + .item-active:hover { + // .item-blog, + .item-setting, + .item-star, + .item-conflict-info { + display: none; + } + } + } + #tool { + display: none; + } } // share @@ -1156,7 +1176,9 @@ h1, h2, h3 { } } .note-mask { - position: absolute; top: 0px; bottom: 0px; right: 0; left: 3px; z-index: -1; + position: absolute; top: 0px; bottom: 0px; right: 0; + left: 0; + z-index: -1; } #noteMaskForLoading { padding-top: 60px; @@ -1986,5 +2008,59 @@ img::selection { } } +//--------- +// batch + +#batchMask { + background: #fff; + user-select: none; + -webkit-user-select: none; + -moz-user-select: none; + // z-index: 10; +} +.batch-ctn { + position: relative; + padding: 50px; + width: 100%; + height: 100%; +} +.batch-note { + display: inline-block; + width: 160px; + position: absolute; + left: 50%; + // margin-left: -80px; + border: 1px solid #ccc; + height: 200px; + padding: 5px; + border-radius: 5px; + background: #eee; + // transform: rotate(-30deg); + overflow: hidden; + transition: margin 0.5s; + margin-left: -1000px; + .title { + font-size: 16px; + margin-bottom: 5px; + font-weight: bold; + } +} +.batch-info { + position: absolute; + left: 0; + top: 0; + right: 0; + text-align: center; + margin-top: 300px; + // 设置 + p { + margin-top: 8px; + } + .fa { + cursor: pointer; + font-size: 16px; + } +} + @import '../css/traffic.less'; @import '../css/ani.less'; diff --git a/public/themes/default.css b/public/themes/default.css index d224635b..49986a27 100644 --- a/public/themes/default.css +++ b/public/themes/default.css @@ -436,6 +436,19 @@ h3 { border-color: #ebeff2; box-shadow: none; } +#noteItemList .item:hover .item-setting, +#noteItemList .item:hover .item-star, +#noteItemList .item:hover .item-blog { + display: block; +} +#noteItemList .item:hover.item-conflict .item-conflict-info { + display: block; +} +#noteItemList { + user-select: none; + -webkit-user-select: none; + -moz-user-select: none; +} #noteItemList .item-setting, #noteItemList .item-blog, #noteItemList .item-star, @@ -492,13 +505,16 @@ h3 { #noteItemList .item-is-star .item-star .fa { color: yellow !important; } -#noteItemList .item:hover .item-setting, -#noteItemList .item:hover .item-star, -#noteItemList .item:hover .item-blog { - display: block; +.batch #noteItemList .item-active .item-setting, +.batch #noteItemList .item-active:hover .item-setting, +.batch #noteItemList .item-active .item-star, +.batch #noteItemList .item-active:hover .item-star, +.batch #noteItemList .item-active .item-conflict-info, +.batch #noteItemList .item-active:hover .item-conflict-info { + display: none; } -#noteItemList .item:hover.item-conflict .item-conflict-info { - display: block; +.batch #tool { + display: none; } .friend-header { position: relative; @@ -1072,7 +1088,7 @@ h3 { top: 0px; bottom: 0px; right: 0; - left: 3px; + left: 0; z-index: -1; } #noteMaskForLoading { @@ -1743,6 +1759,52 @@ img::selection { opacity: 1; right: 5px; } +#batchMask { + background: #fff; + user-select: none; + -webkit-user-select: none; + -moz-user-select: none; +} +.batch-ctn { + position: relative; + padding: 50px; + width: 100%; + height: 100%; +} +.batch-note { + display: inline-block; + width: 160px; + position: absolute; + left: 50%; + border: 1px solid #ccc; + height: 200px; + padding: 5px; + border-radius: 5px; + background: #eee; + overflow: hidden; + transition: margin 0.5s; + margin-left: -1000px; +} +.batch-note .title { + font-size: 16px; + margin-bottom: 5px; + font-weight: bold; +} +.batch-info { + position: absolute; + left: 0; + top: 0; + right: 0; + text-align: center; + margin-top: 300px; +} +.batch-info p { + margin-top: 8px; +} +.batch-info .fa { + cursor: pointer; + font-size: 16px; +} .win-tool { padding: 5px; position: absolute;