Permalink
Browse files

Updates from week #8 - Theming the chat window is in! Also, more comm…

…ents!
  • Loading branch information...
roncli committed May 9, 2017
1 parent 1350be6 commit 032fce07d14e1afba51de3b60c0e3fa675a174e7
@@ -0,0 +1,25 @@
{
"env": {
"browser": true,
"es6": true,
"jquery": true,
"node": true
},
"parserOptions": {
"ecmaFeatures": {
"impliedStrict": true
},
"sourceType": "module",
"ecmaVersion": 6
},
"rules": {
"constructor-super": "warn",
"no-const-assign": "warn",
"no-this-before-super": "warn",
"no-undef": "warn",
"no-unreachable": "warn",
"no-unused-vars": "warn",
"semi": "warn",
"valid-typeof": "warn"
}
}
@@ -1,6 +1,15 @@
const {app, BrowserWindow, Menu} = require("electron");
const {app, BrowserWindow} = require("electron"),
MainMenu = require("./mainmenu"),

var win,
// # # # # #
// # # # #
// ## ### ## ### ### ## # # ## ### ### ## # #
// # # # # ## # # # # ## #### # # # # # # # # #
// # # ## # ## # ## #### # # # # # # # ####
// ## # ## # # ## ## # # ### # # ### ## ####
/**
* Creates the main window.
*/
createWindow = () => {
win = new BrowserWindow({show: false, width: 800, height: 600, minWidth: 800, minHeight: 600, icon: __dirname + "/../logo/logo.ico", title: "Hyperdrive Toolkit"}); // TODO: Get the right icon.
win.loadURL(`file://${__dirname}/site/index.htm`);
@@ -16,17 +25,40 @@ var win,
win = null;
});

require("./mainmenu");
this.menu = new MainMenu(win);
};

var win;

// #
// #
// ### ### ### ## ### ### ## ### ### # #
// # # # # # # # # # # # # # ## # # # # # #
// # ## # # # # # # # # # ## # ## # # # #
// # # ### ### ## # # # ## # # ### #
// # # #
app.on("ready", createWindow);

// # # ## ## ## #
// # # # # #
// ### ### ### ## ### # # ## ### ### ## # # ### # # ## # ## ### ## ###
// # # # # # # # # # # # # # # # # # # # # # #### # # # # #### # # # # ## # ## # #
// # ## # # # # # # # # #### # # # # # # # #### # ## # # # # # # ## ## # #
// # # ### ### ## # # #### ### # # ### ## #### # # ### ### ## ### ## ### ## ###
// # #
app.on("window-all-closed", () => {
if (process.platform !== "darwin") {
app.quit();
}
});

