rdoc.js 988 B

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