mirror of https://github.com/freeCodeCamp/devdocs
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.
22 lines
569 B
22 lines
569 B
//= require views/pages/base
|
|
|
|
app.views.RdocPage = class RdocPage extends app.views.BasePage {
|
|
static events = { click: "onClick" };
|
|
|
|
onClick(event) {
|
|
if (!event.target.classList.contains("method-click-advice")) {
|
|
return;
|
|
}
|
|
$.stopEvent(event);
|
|
|
|
const source = $(
|
|
".method-source-code",
|
|
event.target.closest(".method-detail"),
|
|
);
|
|
const isShown = source.style.display === "block";
|
|
|
|
source.style.display = isShown ? "none" : "block";
|
|
return (event.target.textContent = isShown ? "Show source" : "Hide source");
|
|
}
|
|
};
|