Sanity-check decaffeinate app.views.EntryPage

pull/1441/head
Simon Legner 1 year ago
parent 1995d8a3bb
commit 7fa81665df

@ -1,35 +1,20 @@
// TODO: This file was created by bulk-decaffeinate. app.views.EntryPage = class EntryPage extends app.View {
// Sanity-check the conversion and remove this comment. static className = "_page";
/* static errorClass = "_page-error";
* decaffeinate suggestions:
* DS101: Remove unnecessary use of Array.from static events = { click: "onClick" };
* DS102: Remove unnecessary code created because of implicit returns
* DS205: Consider reworking code to avoid use of IIFEs static shortcuts = {
* DS206: Consider reworking classes to avoid initClass
* DS207: Consider shorter variations of null checks
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/main/docs/suggestions.md
*/
(function () {
let LINKS = undefined;
app.views.EntryPage = class EntryPage extends app.View {
static initClass() {
this.className = "_page";
this.errorClass = "_page-error";
this.events = { click: "onClick" };
this.shortcuts = {
altC: "onAltC", altC: "onAltC",
altO: "onAltO", altO: "onAltO",
}; };
this.routes = { before: "beforeRoute" }; static routes = { before: "beforeRoute" };
LINKS = { static LINKS = {
home: "Homepage", home: "Homepage",
code: "Source code", code: "Source code",
}; };
}
init() { init() {
this.cacheMap = {}; this.cacheMap = {};
@ -86,7 +71,7 @@
this.copyButton.title = "Copy to clipboard"; this.copyButton.title = "Copy to clipboard";
this.copyButton.setAttribute("aria-label", "Copy to clipboard"); this.copyButton.setAttribute("aria-label", "Copy to clipboard");
} }
for (var el of Array.from(this.findAllByTag("pre"))) { for (var el of this.findAllByTag("pre")) {
el.appendChild(this.copyButton.cloneNode(true)); el.appendChild(this.copyButton.cloneNode(true));
} }
} }
@ -116,7 +101,7 @@
for (var link in this.entry.doc.links) { for (var link in this.entry.doc.links) {
var url = this.entry.doc.links[link]; var url = this.entry.doc.links[link];
result.push( result.push(
`<a href="${url}" class="_links-link">${LINKS[link]}</a>`, `<a href="${url}" class="_links-link">${EntryPage.LINKS[link]}</a>`,
); );
} }
return result; return result;
@ -142,8 +127,7 @@
subViewClass() { subViewClass() {
return ( return (
app.views[`${$.classify(this.entry.doc.type)}Page`] || app.views[`${$.classify(this.entry.doc.type)}Page`] || app.views.BasePage
app.views.BasePage
); );
} }
@ -260,7 +244,4 @@
} }
this.delay(() => $.popup(link.href + location.hash)); this.delay(() => $.popup(link.href + location.hash));
} }
}; };
app.views.EntryPage.initClass();
return app.views.EntryPage;
})();

Loading…
Cancel
Save