root_page.js 859 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. app.views.RootPage = class RootPage extends app.View {
  2. static events = { click: "onClick" };
  3. init() {
  4. if (!this.isHidden()) {
  5. this.setHidden(false);
  6. } // reserve space in local storage
  7. this.render();
  8. }
  9. render() {
  10. this.empty();
  11. const tmpl = app.isAndroidWebview()
  12. ? "androidWarning"
  13. : this.isHidden()
  14. ? "splash"
  15. : app.isMobile()
  16. ? "mobileIntro"
  17. : "intro";
  18. this.append(this.tmpl(tmpl));
  19. }
  20. hideIntro() {
  21. this.setHidden(true);
  22. this.render();
  23. }
  24. setHidden(value) {
  25. app.settings.set("hideIntro", value);
  26. }
  27. isHidden() {
  28. return app.isSingleDoc() || app.settings.get("hideIntro");
  29. }
  30. onRoute() {}
  31. onClick(event) {
  32. if ($.eventTarget(event).hasAttribute("data-hide-intro")) {
  33. $.stopEvent(event);
  34. this.hideIntro();
  35. }
  36. }
  37. };