126 lines
2.9 KiB
JavaScript
126 lines
2.9 KiB
JavaScript
const { app, Menu,shell } = require('electron');
|
|
const navi = require('./dock');
|
|
const prefman = require('./preferencemanager');
|
|
const ipc = require('electron').ipcMain;
|
|
|
|
const options = {userAgent: 'Mozilla/5.0 (Linux; Android 7.1.1; Nexus 6 Build/N6F27E) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.83 Mobile Safari/537.36'};
|
|
|
|
module.exports = function(win){
|
|
const template = [
|
|
{
|
|
label: 'Edit',
|
|
submenu: [
|
|
{role: 'undo'},
|
|
{role: 'redo'},
|
|
{type: 'separator'},
|
|
{role: 'cut'},
|
|
{role: 'copy'},
|
|
{role: 'paste'},
|
|
{role: 'pasteandmatchstyle'},
|
|
{role: 'delete'},
|
|
{role: 'selectall'}
|
|
]
|
|
},
|
|
{
|
|
label: 'View',
|
|
submenu: [
|
|
{role: 'reload'},
|
|
{role: 'forcereload'},
|
|
{type: 'separator'},
|
|
{role: 'resetzoom'},
|
|
{role: 'zoomin'},
|
|
{role: 'zoomout'},
|
|
{type: 'separator'},
|
|
{role: 'togglefullscreen'}
|
|
]
|
|
},
|
|
|
|
{
|
|
label: 'Go',
|
|
submenu: navi.navitemplate(win)
|
|
},
|
|
{
|
|
role: 'window',
|
|
submenu: [
|
|
{role: 'minimize'},
|
|
{role: 'close'}
|
|
]
|
|
},
|
|
{
|
|
label: 'Help',
|
|
role: 'help',
|
|
submenu: [
|
|
{
|
|
label: "Million Live! Help",
|
|
click() { win.loadURL("http://imas.gree-apps.net/app/index.php/help",options)}
|
|
},
|
|
{
|
|
label: "Project Homepage",
|
|
click(){shell.openExternal("https://github.com/Damillora/MillionHopes")}
|
|
},
|
|
{
|
|
label: 'About Million Hopes',
|
|
click() {
|
|
prefman.showAbout();
|
|
},
|
|
visible: process.platform !== 'darwin'
|
|
}
|
|
|
|
]
|
|
}
|
|
]
|
|
if (process.platform === 'darwin') {
|
|
template.unshift({
|
|
label: app.getName(),
|
|
submenu: [
|
|
{label: 'About Million Hopes',click(){prefman.showAbout()}},
|
|
{type: 'separator'},
|
|
{label: 'Preferences',click(){prefman.showPreferences()}},
|
|
{type: 'separator'},
|
|
{role: 'services', submenu: []},
|
|
{type: 'separator'},
|
|
{role: 'hide'},
|
|
{role: 'hideothers'},
|
|
{role: 'unhide'},
|
|
{type: 'separator'},
|
|
{role: 'quit'}
|
|
]
|
|
})
|
|
|
|
// Edit menu
|
|
template[2].submenu.push(
|
|
{type: 'separator'},
|
|
{
|
|
label: 'Speech',
|
|
submenu: [
|
|
{role: 'startspeaking'},
|
|
{role: 'stopspeaking'}
|
|
]
|
|
}
|
|
)
|
|
|
|
// Window menu
|
|
template[4].submenu = [
|
|
{role: 'close'},
|
|
{role: 'minimize'},
|
|
{role: 'zoom'},
|
|
{type: 'separator'},
|
|
{role: 'front'}
|
|
]
|
|
} else
|
|
{
|
|
template.unshift({
|
|
label: "File",
|
|
submenu: [
|
|
{label: 'Preferences',click(){prefman.showPreferences()}},
|
|
{type: 'separator'},
|
|
{label: 'Exit', click(){ app.quit() }},
|
|
],
|
|
visible: process.platform !== 'darwin'
|
|
})
|
|
}
|
|
|
|
const themenu = Menu.buildFromTemplate(template);
|
|
return themenu;
|
|
}
|