Skip to content

Commit 9fdef5a

Browse files
datatableDir argument for remote/local css/js files
1 parent 1e0d8cf commit 9fdef5a

1 file changed

Lines changed: 43 additions & 8 deletions

File tree

knotAnnotSV.pl

Lines changed: 43 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@
4444
\n--annotSVranking <annotSV ranking explanations file>
4545
\n--outDir <output directory (default = current dir)>
4646
\n--outPrefix <output file prefix (default = \"\")>
47-
\n--datatableDir <directory containing datatables file (default = \"\")>";
47+
\n--genomeBuild <Genome Assembly reference (default = hg19)>
48+
\n--datatableDir <Local Path to dataTables directory containing css and js files (default = \"\", requires web connection)>";
4849

4950

5051
my $configFile = ".";
@@ -401,6 +402,38 @@
401402
}#END WHILE VCF
402403

403404

405+
#prepare path to lib css and js
406+
407+
408+
#original url used
409+
#'https://code.jquery.com/jquery-3.5.1.js'
410+
#'https://cdn.datatables.net/1.10.22/js/jquery.dataTables.min.js'
411+
#'https://cdn.datatables.net/fixedheader/3.1.7/js/dataTables.fixedHeader.min.js'
412+
#'https://cdn.datatables.net/1.10.22/css/jquery.dataTables.min.css'
413+
#'https://cdn.datatables.net/fixedheader/3.1.7/css/fixedHeader.dataTables.min.css'
414+
415+
416+
417+
my $path2jquery = "https://code.jquery.com/";
418+
my $path2jqueryDT = "https://cdn.datatables.net/1.10.22/js/";
419+
my $path2jsFHDT = "https://cdn.datatables.net/fixedheader/3.1.7/js/";
420+
421+
my $path2css = "https://cdn.datatables.net/1.10.22/css/";
422+
my $path2FHcss = "https://cdn.datatables.net/fixedheader/3.1.7/css/";
423+
424+
if ($datatableDir ne ""){
425+
426+
#remove trailing slash from path
427+
$datatableDir =~ s/\/$//;
428+
429+
$path2jquery = $datatableDir."/js/";
430+
$path2jqueryDT = $datatableDir."/js/";
431+
$path2jsFHDT = $datatableDir."/js/";
432+
433+
$path2css = $datatableDir."/css/";
434+
$path2FHcss = $datatableDir."/css/";
435+
}
436+
404437

405438

406439

@@ -414,9 +447,9 @@
414447
\n<head>
415448
\n<meta charset=\"utf-8\">
416449
\n<title>".$outPrefix." knotAnnotSV</title>\n
417-
\n<script type=\"text/javascript\" language=\"javascript\" src='https://code.jquery.com/jquery-3.5.1.js'></script>
418-
\n<script type=\"text/javascript\" language=\"javascript\" src='https://cdn.datatables.net/1.10.22/js/jquery.dataTables.min.js'></script>
419-
\n<script type=\"text/javascript\" language=\"javascript\" src='https://cdn.datatables.net/fixedheader/3.1.7/js/dataTables.fixedHeader.min.js'></script>
450+
\n<script type=\"text/javascript\" language=\"javascript\" src='".$path2jquery."jquery-3.5.1.js'></script>
451+
\n<script type=\"text/javascript\" language=\"javascript\" src='".$path2jqueryDT."jquery.dataTables.min.js'></script>
452+
\n<script type=\"text/javascript\" language=\"javascript\" src='".$path2jsFHDT."dataTables.fixedHeader.min.js'></script>
420453
\n<script>
421454
\$(document).ready(function () {
422455
@@ -455,6 +488,8 @@
455488
var table = \$('#tabFULL').DataTable( {\"order\": [] ,\"lengthMenu\":[ [ 50, 100, -1 ],[ 50, 100, \"All\" ]], \"fixedHeader\": true, \"orderCellsTop\": true, \"oLanguage\": { \"sLengthMenu\": \"Show _MENU_ lines\",\"sInfo\": \"Showing _START_ to _END_ of _TOTAL_ lines\" } } );
456489
var tableFULLSPLIT = \$('#tabFULLSPLIT').DataTable( {\"order\": [] ,\"lengthMenu\":[ [ 50, 100, -1 ],[ 50, 100, \"All\" ]], \"fixedHeader\": true, \"orderCellsTop\": true, \"oLanguage\": { \"sLengthMenu\": \"Show _MENU_ lines\",\"sInfo\": \"Showing _START_ to _END_ of _TOTAL_ lines\" } } );
457490
491+
window.onload = document.getElementById('focusFULLfirst').focus();
492+
458493
});
459494
460495
function openCity(evt, cityName) {
@@ -484,8 +519,8 @@
484519
485520
486521
</script>
487-
\n<link rel=\"stylesheet\" type=\"text/css\" href='https://cdn.datatables.net/1.10.22/css/jquery.dataTables.min.css'>
488-
\n<link rel=\"stylesheet\" type=\"text/css\" href='https://cdn.datatables.net/fixedheader/3.1.7/css/fixedHeader.dataTables.min.css'>
522+
\n<link rel=\"stylesheet\" type=\"text/css\" href='".$path2css."jquery.dataTables.min.css'>
523+
\n<link rel=\"stylesheet\" type=\"text/css\" href='".$path2FHcss."fixedHeader.dataTables.min.css'>
489524
490525
\n<style>
491526
/* Style the tab */
@@ -520,7 +555,7 @@
520555
.tab button.active {
521556
background-color: #ccc;
522557
}
523-
.tab1 button.active {
558+
.tab button:focus {
524559
background-color: #ccc;
525560
}
526561
@@ -614,7 +649,7 @@
614649
my $htmlEndTable = "</tbody>\n</table>\n</div>\n\n\n";
615650

616651
my $htmlEnd = "<div class=\"tab\">\n
617-
<button class=\"tablinks\" onclick=\"openCity(event, 'FULL')\">FULL</button>\n
652+
<button id=\"focusFULLfirst\" class=\"tablinks\" onclick=\"openCity(event, 'FULL')\">FULL</button>\n
618653
<button class=\"tablinks\" onclick=\"openCity(event, 'FULL+SPLIT')\">FULL+SPLIT</button>\n
619654
</div>";
620655

0 commit comments

Comments
 (0)