forked from FroSteel/Planification
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6ae440cbf1 | |||
| f6d549d522 |
+32
-3
@@ -85,7 +85,7 @@ async function fetchPlanningXml(origin, phpsessid, unixDate) {
|
||||
`&day_start_hour=8` +
|
||||
`&day_end_hour=19`;
|
||||
console.log("[bg] fetchPlanningXml →", url.substring(0, 140));
|
||||
const r = await fetch(url, { credentials: "include" });
|
||||
const r = await evFetch(url, origin);
|
||||
console.log("[bg] status =", r.status);
|
||||
if (!r.ok) {
|
||||
// v4.2 : classifier l'erreur HTTP pour que le viewer affiche le bon
|
||||
@@ -100,6 +100,32 @@ async function fetchPlanningXml(origin, phpsessid, unixDate) {
|
||||
return xml;
|
||||
}
|
||||
|
||||
/**
|
||||
* v5.0.9 : wrapper autour de fetch() qui ajoute systématiquement les
|
||||
* headers de sécurité attendus par EasyVista (Referer, Sec-Fetch-Site,
|
||||
* X-Requested-With). Sans ces headers, EV renvoie soit un <script> de
|
||||
* redirection (CSRF check), soit une page de login, même avec une session
|
||||
* valide.
|
||||
*
|
||||
* Observé dans les captures réseau du navigateur :
|
||||
* Referer: https://itsma.etat-de-vaud.ch/index.php?eventName=HelpDesk_PlanningItem
|
||||
* Sec-Fetch-Site: same-origin
|
||||
* X-Requested-With: XMLHttpRequest (parfois)
|
||||
*
|
||||
* @param {string} url - URL complète à fetcher
|
||||
* @param {string} origin - origine EasyVista (pour construire le Referer)
|
||||
* @param {object} [opts] - options fetch (method, body, headers supplémentaires)
|
||||
*/
|
||||
async function evFetch(url, origin, opts = {}) {
|
||||
const defaultHeaders = {
|
||||
"Referer": `${origin}/index.php?eventName=HelpDesk_PlanningItem`,
|
||||
"X-Requested-With": "XMLHttpRequest"
|
||||
};
|
||||
const headers = Object.assign({}, defaultHeaders, opts.headers || {});
|
||||
const fetchOpts = Object.assign({ credentials: "include" }, opts, { headers });
|
||||
return await fetch(url, fetchOpts);
|
||||
}
|
||||
|
||||
/**
|
||||
* v4.2 : classifie un statut HTTP comme "session_expired" ou "ev_unreachable".
|
||||
* - 401, 403, 404 → session_expired (EV renvoie souvent 404 au lieu de rediriger
|
||||
@@ -118,7 +144,7 @@ function classifyHttpStatus(status) {
|
||||
*/
|
||||
async function fetchXhr2(origin, phpsessid, actionId) {
|
||||
const url = `${origin}/planning_xhr_2.php?PHPSESSID=${encodeURIComponent(phpsessid)}&id=${encodeURIComponent(actionId)}`;
|
||||
const r = await fetch(url, { credentials: "include" });
|
||||
const r = await evFetch(url, origin);
|
||||
if (!r.ok) {
|
||||
const err = new Error("HTTP " + r.status);
|
||||
err.kind = classifyHttpStatus(r.status);
|
||||
@@ -131,7 +157,7 @@ async function fetchXhr2(origin, phpsessid, actionId) {
|
||||
async function fetchFicheHtml(origin, phpsessid, formLink) {
|
||||
const url = `${origin}/index.php?${formLink}&PHPSESSID=${encodeURIComponent(phpsessid)}`;
|
||||
console.log("[bg] fetchFicheHtml →", url.substring(0, 120));
|
||||
const r = await fetch(url, { credentials: "include" });
|
||||
const r = await evFetch(url, origin);
|
||||
if (!r.ok) {
|
||||
const err = new Error("HTTP " + r.status);
|
||||
err.kind = classifyHttpStatus(r.status);
|
||||
@@ -140,6 +166,9 @@ async function fetchFicheHtml(origin, phpsessid, formLink) {
|
||||
}
|
||||
const html = await r.text();
|
||||
console.log("[bg] fiche status =", r.status, "| taille =", html.length);
|
||||
if (html.length < 500) {
|
||||
console.warn("[bg] ⚠ fiche très courte, contenu =", JSON.stringify(html));
|
||||
}
|
||||
return html;
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"manifest_version": 3,
|
||||
"name": "Planification",
|
||||
"version": "4.2.8",
|
||||
"description": "Vue claire du planning EasyVista (itsma.etat-de-vaud.ch et itsma.vd.ch). v4.2.8 : liste de techniciens dans les modals Absence/Douchette entièrement visible sans scroll. Inclut v4.2.7 (URL exacte douchette).",
|
||||
"version": "5.0.0",
|
||||
"description": "Vue claire du planning EasyVista (itsma.etat-de-vaud.ch et itsma.vd.ch). v4.3.0 : (1) conflits horaires entre interventions d'un même tech affichés en rouge + ⚠. (2) Réservations disparues retirées directement (pas de re-fetch inutile). (3) Popups épinglés détachés : plusieurs peuvent coexister, ancrés au contenu (scrollent avec la page), auto-positionnés sans se marcher dessus (toast si pas de place), Échap pour tout fermer, Ctrl×2 pour fermer si un seul épinglé. Inclut v4.2.9.",
|
||||
"permissions": [
|
||||
"activeTab",
|
||||
"scripting",
|
||||
|
||||
+99
-6
@@ -262,7 +262,7 @@ html, body {
|
||||
background: rgba(255,255,255,0.15);
|
||||
}
|
||||
|
||||
/* Barre de progression pendant le rafraîchissement — v4.1.12 : texte
|
||||
/* Barre de progression pendant le rafraichissement — v4.1.12 : texte
|
||||
toujours lisible, que la zone verte l'ait atteint ou non (utilise
|
||||
mix-blend-mode:difference pour inverser la couleur du texte là où la
|
||||
barre verte est dessous). */
|
||||
@@ -438,7 +438,7 @@ html, body {
|
||||
opacity: 0.9;
|
||||
}
|
||||
|
||||
/* Bouton "Arrêter" (apparaît pendant un refresh manuel) */
|
||||
/* Bouton "Arrêter" (apparaît pdt un refresh manuel) */
|
||||
.btn-abort {
|
||||
background: var(--danger-soft);
|
||||
color: var(--danger);
|
||||
@@ -909,10 +909,9 @@ html, body {
|
||||
to { transform: rotate(360deg); }
|
||||
}
|
||||
|
||||
.intervention-v2.is-ghost {
|
||||
opacity: 0.5;
|
||||
text-decoration: line-through;
|
||||
}
|
||||
/* .intervention-v2.is-ghost : retirée en v4.3.3 — on ne barre plus les
|
||||
cartes. La gestion des tickets disparus se fait via _disappearStatus
|
||||
(vert ✓/✓✓) ou _disappearRemove (retrait total). */
|
||||
|
||||
/* Ligne 1 : REF en titre centré gros gras */
|
||||
.iv-ref-header {
|
||||
@@ -1751,3 +1750,97 @@ html, body {
|
||||
.modal-actions.horizontal .btn {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
/* ─────────────────────────────────────────────────────────────────────────
|
||||
v4.2.9 : blocage du scroll arrière quand une modal est ouverte.
|
||||
La classe body.modal-open est ajoutée/retirée automatiquement par
|
||||
initModalScrollLock() dans viewer.js dès qu'un .modal-overlay existe.
|
||||
───────────────────────────────────────────────────────────────────────── */
|
||||
body.modal-open {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
/* v4.2.9 : pied de page discret en bas à droite — affiche auteur + date + version */
|
||||
.app-footer {
|
||||
position: fixed;
|
||||
right: 8px;
|
||||
bottom: 4px;
|
||||
font-size: 10px;
|
||||
color: var(--text-faint, #8892a0);
|
||||
opacity: 0.55;
|
||||
pointer-events: none; /* ne capture pas les clics */
|
||||
user-select: none;
|
||||
font-variant-numeric: tabular-nums;
|
||||
letter-spacing: 0.2px;
|
||||
z-index: 1; /* sous les modals (qui sont à 10000) */
|
||||
}
|
||||
.app-footer:hover {
|
||||
opacity: 0.85;
|
||||
}
|
||||
|
||||
/* ─────────────────────────────────────────────────────────────────────────
|
||||
v4.3.0 : conflit d'horaire entre 2 interventions d'un même tech.
|
||||
Les heures s'affichent en rouge + icône ⚠ à côté.
|
||||
───────────────────────────────────────────────────────────────────────── */
|
||||
.iv-time-vertical.iv-time-overlap .iv-time-start,
|
||||
.iv-time-vertical.iv-time-overlap .iv-time-end,
|
||||
.iv-time-vertical.iv-time-overlap .iv-time-arrow {
|
||||
color: var(--danger, #b03030) !important;
|
||||
font-weight: 700;
|
||||
}
|
||||
.iv-time-overlap-warn {
|
||||
color: var(--danger, #b03030);
|
||||
font-size: 14px;
|
||||
font-weight: 700;
|
||||
line-height: 1;
|
||||
margin-top: 2px;
|
||||
cursor: help;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/* ─────────────────────────────────────────────────────────────────────────
|
||||
v4.3.0 : popups épinglés détachés
|
||||
Ancrés au contenu (position:absolute coord document) → scrollent avec
|
||||
la page. Persistent jusqu'à fermeture explicite.
|
||||
───────────────────────────────────────────────────────────────────────── */
|
||||
.tooltip.pinned-popup {
|
||||
position: absolute !important; /* override le fixed du .tooltip */
|
||||
/* v4.3.3 corr : les popups épinglées doivent passer DERRIÈRE la topbar
|
||||
quand on scrolle (topbar sticky z-index 10). Donc on met 5 : au-dessus
|
||||
du contenu normal, mais sous la topbar / bannières / modals. */
|
||||
z-index: 5 !important;
|
||||
opacity: 1 !important;
|
||||
pointer-events: auto !important;
|
||||
/* Bordure plus visible pour distinguer du tooltip live */
|
||||
border: 2px solid var(--accent, #0f4f8b);
|
||||
box-shadow: 0 8px 24px rgba(0,0,0,0.18);
|
||||
/* Pas de contain: layout (hérité) car ça limite le rendu ; on laisse */
|
||||
animation: pinned-popup-in 0.15s ease-out;
|
||||
}
|
||||
@keyframes pinned-popup-in {
|
||||
from { opacity: 0; transform: scale(0.96); }
|
||||
to { opacity: 1; transform: scale(1); }
|
||||
}
|
||||
|
||||
/* Bouton × de fermeture du popup épinglé */
|
||||
.pinned-popup-close {
|
||||
position: absolute;
|
||||
top: 4px;
|
||||
right: 6px;
|
||||
width: 22px;
|
||||
height: 22px;
|
||||
padding: 0;
|
||||
line-height: 1;
|
||||
font-size: 18px;
|
||||
font-weight: 400;
|
||||
color: var(--text-muted, #888);
|
||||
background: transparent;
|
||||
border: none;
|
||||
border-radius: 4px;
|
||||
cursor: pointer;
|
||||
transition: background 0.1s, color 0.1s;
|
||||
}
|
||||
.pinned-popup-close:hover {
|
||||
background: var(--danger-soft, #fbe6e6);
|
||||
color: var(--danger, #b03030);
|
||||
}
|
||||
|
||||
+1
-1
@@ -13,7 +13,7 @@
|
||||
<button id="user-badge" class="user-badge hidden"
|
||||
type="button" aria-label="Utilisateur connecté"
|
||||
title="Utilisateur connecté"></button>
|
||||
<h1>Planification</h1>
|
||||
<h1 id="app-title">Planification</h1>
|
||||
<div class="date-nav">
|
||||
<button id="nav-prev" class="btn btn-nav" title="Jour précédent" aria-label="Jour précédent">◀</button>
|
||||
<input type="date" id="date-picker" class="date-input">
|
||||
|
||||
Reference in New Issue
Block a user