Clipper/joplin-webclipper/content_scripts/Readability.js
function(table) {
    var rows = 0;
    var columns = 0;
    var trs = table.getElementsByTagName("tr");
    for (var i = 0; i < trs.length; i++) {
      var rowspan = trs[i].getAttribute("rowspan") || 0;
      if (rowspan) {
        rowspan = parseInt(rowspan, 10);
      }
      rows += (rowspan || 1);

      // Now look for column-related info
      var columnsInThisRow = 0;
      var cells = trs[i].getElementsByTagName("td");
      for (var j = 0; j < cells.length; j++) {
        var colspan = cells[j].getAttribute("colspan") || 0;
        if (colspan) {
          colspan = parseInt(colspan, 10);
        }
        columnsInThisRow += (colspan || 1);
      }
      columns = Math.max(columns, columnsInThisRow);
    }
    return {rows: rows, columns: columns};
  }
function(table) {
    var rows = 0;
    var columns = 0;
    var trs = table.getElementsByTagName("tr");
    for (var i = 0; i < trs.length; i++) {
      var rowspan = trs[i].getAttribute("rowspan") || 0;
      if (rowspan) {
        rowspan = parseInt(rowspan, 10);
      }
      rows += (rowspan || 1);

      // Now look for column-related info
      var columnsInThisRow = 0;
      var cells = trs[i].getElementsByTagName("td");
      for (var j = 0; j < cells.length; j++) {
        var colspan = cells[j].getAttribute("colspan") || 0;
        if (colspan) {
          colspan = parseInt(colspan, 10);
        }
        columnsInThisRow += (colspan || 1);
      }
      columns = Math.max(columns, columnsInThisRow);
    }
    return {rows: rows, columns: columns};
  }
function ( table ) { var rows = 0 ; var columns = 0 ; var trs = table . getElementsByTagName ( "tr" ) ; for ( var i = 0 ; i < trs . length ; i ++ ) { var rowspan = trs [ i ] . getAttribute ( "rowspan" ) || 0 ; if ( rowspan ) { rowspan = parseInt ( rowspan , 10 ) ; } rows += ( rowspan || 1 ) ; // Now look for column-related info var columnsInThisRow = 0 ; var cells = trs [ i ] . getElementsByTagName ( "td" ) ; for ( var j = 0 ; j < cells . length ; j ++ ) { var colspan = cells [ j ] . getAttribute ( "colspan" ) || 0 ; if ( colspan ) { colspan = parseInt ( colspan , 10 ) ; } columnsInThisRow += ( colspan || 1 ) ; } columns = Math . max ( columns , columnsInThisRow ) ; } return { rows : rows , columns : columns } ; }
Return an object indicating how many rows and columns this table has.
Return an object indicating how many rows and columns this table has .