Merge pull request #34 from BynariStar/master
Game compatibility list fixes and improvements
This commit is contained in:
commit
4d9e87cd64
|
@ -24,7 +24,7 @@
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<div class="input-group search-box">
|
<div class="input-group search-box">
|
||||||
<input type="text" class="form-control fuzzy-search" id="search-box" placeholder="Search...">
|
<input type="text" class="form-control search" id="search-box" placeholder="Search...">
|
||||||
<span onclick="clearSearch()" class="clear-search input-group-addon">X</span>
|
<span onclick="clearSearch()" class="clear-search input-group-addon">X</span>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
|
@ -54,26 +54,26 @@
|
||||||
|
|
||||||
{{ range .Pages }}
|
{{ range .Pages }}
|
||||||
{{- $key := substr .Params.title 0 1 }}
|
{{- $key := substr .Params.title 0 1 }}
|
||||||
{{- $rating := index .Site.Data.compatibility .Params.compatibility }}
|
{{- $rating := index .Site.Data.compatibility .Params.compatibility }}
|
||||||
{{- $type := index .Site.Data.gameTypes (.Params.game_type | default "3ds") }}
|
{{- $type := index .Site.Data.gameTypes (.Params.game_type | default "3ds") }}
|
||||||
<tr data-key="{{ $key }}">
|
<tr data-key="{{ $key }}">
|
||||||
<td class="hidden listing-metadata">
|
<td class="hidden listing-metadata">
|
||||||
{{ .Params.title }} {{ $type.name }} {{ $rating.name }} {{ dateFormat "January 2, 2006" .Params.testcase_date }}
|
<span>{{ .Params.title }} {{ $type.name }} {{ $rating.name }} {{ dateFormat "January 2, 2006" .Params.testcase_date }}</span>
|
||||||
</td>
|
</td>
|
||||||
<td class="col-md-1 icon">
|
<td class="col-md-1 icon">
|
||||||
<img src="/images/game/icons/{{ .File.BaseFileName }}.png" />
|
<img src="/images/game/icons/{{ .File.BaseFileName }}.png" />
|
||||||
</td>
|
</td>
|
||||||
<td class="col-md-6 title">
|
<td class="col-md-6 title" data-title="{{ .Params.title }}">
|
||||||
<a href="{{ .Permalink }}">{{ .Params.title }}</a>
|
<a href="{{ .Permalink }}">{{ .Params.title }}</a>
|
||||||
</td>
|
</td>
|
||||||
<td class="col-md-1 type">
|
<td class="col-md-1 type" data-type="{{ $type.name }}">
|
||||||
<img src="/images/game/types/{{ $type.key }}.png" title="{{ $type.name }}" />
|
<img src="/images/game/types/{{ $type.key }}.png" title="{{ $type.name }}" />
|
||||||
</td>
|
</td>
|
||||||
<td class="col-md-1 compatibility">
|
<td class="col-md-1 compatibility" data-compatibility="{{ $rating.key }}">
|
||||||
<div class="square-icon" style="background-color: {{ $rating.color }}"></div> {{ $rating.name }}
|
<div class="square-icon" style="background-color: {{ $rating.color }}"></div> <span>{{ $rating.name }}</span>
|
||||||
</td>
|
</td>
|
||||||
<td class="col-md-3 date-tested">
|
<td class="col-md-3 date-tested" data-timestamp="{{ .Params.testcase_date }}">
|
||||||
{{ dateFormat "January 2, 2006" .Params.testcase_date }}
|
<span>{{ dateFormat "January 2, 2006" .Params.testcase_date }}</span>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
@ -90,7 +90,14 @@
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var options = {
|
var options = {
|
||||||
valueNames: ['listing-metadata', 'icon', 'title', 'type', 'compatibility', 'date-tested'],
|
valueNames: [
|
||||||
|
'listing-metadata',
|
||||||
|
{ name: 'title', attr: 'data-title' },
|
||||||
|
{ name: 'type', attr: 'data-type' },
|
||||||
|
{ name: 'compatibility', attr: 'data-compatibility' },
|
||||||
|
{ name: 'date-tested', attr: 'data-timestamp' }
|
||||||
|
],
|
||||||
|
searchColumns: [ 'listing-metadata' ],
|
||||||
pagination: true,
|
pagination: true,
|
||||||
indexAsync: true,
|
indexAsync: true,
|
||||||
page: 50
|
page: 50
|
||||||
|
@ -100,33 +107,43 @@
|
||||||
|
|
||||||
list.sort("title", {order: "asc"});
|
list.sort("title", {order: "asc"});
|
||||||
|
|
||||||
$('#search-box').keyup(function() {
|
list.on("updated", function(list){
|
||||||
var searchString = $(this).val();
|
var $list = $(list.list);
|
||||||
list.fuzzySearch(searchString, ['listing-metadata']);
|
var $items = $list.children();
|
||||||
});
|
$items.removeClass("key");
|
||||||
|
if ('title' == getLastSorted(list)){
|
||||||
list.on("updated", function(){
|
$items.each(function(){
|
||||||
$("#compatibility-list tbody tr.key").removeClass("key");
|
|
||||||
if ($("#compatibility-list thead").find("th.asc[data-sort='title'], th.desc[data-sort='title']").length){
|
|
||||||
$("#compatibility-list tbody tr[data-key]").each(function(){
|
|
||||||
var key = $(this).attr("data-key")
|
var key = $(this).attr("data-key")
|
||||||
if ($("tr[data-key='" + key + "']:first").is($(this))){
|
if (
|
||||||
|
$list
|
||||||
|
.children("[data-key='" + key + "']")
|
||||||
|
.first()
|
||||||
|
.is( $(this) )
|
||||||
|
){
|
||||||
$(this).addClass("key");
|
$(this).addClass("key");
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
function getLastSorted(list){
|
||||||
|
var currentSorted = $(list.listContainer).find(".asc, .desc").attr("data-sort");
|
||||||
|
if ('undefined' !== typeof currentSorted)
|
||||||
|
list.lastSorted = currentSorted;
|
||||||
|
return list.lastSorted;
|
||||||
|
}
|
||||||
|
|
||||||
function filterTable(_) {
|
function filterTable(_) {
|
||||||
var rating = this.name;
|
var rating = this.name;
|
||||||
|
var index = this.index;
|
||||||
|
|
||||||
$("#search-box").val(rating);
|
$("#search-box").val(rating);
|
||||||
list.search(rating, ['compatibility']);
|
list.search(index, ['compatibility']);
|
||||||
}
|
}
|
||||||
|
|
||||||
function clearSearch() {
|
function clearSearch() {
|
||||||
$("#search-box").val("");
|
$("#search-box").val("");
|
||||||
list.fuzzySearch();
|
list.search();
|
||||||
}
|
}
|
||||||
|
|
||||||
Highcharts.chart('highchart-container', {
|
Highcharts.chart('highchart-container', {
|
||||||
|
|
Reference in New Issue