sqlite.js 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. // TODO: This file was created by bulk-decaffeinate.
  2. // Sanity-check the conversion and remove this comment.
  3. /*
  4. * decaffeinate suggestions:
  5. * DS002: Fix invalid constructor
  6. * DS206: Consider reworking classes to avoid initClass
  7. * Full docs: https://github.com/decaffeinate/decaffeinate/blob/main/docs/suggestions.md
  8. */
  9. //= require views/pages/base
  10. app.views.SqlitePage = class SqlitePage extends app.views.BasePage {
  11. constructor(...args) {
  12. this.onClick = this.onClick.bind(this);
  13. super(...args);
  14. }
  15. static initClass() {
  16. this.events = { click: "onClick" };
  17. }
  18. onClick(event) {
  19. let el, id;
  20. if (!(id = event.target.getAttribute("data-toggle"))) {
  21. return;
  22. }
  23. if (!(el = this.find(`#${id}`))) {
  24. return;
  25. }
  26. $.stopEvent(event);
  27. if (el.style.display === "none") {
  28. el.style.display = "block";
  29. event.target.textContent = "hide";
  30. } else {
  31. el.style.display = "none";
  32. event.target.textContent = "show";
  33. }
  34. }
  35. };
  36. app.views.SqlitePage.initClass();