leanote协议完成

This commit is contained in:
life
2015-11-09 23:33:41 +08:00
parent 52ed3ea523
commit f20120ebdf
8 changed files with 154 additions and 25 deletions

View File

@@ -422,6 +422,10 @@ Note.genAbstract = function(content, len) {
return d.innerHTML;
};
Note.fixImageSrc = function(src) {
return fixContentUrl(src);
};
Note.getImgSrc = function(content) {
if(!content) {
return "";
@@ -779,9 +783,9 @@ Note.renderChangedNote = function(changedNote) {
$thumb = $leftNoteNav.find(".item-thumb");
// 有可能之前没有图片
if($thumb.length > 0) {
$thumb.find("img").attr("src", changedNote.ImgSrc);
$thumb.find("img").attr("src", Note.fixImageSrc(changedNote.ImgSrc));
} else {
$leftNoteNav.append(tt('<div class="item-thumb" style=""><img src="?"></div>', changedNote.ImgSrc));
$leftNoteNav.append(tt('<div class="item-thumb" style=""><img src="?"></div>', Note.fixImageSrc(changedNote.ImgSrc)));
$leftNoteNav.addClass("item-image");
}
$leftNoteNav.find(".item-desc").removeAttr("style");
@@ -982,7 +986,7 @@ Note._getNoteHtmlObjct = function(note, isShared) {
var tmp;
if(note.ImgSrc) {
tmp = tt(Note.itemTpl, classes, this.newNoteSeq(), note.NoteId, note.ImgSrc, note.Title, Notebook.getNotebookTitle(note.NotebookId), goNowToDatetime(note.UpdatedTime), note.Desc);
tmp = tt(Note.itemTpl, classes, this.newNoteSeq(), note.NoteId, Note.fixImageSrc(note.ImgSrc), note.Title, Notebook.getNotebookTitle(note.NotebookId), goNowToDatetime(note.UpdatedTime), note.Desc);
} else {
tmp = tt(Note.itemTplNoImg, classes, this.newNoteSeq(), note.NoteId, note.Title, Notebook.getNotebookTitle(note.NotebookId), goNowToDatetime(note.UpdatedTime), note.Desc);
}
@@ -1028,7 +1032,7 @@ Note._renderNotes = function(notes, forNewNote, isShared, tang) { // 第几趟
var tmp;
if(note.ImgSrc) {
tmp = tt(Note.itemTpl, classes, i, note.NoteId, note.ImgSrc, note.Title, Notebook.getNotebookTitle(note.NotebookId), goNowToDatetime(note.UpdatedTime), note.Desc || '');
tmp = tt(Note.itemTpl, classes, i, note.NoteId, Note.fixImageSrc(note.ImgSrc), note.Title, Notebook.getNotebookTitle(note.NotebookId), goNowToDatetime(note.UpdatedTime), note.Desc || '');
} else {
tmp = tt(Note.itemTplNoImg, classes, i, note.NoteId, note.Title, Notebook.getNotebookTitle(note.NotebookId), goNowToDatetime(note.UpdatedTime), note.Desc || '');
}

View File

@@ -4,6 +4,7 @@ var Evt = require('evt');
var app = require('remote').require('app');
var basePath = app.getPath('appData') + '/leanote'; // /Users/life/Library/Application Support/Leanote'; // require('nw.gui').App.dataPath;
Evt.setDataBasePath(basePath);
var protocol = require('remote').require('protocol');
if(!/login.html/.test(location.href)) {
// 启动服务器, 图片