You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
devdocs/assets/javascripts/views/pages/rdoc.js

33 lines
988 B

// TODO: This file was created by bulk-decaffeinate.
// Sanity-check the conversion and remove this comment.
/*
* decaffeinate suggestions:
* DS102: Remove unnecessary code created because of implicit returns
* DS206: Consider reworking classes to avoid initClass
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/main/docs/suggestions.md
*/
//= require views/pages/base
app.views.RdocPage = class RdocPage extends app.views.BasePage {
static initClass() {
1 year ago
this.events = { click: "onClick" };
}
onClick(event) {
1 year ago
if (!event.target.classList.contains("method-click-advice")) {
return;
}
$.stopEvent(event);
1 year ago
const source = $(
".method-source-code",
event.target.closest(".method-detail"),
);
const isShown = source.style.display === "block";
1 year ago
source.style.display = isShown ? "none" : "block";
return (event.target.textContent = isShown ? "Show source" : "Hide source");
}
};
app.views.RdocPage.initClass();