Remove chapter-list-data script after setup

This commit is contained in:
Tetrakern 2024-10-18 01:18:13 +02:00
parent eb988ac551
commit 6249bdd605
4 changed files with 6 additions and 5 deletions

2
js/chapter.min.js vendored

File diff suppressed because one or more lines are too long

6
js/complete.min.js vendored

File diff suppressed because one or more lines are too long

View File

@ -90,7 +90,7 @@ get_header(
);
if ( $story_post && $indexed_chapters ) {
echo '<script>const fcn_storyChapterListData = ' . json_encode( fictioneer_get_chapter_index_array( $story_id ) ) . ';</script>';
echo '<script id="chapter-list-data">const fcn_storyChapterListData = ' . json_encode( fictioneer_get_chapter_index_array( $story_id ) ) . ';</script>';
}
if ( get_option( 'fictioneer_enable_bookmarks' ) ) {

View File

@ -1268,6 +1268,7 @@ function fcn_appendChapterList(target) {
}
target.querySelector(`[data-id="${target.dataset.currentId}"]`)?.classList.add('current-chapter');
document.getElementById("chapter-list-data")?.remove(); // Cleanup
}
}