@npm_leadtech/legal-lib-components 0.44.2 → 0.46.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,87 +1,75 @@
1
1
  /* eslint-disable */
2
2
  var jumpToCode = (function init() {
3
- // Classes of code we would like to highlight in the file view
4
- var missingCoverageClasses = ['.cbranch-no', '.cstat-no', '.fstat-no'];
3
+ // Classes of code we would like to highlight in the file view
4
+ var missingCoverageClasses = ['.cbranch-no', '.cstat-no', '.fstat-no'];
5
5
 
6
- // Elements to highlight in the file listing view
7
- var fileListingElements = ['td.pct.low'];
6
+ // Elements to highlight in the file listing view
7
+ var fileListingElements = ['td.pct.low'];
8
8
 
9
- // We don't want to select elements that are direct descendants of another match
10
- var notSelector = ':not(' + missingCoverageClasses.join('):not(') + ') > '; // becomes `:not(a):not(b) > `
9
+ // We don't want to select elements that are direct descendants of another match
10
+ var notSelector = ':not(' + missingCoverageClasses.join('):not(') + ') > '; // becomes `:not(a):not(b) > `
11
11
 
12
- // Selecter that finds elements on the page to which we can jump
13
- var selector =
14
- fileListingElements.join(', ') +
15
- ', ' +
16
- notSelector +
17
- missingCoverageClasses.join(', ' + notSelector); // becomes `:not(a):not(b) > a, :not(a):not(b) > b`
12
+ // Selecter that finds elements on the page to which we can jump
13
+ var selector = fileListingElements.join(', ') + ', ' + notSelector + missingCoverageClasses.join(', ' + notSelector); // becomes `:not(a):not(b) > a, :not(a):not(b) > b`
18
14
 
19
- // The NodeList of matching elements
20
- var missingCoverageElements = document.querySelectorAll(selector);
15
+ // The NodeList of matching elements
16
+ var missingCoverageElements = document.querySelectorAll(selector);
21
17
 
22
- var currentIndex;
18
+ var currentIndex;
23
19
 
24
- function toggleClass(index) {
25
- missingCoverageElements
26
- .item(currentIndex)
27
- .classList.remove('highlighted');
28
- missingCoverageElements.item(index).classList.add('highlighted');
29
- }
30
-
31
- function makeCurrent(index) {
32
- toggleClass(index);
33
- currentIndex = index;
34
- missingCoverageElements.item(index).scrollIntoView({
35
- behavior: 'smooth',
36
- block: 'center',
37
- inline: 'center'
38
- });
39
- }
20
+ function toggleClass(index) {
21
+ missingCoverageElements.item(currentIndex).classList.remove('highlighted');
22
+ missingCoverageElements.item(index).classList.add('highlighted');
23
+ }
40
24
 
41
- function goToPrevious() {
42
- var nextIndex = 0;
43
- if (typeof currentIndex !== 'number' || currentIndex === 0) {
44
- nextIndex = missingCoverageElements.length - 1;
45
- } else if (missingCoverageElements.length > 1) {
46
- nextIndex = currentIndex - 1;
47
- }
25
+ function makeCurrent(index) {
26
+ toggleClass(index);
27
+ currentIndex = index;
28
+ missingCoverageElements.item(index).scrollIntoView({
29
+ behavior: 'smooth',
30
+ block: 'center',
31
+ inline: 'center',
32
+ });
33
+ }
48
34
 
49
- makeCurrent(nextIndex);
35
+ function goToPrevious() {
36
+ var nextIndex = 0;
37
+ if (typeof currentIndex !== 'number' || currentIndex === 0) {
38
+ nextIndex = missingCoverageElements.length - 1;
39
+ } else if (missingCoverageElements.length > 1) {
40
+ nextIndex = currentIndex - 1;
50
41
  }
51
42
 
52
- function goToNext() {
53
- var nextIndex = 0;
43
+ makeCurrent(nextIndex);
44
+ }
54
45
 
55
- if (
56
- typeof currentIndex === 'number' &&
57
- currentIndex < missingCoverageElements.length - 1
58
- ) {
59
- nextIndex = currentIndex + 1;
60
- }
46
+ function goToNext() {
47
+ var nextIndex = 0;
61
48
 
62
- makeCurrent(nextIndex);
49
+ if (typeof currentIndex === 'number' && currentIndex < missingCoverageElements.length - 1) {
50
+ nextIndex = currentIndex + 1;
63
51
  }
64
52
 
65
- return function jump(event) {
66
- if (
67
- document.getElementById('fileSearch') === document.activeElement &&
68
- document.activeElement != null
69
- ) {
70
- // if we're currently focused on the search input, we don't want to navigate
71
- return;
72
- }
53
+ makeCurrent(nextIndex);
54
+ }
73
55
 
74
- switch (event.which) {
75
- case 78: // n
76
- case 74: // j
77
- goToNext();
78
- break;
79
- case 66: // b
80
- case 75: // k
81
- case 80: // p
82
- goToPrevious();
83
- break;
84
- }
85
- };
56
+ return function jump(event) {
57
+ if (document.getElementById('fileSearch') === document.activeElement && document.activeElement != null) {
58
+ // if we're currently focused on the search input, we don't want to navigate
59
+ return;
60
+ }
61
+
62
+ switch (event.which) {
63
+ case 78: // n
64
+ case 74: // j
65
+ goToNext();
66
+ break;
67
+ case 66: // b
68
+ case 75: // k
69
+ case 80: // p
70
+ goToPrevious();
71
+ break;
72
+ }
73
+ };
86
74
  })();
87
75
  window.addEventListener('keydown', jumpToCode);