mirror of
https://github.com/leanote/desktop-app.git
synced 2025-10-17 16:45:21 +00:00
同步笔记本
This commit is contained in:
@@ -1294,37 +1294,55 @@ LeaAce = {
|
||||
}
|
||||
};
|
||||
|
||||
// 全量同步
|
||||
function fullSync() {
|
||||
|
||||
}
|
||||
|
||||
// note.html调用
|
||||
// 实始化页面
|
||||
// 判断是否登录
|
||||
function initPage() {
|
||||
$(function() {
|
||||
// 获取笔记本
|
||||
Service.notebookService.getNotebooks(function(notebooks) {
|
||||
Notebook.renderNotebooks(notebooks);
|
||||
});
|
||||
function _init() {
|
||||
$(function() {
|
||||
// 获取笔记本
|
||||
Service.notebookService.getNotebooks(function(notebooks) {
|
||||
Notebook.renderNotebooks(notebooks);
|
||||
});
|
||||
|
||||
// 获得笔记
|
||||
Service.noteService.getNotes('', function(notes) {
|
||||
Note.renderNotesAndFirstOneContent(notes);
|
||||
if(!curNotebookId) {
|
||||
Notebook.selectNotebook($(tt('#notebook [notebookId="?"]', Notebook.allNotebookId)));
|
||||
}
|
||||
});
|
||||
// 获得笔记
|
||||
Service.noteService.getNotes('', function(notes) {
|
||||
Note.renderNotesAndFirstOneContent(notes);
|
||||
if(!curNotebookId) {
|
||||
Notebook.selectNotebook($(tt('#notebook [notebookId="?"]', Notebook.allNotebookId)));
|
||||
}
|
||||
});
|
||||
|
||||
// 指定笔记, 也要保存最新笔记
|
||||
if(latestNotes.length > 0) {
|
||||
for(var i = 0; i < latestNotes.length; ++i) {
|
||||
Note.addNoteCache(latestNotes[i]);
|
||||
// 指定笔记, 也要保存最新笔记
|
||||
if(latestNotes.length > 0) {
|
||||
for(var i = 0; i < latestNotes.length; ++i) {
|
||||
Note.addNoteCache(latestNotes[i]);
|
||||
}
|
||||
}
|
||||
|
||||
// 标签
|
||||
Service.tagService.getTags(function(tags) {
|
||||
Tag.renderTagNav(tags);
|
||||
});
|
||||
|
||||
// init notebook后才调用
|
||||
// initSlimScroll();
|
||||
LeaAce.handleEvent();
|
||||
});
|
||||
};
|
||||
|
||||
// 判断是否登录
|
||||
UserService.init(function(userInfo) {
|
||||
if(userInfo) {
|
||||
UserInfo = userInfo;
|
||||
_init();
|
||||
} else {
|
||||
location.href = 'login.html';
|
||||
}
|
||||
|
||||
// 标签
|
||||
Service.tagService.getTags(function(tags) {
|
||||
Tag.renderTagNav(tags);
|
||||
});
|
||||
|
||||
// init notebook后才调用
|
||||
// initSlimScroll();
|
||||
LeaAce.handleEvent();
|
||||
});
|
||||
}
|
||||
|
@@ -6,10 +6,19 @@ var Service = {
|
||||
noteService: require('note'),
|
||||
tagService: require('tag'),
|
||||
userService: require('user'),
|
||||
tagService: require('tag')
|
||||
tagService: require('tag'),
|
||||
apiService: require('api'),
|
||||
syncServie: require('sync');
|
||||
};
|
||||
|
||||
// 全局变量
|
||||
var ApiService = Service.apiService;
|
||||
var UserService = Service.userService;
|
||||
var SyncService = Service.syncService;
|
||||
|
||||
// 分发服务
|
||||
// route = /note/notebook
|
||||
// 过时
|
||||
Service.dispatch = function(router, param, callback) {
|
||||
var me = this;
|
||||
router = $.trim(router);
|
||||
@@ -27,28 +36,7 @@ Service.dispatch = function(router, param, callback) {
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
var db = openDatabase('leanote', '1.0', 'my first database', 2 * 1024 * 1024);
|
||||
db.transaction(function (tx) {
|
||||
log(tx);
|
||||
tx.executeSql('CREATE TABLE IF NOT EXISTS users (id unique, text)');
|
||||
tx.executeSql('INSERT INTO users (id, text) VALUES (1, "synergies")');
|
||||
tx.executeSql('INSERT INTO users (id, text) VALUES (2, "luyao")');
|
||||
alert(30);
|
||||
});
|
||||
|
||||
// Query out the data
|
||||
db.transaction(function (tx) {
|
||||
tx.executeSql('SELECT * FROM users', [], function (tx, results) {
|
||||
var len = results.rows.length, i;
|
||||
for (i = 0; i < len; i++) {
|
||||
alert(results.rows.item(i).text);
|
||||
}
|
||||
});
|
||||
});
|
||||
*/
|
||||
|
||||
// clipbord
|
||||
// 右键菜单
|
||||
$(document).on('contextmenu', function (e) {
|
||||
e.preventDefault();
|
||||
var $target = $(e.target);
|
||||
@@ -100,6 +88,4 @@ Menu.prototype.popup = function (x, y) {
|
||||
this.menu.popup(x, y);
|
||||
};
|
||||
var menu = new Menu();
|
||||
|
||||
var FS = require('fs');
|
||||
|
||||
var FS = require('fs');
|
Reference in New Issue
Block a user