presentation, fullscreen toggle; user state; animation loading;

This commit is contained in:
life
2015-03-06 22:13:27 +08:00
parent fe29869cc8
commit a836aa5a1f
24 changed files with 904 additions and 96 deletions

View File

@@ -22,7 +22,7 @@
<section id="box" class="animated fadeInUp"> <section id="box" class="animated fadeInUp">
<div> <div>
<h1 id="logo"> <h1 id="logo">
<a onclick="openExternal('http://leanote.com')" title="leanote"> <a onclick="openExternal('http://leanote.com')" id="loadingLogo" title="leanote">
<img src="public/images/logo/leanote_icon_blue.png"> <img src="public/images/logo/leanote_icon_blue.png">
</a> </a>
</h1> </h1>
@@ -87,10 +87,12 @@ $(function() {
return; return;
} }
} }
$('#loadingLogo').addClass('loading');
// TODO show loading // TODO show loading
// console.log(33); // console.log(33);
// $("#loginBtn").html("loading...").addClass("disabled"); // $("#loginBtn").html("loading...").addClass("disabled");
ApiService.auth(email, pwd, function(ret) { ApiService.auth(email, pwd, function(ret) {
$('#loadingLogo').removeClass('loading');
// $("#loginBtn").html("Sign in").removeClass("disabled"); // $("#loginBtn").html("Sign in").removeClass("disabled");
if(ret.Ok) { if(ret.Ok) {
$("#loginBtn").html("Success..."); $("#loginBtn").html("Success...");

4
node_modules/common.js generated vendored
View File

@@ -6,14 +6,16 @@ var ObjectId = require('objectid');
// var gui = require('nw.gui'); // var gui = require('nw.gui');
// console.log(gui.App); // console.log(gui.App);
/*
// 开发版 // 开发版
/*
process.on('uncaughtException', function (err) { process.on('uncaughtException', function (err) {
// 打印出错误 // 打印出错误
console.log('~!!~ uncaughtException ~!!~'); console.log('~!!~ uncaughtException ~!!~');
console.log(err); console.log(err);
// 打印出错误的调用栈方便调试 // 打印出错误的调用栈方便调试
console.log(err.stack); console.log(err.stack);
// Web = require('web');
// Web.debug('错误!!');
}); });
*/ */

4
node_modules/note.js generated vendored
View File

@@ -360,10 +360,10 @@ var Note = {
} }
// http://leanote.com/file/outputImage?fileId=54f9079f38f4115c0200001b // http://leanote.com/file/outputImage?fileId=54f9079f38f4115c0200001b
var reg0 = new RegExp(Evt.leanoteUrl + '/file/outputImage', 'g'); var reg0 = new RegExp(Evt.leanoteUrl + '/file/outputImage', 'g');
content = content.replace(reg0, Server.localUrl + '/api/file/getImage'); content = content.replace(reg0, Evt.localUrl + '/api/file/getImage');
var reg = new RegExp(Evt.leanoteUrl + '/api/file/getImage', 'g'); var reg = new RegExp(Evt.leanoteUrl + '/api/file/getImage', 'g');
content = content.replace(reg, Server.localUrl + '/api/file/getImage'); content = content.replace(reg, Evt.localUrl + '/api/file/getImage');
var reg2 = new RegExp(Evt.leanoteUrl + '/api/file/getAttach', 'g'); var reg2 = new RegExp(Evt.leanoteUrl + '/api/file/getAttach', 'g');
content = content.replace(reg2, Evt.localUrl + '/api/file/getAttach'); content = content.replace(reg2, Evt.localUrl + '/api/file/getAttach');

27
node_modules/sync.js generated vendored
View File

@@ -88,6 +88,21 @@ var Sync = {
me._needIncrSyncAgain = false; me._needIncrSyncAgain = false;
}, },
// 停止同步
_stop: false,
stop: function() {
var me = this;
me._stop = true;
},
isStop: function() {
var me = this;
if(me._stop) {
me._stop = false;
return true;
}
return false;
},
//--------------- //---------------
// notebook // notebook
//--------------- //---------------
@@ -108,6 +123,7 @@ var Sync = {
// 同步笔记本 // 同步笔记本
_syncNotebookToLocal: function(notebooks, callback) { _syncNotebookToLocal: function(notebooks, callback) {
var me = this; var me = this;
function canCall() { function canCall() {
// 是最后一块, 且 // 是最后一块, 且
me._addSyncNotebookNum(); me._addSyncNotebookNum();
@@ -183,6 +199,9 @@ var Sync = {
syncNotebook: function(afterUsn, callback) { syncNotebook: function(afterUsn, callback) {
var me = this; var me = this;
if(me.isStop()) {
return;
}
Api.getSyncNotebooks(afterUsn, me._notebookMaxEntry, function(notebooks) { Api.getSyncNotebooks(afterUsn, me._notebookMaxEntry, function(notebooks) {
console.log('syncNotebook') console.log('syncNotebook')
console.log(notebooks); console.log(notebooks);
@@ -228,6 +247,7 @@ var Sync = {
// 同步笔记到本地 // 同步笔记到本地
_syncNoteToLocal: function(notes, callback) { _syncNoteToLocal: function(notes, callback) {
var me = this; var me = this;
function canCall(isEmpty) { function canCall(isEmpty) {
// 为空时来判断是最后一次了, 可以之前的还没处理完 // 为空时来判断是最后一次了, 可以之前的还没处理完
if(isEmpty && me._totalHasSyncNoteNum < me._totalSyncNoteNum) { if(isEmpty && me._totalHasSyncNoteNum < me._totalSyncNoteNum) {
@@ -313,6 +333,10 @@ var Sync = {
syncNote: function(afterUsn, callback) { syncNote: function(afterUsn, callback) {
var me = this; var me = this;
if(me.isStop()) {
return;
}
Api.getSyncNotes(afterUsn, me._noteMaxEntry, function(notes) { Api.getSyncNotes(afterUsn, me._noteMaxEntry, function(notes) {
log('syncNote') log('syncNote')
log(notes); log(notes);
@@ -423,6 +447,9 @@ var Sync = {
}, },
syncTag: function(afterUsn, callback) { syncTag: function(afterUsn, callback) {
var me = this; var me = this;
if(me.isStop()) {
return;
}
Api.getSyncTags(afterUsn, me._tagMaxEntry, function(tags) { Api.getSyncTags(afterUsn, me._tagMaxEntry, function(tags) {
log('syncTags------------------------------------') log('syncTags------------------------------------')
log(tags); log(tags);

3
node_modules/user.js generated vendored
View File

@@ -243,8 +243,9 @@ User = {
}, callback); }, callback);
*/ */
saveCurState: function(state, callback) { saveCurState: function(state, callback) {
var me = this;
state = state || {}; state = state || {};
db.g.update({_id: '1'}, {$set: state}, {upsert: true}, function() { db.users.update({_id: me.getCurActiveUserId()}, {$set: {State: state}}, function() {
callback && callback(); callback && callback();
}); });
} }

View File

@@ -20,6 +20,7 @@
<!-- theme --> <!-- 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"/> <link rel="stylesheet" href="public/css/theme/blue.css" type="text/css" id="theme"/>
<link rel="stylesheet" href="public/css/theme/presentation.css" type="text/css" disabled id="themePresentation"/>
<!-- context-menu --> <!-- context-menu -->
<link rel="stylesheet" href="public/js/contextmenu/css/contextmenu.css" type="text/css" /> <link rel="stylesheet" href="public/js/contextmenu/css/contextmenu.css" type="text/css" />
@@ -35,7 +36,7 @@ function log(o) {
} }
</script> </script>
</head> </head>
<body class="clearfix"> <body class="clearfix init">
<!-- 关闭, 最小化, 最大 --> <!-- 关闭, 最小化, 最大 -->
<div id="winTool" class="win-tool clearfix"> <div id="winTool" class="win-tool clearfix">
<a class="tool-close"></a> <a class="tool-close"></a>
@@ -43,7 +44,38 @@ function log(o) {
<a class="tool-max"></a> <a class="tool-max"></a>
</div> </div>
<!-- 演示模式 -->
<div id="presentation">
<!-- 工具 -->
<div class="pren-tool">
</div>
<!-- 标题 -->
<div class="pren-title">
</div>
<!-- 内容 -->
<div class="pren-content">
</div>
</div>
<div id="page" class="clearfix"> <div id="page" class="clearfix">
<div id="mainMask">
<table><tr><td>
<div id="loadingLogo" class="loading">
<img src="public/images/logo/leanote_icon_blue.png">
</div>
<div id="allProcess">
loading...
</div>
<div id="syncProcess">
</div>
</table></tr></td>
<div class="loading-footer">
<a onclick="switchAccount()">Switch account</a>
</div>
</div>
<div id="pageInner"> <div id="pageInner">
<!-- header start --> <!-- header start -->
@@ -93,16 +125,10 @@ function log(o) {
<!-- header end --> <!-- header end -->
<div id="mainContainer" class="clearfix"> <div id="mainContainer" class="clearfix">
<div id="mainMask">
<img src="public/images/loading-30.gif" />
<br />
<br />
<div id="allProcess">
loading...
</div>
<div id="syncProcess">
</div>
</div>
<div id="leftNotebook"> <div id="leftNotebook">
<div id="notebook"> <div id="notebook">
@@ -298,11 +324,13 @@ function log(o) {
</div> </div>
<!-- 遮罩, 为了resize3Columns用 --> <!-- 遮罩, 为了resize3Columns用 -->
<div id="noteMask" class="note-mask"></div> <div id="noteMask" class="note-mask"></div>
<div id="noteMaskForLoading" class="note-mask"> <div id="noteMaskForLoading" class="note-mask">
<img src="public/images/loading-24.gif"/> <img src="public/images/loading-24.gif"/>
<br /> <br />
loading... loading...
</div> </div>
<div id="editorMask"> <div id="editorMask">
The notebook is empty, why not... The notebook is empty, why not...
<br /> <br />

View File

@@ -2,19 +2,18 @@
"name": "Leanote", "name": "Leanote",
"description": "Leanote", "description": "Leanote",
"version": "0.1", "version": "0.1",
"main": "index.html", "main": "note.html",
"window": { "window": {
"toolbar": true, "toolbar": true,
"frame": true, "frame": false,
"transparent": false, "transparent": true,
"min_width": 400, "min_width": 400,
"min_height": 200, "min_height": 200,
// "width": 400, // 1100, // "width": 400, // 1100,
// "height": 300 // 600 // "height": 300 // 600
"width": 1100, "width": 400,
"height": 600 "height": 300
} }
} }

26
public/css/ani.less Normal file
View File

@@ -0,0 +1,26 @@
@keyframes rond {
0% {transform : rotate(0deg);}
100% {transform : rotate(360deg);}
}
@-webkit-keyframes rond {
0% {-webkit-transform : rotate(0deg);}
100% {-webkit-transform : rotate(360deg);}
}
#loadingLogo {
position: relative;
width: 100px;
display: block;
margin: auto;
border: 1px solid #4092C5;
border-radius: 50%;
img {
width: 100px;
padding: 20px;
}
&.loading {
animation: rond 2s infinite;
-webkit-animation: rond 2s infinite;
}
}

View File

@@ -0,0 +1,3 @@
/**
* 演示
*/

View File

@@ -1,3 +1,35 @@
@keyframes rond {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
@-webkit-keyframes rond {
0% {
-webkit-transform: rotate(0deg);
}
100% {
-webkit-transform: rotate(360deg);
}
}
#loadingLogo {
position: relative;
width: 100px;
display: block;
margin: auto;
border: 1px solid #4092C5;
border-radius: 50%;
}
#loadingLogo img {
width: 100px;
padding: 20px;
}
#loadingLogo.loading {
animation: rond 2s infinite;
-webkit-animation: rond 2s infinite;
}
@font-face { @font-face {
font-family: 'Open Sans'; font-family: 'Open Sans';
font-style: normal; font-style: normal;
@@ -295,12 +327,9 @@ input,
#box h1 { #box h1 {
margin: auto; margin: auto;
margin-bottom: 30px; margin-bottom: 30px;
width: 316px; width: 248px;
color: #eee; color: #eee;
} }
#logo {
text-align: center;
}
#boxHeader { #boxHeader {
border-color: #e8e8e8; border-color: #e8e8e8;
color: #333; color: #333;
@@ -313,7 +342,7 @@ input,
font-size: 16px; font-size: 16px;
} }
#boxForm { #boxForm {
width: 316px; width: 248px;
margin: auto; margin: auto;
border-radius: 2px; border-radius: 2px;
width: 200px; width: 200px;
@@ -335,7 +364,7 @@ input,
color: #eee; color: #eee;
} }
#quickLinks { #quickLinks {
width: 316px; width: 248px;
margin: auto; margin: auto;
text-align: right; text-align: right;
} }
@@ -466,7 +495,7 @@ input,
margin-left: 10px; margin-left: 10px;
} }
#errorBox { #errorBox {
width: 316px; width: 248px;
margin: auto; margin: auto;
padding: 20px 30px; padding: 20px 30px;
padding-bottom: 30px; padding-bottom: 30px;
@@ -694,15 +723,6 @@ body #container {
-webkit-user-select: none; -webkit-user-select: none;
box-shadow: 0px 0px 5px rgba(66, 66, 66, 0.5); box-shadow: 0px 0px 5px rgba(66, 66, 66, 0.5);
} }
#box h1 {
width: 248px;
}
#box h1 img {
width: 100px;
border: 1px solid #4092C5;
border-radius: 50%;
padding: 20px;
}
.win-tool { .win-tool {
padding: 5px; padding: 5px;
position: absolute; position: absolute;

View File

@@ -13,6 +13,8 @@
@containerWidth: 945px; @containerWidth: 945px;
@titleColor: #5AD4A0; @titleColor: #5AD4A0;
@import "ani.less";
// font // font
@font-face { @font-face {
font-family: 'Open Sans'; font-family: 'Open Sans';
@@ -330,12 +332,11 @@ input, .form-control {
//------------- //-------------
@boxWidth: 316px; @boxWidth: 248px;
#box { #box {
margin: 0; margin: 0;
color: #000; color: #000;
padding-top: 40px; padding-top: 40px;
h1 { h1 {
width: @boxWidth;; width: @boxWidth;;
margin: auto; margin: auto;
@@ -344,9 +345,9 @@ input, .form-control {
color: #eee; color: #eee;
} }
} }
#logo {
text-align: center;
}
#boxHeader { #boxHeader {
border-color: #e8e8e8; border-color: #e8e8e8;
color: #333; color: #333;
@@ -800,14 +801,7 @@ body {
box-shadow: 0px 0px 5px rgba(66, 66, 66, 0.5); box-shadow: 0px 0px 5px rgba(66, 66, 66, 0.5);
} }
} }
#box h1 {
width: 248px;
img {
width: 100px;
border: 1px solid #4092C5;
border-radius: 50%;
padding: 20px;
}
}
@import "traffic.less"; @import "traffic.less";

View File

@@ -1575,8 +1575,7 @@ html,body, #page, #pageInner {
background-color: #fff; background-color: #fff;
} }
body { body {
display: none; // display: none;
// #notesAndSort {
-webkit-user-select: none; // input, textarea还是可以选择的 -webkit-user-select: none; // input, textarea还是可以选择的
-webkit-app-region: drag; -webkit-app-region: drag;
border: 1px solid #ccc; border: 1px solid #ccc;
@@ -1587,6 +1586,23 @@ body {
// box-shadow: 0 0 50px #eee; // box-shadow: 0 0 50px #eee;
// box-shadow: 0px 0px 5px #666; // box-shadow: 0px 0px 5px #666;
box-shadow: 0px 0px 5px rgba(66, 66, 66, 0.5); box-shadow: 0px 0px 5px rgba(66, 66, 66, 0.5);
&.no-drag {
-webkit-app-region: no-drag;
}
// 刚开始载入时, 只有loading
&.init {
#winTool {
display: none;
}
// border: none;
// box-shadow: none;
#allProcess, #syncProcess, .loading-footer {
display: none;
}
#pageInner {
display: none;
}
}
} }
#page { #page {
#pageInner { #pageInner {
@@ -1631,4 +1647,41 @@ body {
-webkit-app-region: no-drag; -webkit-app-region: no-drag;
} }
#mainMask {
position: absolute;
left: 0;
right: 0;
bottom: 0;
top: 0;
background-color: rgba(255, 255, 255, 0.95);
text-align: center;
padding-top: 10px;
z-index: 1000;
table, td {
width: 100%;
height: 100%;
border: none;
vertical-align: middle;
}
#syncProcess {
margin-top: 20px;
}
.loading-footer {
text-align: center;
position: absolute;
left: 0;
right: 0;
bottom: 10px;
a {
color: #ccc;
}
}
}
#presentation {
display: none;
}
@import '../traffic.less'; @import '../traffic.less';
@import '../ani.less';

View File

@@ -1428,7 +1428,6 @@ body,
background-color: #fff; background-color: #fff;
} }
body { body {
display: none;
-webkit-user-select: none; -webkit-user-select: none;
-webkit-app-region: drag; -webkit-app-region: drag;
border: 1px solid #ccc; border: 1px solid #ccc;
@@ -1437,6 +1436,20 @@ body {
bottom: 5px; bottom: 5px;
box-shadow: 0px 0px 5px rgba(66, 66, 66, 0.5); box-shadow: 0px 0px 5px rgba(66, 66, 66, 0.5);
} }
body.no-drag {
-webkit-app-region: no-drag;
}
body.init #winTool {
display: none;
}
body.init #allProcess,
body.init #syncProcess,
body.init .loading-footer {
display: none;
}
body.init #pageInner {
display: none;
}
#leftNotebook { #leftNotebook {
overflow: hidden; overflow: hidden;
border-radius: 5px 0 0 0; border-radius: 5px 0 0 0;
@@ -1471,6 +1484,40 @@ body {
#notebook { #notebook {
-webkit-app-region: no-drag; -webkit-app-region: no-drag;
} }
#mainMask {
position: absolute;
left: 0;
right: 0;
bottom: 0;
top: 0;
background-color: rgba(255, 255, 255, 0.95);
text-align: center;
padding-top: 10px;
z-index: 1000;
}
#mainMask table,
#mainMask td {
width: 100%;
height: 100%;
border: none;
vertical-align: middle;
}
#mainMask #syncProcess {
margin-top: 20px;
}
#mainMask .loading-footer {
text-align: center;
position: absolute;
left: 0;
right: 0;
bottom: 10px;
}
#mainMask .loading-footer a {
color: #ccc;
}
#presentation {
display: none;
}
.win-tool { .win-tool {
padding: 5px; padding: 5px;
position: absolute; position: absolute;
@@ -1527,6 +1574,38 @@ body {
.blur .win-tool a { .blur .win-tool a {
background: url(icon/traffic-disabled@2x.png); background: url(icon/traffic-disabled@2x.png);
} }
@keyframes rond {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
@-webkit-keyframes rond {
0% {
-webkit-transform: rotate(0deg);
}
100% {
-webkit-transform: rotate(360deg);
}
}
#loadingLogo {
position: relative;
width: 100px;
display: block;
margin: auto;
border: 1px solid #4092C5;
border-radius: 50%;
}
#loadingLogo img {
width: 100px;
padding: 20px;
}
#loadingLogo.loading {
animation: rond 2s infinite;
-webkit-animation: rond 2s infinite;
}
::selection { ::selection {
background: #000000; background: #000000;
color: #ffffff; color: #ffffff;

View File

@@ -0,0 +1,111 @@
/**
* 演示
*/
body {
box-shadow: none;
left: 0;
right: 0;
bottom: 0;
border-radius: 0;
border: none;
}
#mainMask,
#winTool,
.navbar.navbar-default {
display: none;
}
#presentation {
position: absolute;
left: 0;
right: 0;
bottom: 0;
top: 0;
background-color: #fff;
display: block;
-webkit-user-select: text;
overflow-y: scroll;
}
.pren-title {
font-size: 32px;
margin: 100px 0;
text-align: center;
padding: 0 150px;
}
.pren-content {
padding: 0 150px;
}
.pren-content * {
font-size: 18px;
line-height: 1.2;
}
.pren-content p {
margin: 10px 0;
}
.pren-content h1 {
font-size: 30px;
}
.pren-content h2 {
font-size: 24px;
}
.pren-content h3 {
font-size: 18px;
}
.pren-content h4 {
font-size: 14px;
}
/*
body.init #pageInner {
display: block;
}
#noteAndEditor {
left: 0 !important;
}
#note {
left: 0 !important;
// left: 100px !important;
// right: 100px !important;
// padding: 0 100px;
#tool {
border: none;
}
#noteTitleDiv {
right: 0;
margin: 20px 0;
}
#noteTitle {
text-align: center;
font-size: 24px;
}
* {
font-size: 18px;
}
h1 {
font-size: 30px;
}
h2 {
font-size: 24px;
}
h3 {
font-size: 18px;
}
h4 {
font-size: 14px;
}
}
#editor, #mdEditor {
bottom: 0;
top: 100px !important;
}
#mdEditor .layout-wrapper-l3, #editorContent {
top: 0 !important;
}
#editorContent {
padding: 0 100px;
}
*/

View File

@@ -0,0 +1,117 @@
/**
* 演示
*/
body {
box-shadow: none;
left: 0;
right: 0;
bottom: 0;
border-radius: 0;
border: none;
}
#mainMask,
#winTool,
.navbar.navbar-default
{
display: none;
}
#presentation {
position: absolute;
left: 0;
right: 0;
bottom: 0;
top: 0;
background-color: #fff;
// display: none;
display: block;
-webkit-user-select: text;
overflow-y: scroll;
}
.pren-title {
font-size: 32px;
margin: 100px 0;
// margin-top: 100px;
text-align: center;
padding: 0 150px;
}
.pren-content {
padding: 0 150px;
* {
font-size: 18px;
line-height: 1.2;
}
p {
margin: 10px 0;
}
h1 {
font-size: 30px;
}
h2 {
font-size: 24px;
}
h3 {
font-size: 18px;
}
h4 {
font-size: 14px;
}
}
/*
body.init #pageInner {
display: block;
}
#noteAndEditor {
left: 0 !important;
}
#note {
left: 0 !important;
// left: 100px !important;
// right: 100px !important;
// padding: 0 100px;
#tool {
border: none;
}
#noteTitleDiv {
right: 0;
margin: 20px 0;
}
#noteTitle {
text-align: center;
font-size: 24px;
}
* {
font-size: 18px;
}
h1 {
font-size: 30px;
}
h2 {
font-size: 24px;
}
h3 {
font-size: 18px;
}
h4 {
font-size: 14px;
}
}
#editor, #mdEditor {
bottom: 0;
top: 100px !important;
}
#mdEditor .layout-wrapper-l3, #editorContent {
top: 0 !important;
}
#editorContent {
padding: 0 100px;
}
*/

View File

@@ -1428,7 +1428,6 @@ body,
background-color: #fff; background-color: #fff;
} }
body { body {
display: none;
-webkit-user-select: none; -webkit-user-select: none;
-webkit-app-region: drag; -webkit-app-region: drag;
border: 1px solid #ccc; border: 1px solid #ccc;
@@ -1437,6 +1436,20 @@ body {
bottom: 5px; bottom: 5px;
box-shadow: 0px 0px 5px rgba(66, 66, 66, 0.5); box-shadow: 0px 0px 5px rgba(66, 66, 66, 0.5);
} }
body.no-drag {
-webkit-app-region: no-drag;
}
body.init #winTool {
display: none;
}
body.init #allProcess,
body.init #syncProcess,
body.init .loading-footer {
display: none;
}
body.init #pageInner {
display: none;
}
#leftNotebook { #leftNotebook {
overflow: hidden; overflow: hidden;
border-radius: 5px 0 0 0; border-radius: 5px 0 0 0;
@@ -1471,6 +1484,40 @@ body {
#notebook { #notebook {
-webkit-app-region: no-drag; -webkit-app-region: no-drag;
} }
#mainMask {
position: absolute;
left: 0;
right: 0;
bottom: 0;
top: 0;
background-color: rgba(255, 255, 255, 0.95);
text-align: center;
padding-top: 10px;
z-index: 1000;
}
#mainMask table,
#mainMask td {
width: 100%;
height: 100%;
border: none;
vertical-align: middle;
}
#mainMask #syncProcess {
margin-top: 20px;
}
#mainMask .loading-footer {
text-align: center;
position: absolute;
left: 0;
right: 0;
bottom: 10px;
}
#mainMask .loading-footer a {
color: #ccc;
}
#presentation {
display: none;
}
.win-tool { .win-tool {
padding: 5px; padding: 5px;
position: absolute; position: absolute;
@@ -1527,6 +1574,38 @@ body {
.blur .win-tool a { .blur .win-tool a {
background: url(icon/traffic-disabled@2x.png); background: url(icon/traffic-disabled@2x.png);
} }
@keyframes rond {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
@-webkit-keyframes rond {
0% {
-webkit-transform: rotate(0deg);
}
100% {
-webkit-transform: rotate(360deg);
}
}
#loadingLogo {
position: relative;
width: 100px;
display: block;
margin: auto;
border: 1px solid #4092C5;
border-radius: 50%;
}
#loadingLogo img {
width: 100px;
padding: 20px;
}
#loadingLogo.loading {
animation: rond 2s infinite;
-webkit-animation: rond 2s infinite;
}
::selection { ::selection {
background: #000000; background: #000000;
color: #ffffff; color: #ffffff;
@@ -1665,17 +1744,6 @@ a.raw:hover {
background-color: #ebeff2; background-color: #ebeff2;
} }
/*********************/ /*********************/
#mainMask {
position: absolute;
left: 0;
right: 0;
bottom: 0;
top: 0;
background-color: #fff;
text-align: center;
padding-top: 100px;
z-index: 1000;
}
#notebookSplitter { #notebookSplitter {
left: 170px; left: 170px;
} }

