Files
ploxion-rs/app.blade.php

142 lines
18 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{{-- ◆ LE SYSTÈME DES RS (19.10.2026). RS-7 : « chaque ploxion a été créé et inventé par un RS différent, il faut le noter, catégoriser les
ploxions par RS ; c'est ça le xerboxion, créer la bulle de certitude autour du chaos » ; « tous les RS sont le même personnage, à
différentes timelines et univers » ; « on peut attribuer des ploxions à des gens, et connecter son ploxion avec quelqu'un » ; « des
propositions automatiques de vision, parce que chaque RS a des tags, pour taguer des trucs ou envoyer des liens de vidéos à un RS ».
Données : RsController (/px/rs.json, /px/rs/attribuer, /px/rs/boite). Les tags = la vision de RS-1, à confirmer : ils PROPOSENT, RS-7 décide.
Partager un ploxion = jOSPartage (les degrés O/I/X/N), rien de refait ici. --}}
<style>
.rsx { --a:#a597cf; --b:#79d9a2; --t:#ddd6ea; --m:#8a81a6; --s:#0f0b18; --bd:#272036; --bd2:#3a3050; min-height:100%; box-sizing:border-box; background:#07050c; color:var(--t);
font:14px/1.45 -apple-system,system-ui,sans-serif; padding:14px 14px calc(18px + env(safe-area-inset-bottom,0px)); }
.rsx * { box-sizing:border-box; } .rsx button, .rsx select, .rsx input { font:inherit; color:inherit; }
.rsx button { cursor:pointer; }
.rsx-h { margin:4px 0 10px; display:flex; align-items:baseline; gap:10px; font-size:17px; } .rsx-h small { margin-left:auto; font:600 11px ui-monospace,Menlo,monospace; color:var(--m); }
.rsx-sous { margin:18px 0 8px; font:700 11px ui-monospace,Menlo,monospace; letter-spacing:.12em; text-transform:uppercase; color:var(--m); }
.rsx-grille { display:grid; grid-template-columns:repeat(auto-fill,minmax(150px,1fr)); gap:8px; }
.rsx-carte { text-align:left; padding:11px 12px; border-radius:14px; border:2px solid var(--bd); background:var(--s); display:grid; grid-template-columns:30px 1fr; gap:2px 10px; }
.rsx-carte i { grid-row:1 / 4; font-style:normal; font-size:22px; color:var(--a); align-self:center; } .rsx-carte b { font-size:14px; } .rsx-carte small { color:var(--m); font-size:11.5px; }
.rsx-carte em { font:700 11px ui-monospace,Menlo,monospace; color:var(--b); font-style:normal; } .rsx-carte.on { border-color:var(--b); background:#0e1a14; } .rsx-carte.vide { opacity:.55; }
.rsx-panneau { margin-top:12px; padding:12px 14px; border-radius:16px; border:2px solid var(--bd2); background:#0b0814; }
.rsx-panneau h4 { margin:12px 0 6px; font:700 11px ui-monospace,Menlo,monospace; letter-spacing:.12em; text-transform:uppercase; color:var(--m); }
.rsx-tags { display:flex; flex-wrap:wrap; gap:4px; margin-top:6px; } .rsx-tags span { padding:2px 7px; border-radius:7px; border:1px dashed var(--bd2); font:600 10.5px ui-monospace,Menlo,monospace; color:var(--m); }
.rsx-px { display:inline-flex; align-items:center; gap:6px; min-height:36px; margin:0 6px 6px 0; padding:0 10px; border-radius:10px; border:1.5px solid var(--bd2); background:#0a0712; font-size:13px; }
.rsx-prop { display:flex; align-items:center; gap:6px; padding:5px 0; border-bottom:1px solid #15101f; } .rsx-prop span { flex:1; font-size:13px; }
.rsx-prop button { min-width:40px; min-height:36px; border-radius:10px; border:1.5px solid var(--bd2); background:#0a0712; } .rsx-prop button.oui { border-color:var(--b); color:var(--b); }
.rsx-lien { display:flex; align-items:center; gap:8px; padding:7px 0; border-bottom:1px solid #15101f; } .rsx-lien a { flex:1; min-width:0; color:var(--b); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:13px; }
.rsx-lien small { color:var(--m); font-size:11.5px; } .rsx-lien button { min-width:36px; min-height:34px; border-radius:9px; border:1.5px solid var(--bd2); background:#0a0712; }
.rsx-form { display:flex; flex-wrap:wrap; gap:6px; margin-top:8px; } .rsx-form input, .rsx-form select { flex:1 1 160px; min-height:40px; padding:0 10px; border-radius:11px; border:2px solid var(--bd2); background:#0a0712; font-size:16px; }
.rsx-bt { min-height:40px; padding:0 12px; border-radius:11px; border:2px solid var(--a); background:var(--a); color:#0d0a16 !important; font-weight:700; }
.rsx-bt.sec { background:#0a0712; border-color:var(--bd2); color:var(--t) !important; }
.rsx-mono { font:600 11px ui-monospace,Menlo,monospace; color:var(--m); } .rsx-p { color:#cfc6e3; font-size:13px; margin:0 0 6px; }
</style>
<script>
(function () {
'use strict';
var ID = 'rs', ROLES = { pose: 'a posé l\'idée', construit: 'a construit', relie: 'relié' };
function esc(s) { return window.jOSb.esc(s); }
function csrf() { var m = document.querySelector('meta[name="csrf-token"]'); return m ? m.content : ''; }
function api(url, methode, corps) {
return fetch(url, { method: methode || 'GET', credentials: 'same-origin', headers: { Accept: 'application/json', 'Content-Type': 'application/json', 'X-CSRF-TOKEN': csrf(), 'X-Requested-With': 'XMLHttpRequest' }, body: corps ? JSON.stringify(corps) : undefined })
.then(function (r) { return r.json().catch(function () { return {}; }).then(function (d) { if (!r.ok || d.ok === false) throw new Error(d.message || ('erreur ' + r.status)); return d; }); });
}
function toast(m) { try { var T = (window.jOSb && jOSb.toast) || (window.jOS && jOS.toast); if (T) T(m); } catch (e) {} }
function mount(c, ctx) {
var HUB = (ctx && (ctx.hub || (ctx.params && ctx.params.hub))) || null;
var vivant = true, d = null, choix = 'RS-7', ouvert = null; // choix : un RS, 'u:<id>' une personne, '?' ; ouvert : le ploxion du panneau
function charger() { return api('/px/rs.json').then(function (x) { d = x; dessiner(); }); }
function nom(id) { var n = d.noms[id] || {}; return (n.icone ? n.icone + ' ' : '') + (n.nom || id); }
function personne(id) { return (d.gens || []).filter(function (g) { return g.id === id; })[0]; }
function decide(px) { return (d.boite || []).filter(function (b) { return b.type === 'ploxion' && b.cible === px; }); }
function chip(id) { return '<button class="rsx-px" data-ouvrir="' + esc(id) + '">' + esc(nom(id)) + '</button>'; }
function panneauPloxion() {
if (!ouvert) return '';
var at = (d.attributions || {})[ouvert] || [], tr = (d.ploxions || {})[ouvert] || { idee: [], forge: [] }, rg = decide(ouvert).filter(function (b) { return b.statut === 'confirme'; });
var gens = (d.gens || []).filter(function (g) { return g.id === d.moi || (d.amis || []).indexOf(g.id) >= 0; });
return '<div class="rsx-panneau"><div class="rsx-h" style="margin:0">' + esc(nom(ouvert)) + '<small><button class="rsx-bt sec" data-fermer>✕</button></small></div>'
+ '<p class="rsx-p rsx-mono">' + (tr.idee.length ? 'posé par ' + tr.idee.join(', ') : '') + (tr.forge.length ? ' · construit par ' + tr.forge.join(', ') : '') + (rg.length ? ' · rangé chez ' + rg.map(function (b) { return b.rs; }).join(', ') : '') + '</p>'
+ '<div class="rsx-form"><button class="rsx-bt" data-aller="' + esc(ouvert) + '">▶ ouvrir</button><button class="rsx-bt sec" data-partager="' + esc(ouvert) + '">⇄ partager</button></div>'
+ '<h4>les gens</h4>' + (at.length ? at.map(function (a) { var p = personne(a.user_id); return '<div class="rsx-prop"><span>' + esc(p ? p.glyphe + ' ' + p.nom : '#' + a.user_id) + ' · ' + ROLES[a.role] + '</span>' + (d.admin || a.user_id === d.moi ? '<button data-retirer="' + a.user_id + ':' + a.role + '">✕</button>' : '') + '</div>'; }).join('') : '<p class="rsx-p rsx-mono">personne encore</p>')
+ '<div class="rsx-form"><select data-qui>' + gens.map(function (g) { return '<option value="' + g.id + '">' + esc(g.glyphe + ' ' + g.nom + (g.id === d.moi ? ' (toi)' : '')) + '</option>'; }).join('') + '</select>'
+ '<select data-role><option value="relie">relié</option><option value="pose">a posé l\'idée</option><option value="construit">a construit</option></select><button class="rsx-bt" data-attribuer>+</button></div></div>';
}
function panneauRS(R) {
var P = d.ploxions || {}, ids = Object.keys(P), B = d.boite || [];
var idee = ids.filter(function (id) { return P[id].idee.indexOf(R.id) >= 0; }), forge = ids.filter(function (id) { return P[id].forge.indexOf(R.id) >= 0; });
var ranges = B.filter(function (b) { return b.rs === R.id && b.type === 'ploxion' && b.statut === 'confirme'; }).map(function (b) { return b.cible; });
var props = ids.filter(function (id) { return P[id].propose && P[id].propose.rs === R.id && !decide(id).length; });
var liens = B.filter(function (b) { return b.rs === R.id && b.type !== 'ploxion'; });
return '<div class="rsx-panneau"><b>' + esc(R.id + ' · ' + R.titre) + '</b>' + (R.role ? '<p class="rsx-p">' + esc(R.role) + '</p>' : '')
+ ((R.tags || []).length ? '<div class="rsx-tags">' + R.tags.map(function (t) { return '<span>' + esc(t) + '</span>'; }).join('') + '<span style="border-style:solid">vision RS-1 · à confirmer</span></div>' : '')
+ (idee.length ? '<h4>a posé l\'idée · ' + idee.length + '</h4>' + idee.map(chip).join('') : '')
+ (forge.length ? '<h4>a construit · ' + forge.length + '</h4>' + forge.map(chip).join('') : '')
+ (ranges.length ? '<h4>rangés par RS-7 · ' + ranges.length + '</h4>' + ranges.map(chip).join('') : '')
+ (props.length ? '<h4>◇ propositions · vision RS-1 · ' + props.length + '</h4>' + props.map(function (id) { return '<div class="rsx-prop"><span><button class="rsx-px" style="margin:0" data-ouvrir="' + esc(id) + '">' + esc(nom(id)) + '</button></span>'
+ (d.admin ? '<button class="oui" data-decider="' + esc(id) + ':confirme">✓</button><button data-decider="' + esc(id) + ':refuse">✕</button>' : '<span class="rsx-mono">RS-7 décide</span>') + '</div>'; }).join('') : '')
+ '<h4>la boîte · ' + liens.length + '</h4>' + liens.map(function (b) { return '<div class="rsx-lien">' + (b.type === 'lien' ? '<a href="' + esc(b.cible) + '" target="_blank" rel="noopener">' + esc(b.cible.replace(/^https?:\/\/(www\.)?/, '')) + '</a>' : '<span style="flex:1">' + esc(b.cible) + '</span>')
+ (b.note ? '<small>' + esc(b.note) + '</small>' : '') + '<button data-boite-suppr="' + b.id + '">✕</button></div>'; }).join('')
+ '<div class="rsx-form"><input data-lien placeholder="un lien (une vidéo à regarder…) ou une note" maxlength="600"><input data-note placeholder="pourquoi" maxlength="500"><button class="rsx-bt" data-envoyer>→ ' + esc(R.id) + '</button></div></div>';
}
// un HUB : ses ploxions = ceux de son RS (traces, rangés, proposés) + ceux dont l'id, le nom ou la description portent ses tags
function membresHub(H) {
var P = d.ploxions || {}, out = [], re = (H.tags || []).map(function (t) { return new RegExp('(^|[^a-z])' + t.replace(/[-]/g, '[- ]?'), 'i'); });
Object.keys(d.noms || {}).forEach(function (id) { var n = d.noms[id] || {}, r0 = P[id] || { idee: [], forge: [] }, txt = (id + ' ' + (n.nom || '') + ' ' + (n.desc || '')).normalize('NFD').replace(/[\u0300-\u036f]/g, '');
var parRS = H.rs && (r0.idee.indexOf(H.rs) >= 0 && r0.idee.length === 1 || r0.forge.indexOf(H.rs) >= 0 || (r0.propose && r0.propose.rs === H.rs) || (d.boite || []).some(function (b) { return b.type === 'ploxion' && b.cible === id && b.rs === H.rs && b.statut === 'confirme'; }));
var tag = re.some(function (x) { return x.test(id) || x.test(n.nom || ''); }) || re.filter(function (x) { return x.test(txt); }).length >= 2;
if ((parRS || tag) && !n.admin && id !== H.id && id !== 'rs') out.push(id); });
return out;
}
function vueHub(H) {
var ids = membresHub(H), B = (d.boite || []).filter(function (b) { return b.rs === H.id && b.type !== 'ploxion'; }), R = H.rs ? d.registre.filter(function (r) { return r.id === H.rs; })[0] : null;
return '<div class="rsx"><div class="rsx-h"><span style="font-size:26px;color:var(--a)">' + esc(H.glyphe) + '</span> ' + esc(H.nom) + '<small>' + ids.length + ' ploxions</small></div>'
+ '<p class="rsx-p">' + esc(H.sens) + (R ? ' · <b>' + esc(R.id + ' · ' + R.titre) + '</b>' : '') + '</p>'
+ '<div class="rsx-tags">' + (H.tags || []).map(function (t) { return '<span>' + esc(t) + '</span>'; }).join('') + '</div>'
+ '<div class="rsx-sous">ses ploxions</div>' + ids.map(function (id) { return '<button class="rsx-px" data-aller="' + esc(id) + '">' + esc(nom(id)) + '</button>'; }).join('')
+ '<div class="rsx-sous">la boîte · ' + B.length + '</div>' + B.map(function (b) { return '<div class="rsx-lien">' + (b.type === 'lien' ? '<a href="' + esc(b.cible) + '" target="_blank" rel="noopener">' + esc(b.cible.replace(/^https?:\/\/(www\.)?/, '')) + '</a>' : '<span style="flex:1">' + esc(b.cible) + '</span>') + (b.note ? '<small>' + esc(b.note) + '</small>' : '') + '<button data-boite-suppr="' + b.id + '">✕</button></div>'; }).join('')
+ '<div class="rsx-form"><input data-lien placeholder="un lien, une recette, une vidéo, une note…" maxlength="600"><input data-note placeholder="pourquoi" maxlength="500"><button class="rsx-bt" data-envoyer>→ ' + esc(H.glyphe) + '</button></div>'
+ '<p class="rsx-mono" style="margin-top:14px">◆ <button class="rsx-px" data-aller="rs">le système des RS</button></p></div>';
}
function dessiner() {
if (!vivant) return;
if (!d) { c.innerHTML = '<div class="rsx"><div class="rsx-mono">…</div></div>'; return; }
var H0 = HUB && (d.hubs || []).filter(function (h) { return h.id === HUB; })[0];
if (H0) { choix = H0.id; c.innerHTML = vueHub(H0); return; }
var P = d.ploxions || {}, ids = Object.keys(P), compte = {}, B = d.boite || [];
ids.forEach(function (id) { var r = P[id]; r.idee.concat(r.forge).forEach(function (x) { compte[x] = (compte[x] || 0) + 1; }); });
B.forEach(function (b) { if (b.type === 'ploxion' && b.statut === 'confirme') compte[b.rs] = (compte[b.rs] || 0) + 1; });
var sans = ids.filter(function (id) { return !P[id].idee.length && !P[id].forge.length && !decide(id).some(function (b) { return b.statut === 'confirme'; }); });
var A = d.attributions || {}, parPers = {}; Object.keys(A).forEach(function (px) { A[px].forEach(function (a) { (parPers[a.user_id] = parPers[a.user_id] || []).push(px); }); });
var R = d.registre.filter(function (r) { return r.id === choix; })[0], corps = '';
if (R) corps = panneauRS(R);
else if (choix === '?') corps = '<div class="rsx-panneau"><h4>à attribuer · ' + sans.length + '</h4>' + sans.map(chip).join('') + '</div>';
else if (choix.indexOf('u:') === 0) { var pid = +choix.slice(2), pp = personne(pid); corps = '<div class="rsx-panneau"><b>' + esc(pp ? pp.glyphe + ' ' + pp.nom : '') + '</b><h4>ses ploxions · ' + (parPers[pid] || []).length + '</h4>' + (parPers[pid] || []).map(chip).join('') + '</div>'; }
var gensAtt = (d.gens || []).filter(function (g) { return parPers[g.id]; });
c.innerHTML = '<div class="rsx"><div class="rsx-h">◆ le système des RS<small>' + ids.length + ' ploxions · ' + (ids.length - sans.length) + ' rangés</small></div>'
+ '<p class="rsx-p">tous les RS sont le même personnage, à différentes timelines et univers. chaque ploxion a un RS qui l\'a posé et un RS qui l\'a construit.</p>'
+ '<div class="rsx-grille">' + d.registre.map(function (r) { return '<button class="rsx-carte' + (choix === r.id ? ' on' : '') + (compte[r.id] ? '' : ' vide') + '" data-rs="' + esc(r.id) + '"><i>' + esc(r.glyphe) + '</i><b>' + esc(r.id) + '</b><small>' + esc(r.titre) + '</small><em>' + (compte[r.id] || 0) + ' ploxions</em></button>'; }).join('')
+ '<button class="rsx-carte' + (choix === '?' ? ' on' : '') + '" data-rs="?"><i>?</i><b>à attribuer</b><small>sans trace</small><em>' + sans.length + '</em></button></div>'
+ (gensAtt.length ? '<div class="rsx-sous">◇ les gens du Nexus</div><div class="rsx-grille">' + gensAtt.map(function (g) { return '<button class="rsx-carte' + (choix === 'u:' + g.id ? ' on' : '') + '" data-rs="u:' + g.id + '"><i>' + esc(g.glyphe) + '</i><b>' + esc(g.nom) + '</b><small>' + esc(g.palier) + '</small><em>' + parPers[g.id].length + ' ploxions</em></button>'; }).join('') + '</div>' : '')
+ panneauPloxion() + corps + '</div>';
}
function apres(p, ok) { return p.then(function () { if (ok) toast(ok); return charger(); }, function (e) { toast('◆ ' + e.message); }); }
c.addEventListener('click', function (e) {
var b = e.target.closest('button'); if (!b || !vivant) return; var x = b.dataset;
if (x.rs) { choix = x.rs; ouvert = null; return dessiner(); }
if (x.ouvrir) { ouvert = x.ouvrir; dessiner(); var pn = c.querySelector('.rsx-panneau'); if (pn && pn.scrollIntoView) pn.scrollIntoView({ block: 'nearest' }); return; }
if (x.fermer != null) { ouvert = null; return dessiner(); }
if (x.aller) { try { if (window.jOS && jOS.openPloxion && jOS.openPloxion(x.aller)) return; } catch (er) {} location.href = '/px/' + x.aller; return; }
if (x.partager) { if (window.jOSPartage && jOSPartage.composer) jOSPartage.composer({ kind: 'ploxion', title: nom(x.partager), payload: { id: x.partager } }); else toast('◆ le partage n\'est pas chargé ici'); return; }
if (x.attribuer != null) { return apres(api('/px/rs/attribuer', 'POST', { ploxion: ouvert, user_id: +c.querySelector('[data-qui]').value, role: c.querySelector('[data-role]').value }), '◆ attribué'); }
if (x.retirer) { var pr = x.retirer.split(':'); return apres(api('/px/rs/retirer', 'POST', { ploxion: ouvert, user_id: +pr[0], role: pr[1] })); }
if (x.decider) { var dc = x.decider.split(':'); return apres(api('/px/rs/boite', 'POST', { rs: choix, type: 'ploxion', cible: dc[0], statut: dc[1] }), dc[1] === 'confirme' ? '◆ rangé chez ' + choix : null); }
if (x.envoyer != null) { var li = c.querySelector('[data-lien]').value.trim(), no = c.querySelector('[data-note]').value.trim(); if (!li) return;
return apres(api('/px/rs/boite', 'POST', { rs: choix, type: /^https?:\/\//.test(li) ? 'lien' : 'note', cible: li, note: no || null }), '→ ' + choix); }
if (x.boiteSuppr) { return apres(api('/px/rs/boite/' + x.boiteSuppr, 'DELETE')); }
});
charger().catch(function (e) { c.innerHTML = '<div class="rsx"><div class="rsx-mono">⊘ ' + esc(e.message) + '</div></div>'; });
dessiner();
return { unmount: function () { vivant = false; c.innerHTML = ''; } };
}
window.jOSApps = window.jOSApps || {};
window.jOSApps[ID] = { manifest: { id: ID, name: 'Le système des RS', icon: '◆' }, mount: mount };
})();
</script>