mirror of
https://github.com/readthedocs/sphinx_rtd_theme.git
synced 2025-02-25 18:55:21 -06:00
* Show version/language selectors below the title * Use CSS styles from old attempt https://github.com/readthedocs/sphinx_rtd_theme/pull/438 * Update CSS to apply to both selectors * Prepend the current version if it's hidden * Split it into two different configs * Use correct value for language * Make the selectors more prominent * Typo fix on comment * Update CSS * Update JavaScript * Always include the version javascript * Only include the languages if there is one * Change `display_version` default * HTML layout rework * Update docs * HTML layout fix * Docs typo * Update CSS * Updates from review * re-compile CSS * Update CSS * Apply suggestions from code review Co-authored-by: Eric Holscher <25510+ericholscher@users.noreply.github.com> * Use the prettier to lint the file * Whitespaces * Update event listener * Update CSS * Update CSS * Remove language switch if there are not translations * Tune version and language selector styles (#1603) * Tuning on select width and icon placement * Use better cursor * Add a max width to selects so that they can't overflow * Only add after pseudo element if select exists * Lint * Debug: trigger Read the Docs Addons event to test/debug locally (#1606) * Debug: trigger Read the Docs Addons event to test/debug locally Closes #1605 * Push missing file --------- Co-authored-by: Eric Holscher <25510+ericholscher@users.noreply.github.com> Co-authored-by: Anthony <aj@ohess.org>
44 lines
1.0 KiB
JavaScript
44 lines
1.0 KiB
JavaScript
// Add debug actions to flyout menu
|
|
|
|
$(function () {
|
|
$("[data-toggle='rst-debug-badge']").on("click", function () {
|
|
$("[data-toggle='rst-versions']").toggleClass("rst-badge");
|
|
});
|
|
});
|
|
|
|
|
|
const EVENT_READTHEDOCS_ADDONS_DATA_READY = "readthedocs-addons-data-ready";
|
|
|
|
fetch("_static/addons.mocked.json", { method: "GET" })
|
|
.then((response) => {
|
|
if (!response.ok) {
|
|
throw new Error("Error downloading Read the Docs Addons mocked data");
|
|
}
|
|
return response.json();
|
|
})
|
|
.then((data) => {
|
|
return dispatchEvent(
|
|
EVENT_READTHEDOCS_ADDONS_DATA_READY,
|
|
new ReadTheDocsEventData(data),
|
|
);
|
|
});
|
|
|
|
|
|
// ``ReadTheDocsEventData`` and ``dispatchEvent``
|
|
// are borrowed and adapted from Read the Docs Addons.
|
|
// https://github.com/readthedocs/addons
|
|
class ReadTheDocsEventData {
|
|
constructor(data) {
|
|
this._data = data;
|
|
}
|
|
|
|
data() {
|
|
return this._data;
|
|
}
|
|
}
|
|
|
|
function dispatchEvent(eventName, data) {
|
|
const event = new CustomEvent(eventName, { detail: data });
|
|
document.dispatchEvent(event);
|
|
}
|