extract window.uid() to separate file, update shots.js and script tags to v=7
CI / Build Native (push) Successful in 7m10s
CI / Build Native (push) Successful in 7m10s
This commit is contained in:
@@ -1,9 +1,6 @@
|
||||
window.shots = {
|
||||
generateUid() {
|
||||
if (typeof crypto !== 'undefined' && typeof crypto.randomUUID === 'function') {
|
||||
return crypto.randomUUID();
|
||||
}
|
||||
return Date.now().toString(36) + '-' + Math.random().toString(36).slice(2, 10);
|
||||
return window.uid();
|
||||
},
|
||||
WEIGHTS: {
|
||||
Soulshot: { D: 3, C: 3, B: 2, A: 2, S: 2 },
|
||||
@@ -84,7 +81,7 @@ window.shots = {
|
||||
const grado = m[2].toUpperCase();
|
||||
const cantidad = parseInt(m[3].replace(/[.,]/g, ''), 10);
|
||||
if (!this.WEIGHTS[tipo]?.[grado]) continue;
|
||||
parsed.push({ uid: this.generateUid(), tipo, grado, cantidad });
|
||||
parsed.push({ uid: window.uid(), tipo, grado, cantidad });
|
||||
}
|
||||
return parsed;
|
||||
},
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
window.uid = function () {
|
||||
if (typeof crypto !== 'undefined' && typeof crypto.randomUUID === 'function') {
|
||||
return crypto.randomUUID();
|
||||
}
|
||||
return Date.now().toString(36) + '-' + Math.random().toString(36).slice(2, 10);
|
||||
};
|
||||
@@ -205,6 +205,7 @@
|
||||
|
||||
<script src="/static/js/defaults.js?v=7"></script>
|
||||
<script src="/static/js/api.js?v=7"></script>
|
||||
<script src="/static/js/uid.js?v=7"></script>
|
||||
<script src="/static/js/shots.js?v=7"></script>
|
||||
<script src="/static/js/app.js?v=7"></script>
|
||||
<script defer src="/static/js/alpine.min.js?v=7"></script>
|
||||
|
||||
@@ -227,11 +227,12 @@
|
||||
</p>
|
||||
</footer>
|
||||
|
||||
<script src="/static/js/defaults.js?v=6"></script>
|
||||
<script src="/static/js/api.js?v=6"></script>
|
||||
<script src="/static/js/shots.js?v=6"></script>
|
||||
<script src="/static/js/app.js?v=6"></script>
|
||||
<script defer src="/static/js/alpine.min.js?v=6"></script>
|
||||
<script src="/static/js/defaults.js?v=7"></script>
|
||||
<script src="/static/js/api.js?v=7"></script>
|
||||
<script src="/static/js/uid.js?v=7"></script>
|
||||
<script src="/static/js/shots.js?v=7"></script>
|
||||
<script src="/static/js/app.js?v=7"></script>
|
||||
<script defer src="/static/js/alpine.min.js?v=7"></script>
|
||||
|
||||
<script>
|
||||
document.addEventListener('alpine:init', () => {
|
||||
@@ -265,8 +266,13 @@
|
||||
},
|
||||
|
||||
async init() {
|
||||
if (!window.shots || !window.uid) {
|
||||
this.error = 'Error cargando utilidades de la pagina (shots/uid). Recarga con Ctrl+Shift+R.';
|
||||
return;
|
||||
}
|
||||
await Promise.all([this.loadSales(), this.loadCharacters()]);
|
||||
document.addEventListener('visibilitychange', this.visibilityHandler);
|
||||
this._boundVisibility = this.visibilityHandler.bind(this);
|
||||
document.addEventListener('visibilitychange', this._boundVisibility);
|
||||
this.tick();
|
||||
},
|
||||
|
||||
@@ -283,7 +289,7 @@
|
||||
},
|
||||
|
||||
destroy() {
|
||||
document.removeEventListener('visibilitychange', this.visibilityHandler);
|
||||
document.removeEventListener('visibilitychange', this._boundVisibility);
|
||||
if (this.timer) clearTimeout(this.timer);
|
||||
},
|
||||
|
||||
@@ -305,7 +311,7 @@
|
||||
},
|
||||
|
||||
addItem() {
|
||||
this.form.items.push({ uid: window.shots.generateUid(), tipo: '', grado: '', cantidad: null });
|
||||
this.form.items.push({ uid: window.uid(), tipo: '', grado: '', cantidad: null });
|
||||
},
|
||||
|
||||
removeItem(idx) {
|
||||
|
||||
Reference in New Issue
Block a user