mirror of
https://git.j0bot.ch/admin_j0bot/ploxion-chaoxion.git
synced 2026-11-29 06:12:06 +00:00
synchro du labo (0bf0da65) : app.blade.php, README.md
This commit is contained in:
parent
b9f76f5b03
commit
df4a217f67
22
README.md
22
README.md
@ -1,3 +1,21 @@
|
|||||||
# ploxion-chaoxion
|
# 🌀 Chaoxion
|
||||||
|
|
||||||
PLOXION · L'inbox du chaos : avale tes milliers d'inspirations (liens en masse, screenshots, notes), les classe (zéro LLM) et les pose dans un backlog « à forger » → idée / RepoVerse / forge. · fournit: inbox, intake, classify, backlog
|
L'inbox du chaos : avale tes milliers d'inspirations (liens en masse, screenshots, notes), les classe (zéro LLM) et les pose dans un backlog « à forger » → idée / RepoVerse / forge.
|
||||||
|
|
||||||
|
| | |
|
||||||
|
| --- | --- |
|
||||||
|
| id | `chaoxion` |
|
||||||
|
| fournit | `inbox` `intake` `classify` `backlog` |
|
||||||
|
| bions qu'il nomme | `jOSApps` `jOSBoxion` `jOSPorts` `jOSRepoverse` |
|
||||||
|
| fichiers | `app.blade.php` |
|
||||||
|
| dans le labo | `resources/views/ploxions/chaoxion/` (dépôt `my_website2`) |
|
||||||
|
|
||||||
|
## Contribuer
|
||||||
|
|
||||||
|
- **Dans le xer** : https://labo.j0bot.ch/px/atelier?ploxion=chaoxion — prends-le, modifie-le, vois-le tourner, « ⧗ envoyer le tsoin ».
|
||||||
|
- **Dans VS Code** : `xb prendre chaoxion` (ou l'extension xerboxion › ⇩ Prendre), puis ⧗ Envoyer.
|
||||||
|
- Le chemin complet : https://labo.j0bot.ch/px/contribuer
|
||||||
|
|
||||||
|
Ce dépôt est un **miroir** du labo (synchronisé par `bin/ploxions-forge.mjs`, depuis le commit `0bf0da65`) : une modif se propose par un tsoin ou une branche du labo, pas directement ici.
|
||||||
|
|
||||||
|
© 2026 chill-tekk · ne pas nuire
|
||||||
|
|||||||
895
app.blade.php
Normal file
895
app.blade.php
Normal file
@ -0,0 +1,895 @@
|
|||||||
|
{{-- ============================================================================================
|
||||||
|
PL0XI0N chaoxion — L'USINE À ORDONNER LE CHAOS (directive RS-7 16.08 : « améliorer le
|
||||||
|
CHAOXION au max »). RS-7 a des MILLIERS d'inspirations collectées depuis des années.
|
||||||
|
Ce ploxion les gobe (liens, screenshots, notes), les CLASSE de manière déterministe
|
||||||
|
(zéro LLM), puis les fait SORTIR vers les machines sœurs :
|
||||||
|
🍽 digestion (awesome-catalog.json, 89 listes) 🎯 mission (format dev-ploxions)
|
||||||
|
🛠 atelier (handoff atelier:take) 💡 idée / RepoVerse
|
||||||
|
📦 archive · 🔥 garder au chaud (le vrai backlog)
|
||||||
|
Le bouton « ⚙ ordonner le chaos » = AUTO-TRIAGE déterministe : dédup url/titre,
|
||||||
|
match awesome-* contre le catalog (statut hérité), lien vers les ploxions du registre,
|
||||||
|
classification par domaine. Le % chaos→ordre = (classés+routés+faits)/total, RÉEL.
|
||||||
|
|
||||||
|
UI DENSE : une ligne = un item (titre · domaine · statut · actions), expansion au clic,
|
||||||
|
compteurs-filtres, sélection multiple (checkbox + shift) pour le triage en masse.
|
||||||
|
|
||||||
|
CONTRAT : window.jOSApps['chaoxion'] = { manifest, mount(container,ctx) -> { unmount } }.
|
||||||
|
Racine au contrat xer : .cx = position:absolute; inset:0.
|
||||||
|
Persistance RÉTRO-COMPATIBLE : jOSBoxion (ns 'chaoxion', key 'inbox') + localStorage
|
||||||
|
'jos:chaoxion'. Mêmes clés, champs ADDITIFS seulement :
|
||||||
|
{ items:[...], ← inchangé (statuts additifs : digestion, candidat-digestion,
|
||||||
|
mission, atelier, archive, chaud, doublon)
|
||||||
|
scout:{id:{...}}, ← NOUVEAU : overlay d'état des items catalogue (jamais dupliqués)
|
||||||
|
snapshot:{...} } ← NOUVEAU : résumé pour describe() (pur, hors DOM)
|
||||||
|
Les catalogues scout restent la source du contenu (5 fichiers /data/chaoxion-*.json +
|
||||||
|
inspirations) ; seul l'ÉTAT (statut, liens, domaine corrigé) est persisté → léger.
|
||||||
|
============================================================================================ --}}
|
||||||
|
<style>
|
||||||
|
.cx{position:absolute;inset:0;display:flex;flex-direction:column;overflow:hidden;background:var(--xr-bg,#0a0d16);color:var(--xr-fg,#e8ecf8);
|
||||||
|
font-family:var(--xr-font-ui,ui-sans-serif,system-ui);font-size:.84rem}
|
||||||
|
.cx *{box-sizing:border-box}
|
||||||
|
.cx .hd{display:flex;align-items:center;gap:8px;padding:8px 11px;border-bottom:1px solid var(--xr-line,#1b2540);flex-wrap:wrap}
|
||||||
|
.cx .hd .ttl{font-weight:800;letter-spacing:.01em;white-space:nowrap}
|
||||||
|
.cx .hd .ttl small{display:block;font-weight:400;font-size:.62rem;color:var(--xr-muted,#7f93c8)}
|
||||||
|
.cx .prog{margin-left:auto;min-width:110px;flex:0 1 190px}
|
||||||
|
.cx .prog .bar{height:7px;border-radius:6px;background:var(--xr-card,#111a30);overflow:hidden;border:1px solid var(--xr-line,#1b2540)}
|
||||||
|
.cx .prog .fill{height:100%;background:linear-gradient(90deg,var(--xr-accent,#3fe0d0),var(--xr-accent2,#8a7dff));transition:width .4s;width:0}
|
||||||
|
.cx .prog .lab{font-size:.58rem;color:var(--xr-muted,#7f93c8);margin-top:2px;text-align:right}
|
||||||
|
.cx .hd .hbtn{flex:0 0 auto;border:1px solid var(--xr-line,#2a3a5e);background:var(--xr-card,#111a30);color:var(--xr-fg,#e8ecf8);border-radius:9px;padding:7px 11px;font:inherit;font-weight:700;cursor:pointer;font-size:.76rem;min-height:38px}
|
||||||
|
.cx .hd .hbtn.pri{background:var(--xr-accent,#2a5ad0);border-color:transparent;color:#fff}
|
||||||
|
.cx .stats{display:flex;flex-wrap:wrap;gap:5px;padding:6px 11px;border-bottom:1px solid var(--xr-line,#1b2540)}
|
||||||
|
.cx .stat{flex:0 0 auto;padding:3px 10px;border:1px solid var(--xr-line,#1b2540);border-radius:16px;background:var(--xr-card,#111a30);cursor:pointer;line-height:1.15;display:flex;gap:6px;align-items:baseline;min-height:30px}
|
||||||
|
.cx .stat.on{border-color:var(--xr-accent,#3fe0d0);box-shadow:0 0 0 1px var(--xr-accent,#3fe0d0) inset}
|
||||||
|
.cx .stat b{font-size:.92rem}
|
||||||
|
.cx .stat small{font-size:.6rem;color:var(--xr-muted,#7f93c8);text-transform:uppercase;letter-spacing:.03em}
|
||||||
|
.cx:not(.intake-open) .intake{display:none}
|
||||||
|
.cx .intake{padding:9px 11px;border-bottom:1px solid var(--xr-line,#1b2540);display:flex;flex-direction:column;gap:8px}
|
||||||
|
.cx .tabs{display:flex;gap:5px;flex-wrap:wrap}
|
||||||
|
.cx .tab{flex:1;min-width:92px;min-height:40px;padding:7px 9px;border:1px solid var(--xr-line,#1b2540);border-radius:10px;background:var(--xr-card,#111a30);color:var(--xr-fg,#e8ecf8);font-weight:700;cursor:pointer;font-size:.78rem}
|
||||||
|
.cx .tab.on{border-color:var(--xr-accent,#3fe0d0);color:var(--xr-accent,#3fe0d0)}
|
||||||
|
.cx .pane{display:none;flex-direction:column;gap:7px}
|
||||||
|
.cx .pane.on{display:flex}
|
||||||
|
.cx textarea,.cx input[type=text],.cx input[type=url]{width:100%;background:var(--xr-bg2,#080b13);border:1px solid var(--xr-line,#1b2540);color:var(--xr-fg,#e8ecf8);border-radius:9px;padding:9px;font:inherit;outline:none}
|
||||||
|
.cx textarea{min-height:100px;resize:vertical;line-height:1.4}
|
||||||
|
.cx textarea:focus,.cx input:focus{border-color:var(--xr-accent,#3fe0d0)}
|
||||||
|
.cx .btn{min-height:40px;padding:9px 13px;border:0;border-radius:10px;background:var(--xr-accent,#2a5ad0);color:#fff;font-weight:800;cursor:pointer;font-size:.86rem}
|
||||||
|
.cx .drop{border:2px dashed var(--xr-line,#2a3a5e);border-radius:11px;padding:16px 10px;text-align:center;color:var(--xr-muted,#7f93c8);font-size:.78rem}
|
||||||
|
.cx .filters{display:flex;gap:6px;padding:7px 11px;border-bottom:1px solid var(--xr-line,#1b2540);flex-wrap:wrap;align-items:center}
|
||||||
|
.cx select{background:var(--xr-bg2,#080b13);border:1px solid var(--xr-line,#1b2540);color:var(--xr-fg,#e8ecf8);border-radius:8px;padding:6px 8px;font:inherit;min-height:36px;font-size:.78rem}
|
||||||
|
.cx .filters input{flex:1;min-width:110px;min-height:36px;padding:6px 9px}
|
||||||
|
.cx .selbar{display:none;gap:6px;padding:6px 11px;border-bottom:1px solid var(--xr-accent,#3fe0d0);background:var(--xr-card,#111a30);align-items:center;flex-wrap:wrap}
|
||||||
|
.cx .selbar.on{display:flex}
|
||||||
|
.cx .selbar b{font-size:.76rem}
|
||||||
|
.cx .selbar button{min-height:34px;padding:5px 10px;border-radius:8px;border:1px solid var(--xr-line,#2a3a5e);background:transparent;color:var(--xr-fg,#e8ecf8);font-size:.72rem;font-weight:700;cursor:pointer}
|
||||||
|
.cx .body{flex:1;overflow:auto;min-height:0}
|
||||||
|
.cx .row{display:flex;align-items:center;gap:7px;padding:5px 11px;border-bottom:1px solid color-mix(in srgb,var(--xr-line,#1b2540) 55%,transparent);cursor:pointer;min-height:36px}
|
||||||
|
.cx .row:hover{background:color-mix(in srgb,var(--xr-card,#111a30) 70%,transparent)}
|
||||||
|
.cx .row.done{opacity:.45}
|
||||||
|
.cx .row .ck{flex:0 0 auto;width:16px;height:16px;accent-color:var(--xr-accent,#3fe0d0);cursor:pointer}
|
||||||
|
.cx .row .ico{flex:0 0 auto;font-size:.95rem;line-height:1;width:1.25em;text-align:center}
|
||||||
|
.cx .row .ti{flex:1 1 auto;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-weight:600;color:var(--xr-fg,#dbe6ff)}
|
||||||
|
.cx .row .ti small{font-weight:400;color:var(--xr-muted,#7f93c8);font-size:.72rem}
|
||||||
|
.cx .chip{flex:0 0 auto;font-size:.6rem;padding:1px 7px;border-radius:14px;border:1px solid var(--xr-line,#2a3a5e);color:var(--xr-muted,#9fb0d8);white-space:nowrap;max-width:9em;overflow:hidden;text-overflow:ellipsis}
|
||||||
|
.cx .chip.dom{border-color:color-mix(in srgb,var(--xr-accent,#3fe0d0) 55%,transparent);color:var(--xr-accent,#3fe0d0)}
|
||||||
|
.cx .chip.reg{border-color:#8a7dff;color:#b4a8ff;cursor:pointer}
|
||||||
|
.cx .st{flex:0 0 auto;font-size:.62rem;font-weight:700;white-space:nowrap}
|
||||||
|
.cx .st-nouveau{color:var(--xr-muted,#9fb0d8)} .cx .st-chaud{color:#ffb26b} .cx .st-route{color:#8fd3ff}
|
||||||
|
.cx .st-fait{color:#7CFFB2} .cx .st-doublon{color:#ff7ca0}
|
||||||
|
.cx .row .qa{flex:0 0 auto;display:flex;gap:2px}
|
||||||
|
.cx .row .qa button{border:0;background:transparent;color:var(--xr-muted,#7f93c8);font-size:.82rem;cursor:pointer;padding:3px 4px;border-radius:6px;line-height:1}
|
||||||
|
.cx .row .qa button:hover{background:var(--xr-card,#111a30);color:var(--xr-fg,#e8ecf8)}
|
||||||
|
.cx .det{display:none;padding:8px 11px 10px 34px;border-bottom:1px solid var(--xr-line,#1b2540);background:color-mix(in srgb,var(--xr-card,#111a30) 55%,transparent)}
|
||||||
|
.cx .det.on{display:block}
|
||||||
|
.cx .det .note{font-size:.76rem;color:var(--xr-muted,#9fb0d8);margin:2px 0 7px;line-height:1.45;word-break:break-word}
|
||||||
|
.cx .det .note a{color:var(--xr-accent,#3fe0d0);text-decoration:none;word-break:break-all}
|
||||||
|
.cx .det .routes{display:flex;gap:5px;flex-wrap:wrap;margin-bottom:6px}
|
||||||
|
.cx .det .routes button{min-height:36px;padding:6px 10px;border-radius:8px;border:1px solid var(--xr-line,#2a3a5e);background:transparent;color:var(--xr-fg,#e8ecf8);font-size:.72rem;font-weight:700;cursor:pointer}
|
||||||
|
.cx .det .routes button.pri{border-color:var(--xr-accent,#3fe0d0);color:var(--xr-accent,#3fe0d0)}
|
||||||
|
.cx .det .routes button.warn{border-color:#ffb26b;color:#ffb26b}
|
||||||
|
.cx .det .routes button.ok{border-color:#7CFFB2;color:#7CFFB2}
|
||||||
|
.cx .det .edit{display:flex;gap:5px;flex-wrap:wrap}
|
||||||
|
.cx .det .edit input{flex:1;min-width:110px;min-height:34px;padding:5px 8px}
|
||||||
|
.cx .thumb{width:26px;height:26px;border-radius:6px;object-fit:cover;flex:0 0 auto;background:var(--xr-bg2,#080b13);border:1px solid var(--xr-line,#1b2540)}
|
||||||
|
.cx .empty{color:var(--xr-muted,#7f93c8);text-align:center;padding:26px 12px;font-size:.8rem;line-height:1.5}
|
||||||
|
.cx .toastline{font-size:.68rem;color:var(--xr-muted,#7f93c8);padding:4px 11px;min-height:1.4em;border-bottom:1px solid var(--xr-line,#1b2540);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
|
||||||
|
.cx .toastline:empty{display:none}
|
||||||
|
@media (max-width:480px){
|
||||||
|
.cx .chip.pid,.cx .row .qa .xtra{display:none}
|
||||||
|
.cx .det{padding-left:11px}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<script>
|
||||||
|
(function () {
|
||||||
|
'use strict';
|
||||||
|
var ID = 'chaoxion';
|
||||||
|
var NS = 'chaoxion', KEY = 'inbox', LS = 'jos:chaoxion';
|
||||||
|
// les 5 catalogues scout (contenu, lecture seule) — l'ÉTAT vit dans l'overlay persisté
|
||||||
|
var SCOUT_SRC = [
|
||||||
|
['/data/inspirations-ploxions.json', 'scout'],
|
||||||
|
['/data/chaoxion-stars.json', 'star'],
|
||||||
|
['/data/chaoxion-raven.json', 'raven'],
|
||||||
|
['/data/chaoxion-aryeth.json', 'aryeth'],
|
||||||
|
['/data/chaoxion-quantique.json', 'quantique']
|
||||||
|
];
|
||||||
|
var AW_URL = '/px/awesome-catalog.json'; // la machine à digestion (89 listes, statuts)
|
||||||
|
var REG_URL = '/dev/ploxions.json'; // le registre + les 1193 missions (auth ; tolère 401)
|
||||||
|
|
||||||
|
// ---- CLASSIFICATION DÉTERMINISTE (zéro LLM — doctrine forge) ------------------------------
|
||||||
|
var DOMAINS = [
|
||||||
|
{ key: 'audio', label: 'Audio / Son', icon: '🎵', type: 'bion', kw: ['audio','son','sound','music','musique','spotify','synth','mixer','radio','podcast','mp3','wav','ableton','daw','beat','sample','freesound'] },
|
||||||
|
{ key: '3d', label: '3D / CAD', icon: '🧊', type: 'ploxion', kw: ['3d','cad','scad','openscad','blender','stl','mesh','thingiverse','printables','render','fusion360','freecad','slicer'] },
|
||||||
|
{ key: 'espace', label: 'Espace', icon: '🛰️', type: 'ploxion', kw: ['space','espace','nasa','esa','iss','orbit','orbite','satellite','astro','cosmos','planet','galaxy','spacex','rocket','celestrak'] },
|
||||||
|
{ key: 'hardware', label: 'Hardware', icon: '🔌', type: 'bion', kw: ['arduino','esp32','esp8266','raspberry','rpi','pcb','circuit','electronic','électronique','hardware','sensor','capteur','gpio','mcu','kicad','solder','fritzing','microcontroller','stm32','firmware','embedded'] },
|
||||||
|
{ key: 'jeu', label: 'Jeu', icon: '🎮', type: 'ploxion', kw: ['game','jeu','steam','unity','godot','minecraft','itch','gamedev','roguelike','pixel','sprite','tilemap'] },
|
||||||
|
{ key: 'data', label: 'Data / Viz', icon: '📊', type: 'bion', kw: ['data','viz','chart','graph','dataset','csv','dashboard','d3','plotly','plot','statistiques','stats','kaggle','analytics'] },
|
||||||
|
{ key: 'reseau', label: 'Réseau', icon: '🌐', type: 'ploxion', kw: ['network','réseau','reseau','mesh','p2p','tor','vpn','wireguard','protocol','protocole','socket','mqtt','bluetooth','lora','matrix','federation','selfhosted','self-hosted'] },
|
||||||
|
{ key: 'science', label: 'Science', icon: '🔬', type: 'ploxion', kw: ['paper','arxiv','mdpi','research','recherche','science','physics','physique','math','maths','doi','crossref','journal','preprint','quantique','quantum','eeg','bci'] },
|
||||||
|
{ key: 'video', label: 'Vidéo', icon: '🎬', type: 'ploxion', kw: ['youtube','youtu.be','video','vidéo','vimeo','film','twitch','mp4','stream','clip'] },
|
||||||
|
{ key: 'ia', label: 'IA / ML', icon: '🧠', type: 'ploxion', kw: ['machine-learning',' ml ','neural','llm','gpt','huggingface','pytorch','tensorflow','diffusion',' ai ',' ia '] },
|
||||||
|
{ key: 'design', label: 'Design / DA', icon: '🎨', type: 'bion', kw: ['design','figma','dribbble','behance','font','police','typo','couleur','color','palette','shader','glsl',' ui ',' ux '] },
|
||||||
|
// 'web' EN DERNIER : github/app/tool matchent presque tout — c'est le filet, pas le filtre.
|
||||||
|
{ key: 'web', label: 'Web / Outil', icon: '🧰', type: 'ploxion', kw: ['github','gitlab','codepen','npm','api','app','tool','outil','framework','library','css','html','javascript','react','vue','svelte','webapp','saas','plugin','cli','awesome'] }
|
||||||
|
];
|
||||||
|
var HINT_BION = ['bion','component','composant','widget','snippet','lib','util','helper','micro','brique'];
|
||||||
|
var ROUTED = { digestion: 1, 'candidat-digestion': 1, mission: 1, atelier: 1, idee: 1 };
|
||||||
|
|
||||||
|
function slug(s) {
|
||||||
|
return String(s || '').toLowerCase().normalize('NFD').replace(/[\u0300-\u036f]/g, '')
|
||||||
|
.replace(/[^a-z0-9]+/g, '-').replace(/^-+|-+$/g, '').slice(0, 48);
|
||||||
|
}
|
||||||
|
function normUrl(u) {
|
||||||
|
return String(u || '').toLowerCase().replace(/^https?:\/\//, '').replace(/^www\./, '')
|
||||||
|
.replace(/[#?].*$/, '').replace(/\/+$/, '');
|
||||||
|
}
|
||||||
|
function repoPath(u) { // github.com/owner/name → owner/name
|
||||||
|
var m = normUrl(u).match(/^github\.com\/([^\/]+\/[^\/]+)/); return m ? m[1] : '';
|
||||||
|
}
|
||||||
|
function domainOf(text) {
|
||||||
|
var t = ' ' + String(text || '').toLowerCase() + ' ';
|
||||||
|
for (var i = 0; i < DOMAINS.length; i++) {
|
||||||
|
var d = DOMAINS[i];
|
||||||
|
for (var k = 0; k < d.kw.length; k++) { if (t.indexOf(d.kw[k]) >= 0) return d; }
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
function classify(item) {
|
||||||
|
var text = (item.titre || '') + ' ' + (item.url || '') + ' ' + (item.note || '') + ' ' + (item.source || '');
|
||||||
|
var d = domainOf(text);
|
||||||
|
var type = d ? d.type : 'ploxion';
|
||||||
|
var lt = ' ' + text.toLowerCase() + ' ';
|
||||||
|
for (var i = 0; i < HINT_BION.length; i++) { if (lt.indexOf(HINT_BION[i]) >= 0) { type = 'bion'; break; } }
|
||||||
|
var base = slug(item.titre) || (d ? d.key : 'chaos');
|
||||||
|
return { domain: d ? d.key : null, type: type, ploxion_id: base + '-' + type.slice(0, 3), icon: d ? d.icon : '❔' };
|
||||||
|
}
|
||||||
|
function ensureClassified(item) {
|
||||||
|
if (item.type && item.ploxion_id && item.domain) return item;
|
||||||
|
var c = classify(item);
|
||||||
|
if (!item.domain) item.domain = c.domain;
|
||||||
|
if (!item.type) item.type = c.type;
|
||||||
|
if (!item.ploxion_id) item.ploxion_id = c.ploxion_id;
|
||||||
|
if (!item.icon) item.icon = c.icon;
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
function domLabel(key) {
|
||||||
|
for (var i = 0; i < DOMAINS.length; i++) if (DOMAINS[i].key === key) return DOMAINS[i].label;
|
||||||
|
return key || 'indéterminé';
|
||||||
|
}
|
||||||
|
function hostOf(url) {
|
||||||
|
try { return new URL(url).hostname.replace(/^www\./, ''); } catch (e) {
|
||||||
|
var m = String(url || '').match(/^[a-z]+:\/\/([^\/]+)/i); return m ? m[1].replace(/^www\./, '') : '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function guessTitle(url) {
|
||||||
|
var h = hostOf(url); if (!h) return url || 'lien';
|
||||||
|
var path = '';
|
||||||
|
try { path = new URL(url).pathname.replace(/\/+$/, '').split('/').filter(Boolean).pop() || ''; } catch (e) {}
|
||||||
|
path = path.replace(/\.[a-z0-9]{1,5}$/i, '').replace(/[-_+]+/g, ' ').trim();
|
||||||
|
var name = h.split('.').slice(0, -1).join('.') || h;
|
||||||
|
return path ? (name + ' · ' + path).slice(0, 90) : name;
|
||||||
|
}
|
||||||
|
function genId() { return 'c' + Date.now().toString(36) + Math.random().toString(36).slice(2, 6); }
|
||||||
|
|
||||||
|
// statut effectif → famille (pour compteurs/filtres/couleurs)
|
||||||
|
function stFam(s) {
|
||||||
|
if (s === 'fait' || s === 'archive') return 'fait';
|
||||||
|
if (s === 'chaud' || s === 'à forger') return 'chaud';
|
||||||
|
if (ROUTED[s]) return 'route';
|
||||||
|
if (s === 'doublon') return 'doublon';
|
||||||
|
return 'nouveau';
|
||||||
|
}
|
||||||
|
function stLabel(s) {
|
||||||
|
return ({ nouveau: 'à traiter', 'à forger': '🔥 chaud', chaud: '🔥 chaud', fait: '✓ fait', archive: '📦 archivé',
|
||||||
|
digestion: '🍽 digestion', 'candidat-digestion': '🍽 candidat', mission: '🎯 mission', atelier: '🛠 atelier',
|
||||||
|
idee: '💡 idée', doublon: '≡ doublon' })[s] || 'à traiter';
|
||||||
|
}
|
||||||
|
|
||||||
|
function mount(container, ctx) {
|
||||||
|
var STATE = { items: [] }; // la file réelle persistée (inchangée)
|
||||||
|
var OVER = {}; // overlay d'état des items scout (ADDITIF : clé 'scout' du store)
|
||||||
|
var SAVED = {}; // l'objet chargé tel quel (préserve les clés inconnues)
|
||||||
|
var SCOUT = []; // contenu des catalogues (lecture)
|
||||||
|
var AW = []; // awesome-catalog.json → listes
|
||||||
|
var REG = {}; // ids du registre des ploxions
|
||||||
|
var SEL = {}; // sélection multiple
|
||||||
|
var OPEN = {}; // lignes dépliées
|
||||||
|
var alive = true, fStatus = 'tous', fDomain = 'tous', q = '', lastIdx = -1, busOff = null;
|
||||||
|
|
||||||
|
container.innerHTML =
|
||||||
|
'<div class="cx">' +
|
||||||
|
'<div class="hd">' +
|
||||||
|
'<div class="ttl">🌀 chaoxion <small>l\'usine à ordonner le chaos</small></div>' +
|
||||||
|
'<div class="prog"><div class="bar"><div class="fill" data-fill></div></div><div class="lab" data-plab>chaos → ordre</div></div>' +
|
||||||
|
'<button class="hbtn pri" data-ordonner>⚙ ordonner le chaos</button>' +
|
||||||
|
'<button class="hbtn" data-tgl>+ ajouter</button>' +
|
||||||
|
'</div>' +
|
||||||
|
'<div class="stats" data-stats></div>' +
|
||||||
|
'<div class="intake">' +
|
||||||
|
'<div class="tabs">' +
|
||||||
|
'<button class="tab on" data-tab="liens">🔗 Liens en masse</button>' +
|
||||||
|
'<button class="tab" data-tab="images">🖼️ Screenshots</button>' +
|
||||||
|
'<button class="tab" data-tab="note">📝 Note rapide</button>' +
|
||||||
|
'</div>' +
|
||||||
|
'<div class="pane on" data-pane="liens">' +
|
||||||
|
'<textarea data-links placeholder="Colle tes liens, un par ligne. La machine les gobe, dédup, et devine le domaine…"></textarea>' +
|
||||||
|
'<button class="btn" data-add-links>🌀 Avaler les liens</button>' +
|
||||||
|
'</div>' +
|
||||||
|
'<div class="pane" data-pane="images">' +
|
||||||
|
'<div class="drop" data-drop>Dépose des captures ici, ou :</div>' +
|
||||||
|
'<input type="file" accept="image/*" multiple data-file style="display:none">' +
|
||||||
|
'<button class="btn" data-pick>🖼️ Ajouter des images</button>' +
|
||||||
|
'</div>' +
|
||||||
|
'<div class="pane" data-pane="note">' +
|
||||||
|
'<input type="url" data-n-url placeholder="URL (titre auto-extrait si même origine)">' +
|
||||||
|
'<input type="text" data-n-note placeholder="La note / l\'idée brute…">' +
|
||||||
|
'<button class="btn" data-add-note>➕ Ajouter à l\'inbox</button>' +
|
||||||
|
'</div>' +
|
||||||
|
'</div>' +
|
||||||
|
'<div class="filters">' +
|
||||||
|
'<select data-f-domain><option value="tous">Tous domaines</option></select>' +
|
||||||
|
'<select data-f-status>' +
|
||||||
|
'<option value="tous">Tous statuts</option>' +
|
||||||
|
'<option value="nouveau">À traiter</option>' +
|
||||||
|
'<option value="route">Routés</option>' +
|
||||||
|
'<option value="chaud">🔥 Chauds</option>' +
|
||||||
|
'<option value="fait">Faits + archivés</option>' +
|
||||||
|
'<option value="doublon">Doublons</option>' +
|
||||||
|
'</select>' +
|
||||||
|
'<input type="text" data-search placeholder="filtrer…">' +
|
||||||
|
'</div>' +
|
||||||
|
'<div class="selbar" data-selbar>' +
|
||||||
|
'<b data-selcount></b>' +
|
||||||
|
'<button data-mass="archive">📦 archiver</button>' +
|
||||||
|
'<button data-mass="chaud">🔥 chaud</button>' +
|
||||||
|
'<button data-mass="fait">✓ fait</button>' +
|
||||||
|
'<button data-mass="nouveau">↺ à traiter</button>' +
|
||||||
|
'<button data-selnone>✕</button>' +
|
||||||
|
'</div>' +
|
||||||
|
'<div class="toastline" data-msg></div>' +
|
||||||
|
'<div class="body" data-list></div>' +
|
||||||
|
'</div>';
|
||||||
|
|
||||||
|
var R = container.querySelector('.cx');
|
||||||
|
var listEl = R.querySelector('[data-list]');
|
||||||
|
var statsEl = R.querySelector('[data-stats]');
|
||||||
|
var msgEl = R.querySelector('[data-msg]');
|
||||||
|
var fillEl = R.querySelector('[data-fill]');
|
||||||
|
var plabEl = R.querySelector('[data-plab]');
|
||||||
|
var fDomSel = R.querySelector('[data-f-domain]');
|
||||||
|
var selbar = R.querySelector('[data-selbar]');
|
||||||
|
var selcount = R.querySelector('[data-selcount]');
|
||||||
|
|
||||||
|
function esc(s) {
|
||||||
|
if (window.jOSb && window.jOSb.esc) return window.jOSb.esc(s);
|
||||||
|
var d = document.createElement('div'); d.textContent = (s == null ? '' : s); return d.innerHTML;
|
||||||
|
}
|
||||||
|
function msg(m) { try { msgEl.textContent = m || ''; } catch (e) {} }
|
||||||
|
function copy(text, okMsg) {
|
||||||
|
var done = false;
|
||||||
|
try { if (navigator.clipboard && navigator.clipboard.writeText) { navigator.clipboard.writeText(text); done = true; } } catch (e) {}
|
||||||
|
if (!done) {
|
||||||
|
try {
|
||||||
|
var ta = document.createElement('textarea'); ta.value = text; ta.style.position = 'fixed'; ta.style.opacity = '0';
|
||||||
|
document.body.appendChild(ta); ta.select(); document.execCommand('copy'); document.body.removeChild(ta); done = true;
|
||||||
|
} catch (e2) {}
|
||||||
|
}
|
||||||
|
msg(done ? (okMsg || '📋 copié.') : 'copie impossible — ' + text.slice(0, 80));
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---- PERSISTANCE (rétro-compatible : items inchangé, scout/snapshot ADDITIFS) -------------
|
||||||
|
function snapshot() {
|
||||||
|
var all = merged(), total = 0, ord = 0, oldest = [];
|
||||||
|
all.forEach(function (v) {
|
||||||
|
if (v.st === 'doublon') return;
|
||||||
|
total++;
|
||||||
|
// ordonné = une DÉCISION a été prise : routé/fait/chaud, ou classé par le triage ⚙
|
||||||
|
if (v.st !== 'nouveau' || v.tri) ord++;
|
||||||
|
if (stFam(v.st) === 'nouveau') oldest.push({ t: v.titre, at: v.addedAt || 0 });
|
||||||
|
});
|
||||||
|
oldest.sort(function (a, b) { return (a.at || 0) - (b.at || 0); });
|
||||||
|
return { total: total, pct: total ? Math.round((ord / total) * 100) : 0,
|
||||||
|
oldest: oldest.slice(0, 3).map(function (o) { return String(o.t || '').slice(0, 60); }), at: Date.now() };
|
||||||
|
}
|
||||||
|
function persist() {
|
||||||
|
var out = Object.assign({}, SAVED, { items: STATE.items, scout: OVER, snapshot: snapshot() });
|
||||||
|
try { localStorage.setItem(LS, JSON.stringify(out)); } catch (e) {}
|
||||||
|
try {
|
||||||
|
if (window.jOSBoxion && window.jOSBoxion.saveSoon)
|
||||||
|
window.jOSBoxion.saveSoon(NS, KEY, out, 'Inbox Chaoxion');
|
||||||
|
} catch (e) {}
|
||||||
|
}
|
||||||
|
function adopt(o) {
|
||||||
|
if (!o) return false;
|
||||||
|
SAVED = o;
|
||||||
|
if (Array.isArray(o.items)) STATE.items = o.items;
|
||||||
|
if (o.scout && typeof o.scout === 'object') OVER = o.scout;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
function loadState() {
|
||||||
|
try { var raw = localStorage.getItem(LS); if (raw) { adopt(JSON.parse(raw)); render(); } } catch (e) {}
|
||||||
|
try {
|
||||||
|
if (window.jOSBoxion && window.jOSBoxion.load) {
|
||||||
|
window.jOSBoxion.load(NS, KEY).then(function (it) {
|
||||||
|
if (!alive || !it || !it.data || !(Array.isArray(it.data.items))) return;
|
||||||
|
// le boxion gagne s'il porte au moins autant d'état (source multi-appareils)
|
||||||
|
var mineN = STATE.items.length + Object.keys(OVER).length;
|
||||||
|
var hisN = it.data.items.length + Object.keys(it.data.scout || {}).length;
|
||||||
|
if (hisN >= mineN) { adopt(it.data); render(); }
|
||||||
|
}).catch(function () {});
|
||||||
|
}
|
||||||
|
} catch (e) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---- CATALOGUES SCOUT (contenu ; l'état vit dans OVER) ------------------------------------
|
||||||
|
function mapCatalog(d, prefix) {
|
||||||
|
var arr = Array.isArray(d) ? d : (d.idees || d.items || d.ploxions || d.inspirations || []);
|
||||||
|
return (arr || []).map(function (e, i) {
|
||||||
|
var url = e.url || e.link || e.href || '';
|
||||||
|
return ensureClassified({
|
||||||
|
id: prefix + ':' + (e.id || slug(e.titre || e.title || e.name) || i),
|
||||||
|
url: url, titre: e.titre || e.title || e.name || guessTitle(url) || 'inspiration',
|
||||||
|
note: e.quoi || e.description || e.note || e.pitch || '',
|
||||||
|
source: e.source || hostOf(url) || prefix,
|
||||||
|
difficulte: e.difficulty || e.difficulte || e.diff || null,
|
||||||
|
domain: e.domaine || e.domain || null, type: e.type || null, ploxion_id: e.ploxion_id || null,
|
||||||
|
icon: e.icone || e.icon || null, status: 'nouveau', scout: true
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function loadScout() {
|
||||||
|
SCOUT_SRC.forEach(function (src) {
|
||||||
|
try {
|
||||||
|
fetch(src[0], { credentials: 'same-origin', headers: { Accept: 'application/json' } })
|
||||||
|
.then(function (r) { return r.ok ? r.json() : null; })
|
||||||
|
.then(function (d) {
|
||||||
|
if (!alive || !d) return;
|
||||||
|
var add = mapCatalog(d, src[1]);
|
||||||
|
var have = {}; SCOUT.forEach(function (x) { have[x.id] = true; });
|
||||||
|
add.forEach(function (x) { if (!have[x.id]) SCOUT.push(x); });
|
||||||
|
render();
|
||||||
|
}).catch(function () {});
|
||||||
|
} catch (e) {}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// ---- MACHINES SŒURS : le catalog digestion + le registre des ploxions ---------------------
|
||||||
|
function loadSisters() {
|
||||||
|
try {
|
||||||
|
fetch(AW_URL, { credentials: 'same-origin', headers: { Accept: 'application/json' } })
|
||||||
|
.then(function (r) { return r.ok ? r.json() : null; })
|
||||||
|
.then(function (d) { if (alive && d && Array.isArray(d.listes)) { AW = d.listes; render(); } })
|
||||||
|
.catch(function () {});
|
||||||
|
} catch (e) {}
|
||||||
|
try {
|
||||||
|
fetch(REG_URL, { credentials: 'same-origin', headers: { Accept: 'application/json' } })
|
||||||
|
.then(function (r) { return r.ok ? r.json() : null; })
|
||||||
|
.then(function (d) {
|
||||||
|
if (!alive || !d || !(Array.isArray(d.ploxions))) return;
|
||||||
|
d.ploxions.forEach(function (p) { if (p && p.id) REG[p.id] = p.name || p.id; });
|
||||||
|
render();
|
||||||
|
}).catch(function () {});
|
||||||
|
} catch (e) {}
|
||||||
|
try { Object.keys(window.jOSApps || {}).forEach(function (k) { REG[k] = REG[k] || k; }); } catch (e) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---- VUE FUSIONNÉE : items réels + scout⊕overlay (une seule identité par id) --------------
|
||||||
|
function merged() {
|
||||||
|
var out = STATE.items.map(function (it) {
|
||||||
|
var v = Object.assign({}, it); v.real = true; v.st = it.status || 'nouveau'; return ensureClassified(v);
|
||||||
|
});
|
||||||
|
var haveUrl = {}; out.forEach(function (v) { var k = normUrl(v.url); if (k) haveUrl[k] = true; });
|
||||||
|
SCOUT.forEach(function (s) {
|
||||||
|
if (s.url && haveUrl[normUrl(s.url)]) return; // déjà matérialisé en item réel
|
||||||
|
var o = OVER[s.id] || {};
|
||||||
|
var v = Object.assign({}, s, o); v.real = false; v.st = o.status || 'nouveau';
|
||||||
|
out.push(ensureClassified(v));
|
||||||
|
});
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
function patch(id, fields) {
|
||||||
|
for (var i = 0; i < STATE.items.length; i++) {
|
||||||
|
if (STATE.items[i].id === id) {
|
||||||
|
if (fields.status !== undefined) STATE.items[i].status = fields.status;
|
||||||
|
Object.keys(fields).forEach(function (k) { if (k !== 'status') STATE.items[i][k] = fields[k]; });
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// item scout → overlay (le contenu reste dans le catalogue, seul l'état est persisté)
|
||||||
|
var o = OVER[id] || (OVER[id] = {});
|
||||||
|
Object.keys(fields).forEach(function (k) { o[k] = fields[k]; });
|
||||||
|
o.at = Date.now();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
function viewOf(id) { var all = merged(); for (var i = 0; i < all.length; i++) if (all[i].id === id) return all[i]; return null; }
|
||||||
|
|
||||||
|
// ---- AUTO-TRIAGE DÉTERMINISTE : « ⚙ ordonner le chaos » -----------------------------------
|
||||||
|
function awMatch(v) {
|
||||||
|
var rp = repoPath(v.url), nu = normUrl(v.url), t = String(v.titre || '').toLowerCase();
|
||||||
|
for (var i = 0; i < AW.length; i++) {
|
||||||
|
var c = AW[i];
|
||||||
|
var cu = normUrl(c.url || '');
|
||||||
|
if ((rp && repoPath(c.url || '') === rp) || (nu && cu === nu)) return c;
|
||||||
|
if (c.nom && String(c.nom).toLowerCase() === t) return c;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
function regMatch(v) {
|
||||||
|
if (v.ploxion_id && REG[v.ploxion_id]) return v.ploxion_id;
|
||||||
|
var last = '';
|
||||||
|
try { last = slug((new URL(v.url)).pathname.split('/').filter(Boolean).pop() || ''); } catch (e) {}
|
||||||
|
if (last && REG[last]) return last;
|
||||||
|
var ts = slug(v.titre || '');
|
||||||
|
if (ts && REG[ts]) return ts;
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
function isAwesome(v) { return /awesome/i.test((v.titre || '') + ' ' + (v.url || '')); }
|
||||||
|
function ordonner() {
|
||||||
|
var rep = { dedup: 0, digestion: 0, candidats: 0, registre: 0, classes: 0, total: 0 };
|
||||||
|
var all = merged(), seen = {};
|
||||||
|
all.forEach(function (v) {
|
||||||
|
if (v.st === 'doublon') return;
|
||||||
|
// (a) DÉDUP : même url ou même titre normalisé — le premier gagne, rien n'est perdu
|
||||||
|
var k = normUrl(v.url) || ('t:' + slug(v.titre));
|
||||||
|
if (k && k !== 't:') {
|
||||||
|
if (seen[k]) { patch(v.id, { status: 'doublon', dup_of: seen[k] }); rep.dedup++; return; }
|
||||||
|
seen[k] = v.id;
|
||||||
|
}
|
||||||
|
rep.total++;
|
||||||
|
// (c) lien registre (chip cliquable) — jamais destructif
|
||||||
|
if (!v.reg) { var rid = regMatch(v); if (rid) { patch(v.id, { reg: rid }); rep.registre++; } }
|
||||||
|
else rep.registre++;
|
||||||
|
// (b) awesome-* → la machine à digestion (statuts hérités du catalog)
|
||||||
|
if (isAwesome(v) && stFam(v.st) === 'nouveau') {
|
||||||
|
var c = awMatch(v);
|
||||||
|
if (c) { patch(v.id, { status: 'digestion', aw: c.id, aw_statut: c.statut || 'a-digerer' }); rep.digestion++; }
|
||||||
|
else { patch(v.id, { status: 'candidat-digestion' }); rep.candidats++; }
|
||||||
|
}
|
||||||
|
// (d) domaine (ensureClassified au merge) → l'item est CLASSÉ : tampon tri (persisté),
|
||||||
|
// c'est lui qui rend le % chaos→ordre réel (une décision machine a été prise)
|
||||||
|
if (v.domain) {
|
||||||
|
rep.classes++;
|
||||||
|
if (!v.tri) patch(v.id, { tri: 1 });
|
||||||
|
if (v.real) { var it = null; STATE.items.forEach(function (x) { if (x.id === v.id) it = x; }); if (it) ensureClassified(it); }
|
||||||
|
}
|
||||||
|
});
|
||||||
|
persist(); render();
|
||||||
|
var pct = snapshot().pct;
|
||||||
|
msg('⚙ ordonné : ' + rep.dedup + ' doublon' + (rep.dedup > 1 ? 's' : '') +
|
||||||
|
' · 🍽 ' + rep.digestion + ' liés digestion + ' + rep.candidats + ' candidats' +
|
||||||
|
' · ▣ ' + rep.registre + ' liés registre' +
|
||||||
|
' · 🏷 ' + rep.classes + '/' + rep.total + ' classés · ordre ' + pct + '%');
|
||||||
|
return rep;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---- LES ROUTES DE SORTIE (le chaos SORT vers les machines) -------------------------------
|
||||||
|
function routeDigestion(id) {
|
||||||
|
var v = viewOf(id); if (!v) return;
|
||||||
|
var c = awMatch(v);
|
||||||
|
if (c) {
|
||||||
|
patch(id, { status: 'digestion', aw: c.id, aw_statut: c.statut || 'a-digerer' });
|
||||||
|
persist(); render();
|
||||||
|
msg('🍽 lié au catalog digestion : ' + c.id + ' (' + (c.statut || 'a-digerer') + ')');
|
||||||
|
} else {
|
||||||
|
patch(id, { status: 'candidat-digestion' }); persist(); render();
|
||||||
|
var entry = {
|
||||||
|
id: slug(v.titre).replace(/-(plo|bio)$/, ''), nom: v.titre, url: v.url || '',
|
||||||
|
domaine: v.domain || 'web', pour_quel_ploxion: v.reg || v.ploxion_id || '',
|
||||||
|
quoi_manger: v.note || 'À distiller : bions + patterns pour le xerboxion.',
|
||||||
|
statut: 'a-digerer', priorite: 2
|
||||||
|
};
|
||||||
|
copy(JSON.stringify(entry, null, 1), '📋 entrée prête pour resources/data/awesome-catalog.json — colle-la dans « listes ».');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function routeMission(id) {
|
||||||
|
var v = viewOf(id); if (!v) return;
|
||||||
|
patch(id, { status: 'mission' }); persist(); render();
|
||||||
|
var m = {
|
||||||
|
id: 'chaoxion:' + slug(v.titre), t: 'Digérer « ' + v.titre + ' » pour le xerboxion',
|
||||||
|
why: v.note || ('Inspiration ' + (v.source || 'chaoxion') + ' à transformer en bion/ploxion.'),
|
||||||
|
diff: 'moyen', file: null, doc: null, href: v.url || null
|
||||||
|
};
|
||||||
|
copy(JSON.stringify(m, null, 1), '📋 mission (format dev-ploxions) copiée.');
|
||||||
|
}
|
||||||
|
function routeAtelier(id) {
|
||||||
|
var v = viewOf(id); if (!v) return;
|
||||||
|
patch(id, { status: 'atelier' }); persist(); render();
|
||||||
|
var target = v.reg || null;
|
||||||
|
if (target) {
|
||||||
|
// la passe de main native de l'atelier : localStorage 'atelier:take' + ouverture
|
||||||
|
try { localStorage.setItem('atelier:take', target); } catch (e) {}
|
||||||
|
var opened = false;
|
||||||
|
try { if (window.jOS && window.jOS.openPloxion) opened = !!window.jOS.openPloxion('atelier'); } catch (e) {}
|
||||||
|
if (!opened) { try { location.href = '/px/atelier?ploxion=' + encodeURIComponent(target); } catch (e) {} }
|
||||||
|
msg('🛠 passé à l\'atelier : ' + target);
|
||||||
|
} else {
|
||||||
|
copy('# Squelette ploxion — ' + v.titre + '\n\nid proposé : ' + (v.ploxion_id || slug(v.titre)) +
|
||||||
|
'\ntype : ' + (v.type || 'ploxion') + ' · domaine : ' + domLabel(v.domain) +
|
||||||
|
(v.url ? '\nsource : ' + v.url : '') + (v.note ? '\nnote : ' + v.note : '') +
|
||||||
|
'\n\nContrat : window.jOSApps[id] = { manifest, mount(container,ctx) -> { unmount } }',
|
||||||
|
'📋 squelette copié (pas encore au registre) — colle-le à l\'atelier.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function toIdea(id) {
|
||||||
|
var v = viewOf(id); if (!v) return;
|
||||||
|
var payload = {
|
||||||
|
title: v.titre,
|
||||||
|
pitch: v.note || ('Inspiration ' + (v.source || '') + (v.url ? (' — ' + v.url) : '')),
|
||||||
|
braindump: [v.url ? ('source : ' + v.url) : '', 'domaine deviné : ' + (v.domain || '?'),
|
||||||
|
'type : ' + (v.type || '?') + ' · id proposé : ' + (v.ploxion_id || '?'),
|
||||||
|
v.note ? ('note : ' + v.note) : ''].filter(Boolean).join('\n')
|
||||||
|
};
|
||||||
|
var sent = false;
|
||||||
|
try { if (window.jOSPorts && window.jOSPorts.emit) { window.jOSPorts.emit('idee', 'seed', payload); sent = true; } } catch (e) {}
|
||||||
|
// LOT C social-v0 (24.09, D9.1) : « balancer l'idée » PERSISTE — KV idee/mes-idees + chose partagée kind idee
|
||||||
|
// visibilité moi (le geste du ploxion Idée, window.jOSApps.idee.balancer, chargé à la demande). Plus de presse-papier
|
||||||
|
// (la branche jOSRepoverse.createIdea, inexistante, est retirée). Kill-switch : localStorage xb:idee.persist = 'off'
|
||||||
|
// → ancien comportement (bus seul, sinon gabarit copié).
|
||||||
|
var persistOn = true; try { persistOn = localStorage.getItem('xb:idee.persist') !== 'off'; } catch (e) {}
|
||||||
|
var A = window.jOSApps;
|
||||||
|
patch(id, { status: 'idee', idea_sent: sent || undefined }); persist(); render();
|
||||||
|
if (persistOn && A) {
|
||||||
|
msg('💡 on garde « ' + v.titre + ' »…');
|
||||||
|
Promise.resolve(A.ensure ? A.ensure('idee') : null).then(function () {
|
||||||
|
var I = A.idee; if (!I || !I.balancer) throw new Error('ploxion Idée indisponible');
|
||||||
|
return I.balancer({ title: payload.title, pitch: payload.pitch, braindump: payload.braindump });
|
||||||
|
}).then(function (x) {
|
||||||
|
patch(id, { idea_saved: true, idea_post: (x && x.post_id) || undefined }); persist(); render();
|
||||||
|
msg('💡 « ' + v.titre + ' » gardée' + (x && x.post_id ? ' dans ton fil (🔒 toi seul) — « ⊕ repo » dans le ploxion Idée pour la développer.' : ' sur ton boxion.'));
|
||||||
|
}).catch(function (e) {
|
||||||
|
copy('# ' + payload.title + '\n\n' + payload.pitch + '\n\n' + payload.braindump, '📋 pas pu la garder (' + ((e && e.message) || e) + ') — gabarit copié.');
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (sent) msg('💡 « ' + v.titre + ' » semé dans le ploxion Idée.');
|
||||||
|
else copy('# ' + payload.title + '\n\n' + payload.pitch + '\n\n' + payload.braindump, '📋 gabarit d\'idée copié (colle-le dans RepoVerse).');
|
||||||
|
}
|
||||||
|
function applyEdit(id, domain, type, pid) {
|
||||||
|
var d = null; DOMAINS.forEach(function (x) { if (x.key === domain) d = x; });
|
||||||
|
patch(id, { domain: domain || null, type: type || 'ploxion', ploxion_id: pid || null, icon: d ? d.icon : '❔' });
|
||||||
|
persist(); render();
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---- INTAKE -------------------------------------------------------------------------------
|
||||||
|
function enrichTitle(it) {
|
||||||
|
// titre auto-extrait si MÊME ORIGINE (pas de CORS cross-site) ; sinon guessTitle suffit
|
||||||
|
try {
|
||||||
|
var u = new URL(it.url, location.href);
|
||||||
|
if (u.origin !== location.origin) return;
|
||||||
|
fetch(u.href, { credentials: 'same-origin' }).then(function (r) { return r.ok ? r.text() : ''; }).then(function (t) {
|
||||||
|
if (!alive || !t) return;
|
||||||
|
var m = t.match(/<title[^>]*>\s*([^<]{2,140})/i);
|
||||||
|
if (m) {
|
||||||
|
for (var i = 0; i < STATE.items.length; i++) {
|
||||||
|
if (STATE.items[i].id === it.id) { STATE.items[i].titre = m[1].trim(); persist(); render(); break; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}).catch(function () {});
|
||||||
|
} catch (e) {}
|
||||||
|
}
|
||||||
|
function addLinks(text) {
|
||||||
|
var lines = String(text || '').split(/\r?\n/), added = 0, dup = 0;
|
||||||
|
var seen = {};
|
||||||
|
merged().forEach(function (v) { var k = normUrl(v.url); if (k) seen[k] = true; });
|
||||||
|
lines.forEach(function (raw) {
|
||||||
|
var line = raw.trim(); if (!line) return;
|
||||||
|
var url = line, note = '';
|
||||||
|
var m = line.match(/(https?:\/\/\S+)/i);
|
||||||
|
if (m) { url = m[1]; note = line.replace(m[1], '').replace(/^[\s\-–—:|]+|[\s\-–—:|]+$/g, ''); }
|
||||||
|
else if (!/^[a-z]+:\/\//i.test(line) && /\.[a-z]{2,}/i.test(line) && line.indexOf(' ') < 0) { url = 'https://' + line; }
|
||||||
|
else { note = line; url = ''; }
|
||||||
|
var key = url ? normUrl(url) : ('note:' + note.toLowerCase());
|
||||||
|
if (seen[key]) { dup++; return; }
|
||||||
|
seen[key] = true;
|
||||||
|
var it = ensureClassified({
|
||||||
|
id: genId(), url: url, titre: url ? guessTitle(url) : note.slice(0, 80),
|
||||||
|
note: url ? note : '', source: url ? hostOf(url) : 'note',
|
||||||
|
addedAt: Date.now(), status: 'nouveau', type: null, ploxion_id: null, kind: 'link'
|
||||||
|
});
|
||||||
|
STATE.items.unshift(it); added++;
|
||||||
|
if (url) enrichTitle(it);
|
||||||
|
});
|
||||||
|
persist(); render();
|
||||||
|
msg('🌀 ' + added + ' avalé' + (added > 1 ? 's' : '') + (dup ? (' · ' + dup + ' doublon' + (dup > 1 ? 's' : '')) : ''));
|
||||||
|
}
|
||||||
|
function addImages(files) {
|
||||||
|
if (!files || !files.length) return;
|
||||||
|
var arr = [].slice.call(files, 0, 40), pending = arr.length, ok = 0;
|
||||||
|
msg('🖼️ envoi de ' + pending + ' image' + (pending > 1 ? 's' : '') + '…');
|
||||||
|
arr.forEach(function (f) {
|
||||||
|
var it = ensureClassified({
|
||||||
|
id: genId(), url: '', titre: (f.name || 'capture').replace(/\.[a-z0-9]+$/i, ''),
|
||||||
|
note: '', source: 'screenshot', addedAt: Date.now(), status: 'nouveau',
|
||||||
|
type: null, ploxion_id: null, kind: 'image', file: null, thumb: null
|
||||||
|
});
|
||||||
|
try { it.thumb = URL.createObjectURL(f); } catch (e) {}
|
||||||
|
STATE.items.unshift(it);
|
||||||
|
var up = (window.jOSBoxion && window.jOSBoxion.uploadFile) ? window.jOSBoxion.uploadFile(f, 'chaoxion', f.name) : Promise.resolve(null);
|
||||||
|
up.then(function (item) {
|
||||||
|
if (item && (item.id || item.url)) {
|
||||||
|
it.file = item.id || null;
|
||||||
|
it.url = item.url || (item.id && window.jOSBoxion.fileUrl ? window.jOSBoxion.fileUrl(item.id) : it.url);
|
||||||
|
if (it.url) it.thumb = it.url;
|
||||||
|
ok++;
|
||||||
|
}
|
||||||
|
if (--pending <= 0) { persist(); render(); msg('🖼️ ' + ok + '/' + arr.length + ' sur le boxion' + (ok < arr.length ? ' (le reste en local)' : '')); }
|
||||||
|
}).catch(function () { if (--pending <= 0) { persist(); render(); } });
|
||||||
|
});
|
||||||
|
render();
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---- RENDER (dense : une ligne = un item) -------------------------------------------------
|
||||||
|
function renderStats() {
|
||||||
|
var all = merged();
|
||||||
|
var c = { tous: 0, nouveau: 0, route: 0, chaud: 0, fait: 0, doublon: 0 }, ord = 0;
|
||||||
|
all.forEach(function (v) {
|
||||||
|
var f = stFam(v.st);
|
||||||
|
c[f]++;
|
||||||
|
if (f === 'doublon') return;
|
||||||
|
c.tous++;
|
||||||
|
if (v.st !== 'nouveau' || v.tri) ord++;
|
||||||
|
});
|
||||||
|
var cells = [
|
||||||
|
{ k: 'tous', b: c.tous, l: 'total' },
|
||||||
|
{ k: 'nouveau', b: c.nouveau, l: 'à traiter' },
|
||||||
|
{ k: 'route', b: c.route, l: 'routés' },
|
||||||
|
{ k: 'chaud', b: c.chaud, l: '🔥 chauds' },
|
||||||
|
{ k: 'fait', b: c.fait, l: 'faits' }
|
||||||
|
];
|
||||||
|
if (c.doublon) cells.push({ k: 'doublon', b: c.doublon, l: 'doublons' });
|
||||||
|
statsEl.innerHTML = cells.map(function (x) {
|
||||||
|
return '<div class="stat' + (fStatus === x.k ? ' on' : '') + '" data-fstat="' + x.k + '"><b>' + x.b + '</b><small>' + x.l + '</small></div>';
|
||||||
|
}).join('');
|
||||||
|
var pct = c.tous ? Math.round((ord / c.tous) * 100) : 0;
|
||||||
|
fillEl.style.width = pct + '%';
|
||||||
|
plabEl.textContent = 'chaos → ordre · ' + pct + '%';
|
||||||
|
var doms = {}; all.forEach(function (v) { if (v.domain) doms[v.domain] = true; });
|
||||||
|
var cur = fDomain;
|
||||||
|
var opts = '<option value="tous">Tous domaines</option>';
|
||||||
|
DOMAINS.forEach(function (d) { if (doms[d.key]) opts += '<option value="' + d.key + '">' + d.icon + ' ' + esc(d.label) + '</option>'; });
|
||||||
|
fDomSel.innerHTML = opts; fDomSel.value = (cur && (cur === 'tous' || doms[cur])) ? cur : 'tous'; fDomain = fDomSel.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
function rowHtml(v, idx) {
|
||||||
|
var fam = stFam(v.st);
|
||||||
|
var open = OPEN[v.id];
|
||||||
|
var thumb = (v.kind === 'image' && v.thumb) ? '<img class="thumb" src="' + esc(v.thumb) + '" alt="">' : '<span class="ico">' + esc(v.icon || '❔') + '</span>';
|
||||||
|
var h = '<div class="row' + (fam === 'fait' || fam === 'doublon' ? ' done' : '') + '" data-row="' + esc(v.id) + '" data-idx="' + idx + '">' +
|
||||||
|
'<input type="checkbox" class="ck" data-sel' + (SEL[v.id] ? ' checked' : '') + '>' + thumb +
|
||||||
|
'<span class="ti">' + esc(v.titre) + (v.url ? ' <small>· ' + esc(v.source || hostOf(v.url)) + '</small>' : '') + '</span>' +
|
||||||
|
(v.reg ? '<span class="chip reg" data-reg="' + esc(v.reg) + '" title="ploxion du registre">▣ ' + esc(v.reg) + '</span>' : '') +
|
||||||
|
(v.aw ? '<span class="chip" title="awesome-catalog">🍽 ' + esc(v.aw_statut || '') + '</span>' : '') +
|
||||||
|
'<span class="chip dom">' + esc(v.domain ? domLabel(v.domain) : '?') + '</span>' +
|
||||||
|
'<span class="st st-' + fam + '">' + stLabel(v.st) + '</span>' +
|
||||||
|
'<span class="qa">' +
|
||||||
|
'<button data-act="digestion" title="→ digestion">🍽</button>' +
|
||||||
|
'<button data-act="chaud" title="garder au chaud" class="xtra">🔥</button>' +
|
||||||
|
'<button data-act="archive" title="archiver">📦</button>' +
|
||||||
|
'</span>' +
|
||||||
|
'</div>';
|
||||||
|
if (open) {
|
||||||
|
var domOpts = '<option value="">— domaine —</option>' + DOMAINS.map(function (d) {
|
||||||
|
return '<option value="' + d.key + '"' + (v.domain === d.key ? ' selected' : '') + '>' + d.icon + ' ' + esc(d.label) + '</option>';
|
||||||
|
}).join('');
|
||||||
|
h += '<div class="det on" data-det="' + esc(v.id) + '">' +
|
||||||
|
'<div class="note">' +
|
||||||
|
(v.url ? '<a href="' + esc(v.url) + '" target="_blank" rel="noopener">' + esc(v.url) + '</a><br>' : '') +
|
||||||
|
esc(v.note || '') +
|
||||||
|
(v.dup_of ? '<br>≡ doublon de ' + esc(v.dup_of) : '') +
|
||||||
|
(v.aw ? '<br>🍽 lié au catalog : ' + esc(v.aw) + ' (' + esc(v.aw_statut || '?') + ')' : '') +
|
||||||
|
'</div>' +
|
||||||
|
'<div class="routes">' +
|
||||||
|
'<button class="pri" data-act="digestion">🍽 → digestion</button>' +
|
||||||
|
'<button data-act="mission">🎯 → mission</button>' +
|
||||||
|
'<button data-act="atelier">🛠 → atelier</button>' +
|
||||||
|
'<button data-act="idea">💡 → idée</button>' +
|
||||||
|
'<button class="warn" data-act="chaud">🔥 garder au chaud</button>' +
|
||||||
|
'<button data-act="archive">📦 archiver</button>' +
|
||||||
|
'<button class="ok" data-act="fait">✓ fait</button>' +
|
||||||
|
(v.real ? '<button data-act="del">🗑</button>' : '') +
|
||||||
|
'</div>' +
|
||||||
|
'<div class="edit">' +
|
||||||
|
'<select data-e-dom>' + domOpts + '</select>' +
|
||||||
|
'<select data-e-type><option value="ploxion"' + (v.type !== 'bion' ? ' selected' : '') + '>ploxion</option><option value="bion"' + (v.type === 'bion' ? ' selected' : '') + '>bion</option></select>' +
|
||||||
|
'<input type="text" data-e-pid value="' + esc(v.ploxion_id || '') + '" placeholder="ploxion_id">' +
|
||||||
|
'<button data-act="save">ok</button>' +
|
||||||
|
'</div>' +
|
||||||
|
'</div>';
|
||||||
|
}
|
||||||
|
return h;
|
||||||
|
}
|
||||||
|
|
||||||
|
var VIEW = []; // la liste rendue (ordre courant, pour le shift-select)
|
||||||
|
function render() {
|
||||||
|
renderStats();
|
||||||
|
var all = merged(), ql = q.toLowerCase();
|
||||||
|
VIEW = all.filter(function (v) {
|
||||||
|
var fam = stFam(v.st);
|
||||||
|
if (fStatus === 'tous') { if (fam === 'doublon') return false; }
|
||||||
|
else if (fam !== fStatus) return false;
|
||||||
|
if (fDomain !== 'tous' && v.domain !== fDomain) return false;
|
||||||
|
if (ql) {
|
||||||
|
var hay = (v.titre + ' ' + v.url + ' ' + v.note + ' ' + v.source + ' ' + (v.ploxion_id || '') + ' ' + (v.reg || '')).toLowerCase();
|
||||||
|
if (hay.indexOf(ql) < 0) return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
if (!VIEW.length) {
|
||||||
|
listEl.innerHTML = '<div class="empty">' + (all.length
|
||||||
|
? 'Rien avec ce filtre.'
|
||||||
|
: 'Le bion est vide. Colle des liens, dépose des captures, ou note une idée — la machine avale le chaos.') + '</div>';
|
||||||
|
} else {
|
||||||
|
listEl.innerHTML = VIEW.map(function (v, i) { return rowHtml(v, i); }).join('');
|
||||||
|
}
|
||||||
|
var n = Object.keys(SEL).length;
|
||||||
|
selbar.classList.toggle('on', n > 0);
|
||||||
|
selcount.textContent = n + ' sélectionné' + (n > 1 ? 's' : '');
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---- WIRING -------------------------------------------------------------------------------
|
||||||
|
R.querySelector('[data-tgl]').onclick = function () {
|
||||||
|
R.classList.toggle('intake-open');
|
||||||
|
this.textContent = R.classList.contains('intake-open') ? '× fermer' : '+ ajouter';
|
||||||
|
};
|
||||||
|
R.querySelector('[data-ordonner]').onclick = function () { ordonner(); };
|
||||||
|
R.querySelector('[data-add-links]').onclick = function () {
|
||||||
|
var ta = R.querySelector('[data-links]'); addLinks(ta.value); ta.value = '';
|
||||||
|
};
|
||||||
|
R.querySelector('[data-add-note]').onclick = function () {
|
||||||
|
var u = R.querySelector('[data-n-url]').value.trim(), n = R.querySelector('[data-n-note]').value.trim();
|
||||||
|
if (!u && !n) { msg('rien à ajouter.'); return; }
|
||||||
|
addLinks((u ? u + ' — ' : '') + n);
|
||||||
|
R.querySelector('[data-n-url]').value = ''; R.querySelector('[data-n-note]').value = '';
|
||||||
|
};
|
||||||
|
var fileInput = R.querySelector('[data-file]');
|
||||||
|
R.querySelector('[data-pick]').onclick = function () { fileInput.click(); };
|
||||||
|
fileInput.onchange = function () { addImages(fileInput.files); fileInput.value = ''; };
|
||||||
|
var drop = R.querySelector('[data-drop]');
|
||||||
|
drop.addEventListener('dragover', function (e) { e.preventDefault(); e.stopPropagation(); drop.style.borderColor = 'var(--xr-accent,#3fe0d0)'; });
|
||||||
|
drop.addEventListener('dragleave', function () { drop.style.borderColor = ''; });
|
||||||
|
drop.addEventListener('drop', function (e) {
|
||||||
|
e.preventDefault(); e.stopPropagation(); drop.style.borderColor = '';
|
||||||
|
if (e.dataTransfer && e.dataTransfer.files && e.dataTransfer.files.length) addImages(e.dataTransfer.files);
|
||||||
|
});
|
||||||
|
R.querySelectorAll('.tab').forEach(function (b) {
|
||||||
|
b.onclick = function () {
|
||||||
|
var tab = b.getAttribute('data-tab');
|
||||||
|
R.querySelectorAll('.tab').forEach(function (x) { x.classList.toggle('on', x === b); });
|
||||||
|
R.querySelectorAll('.pane').forEach(function (p) { p.classList.toggle('on', p.getAttribute('data-pane') === tab); });
|
||||||
|
};
|
||||||
|
});
|
||||||
|
R.querySelector('[data-f-status]').onchange = function () { fStatus = this.value; render(); };
|
||||||
|
fDomSel.onchange = function () { fDomain = this.value; render(); };
|
||||||
|
R.querySelector('[data-search]').oninput = function () { q = this.value.trim(); render(); };
|
||||||
|
statsEl.addEventListener('click', function (e) {
|
||||||
|
var s = e.target.closest('[data-fstat]'); if (!s) return;
|
||||||
|
fStatus = s.getAttribute('data-fstat');
|
||||||
|
var sel = R.querySelector('[data-f-status]');
|
||||||
|
sel.value = (fStatus === 'tous' || fStatus === 'nouveau' || fStatus === 'route' || fStatus === 'chaud' || fStatus === 'fait' || fStatus === 'doublon') ? fStatus : 'tous';
|
||||||
|
render();
|
||||||
|
});
|
||||||
|
// sélection multiple : archivage/statut EN MASSE
|
||||||
|
selbar.addEventListener('click', function (e) {
|
||||||
|
var b = e.target.closest('[data-mass]');
|
||||||
|
if (b) {
|
||||||
|
var st = b.getAttribute('data-mass'), n = 0;
|
||||||
|
Object.keys(SEL).forEach(function (id) { patch(id, { status: st }); n++; });
|
||||||
|
SEL = {}; persist(); render();
|
||||||
|
msg('⚡ ' + n + ' item' + (n > 1 ? 's' : '') + ' → ' + stLabel(st));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (e.target.closest('[data-selnone]')) { SEL = {}; render(); }
|
||||||
|
});
|
||||||
|
listEl.addEventListener('click', function (e) {
|
||||||
|
var regChip = e.target.closest('[data-reg]');
|
||||||
|
if (regChip) {
|
||||||
|
e.stopPropagation();
|
||||||
|
try { if (window.jOS && window.jOS.openPloxion) { window.jOS.openPloxion(regChip.getAttribute('data-reg')); return; } } catch (x) {}
|
||||||
|
try { location.href = '/px/' + encodeURIComponent(regChip.getAttribute('data-reg')); } catch (x) {}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var row = e.target.closest('[data-row]');
|
||||||
|
var det = e.target.closest('[data-det]');
|
||||||
|
var id = row ? row.getAttribute('data-row') : (det ? det.getAttribute('data-det') : null);
|
||||||
|
if (!id) return;
|
||||||
|
if (e.target.closest('[data-sel]')) {
|
||||||
|
var idx = row ? +row.getAttribute('data-idx') : -1;
|
||||||
|
if (e.shiftKey && lastIdx >= 0 && idx >= 0) {
|
||||||
|
var a = Math.min(lastIdx, idx), b2 = Math.max(lastIdx, idx);
|
||||||
|
for (var i = a; i <= b2; i++) { if (VIEW[i]) SEL[VIEW[i].id] = true; }
|
||||||
|
} else if (SEL[id]) delete SEL[id];
|
||||||
|
else SEL[id] = true;
|
||||||
|
if (idx >= 0) lastIdx = idx;
|
||||||
|
render();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var btn = e.target.closest('[data-act]');
|
||||||
|
if (btn) {
|
||||||
|
var act = btn.getAttribute('data-act');
|
||||||
|
if (act === 'digestion') return routeDigestion(id);
|
||||||
|
if (act === 'mission') return routeMission(id);
|
||||||
|
if (act === 'atelier') return routeAtelier(id);
|
||||||
|
if (act === 'idea') return toIdea(id);
|
||||||
|
if (act === 'chaud' || act === 'archive' || act === 'fait') { patch(id, { status: act }); persist(); render(); return; }
|
||||||
|
if (act === 'del') { STATE.items = STATE.items.filter(function (x) { return x.id !== id; }); persist(); render(); return; }
|
||||||
|
if (act === 'save') {
|
||||||
|
var box = det || listEl.querySelector('[data-det="' + id.replace(/"/g, '') + '"]'); if (!box) return;
|
||||||
|
return applyEdit(id, box.querySelector('[data-e-dom]').value, box.querySelector('[data-e-type]').value, box.querySelector('[data-e-pid]').value.trim());
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (e.target.closest('a,select,input')) return;
|
||||||
|
if (row) { OPEN[id] = !OPEN[id]; render(); }
|
||||||
|
});
|
||||||
|
// l'entrée par BUS : n'importe quel ploxion peut nourrir le chaos
|
||||||
|
try {
|
||||||
|
if (window.jOSPorts && window.jOSPorts.on) {
|
||||||
|
busOff = window.jOSPorts.on('chaoxion', 'avaler', function (p) {
|
||||||
|
if (!alive || !p) return;
|
||||||
|
addLinks(typeof p === 'string' ? p : ((p.url || '') + (p.note || p.text ? ' — ' + (p.note || p.text) : '')));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} catch (e) {}
|
||||||
|
|
||||||
|
loadState();
|
||||||
|
loadScout();
|
||||||
|
loadSisters();
|
||||||
|
render();
|
||||||
|
persist(); // pose le snapshot pour describe() dès le premier mount
|
||||||
|
|
||||||
|
return { unmount: function () {
|
||||||
|
alive = false;
|
||||||
|
try { if (typeof busOff === 'function') busOff(); else if (busOff && busOff.off) busOff.off(); } catch (e) {}
|
||||||
|
try { STATE.items.forEach(function (it) { if (it.kind === 'image' && it.thumb && it.thumb.indexOf('blob:') === 0) URL.revokeObjectURL(it.thumb); }); } catch (e) {}
|
||||||
|
container.innerHTML = '';
|
||||||
|
} };
|
||||||
|
}
|
||||||
|
|
||||||
|
// ===== XUI (contrat v0) : describe() PUR, marche NON MONTÉ — lit le snapshot persisté
|
||||||
|
// (localStorage jos:chaoxion, écrit par le mount), jamais le DOM. Ne lève jamais. =====
|
||||||
|
function describe() {
|
||||||
|
try {
|
||||||
|
var o = null;
|
||||||
|
try { o = JSON.parse(localStorage.getItem(LS) || 'null'); } catch (e0) {}
|
||||||
|
var snap = o && o.snapshot;
|
||||||
|
var items = [];
|
||||||
|
if (snap && typeof snap.total === 'number') {
|
||||||
|
items.push({ p: 1, kind: 'stat', label: '🌀 chaos', value: snap.total + ' items · ' + (snap.pct || 0) + '% ordonné' });
|
||||||
|
if (snap.oldest && snap.oldest.length)
|
||||||
|
items.push({ p: 2, kind: 'list', label: 'les plus vieux à traiter', items: snap.oldest.slice(0, 3).map(function (t) { return { label: String(t).slice(0, 40) }; }) });
|
||||||
|
} else {
|
||||||
|
// rétro-compat : pas encore de snapshot → on lit les items bruts
|
||||||
|
var its = (o && Array.isArray(o.items)) ? o.items : [];
|
||||||
|
var n = 0; its.forEach(function (it) { if (!it.status || it.status === 'nouveau') n++; });
|
||||||
|
items.push({ p: 1, kind: 'stat', label: '🌀 chaos', value: its.length ? (its.length + ' items · ' + n + ' à traiter') : 'inbox vide' });
|
||||||
|
var old3 = its.slice().sort(function (a, b) { return (a.addedAt || 0) - (b.addedAt || 0); }).slice(0, 3);
|
||||||
|
if (old3.length) items.push({ p: 2, kind: 'list', label: 'les plus vieux', items: old3.map(function (it) { return { label: String(it.titre || it.url || '?').slice(0, 40) }; }) });
|
||||||
|
}
|
||||||
|
items.push({ p: 4, kind: 'text', label: '⚙ ordonner le chaos : dédup + digestion + registre + domaines — zéro LLM' });
|
||||||
|
return { v: 1, id: ID, title: 'Chaoxion', icon: '🌀', items: items };
|
||||||
|
} catch (e) {
|
||||||
|
return { v: 1, id: ID, title: 'Chaoxion', icon: '🌀', items: [{ p: 1, kind: 'text', label: 'Chaoxion — l\'usine à ordonner le chaos' }] };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
window.jOSApps = window.jOSApps || {};
|
||||||
|
window.jOSApps[ID] = { manifest: { id: ID, name: 'Chaoxion', icon: '🌀' }, mount: mount, describe: describe };
|
||||||
|
})();
|
||||||
|
</script>
|
||||||
Loading…
Reference in New Issue
Block a user