Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
TooBug committed May 26, 2015
2 parents e753a08 + a27ee70 commit bd95db4
Show file tree
Hide file tree
Showing 20 changed files with 22,055 additions and 262 deletions.
15 changes: 10 additions & 5 deletions src/editor.css
@@ -1,5 +1,6 @@
@import "./styles/reset.css";
@import "./styles/theme.css";
@import "./styles/monokai_sublime.css";

body,html{
height: 100%;
Expand Down Expand Up @@ -103,14 +104,18 @@ body,html{
display: inline-block;
overflow-x:hidden;
overflow-y: auto;
padding:20px;
background:rgb(250,250,245);
color:#555;
/*padding:20px;*/
/*background:rgb(250,250,245);*/
/*color:#555;*/
/*-webkit-box-flex:1;*/
width: -webkit-calc(50% - 100px);
font-size: 16px;
white-space: pre;
line-height: 1.8em;
font-family:Monaco, Menlo, 'Ubuntu Mono', Consolas, source-code-pro, monospace;
/*white-space: pre;*/
line-height: 1.6em;
}
#editor *{
font-family:Monaco, Menlo, 'Ubuntu Mono', Consolas, source-code-pro, monospace;
}
#editor.noSidebar{
width:50%;
Expand Down
4 changes: 2 additions & 2 deletions src/editor.html
Expand Up @@ -30,8 +30,8 @@ <h1>TooNote</h1>
<div id="preview" class="preview">
</div>
<div id="toc"></div>
<script src="scripts/ace/ace.js"></script>
<script src="highlight.pack.js"></script>
<script src="editor.js"></script>
<link rel="stylesheet" href="monokai_sublime.css" />
<script src="scripts/main.js"></script>
</body>
</html>
Binary file added src/images/logo@256.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
97 changes: 97 additions & 0 deletions src/login.html
@@ -0,0 +1,97 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>TooNote</title>
<link rel="stylesheet" href="./styles/login.css">
</head>
<body>
<div class="banner">

</div>
<div class="form">
<form id="loginForm">
<p><input type="text" name="email" placeholder="Email" /></p>
<p><input type="password" name="loginPassword" placeholder="Password" /></p>
<p class="hide"><input type="text" name="registerPassword" placeholder="Password" /></p>
<p><button type="submit">登录</button></p>
</form>
</div>
<script>

var ipc = require('ipc');
var remote = require('remote');
var remoteIpc = remote.require('ipc');

var $email = document.querySelector('#loginForm input[name=email]');
var $loginPassword = document.querySelector('#loginForm input[name=loginPassword]');
var $registerPassword = document.querySelector('#loginForm input[name=registerPassword]');
var $btn = document.querySelector('#loginForm button');
var isRegister = false;

$email.addEventListener('change',function(){
console.log('change');
ipc.send('login.queryUser', $email.value);
});

document.querySelector('#loginForm').addEventListener('submit', function(e){

e.preventDefault();
if(isRegister){
ipc.send('login.doRegister', {
email: $email.value,
password: $registerPassword.value
});
}else{
ipc.send('login.doLogin', {
email: $email.value,
password: $loginPassword.value
});
}

});

remoteIpc.on('loginCallback.register',function(e, isSuccess){
console.log('after register', isSuccess);
});

remoteIpc.on('loginCallback.login',function(e, data){
console.log('after login', data);
if(!data.isSuccess){
alert('登录失败:' + data.message);
}
});

remoteIpc.on('loginCallback.queryUser',function(e, isRegistered){
console.log('checked ', isRegistered);
if(!isRegistered){
$loginPassword.parentNode.classList.add('hide');
$registerPassword.parentNode.classList.remove('hide');
$btn.innerHTML = '注册';
setTimeout(function(){
$registerPassword.focus();
}, 0);
isRegister = true;
}else{
$loginPassword.parentNode.classList.remove('hide');
$registerPassword.parentNode.classList.add('hide');
$btn.innerHTML = '登录';
setTimeout(function(){
$loginPassword.focus();
}, 0);
isRegister = false;
}
});

// 关闭窗口
document.addEventListener('keydown',function(e){
var ctrlOrCmd = e.metaKey || e.ctrlKey;
// CTRL+W
if(ctrlOrCmd && e.keyCode === 87){
window.close();
return;
}
});
</script>
</body>
</html>
16 changes: 13 additions & 3 deletions src/package.json
@@ -1,5 +1,15 @@
{
"name":"TooNote",
"version":"0.1.0beta2",
"main":"main.js"
"name": "TooNote",
"version": "0.1.0beta2",
"main": "main.js",
"dependencies": {
"avoscloud-sdk": "^0.5.1",
"jszip": "^2.5.0",
"marked": "^0.3.3",
"marked-toc": "^0.3.0",
"postcss": "^4.1.4",
"postcss-import": "^5.1.1",
"remarkable": "^1.6.0",
"restler": "^3.2.2"
}
}
1 change: 1 addition & 0 deletions src/render.css
@@ -1,5 +1,6 @@
@import "./styles/reset.css";
@import "./styles/theme.css";
@import "./styles/monokai_sublime.css";

body,html{
height:100%;
Expand Down

0 comments on commit bd95db4

Please sign in to comment.