Version 5.1 - All the GraphQL #32
@ -25,10 +25,10 @@
|
|||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
<th>Title</th>
|
<th>Title</th>
|
||||||
<th>Airing Status</th>
|
<th>Airing Status</th>
|
||||||
<th>Score</th>
|
<th class='numeric'>Score</th>
|
||||||
<th>Type</th>
|
<th>Type</th>
|
||||||
<th>Progress</th>
|
<th class='numeric'>Progress</th>
|
||||||
<th>Rated</th>
|
<th class='rating'>Age Rating</th>
|
||||||
<th>Attributes</th>
|
<th>Attributes</th>
|
||||||
<?php if($hasNotes): ?><th>Notes</th><?php endif ?>
|
<?php if($hasNotes): ?><th>Notes</th><?php endif ?>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -38,10 +38,10 @@
|
|||||||
{$firstTh}
|
{$firstTh}
|
||||||
<th>Title</th>
|
<th>Title</th>
|
||||||
{$mediaTh}
|
{$mediaTh}
|
||||||
<th>Episode Count</th>
|
<th class='numeric'>Episode Count</th>
|
||||||
<th>Episode Length</th>
|
<th class='numeric'>Episode Length</th>
|
||||||
<th>Show Type</th>
|
<th>Show Type</th>
|
||||||
<th>Age Rating</th>
|
<th class='rating'>Age Rating</th>
|
||||||
{$noteTh}
|
{$noteTh}
|
||||||
<th>Genres</th>
|
<th>Genres</th>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -20,8 +20,8 @@
|
|||||||
<td> </td>
|
<td> </td>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
<th>Title</th>
|
<th>Title</th>
|
||||||
<th>Rating</th>
|
<th class='numeric'>Score</th>
|
||||||
<th>Completed Chapters</th>
|
<th class='numeric'>Completed Chapters</th>
|
||||||
<th>Attributes</th>
|
<th>Attributes</th>
|
||||||
<th>Type</th>
|
<th>Type</th>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -6,9 +6,22 @@ const LightTableSorter = (() => {
|
|||||||
const sort = (a, b) => {
|
const sort = (a, b) => {
|
||||||
let textA = text(a);
|
let textA = text(a);
|
||||||
let textB = text(b);
|
let textB = text(b);
|
||||||
const n = parseInt(textA, 10);
|
console.log("Comparing " + textA + " and " + textB)
|
||||||
if (n) {
|
|
||||||
textA = n;
|
if(th.classList.contains("numeric")){
|
||||||
|
arrayA = textA.replace('episodes: ','').replace('-',0).split("/");
|
||||||
|
arrayB = textB.replace('episodes: ','').replace('-',0).split("/");
|
||||||
|
if(arrayA.length > 1) {
|
||||||
|
textA = parseInt(arrayA[0],10) / parseInt(arrayA[1],10);
|
||||||
|
textB = parseInt(arrayB[0],10) / parseInt(arrayB[1],10);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
textA = parseInt(arrayA[0],10);
|
||||||
|
textB = parseInt(arrayB[0],10);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (parseInt(textA, 10)) {
|
||||||
|
textA = parseInt(textA, 10);
|
||||||
textB = parseInt(textB, 10);
|
textB = parseInt(textB, 10);
|
||||||
}
|
}
|
||||||
if (textA > textB) {
|
if (textA > textB) {
|
||||||
@ -59,6 +72,7 @@ const LightTableSorter = (() => {
|
|||||||
for (let i = 0, len = ths.length; i < len; i++) {
|
for (let i = 0, len = ths.length; i < len; i++) {
|
||||||
let th = ths[i];
|
let th = ths[i];
|
||||||
th.classList.add('sorting');
|
th.classList.add('sorting');
|
||||||
|
th.classList.add('testing');
|
||||||
results.push(th.onclick = onClickEvent);
|
results.push(th.onclick = onClickEvent);
|
||||||
}
|
}
|
||||||
return results;
|
return results;
|
||||||
|
File diff suppressed because one or more lines are too long
2
public/js/tables.min.js
vendored
2
public/js/tables.min.js
vendored
@ -1 +1 @@
|
|||||||
var LightTableSorter=function(){var th=null;var cellIndex=null;var order='';var text=function(row){return row.cells.item(cellIndex).textContent.toLowerCase()};var sort=function(a,b){var textA=text(a);var textB=text(b);var n=parseInt(textA,10);if(n){textA=n;textB=parseInt(textB,10)}if(textA>textB)return 1;if(textA<textB)return -1;return 0};var toggle=function(){var c=order!=='sorting-asc'?'sorting-asc':'sorting-desc';th.className=(th.className.replace(order,'')+' '+c).trim();return order=c};var reset=function(){th.classList.remove('sorting-asc','sorting-desc');th.classList.add('sorting');return order=''};var onClickEvent=function(e){if(th&&cellIndex!==e.target.cellIndex)reset();th=e.target;if(th.nodeName.toLowerCase()==='th'){cellIndex=th.cellIndex;var tbody=th.offsetParent.getElementsByTagName('tbody')[0];var rows=Array.from(tbody.rows);if(rows){rows.sort(sort);if(order==='sorting-asc')rows.reverse();toggle();tbody.innerHtml='';rows.forEach(function(row){tbody.appendChild(row)})}}};return{init:function(){var ths=document.getElementsByTagName('th');var results=[];for(var i=0,len=ths.length;i<len;i++){var th=ths[i];th.classList.add('sorting');results.push(th.onclick=onClickEvent)}return results}}}();LightTableSorter.init()
|
var LightTableSorter=function(){var th=null;var cellIndex=null;var order='';var text=function(row){return row.cells.item(cellIndex).textContent.toLowerCase()};var sort=function(a,b){var textA=text(a);var textB=text(b);console.log("Comparing "+textA+" and "+textB);if(th.classList.contains("numeric")){arrayA=textA.replace('episodes: ','').replace('-',0).split("/");arrayB=textB.replace('episodes: ','').replace('-',0).split("/");if(arrayA.length>1){textA=parseInt(arrayA[0],10)/parseInt(arrayA[1],10);textB=parseInt(arrayB[0],10)/parseInt(arrayB[1],10)}else{textA=parseInt(arrayA[0],10);textB=parseInt(arrayB[0],10)}}else if(parseInt(textA,10)){textA=parseInt(textA,10);textB=parseInt(textB,10)}if(textA>textB)return 1;if(textA<textB)return -1;return 0};var toggle=function(){var c=order!=='sorting-asc'?'sorting-asc':'sorting-desc';th.className=(th.className.replace(order,'')+' '+c).trim();return order=c};var reset=function(){th.classList.remove('sorting-asc','sorting-desc');th.classList.add('sorting');return order=''};var onClickEvent=function(e){if(th&&cellIndex!==e.target.cellIndex)reset();th=e.target;if(th.nodeName.toLowerCase()==='th'){cellIndex=th.cellIndex;var tbody=th.offsetParent.getElementsByTagName('tbody')[0];var rows=Array.from(tbody.rows);if(rows){rows.sort(sort);if(order==='sorting-asc')rows.reverse();toggle();tbody.innerHtml='';rows.forEach(function(row){tbody.appendChild(row)})}}};return{init:function(){var ths=document.getElementsByTagName('th');var results=[];for(var i=0,len=ths.length;i<len;i++){var th=ths[i];th.classList.add('sorting');th.classList.add('testing');results.push(th.onclick=onClickEvent)}return results}}}();LightTableSorter.init()
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user