veryroundbird revised this gist 1 month ago. Go to revision
1 file changed, 22 insertions
onionring-adaptation-for-petrapixel-sites.js(file created)
| @@ -0,0 +1,22 @@ | |||
| 1 | + | const webringContainer = '#webrings'; // edit this to be the selector of some container you want to put your webrings in | |
| 2 | + | const webrings = { // follow the structure here to add more items if you have more | |
| 3 | + | tyvnjam: { | |
| 4 | + | vars: 'https://kazehai.com/else/tyvnjam/variables.js', | |
| 5 | + | widget: 'https://kazehai.com/else/tyvnjam/widget.js' | |
| 6 | + | }, | |
| 7 | + | }; | |
| 8 | + | ||
| 9 | + | Object.keys(webrings).forEach((ring) => { | |
| 10 | + | const ringCont = document.createElement('div'); | |
| 11 | + | ringCont.id = ring; | |
| 12 | + | ||
| 13 | + | const vars = document.createElement('script'); | |
| 14 | + | vars.src = webrings[ring].vars; | |
| 15 | + | ||
| 16 | + | const widget = document.createElement('script'); | |
| 17 | + | widget.src = webrings[ring].widget; | |
| 18 | + | ||
| 19 | + | ringCont.appendChild(vars); | |
| 20 | + | ringCont.appendChild(widget); | |
| 21 | + | document.querySelector(webringContainer).appendChild(ringCont); | |
| 22 | + | }); | |
Newer
Older