Project

General

Profile

« Previous | Next » 

Revision 608947a8

Added by Stephen Beaver almost 10 years ago

Experimental table sorting

View differences:

src/usr/local/www/diag_arp.php
304 304
for ($i = 0; $i < ob_get_level(); $i++) {
305 305
	ob_end_flush();
306 306
}
307

  
307 308
ob_implicit_flush(1);
308 309

  
309 310
// Resolve hostnames and replace Z_ with "".  The intention
......
338 339
$mac_man = load_mac_manufacturer_table();
339 340
?>
340 341
<div class="table-responsive">
341
	<table class="table table-striped table-hover">
342
	<table class="sortable-theme-bootstrap table table-striped table-hover" data-sortable>
342 343
		<thead>
343 344
			<tr>
344 345
				<th><?= gettext("Interface")?></th>
src/usr/local/www/foot.inc
26 26
	<script src="/bootstrap/js/bootstrap.min.js"></script>
27 27
	<script src="/jquery/pfSense.js"></script>
28 28
	<script src="/jquery/pfSenseHelpers.js"></script>
29
	<script src="sortable/sortable.min.js"></script>
29 30

  
30 31
	<script>
31 32
		// Un-hide the "Top of page" icons if the page is larger than the window
src/usr/local/www/head.inc
74 74
	<meta name="viewport" content="width=device-width, initial-scale=1">
75 75
	<link rel="stylesheet" href="/bootstrap/css/pfSense.css" />
76 76
	<link rel="stylesheet" href="font-awesome/css/font-awesome.min.css">
77
	<link rel="stylesheet" href="sortable/sortable-theme-bootstrap.css">
77 78
	<title><?=$tabtitle?></title>
78 79
	<script>var events = events || [];</script>
