sqlite.js 1012 B

123456789101112131415161718192021222324252627282930313233343536
  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. const Cls = (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 =
  17. {click: 'onClick'};
  18. }
  19. onClick(event) {
  20. let el, id;
  21. if (!(id = event.target.getAttribute('data-toggle'))) { return; }
  22. if (!(el = this.find(`#${id}`))) { return; }
  23. $.stopEvent(event);
  24. if (el.style.display === 'none') {
  25. el.style.display = 'block';
  26. event.target.textContent = 'hide';
  27. } else {
  28. el.style.display = 'none';
  29. event.target.textContent = 'show';
  30. }
  31. }
  32. });
  33. Cls.initClass();