simple, blue, black三种配色

This commit is contained in:
life
2015-03-04 01:20:54 +08:00
parent 55b650a086
commit 94f39da8b9
11 changed files with 378 additions and 31 deletions

4
node_modules/db.js generated vendored
View File

@@ -12,10 +12,10 @@ if(dbPath.length < 6) {
var dbPath = '/Users/life/Library/Application Support/Leanote' + '/nedb';
}
// console.log(",,,,,,,,,,,,,");
// console.log(dbPath);
// g, 表全局环境
var db = {};
var dbNames = ['notebooks', 'notes', 'users', 'tags', 'images', 'attachs', 'noteHistories'];
var dbNames = ['notebooks', 'notes', 'users', 'tags', 'images', 'attachs', 'noteHistories', 'g'];
for(var i in dbNames) {
var name = dbNames[i];
db[name] = new Datastore({ filename: path.join(dbPath, name + '.db'), autoload: true });

29
node_modules/user.js generated vendored
View File

@@ -85,6 +85,10 @@ User = {
init: function(callback) {
console.log("......user init.......")
var me = this;
me.getG(function(g) {
me.g = g;
db.users.findOne({IsActive: true}, function(err, user) {
if(err || !user || !user.UserId) {
console.log('不存在');
@@ -98,12 +102,19 @@ User = {
me.LastSyncUsn = user.LastSyncUsn;
me.LastSyncTime = user.LastSyncTime;
// 全局配置也在user中, 到web端
for(var i in me.g) {
user[i] = me.g[i];
}
// 设置当前用户数据路径
me.setUserDataPath();
callback && callback(user);
}
});
});
},
// 得到当前活跃用户Id
getCurActiveUserId: function() {
@@ -198,6 +209,24 @@ User = {
var me = this;
me.LastSyncUsn = usn;
db.users.update({UserId: me.getCurActiveUserId()}, {$set: {LastSyncUsn: usn}});
},
// 全局配置
getG: function(callback) {
var me = this;
db.g.findOne({_id: '1'}, function(err, doc) {
if(err || !doc) {
callback({});
} else {
callback(doc);
}
});
},
// data = {Theme, NotebookWidth, NoteListWidth, MdEditorWidth};
updateG: function(data, callback) {
db.g.update({_id: '1'}, {$set: data}, {upsert: true}, function() {
callback && callback();
});
}
};

View File

@@ -16,8 +16,11 @@
<!-- leanote css -->
<link href="public/css/font-awesome-4.2.0/css/font-awesome.css" rel="stylesheet" />
<link href="public/css/zTreeStyle/zTreeStyle.css" rel="stylesheet" />
<!-- theme -->
<link rel="stylesheet" href="public/css/theme/simple.css" type="text/css" />
<link rel="stylesheet" href="public/css/theme/simple.css" type="text/css"/>
<link rel="stylesheet" href="public/css/theme/blue.css" type="text/css" id="theme"/>
<!-- context-menu -->
<link rel="stylesheet" href="public/js/contextmenu/css/contextmenu.css" type="text/css" />
<!-- mdeditor -->
@@ -187,7 +190,7 @@ function log(o) {
<div id="notebookBottom" class="clearfix">
<!-- fa-spin -->
<a class="pull-left sync-icon">
<i class="fa fa-refresh" id="syncRefresh"></i>
<i class="fa fa-refresh" id="syncRefresh" title="Sync"></i>
<i class="fa fa-exclamation-triangle" id="syncWarning" title="Sync error!!"></i>
</a>
<div class="pull-right" id="myProfile">
@@ -196,12 +199,12 @@ function log(o) {
<span class="username" id="username">
</span><i class="fa fa-angle-down account-more"></i>
</a>
<!--
<ul class="dropdown-menu li-a " role="menu">
<li role="presentation">
<a>Theme</a>
</li>
<li role="presentation">
<!-- 400 * 300px -->
<a href="login.html">Switch account</a>
</li>
<li role="presentation" class="divider"></li>
@@ -209,6 +212,7 @@ function log(o) {
<a>Full async force</a>
</li>
</ul>
-->
</div>
</div>
</div>

View File

@@ -6,8 +6,8 @@
"window": {
"toolbar": true,
"frame": true,
"transparent": false,
"frame": false,
"transparent": true,
"min_width": 400,
"min_height": 200,

43
public/css/css/black.css Normal file
View File

@@ -0,0 +1,43 @@
#notebook,
#notebookBottom {
background: none !important;
background-color: rgba(37, 49, 62, 0.9) !important;
}
.folderHeader .fa-left,
.folderHeader span {
color: #fff;
}
#addNotebookPlus {
color: #F9F8F8;
}
#notebookList {
border-top: none;
}
.folderBody a:hover {
background-color: transparent !important;
font-weight: bold;
}
.ztree li a.curSelectedNode {
color: #eee;
}
.ztree li a.curSelectedNode,
#starNotes li.selected {
background-color: transparent;
font-weight: bold;
}
.ztree li a.curSelectedNode a,
#starNotes li.selected a {
color: #eee;
}
#starNotes li,
.ztree li {
border: none;
}
#starNotes li a,
.ztree li a {
color: #eee;
}
.sync-icon,
#myProfile a {
color: #fff;
}

View File

@@ -0,0 +1,43 @@
#notebook,
#notebookBottom {
background: none !important;
background-color: rgba(37, 49, 62, 0.9) !important;
}
.folderHeader .fa-left,
.folderHeader span {
color: #fff;
}
#addNotebookPlus {
color: #F9F8F8;
}
#notebookList {
border-top: none;
}
.folderBody a:hover {
background-color: transparent !important;
font-weight: bold;
}
.ztree li a.curSelectedNode {
color: #eee;
}
.ztree li a.curSelectedNode,
#starNotes li.selected {
background-color: transparent;
font-weight: bold;
}
.ztree li a.curSelectedNode a,
#starNotes li.selected a {
color: #eee;
}
#starNotes li,
.ztree li {
border: none;
}
#starNotes li a,
.ztree li a {
color: #eee;
}
.sync-icon,
#myProfile a {
color: #fff;
}

