Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
109 lines (90 sloc) 2.69 KB
<html>
<head>
<title>TCP texts</title>
<!-- DataTables CSS -->
<link rel="stylesheet" type="text/css" href="//cdn.datatables.net/1.10.4/css/jquery.dataTables.css">
<style type="text/css">
td { vertical-align: top }
tfoot {
display: table-header-group;
}
</style>
<!-- jQuery -->
<script type="text/javascript" charset="utf8" src="//code.jquery.com/jquery-1.10.2.min.js"></script>
<!-- DataTables -->
<script type="text/javascript" charset="utf8" src="//cdn.datatables.net/1.10.4/js/jquery.dataTables.js"></script>
<script type="text/javascript" class="init">
$(document).ready(function() {
$('#tcpcat tfoot th').each( function () {
var title = $('#tcpcat tfoot th').eq( $(this).index() ).text();
$(this).html( '<input type="text" placeholder="Search '+title+'">' );
} );
var table = $('#tcpcat').DataTable( {
"processing": true,
"serverSide": true,
"ajax": "/scripts/server_processing.php",
"columnDefs": [
{
"targets": [ 2 ],
"render": function ( data, type, row ) {
if ( data == 1 ) { return 'Free' } else { return 'Restricted' };
}
},
{
"targets": [ 3 ],
"visible": false
},
{
"targets": [ 5 ],
"render": function ( data, type, row ) {
return data + ' (<i>' + row[3] + '</i>)';
}
},
{
"targets": [ 0 ],
"render": function ( data, type, row ) {
$links = '<a href="http://www.ota.ox.ac.uk/text/'+data+'.html">HTML</a>; <a href="http://www.ota.ox.ac.uk/text/'+data+'.epub">ePub</a>';
if (row[2] == '1') { $links += '; <a href="http://www.ota.ox.ac.uk/text/'+data+'.xml">source</a>'} ;
return $links;
}
}
]
} );
table.columns().eq( 0 ).each( function ( colIdx ) {
$( 'input', table.column( colIdx ).footer() ).on( 'keyup change', function () {
table
.column( colIdx )
.search( this.value )
.draw();
} );
} );
} );
</script>
</head>
<body>
<table id="tcpcat" class="display" cellspacing="0" width="100%">
<thead>
<tr>
<th>TCP</th>
<th>ID</th>
<th>Avail</th>
<th>Author</th>
<th>Date</th>
<th>Title</th>
<th>Pages</th>
</tr>
</thead>
<tfoot>
<tr>
<th>TCP</th>
<th>ID</th>
<th>Avail</th>
<th>Author</th>
<th>Date</th>
<th>Title</th>
<th>Pages</th>
</tr>
</tfoot>
</table>
</body>
</html>