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,8 +22,8 @@
<section id="box" class="animated fadeInUp">
<div>
<h1 id="logo">
<a onclick="openExternal('http://leanote.com')" title="leanote">
<img src="public/images/logo/leanote_icon_blue.png">
<a onclick="openExternal('http://leanote.com')" id="loadingLogo" title="leanote">
<img src="public/images/logo/leanote_icon_blue.png">
</a>
</h1>
<div id="boxForm">
@@ -87,10 +87,12 @@ $(function() {
return;
}
}
$('#loadingLogo').addClass('loading');
// TODO show loading
// console.log(33);
// $("#loginBtn").html("loading...").addClass("disabled");
ApiService.auth(email, pwd, function(ret) {
$('#loadingLogo').removeClass('loading');
// $("#loginBtn").html("Sign in").removeClass("disabled");
if(ret.Ok) {
$("#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');
// console.log(gui.App);
/*
// 开发版
/*
process.on('uncaughtException', function (err) {
// 打印出错误
console.log('~!!~ uncaughtException ~!!~');
console.log(err);
// 打印出错误的调用栈方便调试
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
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');
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');
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;
},
// 停止同步
_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
//---------------
@@ -108,6 +123,7 @@ var Sync = {
// 同步笔记本
_syncNotebookToLocal: function(notebooks, callback) {
var me = this;
function canCall() {
// 是最后一块, 且
me._addSyncNotebookNum();
@@ -183,6 +199,9 @@ var Sync = {
syncNotebook: function(afterUsn, callback) {
var me = this;
if(me.isStop()) {
return;
}
Api.getSyncNotebooks(afterUsn, me._notebookMaxEntry, function(notebooks) {
console.log('syncNotebook')
console.log(notebooks);
@@ -228,6 +247,7 @@ var Sync = {
// 同步笔记到本地
_syncNoteToLocal: function(notes, callback) {
var me = this;
function canCall(isEmpty) {
// 为空时来判断是最后一次了, 可以之前的还没处理完
if(isEmpty && me._totalHasSyncNoteNum < me._totalSyncNoteNum) {
@@ -313,6 +333,10 @@ var Sync = {
syncNote: function(afterUsn, callback) {
var me = this;
if(me.isStop()) {
return;
}
Api.getSyncNotes(afterUsn, me._noteMaxEntry, function(notes) {
log('syncNote')
log(notes);
@@ -423,6 +447,9 @@ var Sync = {
},
syncTag: function(afterUsn, callback) {
var me = this;
if(me.isStop()) {
return;
}
Api.getSyncTags(afterUsn, me._tagMaxEntry, function(tags) {
log('syncTags------------------------------------')
log(tags);

3
node_modules/user.js generated vendored
View File

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

View File

@@ -20,6 +20,7 @@
<!-- theme -->
<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/presentation.css" type="text/css" disabled id="themePresentation"/>
<!-- context-menu -->
<link rel="stylesheet" href="public/js/contextmenu/css/contextmenu.css" type="text/css" />
@@ -35,15 +36,46 @@ function log(o) {
}
</script>
</head>
<body class="clearfix">
<body class="clearfix init">
<!-- 关闭, 最小化, 最大 -->
<div id="winTool" class="win-tool clearfix">
<a class="tool-close"></a>
<a class="tool-min"></a>
<a class="tool-max"></a>
</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="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">
<!-- header start -->
@@ -93,16 +125,10 @@ function log(o) {
<!-- header end -->
<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="notebook">
@@ -298,11 +324,13 @@ function log(o) {
</div>
<!-- 遮罩, 为了resize3Columns用 -->
<div id="noteMask" class="note-mask"></div>
<div id="noteMaskForLoading" class="note-mask">
<img src="public/images/loading-24.gif"/>
<br />
loading...
</div>
<div id="editorMask">
The notebook is empty, why not...
<br />

View File

@@ -2,19 +2,18 @@
"name": "Leanote",
"description": "Leanote",
"version": "0.1",
"main": "index.html",
"main": "note.html",
"window": {
"toolbar": true,
"frame": true,
"transparent": false,
"frame": false,
"transparent": true,
"min_width": 400,
"min_height": 200,
// "width": 400, // 1100,
// "height": 300 // 600
"width": 1100,
"height": 600
"width": 400,
"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-family: 'Open Sans';
font-style: normal;
@@ -295,12 +327,9 @@ input,
#box h1 {
margin: auto;
margin-bottom: 30px;
width: 316px;
width: 248px;
color: #eee;
}
#logo {
text-align: center;
}
#boxHeader {
border-color: #e8e8e8;
color: #333;
@@ -313,7 +342,7 @@ input,
font-size: 16px;
}
#boxForm {
width: 316px;
width: 248px;
margin: auto;
border-radius: 2px;
width: 200px;
@@ -335,7 +364,7 @@ input,
color: #eee;
}
#quickLinks {
width: 316px;
width: 248px;
margin: auto;
text-align: right;
}
@@ -466,7 +495,7 @@ input,
margin-left: 10px;
}
#errorBox {
width: 316px;
width: 248px;
margin: auto;
padding: 20px 30px;
padding-bottom: 30px;
@@ -694,15 +723,6 @@ body #container {
-webkit-user-select: none;
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 {
padding: 5px;
position: absolute;

View File

@@ -13,6 +13,8 @@
@containerWidth: 945px;
@titleColor: #5AD4A0;
@import "ani.less";
// font
@font-face {
font-family: 'Open Sans';
@@ -330,12 +332,11 @@ input, .form-control {
//-------------
@boxWidth: 316px;
@boxWidth: 248px;
#box {
margin: 0;
color: #000;
padding-top: 40px;
h1 {
width: @boxWidth;;
margin: auto;
@@ -344,9 +345,9 @@ input, .form-control {
color: #eee;
}
}
#logo {
text-align: center;
}
#boxHeader {
border-color: #e8e8e8;
color: #333;
@@ -800,14 +801,7 @@ body {
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";

View File

@@ -1575,8 +1575,7 @@ html,body, #page, #pageInner {
background-color: #fff;
}
body {
display: none;
// #notesAndSort {
// display: none;
-webkit-user-select: none; // input, textarea还是可以选择的
-webkit-app-region: drag;
border: 1px solid #ccc;
@@ -1587,6 +1586,23 @@ body {
// box-shadow: 0 0 50px #eee;
// box-shadow: 0px 0px 5px #666;
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 {
#pageInner {
@@ -1631,4 +1647,41 @@ body {
-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 '../ani.less';

View File

@@ -1428,7 +1428,6 @@ body,
background-color: #fff;
}
body {
display: none;
-webkit-user-select: none;
-webkit-app-region: drag;
border: 1px solid #ccc;
@@ -1437,6 +1436,20 @@ body {
bottom: 5px;
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 {
overflow: hidden;
border-radius: 5px 0 0 0;
@@ -1471,6 +1484,40 @@ body {
#notebook {
-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 {
padding: 5px;
position: absolute;
@@ -1527,6 +1574,38 @@ body {
.blur .win-tool a {
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 {
background: #000000;
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;
}
body {
display: none;
-webkit-user-select: none;
-webkit-app-region: drag;
border: 1px solid #ccc;
@@ -1437,6 +1436,20 @@ body {
bottom: 5px;
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 {
overflow: hidden;
border-radius: 5px 0 0 0;
@@ -1471,6 +1484,40 @@ body {
#notebook {
-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 {
padding: 5px;
position: absolute;
@@ -1527,6 +1574,38 @@ body {
.blur .win-tool a {
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 {
background: #000000;
color: #ffffff;
@@ -1665,17 +1744,6 @@ a.raw:hover {
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 {
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 {
left: @leftNotebookWidth;

View File

@@ -1428,7 +1428,6 @@ body,
background-color: #fff;
}
body {
display: none;
-webkit-user-select: none;
-webkit-app-region: drag;
border: 1px solid #ccc;
@@ -1437,6 +1436,20 @@ body {
bottom: 5px;
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 {
overflow: hidden;
border-radius: 5px 0 0 0;
@@ -1471,6 +1484,40 @@ body {
#notebook {
-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 {
padding: 5px;
position: absolute;
@@ -1527,6 +1574,38 @@ body {
.blur .win-tool a {
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-family: 'Open Sans';
font-style: normal;

View File

@@ -1428,7 +1428,6 @@ body,
background-color: #fff;
}
body {
display: none;
-webkit-user-select: none;
-webkit-app-region: drag;
border: 1px solid #ccc;
@@ -1437,6 +1436,20 @@ body {
bottom: 5px;
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 {
overflow: hidden;
border-radius: 5px 0 0 0;
@@ -1471,6 +1484,40 @@ body {
#notebook {
-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 {
padding: 5px;
position: absolute;
@@ -1527,6 +1574,38 @@ body {
.blur .win-tool a {
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-family: 'Open Sans';
font-style: normal;

View File

@@ -1155,9 +1155,9 @@ Note.fixNetOrAuthError = function() {
// 同步进度显示
Note.syncProcess = function(msg) {
$('body').show();
$('#allProcess').hide();
$('#syncProcess').html(msg);
$('#syncProcess').show().html(msg);
$('.loading-footer').show();
};
// 保存note ctrl + s
@@ -1726,6 +1726,14 @@ Note.selectStar = function(noteId) {
Note.renderStarNote = function(target) {
var me = this;
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');
target.addClass('selected');

View File

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

View File

@@ -531,7 +531,7 @@ function initEditor() {
// 刷新时保存 参考autosave插件
window.onbeforeunload = function(e) {
Note.curChangedSaveIt();
}
};
// 全局ctrl + s
$("body").on('keydown', Note.saveNote);
@@ -942,6 +942,8 @@ LeaAce = {
tinymce.activeEditor.undoManager.setCanAdd(true);
},
canAce: function() {
return true;
/*
if(this._isInit) {
return this._canAce;
}
@@ -952,6 +954,7 @@ LeaAce = {
}
this._isInit = true;
return this._canAce;
*/
},
canAndIsAce: function() {
return this.canAce() && this.isAce;
@@ -1361,13 +1364,32 @@ var State = {
CurTag: CurTag,
CurSearchKey: CurSearchKey
};
console.log(state);
// console.log(state);
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) {
console.log(state);
recoverState: function(userInfo) {
var state = userInfo.State || {};
// 表明没有state
if(state.NotebookOpened === undefined) {
this.recoverAfter();
return;
}
// 1. 左侧哪个open
if(!state.NotebookOpened) {
$('.folderNote.opened').removeClass('opened').addClass('closed');
@@ -1392,11 +1414,12 @@ var State = {
Note.searchNoteSys(state.CurSearchKey, state.CurNoteId);
}
// 笔记本了
else {
else if(notebookId) {
Notebook.expandNotebookTo(notebookId);
Notebook.changeNotebook(notebookId, false, state.CurNoteId);
}
this.recoverAfter();
}
};
@@ -1471,9 +1494,7 @@ function initPage() {
// end
// 开始时显示loading......
// 隐藏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
function userMenu() {
//-------------------
@@ -1618,10 +1658,75 @@ function userMenu() {
userMenuSys.popup(e);
});
// 全局菜单
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() {
initUploadImage();
userMenu();

View File

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

View File

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