Sha256: 76ea603207b9c21b155668da38de998298178bcc1f4315ac2705c95ebf812c72

Contents?: true

Size: 1.39 KB

Versions: 3

Compression:

Stored size: 1.39 KB

Contents

//sort table
$(function(){
  'use strict';

  // add custom parser to make the stars column to sort according to attr.
  $.tablesorter.addParser({
    id: 'star_scores', // called later when init the tablesorter
    is: function() {
      return false; // return false so this parser is not auto detected
    },
    format: function(s, table, cell, cellIndex) {
      var $cell = $(cell);
      if (cellIndex === 1) {
        return $cell.attr('data-score') || s;
      }
      return s;
    },
    parsed: false,
    type: 'numeric' // Setting type of data...
  });

  $('table').tablesorter({
    headers: {
      1 : { sorter: 'star_scores' } // Telling it to use custom parser...
    },
    sortList: [[0,0]],
  });
});


//ToolTip
$(function () {
  'use strict';
  $("[data-toggle='tooltip']").tooltip();
});

//Hide empty columns
$(document).ready(function() {
  'use strict';
  if (window.chrome && (window.location.protocol === 'file:') )  {
    $('#browseralert').modal();
  }


  $('#sortable_table tr th').each(function(i) {
    //select all tds in this column
    var tds = $(this).parents('table')
    .find('tr td:nth-child(' + (i + 1) + ')');
    //check if all the cells in this column are empty
    //
    if ($(this).hasClass('chart-column')) {
    } else {
      if ($(this).text().trim() === '') {
        //hide header
        $(this).hide();
        //hide cells
        tds.hide();
      }
    }
  });
});

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
genevalidator-1.6.1 aux/files/js/script.js
genevalidator-1.6.0 aux/files/js/script.js
genevalidator-1.5.6 aux/files/js/script.js