mirror of
https://github.com/marcrobledo/savegame-editors.git
synced 2025-04-28 09:05:10 +00:00
TOTK: added button for game mod variables importing in master editor
This commit is contained in:
parent
0c4874c441
commit
73d8796371
@ -920,7 +920,14 @@
|
||||
<h3 data-translate="Master editor">Master editor</h3>
|
||||
<div id="master-editor-loading" class="text-center">Master editor is loading...</div>
|
||||
<div id="master-editor-hidden" class="hide">
|
||||
<div class="mb-10">
|
||||
<div id="row-hashes-import" style="float:right">
|
||||
<span class="text-mute">
|
||||
<img src="assets/octicons/octicon_link_external.svg" loading="lazy" class="octicon" /> <a href="https://github.com/marcrobledo/savegame-editors/wiki/TOTK-mods-additional-variables-for-Master-Editor" target="_blank" class="external-link" data-translate="Help">Help</a>
|
||||
</span>
|
||||
<button class="btn" id="button-hashes-import"><img src="assets/octicons/octicon_upload.svg" loading="lazy" class="octicon" /> <span data-translate="Import mod variables">Import mod variables</span></button>
|
||||
<input id="input-file-hashes-import" type="file" accept=".csv" class="hide" />
|
||||
</div>
|
||||
<div class="mb-20">
|
||||
<label><span data-translate="Search">Search</span> <input id="input-custom-filter" type="text" list="knownHashes" placeholder="Search variables" style="width:400px" /></label>
|
||||
<datalist id="knownHashes">
|
||||
<option value="DefeatedEnemyNum.* OR EnemyBattleData.*">Experience</option>
|
||||
|
@ -1056,6 +1056,7 @@ SavegameEditor={
|
||||
break;
|
||||
}
|
||||
}
|
||||
TOTKMasterEditor.gameMod=!knownSavegameVersion;
|
||||
setValue('version', knownSavegameVersion || '*Game mod*');
|
||||
return true;
|
||||
}
|
||||
@ -1715,6 +1716,7 @@ var UI=(function(sge){
|
||||
tabCache[newTab]=true;
|
||||
}else if(newTab==='master'){
|
||||
if(TOTKMasterEditor.isLoaded()){
|
||||
TOTKMasterEditor.toggleImportButton();
|
||||
if(TOTKMasterEditor.forceFindOffsets)
|
||||
TOTKMasterEditor.findOffsets();
|
||||
TOTKMasterEditor.focus();
|
||||
|
@ -309,7 +309,12 @@ var TOTKMasterEditor=(function(){
|
||||
this.refreshResults();
|
||||
get('input-custom-filter').focus();
|
||||
},
|
||||
toggleImportButton:function(){
|
||||
document.getElementById('row-hashes-import').className=this.gameMod? '' : 'hide';
|
||||
},
|
||||
initialize:function(){
|
||||
TOTKMasterEditor.toggleImportButton();
|
||||
|
||||
if(this.isLoaded()){
|
||||
this.focus();
|
||||
}else if(typeof window.fetch==='function'){
|
||||
@ -328,9 +333,19 @@ var TOTKMasterEditor=(function(){
|
||||
this.value=this.value.replace(/[^A-Za-z0-9_\.\*]/g,'').trim();
|
||||
TOTKMasterEditor.refreshResults();
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
get('button-hashes-import').addEventListener('click', function(){
|
||||
document.getElementById('input-file-hashes-import').click();
|
||||
});
|
||||
get('input-file-hashes-import').addEventListener('change', function(){
|
||||
var fr=new FileReader();
|
||||
fr.addEventListener('load', function(evt){
|
||||
_parseHashFile(fr.result);
|
||||
TOTKMasterEditor.findOffsets();
|
||||
});
|
||||
fr.readAsText(this.files[0]);
|
||||
});
|
||||
|
||||
TOTKMasterEditor.focus();
|
||||
})
|
||||
.catch(function(){
|
||||
|
Loading…
x
Reference in New Issue
Block a user