「MediaWiki:Gadget-tablesort.js」の版間の差分

No.name2 (トーク | 投稿記録)
標準のソート機能の読み込みを阻止できない場合に、割り当てられたアクションを取り除くようにした
Motodai (トーク | 投稿記録)
resolve warning
 
(他の1人の利用者による、間の1版が非表示)
60行目: 60行目:
           });
           });
         }
         }
      });
      $.tablesorter.addParser({
        id: 'number',
        is: $.tablesorter.isDigit,
        format: function(s) {
          var i = parseFloat(s.replace( /[, ]/g, '').replace('\u2212', '-'));
          return isNaN(i) ? 0 : i;
        },
        type: 'numeric'
       });
       });


75行目: 85行目:
         /* thead要素 */
         /* thead要素 */
         var $thead = $('<thead></thead>');
         var $thead = $('<thead></thead>');
        var setCellSorter = function() {
    var $cell = $(this);
if ($cell.hasClass('unsortable')) {
        $cell.data('sorter', false);
    } else if ($cell.data('sortType') === 'number') {
        $cell.data('sorter', 'number');
    }
};
         while (rows.length) {
         while (rows.length) {
           $tr = $(rows[0]);
           $tr = $(rows[0]);
81行目: 100行目:
             $tr.children().data('sorter', false);
             $tr.children().data('sorter', false);
           } else {
           } else {
            $tr.children().each(function() {
        $tr.children().each(setCellSorter);
              var $cell = $(this);
      }
              if ($cell.hasClass('unsortable')) {
                $cell.data('sorter', false);
              } else if ($cell.data('sortType') === 'number') {
                $cell.data('sorter', 'digit');
              }
            });
          }
           $thead.append($tr);
           $thead.append($tr);
         }
         }