diff --git a/src/node_modules/note.js b/src/node_modules/note.js index efe34ecb..75c1b4eb 100644 --- a/src/node_modules/note.js +++ b/src/node_modules/note.js @@ -177,13 +177,13 @@ var Note = { db.noteHistories.findOne({_id: noteId}, function(err, history) { // 新建之 if(!history) { - db.noteHistories.insert({_id: noteId, Histories: [content]}); + db.noteHistories.insert({_id: noteId, Histories: [content], "UpdatedTime": new Date()}); } // 更新之 else { var histories = history.Histories; histories.push(content); - db.noteHistories.update({_id: noteId}, {$set: {Histories: histories}}); + db.noteHistories.update({_id: noteId}, {$set: {Histories: histories, "UpdatedTime": new Date()}}); } }); }, diff --git a/src/note.html b/src/note.html index d1a71286..3e246c8f 100755 --- a/src/note.html +++ b/src/note.html @@ -286,13 +286,13 @@ function log(o) {
- +
-
  • -
  • @@ -608,7 +608,6 @@ function log(o) { - + diff --git a/src/public/js/app/native.js b/src/public/js/app/native.js index 3ce82878..1c33e78d 100644 --- a/src/public/js/app/native.js +++ b/src/public/js/app/native.js @@ -59,12 +59,12 @@ $(function() { FileService.download(downloadImgPath, name, function(ok, msg) { // console.log(ok + ' -=-'); if(ok) { - new window.Notification('Info', { - body: 'Image saved successful!', + new window.Notification(getMsg('Info'), { + body: getMsg('Image saved successful!'), }); } else { - new window.Notification('Warning', { - body: msg || 'Image saved failure!', + new window.Notification(getMsg('Warning'), { + body: getMsg(msg || 'Image saved failure!'), }); } }); @@ -80,19 +80,19 @@ $(function() { function Menu() { this.menu = new gui.Menu(); this.cut = new gui.MenuItem({ - label: 'Cut', + label: getMsg('Cut'), click: function() { document.execCommand('cut'); } }); this.copy = new gui.MenuItem({ - label: 'Copy', + label: getMsg('Copy'), click: function() { document.execCommand('copy'); } }); this.paste = new gui.MenuItem({ - label: 'Paste', + label: getMsg('Paste'), click: function() { // document.execCommand("selectAll"); document.execCommand('paste'); @@ -100,13 +100,13 @@ function Menu() { }); this.saveAs = new gui.MenuItem({ - label: 'Save as', + label: getMsg('Save as'), click: function() { // document.execCommand("selectAll"); // document.execCommand('paste'); var src = $curTarget.attr('src'); if(!src) { - alert('error'); + alert(getMsg('Error')); } // 得到图片, 打开dialog FileService.downloadImg(src, function(curPath) { @@ -122,7 +122,7 @@ function Menu() { // alert('File not exists'); // https://github.com/nwjs/nw.js/wiki/Notification var notification = new window.Notification('Warning', { - body: 'File not exists', + body: getMsg('File not exists'), // icon: appIcon }); } @@ -131,7 +131,7 @@ function Menu() { }); this.openInBrowser = new gui.MenuItem({ - label: 'Open link in browser', + label: getMsg('Open link in browser'), click: function() { // document.execCommand("selectAll"); // document.execCommand('paste'); @@ -173,7 +173,6 @@ Menu.prototype.popup = function(x, y) { this.menu.popup(x, y); }; var menu = new Menu(); -var FS = require('fs'); // 右键菜单 var winHref = ''; diff --git a/src/public/js/app/note.js b/src/public/js/app/note.js index 64d92eed..34cf36a7 100644 --- a/src/public/js/app/note.js +++ b/src/public/js/app/note.js @@ -12,7 +12,7 @@ Note.curNoteId = ""; Note.interval = ""; // 定时器 // 这里, settings, blog, star -Note.itemIsBlog = '
    '; +Note.itemIsBlog = '
    '; // for render Note.itemTplNoImg = '
  • ' @@ -1442,7 +1442,7 @@ Note.listNoteContentHistories = function() { for (i in re) { var content = re[i] content.Ab = Note.genAbstract(content.Content, 200); - str += tt('#??
    ' + getMsg("datetime") + ': ?
    ', i, (+i+1), s, content.Ab, s, goNowToDatetime(content.UpdatedTime)) + str += tt('#??
    ' + getMsg("datetime") + ': ?
    ', i, (+i+1), s, content.Ab, s, content.UpdatedTime) } str += ""; $content.html(str); @@ -1790,7 +1790,7 @@ Note.deleteNoteTag = function(item, tag) { // 渲染列表 Note.starNotes = []; -Note.starItemT = '
  • ?X
  • '; +Note.starItemT = '
  • ?X
  • '; Note.starNotesO = $('#starNotes'); Note.renderStars = function(notes) { var me = this; @@ -1799,12 +1799,12 @@ Note.renderStars = function(notes) { me.starNotesO.html(''); for(var i = 0; i < notes.length; ++i) { var note = notes[i]; - var t = tt(me.starItemT, note.NoteId, note.Title || 'Untitled'); + var t = tt(me.starItemT, note.NoteId, note.Title || getMsg('Untitled')); me.starNotesO.append(t); } if(notes.length == 0) { - me.starNotesO.html('

    No Starred Note

    '); + me.starNotesO.html('

    ' + getMsg('No Starred Note') + '

    '); } }; @@ -1838,7 +1838,7 @@ Note.renderStarNote = function(target) { me.directToNote(noteId); // $('#curNotebookForLisNote').text("Starred"); - Notebook.changeCurNotebookTitle('Starred', true); + Notebook.changeCurNotebookTitle(getMsg('Starred'), true); }; // 笔记标题改了后, 如果在star中, 则也要改标题 @@ -1853,7 +1853,7 @@ Note.changeStarNoteTitle = function(noteId, title) { var target = me.starNotesO.find('li[data-id="' + noteId + '"]'); if(target.length == 1) { - target.find('a').html((title || 'Untitled') + 'X'); + target.find('a').html((title || 'Untitled') + 'X'); } }; @@ -2366,14 +2366,14 @@ var Attach = { FileService.download(curAttach.Path, value, function(ok, msg) { if(!ok) { // TODO 提示下载成功 - var notification = new window.Notification('Warning', { - body: 'File saved failure!', + var notification = new window.Notification(getMsg('Warning'), { + body: getMsg('File saved failure!'), // icon: appIcon }); } else { // TODO 提示下载成功 - var notification = new window.Notification('Info', { - body: 'File saved successful!', + var notification = new window.Notification(getMsg('Info'), { + body: getMsg('File saved successful!'), // icon: appIcon }); } @@ -2501,9 +2501,9 @@ var Attach = { html += '
  • ' + '
    ' + each.Title + '
    ' + '
    ' + - ' ' + - ' ' + - ' ' + + ' ' + + ' ' + + ' ' + '
    ' + '
  • '; self.attachsMap[each.FileId] = each; diff --git a/src/public/js/app/notebook.js b/src/public/js/app/notebook.js index 5c76dfae..ea46a461 100644 --- a/src/public/js/app/notebook.js +++ b/src/public/js/app/notebook.js @@ -139,11 +139,11 @@ Notebook.getTreeSetting = function(isSearch, isShare){ if(!isShare) { if(!Notebook.isAllNotebookId(treeNode.NotebookId) && !Notebook.isTrashNotebookId(treeNode.NotebookId)) { icoObj.after($('' + (treeNode.NumberNotes || 0) + '')); - icoObj.after($('')); + icoObj.after($('')); } } else { if(!Share.isDefaultNotebookId(treeNode.NotebookId)) { - icoObj.after($('')); + icoObj.after($('')); } } if (treeNode.level > 1) { @@ -480,7 +480,7 @@ Notebook.getChangedNotebooks = function(notebooks) { navForNewNote += eachForNew; } return navForNewNote; -} +}; Notebook.everNavForNewNote = ""; Notebook.everNotebooks = []; diff --git a/src/public/js/lang.js b/src/public/js/lang.js index ed0fc0c9..c0993a5b 100644 --- a/src/public/js/lang.js +++ b/src/public/js/lang.js @@ -44,6 +44,14 @@ var lang = { $this.attr('placeholder', langData[txt]); } }); + + $('.lang-title').each(function() { + var $this = $(this); + var txt = $.trim($this.attr('title')); + if(langData[txt] != undefined) { + $this.attr('title', langData[txt]); + } + }); } }; diff --git a/src/public/langs/zh-cn.js b/src/public/langs/zh-cn.js index b863d711..be52b838 100644 --- a/src/public/langs/zh-cn.js +++ b/src/public/langs/zh-cn.js @@ -197,7 +197,12 @@ "Public as blog": "公开为博客", "Cancel public": "取消公开为博客", "Delete": "删除", + "Remove": "移除", "Export": "导出", + "Histories": "历史记录", + "Toggle writting mode": "切换写作模式", + "Attachments": "附件", + "UnTitled": "无标题", "Add sub notebook": "添加子笔记本", "Rename": "重命名", @@ -212,5 +217,31 @@ "Password": "密码", "Sign up": "注册", "Forget password?": "忘记密码?", - "Find password": "找回密码" + "Find password": "找回密码", + + "Untitled": "无标题", + "No Starred Note": "无加星笔记", + "Conflict": "冲突", + "Star": "加星", + "Blog": "博客", + "Setting": "设置", + + "Insert link into content": "插件附件链接到笔记中", + "Save as": "保存为", + + "Image saved successful!": "图片保存成功!", + "Image saved failure!": "图片保存失败!", + "File saved failure!": "文件保存失败!", + "File saved successful!": "文件保存成功", + + "File not exists": "文件不存在", + "Error": "错误", + "Cut": "剪切", + "Copy": "复制", + "Paste": "粘贴", + "Open link in browser": "在浏览器打开", + + "Info": "提示", + "Warning": "警告" + } \ No newline at end of file