on master help sign in
Replace window.onload assignment
16a7208Liam Cooke
scripts/opml.js+2−2
@@ -4,10 +4,10 @@ const outlines = sites.filter(site => site.rss).map(site => {
4
4
5const template = `<?xml version="1.0" encoding="UTF-8"?><opml version="1.1"><head></head><body>${outlines.join('')}</body></opml>`
5const template = `<?xml version="1.0" encoding="UTF-8"?><opml version="1.1"><head></head><body>${outlines.join('')}</body></opml>`
6
6
7−window.onload = function () {
7+window.addEventListener('DOMContentLoaded', () => {
8 const a = document.getElementById('opml')
8 const a = document.getElementById('opml')
9 if (a) {
9 if (a) {
10 a.setAttribute('href', 'data:text/plain;charset=utf-8,' + window.encodeURIComponent(template))
10 a.setAttribute('href', 'data:text/plain;charset=utf-8,' + window.encodeURIComponent(template))
11 a.setAttribute('download', 'webring.opml')
11 a.setAttribute('download', 'webring.opml')
12 }
12 }
13−}
13+})