Skip to content

TagSpaces is an offline, open source, document manager with tagging support

js styling

uggrocka024ffc7a3b4
diff --git a/Gruntfile.js b/Gruntfile.js
index 23f8bd8ec..e856ebe65 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -56,6 +56,7 @@ module.exports = function(grunt) {
'!data/js/settings.default.js',
'data/chromium/*.js',
'data/cordova/*.js',
+ 'data/electron/*.js',
'data/ext/editorHTML/*.js',
'data/ext/editorJSON/*.js',
'data/ext/editorODF/*.js',
@@ -101,7 +102,7 @@ module.exports = function(grunt) {
'!data/js/settings.default.js',
'data/chromium/**/*.js',
'data/cordova/*.js',
- '!data/cordova/cordova.api.3.4.js',
+ 'data/electron/*.js',
'data/ext/editorHTML/*.js',
'data/ext/editorJSON/*.js',
'data/ext/editorODF/*.js',
diff --git a/data/electron/electron.api.js b/data/electron/electron.api.js
index 1dcf3a96c..7593d63ad 100644
--- a/data/electron/electron.api.js
+++ b/data/electron/electron.api.js
@@ -4,8 +4,8 @@
const fs = require('fs-extra'); // jshint ignore:line
const pathUtils = require('path'); // jshint ignore:line
-const electron = require('electron');
-const remote = electron.remote;
+const electron = require('electron'); // jshint ignore:line
+const remote = electron.remote; // jshint ignore:line
/**
* A implementation of the IOAPI for the nw.js platform
* @class NWJS
@@ -27,14 +27,14 @@ define(function(require, exports, module) {
win.show();
};
- process.on("uncaughtException", function(err) {
+ /*process.on("uncaughtException", function(err) {
//var msg = ' Information | Description \n' +
// '-------------|-----------------------------\n' +
// ' Date | '+ new Date +'\n' +
// ' Type | UncaughtException \n' +
// ' Stack | '+ err.stack +'\n\n';
//fs.appendFile(errorLogFile, '---uncaughtException---\n' + msg);
- });
+ });*/
// Experimental functionality
function watchDirecotory(dirPath, listener) {
@@ -61,8 +61,8 @@ define(function(require, exports, module) {
var Menu = remote.Menu;
var template = [
- {
- label: 'Edit',
+ {
+ label: 'Edit',
submenu: [
{
label: 'Undo',
@@ -106,8 +106,9 @@ define(function(require, exports, module) {
label: $.i18n.t("ns.common:reloadApplication"),
accelerator: 'CmdOrCtrl+R',
click: function(item, focusedWindow) {
- if (focusedWindow)
+ if (focusedWindow) {
focusedWindow.reload();
+ }
}
},
{
@@ -125,10 +126,11 @@ define(function(require, exports, module) {
{
label: $.i18n.t("ns.common:toggleFullScreen"),
accelerator: (function() {
- if (process.platform == 'darwin')
- return 'Ctrl+Command+F';
- else
- return 'F11';
+ if (process.platform == 'darwin') {
+ return 'Ctrl+Command+F';
+ } else {
+ return 'F11';
+ }
})(),
click: function(item, focusedWindow) {
win.setFullScreen(!win.isFullScreen());
@@ -173,7 +175,7 @@ define(function(require, exports, module) {
}
function trash(files) {
- return new Promise(function(resolve, reject){
+ return new Promise(function(resolve, reject) {
files.forEach(function(fullPath) {
electron.shell.moveItemToTrash(fullPath);
});
diff --git a/data/electron/main.js b/data/electron/main.js
index 8fb8d029b..f9b52729a 100644
--- a/data/electron/main.js
+++ b/data/electron/main.js
@@ -4,17 +4,16 @@ const electron = require('electron');
const app = electron.app; // Module to control application life.
const BrowserWindow = electron.BrowserWindow; // Module to create native browser window.
-//app.setPath('userData','data'); // making the app portable
-
-//console.log("CM Args: " + JSON.stringify(process.argv));
var debugMode;
process.argv.forEach(function(arg) {
- if (arg.indexOf('-d') >= 0) {
- debugMode = true;
- }
-});
+ if (arg.indexOf('-d') >= 0) {
+ debugMode = true;
+ }
+ //app.setPath('userData','data'); // making the app portable
+
+});
var path = require('path');
// Keep a global reference of the window object, if you don't, the window will
@@ -30,10 +29,7 @@ app.on('window-all-closed', function() {
}
});
-// This method will be called when Electron has finished
-// initialization and is ready to create browser windows.
app.on('ready', function() {
- // Create the browser window.
mainWindow = new BrowserWindow({width: 1280, height: 768});
// and load the index.html of the app.
@@ -45,8 +41,7 @@ app.on('ready', function() {
mainWindow.setMenu(null);
mainWindow.loadURL(indexPath);
- // Open the DevTools.
- if(debugMode) {
+ if (debugMode) {
mainWindow.webContents.openDevTools();
}