diff --git a/dock.js b/dock.js new file mode 100644 index 0000000..2a624a6 --- /dev/null +++ b/dock.js @@ -0,0 +1,34 @@ +const { app, Menu } = require('electron'); +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.navitemplate = function(win){ + const template = [ + { + label: "My Page", + click(){ win.loadURL("http://imas.gree-apps.net/app/index.php/mypage",options)} + }, + { + label: "Eigyo",click() {win.loadURL("http://imas.gree-apps.net/app/index.php/eigyo?from=mypage_main_button",options) } + }, + { + label: "Lesson", + click() { win.loadURL("http://imas.gree-apps.net/app/index.php/lesson",options)} + }, + { + label: "Gasha", + click() { win.loadURL("http://imas.gree-apps.net/app/index.php/gasha",options)} + }, + { + label: "Event", + click() { win.loadURL("http://imas.gree-apps.net/app/index.php/event",options)} + }, + ] + return template; +} +module.exports.setdock = function(win) { + const dockMenu = Menu.buildFromTemplate(module.exports.navitemplate(win)) + + app.dock.setMenu(dockMenu); +} diff --git a/menu.js b/menu.js new file mode 100644 index 0000000..b3396b7 --- /dev/null +++ b/menu.js @@ -0,0 +1,85 @@ +const { app, Menu } = require('electron'); +const navi = require('./dock'); +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'} + ] + }, + { + role: 'window', + submenu: [ + {role: 'minimize'}, + {role: 'close'} + ] + }, + { + label: 'Go', + submenu: navi.navitemplate(win) + } + ] + + if (process.platform === 'darwin') { + template.unshift({ + label: app.getName(), + submenu: [ + {role: 'about'}, + {type: 'separator'}, + {role: 'services', submenu: []}, + {type: 'separator'}, + {role: 'hide'}, + {role: 'hideothers'}, + {role: 'unhide'}, + {type: 'separator'}, + {role: 'quit'} + ] + }) + + // Edit menu + template[1].submenu.push( + {type: 'separator'}, + { + label: 'Speech', + submenu: [ + {role: 'startspeaking'}, + {role: 'stopspeaking'} + ] + } + ) + + // Window menu + template[3].submenu = [ + {role: 'close'}, + {role: 'minimize'}, + {role: 'zoom'}, + {type: 'separator'}, + {role: 'front'} + ] + } + + const themenu = Menu.buildFromTemplate(template); + return themenu; +}