mirror of
https://github.com/zulip/zulip-desktop.git
synced 2025-11-03 13:33:18 +00:00
Fix lint errors.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
"use strict";
|
||||
'use strict';
|
||||
|
||||
class BaseComponent {
|
||||
generateNodeFromTemplate(template) {
|
||||
|
||||
@@ -18,7 +18,7 @@ class Tab extends BaseComponent {
|
||||
}
|
||||
|
||||
template() {
|
||||
if (this.type == Tab.SERVER_TAB) {
|
||||
if (this.type === Tab.SERVER_TAB) {
|
||||
return `<div class="tab" domain="${this.url}">
|
||||
<div class="server-tab-badge"></div>
|
||||
<div class="server-tab" style="background-image: url(${this.icon});"></div>
|
||||
@@ -43,7 +43,7 @@ class Tab extends BaseComponent {
|
||||
|
||||
updateBadge(count) {
|
||||
if (count > 0) {
|
||||
const formattedCount = count > 999? '1K+': count;
|
||||
const formattedCount = count > 999 ? '1K+' : count;
|
||||
|
||||
this.$badge.innerHTML = formattedCount;
|
||||
this.$badge.classList.add('active');
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
const DomainUtil = require(__dirname + '/../utils/domain-util.js');
|
||||
const SystemUtil = require(__dirname + '/../utils/system-util.js');
|
||||
const {linkIsInternal, skipImages} = require(__dirname + '/../../../main/link-helper');
|
||||
const {app, dialog} = require('electron').remote;
|
||||
const {app, dialog, shell} = require('electron').remote;
|
||||
const {ipcRenderer} = require('electron');
|
||||
|
||||
const BaseComponent = require(__dirname + '/../components/base.js');
|
||||
@@ -69,8 +69,8 @@ class WebView extends BaseComponent {
|
||||
|
||||
this.$el.addEventListener('dom-ready', this.show.bind(this));
|
||||
|
||||
this.$el.addEventListener('did-fail-load', (event) => {
|
||||
const {errorCode, errorDescription, validatedURL} = event;
|
||||
this.$el.addEventListener('did-fail-load', event => {
|
||||
const {errorDescription} = event;
|
||||
const hasConnectivityErr = (this.systemUtil.connectivityERR.indexOf(errorDescription) >= 0);
|
||||
if (hasConnectivityErr) {
|
||||
console.error('error', errorDescription);
|
||||
@@ -89,16 +89,18 @@ class WebView extends BaseComponent {
|
||||
}
|
||||
|
||||
getBadgeCount(title) {
|
||||
let messageCountInTitle = (/\(([0-9]+)\)/).exec(title);
|
||||
const messageCountInTitle = (/\(([0-9]+)\)/).exec(title);
|
||||
return messageCountInTitle ? Number(messageCountInTitle[1]) : 0;
|
||||
}
|
||||
|
||||
show() {
|
||||
// Do not show WebView if another tab was selected and this tab should be in background.
|
||||
if (!this.isActive()) return;
|
||||
if (!this.isActive()) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.$el.classList.remove('disabled');
|
||||
this.focus()
|
||||
this.focus();
|
||||
this.loading = false;
|
||||
this.onTitleChange(this.$el.getTitle());
|
||||
}
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
'use strict';
|
||||
|
||||
require(__dirname + '/js/tray.js');
|
||||
const {ipcRenderer} = require('electron');
|
||||
|
||||
const DomainUtil = require(__dirname + '/js/utils/domain-util.js');
|
||||
const SystemUtil = require(__dirname + '/js/utils/system-util.js');
|
||||
const {linkIsInternal, skipImages} = require(__dirname + '/../main/link-helper');
|
||||
const {shell, ipcRenderer} = require('electron');
|
||||
const WebView = require(__dirname + '/js/components/webview.js');
|
||||
const Tab = require(__dirname + '/js/components/tab.js');
|
||||
|
||||
@@ -36,7 +34,7 @@ class ServerManagerView {
|
||||
const servers = this.domainUtil.getDomains();
|
||||
if (servers.length > 0) {
|
||||
for (let i = 0; i < servers.length; i++) {
|
||||
this.initServer(servers[i], i)
|
||||
this.initServer(servers[i], i);
|
||||
}
|
||||
this.activateTab(0);
|
||||
} else {
|
||||
@@ -55,10 +53,12 @@ class ServerManagerView {
|
||||
}));
|
||||
this.webviews.push(new WebView({
|
||||
$root: this.$content,
|
||||
index: index,
|
||||
index,
|
||||
url: server.url,
|
||||
name: server.alias,
|
||||
isActive: () => {return index == this.activeTabIndex},
|
||||
isActive: () => {
|
||||
return index === this.activeTabIndex;
|
||||
},
|
||||
onTitleChange: this.updateBadge.bind(this),
|
||||
nodeIntegration: false
|
||||
}));
|
||||
@@ -82,7 +82,7 @@ class ServerManagerView {
|
||||
this.settingsTabIndex = this.webviews.length;
|
||||
|
||||
this.tabs.push(new Tab({
|
||||
url: url,
|
||||
url,
|
||||
name: 'Settings',
|
||||
type: Tab.SETTINGS_TAB,
|
||||
$root: this.$tabsContainer,
|
||||
@@ -92,9 +92,11 @@ class ServerManagerView {
|
||||
this.webviews.push(new WebView({
|
||||
$root: this.$content,
|
||||
index: this.settingsTabIndex,
|
||||
url: url,
|
||||
name: "Settings",
|
||||
isActive: () => {return this.settingsTabIndex == this.activeTabIndex},
|
||||
url,
|
||||
name: 'Settings',
|
||||
isActive: () => {
|
||||
return this.settingsTabIndex === this.activeTabIndex;
|
||||
},
|
||||
onTitleChange: this.updateBadge.bind(this),
|
||||
nodeIntegration: true
|
||||
}));
|
||||
@@ -137,16 +139,16 @@ class ServerManagerView {
|
||||
registerIpcs() {
|
||||
const webviewListeners = {
|
||||
'webview-reload': 'reload',
|
||||
'back': 'back',
|
||||
'focus': 'focus',
|
||||
'forward': 'forward',
|
||||
'zoomIn': 'zoomIn',
|
||||
'zoomOut': 'zoomOut',
|
||||
'zoomActualSize': 'zoomActualSize',
|
||||
back: 'back',
|
||||
focus: 'focus',
|
||||
forward: 'forward',
|
||||
zoomIn: 'zoomIn',
|
||||
zoomOut: 'zoomOut',
|
||||
zoomActualSize: 'zoomActualSize',
|
||||
'log-out': 'logOut',
|
||||
'shortcut': 'showShortcut',
|
||||
shortcut: 'showShortcut',
|
||||
'tab-devtools': 'openDevTools'
|
||||
}
|
||||
};
|
||||
|
||||
for (const key in webviewListeners) {
|
||||
ipcRenderer.on(key, () => {
|
||||
|
||||
Reference in New Issue
Block a user