|
43 | 43 | constbuttons=$('<div class="dt-tags" style="grid-column: page;">') |
44 | 44 | buttons.append('<a href="#citation" class="dt-tag"><i class="fas fa-quote-left"></i> Cite</a>') |
45 | 45 | buttons.append('<a href="'+slug+'.pdf" class="dt-tag"><i class="fas fa-file-pdf"></i> PDF</a>') |
46 | | -buttons.append('<a href="'+slug+'.zip" class="dt-tag"><i class="fas fa-file-zipper"></i> Supplement</a>') |
| 46 | + |
| 47 | +// Conditionally add supplementary files button |
| 48 | +document.addEventListener('DOMContentLoaded',()=>{ |
| 49 | +if(document.getElementById('supplementary-materials')){ |
| 50 | +// create element safely |
| 51 | +consta=document.createElement('a'); |
| 52 | +a.href=slug+'.zip'; |
| 53 | +a.className='dt-tag'; |
| 54 | +a.innerHTML='<i class="fas fa-file-zipper"></i> Supplement'; |
| 55 | +// append depending on what `buttons` is: |
| 56 | +// if buttons is a DOM node: |
| 57 | +buttons.appendChild(a); |
| 58 | +// OR if buttons is a selector string: |
| 59 | +// document.querySelector(buttons).appendChild(a); |
| 60 | +} |
| 61 | +}); |
47 | 62 |
|
48 | 63 | // adds Abstract: in front of the first <p> in the title section -- |
49 | 64 | // unless it happens to be the subtitle (FIXME: this is a bad hack - can't distill do this?) |
|