mirror of https://github.com/Kylart/KawAnime.git
184 lines
3.0 KiB
JavaScript
184 lines
3.0 KiB
JavaScript
/**
|
|
* Created by Kylart on 18/03/2017.
|
|
*/
|
|
|
|
const path = require('path')
|
|
const electron = require('electron')
|
|
const app = require('electron').app
|
|
const url = require('url')
|
|
|
|
const template = () => {
|
|
let menu = [
|
|
{
|
|
label: 'Edit',
|
|
submenu: [
|
|
{
|
|
role: 'copy'
|
|
},
|
|
{
|
|
role: 'paste'
|
|
},
|
|
{
|
|
role: 'delete'
|
|
},
|
|
{
|
|
type: 'separator'
|
|
},
|
|
{
|
|
label: 'Preferences',
|
|
accelerator: 'Ctrl+,'
|
|
}
|
|
]
|
|
},
|
|
{
|
|
label: 'View',
|
|
submenu: [
|
|
{
|
|
role: 'reload'
|
|
},
|
|
{
|
|
role: 'forcereload'
|
|
},
|
|
{
|
|
type: 'separator'
|
|
},
|
|
{
|
|
role: 'resetzoom'
|
|
},
|
|
{
|
|
role: 'zoomin'
|
|
},
|
|
{
|
|
role: 'zoomout'
|
|
},
|
|
{
|
|
type: 'separator'
|
|
},
|
|
{
|
|
role: 'togglefullscreen'
|
|
},
|
|
{
|
|
type: 'separator'
|
|
},
|
|
{
|
|
label: 'Developpers',
|
|
submenu: [
|
|
{
|
|
role: 'toggledevtools'
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
role: 'window',
|
|
submenu: [
|
|
{
|
|
role: 'minimize'
|
|
},
|
|
{
|
|
role: 'close'
|
|
}
|
|
]
|
|
},
|
|
{
|
|
role: 'help',
|
|
submenu: [
|
|
{
|
|
label: 'Learn More',
|
|
click () { require('electron').shell.openExternal('https://github.com/Kylart/KawAnime') }
|
|
}
|
|
]
|
|
}
|
|
]
|
|
|
|
if (process.platform === 'darwin')
|
|
{
|
|
menu.unshift({
|
|
label: app.getName(),
|
|
submenu: [
|
|
{
|
|
role: 'about'
|
|
},
|
|
{
|
|
type: 'separator'
|
|
},
|
|
{
|
|
label: 'Preferences',
|
|
accelerator: 'Cmd+,'
|
|
},
|
|
{
|
|
type: 'separator'
|
|
},
|
|
{
|
|
role: 'services',
|
|
submenu: []
|
|
},
|
|
{
|
|
type: 'separator'
|
|
},
|
|
{
|
|
role: 'hide'
|
|
},
|
|
{
|
|
role: 'hideothers'
|
|
},
|
|
{
|
|
role: 'unhide'
|
|
},
|
|
{
|
|
type: 'separator'
|
|
},
|
|
{
|
|
role: 'quit'
|
|
}
|
|
]
|
|
})
|
|
// Edit menu.
|
|
menu[1].submenu.pop() // Removing preferences from this part.
|
|
menu[1].submenu.push(
|
|
{
|
|
type: 'separator'
|
|
},
|
|
{
|
|
label: 'Speech',
|
|
submenu: [
|
|
{
|
|
role: 'startspeaking'
|
|
},
|
|
{
|
|
role: 'stopspeaking'
|
|
}
|
|
]
|
|
}
|
|
)
|
|
// Window menu.
|
|
menu[3].submenu = [
|
|
{
|
|
label: 'Close',
|
|
accelerator: 'CmdOrCtrl+W',
|
|
role: 'close'
|
|
},
|
|
{
|
|
label: 'Minimize',
|
|
accelerator: 'CmdOrCtrl+M',
|
|
role: 'minimize'
|
|
},
|
|
{
|
|
label: 'Zoom',
|
|
role: 'zoom'
|
|
},
|
|
{
|
|
type: 'separator'
|
|
},
|
|
{
|
|
label: 'Bring All to Front',
|
|
role: 'front'
|
|
}
|
|
]
|
|
}
|
|
|
|
return menu
|
|
}
|
|
|
|
exports.menu = template() |