feat: added ROM game match fixing
This commit is contained in:
@@ -1,54 +1,86 @@
|
||||
<table cellspacing="0">
|
||||
<tr>
|
||||
<th>Platform</th>
|
||||
<td id="rominfo_platform"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>File name</th>
|
||||
<td id="rominfo_filename"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Size</th>
|
||||
<td id="rominfo_size"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>ROM Type</th>
|
||||
<td id="rominfo_type"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Media Type</th>
|
||||
<td id="rominfo_mediatype"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Media Label</th>
|
||||
<td id="rominfo_medialabel"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>MD5</th>
|
||||
<td id="rominfo_md5"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>SHA1</th>
|
||||
<td id="rominfo_sha1"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Signature Matched From</th>
|
||||
<td id="rominfo_signaturematch"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Signature Source Flags</th>
|
||||
<td id="rominfo_flags"></td>
|
||||
</tr>
|
||||
</table>
|
||||
<div id="properties_toc">
|
||||
<div id="properties_toc_general" name="properties_toc_item" onclick="SelectTab('general');">General</div>
|
||||
<div id="properties_toc_match" name="properties_toc_item" onclick="SelectTab('match');">Title Match</div>
|
||||
<div id="properties_toc_manage" name="properties_toc_item" onclick="SelectTab('manage');">Manage</div>
|
||||
</div>
|
||||
<div id="properties_bodypanel">
|
||||
<div id="properties_bodypanel_general" name="properties_tab" style="display: none;">
|
||||
<table cellspacing="0">
|
||||
<tr>
|
||||
<th>Platform</th>
|
||||
<td id="rominfo_platform"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Size</th>
|
||||
<td id="rominfo_size"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>ROM Type</th>
|
||||
<td id="rominfo_type"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Media Type</th>
|
||||
<td id="rominfo_mediatype"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Media Label</th>
|
||||
<td id="rominfo_medialabel"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>MD5</th>
|
||||
<td id="rominfo_md5"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>SHA1</th>
|
||||
<td id="rominfo_sha1"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Signature Matched From</th>
|
||||
<td id="rominfo_signaturematch"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Signature Source Flags</th>
|
||||
<td id="rominfo_flags"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div id="properties_bodypanel_match" name="properties_tab" style="display: none;">
|
||||
<table style="width: 100%;">
|
||||
<tr>
|
||||
<th colspan="2">Fix Match</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="width: 25%;">Platform</th>
|
||||
<td style="width: 75%;">
|
||||
<select id="properties_fixplatform" style="width: 100%;"></select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="width: 25%;">Game</th>
|
||||
<td style="width: 75%;"><select id="properties_fixgame" style="width: 100%;"></select></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" style="text-align: right;"><button id="properties_fixsave" value="Save Match" onclick="SaveFixedGame();">Save Match</button></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div id="properties_bodypanel_manage" name="properties_tab" style="display: none;">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
document.getElementById('modal-heading').innerHTML = "ROM/Image Info";
|
||||
document.getElementById('modal-heading').innerHTML = "Properties";
|
||||
|
||||
var gameId = urlParams.get('id');
|
||||
|
||||
var romData;
|
||||
|
||||
function getRomType(typeId) {
|
||||
switch (typeId) {
|
||||
|
||||
|
||||
case 1:
|
||||
return "Optical media";
|
||||
break;
|
||||
@@ -62,7 +94,7 @@
|
||||
return "Individual pars";
|
||||
break;
|
||||
case 5:
|
||||
return "Tape base media";
|
||||
return "Tape based media";
|
||||
break;
|
||||
case 6:
|
||||
return "Side of the media";
|
||||
@@ -75,8 +107,10 @@
|
||||
}
|
||||
|
||||
ajaxCall('/api/v1/Games/' + gameId + '/roms/' + modalVariables, 'GET', function (result) {
|
||||
romData = result;
|
||||
document.getElementById('modal-heading').innerHTML = result.name;
|
||||
document.getElementById('rominfo_platform').innerHTML = result.platform.name;
|
||||
document.getElementById('rominfo_filename').innerHTML = result.name;
|
||||
//document.getElementById('rominfo_filename').innerHTML = result.name;
|
||||
document.getElementById('rominfo_size').innerHTML = formatBytes(result.size, 2);
|
||||
document.getElementById('rominfo_type').innerHTML = getRomType(result.romType);
|
||||
document.getElementById('rominfo_mediatype').innerHTML = result.romTypeMedia;
|
||||
@@ -85,5 +119,126 @@
|
||||
document.getElementById('rominfo_sha1').innerHTML = result.shA1;
|
||||
document.getElementById('rominfo_signaturematch').innerHTML = result.source;
|
||||
document.getElementById('rominfo_flags').innerHTML = result.flags;
|
||||
|
||||
document.getElementById('properties_fixplatform').innerHTML = "<option value='" + result.platform.id + "' selected='selected'>" + result.platform.name + "</option>";
|
||||
document.getElementById('properties_fixgame').innerHTML = "<option value='" + gameData.id + "' selected='selected'>" + gameData.name + "</option>";
|
||||
});
|
||||
</script>
|
||||
|
||||
function SelectTab(TabName) {
|
||||
var tabs = document.getElementsByName('properties_tab');
|
||||
for (var i = 0; i < tabs.length; i++) {
|
||||
if ((tabs[i].id) == ("properties_bodypanel_" + TabName)) {
|
||||
tabs[i].style.display = '';
|
||||
} else {
|
||||
tabs[i].style.display = 'none';
|
||||
}
|
||||
}
|
||||
|
||||
var tocs = document.getElementsByName('properties_toc_item');
|
||||
for (var i = 0; i < tocs.length; i++) {
|
||||
if ((tocs[i].id) == ("properties_toc_" + TabName)) {
|
||||
tocs[i].className = "properties_toc_item_selected";
|
||||
} else {
|
||||
tocs[i].className = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$('#properties_fixplatform').select2({
|
||||
minimumInputLength: 3,
|
||||
ajax: {
|
||||
url: '/api/v1/Search/Platform',
|
||||
data: function (params) {
|
||||
var query = {
|
||||
SearchString: params.term
|
||||
}
|
||||
|
||||
// Query parameters will be ?SearchString=[term]
|
||||
return query;
|
||||
},
|
||||
processResults: function (data) {
|
||||
var arr = [];
|
||||
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
arr.push({
|
||||
id: data[i].id,
|
||||
text: data[i].name
|
||||
});
|
||||
}
|
||||
|
||||
return {
|
||||
results: arr
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$('#properties_fixgame').select2({
|
||||
minimumInputLength: 3,
|
||||
templateResult: DropDownRenderGameOption,
|
||||
ajax: {
|
||||
url: '/api/v1/Search/Game',
|
||||
data: function (params) {
|
||||
fixplatform = $('#properties_fixplatform').select2('data');
|
||||
|
||||
var query = {
|
||||
PlatformId: fixplatform[0].id,
|
||||
SearchString: params.term
|
||||
}
|
||||
|
||||
// Query parameters will be ?SearchString=[term]
|
||||
return query;
|
||||
},
|
||||
processResults: function (data) {
|
||||
var arr = [];
|
||||
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
arr.push({
|
||||
id: data[i].id,
|
||||
text: data[i].name,
|
||||
cover: data[i].cover
|
||||
});
|
||||
}
|
||||
|
||||
return {
|
||||
results: arr
|
||||
};
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
function DropDownRenderGameOption(state) {
|
||||
console.log(JSON.stringify(state));
|
||||
|
||||
if (state.loading) {
|
||||
return state;
|
||||
}
|
||||
|
||||
var response;
|
||||
|
||||
if (state.cover) {
|
||||
response = $(
|
||||
'<table class="dropdown-div"><tr><td class="dropdown-cover"><img src="https://images.igdb.com/igdb/image/upload/t_cover_small/' + state.cover.value.imageId + '.jpg" /></td><td class="dropdown-label"><span>' + state.text + '</span></td></tr></table>'
|
||||
);
|
||||
} else {
|
||||
response = $(
|
||||
'<table class="dropdown-div"><tr><td class="dropdown-cover"><img src="/images/unknowngame.png" /></td><td class="dropdown-label"><span>' + state.text + '</span></td></tr></table>'
|
||||
);
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
function SaveFixedGame() {
|
||||
var fixplatform = $('#properties_fixplatform').select2('data');
|
||||
var fixgame = $('#properties_fixgame').select2('data');
|
||||
|
||||
document.getElementById('properties_fixsave').setAttribute("disabled", "disabled");
|
||||
|
||||
ajaxCall('/api/v1/Games/' + gameId + '/roms/' + modalVariables + '?NewPlatformId=' + fixplatform[0].id + '&NewGameId=' + fixgame[0].id, 'PATCH', function (result) {
|
||||
window.location.reload();
|
||||
});
|
||||
}
|
||||
|
||||
SelectTab('general');
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user