79 80
</head>
src/usr/local/www/sortable/sortable-theme-bootstrap.css
1
/* line 2, ../sass/_sortable.sass */
2
table[data-sortable] {
3
  border-collapse: collapse;
4
  border-spacing: 0;
5
}
6
/* line 6, ../sass/_sortable.sass */
7
table[data-sortable] th {
8
  vertical-align: bottom;
9
  font-weight: bold;
10
}
11
/* line 10, ../sass/_sortable.sass */
12
table[data-sortable] th, table[data-sortable] td {
13
  text-align: left;
14
  padding: 10px;
15
}
16
/* line 14, ../sass/_sortable.sass */
17
table[data-sortable] th:not([data-sortable="false"]) {
18
  -webkit-user-select: none;
19
  -moz-user-select: none;
20
  -ms-user-select: none;
21
  -o-user-select: none;
22
  user-select: none;
23
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
24
  -webkit-touch-callout: none;
25
  cursor: pointer;
26
}
27
/* line 26, ../sass/_sortable.sass */
28
table[data-sortable] th:after {
29
  content: "";
30
  visibility: hidden;
31
  display: inline-block;
32
  vertical-align: inherit;
33
  height: 0;
34
  width: 0;
35
  border-width: 5px;
36
  border-style: solid;
37
  border-color: transparent;
38
  margin-right: 1px;
39
  margin-left: 10px;
40
  float: right;
41
}
42
/* line 40, ../sass/_sortable.sass */
43
table[data-sortable] th[data-sorted="true"]:after {
44
  visibility: visible;
45
}
46
/* line 43, ../sass/_sortable.sass */
47
table[data-sortable] th[data-sorted-direction="descending"]:after {
48
  border-top-color: inherit;
49
  margin-top: 8px;
50
}
51
/* line 47, ../sass/_sortable.sass */
52
table[data-sortable] th[data-sorted-direction="ascending"]:after {
53
  border-bottom-color: inherit;
54
  margin-top: 3px;
55
}
56

  
57
/* line 5, ../sass/sortable-theme-bootstrap.sass */
58
table[data-sortable].sortable-theme-bootstrap {
59
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
60
  font-size: 14px;
61
  line-height: 20px;
62
  color: #333333;
63
  background: white;
64
}
65
/* line 12, ../sass/sortable-theme-bootstrap.sass */
66
table[data-sortable].sortable-theme-bootstrap thead th {
67
  border-bottom: 2px solid #e0e0e0;
68
}
69
/* line 15, ../sass/sortable-theme-bootstrap.sass */
70
table[data-sortable].sortable-theme-bootstrap tbody td {
71
  border-top: 1px solid #e0e0e0;
72
}
73
/* line 18, ../sass/sortable-theme-bootstrap.sass */
74
table[data-sortable].sortable-theme-bootstrap th[data-sorted="true"] {
75
  color: #3a87ad;
76
  background: #ffffff;
77
  border-bottom-color: #bce8f1;
78
}
79
/* line 23, ../sass/sortable-theme-bootstrap.sass */
80
table[data-sortable].sortable-theme-bootstrap th[data-sorted="true"][data-sorted-direction="descending"]:after {
81
  border-top-color: #3a87ad;
82
}
83
/* line 26, ../sass/sortable-theme-bootstrap.sass */
84
table[data-sortable].sortable-theme-bootstrap th[data-sorted="true"][data-sorted-direction="ascending"]:after {
85
  border-bottom-color: #3a87ad;
86
}
87
/* line 31, ../sass/sortable-theme-bootstrap.sass */
88
table[data-sortable].sortable-theme-bootstrap.sortable-theme-bootstrap-striped tbody > tr:nth-child(odd) > td {
89
  background-color: #f9f9f9;
90
}
src/usr/local/www/sortable/sortable.min.js
1
/*! sortable.js 0.8.0 */
2
(function(){var a,b,c,d,e,f,g;a="table[data-sortable]",d=/^-?[£$¤]?[\d,.]+%?$/,g=/^\s+|\s+$/g,c=["click"],f="ontouchstart"in document.documentElement,f&&c.push("touchstart"),b=function(a,b,c){return null!=a.addEventListener?a.addEventListener(b,c,!1):a.attachEvent("on"+b,c)},e={init:function(b){var c,d,f,g,h;for(null==b&&(b={}),null==b.selector&&(b.selector=a),d=document.querySelectorAll(b.selector),h=[],f=0,g=d.length;g>f;f++)c=d[f],h.push(e.initTable(c));return h},initTable:function(a){var b,c,d,f,g,h;if(1===(null!=(h=a.tHead)?h.rows.length:void 0)&&"true"!==a.getAttribute("data-sortable-initialized")){for(a.setAttribute("data-sortable-initialized","true"),d=a.querySelectorAll("th"),b=f=0,g=d.length;g>f;b=++f)c=d[b],"false"!==c.getAttribute("data-sortable")&&e.setupClickableTH(a,c,b);return a}},setupClickableTH:function(a,d,f){var g,h,i,j,k,l;for(i=e.getColumnType(a,f),h=function(b){var c,g,h,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D;if(b.handled===!0)return!1;for(b.handled=!0,m="true"===this.getAttribute("data-sorted"),n=this.getAttribute("data-sorted-direction"),h=m?"ascending"===n?"descending":"ascending":i.defaultSortDirection,p=this.parentNode.querySelectorAll("th"),s=0,w=p.length;w>s;s++)d=p[s],d.setAttribute("data-sorted","false"),d.removeAttribute("data-sorted-direction");if(this.setAttribute("data-sorted","true"),this.setAttribute("data-sorted-direction",h),o=a.tBodies[0],l=[],m){for(D=o.rows,v=0,z=D.length;z>v;v++)g=D[v],l.push(g);for(l.reverse(),B=0,A=l.length;A>B;B++)k=l[B],o.appendChild(k)}else{for(r=null!=i.compare?i.compare:function(a,b){return b-a},c=function(a,b){return a[0]===b[0]?a[2]-b[2]:i.reverse?r(b[0],a[0]):r(a[0],b[0])},C=o.rows,j=t=0,x=C.length;x>t;j=++t)k=C[j],q=e.getNodeValue(k.cells[f]),null!=i.comparator&&(q=i.comparator(q)),l.push([q,k,j]);for(l.sort(c),u=0,y=l.length;y>u;u++)k=l[u],o.appendChild(k[1])}return"function"==typeof window.CustomEvent&&"function"==typeof a.dispatchEvent?a.dispatchEvent(new CustomEvent("Sortable.sorted",{bubbles:!0})):void 0},l=[],j=0,k=c.length;k>j;j++)g=c[j],l.push(b(d,g,h));return l},getColumnType:function(a,b){var c,d,f,g,h,i,j,k,l,m,n;if(d=null!=(l=a.querySelectorAll("th")[b])?l.getAttribute("data-sortable-type"):void 0,null!=d)return e.typesObject[d];for(m=a.tBodies[0].rows,h=0,j=m.length;j>h;h++)for(c=m[h],f=e.getNodeValue(c.cells[b]),n=e.types,i=0,k=n.length;k>i;i++)if(g=n[i],g.match(f))return g;return e.typesObject.alpha},getNodeValue:function(a){var b;return a?(b=a.getAttribute("data-value"),null!==b?b:"undefined"!=typeof a.innerText?a.innerText.replace(g,""):a.textContent.replace(g,"")):""},setupTypes:function(a){var b,c,d,f;for(e.types=a,e.typesObject={},f=[],c=0,d=a.length;d>c;c++)b=a[c],f.push(e.typesObject[b.name]=b);return f}},e.setupTypes([{name:"numeric",defaultSortDirection:"descending",match:function(a){return a.match(d)},comparator:function(a){return parseFloat(a.replace(/[^0-9.-]/g,""),10)||0}},{name:"date",defaultSortDirection:"ascending",reverse:!0,match:function(a){return!isNaN(Date.parse(a))},comparator:function(a){return Date.parse(a)||0}},{name:"alpha",defaultSortDirection:"ascending",match:function(){return!0},compare:function(a,b){return a.localeCompare(b)}}]),setTimeout(e.init,0),"function"==typeof define&&define.amd?define(function(){return e}):"undefined"!=typeof exports?module.exports=e:window.Sortable=e}).call(this);

Also available in: Unified diff