synchro du labo (0bf0da65) : app.blade.php, README.md
This commit is contained in:
22
README.md
22
README.md
@@ -1,3 +1,21 @@
|
|||||||
# ploxion-mapper
|
# 🎚 Mapper
|
||||||
|
|
||||||
PLOXION · Mapper n'importe quel bouton (clavier, manette, bientôt lumière/IR/MIDI) à n'importe quelle action — tout est une télécommande. · fournit: input-mapping, gamepad, universal-remote
|
Mapper n'importe quel bouton (clavier, manette, bientôt lumière/IR/MIDI) à n'importe quelle action — tout est une télécommande.
|
||||||
|
|
||||||
|
| | |
|
||||||
|
| --- | --- |
|
||||||
|
| id | `mapper` |
|
||||||
|
| fournit | `input-mapping` `gamepad` `universal-remote` |
|
||||||
|
| bions qu'il nomme | `jOSApps` `jOSMobile` |
|
||||||
|
| fichiers | `app.blade.php` |
|
||||||
|
| dans le labo | `resources/views/ploxions/mapper/` (dépôt `my_website2`) |
|
||||||
|
|
||||||
|
## Contribuer
|
||||||
|
|
||||||
|
- **Dans le xer** : https://labo.j0bot.ch/px/atelier?ploxion=mapper — prends-le, modifie-le, vois-le tourner, « ⧗ envoyer le tsoin ».
|
||||||
|
- **Dans VS Code** : `xb prendre mapper` (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
|
||||||
|
|||||||
118
app.blade.php
Normal file
118
app.blade.php
Normal file
@@ -0,0 +1,118 @@
|
|||||||
|
{{-- PL0XI0N mapper 🎚 — « TOUT est une télécommande » (RS-7) : mappe N'IMPORTE quelle entrée (touche
|
||||||
|
clavier, bouton de MANETTE, plus tard code-lumière/IR/remote) à N'IMPORTE quelle action du xerboxion.
|
||||||
|
« Utiliser le xerboxion avec n'importe quoi. » Persiste les bindings. Zéro réseau pour l'exécution. --}}
|
||||||
|
<style>
|
||||||
|
.px-map{display:flex;flex-direction:column;height:100%;background:var(--xr-bg,#06080f);color:var(--xr-text,#e8ecf8);font-family:var(--xr-font-ui,ui-sans-serif,system-ui)}
|
||||||
|
.px-map .hd{padding:10px 12px;border-bottom:1px solid var(--xr-border,#18213f);display:flex;gap:9px;align-items:center;font-weight:700;color:var(--xr-accent,#9fd0ff)}
|
||||||
|
.px-map .hd small{margin-left:auto;color:var(--xr-muted,#6f83b8);font-weight:400;font-size:.66rem}
|
||||||
|
.px-map .src{display:flex;gap:6px;padding:8px 12px;border-bottom:1px solid var(--xr-border,#131c38);font-size:.72rem;color:var(--xr-muted,#8aa0c8);align-items:center;flex-wrap:wrap}
|
||||||
|
.px-map .src b{color:#7fd0a0}
|
||||||
|
.px-map .list{flex:1;overflow:auto;padding:10px}
|
||||||
|
.px-map .act{display:flex;gap:9px;align-items:center;padding:9px 10px;border:1px solid var(--xr-border,#1b2647);border-radius:11px;margin-bottom:7px;background:var(--xr-surface,#101a30)}
|
||||||
|
.px-map .act .nm{flex:1;min-width:0}.px-map .act .nm b{color:var(--xr-text,#cfe0ff)}.px-map .act .nm small{display:block;color:var(--xr-muted,#6f83b8);font-size:.6rem}
|
||||||
|
.px-map .bind{font-family:ui-monospace,monospace;font-size:.72rem;color:#ffe08a;background:#241f0a;border:1px solid #4a3a10;border-radius:7px;padding:5px 9px;min-width:64px;text-align:center}
|
||||||
|
.px-map .bind.none{color:#516084;background:var(--xr-surface,#0e1428);border-color:var(--xr-border,#223056)}
|
||||||
|
.px-map .act button{background:var(--xr-surface,#101a34);border:1px solid var(--xr-border,#2b3a68);color:#9fc0ff;border-radius:7px;padding:6px 9px;font-size:.7rem;cursor:pointer}
|
||||||
|
.px-map .act button.arm{border-color:#ffe08a;color:#ffe08a;animation:mp 1s infinite}@keyframes mp{50%{opacity:.5}}
|
||||||
|
.px-map .foot{padding:8px 12px;border-top:1px solid var(--xr-border,#131c38);font-size:.64rem;color:var(--xr-muted,#6f83b8);line-height:1.4}
|
||||||
|
</style>
|
||||||
|
<script>
|
||||||
|
(function () {
|
||||||
|
'use strict';
|
||||||
|
var ACTIONS = [
|
||||||
|
['open:browser', '🎛 Ploxions (browser)'], ['open:braindump', '🧠 Braindump'], ['open:chat', '💬 Coord'],
|
||||||
|
['open:space', '🚀 Space'], ['open:carte-espace', '🌌 Carte de l\'espace'], ['open:remote', '📡 Télécommande'],
|
||||||
|
['open:photion', '💡 Photion'], ['open:live', '🔴 Live'], ['open:telexion', '📮 Telexion'],
|
||||||
|
['fullscreen', '⛶ Plein écran / tiling'], ['scroll-up', '↑ Défiler haut'], ['scroll-down', '↓ Défiler bas'],
|
||||||
|
['minimize-all', '🏠 Tout réduire (/home)']
|
||||||
|
];
|
||||||
|
function describe() {
|
||||||
|
var binds = {}; try { binds = JSON.parse(localStorage.getItem('jos:mapper:binds') || '{}') || {}; } catch (e) {}
|
||||||
|
return { v: 1, id: 'mapper', title: 'Mapper', icon: '🎚', items: [
|
||||||
|
{ p: 1, kind: 'stat', label: 'raccourcis mappés', value: Object.keys(binds).length }
|
||||||
|
] };
|
||||||
|
}
|
||||||
|
function mount(container, ctx) {
|
||||||
|
container.innerHTML =
|
||||||
|
'<div class="px-map">' +
|
||||||
|
'<div class="hd">🎚 Mapper <small>tout est une télécommande</small></div>' +
|
||||||
|
'<div class="src">source : <b data-gp>manette : —</b> · appuie une touche/bouton après « bind »</div>' +
|
||||||
|
'<div class="list" data-list></div>' +
|
||||||
|
'<div class="foot">Clique <b>bind</b> puis appuie une touche clavier ou un bouton de manette → l\'action se déclenche à chaque appui. Bindings sauvés sur cet appareil. Bientôt : code-lumière (photion), IR (pont), MIDI.</div>' +
|
||||||
|
'</div>';
|
||||||
|
var root = container.querySelector('.px-map');
|
||||||
|
var listEl = root.querySelector('[data-list]');
|
||||||
|
var binds = {}; // key = "kb:KeyA" | "gp:0" → action code
|
||||||
|
try { binds = JSON.parse(localStorage.getItem('jos:mapper:binds') || '{}') || {}; } catch (e) {}
|
||||||
|
var arming = null; // action code en cours de bind
|
||||||
|
|
||||||
|
function save() { try { localStorage.setItem('jos:mapper:binds', JSON.stringify(binds)); } catch (e) {} }
|
||||||
|
function bindOf(code) { for (var k in binds) if (binds[k] === code) return k; return null; }
|
||||||
|
function label(k) { return k ? k.replace('kb:', '⌨ ').replace('gp:', '🎮 b') : 'aucun'; }
|
||||||
|
|
||||||
|
function render() {
|
||||||
|
listEl.innerHTML = '';
|
||||||
|
ACTIONS.forEach(function (a) {
|
||||||
|
var k = bindOf(a[0]);
|
||||||
|
var row = document.createElement('div'); row.className = 'act';
|
||||||
|
row.innerHTML = '<span class="nm"><b>' + a[1] + '</b><small>' + a[0] + '</small></span>' +
|
||||||
|
'<span class="bind ' + (k ? '' : 'none') + '">' + label(k) + '</span>' +
|
||||||
|
'<button data-bind="' + a[0] + '">' + (arming === a[0] ? 'appuie…' : 'bind') + '</button>' +
|
||||||
|
(k ? '<button data-clr="' + a[0] + '">✕</button>' : '');
|
||||||
|
listEl.appendChild(row);
|
||||||
|
});
|
||||||
|
listEl.querySelectorAll('[data-bind]').forEach(function (b) { b.classList.toggle('arm', arming === b.getAttribute('data-bind'));
|
||||||
|
b.onclick = function () { arming = (arming === b.getAttribute('data-bind')) ? null : b.getAttribute('data-bind'); render(); }; });
|
||||||
|
listEl.querySelectorAll('[data-clr]').forEach(function (b) { b.onclick = function () { var c = b.getAttribute('data-clr'); var kk = bindOf(c); if (kk) delete binds[kk]; save(); render(); }; });
|
||||||
|
}
|
||||||
|
|
||||||
|
function setBind(inputKey) {
|
||||||
|
if (!arming) return false;
|
||||||
|
// enlève un ancien mapping de cette entrée, puis assigne
|
||||||
|
Object.keys(binds).forEach(function (kk) { if (kk === inputKey) delete binds[kk]; });
|
||||||
|
binds[inputKey] = arming; arming = null; save(); render(); return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function exec(code) {
|
||||||
|
try {
|
||||||
|
if (code.indexOf('open:') === 0) { var id = code.slice(5); if (window.jOS && window.jOS.openPloxion) window.jOS.openPloxion(id); else if (window.jOSMobile) window.jOSMobile.open(id, id); return; }
|
||||||
|
if (code === 'fullscreen') { if (window.jOS && window.jOS.tileFull) window.jOS.tileFull(); return; }
|
||||||
|
if (code === 'scroll-up') { window.scrollBy(0, -400); return; }
|
||||||
|
if (code === 'scroll-down') { window.scrollBy(0, 400); return; }
|
||||||
|
if (code === 'minimize-all') { if (window.jOS && window.jOS.minimizeAll) window.jOS.minimizeAll(); return; }
|
||||||
|
} catch (e) {}
|
||||||
|
}
|
||||||
|
function fire(inputKey) { if (setBind(inputKey)) return; var c = binds[inputKey]; if (c) exec(c); }
|
||||||
|
|
||||||
|
// ---- clavier ----
|
||||||
|
function onKey(e) {
|
||||||
|
if (e.target && /^(INPUT|TEXTAREA|SELECT)$/.test(e.target.tagName)) return;
|
||||||
|
var ik = 'kb:' + (e.code || e.key);
|
||||||
|
if (arming || binds[ik]) { e.preventDefault(); fire(ik); }
|
||||||
|
}
|
||||||
|
window.addEventListener('keydown', onKey, true);
|
||||||
|
|
||||||
|
// ---- manette (Gamepad API) ----
|
||||||
|
var gpPrev = {}, gpRaf = null, gpEl = root.querySelector('[data-gp]');
|
||||||
|
function gpLoop() {
|
||||||
|
var pads = navigator.getGamepads ? navigator.getGamepads() : [];
|
||||||
|
var connected = 0;
|
||||||
|
for (var i = 0; i < pads.length; i++) { var p = pads[i]; if (!p) continue; connected++;
|
||||||
|
for (var b = 0; b < p.buttons.length; b++) {
|
||||||
|
var pressed = p.buttons[b].pressed, key = i + ':' + b, was = gpPrev[key];
|
||||||
|
if (pressed && !was) fire('gp:' + b);
|
||||||
|
gpPrev[key] = pressed;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
gpEl.textContent = connected ? ('manette : ' + connected + ' connectée(s)') : 'manette : —';
|
||||||
|
gpRaf = requestAnimationFrame(gpLoop);
|
||||||
|
}
|
||||||
|
gpLoop();
|
||||||
|
|
||||||
|
render();
|
||||||
|
return { unmount: function () { window.removeEventListener('keydown', onKey, true); cancelAnimationFrame(gpRaf); container.innerHTML = ''; } };
|
||||||
|
}
|
||||||
|
window.jOSApps = window.jOSApps || {};
|
||||||
|
window.jOSApps['mapper'] = { manifest: { id: 'mapper', name: 'Mapper', icon: '🎚' }, mount: mount, describe: describe };
|
||||||
|
})();
|
||||||
|
</script>
|
||||||
Reference in New Issue
Block a user