History

Sanity-check decaffeinate app.views.Results

Simon Legner committed 2 years ago

Commit cf412bd1 parent 92b18281 file · +6 −24Browse files

Unified · Split

assets/javascripts/views/sidebar/results.js+6−24
@@ -1,20 +1,9 @@
1// TODO: This file was created by bulk-decaffeinate.
2// Sanity-check the conversion and remove this comment.
3/*
4 * decaffeinate suggestions:
5 * DS102: Remove unnecessary code created because of implicit returns
6 * DS206: Consider reworking classes to avoid initClass
7 * DS207: Consider shorter variations of null checks
8 * Full docs: https://github.com/decaffeinate/decaffeinate/blob/main/docs/suggestions.md
9 */
10app.views.Results = class Results extends app.View {1app.views.Results = class Results extends app.View {
11 static initClass() {2 static className = "_list";
12 this.className = "_list";
13 3
14 this.events = { click: "onClick" };4 static events = { click: "onClick" };
15 5
16 this.routes = { after: "afterRoute" };6 static routes = { after: "afterRoute" };
17 }
18 7
19 constructor(sidebar, search) {8 constructor(sidebar, search) {
20 super();9 super();
@@ -42,9 +31,7 @@ app.views.Results = class Results extends app.View { · 21 unmodified lines
42 31
43 onResults(entries, flags) {32 onResults(entries, flags) {
44 if (flags.initialResults) {33 if (flags.initialResults) {
45 if (this.listFocus != null) {34 this.listFocus?.blur();
46 this.listFocus.blur();
47 }
48 }35 }
49 if (flags.initialResults) {36 if (flags.initialResults) {
50 this.empty();37 this.empty();
@@ -70,16 +57,12 @@ app.views.Results = class Results extends app.View { · 19 unmodified lines
70 57
71 focusFirst() {58 focusFirst() {
72 if (!app.isMobile()) {59 if (!app.isMobile()) {
73 if (this.listFocus != null) {60 this.listFocus?.focusOnNextFrame(this.el.firstElementChild);
74 this.listFocus.focusOnNextFrame(this.el.firstElementChild);
75 }
76 }61 }
77 }62 }
78 63
79 openFirst() {64 openFirst() {
80 if (this.el.firstElementChild != null) {65 this.el.firstElementChild?.click();
81 this.el.firstElementChild.click();
82 }
83 }66 }
84 67
85 onDocEnabled(doc) {68 onDocEnabled(doc) {
@@ -109,4 +92,3 @@ app.views.Results = class Results extends app.View { · 23 unmodified lines
109 }92 }
110 }93 }
111};94};
112app.views.Results.initClass();