const webringUrl = "https://raw.githubusercontent.com/5t3ph/css-webring/main/webring.json"; export class CssWebring extends HTMLElement { connectedCallback() { this.attachShadow({ mode: "open" }); const { shadowRoot } = this; shadowRoot.innerHTML = ` `; const list = shadowRoot.querySelector(".csswr-list"); const limit = this.getAttribute("limit") ? this.getAttribute("limit") : 3; const current = this.getAttribute("current"); const random = this.getAttribute("random"); const getWebring = async () => { const postResp = await fetch(webringUrl); let webring = await postResp.json(); if (current) { webring = webring.filter((link) => link.title !== current); } if (random) { webring = webring.sort(() => Math.random() - 0.5); } if (limit) { webring = webring.slice(0, limit); } return webring .map((item) => { return `