Apply no-var eslint rule
This commit is contained in:
parent
d69bf3aa5e
commit
d73f98825e
|
@ -17,6 +17,7 @@
|
|||
"no-console": 0,
|
||||
"no-process-env": 0,
|
||||
"no-underscore-dangle": 1,
|
||||
"no-var": 2,
|
||||
"react/jsx-indent": [2, 2],
|
||||
"react/jsx-indent-props": [2, 2],
|
||||
"react/no-set-state": 1,
|
||||
|
|
|
@ -22,7 +22,7 @@ export default class LoginModal extends React.Component {
|
|||
}
|
||||
|
||||
render() {
|
||||
var theServer = '';
|
||||
let theServer = '';
|
||||
if (!this.props.show) {
|
||||
theServer = '';
|
||||
} else if (this.props.authInfo.isProxy) {
|
||||
|
|
|
@ -38,7 +38,7 @@ const MainPage = createReactClass({
|
|||
getInitialState() {
|
||||
let key = this.props.initialIndex;
|
||||
if (this.props.deeplinkingUrl !== null) {
|
||||
for (var i = 0; i < this.props.teams.length; i++) {
|
||||
for (let i = 0; i < this.props.teams.length; i++) {
|
||||
if (this.props.deeplinkingUrl.includes(this.props.teams[i].url)) {
|
||||
key = i;
|
||||
break;
|
||||
|
@ -57,7 +57,7 @@ const MainPage = createReactClass({
|
|||
};
|
||||
},
|
||||
componentDidMount() {
|
||||
var self = this;
|
||||
const self = this;
|
||||
ipcRenderer.on('login-request', (event, request, authInfo) => {
|
||||
self.setState({
|
||||
loginRequired: true,
|
||||
|
@ -96,7 +96,7 @@ const MainPage = createReactClass({
|
|||
self.refs[`mattermostView${self.state.key}`].focusOnWebView();
|
||||
}
|
||||
|
||||
var currentWindow = remote.getCurrentWindow();
|
||||
const currentWindow = remote.getCurrentWindow();
|
||||
currentWindow.on('focus', focusListener);
|
||||
window.addEventListener('beforeunload', () => {
|
||||
currentWindow.removeListener('focus', focusListener);
|
||||
|
@ -132,7 +132,7 @@ const MainPage = createReactClass({
|
|||
|
||||
ipcRenderer.on('protocol-deeplink', (event, deepLinkUrl) => {
|
||||
const lastUrlDomain = Utils.getDomain(deepLinkUrl);
|
||||
for (var i = 0; i < this.props.teams.length; i++) {
|
||||
for (let i = 0; i < this.props.teams.length; i++) {
|
||||
if (lastUrlDomain === Utils.getDomain(self.refs[`mattermostView${i}`].getSrc())) {
|
||||
if (this.state.key !== i) {
|
||||
this.handleSelect(i);
|
||||
|
@ -158,7 +158,7 @@ const MainPage = createReactClass({
|
|||
key: newKey,
|
||||
finderVisible: false,
|
||||
});
|
||||
var webview = document.getElementById('mattermostView' + newKey);
|
||||
const webview = document.getElementById('mattermostView' + newKey);
|
||||
ipcRenderer.send('update-title', {
|
||||
title: webview.getTitle(),
|
||||
});
|
||||
|
@ -166,10 +166,10 @@ const MainPage = createReactClass({
|
|||
},
|
||||
|
||||
handleUnreadCountChange(index, unreadCount, mentionCount, isUnread, isMentioned) {
|
||||
var unreadCounts = this.state.unreadCounts;
|
||||
var mentionCounts = this.state.mentionCounts;
|
||||
var unreadAtActive = this.state.unreadAtActive;
|
||||
var mentionAtActiveCounts = this.state.mentionAtActiveCounts;
|
||||
const unreadCounts = this.state.unreadCounts;
|
||||
const mentionCounts = this.state.mentionCounts;
|
||||
const unreadAtActive = this.state.unreadAtActive;
|
||||
const mentionAtActiveCounts = this.state.mentionAtActiveCounts;
|
||||
unreadCounts[index] = unreadCount;
|
||||
mentionCounts[index] = mentionCount;
|
||||
|
||||
|
@ -189,8 +189,8 @@ const MainPage = createReactClass({
|
|||
this.handleUnreadCountTotalChange();
|
||||
},
|
||||
markReadAtActive(index) {
|
||||
var unreadAtActive = this.state.unreadAtActive;
|
||||
var mentionAtActiveCounts = this.state.mentionAtActiveCounts;
|
||||
const unreadAtActive = this.state.unreadAtActive;
|
||||
const mentionAtActiveCounts = this.state.mentionAtActiveCounts;
|
||||
unreadAtActive[index] = false;
|
||||
mentionAtActiveCounts[index] = 0;
|
||||
this.setState({
|
||||
|
@ -201,7 +201,7 @@ const MainPage = createReactClass({
|
|||
},
|
||||
handleUnreadCountTotalChange() {
|
||||
if (this.props.onUnreadCountChange) {
|
||||
var allUnreadCount = this.state.unreadCounts.reduce((prev, curr) => {
|
||||
let allUnreadCount = this.state.unreadCounts.reduce((prev, curr) => {
|
||||
return prev + curr;
|
||||
}, 0);
|
||||
this.state.unreadAtActive.forEach((state) => {
|
||||
|
@ -209,7 +209,7 @@ const MainPage = createReactClass({
|
|||
allUnreadCount += 1;
|
||||
}
|
||||
});
|
||||
var allMentionCount = this.state.mentionCounts.reduce((prev, curr) => {
|
||||
let allMentionCount = this.state.mentionCounts.reduce((prev, curr) => {
|
||||
return prev + curr;
|
||||
}, 0);
|
||||
this.state.mentionAtActiveCounts.forEach((count) => {
|
||||
|
@ -277,8 +277,8 @@ const MainPage = createReactClass({
|
|||
},
|
||||
|
||||
render() {
|
||||
var self = this;
|
||||
var tabsRow;
|
||||
const self = this;
|
||||
let tabsRow;
|
||||
if (this.props.teams.length > 1) {
|
||||
tabsRow = (
|
||||
<Row>
|
||||
|
@ -300,15 +300,15 @@ const MainPage = createReactClass({
|
|||
);
|
||||
}
|
||||
|
||||
var views = this.props.teams.map((team, index) => {
|
||||
const views = this.props.teams.map((team, index) => {
|
||||
function handleUnreadCountChange(unreadCount, mentionCount, isUnread, isMentioned) {
|
||||
self.handleUnreadCountChange(index, unreadCount, mentionCount, isUnread, isMentioned);
|
||||
}
|
||||
function handleNotificationClick() {
|
||||
self.handleSelect(index);
|
||||
}
|
||||
var id = 'mattermostView' + index;
|
||||
var isActive = self.state.key === index;
|
||||
const id = 'mattermostView' + index;
|
||||
const isActive = self.state.key === index;
|
||||
|
||||
let teamUrl = team.url;
|
||||
const deeplinkingUrl = this.props.deeplinkingUrl;
|
||||
|
@ -332,21 +332,21 @@ const MainPage = createReactClass({
|
|||
active={isActive}
|
||||
/>);
|
||||
});
|
||||
var viewsRow = (
|
||||
const viewsRow = (
|
||||
<Row>
|
||||
{views}
|
||||
</Row>);
|
||||
|
||||
var request = null;
|
||||
var authServerURL = null;
|
||||
var authInfo = null;
|
||||
let request = null;
|
||||
let authServerURL = null;
|
||||
let authInfo = null;
|
||||
if (this.state.loginQueue.length !== 0) {
|
||||
request = this.state.loginQueue[0].request;
|
||||
const tmpURL = url.parse(this.state.loginQueue[0].request.url);
|
||||
authServerURL = `${tmpURL.protocol}//${tmpURL.host}`;
|
||||
authInfo = this.state.loginQueue[0].authInfo;
|
||||
}
|
||||
var modal = (
|
||||
const modal = (
|
||||
<NewTeamModal
|
||||
show={this.state.showNewTeamModal}
|
||||
onClose={() => {
|
||||
|
|
|
@ -72,8 +72,8 @@ const MattermostView = createReactClass({
|
|||
},
|
||||
|
||||
componentDidMount() {
|
||||
var self = this;
|
||||
var webview = findDOMNode(this.refs.webview);
|
||||
const self = this;
|
||||
const webview = findDOMNode(this.refs.webview);
|
||||
|
||||
webview.addEventListener('did-fail-load', (e) => {
|
||||
console.log(self.props.name, 'webview did-fail-load', e);
|
||||
|
@ -105,8 +105,8 @@ const MattermostView = createReactClass({
|
|||
|
||||
// Open link in browserWindow. for exmaple, attached files.
|
||||
webview.addEventListener('new-window', (e) => {
|
||||
var currentURL = url.parse(webview.getURL());
|
||||
var destURL = url.parse(e.url);
|
||||
const currentURL = url.parse(webview.getURL());
|
||||
const destURL = url.parse(e.url);
|
||||
if (destURL.protocol !== 'http:' && destURL.protocol !== 'https:' && destURL.protocol !== `${scheme}:`) {
|
||||
ipcRenderer.send('confirm-protocol', destURL.protocol, e.url);
|
||||
return;
|
||||
|
@ -157,15 +157,17 @@ const MattermostView = createReactClass({
|
|||
isLoaded: true,
|
||||
});
|
||||
break;
|
||||
case 'onUnreadCountChange':
|
||||
var unreadCount = event.args[0];
|
||||
var mentionCount = event.args[1];
|
||||
case 'onUnreadCountChange': {
|
||||
const unreadCount = event.args[0];
|
||||
const mentionCount = event.args[1];
|
||||
|
||||
// isUnread and isMentioned is pulse flag.
|
||||
var isUnread = event.args[2];
|
||||
var isMentioned = event.args[3];
|
||||
const isUnread = event.args[2];
|
||||
const isMentioned = event.args[3];
|
||||
self.handleUnreadCountChange(unreadCount, mentionCount, isUnread, isMentioned);
|
||||
|
||||
break;
|
||||
}
|
||||
case 'onNotificationClick':
|
||||
self.props.onNotificationClick();
|
||||
break;
|
||||
|
@ -216,7 +218,7 @@ const MattermostView = createReactClass({
|
|||
reloadTimeoutID: null,
|
||||
isLoaded: false,
|
||||
});
|
||||
var webview = findDOMNode(this.refs.webview);
|
||||
const webview = findDOMNode(this.refs.webview);
|
||||
webview.reload();
|
||||
},
|
||||
|
||||
|
@ -224,7 +226,7 @@ const MattermostView = createReactClass({
|
|||
this.setState({
|
||||
errorInfo: null,
|
||||
});
|
||||
var webContents = findDOMNode(this.refs.webview).getWebContents();
|
||||
const webContents = findDOMNode(this.refs.webview).getWebContents();
|
||||
webContents.session.clearCache(() => {
|
||||
webContents.reload();
|
||||
});
|
||||
|
|
|
@ -38,7 +38,7 @@ const SettingsPage = createReactClass({
|
|||
},
|
||||
|
||||
getInitialState() {
|
||||
var initialState;
|
||||
let initialState;
|
||||
try {
|
||||
initialState = settings.readFileSync(this.props.configFile);
|
||||
} catch (e) {
|
||||
|
@ -59,7 +59,7 @@ const SettingsPage = createReactClass({
|
|||
},
|
||||
componentDidMount() {
|
||||
if (process.platform === 'win32' || process.platform === 'linux') {
|
||||
var self = this;
|
||||
const self = this;
|
||||
appLauncher.isEnabled().then((enabled) => {
|
||||
self.setState({
|
||||
autostart: enabled,
|
||||
|
@ -125,7 +125,7 @@ const SettingsPage = createReactClass({
|
|||
},
|
||||
|
||||
saveConfig(callback) {
|
||||
var config = {
|
||||
const config = {
|
||||
teams: this.state.teams,
|
||||
showTrayIcon: this.state.showTrayIcon,
|
||||
trayIconTheme: this.state.trayIconTheme,
|
||||
|
@ -178,7 +178,7 @@ const SettingsPage = createReactClass({
|
|||
backToIndex();
|
||||
},
|
||||
handleChangeShowTrayIcon() {
|
||||
var shouldShowTrayIcon = !this.refs.showTrayIcon.props.checked;
|
||||
const shouldShowTrayIcon = !this.refs.showTrayIcon.props.checked;
|
||||
this.setState({
|
||||
showTrayIcon: shouldShowTrayIcon,
|
||||
});
|
||||
|
@ -271,7 +271,7 @@ const SettingsPage = createReactClass({
|
|||
},
|
||||
|
||||
updateTeam(index, newData) {
|
||||
var teams = this.state.teams;
|
||||
const teams = this.state.teams;
|
||||
teams[index] = newData;
|
||||
this.setState({
|
||||
teams,
|
||||
|
@ -280,7 +280,7 @@ const SettingsPage = createReactClass({
|
|||
},
|
||||
|
||||
addServer(team) {
|
||||
var teams = this.state.teams;
|
||||
const teams = this.state.teams;
|
||||
teams.push(team);
|
||||
this.setState({
|
||||
teams,
|
||||
|
@ -324,7 +324,7 @@ const SettingsPage = createReactClass({
|
|||
},
|
||||
};
|
||||
|
||||
var teamsRow = (
|
||||
const teamsRow = (
|
||||
<Row>
|
||||
<Col md={12}>
|
||||
<TeamList
|
||||
|
@ -344,7 +344,7 @@ const SettingsPage = createReactClass({
|
|||
</Row>
|
||||
);
|
||||
|
||||
var serversRow = (
|
||||
const serversRow = (
|
||||
<Row>
|
||||
<Col
|
||||
md={10}
|
||||
|
@ -375,7 +375,7 @@ const SettingsPage = createReactClass({
|
|||
</Row>
|
||||
);
|
||||
|
||||
var srvMgmt;
|
||||
let srvMgmt;
|
||||
if (this.props.enableServerManagement === true) {
|
||||
srvMgmt = (
|
||||
<div>
|
||||
|
@ -386,7 +386,7 @@ const SettingsPage = createReactClass({
|
|||
);
|
||||
}
|
||||
|
||||
var options = [];
|
||||
const options = [];
|
||||
|
||||
// MacOS has an option in the Dock, to set the app to autostart, so we choose to not support this option for OSX
|
||||
if (process.platform === 'win32' || process.platform === 'linux') {
|
||||
|
@ -576,7 +576,7 @@ const SettingsPage = createReactClass({
|
|||
</Checkbox>
|
||||
);
|
||||
|
||||
var optionsRow = (options.length > 0) ? (
|
||||
const optionsRow = (options.length > 0) ? (
|
||||
<Row>
|
||||
<Col md={12}>
|
||||
<h2 style={settingsPage.sectionHeading}>{'App Options'}</h2>
|
||||
|
|
|
@ -35,12 +35,12 @@ const TeamList = createReactClass({
|
|||
},
|
||||
handleTeamRemove(index) {
|
||||
console.log(index);
|
||||
var teams = this.props.teams;
|
||||
const teams = this.props.teams;
|
||||
teams.splice(index, 1);
|
||||
this.props.onTeamsChange(teams);
|
||||
},
|
||||
handleTeamAdd(team) {
|
||||
var teams = this.props.teams;
|
||||
const teams = this.props.teams;
|
||||
|
||||
// check if team already exists and then change existing team or add new one
|
||||
if ((typeof team.index !== 'undefined') && teams[team.index]) {
|
||||
|
@ -81,8 +81,8 @@ const TeamList = createReactClass({
|
|||
},
|
||||
|
||||
render() {
|
||||
var self = this;
|
||||
var teamNodes = this.props.teams.map((team, i) => {
|
||||
const self = this;
|
||||
const teamNodes = this.props.teams.map((team, i) => {
|
||||
function handleTeamRemove() {
|
||||
document.activeElement.blur();
|
||||
self.openServerRemoveModal(i);
|
||||
|
@ -110,7 +110,7 @@ const TeamList = createReactClass({
|
|||
);
|
||||
});
|
||||
|
||||
var addServerForm = (
|
||||
const addServerForm = (
|
||||
<NewTeamModal
|
||||
show={this.props.showAddTeamForm || this.state.showEditTeamForm}
|
||||
editMode={this.state.showEditTeamForm}
|
||||
|
@ -126,7 +126,7 @@ const TeamList = createReactClass({
|
|||
this.props.setAddTeamFormVisibility(false);
|
||||
}}
|
||||
onSave={(newTeam) => {
|
||||
var teamData = {
|
||||
const teamData = {
|
||||
name: newTeam.name,
|
||||
url: newTeam.url,
|
||||
};
|
||||
|
|
|
@ -51,7 +51,7 @@ window.addEventListener('load', () => {
|
|||
});
|
||||
|
||||
function hasClass(element, className) {
|
||||
var rclass = /[\t\r\n\f]/g;
|
||||
const rclass = /[\t\r\n\f]/g;
|
||||
if ((' ' + element.className + ' ').replace(rclass, ' ').indexOf(className) > -1) {
|
||||
return true;
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ function getUnreadCount() {
|
|||
|
||||
// unreadCount in sidebar
|
||||
// Note: the active channel doesn't have '.unread-title'.
|
||||
var unreadCount = document.getElementsByClassName('unread-title').length;
|
||||
let unreadCount = document.getElementsByClassName('unread-title').length;
|
||||
|
||||
// unreadCount in team sidebar
|
||||
const teamSideBar = document.getElementsByClassName('team-sidebar'); // team-sidebar doesn't have id
|
||||
|
@ -86,30 +86,30 @@ function getUnreadCount() {
|
|||
}
|
||||
|
||||
// mentionCount in sidebar
|
||||
var elem = document.getElementsByClassName('badge');
|
||||
var mentionCount = 0;
|
||||
for (var i = 0; i < elem.length; i++) {
|
||||
const elem = document.getElementsByClassName('badge');
|
||||
let mentionCount = 0;
|
||||
for (let i = 0; i < elem.length; i++) {
|
||||
if (isElementVisible(elem[i]) && !hasClass(elem[i], 'badge-notify')) {
|
||||
mentionCount += Number(elem[i].innerHTML);
|
||||
}
|
||||
}
|
||||
|
||||
var postAttrName = 'data-reactid';
|
||||
var lastPostElem = document.querySelector('div[' + postAttrName + '="' + this.lastCheckedPostId + '"]');
|
||||
var isUnread = false;
|
||||
var isMentioned = false;
|
||||
const postAttrName = 'data-reactid';
|
||||
const lastPostElem = document.querySelector('div[' + postAttrName + '="' + this.lastCheckedPostId + '"]');
|
||||
let isUnread = false;
|
||||
let isMentioned = false;
|
||||
if (lastPostElem === null || !isElementVisible(lastPostElem)) {
|
||||
// When load channel or change channel, this.lastCheckedPostId is invalid.
|
||||
// So we get latest post and save lastCheckedPostId.
|
||||
|
||||
// find active post-list.
|
||||
var postLists = document.querySelectorAll('div.post-list__content');
|
||||
const postLists = document.querySelectorAll('div.post-list__content');
|
||||
if (postLists.length === 0) {
|
||||
setTimeout(getUnreadCount, UNREAD_COUNT_INTERVAL);
|
||||
return;
|
||||
}
|
||||
var post = null;
|
||||
for (var j = 0; j < postLists.length; j++) {
|
||||
let post = null;
|
||||
for (let j = 0; j < postLists.length; j++) {
|
||||
if (isElementVisible(postLists[j])) {
|
||||
post = postLists[j].children[0];
|
||||
}
|
||||
|
@ -130,19 +130,19 @@ function getUnreadCount() {
|
|||
post = post.nextSibling;
|
||||
}
|
||||
} else if (lastPostElem !== null) {
|
||||
var newPostElem = lastPostElem.nextSibling;
|
||||
let newPostElem = lastPostElem.nextSibling;
|
||||
while (newPostElem) {
|
||||
this.lastCheckedPostId = newPostElem.getAttribute(postAttrName);
|
||||
isUnread = true;
|
||||
var activeChannel = document.querySelector('.active .sidebar-channel');
|
||||
var closeButton = activeChannel.getElementsByClassName('btn-close');
|
||||
const activeChannel = document.querySelector('.active .sidebar-channel');
|
||||
const closeButton = activeChannel.getElementsByClassName('btn-close');
|
||||
if (closeButton.length === 1 && closeButton[0].getAttribute('aria-describedby') === 'remove-dm-tooltip') {
|
||||
// If active channel is DM, all posts is treated as menion.
|
||||
isMentioned = true;
|
||||
break;
|
||||
} else {
|
||||
// If active channel is public/private channel, only mentioned post is treated as mention.
|
||||
var highlight = newPostElem.getElementsByClassName('mention-highlight');
|
||||
const highlight = newPostElem.getElementsByClassName('mention-highlight');
|
||||
if (highlight.length !== 0 && isElementVisible(highlight[0])) {
|
||||
isMentioned = true;
|
||||
break;
|
||||
|
|
|
@ -20,7 +20,7 @@ function upgradeV0toV1(configV0) {
|
|||
}
|
||||
|
||||
export default function upgradeToLatest(config) {
|
||||
var configVersion = config.version ? config.version : 0;
|
||||
const configVersion = config.version ? config.version : 0;
|
||||
switch (configVersion) {
|
||||
case 0:
|
||||
return upgradeToLatest(upgradeV0toV1(config));
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
'use strict';
|
||||
|
||||
import os from 'os';
|
||||
var releaseSplit = os.release().split('.');
|
||||
const releaseSplit = os.release().split('.');
|
||||
|
||||
export default {
|
||||
major: parseInt(releaseSplit[0], 10),
|
||||
|
|
|
@ -45,7 +45,7 @@ export default {
|
|||
if (config.version !== defaultPreferences.version) {
|
||||
throw new Error('version ' + config.version + ' is not equal to ' + defaultPreferences.version);
|
||||
}
|
||||
var data = JSON.stringify(config, null, ' ');
|
||||
const data = JSON.stringify(config, null, ' ');
|
||||
fs.writeFile(configFile, data, 'utf8', callback);
|
||||
},
|
||||
|
||||
|
@ -59,7 +59,7 @@ export default {
|
|||
fs.mkdirSync(dir);
|
||||
}
|
||||
|
||||
var data = JSON.stringify(config, null, ' ');
|
||||
const data = JSON.stringify(config, null, ' ');
|
||||
fs.writeFileSync(configFile, data, 'utf8');
|
||||
},
|
||||
|
||||
|
|
14
src/main.js
14
src/main.js
|
@ -58,7 +58,7 @@ const assetsDir = path.resolve(app.getAppPath(), 'assets');
|
|||
|
||||
// Keep a global reference of the window object, if you don't, the window will
|
||||
// be closed automatically when the JavaScript object is garbage collected.
|
||||
var mainWindow = null;
|
||||
let mainWindow = null;
|
||||
let spellChecker = null;
|
||||
let deeplinkingUrl = null;
|
||||
let scheme = null;
|
||||
|
@ -74,7 +74,7 @@ if (argv['data-dir']) {
|
|||
|
||||
global.isDev = isDev && !argv.disableDevMode;
|
||||
|
||||
var config = {};
|
||||
let config = {};
|
||||
try {
|
||||
const configFile = app.getPath('userData') + '/config.json';
|
||||
config = settings.readFileSync(configFile);
|
||||
|
@ -117,7 +117,7 @@ function switchMenuIconImages(icons, isDarkMode) {
|
|||
}
|
||||
}
|
||||
|
||||
var trayIcon = null;
|
||||
let trayIcon = null;
|
||||
const trayImages = (() => {
|
||||
switch (process.platform) {
|
||||
case 'win32':
|
||||
|
@ -293,7 +293,7 @@ app.on('certificate-error', (event, webContents, url, error, certificate, callba
|
|||
event.preventDefault();
|
||||
callback(true);
|
||||
} else {
|
||||
var detail = `URL: ${url}\nError: ${error}`;
|
||||
let detail = `URL: ${url}\nError: ${error}`;
|
||||
if (certificateStore.isExisting(url)) {
|
||||
detail = 'Certificate is different from previous one.\n\n' + detail;
|
||||
}
|
||||
|
@ -543,8 +543,8 @@ app.on('ready', () => {
|
|||
|
||||
if (process.platform === 'darwin') {
|
||||
session.defaultSession.on('will-download', (event, item) => {
|
||||
var filename = item.getFilename();
|
||||
var savePath = dialog.showSaveDialog({
|
||||
const filename = item.getFilename();
|
||||
const savePath = dialog.showSaveDialog({
|
||||
title: filename,
|
||||
defaultPath: os.homedir() + '/Downloads/' + filename,
|
||||
});
|
||||
|
@ -559,7 +559,7 @@ app.on('ready', () => {
|
|||
|
||||
// Set application menu
|
||||
ipcMain.on('update-menu', (event, configData) => {
|
||||
var aMenu = appMenu.createMenu(mainWindow, configData, global.isDev);
|
||||
const aMenu = appMenu.createMenu(mainWindow, configData, global.isDev);
|
||||
Menu.setApplicationMenu(aMenu);
|
||||
|
||||
// set up context menu for tray icon
|
||||
|
|
|
@ -9,7 +9,7 @@ import fs from 'fs';
|
|||
import {app, dialog, ipcMain, shell} from 'electron';
|
||||
|
||||
const allowedProtocolFile = path.resolve(app.getPath('userData'), 'allowedProtocols.json');
|
||||
var allowedProtocols = [];
|
||||
let allowedProtocols = [];
|
||||
|
||||
function init(mainWindow) {
|
||||
fs.readFile(allowedProtocolFile, 'utf-8', (err, data) => {
|
||||
|
|
|
@ -56,7 +56,7 @@ CertificateStore.prototype.isExisting = function isExisting(targetURL) {
|
|||
};
|
||||
|
||||
CertificateStore.prototype.isTrusted = function isTrusted(targetURL, certificate) {
|
||||
var host = getHost(targetURL);
|
||||
const host = getHost(targetURL);
|
||||
if (!this.isExisting(targetURL)) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ import path from 'path';
|
|||
import {app, BrowserWindow} from 'electron';
|
||||
|
||||
function saveWindowState(file, window) {
|
||||
var windowState = window.getBounds();
|
||||
const windowState = window.getBounds();
|
||||
windowState.maximized = window.isMaximized();
|
||||
windowState.fullscreen = window.isFullScreen();
|
||||
try {
|
||||
|
@ -26,7 +26,7 @@ function createMainWindow(config, options) {
|
|||
|
||||
// Create the browser window.
|
||||
const boundsInfoPath = path.join(app.getPath('userData'), 'bounds-info.json');
|
||||
var windowOptions;
|
||||
let windowOptions;
|
||||
try {
|
||||
windowOptions = JSON.parse(fs.readFileSync(boundsInfoPath, 'utf-8'));
|
||||
} catch (e) {
|
||||
|
|
|
@ -15,11 +15,11 @@ function createTemplate(mainWindow, config, isDev) {
|
|||
type: 'separator',
|
||||
};
|
||||
|
||||
var appName = app.getName();
|
||||
var firstMenuName = (process.platform === 'darwin') ? appName : 'File';
|
||||
var template = [];
|
||||
const appName = app.getName();
|
||||
const firstMenuName = (process.platform === 'darwin') ? appName : 'File';
|
||||
const template = [];
|
||||
|
||||
var platformAppMenu = process.platform === 'darwin' ? [{
|
||||
let platformAppMenu = process.platform === 'darwin' ? [{
|
||||
label: 'About ' + appName,
|
||||
role: 'about',
|
||||
click() {
|
||||
|
@ -217,7 +217,7 @@ function createTemplate(mainWindow, config, isDev) {
|
|||
}],
|
||||
};
|
||||
template.push(windowMenu);
|
||||
var submenu = [];
|
||||
const submenu = [];
|
||||
if (buildConfig.helpLink) {
|
||||
submenu.push({
|
||||
label: 'Learn More...',
|
||||
|
|
|
@ -10,7 +10,7 @@ import settings from '../../common/settings';
|
|||
function createTemplate(mainWindow, config, isDev) {
|
||||
const settingsURL = isDev ? 'http://localhost:8080/browser/settings.html' : `file://${app.getAppPath()}/browser/settings.html`;
|
||||
const teams = settings.mergeDefaultTeams(config.teams);
|
||||
var template = [
|
||||
const template = [
|
||||
...teams.slice(0, 9).map((team, i) => {
|
||||
return {
|
||||
label: team.name,
|
||||
|
|
Loading…
Reference in a new issue