// # # #
// # #
// ### ### ### ## ### ### ## ### ## # # ### ### ##
// # # # # # # # # # # # # # # # # # # # # # ##
// # ## # # # # # # # # # ## # # # # # # ## # ##
// # # ### ### ## # # # # ## ## ### # # # ## ##
// # #
app.on("activate", () => {
if (win === null) {
createWindow();
@@ -1,80 +1,109 @@
var settingsWin;
const electron = require("electron"),
BrowserWindow = electron.BrowserWindow,
Menu = electron.Menu;

const {Menu, BrowserWindow} = require("electron"),
isMac = process.platform === "darwin",
template = [
{
label: "&File",
submenu: [
// # # # # #
// # # # #
// ## ## ### ## # ## ## ## ### # ## # #
// # # # # # ## # # # # # # ## # # #
// # # #### # # # # # ##### # # # #
// # # # # # # # # # # # # # ##
// # # #### ### # # # # ### # # ## #
/**
* The main menu for the application.
*/
class MainMenu {
// # #
// # #
// ## ## ### ### ### ### # # ## ### ## ###
// # # # # # ## # # # # # # # # # # #
// # # # # # ## # # # # # # # # #
// ## ## # # ### ## # ### ## ## ## #
/**
* Creates the main menu and attaches it to the application.
* @param {BrowserWindow} win The browser window to set as the parent of windows opened by the main menu.
*/
constructor(win) {
var mainMenu = this,
isMac = process.platform === "darwin",
template = [
{
label: "&Settings",
click: (menuItem, browserWindow, ev) => {
if (settingsWin) {
// TODO: Focus settings window.
} else {
settingsWin = new BrowserWindow({show: false, width: 800, height: 600, icon: __dirname + "/../logo/logo.ico", title: "Settings - Hyperdrive Toolkit"}); // TODO: Get the right icon, setup proper dimensions, don't allow change in size.
label: "&File",
submenu: [
{
label: "&Settings",
click: () => {
if (mainMenu.settingsWin) {
mainMenu.settingsWin.show();
} else {
mainMenu.settingsWin = new BrowserWindow({show: false, width: 800, height: 600, icon: __dirname + "/../logo/logo.ico", title: "Settings - Hyperdrive Toolkit", parent: mainMenu.win}); // TODO: Get the right icon, setup proper dimensions, don't allow change in size.

settingsWin.loadURL(`file://${__dirname}/site/settings.htm`);
settingsWin.setMenu(null);
settingsWin.toggleDevTools(); // TODO: Remove for release.
mainMenu.settingsWin.loadURL(`file://${__dirname}/site/settings.htm`);
mainMenu.settingsWin.setMenu(null);
mainMenu.settingsWin.toggleDevTools(); // TODO: Remove for release.

settingsWin.once("ready-to-show", () => {
settingsWin.show();
});
mainMenu.settingsWin.once("ready-to-show", () => {
mainMenu.settingsWin.show();
});

settingsWin.on("closed", () => {
settingsWin = null;
});
mainMenu.settingsWin.on("closed", () => {
mainMenu.settingsWin = null;
});
}
}
},
{
type: "separator"
},
{
label: isMac ? "&Quit" : "E&xit",
accelerator: isMac ? "Cmd+Q" : "Alt+F4",
role: "quit"
}
}
]
},
{
type: "separator"
},
{
label: isMac ? "&Quit" : "E&xit",
accelerator: isMac ? "Cmd+Q" : "Alt+F4",
role: "quit"
}
]
},
{
label: "&Edit",
submenu: [
{
label: "&Undo",
accelerator: "CmdOrCtrl+Z"
},
{
label: "&Redo",
accelerator: "CmdOrCtrl+Y"
},
{
type: "separator"
},
{
label: "Cu&t",
accelerator: "CmdOrCtrl+X"
},
{
label: "&Copy",
accelerator: "CmdOrCtrl+C"
},
{
label: "&Paste",
accelerator: "CmdOrCtrl+V"
},
{
label: "&Delete",
accelerator: "Delete"
},
{
label: "Select A&ll",
accelerator: "CmdOrCtrl+A"
label: "&Edit",
submenu: [
{
label: "&Undo",
accelerator: "CmdOrCtrl+Z"
},
{
label: "&Redo",
accelerator: "CmdOrCtrl+Y"
},
{
type: "separator"
},
{
label: "Cu&t",
accelerator: "CmdOrCtrl+X"
},
{
label: "&Copy",
accelerator: "CmdOrCtrl+C"
},
{
label: "&Paste",
accelerator: "CmdOrCtrl+V"
},
{
label: "&Delete",
accelerator: "Delete"
},
{
label: "Select A&ll",
accelerator: "CmdOrCtrl+A"
}
]
}
]
}
],
menu = Menu.buildFromTemplate(template);
],
menu = Menu.buildFromTemplate(template);

this.win = win;
Menu.setApplicationMenu(menu);
}
}

Menu.setApplicationMenu(menu);
module.exports = MainMenu;
@@ -20,7 +20,9 @@
"dependencies": {
"bootstrap": "3.3.7",
"express": "4.15.2",
"iconv-lite": "0.4.17",
"jquery": "3.2.1",
"node-fonts": "1.0.0",
"tmi.js": "1.1.2",
"twitch-api": "0.4.6"
},
@@ -3,6 +3,7 @@ body {
flex-direction: column;
width: 100%;
height: 100%;
line-height: 1.2;
}

#channels {
@@ -0,0 +1,18 @@
.table-row {
display: table;
table-layout: fixed;
width: 100%;
}

.caption {
padding: 1px 3px;
display: table-cell;
flex: 1;
text-align: right;
}

.input {
padding: 1px 3px;
display: table-cell;
flex: 1;
}
@@ -1,6 +1,25 @@
var EventEmitter = require("events");

// ### # #
// # # # #
// # # ## ### ####
// # ## # # #
// # # # #### #
// # # # # # # # #
// ### # # #### ##
/**
* A class that represents a chat module.
*/
class Chat extends EventEmitter {
// # #
// # #
// ## ## ### ### ### ### # # ## ### ## ###
// # # # # # ## # # # # # # # # # # #
// # # # # # ## # # # # # # # # #
// ## ## # # ### ## # ### ## ## ## #
/**
* Creates the chat module.
*/
constructor() {
super();
}
@@ -1,5 +1,28 @@
class DataStore {
constructor() {}
var EventEmitter = require("events");

// #### # ### #
// # # # # # #
// # # ### #### ### # #### ### # ## ###
// # # # # # ### # # # ## # # #
// # # #### # #### # # # # # #####
// # # # # # # # # # # # # # # # #
// #### #### ## #### ### ## ### # ###
/**
* A class that represents a data store module.
*/
class DataStore extends EventEmitter {
// # #
// # #
// ## ## ### ### ### ### # # ## ### ## ###
// # # # # # ## # # # # # # # # # # #
// # # # # # ## # # # # # # # # #
// ## ## # # ### ## # ### ## ## ## #
/**
* Creates the data store module.
*/
constructor() {
super();
}
}

module.exports = DataStore;
@@ -1,3 +1,13 @@
// ### #
// # #
// # # # ##
// # # # #
// # ## # # #
// # # # ## #
// ### ## # ###
/**
* A class that represents a GUI module.
*/
class Gui {
constructor() {}
}
@@ -1,3 +1,10 @@
// # ## ## # # # ###
// # # # # # ## # # # #
// # # # # ## # ### ### # # # # ### ### ### ##
// # # # # # ## # # # # # ### # # # # ## # ##
// # # # # # # # ## ## # # # # # # ## # ## ##
// ## ## ## # # ## ## # # # # # # ### ##
// #
JSON.tryParse = (str) => {
return new Promise((resolve, reject) => {
var initialStr = str;
Oops, something went wrong.

0 comments on commit 032fce0

Please sign in to comment.