gulp prettifyを実行

This commit is contained in:
Yuya Ochiai
2015-10-24 01:44:10 +09:00
parent 3004e117bb
commit 2bb5169f08
6 changed files with 209 additions and 208 deletions

View File

@@ -7,77 +7,65 @@ var createTemplate = function(mainWindow){
var template = []; var template = [];
template.push({ template.push({
label: first_menu_name, label: first_menu_name,
submenu: [ submenu: [{
{
label: 'Settings', label: 'Settings',
click: function(item, focusedWindow) { click: function(item, focusedWindow) {
mainWindow.loadUrl('file://' + __dirname + '/settings.html'); mainWindow.loadUrl('file://' + __dirname + '/settings.html');
} }
}, }, {
{
label: 'Quit', label: 'Quit',
accelerator: 'CmdOrCtrl+Q', accelerator: 'CmdOrCtrl+Q',
click: function(item, focusedWindow) { click: function(item, focusedWindow) {
require('app').quit(); require('app').quit();
} }
} }]
]
}); });
template.push({ template.push({
label: 'Edit', label: 'Edit',
submenu: [ submenu: [{
{
label: 'Undo', label: 'Undo',
accelerator: 'CmdOrCtrl+Z', accelerator: 'CmdOrCtrl+Z',
role: 'undo' role: 'undo'
}, }, {
{
label: 'Redo', label: 'Redo',
accelerator: 'Shift+CmdOrCtrl+Z', accelerator: 'Shift+CmdOrCtrl+Z',
role: 'redo' role: 'redo'
}, }, {
{
type: 'separator' type: 'separator'
}, }, {
{
label: 'Cut', label: 'Cut',
accelerator: 'CmdOrCtrl+X', accelerator: 'CmdOrCtrl+X',
role: 'cut' role: 'cut'
}, }, {
{
label: 'Copy', label: 'Copy',
accelerator: 'CmdOrCtrl+C', accelerator: 'CmdOrCtrl+C',
role: 'copy' role: 'copy'
}, }, {
{
label: 'Paste', label: 'Paste',
accelerator: 'CmdOrCtrl+V', accelerator: 'CmdOrCtrl+V',
role: 'paste' role: 'paste'
}, }, {
{
label: 'Select All', label: 'Select All',
accelerator: 'CmdOrCtrl+A', accelerator: 'CmdOrCtrl+A',
role: 'selectall' role: 'selectall'
}, }, ]
]
}); });
template.push({ template.push({
label: 'View', label: 'View',
submenu: [ submenu: [{
{
label: 'Reload', label: 'Reload',
accelerator: 'CmdOrCtrl+R', accelerator: 'CmdOrCtrl+R',
click: function(item, focusedWindow) { click: function(item, focusedWindow) {
if (focusedWindow) if (focusedWindow)
focusedWindow.reload(); focusedWindow.reload();
} }
}, }, {
{
label: 'Toggle Full Screen', label: 'Toggle Full Screen',
accelerator: (function() { accelerator: (function() {
if (process.platform === 'darwin') { if (process.platform === 'darwin') {
return 'Ctrl+Command+F'; return 'Ctrl+Command+F';
} else { }
else {
return 'F11'; return 'F11';
} }
})(), })(),
@@ -86,13 +74,13 @@ var createTemplate = function(mainWindow){
focusedWindow.setFullScreen(!focusedWindow.isFullScreen()); focusedWindow.setFullScreen(!focusedWindow.isFullScreen());
} }
} }
}, }, {
{
label: 'Toggle Developer Tools', label: 'Toggle Developer Tools',
accelerator: (function() { accelerator: (function() {
if (process.platform === 'darwin') { if (process.platform === 'darwin') {
return 'Alt+Command+I'; return 'Alt+Command+I';
} else { }
else {
return 'Ctrl+Shift+I'; return 'Ctrl+Shift+I';
} }
})(), })(),
@@ -101,8 +89,7 @@ var createTemplate = function(mainWindow){
focusedWindow.toggleDevTools(); focusedWindow.toggleDevTools();
} }
} }
}, }, ]
]
}); });
return template; return template;
}; };
@@ -111,4 +98,6 @@ var createMenu = function(mainWindow){
return Menu.buildFromTemplate(createTemplate(mainWindow)); return Menu.buildFromTemplate(createTemplate(mainWindow));
}; };
module.exports = { createMenu: createMenu }; module.exports = {
createMenu: createMenu
};

View File

@@ -1,9 +1,11 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>Mattermost</title> <title>Mattermost</title>
</head> </head>
<body> <body>
<!-- Modify src to your Mattermost url --> <!-- Modify src to your Mattermost url -->
<webview id="mainWebview" autosize="on" preload="webview/mattermost.js"></webview> <webview id="mainWebview" autosize="on" preload="webview/mattermost.js"></webview>
@@ -18,4 +20,5 @@
</style> </style>
<script src="./index.js"></script> <script src="./index.js"></script>
</body> </body>
</html> </html>

View File

@@ -14,7 +14,8 @@ try{
else { else {
throw 'URL is not configured'; throw 'URL is not configured';
} }
}catch(e){ }
catch (e) {
window.location.href = './settings.html'; window.location.href = './settings.html';
} }

View File

@@ -40,7 +40,10 @@ app.on('before-quit', function(){
// initialization and is ready to create browser windows. // initialization and is ready to create browser windows.
app.on('ready', function() { app.on('ready', function() {
// Create the browser window. // Create the browser window.
mainWindow = new BrowserWindow({width: 800, height: 600}); mainWindow = new BrowserWindow({
width: 800,
height: 600
});
// and load the index.html of the app. // and load the index.html of the app.
mainWindow.loadUrl('file://' + __dirname + '/index.html'); mainWindow.loadUrl('file://' + __dirname + '/index.html');

View File

@@ -1,12 +1,16 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>Settings</title> <title>Settings</title>
</head> </head>
<body> <body>
<h1>Settings</h1> <h1>Settings</h1>
<p>URL: <input type="text" id="url"></p> <p>URL:
<input type="text" id="url">
</p>
<input type="button" value="OK" onclick="saveSettings()"> <input type="button" value="OK" onclick="saveSettings()">
<input type="button" value="Cancel" onclick="goBack()"> <input type="button" value="Cancel" onclick="goBack()">
@@ -31,4 +35,5 @@
} }
</script> </script>
</body> </body>
</html> </html>