View File

@@ -0,0 +1,43 @@
#notebook, #notebookBottom {
background: none !important;
background-color: rgba(37,49,62, 0.9) !important;
// background: url(images/mohu.png) !important;
// background-repeat: repeat;
}
.folderHeader .fa-left, .folderHeader span {
color: #fff;
}
#addNotebookPlus {
color: #F9F8F8;
}
#notebookList {
border-top: none;
}
.folderBody a:hover {
background-color: transparent !important;
font-weight: bold;
}
.ztree li a.curSelectedNode {
color: #eee;
}
.ztree li a.curSelectedNode,
#starNotes li.selected {
background-color: transparent;
font-weight: bold;
a {
color: #eee;
}
}
#starNotes li, .ztree li {
border: none;
a {
color: #eee;
}
}
.sync-icon, #myProfile a {
color: #fff;
}

43
public/css/theme/blue.css Normal file
View File

@@ -0,0 +1,43 @@
#notebook,
#notebookBottom {
background: none !important;
background-color: rgba(40, 167, 233, 0.9) !important;
}
.folderHeader .fa-left,
.folderHeader span {
color: #fff;
}
#addNotebookPlus {
color: #F9F8F8;
}
#notebookList {
border-top: none;
}
.folderBody a:hover {
background-color: transparent !important;
font-weight: bold;
}
.ztree li a.curSelectedNode {
color: #eee;
}
.ztree li a.curSelectedNode,
#starNotes li.selected {
background-color: transparent;
font-weight: bold;
}
.ztree li a.curSelectedNode a,
#starNotes li.selected a {
color: #eee;
}
#starNotes li,
.ztree li {
border: none;
}
#starNotes li a,
.ztree li a {
color: #eee;
}
.sync-icon,
#myProfile a {
color: #fff;
}

View File

@@ -0,0 +1,43 @@
#notebook, #notebookBottom {
background: none !important;
background-color: rgba(40,167,233, 0.9) !important;
// background: url(images/mohu.png) !important;
// background-repeat: repeat;
}
.folderHeader .fa-left, .folderHeader span {
color: #fff;
}
#addNotebookPlus {
color: #F9F8F8;
}
#notebookList {
border-top: none;
}
.folderBody a:hover {
background-color: transparent !important;
font-weight: bold;
}
.ztree li a.curSelectedNode {
color: #eee;
}
.ztree li a.curSelectedNode,
#starNotes li.selected {
background-color: transparent;
font-weight: bold;
a {
color: #eee;
}
}
#starNotes li, .ztree li {
border: none;
a {
color: #eee;
}
}
.sync-icon, #myProfile a {
color: #fff;
}

View File

