window.matrix = (opts) => new Proxy({ el: null, // HTML element plugin:{ type: 'network', name: '[matrix] channel', description: 'a standardized decentralized privacy-friendly protocol', url: 'https://matrix.org', protocol: 'matrix://', video: false, audio: false, chat: true, scene: true }, html: { generic: (opts) => `
` }, init(){ let network = window.network network.plugin['matrix'] = this $connections.chatnetwork = $connections.chatnetwork.concat([this]) $connections.scene = $connections.scene.concat([this]) this.reactToConnectionHrefs() }, connect(opts){ console.log("connecting "+this.plugin.name) console.dir(opts) }, config(opts){ opts = {...opts, ...this.plugin } this.el = document.createElement('div') let html = this.html.generic(opts) for( let i in opts ){ if( this.html[i] ) html += this.html[i](opts) } this.el.innerHTML = html this.el.querySelector('#auth').addEventListener('change', (e) => { this.el.querySelector('#secret').setAttribute('placeholder', `enter ${e.target.value.replace(/.* /,'')}`) }) window.notify(`${opts.name} is ${opts.description}, it is the hottest internet technology available at this moment.