Skip to content

Commit a5106b6

Browse files
Remove duplicated JS function
1 parent 2c9d30c commit a5106b6

File tree

1 file changed

+5
-16
lines changed

1 file changed

+5
-16
lines changed

util/gh-pages/script.js

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -145,29 +145,18 @@ function highlightIfNeeded(elem) {
145145
});
146146
}
147147

148-
function expandLintId(lintId) {
149-
searchState.inputElem.value = lintId;
150-
searchState.filterLints();
151-
152-
// Expand the lint.
148+
function expandLint(lintId) {
153149
const lintElem = document.getElementById(lintId);
154-
const isCollapsed = lintElem.classList.remove("collapsed");
155-
lintElem.querySelector(".label-doc-folding").innerText = "-";
150+
const isCollapsed = lintElem.classList.toggle("collapsed");
151+
lintElem.querySelector(".label-doc-folding").innerText = isCollapsed ? "+" : "−";
156152
highlightIfNeeded(lintElem);
157153
}
158154

159155
// Show details for one lint
160156
function openLint(event) {
161157
event.preventDefault();
162158
event.stopPropagation();
163-
expandLintId(event.target.getAttribute("href").slice(1));
164-
}
165-
166-
function expandLint(lintId) {
167-
const lintElem = document.getElementById(lintId);
168-
const isCollapsed = lintElem.classList.toggle("collapsed");
169-
lintElem.querySelector(".label-doc-folding").innerText = isCollapsed ? "+" : "-";
170-
highlightIfNeeded(lintElem);
159+
expandLint(event.target.getAttribute("href").slice(1));
171160
}
172161

173162
function copyToClipboard(event) {
@@ -526,7 +515,7 @@ function scrollToLint(lintId) {
526515
return;
527516
}
528517
target.scrollIntoView();
529-
expandLintId(lintId);
518+
expandLint(lintId);
530519
}
531520

532521
// If the page we arrive on has link to a given lint, we scroll to it.

0 commit comments

Comments
 (0)