Showing the changes to assets/javascripts (1 of 1 file). Show all
Unified · Split
| @@ -1,23 +1,10 @@ | ||
| 1 | −// TODO: This file was created by bulk-decaffeinate. | |
| 2 | −// Sanity-check the conversion and remove this comment. | |
| 3 | −/* | |
| 4 | − * decaffeinate suggestions: | |
| 5 | − * DS101: Remove unnecessary use of Array.from | |
| 6 | − * DS102: Remove unnecessary code created because of implicit returns | |
| 7 | − * DS103: Rewrite code to no longer use __guard__, or convert again using --optional-chaining | |
| 8 | − * DS206: Consider reworking classes to avoid initClass | |
| 9 | − * DS207: Consider shorter variations of null checks | |
| 10 | − * Full docs: https://github.com/decaffeinate/decaffeinate/blob/main/docs/suggestions.md | |
| 11 | − */ | |
| 12 | 1 | app.views.DocPicker = class DocPicker extends app.View { |
| 13 | − static initClass() { | |
| 14 | − this.className = "_list _list-picker"; | |
| 2 | + static className = "_list _list-picker"; | |
| 15 | 3 | |
| 16 | − this.events = { | |
| 17 | − mousedown: "onMouseDown", | |
| 18 | − mouseup: "onMouseUp", | |
| 19 | − }; | |
| 20 | − } | |
| 4 | + static events = { | |
| 5 | + mousedown: "onMouseDown", | |
| 6 | + mouseup: "onMouseUp", | |
| 7 | + }; | |
| 21 | 8 | |
| 22 | 9 | init() { |
| 23 | 10 | this.addSubview((this.listFold = new app.views.ListFold(this.el))); |
| @@ -42,14 +29,12 @@ app.views.DocPicker = class DocPicker extends app.View { · 18 unmodified lines | ||
| 42 | 29 | render() { |
| 43 | 30 | let doc; |
| 44 | 31 | let html = this.tmpl("docPickerHeader"); |
| 45 | − let docs = app.docs | |
| 46 | − .all() | |
| 47 | − .concat(...Array.from(app.disabledDocs.all() || [])); | |
| 32 | + let docs = app.docs.all().concat(...(app.disabledDocs.all() || [])); | |
| 48 | 33 | |
| 49 | 34 | while ((doc = docs.shift())) { |
| 50 | 35 | if (doc.version != null) { |
| 51 | 36 | var versions; |
| 52 | − [docs, versions] = Array.from(this.extractVersions(docs, doc)); | |
| 37 | + [docs, versions] = this.extractVersions(docs, doc); | |
| 53 | 38 | html += this.tmpl( |
| 54 | 39 | "sidebarVersionedDoc", |
| 55 | 40 | doc, |
| @@ -65,14 +50,12 @@ app.views.DocPicker = class DocPicker extends app.View { · 9 unmodified lines | ||
| 65 | 50 | |
| 66 | 51 | this.html(html + this.tmpl("docPickerNote")); |
| 67 | 52 | |
| 68 | − $.requestAnimationFrame(() => | |
| 69 | − __guard__(this.findByTag("input"), (x) => x.focus()), | |
| 70 | − ); | |
| 53 | + $.requestAnimationFrame(() => this.findByTag("input")?.focus()); | |
| 71 | 54 | } |
| 72 | 55 | |
| 73 | 56 | renderVersions(docs) { |
| 74 | 57 | let html = ""; |
| 75 | − for (var doc of Array.from(docs)) { | |
| 58 | + for (var doc of docs) { | |
| 76 | 59 | html += this.tmpl("sidebarLabel", doc, { |
| 77 | 60 | checked: app.docs.contains(doc), |
| 78 | 61 | }); |
| @@ -83,7 +66,7 @@ app.views.DocPicker = class DocPicker extends app.View { · 4 unmodified lines | ||
| 83 | 66 | extractVersions(originalDocs, version) { |
| 84 | 67 | const docs = []; |
| 85 | 68 | const versions = [version]; |
| 86 | − for (var doc of Array.from(originalDocs)) { | |
| 69 | + for (var doc of originalDocs) { | |
| 87 | 70 | (doc.name === version.name ? versions : docs).push(doc); |
| 88 | 71 | } |
| 89 | 72 | return [docs, versions]; |
| @@ -95,7 +78,7 @@ app.views.DocPicker = class DocPicker extends app.View { · 5 unmodified lines | ||
| 95 | 78 | } |
| 96 | 79 | |
| 97 | 80 | getSelectedDocs() { |
| 98 | − return Array.from(this.findAllByTag("input")) | |
| 81 | + return this.findAllByTag("input") | |
| 99 | 82 | .filter((input) => (input != null ? input.checked : undefined)) |
| 100 | 83 | .map((input) => input.name); |
| 101 | 84 | } |
| @@ -146,10 +129,3 @@ app.views.DocPicker = class DocPicker extends app.View { · 44 unmodified lines | ||
| 146 | 129 | this.focusEl = target; |
| 147 | 130 | } |
| 148 | 131 | }; |
| 149 | −app.views.DocPicker.initClass(); | |
| 150 | − | |
| 151 | −function __guard__(value, transform) { | |
| 152 | − return typeof value !== "undefined" && value !== null | |
| 153 | − ? transform(value) | |
| 154 | − : undefined; | |
| 155 | −} | |