...
 
Commits (12)
##Description
## Description
Enable the "Make tables responsive" text format filter to display field tables responsively using the [Tablesaw Library](https://www.filamentgroup.com/lab/tablesaw.html).
Enable the "Make tables responsive" text format filter to display field
tables responsively using the
[Tablesaw Library](https://www.filamentgroup.com/lab/tablesaw.html).
* For a full description of the module, visit the project page:
https://drupal.org/project/responsive_tables_filter
##Basic Usage
## Basic Usage
0. Place this module in your /modules directory and enable it.
1. Go to admin/config/content/formats.
2. Enable the filter "Responsive Tables Filter" on any text format for which you
want to make tables responsive (e.g., Basic HTML).
3. Verify the text format(s) allow HTML table tags. If you are using the standard
"Limit HTML tags" filter (admin/config/content/formats), all of the following
should be allowed:
3. Verify the text format(s) allow HTML table tags. If you are using the
standard "Limit HTML tags" filter (admin/config/content/formats), all of the
following should be allowed:
`<table> <th> <tr> <td> <thead> <tbody> <tfoot>` (if you want class attributes
supplied by the user to co-exist, use the syntax `<table class>` here).
Any fields that use the text format(s) which have tables in them will now be
responsive.
The 8.x version of this module currently automatically makes Views tables responsive.
The 8.x version of this module currently automatically makes Views tables
responsive.
##FAQ
Q: Can I override the tablesaw CSS?
A: Yes, but any CSS you add needs to include the tablesaw naming patterns so that the Javascript can find elements.
Q: Text filter sets a default Tablesaw mode. Can I override this on per-table
basis in the WYSIWYG?
Q: Can I target specific tables within nodes?
A: The Drupal 8 version of this module does not yet support xpath query.
A: Yes. Add `class="tablesaw-stack"`, `class="tablesaw-columntoggle"`, or
`class="tablesaw-swipe"` to make a single table override the default.
Q: Can I do anything to have tablesaw not be applied to a table (WYSIWYG Only).
......@@ -38,8 +39,3 @@ A: Yes! Add the class `no-tablesaw` to the table.
Current maintainers:
- Mark Fullmer (mark_fullmer) - https://www.drupal.org/u/mark_fullmer
views_enabled: '0'
views_tablesaw_mode: stack
responsive_tables_filter.settings:
type: config_object
mapping:
views_enabled:
type: string
label: "Views enabled"
views_tablesaw_mode:
type: string
label: "Views tablesaw mode"
/*! Tablesaw - v3.1.2 - 2019-03-19
* https://github.com/filamentgroup/tablesaw
* Copyright (c) 2019 Filament Group; Licensed MIT */
.tablesaw {
width: 100%;
max-width: 100%;
empty-cells: show;
border-collapse: collapse;
border: 0;
padding: 0;
}
.tablesaw * {
box-sizing: border-box;
}
.tablesaw-btn {
border: 1px solid #ccc;
border-radius: .25em;
background: none;
box-shadow: 0 1px 0 rgba(255,255,255,1);
color: #4a4a4a;
cursor: pointer;
display: inline-block;
margin: 0;
padding: .5em .85em .4em .85em;
position: relative;
text-align: center;
text-decoration: none;
text-transform: capitalize;
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
}
a.tablesaw-btn {
color: #1c95d4;
}
.tablesaw-btn:hover {
text-decoration: none;
}
/* Default radio/checkbox styling horizonal controlgroups. */
.tablesaw-btn:active {
background-color: #ddd;
}
@supports (box-shadow: none ) {
.tablesaw-btn:focus {
background-color: #fff;
outline: none;
}
.tablesaw-btn:focus {
box-shadow: 0 0 .35em #4faeef !important;
}
}
.tablesaw-btn-select select {
background: none;
border: none;
display: inline-block;
position: absolute;
left: 0;
top: 0;
margin: 0;
width: 100%;
height: 100%;
z-index: 2;
min-height: 1em;
opacity: 0;
color: transparent;
}
.tablesaw-btn select option {
background: #fff;
color: #000;
}
.tablesaw-btn {
display: inline-block;
width: auto;
height: auto;
position: relative;
top: 0;
}
.tablesaw-btn.btn-small {
font-size: 1.0625em;
line-height: 19px;
padding: .3em 1em .3em 1em;
}
.tablesaw-btn.btn-micro {
font-size: .8125em;
padding: .4em .7em .25em .7em;
}
.tablesaw-btn-select {
padding-right: 1.5em;
text-align: left;
display: inline-block;
color: #4d4d4d;
padding-right: 2.5em;
min-width: 7.25em;
}
.tablesaw-btn-select:after {
content: " ";
position: absolute;
background: none;
background-repeat: no-repeat;
background-position: .25em .45em;
content: "\25bc";
font-size: .55em;
padding-top: 1.2em;
padding-left: 1em;
left: auto;
right: 0;
margin: 0;
top: 0;
bottom: 0;
width: 1.8em;
}
.tablesaw-btn-select.btn-small:after,
.tablesaw-btn-select.btn-micro:after {
width: 1.2em;
font-size: .5em;
padding-top: 1em;
padding-right: .5em;
line-height: 1.65;
background: none;
box-shadow: none;
border-left-width: 0;
}
/* Column navigation buttons for swipe and columntoggle tables */
.tablesaw-advance .tablesaw-btn {
-webkit-appearance: none;
-moz-appearance: none;
box-sizing: border-box;
text-shadow: 0 1px 0 #fff;
border-radius: .25em;
}
.tablesaw-advance .tablesaw-btn.btn-micro {
font-size: .8125em;
padding: .3em .7em .25em .7em;
}
.tablesaw-advance a.tablesaw-nav-btn:first-child {
margin-left: 0;
}
.tablesaw-advance a.tablesaw-nav-btn:last-child {
margin-right: 0;
}
.tablesaw-advance a.tablesaw-nav-btn {
display: inline-block;
overflow: hidden;
width: 1.8em;
height: 1.8em;
background-position: 50% 50%;
margin-left: .25em;
margin-right: .25em;
position: relative;
text-indent: -9999px;
}
.tablesaw-advance a.tablesaw-nav-btn.left:before,
.tablesaw-advance a.tablesaw-nav-btn.right:before,
.tablesaw-advance a.tablesaw-nav-btn.down:before,
.tablesaw-advance a.tablesaw-nav-btn.up:before {
content: "\0020";
overflow: hidden;
width: 0;
height: 0;
position: absolute;
}
.tablesaw-advance a.tablesaw-nav-btn.down:before {
left: .5em;
top: .65em;
border-left: 5px solid transparent;
border-right: 5px solid transparent;
border-top: 5px solid #808080;
}
.tablesaw-advance a.tablesaw-nav-btn.up:before {
left: .5em;
top: .65em;
border-left: 5px solid transparent;
border-right: 5px solid transparent;
border-bottom: 5px solid #808080;
}
.tablesaw-advance a.tablesaw-nav-btn.left:before,
.tablesaw-advance a.tablesaw-nav-btn.right:before {
top: .45em;
border-top: 5px solid transparent;
border-bottom: 5px solid transparent;
}
.tablesaw-advance a.tablesaw-nav-btn.left:before {
left: .6em;
border-right: 5px solid #808080;
}
.tablesaw-advance a.tablesaw-nav-btn.right:before {
left: .7em;
border-left: 5px solid #808080;
}
.tablesaw-advance a.tablesaw-nav-btn.disabled {
opacity: .25;
cursor: default;
pointer-events: none;
}
/* Table Toolbar */
.tablesaw-bar {
clear: both;
}
.tablesaw-bar * {
box-sizing: border-box;
}
.tablesaw-bar-section {
float: left;
}
.tablesaw-bar-section label {
font-size: .875em;
padding: .5em 0;
clear: both;
display: block;
color: #888;
margin-right: .5em;
text-transform: uppercase;
}
.tablesaw-btn,
.tablesaw-enhanced .tablesaw-btn {
margin-top: .5em;
margin-bottom: .5em;
}
.tablesaw-btn-select,
.tablesaw-enhanced .tablesaw-btn-select {
margin-bottom: 0;
}
/* TODO */
.tablesaw-bar .tablesaw-bar-section .tablesaw-btn {
margin-left: .4em;
margin-top: 0;
text-transform: uppercase;
border: none;
box-shadow: none;
background: transparent;
font-size: 1em;
padding-left: .3em;
}
.tablesaw-bar .tablesaw-bar-section .btn-select {
min-width: 0;
}
.tablesaw-bar .tablesaw-bar-section .btn-select:after {
padding-top: .9em;
}
.tablesaw-bar .tablesaw-bar-section select {
color: #888;
text-transform: none;
background: transparent;
}
.tablesaw-bar-section ~ table {
clear: both;
}
.tablesaw-bar-section .abbreviated {
display: inline;
}
.tablesaw-bar-section .longform {
display: none;
}
@media (min-width: 24em) {
.tablesaw-bar-section .abbreviated {
display: none;
}
.tablesaw-bar-section .longform {
display: inline;
}
}
.tablesaw th,
.tablesaw td {
padding: .5em .7em;
text-align: left;
vertical-align: middle;
}
.tablesaw-sortable-btn {
/* same as cell padding above */
padding: .5em .7em;
}
.tablesaw thead th {
text-align: left;
}
/* Table rows have a gray bottom stroke by default */
.tablesaw-row-border tr {
border-bottom: 1px solid #dfdfdf;
}
/* Zebra striping */
.tablesaw-row-zebra tr:nth-child(2n) {
background-color: #f8f8f8;
}
.tablesaw caption {
text-align: left;
margin: .59375em 0;
}
.tablesaw-swipe .tablesaw-swipe-cellpersist {
border-right: 2px solid #e4e1de;
}
.tablesaw-swipe-shadow .tablesaw-swipe-cellpersist {
border-right-width: 1px;
}
.tablesaw-swipe-shadow .tablesaw-swipe-cellpersist {
box-shadow: 3px 0 4px -1px #e4e1de;
}
.tablesaw-stack td .tablesaw-cell-label,
.tablesaw-stack th .tablesaw-cell-label {
display: none;
}
/* Mobile first styles: Begin with the stacked presentation at narrow widths */
/* Support note IE9+: @media only all */
@media only all {
/* Show the table cells as a block level element */
.tablesaw-stack {
clear: both;
}
.tablesaw-stack td,
.tablesaw-stack th {
text-align: left;
display: block;
}
.tablesaw-stack tr {
clear: both;
display: table-row;
}
/* Make the label elements a percentage width */
.tablesaw-stack td .tablesaw-cell-label,
.tablesaw-stack th .tablesaw-cell-label {
display: inline-block;
padding: 0 .6em 0 0;
width: 30%;
}
/* For grouped headers, have a different style to visually separate the levels by classing the first label in each col group */
.tablesaw-stack th .tablesaw-cell-label-top,
.tablesaw-stack td .tablesaw-cell-label-top {
display: block;
padding: .4em 0;
margin: .4em 0;
}
.tablesaw-cell-label {
display: block;
}
/* Avoid double strokes when stacked */
.tablesaw-stack tbody th.group {
margin-top: -1px;
}
/* Avoid double strokes when stacked */
.tablesaw-stack th.group b.tablesaw-cell-label {
display: none !important;
}
}
@media (max-width: 39.9375em) {
/* Table rows have a gray bottom stroke by default */
.tablesaw-stack tbody tr {
display: block;
width: 100%;
border-bottom: 1px solid #dfdfdf;
}
.tablesaw-stack thead td,
.tablesaw-stack thead th {
display: none;
}
.tablesaw-stack tbody td,
.tablesaw-stack tbody th {
display: block;
float: left;
clear: left;
width: 100%;
}
.tablesaw-cell-label {
vertical-align: top;
}
.tablesaw-cell-content {
display: inline-block;
max-width: 67%;
}
.tablesaw-stack .tablesaw-stack-block .tablesaw-cell-label,
.tablesaw-stack .tablesaw-stack-block .tablesaw-cell-content {
display: block;
width: 100%;
max-width: 100%;
padding: 0;
}
.tablesaw-stack td:empty,
.tablesaw-stack th:empty {
display: none;
}
}
/* Media query to show as a standard table at 560px (35em x 16px) or wider */
@media (min-width: 40em) {
.tablesaw-stack tr {
display: table-row;
}
/* Show the table header rows */
.tablesaw-stack td,
.tablesaw-stack th,
.tablesaw-stack thead td,
.tablesaw-stack thead th {
display: table-cell;
margin: 0;
}
/* Hide the labels in each cell */
.tablesaw-stack td .tablesaw-cell-label,
.tablesaw-stack th .tablesaw-cell-label {
display: none !important;
}
}
.tablesaw-fix-persist {
table-layout: fixed;
}
@media only all {
/* Unchecked manually: Always hide */
.tablesaw-swipe th.tablesaw-swipe-cellhidden,
.tablesaw-swipe td.tablesaw-swipe-cellhidden {
display: none;
}
}
.tablesaw-overflow {
position: relative;
width: 100%;
overflow-x: auto;
-webkit-overflow-scrolling: touch;
/* More in skin.css */
}
.tablesaw-overflow > .tablesaw {
margin-top: 2px;
/* sortable focus rings are clipped */
}
/* Used for a11y text on button: "Columns" */
.tablesaw-columntoggle-btn span {
text-indent: -9999px;
display: inline-block;
}
.tablesaw-columntoggle-btnwrap {
position: relative;
/* for dialog positioning */
}
.tablesaw-columntoggle-btnwrap .dialog-content {
padding: .5em;
}
.tablesaw-columntoggle tbody td {
line-height: 1.5;
}
/* Remove top/bottom margins around the fieldcontain on check list */
.tablesaw-columntoggle-popup {
display: none;
}
.tablesaw-columntoggle-btnwrap.visible .tablesaw-columntoggle-popup {
display: block;
position: absolute;
top: 2em;
right: 0;
background-color: #fff;
padding: .5em .8em;
border: 1px solid #ccc;
box-shadow: 0 1px 2px #ccc;
border-radius: .2em;
z-index: 1;
}
.tablesaw-columntoggle-popup fieldset {
margin: 0;
}
/* Hide all prioritized columns by default */
@media only all {
.tablesaw-columntoggle th.tablesaw-priority-6,
.tablesaw-columntoggle td.tablesaw-priority-6,
.tablesaw-columntoggle th.tablesaw-priority-5,
.tablesaw-columntoggle td.tablesaw-priority-5,
.tablesaw-columntoggle th.tablesaw-priority-4,
.tablesaw-columntoggle td.tablesaw-priority-4,
.tablesaw-columntoggle th.tablesaw-priority-3,
.tablesaw-columntoggle td.tablesaw-priority-3,
.tablesaw-columntoggle th.tablesaw-priority-2,
.tablesaw-columntoggle td.tablesaw-priority-2,
.tablesaw-columntoggle th.tablesaw-priority-1,
.tablesaw-columntoggle td.tablesaw-priority-1,
.tablesaw-columntoggle th.tablesaw-priority-0,
.tablesaw-columntoggle td.tablesaw-priority-0 {
display: none;
}
}
.tablesaw-columntoggle-btnwrap .dialog-content {
top: 0 !important;
right: 1em;
left: auto !important;
width: 12em;
max-width: 18em;
margin: -.5em auto 0;
}
.tablesaw-columntoggle-btnwrap .dialog-content:focus {
outline-style: none;
}
/* Preset breakpoints if "" class added to table */
/* Show priority 1 at 320px (20em x 16px) */
@media (min-width: 20em) {
.tablesaw-columntoggle th.tablesaw-priority-1,
.tablesaw-columntoggle td.tablesaw-priority-1 {
display: table-cell;
}
}
/* Show priority 2 at 480px (30em x 16px) */
@media (min-width: 30em) {
.tablesaw-columntoggle th.tablesaw-priority-2,
.tablesaw-columntoggle td.tablesaw-priority-2 {
display: table-cell;
}
}
/* Show priority 3 at 640px (40em x 16px) */
@media (min-width: 40em) {
.tablesaw-columntoggle th.tablesaw-priority-3,
.tablesaw-columntoggle td.tablesaw-priority-3 {
display: table-cell;
}
.tablesaw-columntoggle tbody td {
line-height: 2;
}
}
/* Show priority 4 at 800px (50em x 16px) */
@media (min-width: 50em) {
.tablesaw-columntoggle th.tablesaw-priority-4,
.tablesaw-columntoggle td.tablesaw-priority-4 {
display: table-cell;
}
}
/* Show priority 5 at 960px (60em x 16px) */
@media (min-width: 60em) {
.tablesaw-columntoggle th.tablesaw-priority-5,
.tablesaw-columntoggle td.tablesaw-priority-5 {
display: table-cell;
}
}
/* Show priority 6 at 1,120px (70em x 16px) */
@media (min-width: 70em) {
.tablesaw-columntoggle th.tablesaw-priority-6,
.tablesaw-columntoggle td.tablesaw-priority-6 {
display: table-cell;
}
}
@media only all {
/* Unchecked manually: Always hide */
.tablesaw-columntoggle th.tablesaw-toggle-cellhidden,
.tablesaw-columntoggle td.tablesaw-toggle-cellhidden {
display: none;
}
/* Checked manually: Always show */
.tablesaw-columntoggle th.tablesaw-toggle-cellvisible,
.tablesaw-columntoggle td.tablesaw-toggle-cellvisible {
display: table-cell;
}
}
.tablesaw-columntoggle-popup .tablesaw-btn-group > label {
display: block;
padding: .2em 0;
white-space: nowrap;
cursor: default;
}
.tablesaw-columntoggle-popup .tablesaw-btn-group > label input {
margin-right: .8em;
}
.tablesaw-sortable-head {
position: relative;
vertical-align: top;
}
/* Override */
.tablesaw .tablesaw-sortable-head {
padding: 0;
}
.tablesaw-sortable-btn {
min-width: 100%;
color: inherit;
background: transparent;
border: 0;
text-align: inherit;
font: inherit;
text-transform: inherit;
}
.tablesaw-sortable-arrow:after {
display: inline-block;
width: 10px;
height: 14px;
content: " ";
margin-left: .3125em;
}
.tablesaw-sortable-ascending .tablesaw-sortable-arrow:after,
.tablesaw-sortable-descending .tablesaw-sortable-arrow:after {
content: "\0020";
}
.tablesaw-sortable-ascending .tablesaw-sortable-arrow:after {
content: "\2191";
}
.tablesaw-sortable-descending .tablesaw-sortable-arrow:after {
content: "\2193";
}
.tablesaw-advance {
float: right;
}
.tablesaw-advance.minimap {
margin-right: .4em;
}
.tablesaw-advance-dots {
float: left;
margin: 0;
padding: 0;
list-style: none;
}
.tablesaw-advance-dots li {
display: table-cell;
margin: 0;
padding: .4em .2em;
}
.tablesaw-advance-dots li i {
width: .25em;
height: .25em;
background: #555;
border-radius: 100%;
display: inline-block;
}
.tablesaw-advance-dots-hide {
opacity: .25;
cursor: default;
pointer-events: none;
}
/*! Tablesaw - v3.0.0-beta.1 - 2016-09-19
* https://github.com/filamentgroup/tablesaw
* Copyright (c) 2016 Filament Group; Licensed MIT */
table.tablesaw {
empty-cells: show;
max-width: 100%;
width: 100%;
}
.tablesaw {
border-collapse: collapse;
width: 100%;
}
/* Structure */
.tablesaw {
border: 0;
padding: 0;
}
.tablesaw th,
.tablesaw td {
box-sizing: border-box;
padding: .5em .7em;
}
.tablesaw thead tr:first-child th {
padding-top: .9em;
padding-bottom: .7em;
}
/* Table rows have a gray bottom stroke by default */
.tablesaw-stack tbody tr {
border-bottom: 1px solid #dfdfdf;
}
.tablesaw-stack td .tablesaw-cell-label,
.tablesaw-stack th .tablesaw-cell-label {
display: none;
}
/* Mobile first styles: Begin with the stacked presentation at narrow widths */
@media only all {
/* Show the table cells as a block level element */
.tablesaw-stack td,
.tablesaw-stack th {
text-align: left;
display: block;
}
.tablesaw-stack tr {
clear: both;
display: table-row;
}
/* Make the label elements a percentage width */
.tablesaw-stack td .tablesaw-cell-label,
.tablesaw-stack th .tablesaw-cell-label {
display: block;
padding: 0 .6em 0 0;
width: 30%;
display: inline-block;
}
/* For grouped headers, have a different style to visually separate the levels by classing the first label in each col group */
.tablesaw-stack th .tablesaw-cell-label-top,
.tablesaw-stack td .tablesaw-cell-label-top {
display: block;
padding: .4em 0;
margin: .4em 0;
}
.tablesaw-cell-label {
display: block;
}
/* Avoid double strokes when stacked */
.tablesaw-stack tbody th.group {
margin-top: -1px;
}
/* Avoid double strokes when stacked */
.tablesaw-stack th.group b.tablesaw-cell-label {
display: none !important;
}
}
@media (max-width: 39.9375em) {
.tablesaw-stack thead td,
.tablesaw-stack thead th {
display: none;
}
.tablesaw-stack tbody td,
.tablesaw-stack tbody th {
clear: left;
float: left;
width: 100%;
}
.tablesaw-cell-label {
vertical-align: top;
}
.tablesaw-cell-content {
max-width: 67%;
display: inline-block;
}
.tablesaw-stack td:empty,
.tablesaw-stack th:empty {
display: none;
}
}
/* Media query to show as a standard table at 560px (35em x 16px) or wider */
@media (min-width: 40em) {
.tablesaw-stack tr {
display: table-row;
}
/* Show the table header rows */
.tablesaw-stack td,
.tablesaw-stack th,
.tablesaw-stack thead td,
.tablesaw-stack thead th {
display: table-cell;
margin: 0;
}
/* Hide the labels in each cell */
.tablesaw-stack td .tablesaw-cell-label,
.tablesaw-stack th .tablesaw-cell-label {
display: none !important;
}
}
\ No newline at end of file
;(function( $ ) {
Drupal.behaviors.responsiveTablesFilter = {
attach: function (context, settings) {
// DOM-ready auto-init of plugins.
// Many plugins bind to an "enhance" event to init themselves on dom ready, or when new markup is inserted into the DOM
$( function(){
/*! Tablesaw - v3.0.0-beta.1 - 2016-09-19
* https://github.com/filamentgroup/tablesaw
* Copyright (c) 2016 Filament Group; Licensed MIT
*/
$( document ).trigger( "enhance.tablesaw" );
});
}
/*! Tablesaw - v3.1.2 - 2019-03-19
* https://github.com/filamentgroup/tablesaw
* Copyright (c) 2019 Filament Group; Licensed MIT */
(function (win) {
"use strict";
// DOM-ready auto-init of plugins.
// Many plugins bind to an "enhance" event to init themselves on dom ready, or when new markup is inserted into the DOM
// Use raw DOMContentLoaded instead of shoestring (may have issues in Android 2.3, exhibited by stack table)
if (!("Tablesaw" in win)) {
throw new Error("Tablesaw library not found.");
}
})( shoestring || jQuery );
if (!("init" in Tablesaw)) {
throw new Error("Your tablesaw-init.js is newer than the core Tablesaw version.");
}
Tablesaw.init();
})(typeof window !== "undefined" ? window : this);
\ No newline at end of file
!function (t, e) { "function" == typeof define && define.amd ? define(["jquery"], function (a) { return t.Tablesaw = e(a, t) }) : "object" == typeof exports ? module.exports = e("document" in t ? require("jquery") : require("jquery")(t), t) : t.Tablesaw = e(jQuery, t) }("undefined" != typeof window ? window : this, function (t, e) { "use strict"; var a = e.document, s = /complete|loaded/.test(a.readyState); a.addEventListener("DOMContentLoaded", function () { s = !0 }); var n, i, o, l, r, c, h, d, u, b = { i18n: { modeStack: "Stack", modeSwipe: "Swipe", modeToggle: "Toggle", modeSwitchColumnsAbbreviated: "Cols", modeSwitchColumns: "Columns", columnToggleButton: "Columns", columnToggleError: "No eligible columns.", sort: "Sort", swipePreviousColumn: "Previous column", swipeNextColumn: "Next column" }, mustard: "head" in a && (!e.blackberry || e.WebKitPoint) && !e.operamini, $: t, _init: function (t) { b.$(t || a).trigger("enhance.tablesaw") }, init: function (t) { (s = s || /complete|loaded/.test(a.readyState)) ? b._init(t) : "addEventListener" in a && a.addEventListener("DOMContentLoaded", function () { b._init(t) }) } }; return t(a).on("enhance.tablesaw", function () { "undefined" != typeof TablesawConfig && TablesawConfig.i18n && (b.i18n = t.extend(b.i18n, TablesawConfig.i18n || {})), b.i18n.modes = [b.i18n.modeStack, b.i18n.modeSwipe, b.i18n.modeToggle] }), b.mustard && t(a.documentElement).addClass("tablesaw-enhanced"), function () { var s = "tablesaw-bar", n = { create: "tablesawcreate", destroy: "tablesawdestroy", refresh: "tablesawrefresh", resize: "tablesawresize" }, i = {}; b.events = n; var o = function (e) { if (!e) throw new Error("Tablesaw requires an element."); this.table = e, this.$table = t(e), this.$thead = this.$table.children().filter("thead").eq(0), this.$tbody = this.$table.children().filter("tbody"), this.mode = this.$table.attr("data-tablesaw-mode") || "stack", this.$toolbar = null, this.attributes = { subrow: "data-tablesaw-subrow", ignorerow: "data-tablesaw-ignorerow" }, this.init() }; o.prototype.init = function () { if (!this.$thead.length) throw new Error("tablesaw: a <thead> is required, but none was found."); if (!this.$thead.find("th").length) throw new Error("tablesaw: no header cells found. Are you using <th> inside of <thead>?"); this.$table.attr("id") || this.$table.attr("id", "tablesaw-" + Math.round(1e4 * Math.random())), this.createToolbar(), this._initCells(), this.$table.data("tablesaw", this), this.$table.trigger(n.create, [this]) }, o.prototype.getConfig = function (e) { var a = t.extend(i, e || {}); return t.extend(a, "undefined" != typeof TablesawConfig ? TablesawConfig : {}) }, o.prototype._getPrimaryHeaderRow = function () { return this._getHeaderRows().eq(0) }, o.prototype._getHeaderRows = function () { return this.$thead.children().filter("tr").filter(function () { return !t(this).is("[data-tablesaw-ignorerow]") }) }, o.prototype._getRowIndex = function (t) { return t.prevAll().length }, o.prototype._getHeaderRowIndeces = function () { var e = this, a = []; return this._getHeaderRows().each(function () { a.push(e._getRowIndex(t(this))) }), a }, o.prototype._getPrimaryHeaderCells = function (t) { return (t || this._getPrimaryHeaderRow()).find("th") }, o.prototype._$getCells = function (e) { var a = this; return t(e).add(e.cells).filter(function () { var e = t(this), s = e.parent(), n = e.is("[colspan]"); return !(s.is("[" + a.attributes.subrow + "]") || s.is("[" + a.attributes.ignorerow + "]") && n) }) }, o.prototype._getVisibleColspan = function () { var e = 0; return this._getPrimaryHeaderCells().each(function () { var a = t(this); "none" !== a.css("display") && (e += parseInt(a.attr("colspan"), 10) || 1) }), e }, o.prototype.getColspanForCell = function (e) { var a = this._getVisibleColspan(), s = 0; return e.closest("tr").data("tablesaw-rowspanned") && s++ , e.siblings().each(function () { var e = t(this), a = parseInt(e.attr("colspan"), 10) || 1; "none" !== e.css("display") && (s += a) }), a - s }, o.prototype.isCellInColumn = function (e, a) { return t(e).add(e.cells).filter(function () { return this === a }).length }, o.prototype.updateColspanCells = function (e, a, s) { var n = this, i = n._getPrimaryHeaderRow(); this.$table.find("[rowspan][data-tablesaw-priority]").each(function () { var e = t(this); if ("persist" === e.attr("data-tablesaw-priority")) { var a = e.closest("tr"), s = parseInt(e.attr("rowspan"), 10); s > 1 && ((a = a.next()).data("tablesaw-rowspanned", !0), s--) } }), this.$table.find("[colspan],[data-tablesaw-maxcolspan]").filter(function () { return t(this).closest("tr")[0] !== i[0] }).each(function () { var i = t(this); if (void 0 === s || n.isCellInColumn(a, this)) { var o = n.getColspanForCell(i); e && void 0 !== s && i[0 === o ? "addClass" : "removeClass"](e); var l = parseInt(i.attr("data-tablesaw-maxcolspan"), 10); l ? o > l && (o = l) : i.attr("data-tablesaw-maxcolspan", i.attr("colspan")), i.attr("colspan", o) } }) }, o.prototype._findPrimaryHeadersForCell = function (t) { for (var e = this._getPrimaryHeaderRow(), a = this._getRowIndex(e), s = [], n = 0; n < this.headerMapping.length; n++)if (n !== a) for (var i = 0; i < this.headerMapping[n].length; i++)this.headerMapping[n][i] === t && s.push(this.headerMapping[a][i]); return s }, o.prototype.getRows = function () { var e = this; return this.$table.find("tr").filter(function () { return t(this).closest("table").is(e.$table) }) }, o.prototype.getBodyRows = function (e) { return (e ? t(e) : this.$tbody).children().filter("tr") }, o.prototype.getHeaderCellIndex = function (t) { for (var e = this.headerMapping[0], a = 0; a < e.length; a++)if (e[a] === t) return a; return -1 }, o.prototype._initCells = function () { this.$table.find("[data-tablesaw-maxcolspan]").each(function () { var e = t(this); e.attr("colspan", e.attr("data-tablesaw-maxcolspan")) }); var e = this.getRows(), a = []; e.each(function (t) { a[t] = [] }), e.each(function (e) { var s = 0; t(this).children().each(function () { for (var t = parseInt(this.getAttribute("data-tablesaw-maxcolspan") || this.getAttribute("colspan"), 10), n = parseInt(this.getAttribute("rowspan"), 10); a[e][s];)s++; if (a[e][s] = this, t) for (var i = 0; i < t - 1; i++)s++ , a[e][s] = this; if (n) for (var o = 1; o < n; o++)a[e + o][s] = this; s++ }) }); for (var s = this._getHeaderRowIndeces(), n = 0; n < a[0].length; n++)for (var i = 0, o = s.length; i < o; i++) { var l, r = a[s[i]][n], c = s[i]; for (r.cells || (r.cells = []); c < a.length;)r !== (l = a[c][n]) && r.cells.push(l), c++ } this.headerMapping = a }, o.prototype.refresh = function () { this._initCells(), this.$table.trigger(n.refresh, [this]) }, o.prototype._getToolbarAnchor = function () { var t = this.$table.parent(); return t.is(".tablesaw-overflow") ? t : this.$table }, o.prototype._getToolbar = function (t) { return t || (t = this._getToolbarAnchor()), t.prev().filter("." + s) }, o.prototype.createToolbar = function () { var e = this._getToolbarAnchor(), a = this._getToolbar(e); a.length || (a = t("<div>").addClass(s).insertBefore(e)), this.$toolbar = a, this.mode && this.$toolbar.addClass("tablesaw-mode-" + this.mode) }, o.prototype.destroy = function () { this._getToolbar().each(function () { this.className = this.className.replace(/\btablesaw-mode\-\w*\b/gi, "") }); var s = this.$table.attr("id"); t(a).off("." + s), t(e).off("." + s), this.$table.trigger(n.destroy, [this]), this.$table.removeData("tablesaw") }, t.fn.tablesaw = function () { return this.each(function () { t(this).data("tablesaw") || new o(this) }) }; var l = t(a); l.on("enhance.tablesaw", function (e) { if (b.mustard) { var a = t(e.target); a.parent().length && (a = a.parent()), a.find("table").filter("[data-tablesaw],[data-tablesaw-mode],[data-tablesaw-sortable]").tablesaw() } }); var r, c, h = !1; l.on("scroll.tablesaw", function () { h = !0, e.clearTimeout(r), r = e.setTimeout(function () { h = !1 }, 300) }), t(e).on("resize", function () { h || (e.clearTimeout(c), c = e.setTimeout(function () { l.trigger(n.resize) }, 150)) }), b.Table = o }(), n = "tablesaw-stack", i = "tablesaw-cell-label", o = "tablesaw-cell-content", l = "tablesaw-stack", r = "data-tablesaw-no-labels", c = "data-tablesaw-hide-empty", (h = function (e, a) { this.tablesaw = a, this.$table = t(e), this.labelless = this.$table.is("[" + r + "]"), this.hideempty = this.$table.is("[" + c + "]"), this.$table.data(l, this) }).prototype.init = function () { if (this.$table.addClass(n), !this.labelless) { var e = this; this.$table.find("th, td").filter(function () { return !t(this).closest("thead").length }).filter(function () { return !(t(this).is("[" + r + "]") || t(this).closest("tr").is("[" + r + "]") || e.hideempty && !t(this).html()) }).each(function () { var s = t(a.createElement("b")).addClass(i), n = t(this); t(e.tablesaw._findPrimaryHeadersForCell(this)).each(function (e) { var n = t(this.cloneNode(!0)), i = n.find(".tablesaw-sortable-btn"); n.find(".tablesaw-sortable-arrow").remove(); var o = n.find("[data-tablesaw-checkall]"); if (o.closest("label").remove(), o.length) s = t([]); else { e > 0 && s.append(a.createTextNode(", ")); for (var l, r = i.length ? i[0] : n[0]; l = r.firstChild;)s[0].appendChild(l) } }), s.length && !n.find("." + o).length && n.wrapInner("<span class='" + o + "'></span>"); var l = n.find("." + i); l.length ? l.replaceWith(s) : (n.prepend(a.createTextNode(" ")), n.prepend(s)) }) } }, h.prototype.destroy = function () { this.$table.removeClass(n), this.$table.find("." + i).remove(), this.$table.find("." + o).each(function () { t(this).replaceWith(t(this.childNodes)) }) }, t(a).on(b.events.create, function (t, e) { "stack" === e.mode && new h(e.table, e).init() }).on(b.events.refresh, function (e, a) { "stack" === a.mode && t(a.table).data(l).init() }).on(b.events.destroy, function (e, a) { "stack" === a.mode && t(a.table).data(l).destroy() }), b.Stack = h, d = { _create: function () { return t(this).each(function () { t(this).trigger("beforecreate.tablesawbtn").tablesawbtn("_init").trigger("create.tablesawbtn") }) }, _init: function () { var e = t(this), a = this.getElementsByTagName("select")[0]; return a && t(this).addClass("btn-select tablesaw-btn-select").tablesawbtn("_select", a), e }, _select: function (e) { var s = function (e, s) { var n, i, o = t(s).find("option"), l = a.createElement("span"), r = !1; if (l.setAttribute("aria-hidden", "true"), l.innerHTML = "&#160;", o.each(function () { this.selected && (l.innerHTML = this.text) }), i = e.childNodes, o.length > 0) { for (var c = 0, h = i.length; c < h; c++)(n = i[c]) && "SPAN" === n.nodeName.toUpperCase() && (e.replaceChild(l, n), r = !0); r || e.insertBefore(l, e.firstChild) } }; s(this, e), t(this).on("change refresh", function () { s(this, e) }) } }, t.fn.tablesawbtn = function (e, a, s, n) { return this.each(function () { return e && "string" == typeof e ? t.fn.tablesawbtn.prototype[e].call(this, a, s, n) : t(this).data("tablesawbtnactive") ? t(this) : (t(this).data("tablesawbtnactive", !0), void t.fn.tablesawbtn.prototype._create.call(this)) }) }, t.extend(t.fn.tablesawbtn.prototype, d), function () { var s = "tablesaw-coltoggle", n = function (e) { this.$table = t(e), this.$table.length && (this.tablesaw = this.$table.data("tablesaw"), this.attributes = { btnTarget: "data-tablesaw-columntoggle-btn-target", set: "data-tablesaw-columntoggle-set" }, this.classes = { columnToggleTable: "tablesaw-columntoggle", columnBtnContain: "tablesaw-columntoggle-btnwrap tablesaw-advance", columnBtn: "tablesaw-columntoggle-btn tablesaw-nav-btn down", popup: "tablesaw-columntoggle-popup", priorityPrefix: "tablesaw-priority-" }, this.set = [], this.$headers = this.tablesaw._getPrimaryHeaderCells(), this.$table.data(s, this)) }; n.prototype.initSet = function () { var e = this.$table.attr(this.attributes.set); if (e) { var a = this.$table[0]; this.set = t("table[" + this.attributes.set + "='" + e + "']").filter(function () { return this !== a }).get() } }, n.prototype.init = function () { if (this.$table.length) { var n, i, o, l, r, c, h = this, d = this.tablesaw.getConfig({ getColumnToggleLabelTemplate: function (t) { return "<label><input type='checkbox' checked>" + t + "</label>" } }); this.$table.addClass(this.classes.columnToggleTable), i = (n = this.$table.attr("id")) + "-popup", c = t("<div class='" + this.classes.columnBtnContain + "'></div>"), o = t("<a href='#" + i + "' class='btn tablesaw-btn btn-micro " + this.classes.columnBtn + "' data-popup-link><span>" + b.i18n.columnToggleButton + "</span></a>"), l = t("<div class='" + this.classes.popup + "' id='" + i + "'></div>"), r = t("<div class='tablesaw-btn-group'></div>"), this.$popup = l; var u = !1; this.$headers.each(function () { var e = t(this), a = e.attr("data-tablesaw-priority"), s = h.tablesaw._$getCells(this); a && "persist" !== a && (s.addClass(h.classes.priorityPrefix + a), t(d.getColumnToggleLabelTemplate(e.text())).appendTo(r).find('input[type="checkbox"]').data("tablesaw-header", this), u = !0) }), u || r.append("<label>" + b.i18n.columnToggleError + "</label>"), r.appendTo(l), r.find('input[type="checkbox"]').on("change", function (e) { var a; (v(e.target), h.set.length) && (t(h.$popup).find("input[type='checkbox']").each(function (t) { if (this === e.target) return a = t, !1 }), t(h.set).each(function () { var n = t(this).data(s).$popup.find("input[type='checkbox']").get(a); n && (n.checked = e.target.checked, v(n)) })) }), o.appendTo(c); var f, p = t(this.$table.attr(this.attributes.btnTarget)); c.appendTo(p.length ? p : this.tablesaw.$toolbar), o.on("click.tablesaw", function (s) { s.preventDefault(), c.is(".visible") ? m() : (c.addClass("visible"), o.removeClass("down").addClass("up"), t(a).off("click." + n, m), e.clearTimeout(f), f = e.setTimeout(function () { t(a).on("click." + n, m) }, 15)) }), l.appendTo(c), this.$menu = r; var w, g = this.$table.closest(".tablesaw-overflow"); if (g.css("-webkit-overflow-scrolling")) g.on("scroll", function () { var a = t(this); e.clearTimeout(w), w = e.setTimeout(function () { a.css("-webkit-overflow-scrolling", "auto"), e.setTimeout(function () { a.css("-webkit-overflow-scrolling", "touch") }, 0) }, 100) }); t(e).on(b.events.resize + "." + n, function () { h.refreshToggle() }), this.initSet(), this.refreshToggle() } function v(t) { var e = t.checked, a = h.getHeaderFromCheckbox(t), s = h.tablesaw._$getCells(a); s[e ? "removeClass" : "addClass"]("tablesaw-toggle-cellhidden"), s[e ? "addClass" : "removeClass"]("tablesaw-toggle-cellvisible"), h.updateColspanCells(a, e), h.$table.trigger("tablesawcolumns") } function m(e) { e && t(e.target).closest("." + h.classes.popup).length || (t(a).off("click." + n), o.removeClass("up").addClass("down"), c.removeClass("visible")) } }, n.prototype.getHeaderFromCheckbox = function (e) { return t(e).data("tablesaw-header") }, n.prototype.refreshToggle = function () { var t = this; this.$menu.find("input").each(function () { var e = t.getHeaderFromCheckbox(this); this.checked = "table-cell" === t.tablesaw._$getCells(e).eq(0).css("display") }), this.updateColspanCells() }, n.prototype.updateColspanCells = function (t, e) { this.tablesaw.updateColspanCells("tablesaw-toggle-cellhidden", t, e) }, n.prototype.destroy = function () { this.$table.removeClass(this.classes.columnToggleTable), this.$table.find("th, td").each(function () { t(this).removeClass("tablesaw-toggle-cellhidden").removeClass("tablesaw-toggle-cellvisible"), this.className = this.className.replace(/\bui\-table\-priority\-\d\b/g, "") }) }, t(a).on(b.events.create, function (t, e) { "columntoggle" === e.mode && new n(e.table).init() }), t(a).on(b.events.destroy, function (e, a) { "columntoggle" === a.mode && t(a.table).data(s).destroy() }), t(a).on(b.events.refresh, function (e, a) { "columntoggle" === a.mode && t(a.table).data(s).refreshToggle() }), b.ColumnToggle = n }(), function () { function e(e) { var a = []; return t(e.childNodes).each(function () { var e = t(this); e.is("input, select") ? a.push(e.val()) : e.is(".tablesaw-cell-label") || a.push((e.text() || "").replace(/^\s+|\s+$/g, "")) }), a.join("") } var s = "tablesaw-sortable", n = "table[data-" + s + "]", i = "[data-" + s + "-switch]", o = { sortCol: "data-tablesaw-sortable-col", defaultCol: "data-tablesaw-sortable-default-col", numericCol: "data-tablesaw-sortable-numeric", subRow: "data-tablesaw-subrow", ignoreRow: "data-tablesaw-ignorerow" }, l = { head: s + "-head", ascend: s + "-ascending", descend: s + "-descending", switcher: s + "-switch", tableToolbar: "tablesaw-bar-section", sortButton: s + "-btn" }, r = { _create: function (e) { return t(this).each(function () { if (t(this).data(s + "-init")) return !1; t(this).data(s + "-init", !0).trigger("beforecreate." + s)[s]("_init", e).trigger("create." + s) }) }, _init: function () { var a, n, r, c = t(this), h = c.data("tablesaw"); function d(e) { t.each(e, function (e, a) { var s = t(a); s.removeAttr(o.defaultCol), s.removeClass(l.ascend), s.removeClass(l.descend) }) } c.addClass(s), a = c.children().filter("thead").find("th[" + o.sortCol + "]"), r = a, t.each(r, function (e, a) { t(a).addClass(l.head) }), function (e, a) { t.each(e, function (e, s) { var n = t("<button class='" + l.sortButton + "'/>"); n.on("click", { col: s }, a), t(s).wrapInner(n).find("button").append("<span class='tablesaw-sortable-arrow'>") }) }(a, function (e) { if (!t(e.target).is("a[href]")) { e.stopPropagation(); var i = t(e.target).closest("[" + o.sortCol + "]"), r = e.data.col, h = a.index(i[0]); d(i.closest("thead").find("th").filter(function () { return this !== i[0] })), i.is("." + l.descend) || !i.is("." + l.ascend) ? (c[s]("sortBy", r, !0), h += "_asc") : (c[s]("sortBy", r), h += "_desc"), n && n.find("select").val(h).trigger("refresh"), e.preventDefault() } }), function (e) { t.each(e, function (e, a) { var s = t(a); s.is("[" + o.defaultCol + "]") && (s.is("." + l.descend) || s.addClass(l.ascend)) }) }(a), c.is(i) && function (a) { n = t("<div>").addClass(l.switcher).addClass(l.tableToolbar); var i = ["<label>" + b.i18n.sort + ":"]; i.push('<span class="btn tablesaw-btn"><select>'), a.each(function (a) { var s = t(this), n = s.is("[" + o.defaultCol + "]"), r = s.is("." + l.descend), c = s.is("[" + o.numericCol + "]"), h = 0; t(this.cells.slice(0, 5)).each(function () { isNaN(parseInt(e(this), 10)) || h++ }); var d = 5 === h; c || s.attr(o.numericCol, d ? "" : "false"), i.push("<option" + (n && !r ? " selected" : "") + ' value="' + a + '_asc">' + s.text() + " " + (d ? "&#x2191;" : "(A-Z)") + "</option>"), i.push("<option" + (n && r ? " selected" : "") + ' value="' + a + '_desc">' + s.text() + " " + (d ? "&#x2193;" : "(Z-A)") + "</option>") }), i.push("</select></span></label>"), n.html(i.join("")); var r = h.$toolbar.children().eq(0); r.length ? n.insertBefore(r) : n.appendTo(h.$toolbar), n.find(".tablesaw-btn").tablesawbtn(), n.find("select").on("change", function () { var e = t(this).val().split("_"), n = a.eq(e[0]); d(n.siblings()), c[s]("sortBy", n.get(0), "asc" === e[1]) }) }(a) }, sortRows: function (a, s, n, i, l) { var r, c = function (a, s) { var n = []; return t.each(a, function (a, i) { for (var l = i.parentNode, r = t(l), c = [], h = r.next(); h.is("[" + o.subRow + "]");)c.push(h[0]), h = h.next(); var d = l.parentNode; r.is("[" + o.subRow + "]") || d === s && n.push({ element: i, cell: e(i), row: l, subrows: c.length ? c : null, ignored: r.is("[" + o.ignoreRow + "]") }) }), n }(i.cells, l), h = t(i).data("tablesaw-sort"); return r = !(!h || "function" != typeof h) && h(n) || function (t, e) { var a = /[^\-\+\d\.]/g; return t ? function (t, s) { return t.ignored || s.ignored ? 0 : e ? parseFloat(t.cell.replace(a, "")) - parseFloat(s.cell.replace(a, "")) : t.cell.toLowerCase() > s.cell.toLowerCase() ? 1 : -1 } : function (t, s) { return t.ignored || s.ignored ? 0 : e ? parseFloat(s.cell.replace(a, "")) - parseFloat(t.cell.replace(a, "")) : t.cell.toLowerCase() < s.cell.toLowerCase() ? 1 : -1 } }(n, t(i).is("[" + o.numericCol + "]") && !t(i).is("[" + o.numericCol + '="false"]')), function (t) { var e, a, s = []; for (e = 0, a = t.length; e < a; e++)s.push(t[e].row), t[e].subrows && s.push(t[e].subrows); return s }(c.sort(r)) }, makeColDefault: function (e, a) { var s = t(e); s.attr(o.defaultCol, "true"), a ? (s.removeClass(l.descend), s.addClass(l.ascend)) : (s.removeClass(l.ascend), s.addClass(l.descend)) }, sortBy: function (e, a) { var n, i = t(this), o = i.data("tablesaw"); o.$tbody.each(function () { var l, r, c, h = t(this), d = o.getBodyRows(this), u = o.headerMapping[0]; for (r = 0, c = u.length; r < c; r++)if (u[r] === e) { n = r; break } for (r = 0, c = (l = i[s]("sortRows", d, n, a, e, this)).length; r < c; r++)h.append(l[r]) }), i[s]("makeColDefault", e, a), i.trigger("tablesaw-sorted") } }; t.fn[s] = function (e) { var a, n = Array.prototype.slice.call(arguments, 1); return e && "string" == typeof e ? void 0 !== (a = t.fn[s].prototype[e].apply(this[0], n)) ? a : t(this) : (t(this).data(s + "-active") || (t(this).data(s + "-active", !0), t.fn[s].prototype._create.call(this, e)), t(this)) }, t.extend(t.fn[s].prototype, r), t(a).on(b.events.create, function (t, e) { e.$table.is(n) && e.$table[s]() }) }(), function () { var s = { hideBtn: "disabled", persistWidths: "tablesaw-fix-persist", hiddenCol: "tablesaw-swipe-cellhidden", persistCol: "tablesaw-swipe-cellpersist", allColumnsVisible: "tablesaw-all-cols-visible" }, n = { disableTouchEvents: "data-tablesaw-no-touch", ignorerow: "data-tablesaw-ignorerow", subrow: "data-tablesaw-subrow" }; function i(i, o) { var l = o.data("tablesaw"), r = t("<div class='tablesaw-advance'></div>"), c = t("<a href='#' class='btn tablesaw-nav-btn tablesaw-btn btn-micro left'>" + b.i18n.swipePreviousColumn + "</a>").appendTo(r), h = t("<a href='#' class='btn tablesaw-nav-btn tablesaw-btn btn-micro right'>" + b.i18n.swipeNextColumn + "</a>").appendTo(r), d = i._getPrimaryHeaderCells(), u = d.not('[data-tablesaw-priority="persist"]'), f = [], p = [], w = t(a.head || "head"), g = o.attr("id"); if (!d.length) throw new Error("tablesaw swipe: no header cells found."); function v() { o.css({ width: "1px" }), o.find("." + s.hiddenCol).removeClass(s.hiddenCol), f = [], p = [], d.each(function () { var t = this.offsetWidth; f.push(t), y(this) || p.push(t) }), o.css({ width: "" }) } function m(t) { l._$getCells(t).removeClass(s.hiddenCol) } function C(t) { l._$getCells(t).addClass(s.hiddenCol) } function y(e) { return t(e).is('[data-tablesaw-priority="persist"]') } function $() { o.removeClass(s.persistWidths), t("#" + g + "-persist").remove() } function T() { var e, a = []; return u.each(function (n) { var i = t(this), o = "none" === i.css("display") || i.is("." + s.hiddenCol); if (o || e) { if (o && e) return a[1] = n, !1 } else e = !0, a[0] = n }), a } function k() { var t = T(); return [t[1] - 1, t[0] - 1] } function x(t) { return t[1] > -1 && t[1] < u.length } function _() { if (!(a = o.attr("data-tablesaw-swipe-media")) || "matchMedia" in e && e.matchMedia(a).matches) { var a, n = o.parent().width(), i = [], r = 0, c = [], h = d.length; d.each(function (e) { var a = t(this).is('[data-tablesaw-priority="persist"]'); i.push(a), r += f[e], c.push(r), (a || r > n) && h-- }); var u = 0 === h; d.each(function (t) { c[t] > n && C(this) }); var b = !0; d.each(function (t) { if (i[t]) return e = this, l._$getCells(e).addClass(s.persistCol), void (b && (l._$getCells(this).css("width", c[t] + "px"), b = !1)); var e; (c[t] <= n || u) && (u = !1, m(this), l.updateColspanCells(s.hiddenCol, this, !0)) }), $(), o.trigger("tablesawcolumns") } } function M() { B(!0) } function S() { B(!1) } function B(e) { var a; if (x(a = e ? T() : k())) { isNaN(a[0]) && (a[0] = e ? 0 : u.length - 1); var n, i = function () { var e, a = "#" + g + ".tablesaw-swipe ", n = [], i = o.width(), l = i, r = []; if (d.each(function (t) { var e; y(this) && (e = this.offsetWidth, l -= e, e < .75 * i && (r.push(t + "-" + e), n.push(a + " ." + s.persistCol + ":nth-child(" + (t + 1) + ") { width: " + e + "px; }"))) }), e = r.join("_"), n.length) { o.addClass(s.persistWidths); var c = t("#" + g + "-persist"); c.length && c.data("tablesaw-hash") === e || (c.remove(), t("<style>" + n.join("\n") + "</style>").attr("id", g + "-persist").data("tablesaw-hash", e).appendTo(w)) } return l }(), r = a[0], c = a[1], h = u.get(r), b = !1, f = !1; C(h), l.updateColspanCells(s.hiddenCol, h, !0); for (var v = r + (e ? 1 : -1); v >= 0 && v < p.length;) { i -= p[v]; var $ = u.eq(v); $.is(".tablesaw-swipe-cellhidden") ? i > 0 && (b = !0, f = !0, m(n = $.get(0)), l.updateColspanCells(s.hiddenCol, n, !1)) : f = !0, e ? v++ : v-- } f ? !b && x(e ? T() : k()) && B(e) : (m(n = u.get(c)), l.updateColspanCells(s.hiddenCol, n, !1)), o.trigger("tablesawcolumns") } } function H(t, e) { return (t.touches || t.originalEvent.touches)[0][e] } o.addClass("tablesaw-swipe"), v(), r.appendTo(l.$toolbar), g || (g = "tableswipe-" + Math.round(1e4 * Math.random()), o.attr("id", g)), c.add(h).on("click", function (e) { t(e.target).closest(h).length ? M() : S(), e.preventDefault() }), o.is("[" + n.disableTouchEvents + "]") || o.on("touchstart.swipetoggle", function (a) { var s, n, o = H(a, "pageX"), l = H(a, "pageY"), r = e.pageYOffset; t(e).off(b.events.resize, _), t(this).on("touchmove.swipetoggle", function (t) { s = H(t, "pageX"), n = H(t, "pageY") }).on("touchend.swipetoggle", function () { var a = i.getConfig({ swipeHorizontalThreshold: 30, swipeVerticalThreshold: 30 }), c = a.swipe ? a.swipe.verticalThreshold : a.swipeVerticalThreshold, h = a.swipe ? a.swipe.horizontalThreshold : a.swipeHorizontalThreshold, d = Math.abs(e.pageYOffset - r) >= c; Math.abs(n - l) >= c || d || (s - o < -1 * h && M(), s - o > h && S()), e.setTimeout(function () { t(e).on(b.events.resize, _) }, 300), t(this).off("touchmove.swipetoggle touchend.swipetoggle") }) }), o.on("tablesawcolumns.swipetoggle", function () { var t = x(k()), e = x(T()); c[t ? "removeClass" : "addClass"](s.hideBtn), h[e ? "removeClass" : "addClass"](s.hideBtn), l.$toolbar[t || e ? "removeClass" : "addClass"](s.allColumnsVisible) }).on("tablesawnext.swipetoggle", function () { M() }).on("tablesawprev.swipetoggle", function () { S() }).on(b.events.destroy + ".swipetoggle", function () { var a = t(this); a.removeClass("tablesaw-swipe"), l.$toolbar.find(".tablesaw-advance").remove(), t(e).off(b.events.resize, _), a.off(".swipetoggle") }).on(b.events.refresh, function () { $(), v(), _() }), _(), t(e).on(b.events.resize, _) } t(a).on(b.events.create, function (t, e) { "swipe" === e.mode && i(e, e.$table) }) }(), function () { var s = { attr: { init: "data-tablesaw-minimap" }, show: function (t) { var a = t.getAttribute(s.attr.init); return "" === a || !!(a && "matchMedia" in e) && e.matchMedia(a).matches } }; t(a).on(b.events.create, function (a, n) { "swipe" !== n.mode && "columntoggle" !== n.mode || !n.$table.is("[ " + s.attr.init + "]") || function (a) { var n = a.data("tablesaw"), i = t('<div class="tablesaw-advance minimap">'), o = t('<ul class="tablesaw-advance-dots">').appendTo(i), l = "tablesaw-advance-dots-hide"; function r() { if (s.show(a[0])) { i.css("display", "block"); var e = o.find("li").removeClass(l); a.find("thead th").each(function (a) { "none" === t(this).css("display") && e.eq(a).addClass(l) }) } else i.css("display", "none") } a.data("tablesaw")._getPrimaryHeaderCells().each(function () { o.append("<li><i></i></li>") }), i.appendTo(n.$toolbar), r(), t(e).on(b.events.resize, r), a.on("tablesawcolumns.minimap", function () { r() }).on(b.events.destroy + ".minimap", function () { var a = t(this); n.$toolbar.find(".tablesaw-advance").remove(), t(e).off(b.events.resize, r), a.off(".minimap") }) }(n.$table) }), b.MiniMap = s }(), u = { selectors: { init: "table[data-tablesaw-mode-switch]" }, attributes: { excludeMode: "data-tablesaw-mode-exclude" }, classes: { main: "tablesaw-modeswitch", toolbar: "tablesaw-bar-section" }, modes: ["stack", "swipe", "columntoggle"], init: function (e) { var a, s = t(e), n = s.data("tablesaw"), i = s.attr(u.attributes.excludeMode), o = n.$toolbar, l = t("<div>").addClass(u.classes.main + " " + u.classes.toolbar), r = ['<label><span class="abbreviated">' + b.i18n.modeSwitchColumnsAbbreviated + '</span><span class="longform">' + b.i18n.modeSwitchColumns + "</span>:"], c = s.attr("data-tablesaw-mode"); r.push('<span class="btn tablesaw-btn"><select>'); for (var h = 0, d = u.modes.length; h < d; h++)i && i.toLowerCase() === u.modes[h] || (a = c === u.modes[h], r.push("<option" + (a ? " selected" : "") + ' value="' + u.modes[h] + '">' + b.i18n.modes[h] + "</option>")); r.push("</select></span></label>"), l.html(r.join("")); var f = o.find(".tablesaw-advance").eq(0); f.length ? l.insertBefore(f) : l.appendTo(o), l.find(".tablesaw-btn").tablesawbtn(), l.find("select").on("change", function (a) { return u.onModeChange.call(e, a, t(this).val()) }) }, onModeChange: function (e, a) { var s = t(this), n = s.data("tablesaw"); n.$toolbar.find("." + u.classes.main).remove(), n.destroy(), s.attr("data-tablesaw-mode", a), s.tablesaw() } }, t(a).on(b.events.create, function (t, e) { e.$table.is(u.selectors.init) && u.init(e.table) }), function () { var e = "tablesawCheckAll"; function s(t) { this.tablesaw = t, this.$table = t.$table, this.attr = "data-tablesaw-checkall", this.checkAllSelector = "[" + this.attr + "]", this.forceCheckedSelector = "[" + this.attr + "-checked]", this.forceUncheckedSelector = "[" + this.attr + "-unchecked]", this.checkboxSelector = 'input[type="checkbox"]', this.$triggers = null, this.$checkboxes = null, this.$table.data(e) || (this.$table.data(e, this), this.init()) } s.prototype._filterCells = function (e) { return e.filter(function () { return !t(this).closest("tr").is("[data-tablesaw-subrow],[data-tablesaw-ignorerow]") }).find(this.checkboxSelector).not(this.checkAllSelector) }, s.prototype.getCheckboxesForButton = function (e) { return this._filterCells(t(t(e).attr(this.attr))) }, s.prototype.getCheckboxesForCheckbox = function (e) { return this._filterCells(t(t(e).closest("th")[0].cells)) }, s.prototype.init = function () { var e = this; this.$table.find(this.checkAllSelector).each(function () { t(this).is(e.checkboxSelector) ? e.addCheckboxEvents(this) : e.addButtonEvents(this) }) }, s.prototype.addButtonEvents = function (a) { var s = this; t(a).on("click", function (a) { a.preventDefault(); var n, i = s.getCheckboxesForButton(this), o = !0; i.each(function () { this.checked || (o = !1) }), n = !!t(this).is(s.forceCheckedSelector) || !t(this).is(s.forceUncheckedSelector) && !o, i.each(function () { this.checked = n, t(this).trigger("change." + e) }) }) }, s.prototype.addCheckboxEvents = function (a) { var s = this; t(a).on("change", function () { var t = this.checked; s.getCheckboxesForCheckbox(this).each(function () { this.checked = t }) }); var n = s.getCheckboxesForCheckbox(a); n.on("change." + e, function () { var t = 0; n.each(function () { this.checked && t++ }); var e = t === n.length; a.checked = e, a.indeterminate = 0 !== t && !e }) }, t(a).on(b.events.create, function (t, e) { new s(e) }), b.CheckAll = s }(), b });
\ No newline at end of file
/*! Tablesaw - v3.0.0-beta.1 - 2016-09-19
* https://github.com/filamentgroup/tablesaw
* Copyright (c) 2016 Filament Group; Licensed MIT */
/*! Shoestring - v1.0.3 - 2016-09-07
* http://github.com/filamentgroup/shoestring/
* Copyright (c) 2016 Scott Jehl, Filament Group, Inc; Licensed MIT & GPLv2 */
(function( w, undefined ){
/**
* The shoestring object constructor.
*
* @param {string,object} prim The selector to find or element to wrap.
* @param {object} sec The context in which to match the `prim` selector.
* @returns shoestring
* @this window
*/
function shoestring( prim, sec ){
var pType = typeof( prim ),
ret = [],
sel;
// return an empty shoestring object
if( !prim ){
return new Shoestring( ret );
}
// ready calls
if( prim.call ){
return shoestring.ready( prim );
}
// handle re-wrapping shoestring objects
if( prim.constructor === Shoestring && !sec ){
return prim;
}
// if string starting with <, make html
if( pType === "string" && prim.indexOf( "<" ) === 0 ){
var dfrag = document.createElement( "div" );
dfrag.innerHTML = prim;
// TODO depends on children (circular)
return shoestring( dfrag ).children().each(function(){
dfrag.removeChild( this );
});
}
// if string, it's a selector, use qsa
if( pType === "string" ){
if( sec ){
return shoestring( sec ).find( prim );
}
sel = document.querySelectorAll( prim );
return new Shoestring( sel, prim );
}
// array like objects or node lists
if( Object.prototype.toString.call( pType ) === '[object Array]' ||
(window.NodeList && prim instanceof window.NodeList) ){
return new Shoestring( prim, prim );
}
// if it's an array, use all the elements
if( prim.constructor === Array ){
return new Shoestring( prim, prim );
}
// otherwise assume it's an object the we want at an index
return new Shoestring( [prim], prim );
}
var Shoestring = function( ret, prim ) {
this.length = 0;
this.selector = prim;
shoestring.merge(this, ret);
};
// TODO only required for tests
Shoestring.prototype.reverse = [].reverse;
// For adding element set methods
shoestring.fn = Shoestring.prototype;
shoestring.Shoestring = Shoestring;
// For extending objects
// TODO move to separate module when we use prototypes
shoestring.extend = function( first, second ){
for( var i in second ){
if( second.hasOwnProperty( i ) ){
first[ i ] = second[ i ];
}
}
return first;
};
// taken directly from jQuery
shoestring.merge = function( first, second ) {
var len, j, i;
len = +second.length,
j = 0,
i = first.length;
for ( ; j < len; j++ ) {
first[ i++ ] = second[ j ];
}
first.length = i;
return first;
};
// expose
window.shoestring = shoestring;
/**
* Iterates over `shoestring` collections.
*
* @param {function} callback The callback to be invoked on each element and index
* @return shoestring
* @this shoestring
*/
shoestring.fn.each = function( callback ){
return shoestring.each( this, callback );
};
shoestring.each = function( collection, callback ) {
var val;
for( var i = 0, il = collection.length; i < il; i++ ){
val = callback.call( collection[i], i, collection[i] );
if( val === false ){
break;
}
}
return collection;
};
/**
* Check for array membership.
*
* @param {object} needle The thing to find.
* @param {object} haystack The thing to find the needle in.
* @return {boolean}
* @this window
*/
shoestring.inArray = function( needle, haystack ){
var isin = -1;
for( var i = 0, il = haystack.length; i < il; i++ ){
if( haystack.hasOwnProperty( i ) && haystack[ i ] === needle ){
isin = i;
}
}
return isin;
};
/**
* Bind callbacks to be run when the DOM is "ready".
*
* @param {function} fn The callback to be run
* @return shoestring
* @this shoestring
*/
shoestring.ready = function( fn ){
if( ready && fn ){
fn.call( document );
}
else if( fn ){
readyQueue.push( fn );
}
else {
runReady();
}
return [document];
};
// TODO necessary?
shoestring.fn.ready = function( fn ){
shoestring.ready( fn );
return this;
};
// Empty and exec the ready queue
var ready = false,
readyQueue = [],
runReady = function(){
if( !ready ){
while( readyQueue.length ){
readyQueue.shift().call( document );
}
ready = true;
}
};
// Quick IE8 shiv