it works but it's a mess

This commit is contained in:
Alexandra
2025-05-24 02:40:43 -06:00
parent 2f2f358ea2
commit bb743933bd
18 changed files with 519 additions and 378 deletions

View File

@@ -1,12 +1,8 @@
<%
let pageCount = Math.ceil(results.items.length / 100)
pageCount = pageCount ? pageCount : 1 //always ensure 1 page
if(pageNum > pageCount){
pageNum = 1
}
let entryStart = Math.floor((pageNum - 1) * 100)
let entryEnd = entryStart + 100
entryEnd = entryEnd > results.items.length ? results.items.length : entryEnd
%>
<script src='https://code.jquery.com/jquery-3.7.1.js' crossorigin="anonymous"></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js' crossorigin="anonymous"></script>
@@ -31,7 +27,7 @@
<ul class="SuggestionList col-sm-12" id="suggestionList" style="width: 50%;left: 195px;"></ul>
</div>
<p class="m-2">
<%= __('search.found_plural', { count: results.items.length }) %> <%= __('search.in_seconds', { seconds: results.elapsed }) %>.
<%= __('search.found_plural', { count: count }) %> <%= __('search.in_seconds', { seconds: elapsed }) %>.
<%= indexing ? __('search.indexing') : "" %>
<% if (settings.hideNonGame) { %>
<span class="badge badge-info" data-toggle="tooltip" data-placement="top" title="<%= __('settings.extras.hide_non_game.tooltip') %>">
@@ -43,63 +39,11 @@
</form>
<div class="col-sm-12 w-100 mt-3">
<p><%= __('search.displaying_results', { start: entryStart, end: entryEnd }) %></p>
<table class="table text-white table-bordered" id="results">
<thead>
<tr>
<th class="dt-orderable"><span><%= __('results.table.name') %></span><span class="dt-column-order"></span></th>
<th><%= __('results.table.group') %></th>
<th><%= __('results.table.category') %></th>
<th><%= __('results.table.region') %></th>
<th><%= __('results.table.type') %></th>
<th><%= __('results.table.size') %></th>
<th><%= __('results.table.date') %></th>
<th><%= __('results.table.score') %></th>
<% if (process.env.EMULATOR_ENABLED === 'true') { %>
<th><%= __('results.table.play') %></th>
<% } %>
</tr>
</thead>
<% for (let x = entryStart; x < entryEnd; x++) { %>
<tr>
<td>
<a href="<%= results.items[x].path %>">
<%= results.items[x].filename %>
</a>
</td>
<td>
<%= results.items[x].group %>
</td>
<td>
<%= results.items[x].category %>
</td>
<td>
<%= results.items[x].region %>
</td>
<td>
<%= results.items[x].type %>
</td>
<td>
<%= results.items[x].size %>
</td>
<td>
<%= results.items[x].date %>
</td>
<td>
<%= results.items[x].score.toFixed(2) %>
</td>
<% if (process.env.EMULATOR_ENABLED === 'true') { %>
<td>
<% if (isEmulatorCompatible(results.items[x].category)) { %>
<a href="/play/<%= results.items[x].id %>" class="btn btn-sm btn-secondary"><%= __('emulator.play') %></a>
<% } else { %>
<button class="btn btn-sm btn-secondary" disabled><%= __('emulator.not_available') %></button>
<% } %>
</td>
<% } %>
</tr>
<div>
<% for (let x = 0; x < results.length; x++) { %>
<%- include("../partials/result", {result: results[x]}) %>
<% } %>
</table>
</div>
<%
if(pageCount > 1) {
%>
@@ -150,33 +94,4 @@
</div>
<% } %>
</div>
</div>
<script defer>
/*resultTable = new DataTable('#results', {
"order": [[7, 'desc']],
"columns": [
{ "data": "name" }, // Name
{ "data": "group" }, // Group
{ "data": "category" }, // Category
{ "data": "region" }, // Region
{ "data": "type" }, // Type
{ "data": "size" }, // Size
{ "data": "date" }, // Date
{ "data": "score" }, // Search Score
<% if (process.env.EMULATOR_ENABLED === 'true') { %>
{ "data": "play", "orderable": false } // Play button column
<% } %>
],
"lengthMenu": [100, { label: 'All', value: -1 }, 50, 25, 10],
"paging": false,
"filter": false,
"layout": {
"bottomStart": ''
}
});*/
// Initialize tooltips
$(function () {
$('[data-toggle="tooltip"]').tooltip()
});
</script>
</div>

View File

@@ -44,11 +44,62 @@
<div class="col-sm-12 w-100 mt-3">
<p><%= __('search.displaying_results', { start: entryStart, end: entryEnd }) %></p>
<div>
<table class="table text-white table-bordered" id="results">
<thead>
<tr>
<th class="dt-orderable"><span><%= __('results.table.name') %></span><span class="dt-column-order"></span></th>
<th><%= __('results.table.group') %></th>
<th><%= __('results.table.category') %></th>
<th><%= __('results.table.region') %></th>
<th><%= __('results.table.type') %></th>
<th><%= __('results.table.size') %></th>
<th><%= __('results.table.date') %></th>
<th><%= __('results.table.score') %></th>
<% if (process.env.EMULATOR_ENABLED === 'true') { %>
<th><%= __('results.table.play') %></th>
<% } %>
</tr>
</thead>
<% for (let x = entryStart; x < entryEnd; x++) { %>
<%- include("../partials/result", {result: results.items[x]}) %>
<tr>
<td>
<a href="<%= results.items[x].path %>">
<%= results.items[x].filename %>
</a>
</td>
<td>
<%= results.items[x].group %>
</td>
<td>
<%= results.items[x].category %>
</td>
<td>
<%= results.items[x].region %>
</td>
<td>
<%= results.items[x].type %>
</td>
<td>
<%= results.items[x].size %>
</td>
<td>
<%= results.items[x].date %>
</td>
<td>
<%= results.items[x].score.toFixed(2) %>
</td>
<% if (process.env.EMULATOR_ENABLED === 'true') { %>
<td>
<% if (isEmulatorCompatible(results.items[x].category)) { %>
<a href="/play/<%= results.items[x].id %>" class="btn btn-sm btn-secondary"><%= __('emulator.play') %></a>
<% } else { %>
<button class="btn btn-sm btn-secondary" disabled><%= __('emulator.not_available') %></button>
<% } %>
</td>
<% } %>
</tr>
<% } %>
</div>
</table>
<%
if(pageCount > 1) {
%>
@@ -99,4 +150,33 @@
</div>
<% } %>
</div>
</div>
</div>
<script defer>
/*resultTable = new DataTable('#results', {
"order": [[7, 'desc']],
"columns": [
{ "data": "name" }, // Name
{ "data": "group" }, // Group
{ "data": "category" }, // Category
{ "data": "region" }, // Region
{ "data": "type" }, // Type
{ "data": "size" }, // Size
{ "data": "date" }, // Date
{ "data": "score" }, // Search Score
<% if (process.env.EMULATOR_ENABLED === 'true') { %>
{ "data": "play", "orderable": false } // Play button column
<% } %>
],
"lengthMenu": [100, { label: 'All', value: -1 }, 50, 25, 10],
"paging": false,
"filter": false,
"layout": {
"bottomStart": ''
}
});*/
// Initialize tooltips
$(function () {
$('[data-toggle="tooltip"]').tooltip()
});
</script>

View File

@@ -1,9 +1,8 @@
<%
let resultStart = Math.floor((pageNum - 1) * 100)
let length = results.items.length > 5 + resultStart ? 5 + resultStart : results.items.length
let length = results.length > 5 ? 5 : results.length
let resultString = ''
for(let x = resultStart ; x < length; x++){
resultString += `${x + 1}: ${results.items[x].filename}\n\n`
for(let x = 0 ; x < length; x++){
resultString += `${x + 1}: ${results[x].filename}\n\n`
}
resultString = resultString.trim()
%>

View File

@@ -1,14 +1,19 @@
<%
const metadata = result.metadata || new Object()
const file = result.file || new Object()
const coverUrl = metadata.coverartid ? `/proxy-image?url=https://images.igdb.com/igdb/image/upload/t_cover_big/${metadata.coverartid}.webp` : "/public/images/coverart/nocoverart.png"
%>
<div class="col-md-auto row align-items-start searchresult">
<div class="">
<img class="coverart" src="<%= result.image || "/public/images/coverart/nocoverart.png"%>">
<img class="coverart" src="<%= coverUrl %>">
</div>
<div class="col-md">
<p class="title"><%= result.title || result.filename %></p>
<p class="info"<span class="infoitem">Released: <%= result.releaseDate || result.date %></span> <span class="infoitem">Region: <%= result.region %></span></p>
<p class="description"><%= result.description || "No description was found." %></p>
<% if(result.title) {%>
<p class="file">Filename: <%= result.filename %></p>
<p class="title"><%= metadata.title || file.filename %></p>
<p class="info"<span class="infoitem">Released: <%= metadata.releasedate || file.date %></span> <span class="infoitem">Region: <%= file.region %></span> <span class="infoitem">Platform: <%= file.category %></span></p>
<p class="description"><%= metadata.description || "No description was found." %></p>
<% if(metadata.title) {%>
<p class="file">Filename: <%= file.filename %></p>
<% } %>
<p class="actions"><button class="btn btn-sm btn-secondary" href="">More Info</button> <button class="btn btn-sm btn-secondary" href="<%= result.path %>">Download</button> <button class="btn btn-sm btn-secondary" href="/play/<%= result.id %>">Play In Browser</a></button>
<p class="actions"><button class="btn btn-sm btn-secondary" href="">More Info</button> <button class="btn btn-sm btn-secondary" href="<%= file.path %>">Download</button> <button class="btn btn-sm btn-secondary" href="/play/<%= file.id %>">Play In Browser</a></button>
</div>
</div>