diff --git a/app-menu.js b/app-menu.js index 3968f74d..258e5ff8 100644 --- a/app-menu.js +++ b/app-menu.js @@ -2,12 +2,8 @@ var Menu = require('menu'); -var createMenu = function(mainWindow){ - return Menu.buildFromTemplate(createTemplate(mainWindow)); -} - var createTemplate = function(mainWindow){ - var first_menu_name = (process.platform == 'darwin') ? require('app').getName() : 'File'; + var first_menu_name = (process.platform === 'darwin') ? require('app').getName() : 'File'; var template = []; template.push({ label: first_menu_name, @@ -79,32 +75,40 @@ var createTemplate = function(mainWindow){ { label: 'Toggle Full Screen', accelerator: (function() { - if (process.platform == 'darwin') + if (process.platform === 'darwin'){ return 'Ctrl+Command+F'; - else + } else { return 'F11'; + } })(), click: function(item, focusedWindow) { - if (focusedWindow) + if (focusedWindow) { focusedWindow.setFullScreen(!focusedWindow.isFullScreen()); + } } }, { label: 'Toggle Developer Tools', accelerator: (function() { - if (process.platform == 'darwin') + if (process.platform === 'darwin') { return 'Alt+Command+I'; - else + } else { return 'Ctrl+Shift+I'; + } })(), click: function(item, focusedWindow) { - if (focusedWindow) + if (focusedWindow) { focusedWindow.toggleDevTools(); + } } }, ] }); return template; -} +}; + +var createMenu = function(mainWindow){ + return Menu.buildFromTemplate(createTemplate(mainWindow)); +}; module.exports = { createMenu: createMenu }; diff --git a/main.js b/main.js index f11ff80a..16f0ab60 100644 --- a/main.js +++ b/main.js @@ -14,7 +14,7 @@ var willAppQuit = false; app.on('window-all-closed', function() { // On OS X it is common for applications and their menu bar // to stay active until the user quits explicitly with Cmd + Q - if (process.platform != 'darwin') { + if (process.platform !== 'darwin') { app.quit(); } }); @@ -34,7 +34,7 @@ app.on('activate', function(event){ app.on('before-quit', function(){ willAppQuit = true; -}) +}); // This method will be called when Electron has finished // initialization and is ready to create browser windows. @@ -79,12 +79,12 @@ app.on('ready', function() { // Drag&drop is allowed in webview of index.html. mainWindow.webContents.on('will-navigate', function(event, url){ var dirname = __dirname; - if (process.platform == 'win32'){ + if (process.platform === 'win32'){ dirname = '/' + dirname.replace(/\\/g, '/'); } var index = url.indexOf('file://' + dirname); - if(index != 0){ + if(index !== 0){ event.preventDefault(); } });