Revert "turnero: fallback a puerto 8080 si SigWeb no responde en 47289"
This reverts commit 3d035d3699.
This commit is contained in:
@@ -2528,11 +2528,9 @@ document.querySelectorAll('.turnero-firma-item').forEach(function(widget) {
|
|||||||
<script>
|
<script>
|
||||||
// ── Topaz SigWeb ────────────────────────────────────────────────────
|
// ── Topaz SigWeb ────────────────────────────────────────────────────
|
||||||
const topaz = (() => {
|
const topaz = (() => {
|
||||||
const SIGWEB_URLS = [
|
const SIGWEB_URL = 'http://localhost:47289/SigWeb/SigWebTablet.js';
|
||||||
'http://localhost:47289/SigWeb/SigWebTablet.js',
|
|
||||||
'http://localhost:8080/SigWeb/SigWebTablet.js',
|
|
||||||
];
|
|
||||||
let _loaded = false, _ctx = null, _target = null, _poll = null;
|
let _loaded = false, _ctx = null, _target = null, _poll = null;
|
||||||
|
// _target: { type: 'turnero'|'pro', canvas: CanvasElement, onAccept: fn }
|
||||||
|
|
||||||
function _call(fn, ...args) {
|
function _call(fn, ...args) {
|
||||||
if (_ctx && typeof _ctx[fn] === 'function') return _ctx[fn](...args);
|
if (_ctx && typeof _ctx[fn] === 'function') return _ctx[fn](...args);
|
||||||
@@ -2541,20 +2539,15 @@ const topaz = (() => {
|
|||||||
throw new Error('SigWeb: ' + fn + ' no encontrado');
|
throw new Error('SigWeb: ' + fn + ' no encontrado');
|
||||||
}
|
}
|
||||||
|
|
||||||
function _tryLoad(urls) {
|
|
||||||
if (!urls.length) return Promise.resolve(false);
|
|
||||||
return new Promise(res => {
|
|
||||||
const s = document.createElement('script');
|
|
||||||
s.src = urls[0];
|
|
||||||
s.onload = () => { _loaded = true; res(true); };
|
|
||||||
s.onerror = () => _tryLoad(urls.slice(1)).then(res);
|
|
||||||
document.head.appendChild(s);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function _loadScript() {
|
function _loadScript() {
|
||||||
if (_loaded) return Promise.resolve(true);
|
if (_loaded) return Promise.resolve(true);
|
||||||
return _tryLoad(SIGWEB_URLS);
|
return new Promise(res => {
|
||||||
|
const s = document.createElement('script');
|
||||||
|
s.src = SIGWEB_URL;
|
||||||
|
s.onload = () => { _loaded = true; res(true); };
|
||||||
|
s.onerror = () => res(false);
|
||||||
|
document.head.appendChild(s);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Detectar disponibilidad al cargar; ocultar botones si no hay pad
|
// Detectar disponibilidad al cargar; ocultar botones si no hay pad
|
||||||
|
|||||||
Reference in New Issue
Block a user