|
@@ -22,17 +22,18 @@ export default {
|
|
const links = this.$el.querySelectorAll('.page-wrapper a')
|
|
const links = this.$el.querySelectorAll('.page-wrapper a')
|
|
links.forEach((link, i) => {
|
|
links.forEach((link, i) => {
|
|
const number = parseInt(link.hash.replace('#', ''))
|
|
const number = parseInt(link.hash.replace('#', ''))
|
|
- if (!isNaN(number)) {
|
|
|
|
|
|
+ if (!isNaN(number) && this.page.notes.find(note => note.number === number)) {
|
|
link.classList.add('page-footnote-link')
|
|
link.classList.add('page-footnote-link')
|
|
link.id = `footnote-${this.slug}-${number}`
|
|
link.id = `footnote-${this.slug}-${number}`
|
|
link.setAttribute('href', 'javascript:;')
|
|
link.setAttribute('href', 'javascript:;')
|
|
link.dataset.number = number
|
|
link.dataset.number = number
|
|
|
|
+ link.textContent = i + 1
|
|
if (link.parentElement.nodeName === 'SUP') {
|
|
if (link.parentElement.nodeName === 'SUP') {
|
|
link.parentElement.replaceWith(link)
|
|
link.parentElement.replaceWith(link)
|
|
}
|
|
}
|
|
link.onclick = this.onFootnoteLinkClick
|
|
link.onclick = this.onFootnoteLinkClick
|
|
|
|
|
|
- this.addFootnoteContent(link, i)
|
|
|
|
|
|
+ this.addFootnoteContent(link, number)
|
|
}
|
|
}
|
|
})
|
|
})
|
|
},
|
|
},
|
|
@@ -41,7 +42,7 @@ export default {
|
|
const noteContainer = document.createElement('DIV')
|
|
const noteContainer = document.createElement('DIV')
|
|
noteContainer.classList.add('page-footnote-content')
|
|
noteContainer.classList.add('page-footnote-content')
|
|
noteContainer.id = link.id + '-content'
|
|
noteContainer.id = link.id + '-content'
|
|
- noteContainer.innerHTML = this.page.notes[i].content
|
|
|
|
|
|
+ noteContainer.innerHTML = this.page.notes.find(note => note.number === i).content
|
|
link.insertAdjacentElement('afterend', noteContainer)
|
|
link.insertAdjacentElement('afterend', noteContainer)
|
|
},
|
|
},
|
|
|
|
|