diff --git a/gaseous-server/Controllers/GamesController.cs b/gaseous-server/Controllers/GamesController.cs index fa5a609..5e1834b 100644 --- a/gaseous-server/Controllers/GamesController.cs +++ b/gaseous-server/Controllers/GamesController.cs @@ -111,22 +111,14 @@ namespace gaseous_server.Controllers } Database db = new gaseous_tools.Database(Database.databaseType.MySql, Config.DatabaseConfiguration.ConnectionString); - string sql = "SELECT DISTINCT games_roms.gameid AS ROMGameId, game.ageratings, game.aggregatedrating, game.aggregatedratingcount, game.alternativenames, game.artworks, game.bundles, game.category, game.collection, game.cover, game.dlcs, game.expansions, game.externalgames, game.firstreleasedate, game.`follows`, game.franchise, game.franchises, game.gameengines, game.gamemodes, game.genres, game.hypes, game.involvedcompanies, game.keywords, game.multiplayermodes, (CASE WHEN games_roms.gameid = 0 THEN games_roms.`name` ELSE game.`name` END) AS `name`, game.parentgame, game.platforms, game.playerperspectives, game.rating, game.ratingcount, game.releasedates, game.screenshots, game.similargames, game.slug, game.standaloneexpansions, game.`status`, game.storyline, game.summary, game.tags, game.themes, game.totalrating, game.totalratingcount, game.versionparent, game.versiontitle, game.videos, game.websites FROM gaseous.games_roms LEFT JOIN game ON game.id = games_roms.gameid " + whereClause + " " + havingClause + " " + orderByClause; + string sql = "SELECT DISTINCT games_roms.gameid AS ROMGameId, game.ageratings, game.aggregatedrating, game.aggregatedratingcount, game.alternativenames, game.artworks, game.bundles, game.category, game.collection, game.cover, game.dlcs, game.expansions, game.externalgames, game.firstreleasedate, game.`follows`, game.franchise, game.franchises, game.gameengines, game.gamemodes, game.genres, game.hypes, game.involvedcompanies, game.keywords, game.multiplayermodes, game.`name`, game.parentgame, game.platforms, game.playerperspectives, game.rating, game.ratingcount, game.releasedates, game.screenshots, game.similargames, game.slug, game.standaloneexpansions, game.`status`, game.storyline, game.summary, game.tags, game.themes, game.totalrating, game.totalratingcount, game.versionparent, game.versiontitle, game.videos, game.websites FROM gaseous.games_roms LEFT JOIN game ON game.id = games_roms.gameid " + whereClause + " " + havingClause + " " + orderByClause; List RetVal = new List(); DataTable dbResponse = db.ExecuteCMD(sql, whereParams); foreach (DataRow dr in dbResponse.Rows) { - if ((long)dr["ROMGameId"] == 0) - { - // unknown game - } - else - { - // known game - RetVal.Add(Classes.Metadata.Games.GetGame((long)dr["ROMGameId"], false, false)); - } + RetVal.Add(Classes.Metadata.Games.GetGame((long)dr["ROMGameId"], false, false)); } return Ok(RetVal); diff --git a/gaseous-server/wwwroot/android-chrome-192x192.png b/gaseous-server/wwwroot/android-chrome-192x192.png new file mode 100644 index 0000000..143a0d6 Binary files /dev/null and b/gaseous-server/wwwroot/android-chrome-192x192.png differ diff --git a/gaseous-server/wwwroot/android-chrome-512x512.png b/gaseous-server/wwwroot/android-chrome-512x512.png new file mode 100644 index 0000000..c6f960d Binary files /dev/null and b/gaseous-server/wwwroot/android-chrome-512x512.png differ diff --git a/gaseous-server/wwwroot/apple-touch-icon.png b/gaseous-server/wwwroot/apple-touch-icon.png new file mode 100644 index 0000000..72b8714 Binary files /dev/null and b/gaseous-server/wwwroot/apple-touch-icon.png differ diff --git a/gaseous-server/wwwroot/favicon-16x16.png b/gaseous-server/wwwroot/favicon-16x16.png new file mode 100644 index 0000000..a28d403 Binary files /dev/null and b/gaseous-server/wwwroot/favicon-16x16.png differ diff --git a/gaseous-server/wwwroot/favicon-32x32.png b/gaseous-server/wwwroot/favicon-32x32.png new file mode 100644 index 0000000..830c5bb Binary files /dev/null and b/gaseous-server/wwwroot/favicon-32x32.png differ diff --git a/gaseous-server/wwwroot/favicon.ico b/gaseous-server/wwwroot/favicon.ico new file mode 100644 index 0000000..df7b768 Binary files /dev/null and b/gaseous-server/wwwroot/favicon.ico differ diff --git a/gaseous-server/wwwroot/index.html b/gaseous-server/wwwroot/index.html index ccca86d..565daf6 100644 --- a/gaseous-server/wwwroot/index.html +++ b/gaseous-server/wwwroot/index.html @@ -7,6 +7,10 @@ + + + + Gaseous diff --git a/gaseous-server/wwwroot/scripts/filterformating.js b/gaseous-server/wwwroot/scripts/filterformating.js index 85dd088..b5ed334 100644 --- a/gaseous-server/wwwroot/scripts/filterformating.js +++ b/gaseous-server/wwwroot/scripts/filterformating.js @@ -7,7 +7,10 @@ var containerPanelSearch = document.createElement('div'); containerPanelSearch.className = 'filter_panel_box'; var containerPanelSearchField = document.createElement('input'); + containerPanelSearchField.id = 'filter_panel_search'; containerPanelSearchField.type = 'text'; + containerPanelSearchField.placeholder = 'Search'; + containerPanelSearchField.setAttribute('onkeydown', 'executeFilterDelayed();'); containerPanelSearch.appendChild(containerPanelSearchField); panel.appendChild(containerPanelSearch); @@ -18,7 +21,7 @@ var containerPanelPlatform = document.createElement('div'); containerPanelPlatform.className = 'filter_panel_box'; for (var i = 0; i < result.platforms.length; i++) { - containerPanelPlatform.appendChild(buildFilterPanelItem(result.platforms[i].id, result.platforms[i].name)); + containerPanelPlatform.appendChild(buildFilterPanelItem('platforms', result.platforms[i].id, result.platforms[i].name)); } panel.appendChild(containerPanelPlatform); @@ -31,7 +34,7 @@ var containerPanelGenres = document.createElement('div'); containerPanelGenres.className = 'filter_panel_box'; for (var i = 0; i < result.genres.length; i++) { - containerPanelGenres.appendChild(buildFilterPanelItem(result.genres[i].id, result.genres[i].name)); + containerPanelGenres.appendChild(buildFilterPanelItem('genres', result.genres[i].id, result.genres[i].name)); } panel.appendChild(containerPanelGenres); @@ -50,7 +53,7 @@ function buildFilterPanelHeader(headerString, friendlyHeaderString) { return header; } -function buildFilterPanelItem(itemString, friendlyItemString) { +function buildFilterPanelItem(filterType, itemString, friendlyItemString) { var filterPanelItem = document.createElement('div'); filterPanelItem.id = 'filter_panel_item_' + itemString; filterPanelItem.className = 'filter_panel_item'; @@ -61,6 +64,9 @@ function buildFilterPanelItem(itemString, friendlyItemString) { filterPanelItemCheckBoxItem.id = 'filter_panel_item_checkbox_' + itemString; filterPanelItemCheckBoxItem.type = 'checkbox'; filterPanelItemCheckBoxItem.className = 'filter_panel_item_checkbox'; + filterPanelItemCheckBoxItem.name = 'filter_' + filterType; + filterPanelItemCheckBoxItem.setAttribute('filter_id', itemString); + filterPanelItemCheckBoxItem.setAttribute('oninput' , 'executeFilter();'); filterPanelItemCheckBox.appendChild(filterPanelItemCheckBoxItem); var filterPanelItemLabel = document.createElement('label'); @@ -73,4 +79,46 @@ function buildFilterPanelItem(itemString, friendlyItemString) { filterPanelItem.appendChild(filterPanelItemLabel); return filterPanelItem; +} + +var filterExecutor = null; +function executeFilterDelayed() { + if (filterExecutor) { + filterExecutor = null; + } + + filterExecutor = setTimeout(executeFilter, 1000); +} + +function executeFilter() { + // build filter lists + var platforms = ''; + var genres = ''; + + var searchString = document.getElementById('filter_panel_search').value; + var platformFilters = document.getElementsByName('filter_platforms'); + var genreFilters = document.getElementsByName('filter_genres'); + + for (var i = 0; i < platformFilters.length; i++) { + if (platformFilters[i].checked) { + if (platforms.length > 0) { + platforms += ','; + } + platforms += platformFilters[i].getAttribute('filter_id'); + } + } + + for (var i = 0; i < genreFilters.length; i++) { + if (genreFilters[i].checked) { + if (genres.length > 0) { + genres += ','; + } + genres += genreFilters[i].getAttribute('filter_id'); + } + } + + ajaxCall('/api/v1/Games?name=' + searchString + '&platform=' + platforms + '&genre=' + genres, 'GET', function (result) { + var gameElement = document.getElementById('games_library'); + formatGamesPanel(gameElement, result); + }); } \ No newline at end of file diff --git a/gaseous-server/wwwroot/scripts/gamesformating.js b/gaseous-server/wwwroot/scripts/gamesformating.js index 0728726..e72a0af 100644 --- a/gaseous-server/wwwroot/scripts/gamesformating.js +++ b/gaseous-server/wwwroot/scripts/gamesformating.js @@ -1,4 +1,5 @@ function formatGamesPanel(targetElement, result) { + targetElement.innerHTML = ''; for (var i = 0; i < result.length; i++) { var game = renderGameIcon(result[i], true, false); targetElement.appendChild(game); diff --git a/gaseous-server/wwwroot/site.webmanifest b/gaseous-server/wwwroot/site.webmanifest new file mode 100644 index 0000000..45dc8a2 --- /dev/null +++ b/gaseous-server/wwwroot/site.webmanifest @@ -0,0 +1 @@ +{"name":"","short_name":"","icons":[{"src":"/android-chrome-192x192.png","sizes":"192x192","type":"image/png"},{"src":"/android-chrome-512x512.png","sizes":"512x512","type":"image/png"}],"theme_color":"#ffffff","background_color":"#ffffff","display":"standalone"} \ No newline at end of file diff --git a/gaseous-server/wwwroot/styles/style.css b/gaseous-server/wwwroot/styles/style.css index 0c5fb57..eb14529 100644 --- a/gaseous-server/wwwroot/styles/style.css +++ b/gaseous-server/wwwroot/styles/style.css @@ -70,6 +70,25 @@ padding: 10px; } +input[type='text'] { + background-color: #2b2b2b; + color: white; + padding: 5px; + font-family: "PT Sans", Arial, Helvetica, sans-serif; + font-kerning: normal; + font-style: normal; + font-weight: 100; + font-size: 13px; + border-radius: 5px; + border-width: 1px; + border-style: solid; + border-color: lightgray; +} + +input[id='filter_panel_search'] { + width: 160px; +} + .filter_panel_item { display: flex; padding: 3px;