From b89c7ae363730bf43e72beaafa0af5162ac89929 Mon Sep 17 00:00:00 2001 From: vonavi Date: Tue, 4 Mar 2014 21:27:57 +0200 Subject: [PATCH] Add the support of Tablesorter to the website. --- _assets/javascripts/custom.js | 9 ++++- _assets/stylesheets/less/table.less | 63 +++++++++++++++++++++++++++++ _assets/stylesheets/theme.css.less | 1 + _layouts/default.html | 4 ++ 4 files changed, 75 insertions(+), 2 deletions(-) create mode 100644 _assets/stylesheets/less/table.less diff --git a/_assets/javascripts/custom.js b/_assets/javascripts/custom.js index 314a62a..11413c6 100644 --- a/_assets/javascripts/custom.js +++ b/_assets/javascripts/custom.js @@ -1,5 +1,5 @@ -/* Fix the position of chess board while scrolling */ $(function() { + /* Fix the position of chess board while scrolling */ if (obj = $('#GameWrapper')) { obj.affix({ offset: { @@ -8,7 +8,12 @@ $(function() { } } }) - } + }; + + /* Sort a tournament table with tablesorter */ + $('.tablesorter').tablesorter({ + widgets: ['zebra'] + }); }) /* Stylize pgn4web elements by Bootstrap */ diff --git a/_assets/stylesheets/less/table.less b/_assets/stylesheets/less/table.less new file mode 100644 index 0000000..65ff0a9 --- /dev/null +++ b/_assets/stylesheets/less/table.less @@ -0,0 +1,63 @@ +/* Tablesorter */ + +table.tablesorter { + background-color: #cdcdcd; + border-spacing: 1px; + border-collapse: separate; + + thead tr th, tfoot tr th { + background-color: #e6eeee; + border: 1px solid #fff !important; + } + + thead tr { + .header { + padding-right: 21px; + background-image: url("/assets/img/tablesorter/bg.gif"); + background-repeat: no-repeat; + background-position: center right; + cursor: pointer; + } + + .headerSortUp { + background-image: url("/assets/img/tablesorter/asc.gif"); + } + + .headerSortDown { + background-image: url("/assets/img/tablesorter/desc.gif"); + } + + .headerSortDown, .headerSortUp { + background-color: #8dbdd8; + } + } + + tfoot td, tbody td { + background-color: #fff; + border: none; + } + tbody tr.odd td { + background-color: #f0f0f6; + } +} + + +/* Tournament table */ + +table.tournament { + thead > tr > th, thead > tr > td, + tfoot > tr > th, tfoot > tr > td, + tbody > tr > th, tbody > tr > td { + padding: 2px; + } + + tbody > tr { + > .score, > .diagonal { + min-width: 25px; + text-align: center; + } + > .diagonal { + background: black !important; + } + } +} diff --git a/_assets/stylesheets/theme.css.less b/_assets/stylesheets/theme.css.less index 15e95e6..751480f 100644 --- a/_assets/stylesheets/theme.css.less +++ b/_assets/stylesheets/theme.css.less @@ -1 +1,2 @@ //= require less/pgn4web +//= require less/table diff --git a/_layouts/default.html b/_layouts/default.html index 303174d..ea641ed 100644 --- a/_layouts/default.html +++ b/_layouts/default.html @@ -35,6 +35,10 @@ {% javascript bootstrap %} {% javascript holder %} + + {% javascript jquery.tablesorter %} + {% javascript jquery.metadata %} + {% javascript custom %}