コードスタイルの修正
This commit is contained in:
parent
6d4ea0b4fa
commit
6eb261ead0
28
app-menu.js
28
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 };
|
||||
|
|
8
main.js
8
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();
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue