'use strict' function Portal (sites) { this.el = document.createElement('div') this.el.id = 'portal' this.sites = sites // Templates function _readme () { return `

This webring is an attempt to inspire artists & developers to build their own website and share traffic among each other. The ring welcomes personalized websites such as diaries, wikis & portfolios.

To add yourself to the ring, submit a Pull Request.
If you found a broken link, please report it.

` } function _buttons () { return `

Random | Information | The Hallway | The Wiki | OPML

` } function _directory (sites) { const siteTypesArray = [ ...new Set( sites.map( site => site.type ).filter(Boolean) ) ] const siteTypes = siteTypesArray.reduce( (output, siteType) => `${output} <${siteType}>` , `<all>` ) const listItems = sites.reduce( (acc, site, id) => `${acc}
  • ${_name(site)}
  • ` , '' ) return `
    ` } function _name (site) { return site.title || `${site.url.split('//')[1]}` } function _type (site) { return site.type ? `data-type="${site.type}"` : '' } function _redirect (site) { return `

    Redirecting to ${site.url}