onionring-adaptation-for-petrapixel-sites.js
· 768 B · JavaScript
Raw
const webringContainer = '#webrings'; // edit this to be the selector of some container you want to put your webrings in
const webrings = { // follow the structure here to add more items if you have more
tyvnjam: {
vars: 'https://kazehai.com/else/tyvnjam/variables.js',
widget: 'https://kazehai.com/else/tyvnjam/widget.js'
},
};
Object.keys(webrings).forEach((ring) => {
const ringCont = document.createElement('div');
ringCont.id = ring;
const vars = document.createElement('script');
vars.src = webrings[ring].vars;
const widget = document.createElement('script');
widget.src = webrings[ring].widget;
ringCont.appendChild(vars);
ringCont.appendChild(widget);
document.querySelector(webringContainer).appendChild(ringCont);
});
| 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 | }); |