Browse Source

Please don't abuse ternary operator for operations without a value.

It makes the linters angry.
pull/3202/head
TheGoddessInari 7 years ago
parent
commit
13b3b1049b
  1. 14
      app.js
  2. 6
      app/Application.js
  3. 6
      app/store/Services.js
  4. 8
      app/ux/WebView.js
  5. 18
      app/view/add/Add.js

14
app.js

@ -19,10 +19,14 @@ const ipc = require('electron').ipcRenderer;
require('electron-context-menu')();
ipc.on('showAbout', function(event, message) {
!Ext.cq1('about') ? Ext.create('Rambox.view.main.About') : '';
if(!Ext.cq1('about')) {
Ext.create('Rambox.view.main.About');
}
});
ipc.on('showPreferences', function(event, message) {
!Ext.cq1('preferences') ? Ext.create('Rambox.view.preferences.Preferences').show() : '';
if (!Ext.cq1('preferences')) {
Ext.create('Rambox.view.preferences.Preferences').show();
}
});
ipc.on('autoUpdater:check-update', function() {
Rambox.app.checkUpdate();
@ -135,7 +139,11 @@ ipc.on('toggleStatusBar', function() {
var tab = Ext.cq1('app-main').getActiveTab();
if ( tab.id !== 'ramboxTab' ) {
tab.down('statusbar').closed ? tab.setStatusBar(tab.record.get('statusbar')) : tab.closeStatusBar();
if (tab.down('statusbar').closed) {
tab.setStatusBar(tab.record.get('statusbar'));
} else {
tab.closeStatusBar();
}
}
});
// Focus the current service when Alt + Tab or click in webviews textfields

6
app/Application.js

@ -123,7 +123,11 @@ Ext.define('Rambox.Application', {
var tabPanel = Ext.cq1('app-main');
if ( tabPanel.items.indexOf(tabPanel.getActiveTab()) === 0 ) return false;
key === Ext.event.Event.NUM_PLUS || key === 187 ? tabPanel.getActiveTab().zoomIn() : tabPanel.getActiveTab().zoomOut();
if (key === Ext.event.Event.NUM_PLUS || key === 187) {
tabPanel.getActiveTab().zoomIn();
} else {
tabPanel.getActiveTab().zoomOut();
}
}
}
,{

6
app/store/Services.js

@ -46,7 +46,11 @@ Ext.define('Rambox.store.Services', {
}
};
service.get('align') === 'left' ? servicesLeft.push(cfg) : servicesRight.push(cfg);
if (service.get('align') === 'left') {
servicesLeft.push(cfg);
} else {
servicesRight.push(cfg);
}
});
if ( !Ext.isEmpty(servicesLeft) ) Ext.cq1('app-main').insert(1, servicesLeft);

8
app/ux/WebView.js

@ -598,7 +598,13 @@ Ext.define('Rambox.ux.WebView',{
var me = this;
var webview = me.down('component').el.dom;
if ( me.record.get('enabled') ) webview.isDevToolsOpened() ? webview.closeDevTools() : webview.openDevTools();
if ( me.record.get('enabled')) {
if (webview.isDevToolsOpened()) {
webview.closeDevTools();
} else {
webview.openDevTools();
}
}
}
,setURL: function(url) {

18
app/view/add/Add.js

@ -104,11 +104,23 @@ Ext.define('Rambox.view.add.Add',{
cycleBtn.previousSibling().reset();
if ( me.edit && cycleBtn.nextSibling().originalValue !== '2' ) {
me.service.get('custom_domain') && !activeItem.custom ? cycleBtn.previousSibling().reset() : cycleBtn.previousSibling().setValue('');
if (me.service.get('custom_domain') && !activeItem.custom) {
cycleBtn.previousSibling().reset();
} else {
cycleBtn.previousSibling().setValue('');
}
} else if ( me.edit && cycleBtn.nextSibling().originalValue === '2' ) {
me.service.get('custom_domain') && !activeItem.custom ? cycleBtn.previousSibling().setValue( me.service.get('url').indexOf('___') === -1 && me.service.get('custom_domain') ? me.service.get('url') : '') : cycleBtn.previousSibling().reset();
if (me.service.get('custom_domain') && !activeItem.custom) {
cycleBtn.previousSibling().setValue( me.service.get('url').indexOf('___') === -1 && me.service.get('custom_domain') ? me.service.get('url') : '');
} else {
cycleBtn.previousSibling().reset();
}
} else if ( !me.edit && cycleBtn.nextSibling().originalValue === '1' ) {
activeItem.custom ? cycleBtn.previousSibling().setValue('') : cycleBtn.previousSibling().reset();
if (activeItem.custom) {
cycleBtn.previousSibling().setValue('');
} else {
cycleBtn.previousSibling().reset();
}
}
cycleBtn.previousSibling().previousSibling().setHidden(activeItem.custom ? true : me.edit ? me.service.get('url').indexOf('___') === -1 ? true : me.service.get('type') === 'custom' || me.service.get('url') === '___' : me.record.get('url').indexOf('___') === -1 ? true : me.record.get('type') === 'custom' || me.record.get('url') === '___');

Loading…
Cancel
Save