rdoc.js 960 B

12345678910111213141516171819202122232425262728
  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. //= require views/pages/base
  10. const Cls = (app.views.RdocPage = class RdocPage extends app.views.BasePage {
  11. static initClass() {
  12. this.events =
  13. {click: 'onClick'};
  14. }
  15. onClick(event) {
  16. if (!event.target.classList.contains('method-click-advice')) { return; }
  17. $.stopEvent(event);
  18. const source = $('.method-source-code', event.target.closest('.method-detail'));
  19. const isShown = source.style.display === 'block';
  20. source.style.display = isShown ? 'none' : 'block';
  21. return event.target.textContent = isShown ? 'Show source' : 'Hide source';
  22. }
  23. });
  24. Cls.initClass();