|
|
|
@ -29,4 +29,40 @@ if (hrs.length > 2) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Remove the footnote links
|
|
|
|
// Remove the footnote links
|
|
|
|
u(document.getElementsByClassName('footnote-backref')).remove()
|
|
|
|
u(document.getElementsByClassName('footnote-backref')).remove()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Break ingredients into column-able blocks
|
|
|
|
|
|
|
|
window.addEventListener('load', function () {
|
|
|
|
|
|
|
|
const zutatenNode = document.evaluate('//*[@id="zutaten"]', document).iterateNext()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let nodeBlocks = [[]]
|
|
|
|
|
|
|
|
let nextNode = zutatenNode.nextElementSibling
|
|
|
|
|
|
|
|
while (nextNode && nextNode.tagName != "H2") {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(nextNode.tagName == 'H4') {
|
|
|
|
|
|
|
|
nodeBlocks.push([])
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
nodeBlocks[nodeBlocks.length - 1].push(nextNode)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
nextNode = nextNode.nextElementSibling
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let allIngredientsDiv = document.createElement('div')
|
|
|
|
|
|
|
|
allIngredientsDiv.id = "allZutaten"
|
|
|
|
|
|
|
|
allIngredientsDiv.classList.add('allZutaten')
|
|
|
|
|
|
|
|
let nodeBlockIndex = 0
|
|
|
|
|
|
|
|
nodeBlocks.forEach(function(nodeArray) {
|
|
|
|
|
|
|
|
let outerDiv = document.createElement('div')
|
|
|
|
|
|
|
|
outerDiv.id = `wrap${nodeBlockIndex}`
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
outerDiv.classList.add("zutatenWrapper")
|
|
|
|
|
|
|
|
allIngredientsDiv.appendChild(outerDiv)
|
|
|
|
|
|
|
|
for(elem of nodeArray) {
|
|
|
|
|
|
|
|
outerDiv.appendChild(elem)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
nodeBlockIndex += 1
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
zutatenNode.parentNode.insertBefore(allIngredientsDiv, zutatenNode.nextSibling)
|
|
|
|
|
|
|
|
console.log("Finished fiddling")
|
|
|
|
|
|
|
|
})
|
|
|
|
|