From 9793dd9223defa1e5dedeae30f3729cc297d08ae Mon Sep 17 00:00:00 2001 From: life Date: Fri, 1 May 2015 15:22:45 +0800 Subject: [PATCH] menu ok todo: image render --- src/main.js | 33 +++++++ src/node_modules/gui.js | 22 +++++ src/node_modules/note.js | 5 + src/node_modules/server.js | 1 + src/note.html | 9 +- src/package.json | 29 +----- src/public/config.js | 5 +- src/public/js/app/api.js | 2 +- src/public/js/app/native.js | 24 ++--- src/public/js/app/note.js | 177 +++++++++------------------------- src/public/js/app/notebook.js | 6 +- src/public/js/app/page.js | 19 ++-- src/public/js/app/service.js | 6 +- src/public/md/main.js | 2 +- 14 files changed, 153 insertions(+), 187 deletions(-) create mode 100644 src/main.js create mode 100644 src/node_modules/gui.js diff --git a/src/main.js b/src/main.js new file mode 100644 index 00000000..19d27145 --- /dev/null +++ b/src/main.js @@ -0,0 +1,33 @@ +var app = require('app'); // Module to control application life. +var BrowserWindow = require('browser-window'); // Module to create native browser window. + +// Report crashes to our server. +require('crash-reporter').start(); + +// Keep a global reference of the window object, if you don't, the window will +// be closed automatically when the javascript object is GCed. +var mainWindow = null; + +// Quit when all windows are closed. +app.on('window-all-closed', function() { + if (process.platform != 'darwin') + app.quit(); +}); + +// This method will be called when Electron has done everything +// initialization and ready for creating browser windows. +app.on('ready', function() { + // Create the browser window. + mainWindow = new BrowserWindow({width: 1000, height: 600, frame: true, transparent: false }); + + // and load the index.html of the app. + mainWindow.loadUrl('file://' + __dirname + '/note.html'); + + // Emitted when the window is closed. + mainWindow.on('closed', function() { + // Dereference the window object, usually you would store windows + // in an array if your app supports multi windows, this is the time + // when you should delete the corresponding element. + mainWindow = null; + }); +}); \ No newline at end of file diff --git a/src/node_modules/gui.js b/src/node_modules/gui.js new file mode 100644 index 00000000..83cd32ec --- /dev/null +++ b/src/node_modules/gui.js @@ -0,0 +1,22 @@ +var remote = require('remote'); +var Menu = remote.require('menu'); +var MenuItem = remote.require('menu-item'); + +var gui = { + Menu: Menu, + MenuItem: MenuItem, + remote: remote, + + getSeparatorMenu: function() { + return new MenuItem({ type: 'separator' }); + }, + getCurrentWindow: function() { + return remote.getCurrentWindow(); + }, + Shell: require('shell'), + on: function(type, callback) { + + } +}; + +module.exports = gui; \ No newline at end of file diff --git a/src/node_modules/note.js b/src/node_modules/note.js index 2cfde1df..bc3908ea 100644 --- a/src/node_modules/note.js +++ b/src/node_modules/note.js @@ -19,6 +19,8 @@ function log(o) { console.log(o); } +// Web.alertWeb('alert(process.type);'); + /* type NoteOrContent struct { NotebookId string @@ -42,6 +44,9 @@ var Note = { // 更新笔记 updateNoteOrContent: function(noteOrContent, callback) { var me = this; + + // Web.alertWeb(process.type); // render + var userId = User.getCurActiveUserId(); noteOrContent['UserId'] = userId; diff --git a/src/node_modules/server.js b/src/node_modules/server.js index 2e211066..936c0715 100644 --- a/src/node_modules/server.js +++ b/src/node_modules/server.js @@ -44,6 +44,7 @@ var Server = { if(me._started) { return; } + return; var basePath = process.cwd(); var server = http.createServer(function (request, response) { var pathname = url.parse(request.url).pathname; diff --git a/src/note.html b/src/note.html index db0ad87b..3a98da74 100755 --- a/src/note.html +++ b/src/note.html @@ -635,22 +635,27 @@ window.require = undefined; - + + + +-->