Unified · Split
| @@ -1,30 +1,18 @@ | ||
| 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 | − * DS103: Rewrite code to no longer use __guard__, or convert again using --optional-chaining | |
| 7 | − * DS206: Consider reworking classes to avoid initClass | |
| 8 | − * DS207: Consider shorter variations of null checks | |
| 9 | − * Full docs: https://github.com/decaffeinate/decaffeinate/blob/main/docs/suggestions.md | |
| 10 | − */ | |
| 11 | 1 | app.views.Sidebar = class Sidebar extends app.View { |
| 12 | − static initClass() { | |
| 13 | − this.el = "._sidebar"; | |
| 2 | + static el = "._sidebar"; | |
| 14 | 3 | |
| 15 | − this.events = { | |
| 16 | − focus: "onFocus", | |
| 17 | − select: "onSelect", | |
| 18 | − click: "onClick", | |
| 19 | − }; | |
| 4 | + static events = { | |
| 5 | + focus: "onFocus", | |
| 6 | + select: "onSelect", | |
| 7 | + click: "onClick", | |
| 8 | + }; | |
| 20 | 9 | |
| 21 | − this.routes = { after: "afterRoute" }; | |
| 10 | + static routes = { after: "afterRoute" }; | |
| 22 | 11 | |
| 23 | − this.shortcuts = { | |
| 24 | − altR: "onAltR", | |
| 25 | − escape: "onEscape", | |
| 26 | − }; | |
| 27 | − } | |
| 12 | + static shortcuts = { | |
| 13 | + altR: "onAltR", | |
| 14 | + escape: "onEscape", | |
| 15 | + }; | |
| 28 | 16 | |
| 29 | 17 | init() { |
| 30 | 18 | if (!app.isMobile()) { |
| @@ -179,11 +167,7 @@ app.views.Sidebar = class Sidebar extends app.View { · 148 unmodified lines | ||
| 179 | 167 | if (event.which !== 1) { |
| 180 | 168 | return; |
| 181 | 169 | } |
| 182 | − if ( | |
| 183 | − __guardMethod__($.eventTarget(event), "hasAttribute", (o) => | |
| 184 | − o.hasAttribute("data-reset-list"), | |
| 185 | − ) | |
| 186 | − ) { | |
| 170 | + if ($.eventTarget(event).hasAttribute?.("data-reset-list")) { | |
| 187 | 171 | $.stopEvent(event); |
| 188 | 172 | this.onAltR(); |
| 189 | 173 | } |
| @@ -225,16 +209,3 @@ app.views.Sidebar = class Sidebar extends app.View { · 35 unmodified lines | ||
| 225 | 209 | this.resetDisplay(); |
| 226 | 210 | } |
| 227 | 211 | }; |
| 228 | −app.views.Sidebar.initClass(); | |
| 229 | − | |
| 230 | −function __guardMethod__(obj, methodName, transform) { | |
| 231 | − if ( | |
| 232 | − typeof obj !== "undefined" && | |
| 233 | − obj !== null && | |
| 234 | − typeof obj[methodName] === "function" | |
| 235 | − ) { | |
| 236 | − return transform(obj, methodName); | |
| 237 | − } else { | |
| 238 | − return undefined; | |
| 239 | − } | |
| 240 | −} | |