Passed
Push — master ( 65f9b0...e165e5 )
by Eduardo
04:01
created

app/js/renderer/navigation.js   A

Complexity

Total Complexity 14
Complexity/F 1.56

Size

Lines of Code 129
Function Count 9

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 14
eloc 59
mnd 5
bc 5
fnc 9
dl 0
loc 129
rs 10
bpm 0.5555
cpm 1.5555
noi 11
c 0
b 0
f 0
1
// jshint esversion: 8
2
3
/*
4
  $(document).on('drop', function(...) {...});
5
    Prevent drop redirect
6
  parameters
7
    event (object)
8
 */
9
$(document).on('drop', function(event) {
10
  ipcRenderer.send('app:debug', "Preventing drag and drop redirect");
0 ignored issues
show
Bug introduced by
The variable ipcRenderer seems to be never declared. If this is a global, consider adding a /** global: ipcRenderer */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
11
  event.preventDefault();
12
  return false;
13
});
14
15
/*
16
  $(document).on('dragover', function(...) {...});
17
    Prevent drag over redirect
18
  parameters
19
    event (object)
20
 */
21
$(document).on('dragover', function(event) {
22
  event.preventDefault();
23
  return false;
24
});
25
26
/*
27
  $('#navButtonDevtools').click(function() {...});
28
    On click: Button toggle developer tools
29
 */
30
$('#navButtonDevtools').click(function() {
31
  remote.getCurrentWindow().toggleDevTools();
0 ignored issues
show
Bug introduced by
The variable remote seems to be never declared. If this is a global, consider adding a /** global: remote */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
32
  ipcRenderer.send('app:debug', "#navButtonDevtools was clicked");
0 ignored issues
show
Bug introduced by
The variable ipcRenderer seems to be never declared. If this is a global, consider adding a /** global: ipcRenderer */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
33
});
34
35
/*
36
  $('section.tabs ul li').click(function() {...});
37
    On click: Toggle between tabs
38
 */
39
$('section.tabs ul li').click(function() {
40
  var tabName = $(this).attr('data-tab');
41
42
  if (tabName != '#') {
43
    $('section.tabs ul li').removeClass('is-active');
44
    $('div.container .tab-content').removeClass('current');
45
46
    $(this).addClass('is-active');
47
    $("#" + tabName).addClass('current');
48
  }
49
  ipcRenderer.send('app:debug', "#section.tabs switched to data tab, {0}".format(tabName));
0 ignored issues
show
Bug introduced by
The variable ipcRenderer seems to be never declared. If this is a global, consider adding a /** global: ipcRenderer */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
50
});
51
52
/*
53
  $('.delete').click(function() {...});
54
    On click: Delete open notifications
55
 */
56
$('.delete').click(function() {
57
  ipcRenderer.send('app:debug', ".delete (notifications) was clicked");
0 ignored issues
show
Bug introduced by
The variable ipcRenderer seems to be never declared. If this is a global, consider adding a /** global: ipcRenderer */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
58
  var notificationId = $(this).attr('data-notif');
59
60
  $('#' + notificationId).addClass('is-hidden');
61
});
62
63
/*
64
  $(document).keyup(function(...) {...});
65
    On keyup: Assign [ESC] key to close messages or modals
66
 */
67
$(document).keyup(function(event) {
68
  if (event.keyCode === 27) {
69
    ipcRenderer.send('app:debug', "Hotkey, Used [ESC] key, {0}".format(event.keyCode));
0 ignored issues
show
Bug introduced by
The variable ipcRenderer seems to be never declared. If this is a global, consider adding a /** global: ipcRenderer */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
70
    switch (true) {
71
72
      // Single whois tab is active
73
      case ($('#navButtonSw').hasClass('is-active')):
74
        ipcRenderer.send('app:debug', "Hotkey, Single whois tab is active");
75
        switch (true) {
76
          case ($('#swDomainCopied').hasClass('is-active')):
77
            $('#swDomainCopiedClose').click();
78
            break;
79
80
          // Single whois, Dialog is open
81
          case ($('#swMessageWhois').hasClass('is-active')):
82
            $('#swMessageWhoisClose').click();
83
            break;
84
85
            // Single whois, Information table not hidden
86
          case (!$('#swTableWhoisinfo').hasClass('is-hidden')):
87
            $('#swTableWhoisinfo').addClass('is-hidden');
88
            break;
89
90
            // Single whois, Notification not hidden
91
          case (!$('.notification:not(.is-hidden)').hasClass('is-hidden')):
92
            $('.notification:not(.is-hidden)').addClass('is-hidden');
93
            break;
94
        }
95
        break;
96
97
        // Bulk whois tab is active
98
      case ($('#navButtonBw').hasClass('is-active')):
99
        ipcRenderer.send('app:debug', "Hotkey, Bulk whois tab is active");
100
        switch (true) {
101
          // Bulk whois, is Stop dialog open
102
          case ($('#bwProcessingModalStop').hasClass('is-active')):
103
            $('#bwProcessingModalStopButtonContinue').click();
104
            break;
105
        }
106
        break;
107
    }
108
  }
109
});
110
111
/*
112
  $('#navButtonExtendedmenu').click(function() {...});
113
    Button/Toggle special menu items
114
 */
115
$('#navButtonExtendedmenu').click(function() {
116
  ipcRenderer.send('app:debug', "#navButtonExtendedmenu was clicked");
0 ignored issues
show
Bug introduced by
The variable ipcRenderer seems to be never declared. If this is a global, consider adding a /** global: ipcRenderer */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
117
  $('#navButtonExtendedmenu').toggleClass('is-active');
118
  $('.is-specialmenu').toggleClass('is-hidden');
119
});
120
121
/*
122
  $('#navButtonMinimize').click(function() {...});
123
    On click: Minimize window button
124
 */
125
$('#navButtonMinimize').click(function() {
126
  ipcRenderer.send('app:debug', "#navButtonMinimize was clicked");
0 ignored issues
show
Bug introduced by
The variable ipcRenderer seems to be never declared. If this is a global, consider adding a /** global: ipcRenderer */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
127
  remote.getCurrentWindow().minimize();
0 ignored issues
show
Bug introduced by
The variable remote seems to be never declared. If this is a global, consider adding a /** global: remote */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
128
});
129
130
/*
131
  $('#navButtonExit').click(function() {...});
132
    On click: Close main window button
133
 */
134
$('#navButtonExit').click(function() {
135
  ipcRenderer.send('app:debug', "#navButtonExit was clicked");
0 ignored issues
show
Bug introduced by
The variable ipcRenderer seems to be never declared. If this is a global, consider adding a /** global: ipcRenderer */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
136
  remote.getCurrentWindow().close();
0 ignored issues
show
Bug introduced by
The variable remote seems to be never declared. If this is a global, consider adding a /** global: remote */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
137
});
138