Skip to content

Commit

Permalink
🐛 Fix: APlayer invades the click event of the anchor links, resulting…
Browse files Browse the repository at this point in the history
… in invalid Chinese anchor links scrolling (#292)
  • Loading branch information
Lruihao committed Mar 3, 2023
1 parent 4e20b85 commit 0b5e40e
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ All notable changes to this project will be documented in this file.
- :bug: Fix: missing parameter `requiredFields` for Valine
- :bug: Fix: js.build is executed after fingerprint, resulting in the destruction of js integrity
- :bug: Fix: toc fails when the toc aside is on the left
- :bug: Fix: APlayer invades the click event of the anchor links, resulting in invalid Chinese anchor links scrolling ([#292](https://github.com/hugo-fixit/FixIt/issues/292))
- :recycle: Refactor: image lazy loading ([#283](https://github.com/hugo-fixit/FixIt/pull/283))
- :recycle: Refactor: author's avatar of post or profile ([#288](https://github.com/hugo-fixit/FixIt/pull/288))
- :art: Style: fix `#comments` css style conflict ([#269](https://github.com/hugo-fixit/FixIt/issues/269))
Expand Down
2 changes: 1 addition & 1 deletion assets/js/theme.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/js/theme.min.js.map

Large diffs are not rendered by default.

8 changes: 7 additions & 1 deletion src/js/theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -612,10 +612,16 @@ class FixIt {
* init table of contents
*/
initToc() {
const $tocCore = document.getElementById('TableOfContents');
let $tocCore = document.getElementById('TableOfContents');
if ($tocCore === null) {
return;
}
// It's a dirty hack to fix the bug of APlayer, see https://github.com/hugo-fixit/FixIt/issues/292
if (typeof APlayer === 'function') {
const $newTocCore = $tocCore.cloneNode(true);
$tocCore.parentElement.replaceChild($newTocCore, $tocCore);
$tocCore = $newTocCore;
}
if (document.getElementById('toc-static').dataset.kept === true || this.util.isTocStatic()) {
const $tocContentStatic = document.getElementById('toc-content-static');
if ($tocCore.parentElement !== $tocContentStatic) {
Expand Down

1 comment on commit 0b5e40e

@vercel
Copy link

@vercel vercel bot commented on 0b5e40e Mar 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

fixit – ./

fixit-git-master-x-cell.vercel.app
fixit.lruihao.cn
fixit-x-cell.vercel.app
hugofixit.vercel.app

Please sign in to comment.