Spaces:
Running
Running
Add v118 runtime patch for same VMD reselect
Browse files- v118-runtime.js +26 -0
v118-runtime.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// v118-runtime.js: narrow runtime fixes only; do not touch v117 stable internals.
|
| 2 |
+
(function(){
|
| 3 |
+
const VER='v118';
|
| 4 |
+
function log(m,l){try{(window.__dbg||console.log)(m,l||'info')}catch(e){console.log(m)}}
|
| 5 |
+
function setVer(){try{document.title='MMD pmx Player '+VER;const v=document.getElementById('version-label');if(v)v.textContent=VER}catch(e){}}
|
| 6 |
+
function clearVmdInput(id,why){const el=document.getElementById(id);if(el){el.value='';log('[VMD:'+VER+'] '+id+' cleared for same-file reselect ('+why+')','info')}}
|
| 7 |
+
function bind(){
|
| 8 |
+
setVer();setTimeout(setVer,500);setTimeout(setVer,1500);
|
| 9 |
+
const pairs=[['file-input','vmd-input'],['file-input2','vmd-input2']];
|
| 10 |
+
pairs.forEach(([modelId,vmdId])=>{
|
| 11 |
+
const m=document.getElementById(modelId);
|
| 12 |
+
if(m&&!m.__v118ModelClear){m.__v118ModelClear=true;m.addEventListener('change',()=>clearVmdInput(vmdId,'model slot changed'),true)}
|
| 13 |
+
});
|
| 14 |
+
['vmd-input','vmd-input2','cam-vmd-input'].forEach(id=>{
|
| 15 |
+
const el=document.getElementById(id);
|
| 16 |
+
if(!el||el.__v118SameFile)return;
|
| 17 |
+
el.__v118SameFile=true;
|
| 18 |
+
el.addEventListener('click',()=>{el.value='';log('[VMD:'+VER+'] '+id+' cleared before picker','info')},true);
|
| 19 |
+
el.addEventListener('touchstart',()=>{el.value='';log('[VMD:'+VER+'] '+id+' cleared before picker(touch)','info')},{capture:true,passive:true});
|
| 20 |
+
el.addEventListener('change',()=>{setTimeout(()=>{try{el.value=''}catch(e){}},0)},false);
|
| 21 |
+
});
|
| 22 |
+
log('[Runtime:'+VER+'] 同一VMD再選択パッチ有効','info');
|
| 23 |
+
}
|
| 24 |
+
function wait(){if(window.__appReady)bind();else setTimeout(wait,100)}
|
| 25 |
+
wait();
|
| 26 |
+
})();
|