Skip to content

Commit

Permalink
Clean up function declarations
Browse files Browse the repository at this point in the history
  • Loading branch information
notriddle committed Feb 3, 2025
1 parent 1b4b78d commit 85aca23
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/librustdoc/html/static/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -1811,7 +1811,7 @@ href="https://doc.rust-lang.org/${channel}/rustdoc/read-documentation/search.htm
// from settings.js, which uses a separate function. It's done here because
// the minimum sidebar size is rather uncomfortable, and it must pass
// through that size when using the shrink-to-nothing gesture.
const hideSidebar = function hideSidebar() {
const hideSidebar = function() {
if (isSrcPage) {
window.rustdocCloseSourceSidebar();
updateLocalStorage("src-sidebar-width", null);
Expand Down Expand Up @@ -1844,7 +1844,7 @@ href="https://doc.rust-lang.org/${channel}/rustdoc/read-documentation/search.htm
// the visible range without releasing it. You can, however, grab the
// resize handle on a source page with the sidebar closed, because it
// remains visible all the time on there.
const showSidebar = function showSidebar() {
const showSidebar = function() {
if (isSrcPage) {
window.rustdocShowSourceSidebar();
} else {
Expand All @@ -1859,7 +1859,7 @@ href="https://doc.rust-lang.org/${channel}/rustdoc/read-documentation/search.htm
*
* @param {number} size - CSS px width of the sidebar.
*/
const changeSidebarSize = function changeSidebarSize(size) {
const changeSidebarSize = function(size) {
if (isSrcPage) {
updateLocalStorage("src-sidebar-width", size.toString());
// [RUSTDOCIMPL] CSS variable fast path
Expand All @@ -1879,11 +1879,11 @@ href="https://doc.rust-lang.org/${channel}/rustdoc/read-documentation/search.htm

// Check if the sidebar is hidden. Since src pages and doc pages have
// different settings, this function has to check that.
function isSidebarHidden() {
const isSidebarHidden = function() {
return isSrcPage ?
!hasClass(document.documentElement, "src-sidebar-expanded") :
hasClass(document.documentElement, "hide-sidebar");
}
};

/**
* Respond to the resize handle event.
Expand All @@ -1892,7 +1892,7 @@ href="https://doc.rust-lang.org/${channel}/rustdoc/read-documentation/search.htm
*
* @param {PointerEvent} e
*/
function resize(e) {
const resize = function(e) {
if (currentPointerId === null || currentPointerId !== e.pointerId) {
return;
}
Expand Down Expand Up @@ -1923,7 +1923,7 @@ href="https://doc.rust-lang.org/${channel}/rustdoc/read-documentation/search.htm
);
}, 100);
}
}
};
// Respond to the window resize event.
window.addEventListener("resize", () => {
if (window.innerWidth < RUSTDOC_MOBILE_BREAKPOINT) {
Expand All @@ -1940,7 +1940,7 @@ href="https://doc.rust-lang.org/${channel}/rustdoc/read-documentation/search.htm
/**
* @param {PointerEvent=} e
*/
const stopResize = function stopResize(e) {
const stopResize = function(e) {
if (currentPointerId === null) {
return;
}
Expand All @@ -1962,7 +1962,7 @@ href="https://doc.rust-lang.org/${channel}/rustdoc/read-documentation/search.htm
/**
* @param {PointerEvent} e
*/
const initResize = function initResize(e) {
const initResize = function(e) {
if (currentPointerId !== null || e.altKey || e.ctrlKey || e.metaKey || e.button !== 0) {
return;
}
Expand Down

0 comments on commit 85aca23

Please sign in to comment.