fix: download disabled on some scores

This commit is contained in:
Xmader 2020-11-19 18:53:46 -05:00
parent 52e1f9511c
commit 4eade0ad46
No known key found for this signature in database
GPG key ID: A20B97FB9EB730E4

View file

@ -9,10 +9,13 @@ type BtnElement = HTMLButtonElement
const getBtnContainer = (): HTMLDivElement => {
const container = document.querySelectorAll('aside>section>section')[0]
return [...container.children].find((div) => {
const btnParent = [...container.children].find((div) => {
const b = div.querySelector('button, .button')
return b && b.outerHTML.replace(/\s/g, '').includes('Download')
}) as HTMLDivElement
const text = b ? b.outerHTML.replace(/\s/g, '') : ''
return text.includes('Download') || text.includes('Print')
}) as HTMLDivElement | null
if (!btnParent) throw new Error('btn parent not found')
return btnParent
}
const buildDownloadBtn = () => {