Skip to content

Commit 4e8ab17

Browse files
committed
remove no longer used format_toc function
1 parent cfda6fc commit 4e8ab17

File tree

1 file changed

+0
-44
lines changed

1 file changed

+0
-44
lines changed

root/static/js/cpan.js

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -173,50 +173,6 @@ for (const favButton of document.querySelectorAll('.breadcrumbs .favorite')) {
173173

174174
$('.dropdown-toggle').dropdown();
175175

176-
function format_toc(toc) {
177-
if (storage.getItem('hideTOC') == 1) {
178-
toc.classList.add("hide-toc");
179-
}
180-
181-
const toc_header = toc.querySelector('.toc-header');
182-
const toc_body = toc.querySelector('ul');
183-
184-
toc_header.insertAdjacentHTML('beforeend',
185-
' [ <button class="btn-link toggle-toc"><span class="toggle-show">show</span><span class="toggle-hide">hide</span></button> ]'
186-
);
187-
toc_header.querySelector('.toggle-toc').addEventListener('click', e => {
188-
e.preventDefault();
189-
const currentVisible = !toc.classList.contains('hide-toc');
190-
storage.setItem('hideTOC', currentVisible ? 1 : 0);
191-
192-
const fullHeight = toc_body.scrollHeight;
193-
194-
if (currentVisible) {
195-
const trans = toc_body.style.transition;
196-
toc_body.style.transition = '';
197-
198-
requestAnimationFrame(() => {
199-
toc_body.style.height = fullHeight + 'px';
200-
toc_body.style.transition = trans;
201-
toc.classList.toggle('hide-toc');
202-
203-
requestAnimationFrame(() => {
204-
toc_body.style.height = null;
205-
});
206-
});
207-
} else {
208-
const finish = e => {
209-
toc_body.removeEventListener('transitionend', finish);
210-
toc_body.style.height = null;
211-
};
212-
213-
toc_body.addEventListener('transitionend', finish);
214-
toc_body.style.height = fullHeight + 'px';
215-
toc.classList.toggle('hide-toc');
216-
}
217-
});
218-
}
219-
220176
const toc = document.querySelector(".content .toc")
221177
if (toc) {
222178
formatTOC(toc);

0 commit comments

Comments
 (0)