root_page.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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. * DS206: Consider reworking classes to avoid initClass
  7. * Full docs: https://github.com/decaffeinate/decaffeinate/blob/main/docs/suggestions.md
  8. */
  9. app.views.RootPage = class RootPage extends app.View {
  10. static initClass() {
  11. this.events = { click: "onClick" };
  12. }
  13. init() {
  14. if (!this.isHidden()) {
  15. this.setHidden(false);
  16. } // reserve space in local storage
  17. this.render();
  18. }
  19. render() {
  20. this.empty();
  21. const tmpl = app.isAndroidWebview()
  22. ? "androidWarning"
  23. : this.isHidden()
  24. ? "splash"
  25. : app.isMobile()
  26. ? "mobileIntro"
  27. : "intro";
  28. this.append(this.tmpl(tmpl));
  29. }
  30. hideIntro() {
  31. this.setHidden(true);
  32. this.render();
  33. }
  34. setHidden(value) {
  35. app.settings.set("hideIntro", value);
  36. }
  37. isHidden() {
  38. return app.isSingleDoc() || app.settings.get("hideIntro");
  39. }
  40. onRoute() {}
  41. onClick(event) {
  42. if ($.eventTarget(event).hasAttribute("data-hide-intro")) {
  43. $.stopEvent(event);
  44. this.hideIntro();
  45. }
  46. }
  47. };
  48. app.views.RootPage.initClass();