synchro du labo (0bf0da65) : app.blade.php, README.md
This commit is contained in:
63
app.blade.php
Normal file
63
app.blade.php
Normal file
@@ -0,0 +1,63 @@
|
||||
{{-- PL0XION HTML — visualiseur de pages HTML autonomes (public/x/*.html), ex : les
|
||||
pages qui explorent le concept du Kion. S'enregistre dans window.jOSApps['html'].
|
||||
Liste via GET /api/x-pages, ouvre en iframe sandboxé. Thémé --xr-*. --}}
|
||||
<script>
|
||||
(function () {
|
||||
var LIVE = null; // posé au mount : {count:function()}
|
||||
function describe() {
|
||||
var n = LIVE ? LIVE.count() : 0;
|
||||
return { v: 1, id: 'html', title: 'HTML', icon: '🌐', items: [
|
||||
{ p: 1, kind: 'stat', label: 'pages HTML', value: n }
|
||||
] };
|
||||
}
|
||||
|
||||
function mount(el) {
|
||||
el.innerHTML =
|
||||
'<style>'
|
||||
+ '.hx{display:flex;flex-direction:column;height:100%;font-family:var(--xr-font-ui,system-ui);color:var(--xr-text,#e7f0ff);background:var(--xr-bg,#0b1220)}'
|
||||
+ '.hx-bar{flex:0 0 auto;display:flex;align-items:center;gap:8px;padding:8px 11px;border-bottom:1px solid var(--xr-border,#22324f)}'
|
||||
+ '.hx-bar b{color:var(--xr-accent,#3fe0d0)}'
|
||||
+ '.hx-back{display:none;cursor:pointer;background:none;border:1px solid var(--xr-border,#22324f);color:var(--xr-text,#e7f0ff);border-radius:7px;padding:3px 9px;font:12px system-ui}'
|
||||
+ '.hx-sp{flex:1}'
|
||||
+ '.hx-grid{flex:1;min-height:0;overflow:auto;padding:12px;display:grid;gap:10px;grid-template-columns:repeat(auto-fill,minmax(150px,1fr));align-content:start}'
|
||||
+ '.hx-card{cursor:pointer;border:1px solid var(--xr-border,#22324f);border-radius:12px;padding:14px 12px;'
|
||||
+ ' background:color-mix(in srgb, var(--xr-accent,#3fe0d0) 6%, transparent);display:flex;flex-direction:column;gap:6px}'
|
||||
+ '.hx-card:hover{border-color:var(--xr-accent,#3fe0d0)}'
|
||||
+ '.hx-card .t{font-weight:600;font-size:.85rem}.hx-card .f{font-size:.66rem;opacity:.55}'
|
||||
+ '.hx-frame{flex:1;width:100%;border:0;background:#fff;display:none}'
|
||||
+ '.hx-empty{padding:2rem;text-align:center;color:var(--xr-muted,#8aa0c0)}'
|
||||
+ '</style>'
|
||||
+ '<div class="hx">'
|
||||
+ ' <div class="hx-bar"><b>🌐 HTML</b><button class="hx-back" data-back>← pages</button><span class="hx-sp"></span><span class="hx-cur" style="opacity:.6;font-size:.78rem"></span></div>'
|
||||
+ ' <div class="hx-grid" data-grid></div>'
|
||||
+ ' <iframe class="hx-frame" data-frame title="page HTML" sandbox="allow-scripts allow-popups allow-forms"></iframe>'
|
||||
+ '</div>';
|
||||
|
||||
var grid = el.querySelector('[data-grid]'), frame = el.querySelector('[data-frame]'),
|
||||
back = el.querySelector('[data-back]'), cur = el.querySelector('.hx-cur');
|
||||
var pageCount = 0;
|
||||
LIVE = { count: function () { return pageCount; } };
|
||||
|
||||
function showGrid(){ frame.style.display='none'; frame.src='about:blank'; grid.style.display='grid'; back.style.display='none'; cur.textContent=''; }
|
||||
function showPage(p){ grid.style.display='none'; frame.src=p.url; frame.style.display='block'; back.style.display=''; cur.textContent=p.title; }
|
||||
back.addEventListener('click', showGrid);
|
||||
|
||||
fetch('{{ url('/api/x-pages') }}', {headers:{'Accept':'application/json'}})
|
||||
.then(function(r){ return r.json(); })
|
||||
.then(function(pages){
|
||||
pageCount=pages.length; if(!pages.length){ grid.innerHTML='<div class="hx-empty">Aucune page HTML.<br>Dépose un .html dans <code>public/x/</code>.</div>'; return; }
|
||||
pages.forEach(function(p){
|
||||
var c=document.createElement('div'); c.className='hx-card';
|
||||
c.innerHTML='<span class="t"></span><span class="f"></span>';
|
||||
c.querySelector('.t').textContent=p.title; c.querySelector('.f').textContent=p.file;
|
||||
c.addEventListener('click', function(){ showPage(p); });
|
||||
grid.appendChild(c);
|
||||
});
|
||||
})
|
||||
.catch(function(){ grid.innerHTML='<div class="hx-empty">Liste indisponible.</div>'; });
|
||||
}
|
||||
|
||||
window.jOSApps = window.jOSApps || {};
|
||||
window.jOSApps['html'] = { manifest: { id:'html', name:'HTML', icon:'🌐' }, mount: mount, describe: describe };
|
||||
})();
|
||||
</script>
|
||||
Reference in New Issue
Block a user