sorting fixed, saving back to dedicated page

fossxr
Fabien Benetou 2 years ago
parent 51543d08e3
commit e302f2587a
  1. 30
      index.html

@ -1329,21 +1329,29 @@ AFRAME.registerComponent('glossary', {
AFRAME.registerComponent('fossxr', { AFRAME.registerComponent('fossxr', {
init:function(){ init:function(){
},
tick: function(){
let generatorName = this.attrName let generatorName = this.attrName
fetch("https://fabien.benetou.fr/Testing/FOSSXR2022?action=source#" + Date.now()).then(res => res.text() ).then(res => { fetch("https://fabien.benetou.fr/Testing/FOSSXR2022?action=source#" + Date.now()).then(res => res.text() ).then(res => {
res.split("\n").filter(e => (e[0] && e[0] == "*")).slice(0,maxItemsFromSources).map( (n,i) => { res.split("\n").filter(e => (e.match(/^\* /))).slice(0,maxItemsFromSources).map( (n,i) => {
found = added.find((str) => str === n) found = added.find((str) => str === n)
if (typeof found === 'undefined'){ if (typeof found === 'undefined'){
added.push(n) added.push(n)
addNewNote( n, "-1 "+(1+i/10)+" -2.5", ".1 .1 .1", null, generatorName ) addNewNote( n, "-.1 "+(1+i/10)+" -.5", ".1 .1 .1", null, generatorName )
} }
}) })
}) })
} }
}); });
function saveBackList(){
data = Array.from( document.querySelectorAll(".fossxr") ).sort((a, b) => a.object3D.position.y - b.object3D.position.y ).map( e => e.getAttribute("value")).join("%0a")
configurableURL="https://fabien.benetou.fr/PIMVRdata/FOSSXR?action="
fetch(configurableURL+'edit', {
method: 'POST',
headers: {'Content-Type':'application/x-www-form-urlencoded'},
body: "post=1&author=PIMVR&authpw=edit_password&text="+JSON.stringify( data )
}).then(res => res).then(res => setFeedbackHUD("saved remotely"+ res))
}
AFRAME.registerComponent('fot', { AFRAME.registerComponent('fot', {
init:function(){ init:function(){
}, },
@ -1472,8 +1480,9 @@ fetch('./templates.json')
] ]
links = [] links = []
//fetch("commands.json").then(res => res.json() ).then(res => { //fetch("commands.json").then(res => res.json() ).then(res => {
var commandsURL = "https://fabien.benetou.fr/PIMVRdata/CabinCommands?action=source" var commandsURL = "https://fabien.benetou.fr/PIMVRdata/CabinCommands?action=source" // should become a global parameter
commandsURL = "https://fabien.benetou.fr/PIMVRdata/EngineSequentialTutorialCommands?action=source" // new default // commandsURL = "https://fabien.benetou.fr/PIMVRdata/EngineSequentialTutorialCommands?action=source" // new default
commandsURL = "https://fabien.benetou.fr/PIMVRdata/EngineFOSSXRCommands?action=source" // new default
var src = AFRAME.utils.getUrlParameter('commands-url') var src = AFRAME.utils.getUrlParameter('commands-url')
if (src && src != "") commandsURL = src if (src && src != "") commandsURL = src
fetch(commandsURL).then(res => res.json() ).then(res => { fetch(commandsURL).then(res => res.json() ).then(res => {
@ -1493,7 +1502,7 @@ fetch('./templates.json')
}, },
}); });
function save(){ function save(classname=null){
var data = targets.map( e => { return { var data = targets.map( e => { return {
localname: e.localName, localname: e.localName,
src: e.getAttribute("src"), src: e.getAttribute("src"),
@ -1533,8 +1542,9 @@ function remoteLoad(){
// both might not be ideal directly in the original JSON but could be attachement as URLs // both might not be ideal directly in the original JSON but could be attachement as URLs
} }
function remoteSave(){ function remoteSave(configurableURL="https://fabien.benetou.fr/PIMVRdata/CabinData?action="){
fetch(url+'edit', { // targets could be filtered down, e.g .fossxr only
fetch(configurableURL+'edit', {
method: 'POST', method: 'POST',
headers: {'Content-Type':'application/x-www-form-urlencoded'}, headers: {'Content-Type':'application/x-www-form-urlencoded'},
body: "post=1&author=PIMVR&authpw=edit_password&text="+JSON.stringify( cabin ) body: "post=1&author=PIMVR&authpw=edit_password&text="+JSON.stringify( cabin )
@ -1620,6 +1630,8 @@ function switchSide(){
<a-entity hide-on-enter-ar class="hidableenvironment" gltf-model="url(../content/CabanaAndCurtains.glb)" scale=".010 .010 .010" position="0 0.2 0.15" rotation="0 0 0"></a-entity> <a-entity hide-on-enter-ar class="hidableenvironment" gltf-model="url(../content/CabanaAndCurtains.glb)" scale=".010 .010 .010" position="0 0.2 0.15" rotation="0 0 0"></a-entity>
<a-entity light="type: ambient; color: #BBB; intensity: 0.6"></a-entity> <a-entity light="type: ambient; color: #BBB; intensity: 0.6"></a-entity>
<a-entity light="type: directional; color: #FFF; intensity: 0.6" position="-0.5 1 1"></a-entity> <a-entity light="type: directional; color: #FFF; intensity: 0.6" position="-0.5 1 1"></a-entity>
<a-entity light="type: directional; color: #FFF; intensity: 0.6" position="-0.5 1 1"></a-entity>
<a-sky hide-on-enter-ar color="#add8e6"></a-sky> <a-sky hide-on-enter-ar color="#add8e6"></a-sky>
<!-- permanent offline persistent e-ink based, rM2 size, reminder <!-- permanent offline persistent e-ink based, rM2 size, reminder

Loading…
Cancel
Save