add tablesorter v2.25.0 and pager plugin
This commit is contained in:
parent
eb0eb91631
commit
5dc836730f
Binary file not shown.
After Width: | Height: | Size: 720 B |
Binary file not shown.
After Width: | Height: | Size: 737 B |
Binary file not shown.
After Width: | Height: | Size: 736 B |
Binary file not shown.
After Width: | Height: | Size: 745 B |
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,92 @@
|
||||||
|
/*! Parser: metric *//*
|
||||||
|
* Demo: http://jsfiddle.net/Mottie/abkNM/382/
|
||||||
|
* Set the metric name in the header (defaults to 'm|meter'), e.g.
|
||||||
|
* <th data-metric-name-abbr="b|B" data-metric-name-full="byte|Byte|BYTE">HDD Size</th>
|
||||||
|
* <th data-metric-name="m|meter">Distance</th> <!-- data-metric-name is deprecated in v2.22.2 -->
|
||||||
|
*/
|
||||||
|
/*jshint jquery:true */
|
||||||
|
;( function( $ ) {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
var prefixes = {
|
||||||
|
// 'prefix' : [ base 10, base 2 ]
|
||||||
|
// skipping IEEE 1541 defined prefixes: kibibyte, mebibyte, etc, for now.
|
||||||
|
'Y|Yotta|yotta' : [ 1e24, Math.pow(1024, 8) ], // 1024^8
|
||||||
|
'Z|Zetta|zetta' : [ 1e21, Math.pow(1024, 7) ], // 1024^7
|
||||||
|
'E|Exa|exa' : [ 1e18, Math.pow(1024, 6) ], // 1024^6
|
||||||
|
'P|Peta|peta' : [ 1e15, Math.pow(1024, 5) ], // 1024^5
|
||||||
|
'T|Tera|tera' : [ 1e12, Math.pow(1024, 4) ], // 1024^4
|
||||||
|
'G|Giga|giga' : [ 1e9, Math.pow(1024, 3) ], // 1024^3
|
||||||
|
'M|Mega|mega' : [ 1e6, Math.pow(1024, 2) ], // 1024^2
|
||||||
|
'k|Kilo|kilo' : [ 1e3, 1024 ], // 1024
|
||||||
|
// prefixes below here are rarely, if ever, used in binary
|
||||||
|
'h|hecto' : [ 1e2, 1e2 ],
|
||||||
|
'da|deka' : [ 1e1, 1e1 ],
|
||||||
|
'd|deci' : [ 1e-1, 1e-1 ],
|
||||||
|
'c|centi' : [ 1e-2, 1e-2 ],
|
||||||
|
'm|milli' : [ 1e-3, 1e-3 ],
|
||||||
|
'µ|micro' : [ 1e-6, 1e-6 ],
|
||||||
|
'n|nano' : [ 1e-9, 1e-9 ],
|
||||||
|
'p|pico' : [ 1e-12, 1e-12 ],
|
||||||
|
'f|femto' : [ 1e-15, 1e-15 ],
|
||||||
|
'a|atto' : [ 1e-18, 1e-18 ],
|
||||||
|
'z|zepto' : [ 1e-21, 1e-21 ],
|
||||||
|
'y|yocto' : [ 1e-24, 1e-24 ]
|
||||||
|
},
|
||||||
|
// the \\d+ will not catch digits with spaces, commas or decimals; so use the value from n instead
|
||||||
|
RegLong = '(\\d+)(\\s+)?([Zz]etta|[Ee]xa|[Pp]eta|[Tt]era|[Gg]iga|[Mm]ega|kilo|hecto|deka|deci|centi|milli|micro|nano|pico|femto|atto|zepto|yocto)(',
|
||||||
|
RegAbbr = '(\\d+)(\\s+)?(Z|E|P|T|G|M|k|h|da|d|c|m|µ|n|p|f|a|z|y)(',
|
||||||
|
// make these case-insensitive because we all forget the case for these binary values
|
||||||
|
byteTest = /^[b|bit|byte|o|octet]/i;
|
||||||
|
|
||||||
|
$.tablesorter.addParser({
|
||||||
|
id: 'metric',
|
||||||
|
is: function() {
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
format: function(txt, table, cell, cellIndex) {
|
||||||
|
var unit, isBinary, nameLong, nameAbbr,
|
||||||
|
// default base unit name
|
||||||
|
base = 'm|meter',
|
||||||
|
// process number here to get a numerical format (us or eu)
|
||||||
|
num = $.tablesorter.formatFloat( txt.replace(/[^\w,. \-()]/g, ''), table ),
|
||||||
|
$t = table.config.$headerIndexed[ cellIndex ],
|
||||||
|
regex = $t.data( 'metric' );
|
||||||
|
if ( !regex ) {
|
||||||
|
// stored values
|
||||||
|
unit = ( $t.attr('data-metric-name') || base ).split( '|' );
|
||||||
|
nameLong = $t.attr( 'data-metric-name-full' ) || '';
|
||||||
|
nameAbbr = $t.attr( 'data-metric-name-abbr' ) || '';
|
||||||
|
regex = [ nameLong || unit[1] || unit[0].substring(1), nameAbbr || unit[0] ];
|
||||||
|
isBinary = byteTest.test( regex.join( '' ) );
|
||||||
|
// adding 'data-metric-name-full' which would contain 'byte|BYTE|Byte' etc
|
||||||
|
regex[2] = new RegExp( RegLong + (
|
||||||
|
( nameLong === '' ? '' : nameLong + '|' + nameAbbr ) ||
|
||||||
|
// with data-metric-name='b|byte', we end up with 'b|B|byte|BYTE' - maybe not the best solution for case-insensitivity
|
||||||
|
( ( isBinary ? regex[0].toLowerCase() + '|' + regex[0].toUpperCase() : regex[0] ) + '|' +
|
||||||
|
( isBinary ? regex[1].toLowerCase() + '|' + regex[1].toUpperCase() : regex[1] ) ) ) +
|
||||||
|
')' );
|
||||||
|
// adding 'data-metric-name-abbr' which would contain 'b|B' etc
|
||||||
|
regex[3] = new RegExp( RegAbbr + ( nameAbbr ||
|
||||||
|
( ( isBinary ? regex[1].toLowerCase() + '|' + regex[1].toUpperCase() : regex[1] ) ) ) +
|
||||||
|
')' );
|
||||||
|
$t.data( 'metric', regex );
|
||||||
|
}
|
||||||
|
// find match to full name or abbreviation
|
||||||
|
unit = txt.match( regex[2] ) || txt.match( regex[3] );
|
||||||
|
if ( unit ) {
|
||||||
|
for ( base in prefixes ) {
|
||||||
|
if ( unit[3].match( base ) ) {
|
||||||
|
// exception when using binary prefix
|
||||||
|
// change base for binary use
|
||||||
|
isBinary = byteTest.test( unit[4] ) ? 1 : 0;
|
||||||
|
return num * prefixes[ base ][ isBinary ];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return num;
|
||||||
|
},
|
||||||
|
type: 'numeric'
|
||||||
|
});
|
||||||
|
|
||||||
|
})(jQuery);
|
|
@ -0,0 +1,26 @@
|
||||||
|
/* header */
|
||||||
|
.tablesorter .headerSortUp,
|
||||||
|
.tablesorter .tablesorter-headerSortUp,
|
||||||
|
.tablesorter .tablesorter-headerAsc {
|
||||||
|
background-color:#101010;
|
||||||
|
}
|
||||||
|
.tablesorter .headerSortDown,
|
||||||
|
.tablesorter .tablesorter-headerSortDown,
|
||||||
|
.tablesorter .tablesorter-headerDesc {
|
||||||
|
background-color:#101010;
|
||||||
|
}
|
||||||
|
/* filter widget */
|
||||||
|
.tablesorter .tablesorter-filter-row {
|
||||||
|
background-color: #101010;
|
||||||
|
}
|
||||||
|
.tablesorter .tablesorter-filter-row td {
|
||||||
|
background-color: #101010;
|
||||||
|
border-bottom: #000000 1px solid;
|
||||||
|
}
|
||||||
|
/* filters */
|
||||||
|
.tablesorter input.tablesorter-filter,
|
||||||
|
.tablesorter select.tablesorter-filter {
|
||||||
|
background-color: #000000;
|
||||||
|
border: 1px solid #101010;
|
||||||
|
color: #808080;
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
/* header */
|
||||||
|
.tablesorter .headerSortUp,
|
||||||
|
.tablesorter .tablesorter-headerSortUp,
|
||||||
|
.tablesorter .tablesorter-headerAsc {
|
||||||
|
background-color:#E0E0E0;
|
||||||
|
}
|
||||||
|
.tablesorter .headerSortDown,
|
||||||
|
.tablesorter .tablesorter-headerSortDown,
|
||||||
|
.tablesorter .tablesorter-headerDesc {
|
||||||
|
background-color:#E0E0E0;
|
||||||
|
}
|
||||||
|
/* filter widget */
|
||||||
|
.tablesorter .tablesorter-filter-row {
|
||||||
|
background-color: #E0E0E0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tablesorter .tablesorter-filter-row td {
|
||||||
|
background-color: #E0E0E0;
|
||||||
|
border-bottom: #FFFFFF 1px solid;
|
||||||
|
}
|
||||||
|
/* filters */
|
||||||
|
.tablesorter input.tablesorter-filter,
|
||||||
|
.tablesorter select.tablesorter-filter {
|
||||||
|
background-color: #FFFFFF;
|
||||||
|
border: 1px solid #E0E0E0;
|
||||||
|
}
|
|
@ -0,0 +1,140 @@
|
||||||
|
/* header */
|
||||||
|
.reset {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
.tablesorter {
|
||||||
|
font-family:arimo;
|
||||||
|
margin:0 0 15px 0;
|
||||||
|
}
|
||||||
|
.tablesorter .header,
|
||||||
|
.tablesorter .tablesorter-header {
|
||||||
|
background-position: center right;
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
cursor: pointer;
|
||||||
|
outline: none;
|
||||||
|
}
|
||||||
|
.tablesorter .headerSortUp,
|
||||||
|
.tablesorter .tablesorter-headerSortUp,
|
||||||
|
.tablesorter .tablesorter-headerAsc {
|
||||||
|
background-image: url(/webGui/images/sort-asc.png);
|
||||||
|
}
|
||||||
|
.tablesorter .headerSortDown,
|
||||||
|
.tablesorter .tablesorter-headerSortDown,
|
||||||
|
.tablesorter .tablesorter-headerDesc {
|
||||||
|
background-image: url(/webGui/images/sort-desc.png);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* tbody */
|
||||||
|
.tablesorter td {
|
||||||
|
padding:4px 20px 4px 6px;
|
||||||
|
vertical-align:middle;
|
||||||
|
text-align:justify;
|
||||||
|
}
|
||||||
|
tablesorter tbody tr.tr_last td{
|
||||||
|
padding:8px 20px 8px 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* pager wrapper, div */
|
||||||
|
.tablesorter-pager {
|
||||||
|
padding: 5px;
|
||||||
|
}
|
||||||
|
/* pager wrapper, in thead/tfoot */
|
||||||
|
td.tablesorter-pager {
|
||||||
|
background-color: #e6eeee;
|
||||||
|
margin: 0; /* needed for bootstrap .pager gets a 18px bottom margin */
|
||||||
|
}
|
||||||
|
/* pager navigation arrows */
|
||||||
|
.tablesorter-pager img {
|
||||||
|
vertical-align: middle;
|
||||||
|
margin-right: 2px;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* pager output text */
|
||||||
|
.tablesorter-pager .pagedisplay {
|
||||||
|
padding: 0 5px 0 5px;
|
||||||
|
width: 50px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
.tablesorter-pager select {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
min-width: 40px;
|
||||||
|
max-width: 40px;
|
||||||
|
}
|
||||||
|
/*** css used when "updateArrows" option is true ***/
|
||||||
|
/* the pager itself gets a disabled class when the number of rows is less than the size */
|
||||||
|
.tablesorter-pager.disabled {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
/* hide or fade out pager arrows when the first or last row is visible */
|
||||||
|
.tablesorter-pager .disabled {
|
||||||
|
/* visibility: hidden */
|
||||||
|
opacity: 0.5;
|
||||||
|
filter: alpha(opacity=50);
|
||||||
|
cursor: default;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* filter widget */
|
||||||
|
.tablesorter .tablesorter-filter-row td {
|
||||||
|
line-height: normal;
|
||||||
|
text-align: center; /* center the input */
|
||||||
|
-webkit-transition: line-height 0.1s ease;
|
||||||
|
-moz-transition: line-height 0.1s ease;
|
||||||
|
-o-transition: line-height 0.1s ease;
|
||||||
|
transition: line-height 0.1s ease;
|
||||||
|
}
|
||||||
|
/* optional disabled input styling */
|
||||||
|
.tablesorter .tablesorter-filter-row .disabled {
|
||||||
|
opacity: 0.5;
|
||||||
|
filter: alpha(opacity=50);
|
||||||
|
cursor: not-allowed;
|
||||||
|
}
|
||||||
|
/* filters */
|
||||||
|
.tablesorter input.tablesorter-filter,
|
||||||
|
.tablesorter select.tablesorter-filter {
|
||||||
|
width: 95%;
|
||||||
|
height: auto;
|
||||||
|
margin: 1px auto;
|
||||||
|
padding: 1px;
|
||||||
|
-webkit-box-sizing: border-box;
|
||||||
|
-moz-box-sizing: border-box;
|
||||||
|
box-sizing: border-box;
|
||||||
|
-webkit-transition: height 0.1s ease;
|
||||||
|
-moz-transition: height 0.1s ease;
|
||||||
|
-o-transition: height 0.1s ease;
|
||||||
|
transition: height 0.1s ease;
|
||||||
|
}
|
||||||
|
/* rows hidden by filtering (needed for child rows) */
|
||||||
|
.tablesorter .filtered {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* HOVER ROW highlight colors */
|
||||||
|
table.hover-highlight tbody > tr:hover > td, /* override tablesorter theme row hover */
|
||||||
|
table.hover-highlight tbody > tr.odd:hover > td,
|
||||||
|
table.hover-highlight tbody > tr.even:hover > td {
|
||||||
|
background-color: #9FC2E6;
|
||||||
|
color: #000000;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ************************************************* */
|
||||||
|
/* **** No need to modify the definitions below **** */
|
||||||
|
/* ************************************************* */
|
||||||
|
.hover-highlight td:hover::after, .hover-highlight th:hover::after {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
width: 100%;
|
||||||
|
height: 999em;
|
||||||
|
left: 0;
|
||||||
|
top: -555em;
|
||||||
|
z-index: -1;
|
||||||
|
}
|
||||||
|
/* required styles */
|
||||||
|
.hover-highlight {
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
.hover-highlight td, .hover-highlight th {
|
||||||
|
position: relative;
|
||||||
|
outline: 0;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user