mirror of https://github.com/freeCodeCamp/devdocs
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
859 B
47 lines
859 B
app.views.RootPage = class RootPage extends app.View {
|
|
static events = { click: "onClick" };
|
|
|
|
init() {
|
|
if (!this.isHidden()) {
|
|
this.setHidden(false);
|
|
} // reserve space in local storage
|
|
this.render();
|
|
}
|
|
|
|
render() {
|
|
this.empty();
|
|
|
|
const tmpl = app.isAndroidWebview()
|
|
? "androidWarning"
|
|
: this.isHidden()
|
|
? "splash"
|
|
: app.isMobile()
|
|
? "mobileIntro"
|
|
: "intro";
|
|
|
|
this.append(this.tmpl(tmpl));
|
|
}
|
|
|
|
hideIntro() {
|
|
this.setHidden(true);
|
|
this.render();
|
|
}
|
|
|
|
setHidden(value) {
|
|
app.settings.set("hideIntro", value);
|
|
}
|
|
|
|
isHidden() {
|
|
return app.isSingleDoc() || app.settings.get("hideIntro");
|
|
}
|
|
|
|
onRoute() {}
|
|
|
|
onClick(event) {
|
|
if ($.eventTarget(event).hasAttribute("data-hide-intro")) {
|
|
$.stopEvent(event);
|
|
this.hideIntro();
|
|
}
|
|
}
|
|
};
|