@@ -233,7 +233,7 @@ var Resize = {
var self = this;
if(self.lineMove || self.mdLineMove) {
// ajax保存
ajaxGet("/user/updateColumnWidth", {mdEditorWidth: UserInfo.MdEditorWidth, notebookWidth: UserInfo.NotebookWidth, noteListWidth: UserInfo.NoteListWidth}, function() {
UserService.updateG({MdEditorWidth: UserInfo.MdEditorWidth, NotebookWidth: UserInfo.NotebookWidth, NoteListWidth: UserInfo.NoteListWidth}, function() {
});
}
self.lineMove = false;
@@ -299,7 +299,7 @@ var Resize = {
var self = this;
if(mdEditorWidth > 100) {
UserInfo.MdEditorWidth = mdEditorWidth;
log(mdEditorWidth)
// log(mdEditorWidth)
self.leftColumn.width(mdEditorWidth);
self.rightColumn.css("left", mdEditorWidth);
// self.mdSplitter.css("left", mdEditorWidth);
@@ -775,8 +775,6 @@ $(function() {
minLeft(false);
}
// 4/25 防止dropdown太高
// dropdown
$('.dropdown').on('shown.bs.dropdown', function () {
@@ -1410,8 +1408,106 @@ function initUploadImage() {
}
});
});
}
// 改变css
var themes = {"Simple":'simple-no.css', 'Blue': 'blue.css', 'Black': 'black.css'};
var themeMenus = {};
function changeTheme(themeName) {
if(themeName) {
if(themeMenus[themeName]) {
themeMenus[themeName].checked = true;
}
var css = themes[themeName];
if(css) {
$('#theme').attr('href', 'public/css/theme/' + css);
// 保存
UserService.updateG({Theme: themeName});
}
} else {
themeMenus['Simple'].checked = true;
}
}
// user
function userMenu() {
//-------------------
// 右键菜单
function menu() {
var me = this;
// this.target = '';
this.menu = new gui.Menu();
this.email = new gui.MenuItem({
label: UserInfo.Email,
enabled: false,
click: function(e) {
}
});
this.switchAccount = new gui.MenuItem({
label: 'Switch account',
click: function(e) {
location.href = 'login.html';
}
});
this.theme = new gui.MenuItem({
label: 'Change theme',
click: function(e) {
}
});
this.sync = new gui.MenuItem({
label: 'Sync now',
click: function(e) {
incrSync();
}
});
var themeSubmenus = new gui.Menu();
for(var i in themes) {
(function(t) {
themeMenus[t] = new gui.MenuItem({
label: t,
type: 'checkbox',
click: function(e) {
// var themeCss = themes[t];
changeTheme(t);
// 将其它的不选中
for(var j in themes) {
if(j != t) {
themeMenus[j].checked = false;
}
}
}
});
themeSubmenus.append(themeMenus[t]);
})(i);
}
this.theme.submenu = themeSubmenus;
this.menu.append(this.email);
this.menu.append(this.switchAccount);
this.menu.append(new gui.MenuItem({ type: 'separator' }));
this.menu.append(this.theme);
this.menu.append(new gui.MenuItem({ type: 'separator' }));
this.menu.append(this.sync);
this.popup = function(e) {
this.menu.popup(10, $('body').height() - 130);
}
}
var userMenuSys = new menu();
$('#myProfile').click(function(e) {
userMenuSys.popup(e);
});
changeTheme(UserInfo.Theme);
}
$(function() {
initUploadImage();
userMenu();
});

View File

@@ -90,8 +90,8 @@ win.on('blur', function() {
console.log('not focuse ');
});
function isURL(str_url){
var re = new RegExp("^((https|http|ftp|rtsp|mms)://).+");
function isURL(str_url) {
var re = new RegExp("^((https|http|ftp|rtsp|mms|emailto)://).+");
return re.test(str_url);
}
@@ -132,12 +132,15 @@ function Menu() {
this.menu.append(this.paste);
this.menu.append(new gui.MenuItem({ type: 'separator' }));
this.menu.append(this.openInBrowser);
// You can have submenu!
/*
var submenu = new gui.Menu();
submenu.append(new gui.MenuItem({ label: 'checkbox 啊' , type: 'checkbox'}));
submenu.append(new gui.MenuItem({ label: 'Item 2', type: 'checkbox'}));
submenu.append(new gui.MenuItem({ label: 'Item 3'}));
this.openInBrowser.submenu = submenu;
*/
}
Menu.prototype.canCopy = function(bool) {
this.cut.enabled = bool;