|
|
|
@ -6,10 +6,16 @@
|
|
|
|
|
|
|
|
|
|
var platform_type = "";
|
|
|
|
|
|
|
|
|
|
var nw_tray = null;
|
|
|
|
|
|
|
|
|
|
var openBrowser = function (url) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var setTrayMenu = function (items) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function initCordova() {
|
|
|
|
|
platform_type = "cordova";
|
|
|
|
|
|
|
|
|
@ -66,6 +72,76 @@ function initNW() {
|
|
|
|
|
browserwin.menu = browsermenu;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
nw_tray = new nw.Tray({
|
|
|
|
|
title: 'NotePost',
|
|
|
|
|
icon: 'www/img/logo_64.png'
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
setTrayMenu = function (items) {
|
|
|
|
|
var menu = new nw.Menu();
|
|
|
|
|
menu.append(new nw.MenuItem({
|
|
|
|
|
type: 'normal',
|
|
|
|
|
label: 'Open NotePost',
|
|
|
|
|
click: function () {
|
|
|
|
|
nw.Window.get().show();
|
|
|
|
|
}
|
|
|
|
|
}));
|
|
|
|
|
menu.append(new nw.MenuItem({
|
|
|
|
|
type: 'normal',
|
|
|
|
|
label: 'New Note',
|
|
|
|
|
click: function () {
|
|
|
|
|
router.navigate("/editnote");
|
|
|
|
|
nw.Window.get().show();
|
|
|
|
|
}
|
|
|
|
|
}));
|
|
|
|
|
menu.append(new nw.MenuItem({
|
|
|
|
|
type: 'separator'
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
if (items.length > 0) {
|
|
|
|
|
for (i in items) {
|
|
|
|
|
console.log(items[i]);
|
|
|
|
|
var label_max = 50;
|
|
|
|
|
var label = items[i].title;
|
|
|
|
|
if (label.length > label_max) {
|
|
|
|
|
label = label.substring(0, label_max) + "...";
|
|
|
|
|
}
|
|
|
|
|
menu.append(new nw.MenuItem({
|
|
|
|
|
type: 'normal',
|
|
|
|
|
label: label,
|
|
|
|
|
click: function (id) {
|
|
|
|
|
return function () {
|
|
|
|
|
editNote(id);
|
|
|
|
|
nw.Window.get().show();
|
|
|
|
|
}
|
|
|
|
|
}(items[i].id)
|
|
|
|
|
}));
|
|
|
|
|
;
|
|
|
|
|
}
|
|
|
|
|
menu.append(new nw.MenuItem({
|
|
|
|
|
type: 'separator'
|
|
|
|
|
}));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
menu.append(new nw.MenuItem({
|
|
|
|
|
type: 'normal',
|
|
|
|
|
label: 'Exit NotePost',
|
|
|
|
|
click: function () {
|
|
|
|
|
nw.App.quit();
|
|
|
|
|
}
|
|
|
|
|
}));
|
|
|
|
|
nw_tray.menu = menu;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
nw.Window.get().on('minimize', function () {
|
|
|
|
|
nw.Window.get().hide();
|
|
|
|
|
});
|
|
|
|
|
nw_tray.on('click', function () {
|
|
|
|
|
nw.Window.get().show();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
setTrayMenu([]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function initPlatform() {
|
|
|
|
|