View File

@@ -169,17 +169,7 @@ a.raw:hover {
/*********************/ /*********************/
#mainMask {
position: absolute;
left: 0;
right: 0;
bottom: 0;
top: 0;
background-color: #fff;
text-align: center;
padding-top: 100px;
z-index: 1000;
}
#notebookSplitter { #notebookSplitter {
left: @leftNotebookWidth; left: @leftNotebookWidth;

View File

@@ -1428,7 +1428,6 @@ body,
background-color: #fff; background-color: #fff;
} }
body { body {
display: none;
-webkit-user-select: none; -webkit-user-select: none;
-webkit-app-region: drag; -webkit-app-region: drag;
border: 1px solid #ccc; border: 1px solid #ccc;
@@ -1437,6 +1436,20 @@ body {
bottom: 5px; bottom: 5px;
box-shadow: 0px 0px 5px rgba(66, 66, 66, 0.5); box-shadow: 0px 0px 5px rgba(66, 66, 66, 0.5);
} }
body.no-drag {
-webkit-app-region: no-drag;
}
body.init #winTool {
display: none;
}
body.init #allProcess,
body.init #syncProcess,
body.init .loading-footer {
display: none;
}
body.init #pageInner {
display: none;
}
#leftNotebook { #leftNotebook {
overflow: hidden; overflow: hidden;
border-radius: 5px 0 0 0; border-radius: 5px 0 0 0;
@@ -1471,6 +1484,40 @@ body {
#notebook { #notebook {
-webkit-app-region: no-drag; -webkit-app-region: no-drag;
} }
#mainMask {
position: absolute;
left: 0;
right: 0;
bottom: 0;
top: 0;
background-color: rgba(255, 255, 255, 0.95);
text-align: center;
padding-top: 10px;
z-index: 1000;
}
#mainMask table,
#mainMask td {
width: 100%;
height: 100%;
border: none;
vertical-align: middle;
}
#mainMask #syncProcess {
margin-top: 20px;
}
#mainMask .loading-footer {
text-align: center;
position: absolute;
left: 0;
right: 0;
bottom: 10px;
}
#mainMask .loading-footer a {
color: #ccc;
}
#presentation {
display: none;
}
.win-tool { .win-tool {
padding: 5px; padding: 5px;
position: absolute; position: absolute;
@@ -1527,6 +1574,38 @@ body {
.blur .win-tool a { .blur .win-tool a {
background: url(icon/traffic-disabled@2x.png); background: url(icon/traffic-disabled@2x.png);
} }
@keyframes rond {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
@-webkit-keyframes rond {
0% {
-webkit-transform: rotate(0deg);
}
100% {
-webkit-transform: rotate(360deg);
}
}
#loadingLogo {
position: relative;
width: 100px;
display: block;
margin: auto;
border: 1px solid #4092C5;
border-radius: 50%;
}
#loadingLogo img {
width: 100px;
padding: 20px;
}
#loadingLogo.loading {
animation: rond 2s infinite;
-webkit-animation: rond 2s infinite;
}
@font-face { @font-face {
font-family: 'Open Sans'; font-family: 'Open Sans';
font-style: normal; font-style: normal;

View File

@@ -1428,7 +1428,6 @@ body,
background-color: #fff; background-color: #fff;
} }
body { body {
display: none;
-webkit-user-select: none; -webkit-user-select: none;
-webkit-app-region: drag; -webkit-app-region: drag;
border: 1px solid #ccc; border: 1px solid #ccc;
@@ -1437,6 +1436,20 @@ body {
bottom: 5px; bottom: 5px;
box-shadow: 0px 0px 5px rgba(66, 66, 66, 0.5); box-shadow: 0px 0px 5px rgba(66, 66, 66, 0.5);
} }
body.no-drag {
-webkit-app-region: no-drag;
}
body.init #winTool {
display: none;
}
body.init #allProcess,
body.init #syncProcess,
body.init .loading-footer {
display: none;
}
body.init #pageInner {
display: none;
}
#leftNotebook { #leftNotebook {
overflow: hidden; overflow: hidden;
border-radius: 5px 0 0 0; border-radius: 5px 0 0 0;
@@ -1471,6 +1484,40 @@ body {
#notebook { #notebook {
-webkit-app-region: no-drag; -webkit-app-region: no-drag;
} }
#mainMask {
position: absolute;
left: 0;
right: 0;
bottom: 0;
top: 0;
background-color: rgba(255, 255, 255, 0.95);
text-align: center;
padding-top: 10px;
z-index: 1000;
}
#mainMask table,
#mainMask td {
width: 100%;
height: 100%;
border: none;
vertical-align: middle;
}
#mainMask #syncProcess {
margin-top: 20px;
}
#mainMask .loading-footer {
text-align: center;
position: absolute;
left: 0;
right: 0;
bottom: 10px;
}
#mainMask .loading-footer a {
color: #ccc;
}
#presentation {
display: none;
}
.win-tool { .win-tool {
padding: 5px; padding: 5px;
position: absolute; position: absolute;
@@ -1527,6 +1574,38 @@ body {
.blur .win-tool a { .blur .win-tool a {
background: url(icon/traffic-disabled@2x.png); background: url(icon/traffic-disabled@2x.png);
} }
@keyframes rond {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
@-webkit-keyframes rond {
0% {
-webkit-transform: rotate(0deg);
}
100% {
-webkit-transform: rotate(360deg);
}
}
#loadingLogo {
position: relative;
width: 100px;
display: block;
margin: auto;
border: 1px solid #4092C5;
border-radius: 50%;
}
#loadingLogo img {
width: 100px;
padding: 20px;
}
#loadingLogo.loading {
animation: rond 2s infinite;
-webkit-animation: rond 2s infinite;
}
@font-face { @font-face {
font-family: 'Open Sans'; font-family: 'Open Sans';
font-style: normal; font-style: normal;

View File

@@ -1155,9 +1155,9 @@ Note.fixNetOrAuthError = function() {
// 同步进度显示 // 同步进度显示
Note.syncProcess = function(msg) { Note.syncProcess = function(msg) {
$('body').show();
$('#allProcess').hide(); $('#allProcess').hide();
$('#syncProcess').html(msg); $('#syncProcess').show().html(msg);
$('.loading-footer').show();
}; };
// 保存note ctrl + s // 保存note ctrl + s
@@ -1726,6 +1726,14 @@ Note.selectStar = function(noteId) {
Note.renderStarNote = function(target) { Note.renderStarNote = function(target) {
var me = this; var me = this;
var noteId = target.data('id'); var noteId = target.data('id');
// 如果没有target, 则选第一个
if(!noteId) {
target = me.starNotesO.find('li').eq(0);
}
var noteId = target.data('id');
if(!noteId) {
return;
}
me.starNotesO.find('li').removeClass('selected'); me.starNotesO.find('li').removeClass('selected');
target.addClass('selected'); target.addClass('selected');

View File

@@ -640,6 +640,12 @@ Notebook.curActiveNotebookIsAll = function() {
Notebook.changeNotebookSeq = 1; Notebook.changeNotebookSeq = 1;
Notebook.changeNotebook = function(notebookId, callback, needRendNoteId) { Notebook.changeNotebook = function(notebookId, callback, needRendNoteId) {
var me = this; var me = this;
// 如果找不到
if(!Notebook.cache[notebookId]) {
return;
}
Notebook.changeNotebookNav(notebookId); Notebook.changeNotebookNav(notebookId);
Notebook.curNotebookId = notebookId; Notebook.curNotebookId = notebookId;
@@ -673,6 +679,9 @@ Notebook.changeNotebook = function(notebookId, callback, needRendNoteId) {
} else { } else {
cacheNotes = Note.getNotesByNotebookId(notebookId); cacheNotes = Note.getNotesByNotebookId(notebookId);
var notebook = Notebook.cache[notebookId]; var notebook = Notebook.cache[notebookId];
if(!notebook) {
return;
}
var len = cacheNotes ? cacheNotes.length : 0; var len = cacheNotes ? cacheNotes.length : 0;
// 如果为0, 从服务器上拿 // 如果为0, 从服务器上拿

View File

@@ -531,7 +531,7 @@ function initEditor() {
// 刷新时保存 参考autosave插件 // 刷新时保存 参考autosave插件
window.onbeforeunload = function(e) { window.onbeforeunload = function(e) {
Note.curChangedSaveIt(); Note.curChangedSaveIt();
} };
// 全局ctrl + s // 全局ctrl + s
$("body").on('keydown', Note.saveNote); $("body").on('keydown', Note.saveNote);
@@ -942,6 +942,8 @@ LeaAce = {
tinymce.activeEditor.undoManager.setCanAdd(true); tinymce.activeEditor.undoManager.setCanAdd(true);
}, },
canAce: function() { canAce: function() {
return true;
/*
if(this._isInit) { if(this._isInit) {
return this._canAce; return this._canAce;
} }
@@ -952,6 +954,7 @@ LeaAce = {
} }
this._isInit = true; this._isInit = true;
return this._canAce; return this._canAce;
*/
}, },
canAndIsAce: function() { canAndIsAce: function() {
return this.canAce() && this.isAce; return this.canAce() && this.isAce;
@@ -1361,13 +1364,32 @@ var State = {
CurTag: CurTag, CurTag: CurTag,
CurSearchKey: CurSearchKey CurSearchKey: CurSearchKey
}; };
console.log(state); // console.log(state);
UserService.saveCurState(state, callback); UserService.saveCurState(state, callback);
}, },
recoverAfter: function() {
// 先隐藏, 再resize, 再显示
$('body').hide();
win.resizeTo(1100, 600);
win.setPosition('center');
setTimeout(function() {
$('body').show();
$('body').removeClass('init');
$("#mainMask").html("");
$("#mainMask").hide(0);
}, 100);
// $('body').show();
},
// 恢复状态 // 恢复状态
recoverState: function(state) { recoverState: function(userInfo) {
console.log(state); var state = userInfo.State || {};
// 表明没有state
if(state.NotebookOpened === undefined) {
this.recoverAfter();
return;
}
// 1. 左侧哪个open // 1. 左侧哪个open
if(!state.NotebookOpened) { if(!state.NotebookOpened) {
$('.folderNote.opened').removeClass('opened').addClass('closed'); $('.folderNote.opened').removeClass('opened').addClass('closed');
@@ -1392,11 +1414,12 @@ var State = {
Note.searchNoteSys(state.CurSearchKey, state.CurNoteId); Note.searchNoteSys(state.CurSearchKey, state.CurNoteId);
} }
// 笔记本了 // 笔记本了
else { else if(notebookId) {
Notebook.expandNotebookTo(notebookId); Notebook.expandNotebookTo(notebookId);
Notebook.changeNotebook(notebookId, false, state.CurNoteId); Notebook.changeNotebook(notebookId, false, state.CurNoteId);
} }
this.recoverAfter();
} }
}; };
@@ -1471,9 +1494,7 @@ function initPage() {
// end // end
// 开始时显示loading...... // 开始时显示loading......
// 隐藏mask // 隐藏mask
$("#mainMask").html("");
$("#mainMask").hide(0);
$('body').show();
}); });
}; };
@@ -1542,6 +1563,25 @@ function changeTheme(themeName) {
} }
} }
var _isPren = false;
function togglePren() {
if(!_isPren) {
$('.pren-title').html($('#noteTitle').val());
$('.pren-content').html(getEditorContent());
$('#themePresentation').attr('disabled', false);
$('body').addClass('no-drag');
$('#page').hide();
_isPren = true;
} else {
$('#themePresentation').attr('disabled', true);
_isPren = false;
$('body').removeClass('no-drag');
$('#page').show();
}
}
// user // user
function userMenu() { function userMenu() {
//------------------- //-------------------
@@ -1618,9 +1658,74 @@ function userMenu() {
userMenuSys.popup(e); userMenuSys.popup(e);
}); });
changeTheme(UserInfo.Theme); // 全局菜单
var isSlide = false;
var isFullscreen = false;
var slide;
function toggleFullscreen() {
win.toggleFullscreen();
isFullscreen = !isFullscreen;
if(isFullscreen) {
slide.enabled = false;
} else {
slide.enabled = true;
}
}
var fullScreen = new gui.MenuItem({ label: 'Toggle Fullscreen', click: toggleFullscreen});
function toggleSlide() {
win.toggleKioskMode();
isSlide = !isSlide;
togglePren();
if(isSlide) {
fullScreen.enabled = false;
} else {
fullScreen.enabled = true;
}
}
slide = new gui.MenuItem({ label: 'Toggle Presentation', click: toggleSlide});
$("body").on('keydown', function(e) {
if(e.keyCode == 27) {
if(isSlide) {
toggleSlide();
} else if(isFullscreen) {
toggleFullscreen();
}
}
});
var mode = new gui.Menu();
mode.append(slide);
var modes = new gui.MenuItem({ label: 'Mode', submenu: mode});
mode.append(fullScreen);
if(process.platform === "darwin") {
var nativeMenuBar = new gui.Menu({ type: "menubar" });
nativeMenuBar.createMacBuiltin("Leanote");
win.menu = nativeMenuBar;
win.menu.append(modes);
}
// windows
else {
win.menu.append(modes);
} }
win.on('move', function(e) {
// e.preventDefault();
// return false;
});
// disable drag & drop
document.body.addEventListener('dragover', function(e){
e.preventDefault();
e.stopPropagation();
}, false);
document.body.addEventListener('drop', function(e){
e.preventDefault();
e.stopPropagation();
}, false);
// 修改主题
changeTheme(UserInfo.Theme);
}
$(function() { $(function() {
initUploadImage(); initUploadImage();

View File

@@ -1,5 +1,9 @@
var Common = require('common'); var Common = require('common');
// 启动服务器, 图片
var Server = require('server');
Server.start();
var Evt = require('evt'); var Evt = require('evt');
var basePath = require('nw.gui').App.dataPath; var basePath = require('nw.gui').App.dataPath;
Evt.setDataBasePath(basePath); Evt.setDataBasePath(basePath);
@@ -59,8 +63,7 @@ function openExternal(url) {
// 窗口大小设置 // 窗口大小设置
var win = gui.Window.get(); var win = gui.Window.get();
win.resizeTo(1100, 600);
win.setPosition('center');
$(function() { $(function() {
$('.tool-close, .tool-close-blur').click(function() { $('.tool-close, .tool-close-blur').click(function() {
win.close(); win.close();

View File

@@ -1383,6 +1383,11 @@ var ContextTips = {
} }
}; };
function switchAccount() {
SyncService.stop();
location.href = 'login.html';
}
function commonCmd(e) { function commonCmd(e) {
var num = e.which ? e.which : e.keyCode; var num = e.which ? e.which : e.keyCode;
// copy, paste // copy, paste