mirror of
https://github.com/fverdugo/XM_40017.git
synced 2025-12-29 10:18:31 +01:00
build based on bf45227
This commit is contained in:
@@ -75,60 +75,75 @@ $(document).ready(function() {
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
require(['jquery'], function($) {
|
||||
|
||||
let timer = 0;
|
||||
var isExpanded = true;
|
||||
|
||||
$(document).on("click", ".docstring header", function () {
|
||||
let articleToggleTitle = "Expand docstring";
|
||||
|
||||
if ($(this).siblings("section").is(":visible")) {
|
||||
debounce(() => {
|
||||
if ($(this).siblings("section").is(":visible")) {
|
||||
$(this)
|
||||
.find(".docstring-article-toggle-button")
|
||||
.removeClass("fa-chevron-down")
|
||||
.addClass("fa-chevron-right");
|
||||
} else {
|
||||
$(this)
|
||||
.find(".docstring-article-toggle-button")
|
||||
.removeClass("fa-chevron-right")
|
||||
.addClass("fa-chevron-down");
|
||||
|
||||
articleToggleTitle = "Collapse docstring";
|
||||
}
|
||||
|
||||
$(this)
|
||||
.find(".docstring-article-toggle-button")
|
||||
.removeClass("fa-chevron-down")
|
||||
.addClass("fa-chevron-right");
|
||||
} else {
|
||||
$(this)
|
||||
.find(".docstring-article-toggle-button")
|
||||
.removeClass("fa-chevron-right")
|
||||
.addClass("fa-chevron-down");
|
||||
|
||||
articleToggleTitle = "Collapse docstring";
|
||||
}
|
||||
|
||||
$(this)
|
||||
.find(".docstring-article-toggle-button")
|
||||
.prop("title", articleToggleTitle);
|
||||
$(this).siblings("section").slideToggle();
|
||||
.prop("title", articleToggleTitle);
|
||||
$(this).siblings("section").slideToggle();
|
||||
});
|
||||
});
|
||||
|
||||
$(document).on("click", ".docs-article-toggle-button", function () {
|
||||
let articleToggleTitle = "Expand docstring";
|
||||
let navArticleToggleTitle = "Expand all docstrings";
|
||||
|
||||
if (isExpanded) {
|
||||
$(this).removeClass("fa-chevron-up").addClass("fa-chevron-down");
|
||||
$(".docstring-article-toggle-button")
|
||||
.removeClass("fa-chevron-down")
|
||||
.addClass("fa-chevron-right");
|
||||
debounce(() => {
|
||||
if (isExpanded) {
|
||||
$(this).removeClass("fa-chevron-up").addClass("fa-chevron-down");
|
||||
$(".docstring-article-toggle-button")
|
||||
.removeClass("fa-chevron-down")
|
||||
.addClass("fa-chevron-right");
|
||||
|
||||
isExpanded = false;
|
||||
isExpanded = false;
|
||||
|
||||
$(".docstring section").slideUp();
|
||||
} else {
|
||||
$(this).removeClass("fa-chevron-down").addClass("fa-chevron-up");
|
||||
$(".docstring-article-toggle-button")
|
||||
.removeClass("fa-chevron-right")
|
||||
.addClass("fa-chevron-down");
|
||||
$(".docstring section").slideUp();
|
||||
} else {
|
||||
$(this).removeClass("fa-chevron-down").addClass("fa-chevron-up");
|
||||
$(".docstring-article-toggle-button")
|
||||
.removeClass("fa-chevron-right")
|
||||
.addClass("fa-chevron-down");
|
||||
|
||||
isExpanded = true;
|
||||
articleToggleTitle = "Collapse docstring";
|
||||
navArticleToggleTitle = "Collapse all docstrings";
|
||||
isExpanded = true;
|
||||
articleToggleTitle = "Collapse docstring";
|
||||
navArticleToggleTitle = "Collapse all docstrings";
|
||||
|
||||
$(".docstring section").slideDown();
|
||||
$(".docstring section").slideDown();
|
||||
}
|
||||
|
||||
$(this).prop("title", navArticleToggleTitle);
|
||||
$(".docstring-article-toggle-button").prop("title", articleToggleTitle);
|
||||
});
|
||||
});
|
||||
|
||||
function debounce(callback, timeout = 300) {
|
||||
if (Date.now() - timer > timeout) {
|
||||
callback();
|
||||
}
|
||||
|
||||
$(this).prop("title", navArticleToggleTitle);
|
||||
$(".docstring-article-toggle-button").prop("title", articleToggleTitle);
|
||||
});
|
||||
clearTimeout(timer);
|
||||
|
||||
timer = Date.now();
|
||||
}
|
||||
|
||||
})
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Reference in New Issue
Block a user