From 65d15d32669e70f29d3a42cbdda55b1cbe6ca02a Mon Sep 17 00:00:00 2001 From: Fabien Benetou Date: Fri, 24 Mar 2023 10:40:02 +0100 Subject: [PATCH] matching room as wiki pages to be able to write from submit.html and read from index.html --- index.html | 24 ++++++++++++++++++++++++ submit.html | 8 +++++++- 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/index.html b/index.html index f176156..5dc9a76 100644 --- a/index.html +++ b/index.html @@ -2425,6 +2425,29 @@ obj.rotateOnAxis(axis, val.angle) } } +AFRAME.registerComponent('refresh-text-content-from-wiki-page', { + schema: { + pagename: {type: 'string', default: 'FoT'}, + }, + init:function(){ + this.added = [] + let = forcedPagename = AFRAME.utils.getUrlParameter('roomname') + forcedPagename?this.pagename=forcedPagename:this.pagename=this.data.pagename + }, + tick: function(){ + let generatorName = this.attrName + fetch("https://fabien.benetou.fr/PIMVRdata/"+ this.pagename +"?action=source#" + Date.now()).then(res => res.text() ).then(res => { + res.split("\n").slice(0,maxItemsFromSources).map( (n,i) => { + found = this.added.find((str) => str === n) + if (typeof found === 'undefined'){ + this.added.push(n) + addNewNote( n, "-1 "+(1+i/10)+" -2.5", ".1 .1 .1", null, generatorName ) + } + }) + }) + } +}); +
@@ -2433,6 +2456,7 @@ obj.rotateOnAxis(axis, val.angle)