onionring-index.js (786B)
1 // onionring.js is made up of four files - onionring-widget.js, onionring-index.js (this one!), onionring-variables.js, and onionring.css 2 // it's licensed under the cooperative non-violent license (CNPL) v4+ (https://thufie.lain.haus/NPL.html) 3 // it was originally made by joey + mord of allium (蒜) house, last updated 2020-11-24 4 5 // === ONIONRING-INDEX === 6 //this file builds the list of sites in the ring for displaying on your index page 7 8 var tag = document.getElementById('index'); 9 regex = /^https:\/\/|\/$/g; //strips the https:// and trailing slash off the urls for aesthetic purposes 10 11 list = ""; 12 for (i = 0; i < sites.length; i++) { 13 list += `<li><a href='${sites[i]}'>${sites[i].replace(regex, "")}</a></li>`; 14 } 15 16 tag.insertAdjacentHTML('afterbegin', ` 17 <ul> 18 ${list} 19 </ul> 20 `);