j1-template 2021.1.28 → 2021.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/_includes/themes/j1/layouts/content_generator_news_panel_posts.html +6 -6
- data/_includes/themes/j1/layouts/content_generator_post.html +3 -0
- data/_includes/themes/j1/modules/navigator/generator.html +1 -1
- data/_includes/themes/j1/procedures/posts/collate_timeline.proc +5 -5
- data/_includes/themes/j1/procedures/posts/create_series_header.proc +6 -6
- data/_layouts/default.html +6 -2
- data/assets/data/mdil_icons.json +2417 -0
- data/assets/data/panel.html +10 -10
- data/assets/themes/j1/adapter/js/j1.js +8 -7
- data/assets/themes/j1/adapter/js/j1scroll.js +19 -1
- data/assets/themes/j1/adapter/js/navigator.js +11 -4
- data/assets/themes/j1/adapter/js/rtable.js +77 -24
- data/assets/themes/j1/core/css/icon-fonts/materialdesign-light.css +1222 -0
- data/assets/themes/j1/core/css/icon-fonts/materialdesign-light.min.css +1 -0
- data/assets/themes/j1/core/css/icon-fonts/materialdesign.css +1 -1
- data/assets/themes/j1/core/css/themes/uno-dark/bootstrap.css +58 -109
- data/assets/themes/j1/core/css/themes/uno-dark/bootstrap.min.css +1 -1
- data/assets/themes/j1/core/css/themes/uno-light/bootstrap.css +28 -18
- data/assets/themes/j1/core/css/themes/uno-light/bootstrap.min.css +1 -1
- data/assets/themes/j1/core/css/vendor.css +7 -20
- data/assets/themes/j1/core/css/vendor.min.css +1 -1
- data/assets/themes/j1/core/fonts/material_design_icons_light/fonts/eot/materialdesignicons-light-webfont.eot +0 -0
- data/assets/themes/j1/core/fonts/material_design_icons_light/fonts/materialdesignicons-light-webfont.woff +0 -0
- data/assets/themes/j1/core/fonts/material_design_icons_light/fonts/materialdesignicons-light-webfont.woff2 +0 -0
- data/assets/themes/j1/core/fonts/material_design_icons_light/fonts/svg/materialdesignicons-light-webfont.svg +801 -0
- data/assets/themes/j1/core/fonts/material_design_icons_light/fonts/ttf/materialdesignicons-light-webfont.ttf +0 -0
- data/assets/themes/j1/core/js/template.js +4 -4
- data/assets/themes/j1/core/js/template.js.map +1 -1
- data/assets/themes/j1/core/js/template.min.js +4 -4
- data/assets/themes/j1/core/js/template.min.js.map +1 -1
- data/assets/themes/j1/modules/carousel/css/theme/uno.css +1 -1
- data/assets/themes/j1/modules/carousel/css/theme/uno.min.css +1 -1
- data/assets/themes/j1/modules/j1Scroll/js/j1scroll.js +11 -21
- data/assets/themes/j1/modules/j1Scroll/js/j1scroll.min.js +1 -1
- data/assets/themes/j1/modules/justifiedGallery/css/theme/uno.css +1 -1
- data/assets/themes/j1/modules/justifiedGallery/css/theme/uno.min.css +1 -1
- data/assets/themes/j1/modules/mdiPreviewer/css/previewer.css +1 -1
- data/assets/themes/j1/modules/mdiPreviewer/css/previewer.min.css +1 -1
- data/assets/themes/j1/modules/mdiPreviewer/js/previewer.js +5 -15
- data/assets/themes/j1/modules/mdiPreviewer/js/previewer.min.js +1 -1
- data/assets/themes/j1/modules/mdilPreviewer/css/previewer.css +97 -0
- data/assets/themes/j1/modules/mdilPreviewer/css/previewer.min.css +15 -0
- data/assets/themes/j1/modules/mdilPreviewer/js/previewer.js +125 -0
- data/assets/themes/j1/modules/mdilPreviewer/js/previewer.min.js +15 -0
- data/assets/themes/j1/modules/rtable/css/theme/uno/rtable.css +3 -3
- data/assets/themes/j1/modules/rtable/css/theme/uno/rtable.min.css +2 -174
- data/assets/themes/j1/modules/rtable/js/rtable.js +59 -25
- data/assets/themes/j1/modules/rtable/js/rtable.min.js +12 -683
- data/assets/themes/j1/modules/showOnScroll/js/showOnScroll.js +73 -73
- data/assets/themes/j1/modules/showOnScroll/js/showOnScroll.min.js +15 -15
- data/lib/j1/commands/generate.rb +5 -8
- data/lib/j1/version.rb +1 -1
- data/lib/starter_web/Gemfile +1 -1
- data/lib/starter_web/_config.yml +15 -51
- data/lib/starter_web/_data/blocks/banner.yml +4 -5
- data/lib/starter_web/_data/blocks/panel.yml +217 -183
- data/lib/starter_web/_data/layouts/home.yml +20 -16
- data/lib/starter_web/_data/modules/defaults/navigator.yml +1 -1
- data/lib/starter_web/_data/modules/defaults/rtable.yml +34 -0
- data/lib/starter_web/_data/modules/j1scroll.yml +12 -2
- data/lib/starter_web/_data/modules/navigator_menu.yml +3 -3
- data/lib/starter_web/_data/modules/rtable.yml +34 -0
- data/lib/starter_web/_data/resources.yml +38 -16
- data/lib/starter_web/_includes/attributes.asciidoc +6 -1
- data/lib/starter_web/_plugins/lunr_index.rb +1 -1
- data/lib/starter_web/assets/images/modules/attics/annie-spratt-1920x1280.jpg +0 -0
- data/lib/starter_web/assets/images/modules/attics/antonino-visalli-1920x1280.jpg +0 -0
- data/lib/starter_web/assets/images/modules/attics/humble-lamb-1920x1280.jpg +0 -0
- data/lib/starter_web/assets/images/modules/attics/library-1920x1280.jpg +0 -0
- data/lib/starter_web/assets/images/modules/attics/romain-vignes-1920x1280.jpg +0 -0
- data/lib/starter_web/assets/images/modules/attics/sigmund-1920x1280.jpg +0 -0
- data/lib/starter_web/assets/images/{pages/videos → modules/attics}/szabo-viktor-1920x1280.jpg +0 -0
- data/lib/starter_web/assets/images/pages/asciidoc_skeletons/example-pdf-screenshot.png +0 -0
- data/lib/starter_web/collections/posts/public/featured/_posts/{2020-01-01-about-cookies.adoc → 2021-01-01-about-cookies.adoc} +0 -0
- data/lib/starter_web/collections/posts/public/featured/_posts/{2021-03-01-site-generators.adoc → 2021-02-01-site-generators.adoc} +0 -0
- data/lib/starter_web/collections/posts/public/{wikipedia/_posts/2016-11-20-minneapolis.adoc → series/_posts/2020-01-01-post-wiki-series.adoc} +11 -10
- data/lib/starter_web/collections/posts/public/{wikipedia/_posts/2016-11-24-narcisse-snake-dens.adoc → series/_posts/2020-01-02-post-wiki-series.adoc} +15 -13
- data/lib/starter_web/collections/posts/public/{wikipedia/_posts/2016-11-26-columbia-river.adoc → series/_posts/2020-01-03-post-wiki-series.adoc} +28 -11
- data/lib/starter_web/collections/posts/public/{wikipedia → series}/_posts/_includes/attributes.asciidoc +0 -0
- data/lib/starter_web/collections/posts/public/{wikipedia → series}/_posts/_includes/documents/readme +0 -0
- data/lib/starter_web/collections/posts/public/{wikipedia → series}/_posts/_includes/tables/readme +0 -0
- data/lib/starter_web/index.html +2 -2
- data/lib/starter_web/package.json +1 -1
- data/lib/starter_web/pages/public/asciidoc_skeletons/{book → documentation}/000_intro.adoc +5 -7
- data/lib/starter_web/pages/public/asciidoc_skeletons/documentation/100_converter.adoc +43 -0
- data/lib/starter_web/pages/public/asciidoc_skeletons/documentation/200_themes.adoc +61 -0
- data/lib/starter_web/pages/public/asciidoc_skeletons/documentation/_includes/attributes.asciidoc +95 -0
- data/lib/starter_web/pages/public/asciidoc_skeletons/documentation/_includes/documents/000_intro.asciidoc +54 -0
- data/lib/starter_web/pages/public/asciidoc_skeletons/documentation/_includes/documents/100_converter/000_basic_example.asciidoc +31 -0
- data/lib/starter_web/pages/public/asciidoc_skeletons/documentation/_includes/documents/100_converter/111_about_the_converter.asciidoc +111 -0
- data/lib/starter_web/pages/public/asciidoc_skeletons/documentation/_includes/documents/100_converter/112_getting_started.asciidoc +95 -0
- data/lib/starter_web/pages/public/asciidoc_skeletons/documentation/_includes/documents/100_converter/113_themes.asciidoc +39 -0
- data/lib/starter_web/pages/public/asciidoc_skeletons/documentation/_includes/documents/100_converter.asciidoc +8 -0
- data/lib/starter_web/pages/public/asciidoc_skeletons/documentation/_includes/documents/200_themes/211_language_overview.asciidoc +122 -0
- data/lib/starter_web/pages/public/asciidoc_skeletons/documentation/_includes/documents/200_themes/212_values.asciidoc +502 -0
- data/lib/starter_web/pages/public/asciidoc_skeletons/documentation/_includes/documents/200_themes/213_fonts.asciidoc +261 -0
- data/lib/starter_web/pages/public/asciidoc_skeletons/documentation/_includes/documents/200_themes.asciidoc +8 -0
- data/lib/starter_web/pages/public/asciidoc_skeletons/{book → documentation}/a2p.bat +1 -1
- data/lib/starter_web/pages/public/asciidoc_skeletons/{book → documentation}/a2p.sh +2 -2
- data/lib/starter_web/pages/public/asciidoc_skeletons/{book/book.a2p → documentation/documentation.a2p} +2 -8
- data/lib/starter_web/pages/public/asciidoc_skeletons/documentation/documentation.adoc +86 -0
- data/lib/starter_web/pages/public/asciidoc_skeletons/multi-document/_includes/documents/100_chapter.asciidoc +848 -40
- data/lib/starter_web/pages/public/asciidoc_skeletons/multi-document/_includes/documents/200_chapter.asciidoc +149 -38
- data/lib/starter_web/pages/public/asciidoc_skeletons/multi-document/multi.adoc +2 -7
- data/lib/starter_web/pages/public/asciidoc_skeletons/simple-document/simple.adoc +312 -119
- data/lib/starter_web/pages/public/blog/navigator/archive/categoryview.html +5 -5
- data/lib/starter_web/pages/public/blog/navigator/archive/dateview.html +5 -5
- data/lib/starter_web/pages/public/blog/navigator/archive.html +5 -5
- data/lib/starter_web/pages/public/previewer/bootstrap_theme.adoc +1 -1
- data/lib/starter_web/utilsrv/_defaults/package.json +1 -1
- data/lib/starter_web/utilsrv/package.json +1 -1
- metadata +51 -82
- data/assets/themes/j1/modules/rtable/js/tablesaw-init.js +0 -18
- data/assets/themes/j1/modules/rtable/js/tablesaw.stackonly.js +0 -2371
- data/lib/starter_web/collections/posts/public/series/_posts/2020-01-01-post-test-series.adoc +0 -128
- data/lib/starter_web/collections/posts/public/series/_posts/2020-01-02-post-test-series.adoc +0 -131
- data/lib/starter_web/collections/posts/public/series/_posts/2020-01-03-post-test-series.adoc +0 -131
- data/lib/starter_web/collections/posts/public/series/_posts/2020-01-04-post-test-series.adoc +0 -132
- data/lib/starter_web/pages/infinite-scroll-tester-5.adoc +0 -119
- data/lib/starter_web/pages/public/asciidoc_skeletons/_templates/asciidoc-extensions/blindtext.asciidoc +0 -11
- data/lib/starter_web/pages/public/asciidoc_skeletons/_templates/asciidoc-extensions/font_icons.asciidoc +0 -23
- data/lib/starter_web/pages/public/asciidoc_skeletons/_templates/asciidoc-extensions/gallery.asciidoc +0 -5
- data/lib/starter_web/pages/public/asciidoc_skeletons/_templates/asciidoc-extensions/lightbox.asciidoc +0 -7
- data/lib/starter_web/pages/public/asciidoc_skeletons/_templates/documents/chapter_document.asciidoc +0 -9
- data/lib/starter_web/pages/public/asciidoc_skeletons/_templates/documents/entry_document.asciidoc +0 -3
- data/lib/starter_web/pages/public/asciidoc_skeletons/_templates/images/image.asciidoc +0 -6
- data/lib/starter_web/pages/public/asciidoc_skeletons/_templates/tables/table_2_column.asciidoc +0 -12
- data/lib/starter_web/pages/public/asciidoc_skeletons/_templates/tables/table_2_column_options.asciidoc +0 -30
- data/lib/starter_web/pages/public/asciidoc_skeletons/_templates/tables/table_3_column.asciidoc +0 -16
- data/lib/starter_web/pages/public/asciidoc_skeletons/_templates/tables/table_4_column.asciidoc +0 -25
- data/lib/starter_web/pages/public/asciidoc_skeletons/book/100_chapter.adoc +0 -62
- data/lib/starter_web/pages/public/asciidoc_skeletons/book/200_chapter.adoc +0 -64
- data/lib/starter_web/pages/public/asciidoc_skeletons/book/900_references.adoc +0 -73
- data/lib/starter_web/pages/public/asciidoc_skeletons/book/_includes/attributes.asciidoc +0 -74
- data/lib/starter_web/pages/public/asciidoc_skeletons/book/_includes/documents/000_intro.asciidoc +0 -33
- data/lib/starter_web/pages/public/asciidoc_skeletons/book/_includes/documents/100_chapter/100_chapter_document.asciidoc +0 -21
- data/lib/starter_web/pages/public/asciidoc_skeletons/book/_includes/documents/100_chapter/110_chapter_document.asciidoc +0 -36
- data/lib/starter_web/pages/public/asciidoc_skeletons/book/_includes/documents/100_chapter.asciidoc +0 -7
- data/lib/starter_web/pages/public/asciidoc_skeletons/book/_includes/documents/200_chapter/200_chapter_document.asciidoc +0 -53
- data/lib/starter_web/pages/public/asciidoc_skeletons/book/_includes/documents/200_chapter.asciidoc +0 -5
- data/lib/starter_web/pages/public/asciidoc_skeletons/book/_includes/documents/900_references/000_intro.asciidoc +0 -23
- data/lib/starter_web/pages/public/asciidoc_skeletons/book/_includes/documents/900_references/100_chapter_document.asciidoc +0 -33
- data/lib/starter_web/pages/public/asciidoc_skeletons/book/_includes/documents/900_references/200_chapter_document.asciidoc +0 -26
- data/lib/starter_web/pages/public/asciidoc_skeletons/book/_includes/documents/900_references/900_sources.asciidoc +0 -81
- data/lib/starter_web/pages/public/asciidoc_skeletons/book/_includes/documents/900_references.asciidoc +0 -23
- data/lib/starter_web/pages/public/asciidoc_skeletons/book/_includes/documents/tables/110_material_design_icons.asciidoc +0 -102
- data/lib/starter_web/pages/public/asciidoc_skeletons/book/book.adoc +0 -136
- data/lib/starter_web/pages/public/asciidoc_skeletons/multi-document/100_chapter.asciidoc +0 -60
- data/lib/starter_web/pages/public/asciidoc_skeletons/multi-document/200_chapter.asciidoc +0 -59
- data/lib/starter_web/pages/public/asciidoc_skeletons/multi-document/_includes/documents/tables/110_material_design_icons.asciidoc +0 -102
- data/lib/starter_web/pages/public/previewer/_includes/attributes.asciidoc +0 -60
- data/lib/starter_web/pages/public/previewer/_includes/documents/licenses/mit.asciidoc +0 -19
- data/lib/starter_web/pages/public/previewer/_includes/documents/readme +0 -0
- data/lib/starter_web/pages/public/previewer/_includes/documents/rouge/100_language_examples.asciidoc +0 -119
- data/lib/starter_web/pages/public/previewer/_includes/tables/mdi_icons/100_absolute_sizes.asciidoc +0 -39
- data/lib/starter_web/pages/public/previewer/_includes/tables/mdi_icons/110_bs_grid_sizes.asciidoc +0 -47
- data/lib/starter_web/pages/public/previewer/_includes/tables/mdi_icons/120_relative_sizes.asciidoc +0 -47
- data/lib/starter_web/pages/public/previewer/_includes/tables/mdi_icons/200_rotate.asciidoc +0 -71
- data/lib/starter_web/pages/public/previewer/_includes/tables/mdi_icons/300_flip.asciidoc +0 -31
- data/lib/starter_web/pages/public/previewer/_includes/tables/mdi_icons/400_spin_pulsed.asciidoc +0 -39
- data/lib/starter_web/pages/public/previewer/_includes/tables/mdi_icons/500_bw_color_palette.asciidoc +0 -61
- data/lib/starter_web/pages/public/previewer/_includes/tables/mdi_icons/510_bs_color_palette.asciidoc +0 -55
- data/lib/starter_web/pages/public/previewer/_includes/tables/mdi_icons/600_md_color_palette.asciidoc +0 -95
- data/lib/starter_web/pages/public/previewer/_includes/tables/mdi_icons/601_md_color_palette_indigo.asciidoc +0 -95
- data/lib/starter_web/pages/public/previewer/_includes/tables/mdi_icons/602_md_color_palette_pink.asciidoc +0 -95
- data/lib/starter_web/pages/public/previewer/_includes/tables/rouge/200_rouge_attributes.asciidoc +0 -41
- data/lib/starter_web/pages/public/previewer/_includes/tables/rouge/300_supported_languages.asciidoc +0 -857
- data/lib/starter_web/pages/public/previewer/_includes/tables/twitter_emoji/100_bs_sizes.asciidoc +0 -47
- data/lib/starter_web/pages/public/previewer/_includes/tables/twitter_emoji/100_relative_sizes.asciidoc +0 -47
- data/lib/starter_web/pages/public/previewer/_includes/tables/twitter_emoji/200_rotate.asciidoc +0 -71
- data/lib/starter_web/pages/public/previewer/_includes/tables/twitter_emoji/300_flip.asciidoc +0 -30
- data/lib/starter_web/pages/public/previewer/_includes/tables/twitter_emoji/400_spin_pulsed.asciidoc +0 -31
- data/lib/starter_web/pages/public/previewer/iframer.adoc +0 -93
- data/lib/starter_web/pages/public/previewer/justified_gallery.html +0 -41
- data/lib/starter_web/pages/public/previewer/md_color_palette.adoc +0 -574
- data/lib/starter_web/pages/public/previewer/mdi_icons_preview.adoc +0 -220
- data/lib/starter_web/pages/public/previewer/rouge.adoc +0 -133
- data/lib/starter_web/pages/public/previewer/twitter_emoji_preview.adoc +0 -191
@@ -1,690 +1,19 @@
|
|
1
1
|
/*
|
2
2
|
# -----------------------------------------------------------------------------
|
3
|
-
#
|
4
|
-
#
|
3
|
+
# ~/assets/themes/j1/modules/rtable/js/rtable.min.js
|
4
|
+
# Tablesaw v3.1.2 implementation for J1 Template
|
5
5
|
#
|
6
|
-
#
|
7
|
-
#
|
8
|
-
#
|
6
|
+
# Product/Info:
|
7
|
+
# https://jekyll.one
|
8
|
+
# https://github.com/filamentgroup/tablesaw
|
9
9
|
#
|
10
|
-
#
|
11
|
-
#
|
10
|
+
# Copyright (C) 2021 Juergen Adams
|
11
|
+
# Copyright (c) 2013 Filament Group
|
12
12
|
#
|
13
|
-
#
|
14
|
-
#
|
15
|
-
#
|
16
|
-
#
|
13
|
+
# J1 Template is licensed under the MIT License.
|
14
|
+
# See: https://github.com/jekyll-one-org/J1 Template/blob/master/LICENSE
|
15
|
+
# Tablesaw is licensed under the MIT License.
|
16
|
+
# See: https://github.com/filamentgroup/tablesaw/blob/master/LICENSE
|
17
17
|
# -----------------------------------------------------------------------------
|
18
18
|
*/
|
19
|
-
|
20
|
-
/*! Tablesaw - v3.1.2 - 2019-03-19
|
21
|
-
* https://github.com/filamentgroup/tablesaw
|
22
|
-
* Copyright (c) 2019 Filament Group; Licensed MIT */
|
23
|
-
|
24
|
-
(function (root, factory) {
|
25
|
-
if (typeof define === 'function' && define.amd) {
|
26
|
-
define(["jquery"], function (jQuery) {
|
27
|
-
return (root.Tablesaw = factory(jQuery, root));
|
28
|
-
});
|
29
|
-
} else if (typeof exports === 'object') {
|
30
|
-
if( "document" in root ) {
|
31
|
-
module.exports = factory(require('jquery'), root);
|
32
|
-
} else {
|
33
|
-
// special jQuery case for CommonJS (pass in a window)
|
34
|
-
module.exports = factory(require('jquery')(root), root);
|
35
|
-
}
|
36
|
-
} else {
|
37
|
-
root.Tablesaw = factory(jQuery, root);
|
38
|
-
}
|
39
|
-
}(typeof window !== "undefined" ? window : this, function ($, window) {
|
40
|
-
"use strict";
|
41
|
-
|
42
|
-
var document = window.document;
|
43
|
-
|
44
|
-
// Account for Tablesaw being loaded either before or after the DOMContentLoaded event is fired.
|
45
|
-
var domContentLoadedTriggered = /complete|loaded/.test(document.readyState);
|
46
|
-
document.addEventListener("DOMContentLoaded", function() {
|
47
|
-
domContentLoadedTriggered = true;
|
48
|
-
});
|
49
|
-
|
50
|
-
var Tablesaw = {
|
51
|
-
i18n: {
|
52
|
-
modeStack: "Stack",
|
53
|
-
modeSwipe: "Swipe",
|
54
|
-
modeToggle: "Toggle",
|
55
|
-
modeSwitchColumnsAbbreviated: "Cols",
|
56
|
-
modeSwitchColumns: "Columns",
|
57
|
-
columnToggleButton: "Columns",
|
58
|
-
columnToggleError: "No eligible columns.",
|
59
|
-
sort: "Sort",
|
60
|
-
swipePreviousColumn: "Previous column",
|
61
|
-
swipeNextColumn: "Next column"
|
62
|
-
},
|
63
|
-
// cut the mustard
|
64
|
-
mustard:
|
65
|
-
"head" in document && // IE9+, Firefox 4+, Safari 5.1+, Mobile Safari 4.1+, Opera 11.5+, Android 2.3+
|
66
|
-
(!window.blackberry || window.WebKitPoint) && // only WebKit Blackberry (OS 6+)
|
67
|
-
!window.operamini,
|
68
|
-
$: $,
|
69
|
-
_init: function(element) {
|
70
|
-
Tablesaw.$(element || document).trigger("enhance.tablesaw");
|
71
|
-
},
|
72
|
-
init: function(element) {
|
73
|
-
// Account for Tablesaw being loaded either before or after the DOMContentLoaded event is fired.
|
74
|
-
domContentLoadedTriggered =
|
75
|
-
domContentLoadedTriggered || /complete|loaded/.test(document.readyState);
|
76
|
-
if (!domContentLoadedTriggered) {
|
77
|
-
if ("addEventListener" in document) {
|
78
|
-
// Use raw DOMContentLoaded instead of shoestring (may have issues in Android 2.3, exhibited by stack table)
|
79
|
-
document.addEventListener("DOMContentLoaded", function() {
|
80
|
-
Tablesaw._init(element);
|
81
|
-
});
|
82
|
-
}
|
83
|
-
} else {
|
84
|
-
Tablesaw._init(element);
|
85
|
-
}
|
86
|
-
}
|
87
|
-
};
|
88
|
-
|
89
|
-
$(document).on("enhance.tablesaw", function() {
|
90
|
-
// Extend i18n config, if one exists.
|
91
|
-
if (typeof TablesawConfig !== "undefined" && TablesawConfig.i18n) {
|
92
|
-
Tablesaw.i18n = $.extend(Tablesaw.i18n, TablesawConfig.i18n || {});
|
93
|
-
}
|
94
|
-
|
95
|
-
Tablesaw.i18n.modes = [
|
96
|
-
Tablesaw.i18n.modeStack,
|
97
|
-
Tablesaw.i18n.modeSwipe,
|
98
|
-
Tablesaw.i18n.modeToggle
|
99
|
-
];
|
100
|
-
});
|
101
|
-
|
102
|
-
if (Tablesaw.mustard) {
|
103
|
-
$(document.documentElement).addClass("tablesaw-enhanced");
|
104
|
-
}
|
105
|
-
|
106
|
-
(function() {
|
107
|
-
var pluginName = "tablesaw";
|
108
|
-
var classes = {
|
109
|
-
toolbar: "tablesaw-bar"
|
110
|
-
};
|
111
|
-
var events = {
|
112
|
-
create: "tablesawcreate",
|
113
|
-
destroy: "tablesawdestroy",
|
114
|
-
refresh: "tablesawrefresh",
|
115
|
-
resize: "tablesawresize"
|
116
|
-
};
|
117
|
-
var defaultMode = "stack";
|
118
|
-
var initSelector = "table";
|
119
|
-
var initFilterSelector = "[data-tablesaw],[data-tablesaw-mode],[data-tablesaw-sortable]";
|
120
|
-
var defaultConfig = {};
|
121
|
-
|
122
|
-
Tablesaw.events = events;
|
123
|
-
|
124
|
-
var Table = function(element) {
|
125
|
-
if (!element) {
|
126
|
-
throw new Error("Tablesaw requires an element.");
|
127
|
-
}
|
128
|
-
|
129
|
-
this.table = element;
|
130
|
-
this.$table = $(element);
|
131
|
-
|
132
|
-
// only one <thead> and <tfoot> are allowed, per the specification
|
133
|
-
this.$thead = this.$table
|
134
|
-
.children()
|
135
|
-
.filter("thead")
|
136
|
-
.eq(0);
|
137
|
-
|
138
|
-
// multiple <tbody> are allowed, per the specification
|
139
|
-
this.$tbody = this.$table.children().filter("tbody");
|
140
|
-
|
141
|
-
this.mode = this.$table.attr("data-tablesaw-mode") || defaultMode;
|
142
|
-
|
143
|
-
this.$toolbar = null;
|
144
|
-
|
145
|
-
this.attributes = {
|
146
|
-
subrow: "data-tablesaw-subrow",
|
147
|
-
ignorerow: "data-tablesaw-ignorerow"
|
148
|
-
};
|
149
|
-
|
150
|
-
this.init();
|
151
|
-
};
|
152
|
-
|
153
|
-
Table.prototype.init = function() {
|
154
|
-
if (!this.$thead.length) {
|
155
|
-
throw new Error("tablesaw: a <thead> is required, but none was found.");
|
156
|
-
}
|
157
|
-
|
158
|
-
if (!this.$thead.find("th").length) {
|
159
|
-
throw new Error("tablesaw: no header cells found. Are you using <th> inside of <thead>?");
|
160
|
-
}
|
161
|
-
|
162
|
-
// assign an id if there is none
|
163
|
-
if (!this.$table.attr("id")) {
|
164
|
-
this.$table.attr("id", pluginName + "-" + Math.round(Math.random() * 10000));
|
165
|
-
}
|
166
|
-
|
167
|
-
this.createToolbar();
|
168
|
-
|
169
|
-
this._initCells();
|
170
|
-
|
171
|
-
this.$table.data(pluginName, this);
|
172
|
-
|
173
|
-
this.$table.trigger(events.create, [this]);
|
174
|
-
};
|
175
|
-
|
176
|
-
Table.prototype.getConfig = function(pluginSpecificConfig) {
|
177
|
-
// shoestring extend doesn’t support arbitrary args
|
178
|
-
var configs = $.extend(defaultConfig, pluginSpecificConfig || {});
|
179
|
-
return $.extend(configs, typeof TablesawConfig !== "undefined" ? TablesawConfig : {});
|
180
|
-
};
|
181
|
-
|
182
|
-
Table.prototype._getPrimaryHeaderRow = function() {
|
183
|
-
return this._getHeaderRows().eq(0);
|
184
|
-
};
|
185
|
-
|
186
|
-
Table.prototype._getHeaderRows = function() {
|
187
|
-
return this.$thead
|
188
|
-
.children()
|
189
|
-
.filter("tr")
|
190
|
-
.filter(function() {
|
191
|
-
return !$(this).is("[data-tablesaw-ignorerow]");
|
192
|
-
});
|
193
|
-
};
|
194
|
-
|
195
|
-
Table.prototype._getRowIndex = function($row) {
|
196
|
-
return $row.prevAll().length;
|
197
|
-
};
|
198
|
-
|
199
|
-
Table.prototype._getHeaderRowIndeces = function() {
|
200
|
-
var self = this;
|
201
|
-
var indeces = [];
|
202
|
-
this._getHeaderRows().each(function() {
|
203
|
-
indeces.push(self._getRowIndex($(this)));
|
204
|
-
});
|
205
|
-
return indeces;
|
206
|
-
};
|
207
|
-
|
208
|
-
Table.prototype._getPrimaryHeaderCells = function($row) {
|
209
|
-
return ($row || this._getPrimaryHeaderRow()).find("th");
|
210
|
-
};
|
211
|
-
|
212
|
-
Table.prototype._$getCells = function(th) {
|
213
|
-
var self = this;
|
214
|
-
return $(th)
|
215
|
-
.add(th.cells)
|
216
|
-
.filter(function() {
|
217
|
-
var $t = $(this);
|
218
|
-
var $row = $t.parent();
|
219
|
-
var hasColspan = $t.is("[colspan]");
|
220
|
-
// no subrows or ignored rows (keep cells in ignored rows that do not have a colspan)
|
221
|
-
return (
|
222
|
-
!$row.is("[" + self.attributes.subrow + "]") &&
|
223
|
-
(!$row.is("[" + self.attributes.ignorerow + "]") || !hasColspan)
|
224
|
-
);
|
225
|
-
});
|
226
|
-
};
|
227
|
-
|
228
|
-
Table.prototype._getVisibleColspan = function() {
|
229
|
-
var colspan = 0;
|
230
|
-
this._getPrimaryHeaderCells().each(function() {
|
231
|
-
var $t = $(this);
|
232
|
-
if ($t.css("display") !== "none") {
|
233
|
-
colspan += parseInt($t.attr("colspan"), 10) || 1;
|
234
|
-
}
|
235
|
-
});
|
236
|
-
return colspan;
|
237
|
-
};
|
238
|
-
|
239
|
-
Table.prototype.getColspanForCell = function($cell) {
|
240
|
-
var visibleColspan = this._getVisibleColspan();
|
241
|
-
var visibleSiblingColumns = 0;
|
242
|
-
if ($cell.closest("tr").data("tablesaw-rowspanned")) {
|
243
|
-
visibleSiblingColumns++;
|
244
|
-
}
|
245
|
-
|
246
|
-
$cell.siblings().each(function() {
|
247
|
-
var $t = $(this);
|
248
|
-
var colColspan = parseInt($t.attr("colspan"), 10) || 1;
|
249
|
-
|
250
|
-
if ($t.css("display") !== "none") {
|
251
|
-
visibleSiblingColumns += colColspan;
|
252
|
-
}
|
253
|
-
});
|
254
|
-
// console.log( $cell[ 0 ], visibleColspan, visibleSiblingColumns );
|
255
|
-
|
256
|
-
return visibleColspan - visibleSiblingColumns;
|
257
|
-
};
|
258
|
-
|
259
|
-
Table.prototype.isCellInColumn = function(header, cell) {
|
260
|
-
return $(header)
|
261
|
-
.add(header.cells)
|
262
|
-
.filter(function() {
|
263
|
-
return this === cell;
|
264
|
-
}).length;
|
265
|
-
};
|
266
|
-
|
267
|
-
Table.prototype.updateColspanCells = function(cls, header, userAction) {
|
268
|
-
var self = this;
|
269
|
-
var primaryHeaderRow = self._getPrimaryHeaderRow();
|
270
|
-
|
271
|
-
// find persistent column rowspans
|
272
|
-
this.$table.find("[rowspan][data-tablesaw-priority]").each(function() {
|
273
|
-
var $t = $(this);
|
274
|
-
if ($t.attr("data-tablesaw-priority") !== "persist") {
|
275
|
-
return;
|
276
|
-
}
|
277
|
-
|
278
|
-
var $row = $t.closest("tr");
|
279
|
-
var rowspan = parseInt($t.attr("rowspan"), 10);
|
280
|
-
if (rowspan > 1) {
|
281
|
-
$row = $row.next();
|
282
|
-
|
283
|
-
$row.data("tablesaw-rowspanned", true);
|
284
|
-
|
285
|
-
rowspan--;
|
286
|
-
}
|
287
|
-
});
|
288
|
-
|
289
|
-
this.$table
|
290
|
-
.find("[colspan],[data-tablesaw-maxcolspan]")
|
291
|
-
.filter(function() {
|
292
|
-
// is not in primary header row
|
293
|
-
return $(this).closest("tr")[0] !== primaryHeaderRow[0];
|
294
|
-
})
|
295
|
-
.each(function() {
|
296
|
-
var $cell = $(this);
|
297
|
-
|
298
|
-
if (userAction === undefined || self.isCellInColumn(header, this)) {
|
299
|
-
} else {
|
300
|
-
// if is not a user action AND the cell is not in the updating column, kill it
|
301
|
-
return;
|
302
|
-
}
|
303
|
-
|
304
|
-
var colspan = self.getColspanForCell($cell);
|
305
|
-
|
306
|
-
if (cls && userAction !== undefined) {
|
307
|
-
// console.log( colspan === 0 ? "addClass" : "removeClass", $cell );
|
308
|
-
$cell[colspan === 0 ? "addClass" : "removeClass"](cls);
|
309
|
-
}
|
310
|
-
|
311
|
-
// cache original colspan
|
312
|
-
var maxColspan = parseInt($cell.attr("data-tablesaw-maxcolspan"), 10);
|
313
|
-
if (!maxColspan) {
|
314
|
-
$cell.attr("data-tablesaw-maxcolspan", $cell.attr("colspan"));
|
315
|
-
} else if (colspan > maxColspan) {
|
316
|
-
colspan = maxColspan;
|
317
|
-
}
|
318
|
-
|
319
|
-
// console.log( this, "setting colspan to ", colspan );
|
320
|
-
$cell.attr("colspan", colspan);
|
321
|
-
});
|
322
|
-
};
|
323
|
-
|
324
|
-
Table.prototype._findPrimaryHeadersForCell = function(cell) {
|
325
|
-
var $headerRow = this._getPrimaryHeaderRow();
|
326
|
-
var headerRowIndex = this._getRowIndex($headerRow);
|
327
|
-
var results = [];
|
328
|
-
|
329
|
-
for (var rowNumber = 0; rowNumber < this.headerMapping.length; rowNumber++) {
|
330
|
-
if (rowNumber === headerRowIndex) {
|
331
|
-
continue;
|
332
|
-
}
|
333
|
-
|
334
|
-
for (var colNumber = 0; colNumber < this.headerMapping[rowNumber].length; colNumber++) {
|
335
|
-
if (this.headerMapping[rowNumber][colNumber] === cell) {
|
336
|
-
results.push(this.headerMapping[headerRowIndex][colNumber]);
|
337
|
-
}
|
338
|
-
}
|
339
|
-
}
|
340
|
-
|
341
|
-
return results;
|
342
|
-
};
|
343
|
-
|
344
|
-
// used by init cells
|
345
|
-
Table.prototype.getRows = function() {
|
346
|
-
var self = this;
|
347
|
-
return this.$table.find("tr").filter(function() {
|
348
|
-
return $(this)
|
349
|
-
.closest("table")
|
350
|
-
.is(self.$table);
|
351
|
-
});
|
352
|
-
};
|
353
|
-
|
354
|
-
// used by sortable
|
355
|
-
Table.prototype.getBodyRows = function(tbody) {
|
356
|
-
return (tbody ? $(tbody) : this.$tbody).children().filter("tr");
|
357
|
-
};
|
358
|
-
|
359
|
-
Table.prototype.getHeaderCellIndex = function(cell) {
|
360
|
-
var lookup = this.headerMapping[0];
|
361
|
-
for (var colIndex = 0; colIndex < lookup.length; colIndex++) {
|
362
|
-
if (lookup[colIndex] === cell) {
|
363
|
-
return colIndex;
|
364
|
-
}
|
365
|
-
}
|
366
|
-
|
367
|
-
return -1;
|
368
|
-
};
|
369
|
-
|
370
|
-
Table.prototype._initCells = function() {
|
371
|
-
// re-establish original colspans
|
372
|
-
this.$table.find("[data-tablesaw-maxcolspan]").each(function() {
|
373
|
-
var $t = $(this);
|
374
|
-
$t.attr("colspan", $t.attr("data-tablesaw-maxcolspan"));
|
375
|
-
});
|
376
|
-
|
377
|
-
var $rows = this.getRows();
|
378
|
-
var columnLookup = [];
|
379
|
-
|
380
|
-
$rows.each(function(rowNumber) {
|
381
|
-
columnLookup[rowNumber] = [];
|
382
|
-
});
|
383
|
-
|
384
|
-
$rows.each(function(rowNumber) {
|
385
|
-
var coltally = 0;
|
386
|
-
var $t = $(this);
|
387
|
-
var children = $t.children();
|
388
|
-
|
389
|
-
children.each(function() {
|
390
|
-
var colspan = parseInt(
|
391
|
-
this.getAttribute("data-tablesaw-maxcolspan") || this.getAttribute("colspan"),
|
392
|
-
10
|
393
|
-
);
|
394
|
-
var rowspan = parseInt(this.getAttribute("rowspan"), 10);
|
395
|
-
|
396
|
-
// set in a previous rowspan
|
397
|
-
while (columnLookup[rowNumber][coltally]) {
|
398
|
-
coltally++;
|
399
|
-
}
|
400
|
-
|
401
|
-
columnLookup[rowNumber][coltally] = this;
|
402
|
-
|
403
|
-
// TODO? both colspan and rowspan
|
404
|
-
if (colspan) {
|
405
|
-
for (var k = 0; k < colspan - 1; k++) {
|
406
|
-
coltally++;
|
407
|
-
columnLookup[rowNumber][coltally] = this;
|
408
|
-
}
|
409
|
-
}
|
410
|
-
if (rowspan) {
|
411
|
-
for (var j = 1; j < rowspan; j++) {
|
412
|
-
columnLookup[rowNumber + j][coltally] = this;
|
413
|
-
}
|
414
|
-
}
|
415
|
-
|
416
|
-
coltally++;
|
417
|
-
});
|
418
|
-
});
|
419
|
-
|
420
|
-
var headerRowIndeces = this._getHeaderRowIndeces();
|
421
|
-
for (var colNumber = 0; colNumber < columnLookup[0].length; colNumber++) {
|
422
|
-
for (var headerIndex = 0, k = headerRowIndeces.length; headerIndex < k; headerIndex++) {
|
423
|
-
var headerCol = columnLookup[headerRowIndeces[headerIndex]][colNumber];
|
424
|
-
|
425
|
-
var rowNumber = headerRowIndeces[headerIndex];
|
426
|
-
var rowCell;
|
427
|
-
|
428
|
-
if (!headerCol.cells) {
|
429
|
-
headerCol.cells = [];
|
430
|
-
}
|
431
|
-
|
432
|
-
while (rowNumber < columnLookup.length) {
|
433
|
-
rowCell = columnLookup[rowNumber][colNumber];
|
434
|
-
|
435
|
-
if (headerCol !== rowCell) {
|
436
|
-
headerCol.cells.push(rowCell);
|
437
|
-
}
|
438
|
-
|
439
|
-
rowNumber++;
|
440
|
-
}
|
441
|
-
}
|
442
|
-
}
|
443
|
-
|
444
|
-
this.headerMapping = columnLookup;
|
445
|
-
};
|
446
|
-
|
447
|
-
Table.prototype.refresh = function() {
|
448
|
-
this._initCells();
|
449
|
-
|
450
|
-
this.$table.trigger(events.refresh, [this]);
|
451
|
-
};
|
452
|
-
|
453
|
-
Table.prototype._getToolbarAnchor = function() {
|
454
|
-
var $parent = this.$table.parent();
|
455
|
-
if ($parent.is(".tablesaw-overflow")) {
|
456
|
-
return $parent;
|
457
|
-
}
|
458
|
-
return this.$table;
|
459
|
-
};
|
460
|
-
|
461
|
-
Table.prototype._getToolbar = function($anchor) {
|
462
|
-
if (!$anchor) {
|
463
|
-
$anchor = this._getToolbarAnchor();
|
464
|
-
}
|
465
|
-
return $anchor.prev().filter("." + classes.toolbar);
|
466
|
-
};
|
467
|
-
|
468
|
-
Table.prototype.createToolbar = function() {
|
469
|
-
// Insert the toolbar
|
470
|
-
// TODO move this into a separate component
|
471
|
-
var $anchor = this._getToolbarAnchor();
|
472
|
-
var $toolbar = this._getToolbar($anchor);
|
473
|
-
if (!$toolbar.length) {
|
474
|
-
$toolbar = $("<div>")
|
475
|
-
.addClass(classes.toolbar)
|
476
|
-
.insertBefore($anchor);
|
477
|
-
}
|
478
|
-
this.$toolbar = $toolbar;
|
479
|
-
|
480
|
-
if (this.mode) {
|
481
|
-
this.$toolbar.addClass("tablesaw-mode-" + this.mode);
|
482
|
-
}
|
483
|
-
};
|
484
|
-
|
485
|
-
Table.prototype.destroy = function() {
|
486
|
-
// Don’t remove the toolbar, just erase the classes on it.
|
487
|
-
// Some of the table features are not yet destroy-friendly.
|
488
|
-
this._getToolbar().each(function() {
|
489
|
-
this.className = this.className.replace(/\btablesaw-mode\-\w*\b/gi, "");
|
490
|
-
});
|
491
|
-
|
492
|
-
var tableId = this.$table.attr("id");
|
493
|
-
$(document).off("." + tableId);
|
494
|
-
$(window).off("." + tableId);
|
495
|
-
|
496
|
-
// other plugins
|
497
|
-
this.$table.trigger(events.destroy, [this]);
|
498
|
-
|
499
|
-
this.$table.removeData(pluginName);
|
500
|
-
};
|
501
|
-
|
502
|
-
// Collection method.
|
503
|
-
$.fn[pluginName] = function() {
|
504
|
-
return this.each(function() {
|
505
|
-
var $t = $(this);
|
506
|
-
|
507
|
-
if ($t.data(pluginName)) {
|
508
|
-
return;
|
509
|
-
}
|
510
|
-
|
511
|
-
new Table(this);
|
512
|
-
});
|
513
|
-
};
|
514
|
-
|
515
|
-
var $doc = $(document);
|
516
|
-
$doc.on("enhance.tablesaw", function(e) {
|
517
|
-
// Cut the mustard
|
518
|
-
if (Tablesaw.mustard) {
|
519
|
-
var $target = $(e.target);
|
520
|
-
if ($target.parent().length) {
|
521
|
-
$target = $target.parent();
|
522
|
-
}
|
523
|
-
|
524
|
-
$target
|
525
|
-
.find(initSelector)
|
526
|
-
.filter(initFilterSelector)
|
527
|
-
[pluginName]();
|
528
|
-
}
|
529
|
-
});
|
530
|
-
|
531
|
-
// Avoid a resize during scroll:
|
532
|
-
// Some Mobile devices trigger a resize during scroll (sometimes when
|
533
|
-
// doing elastic stretch at the end of the document or from the
|
534
|
-
// location bar hide)
|
535
|
-
var isScrolling = false;
|
536
|
-
var scrollTimeout;
|
537
|
-
$doc.on("scroll.tablesaw", function() {
|
538
|
-
isScrolling = true;
|
539
|
-
|
540
|
-
window.clearTimeout(scrollTimeout);
|
541
|
-
scrollTimeout = window.setTimeout(function() {
|
542
|
-
isScrolling = false;
|
543
|
-
}, 300); // must be greater than the resize timeout below
|
544
|
-
});
|
545
|
-
|
546
|
-
var resizeTimeout;
|
547
|
-
$(window).on("resize", function() {
|
548
|
-
if (!isScrolling) {
|
549
|
-
window.clearTimeout(resizeTimeout);
|
550
|
-
resizeTimeout = window.setTimeout(function() {
|
551
|
-
$doc.trigger(events.resize);
|
552
|
-
}, 150); // must be less than the scrolling timeout above.
|
553
|
-
}
|
554
|
-
});
|
555
|
-
|
556
|
-
Tablesaw.Table = Table;
|
557
|
-
})();
|
558
|
-
|
559
|
-
(function() {
|
560
|
-
var classes = {
|
561
|
-
stackTable: "tablesaw-stack",
|
562
|
-
cellLabels: "tablesaw-cell-label",
|
563
|
-
cellContentLabels: "tablesaw-cell-content"
|
564
|
-
};
|
565
|
-
|
566
|
-
var data = {
|
567
|
-
key: "tablesaw-stack"
|
568
|
-
};
|
569
|
-
|
570
|
-
var attrs = {
|
571
|
-
labelless: "data-tablesaw-no-labels",
|
572
|
-
hideempty: "data-tablesaw-hide-empty"
|
573
|
-
};
|
574
|
-
|
575
|
-
var Stack = function(element, tablesaw) {
|
576
|
-
this.tablesaw = tablesaw;
|
577
|
-
this.$table = $(element);
|
578
|
-
|
579
|
-
this.labelless = this.$table.is("[" + attrs.labelless + "]");
|
580
|
-
this.hideempty = this.$table.is("[" + attrs.hideempty + "]");
|
581
|
-
|
582
|
-
this.$table.data(data.key, this);
|
583
|
-
};
|
584
|
-
|
585
|
-
Stack.prototype.init = function() {
|
586
|
-
this.$table.addClass(classes.stackTable);
|
587
|
-
|
588
|
-
if (this.labelless) {
|
589
|
-
return;
|
590
|
-
}
|
591
|
-
|
592
|
-
var self = this;
|
593
|
-
|
594
|
-
this.$table
|
595
|
-
.find("th, td")
|
596
|
-
.filter(function() {
|
597
|
-
return !$(this).closest("thead").length;
|
598
|
-
})
|
599
|
-
.filter(function() {
|
600
|
-
return (
|
601
|
-
!$(this).is("[" + attrs.labelless + "]") &&
|
602
|
-
!$(this)
|
603
|
-
.closest("tr")
|
604
|
-
.is("[" + attrs.labelless + "]") &&
|
605
|
-
(!self.hideempty || !!$(this).html())
|
606
|
-
);
|
607
|
-
})
|
608
|
-
.each(function() {
|
609
|
-
var $newHeader = $(document.createElement("b")).addClass(classes.cellLabels);
|
610
|
-
var $cell = $(this);
|
611
|
-
|
612
|
-
$(self.tablesaw._findPrimaryHeadersForCell(this)).each(function(index) {
|
613
|
-
var $header = $(this.cloneNode(true));
|
614
|
-
// TODO decouple from sortable better
|
615
|
-
// Changed from .text() in https://github.com/filamentgroup/tablesaw/commit/b9c12a8f893ec192830ec3ba2d75f062642f935b
|
616
|
-
// to preserve structural html in headers, like <a>
|
617
|
-
var $sortableButton = $header.find(".tablesaw-sortable-btn");
|
618
|
-
$header.find(".tablesaw-sortable-arrow").remove();
|
619
|
-
|
620
|
-
// TODO decouple from checkall better
|
621
|
-
var $checkall = $header.find("[data-tablesaw-checkall]");
|
622
|
-
$checkall.closest("label").remove();
|
623
|
-
if ($checkall.length) {
|
624
|
-
$newHeader = $([]);
|
625
|
-
return;
|
626
|
-
}
|
627
|
-
|
628
|
-
if (index > 0) {
|
629
|
-
$newHeader.append(document.createTextNode(", "));
|
630
|
-
}
|
631
|
-
|
632
|
-
var parentNode = $sortableButton.length ? $sortableButton[0] : $header[0];
|
633
|
-
var el;
|
634
|
-
while ((el = parentNode.firstChild)) {
|
635
|
-
$newHeader[0].appendChild(el);
|
636
|
-
}
|
637
|
-
});
|
638
|
-
|
639
|
-
if ($newHeader.length && !$cell.find("." + classes.cellContentLabels).length) {
|
640
|
-
$cell.wrapInner("<span class='" + classes.cellContentLabels + "'></span>");
|
641
|
-
}
|
642
|
-
|
643
|
-
// Update if already exists.
|
644
|
-
var $label = $cell.find("." + classes.cellLabels);
|
645
|
-
if (!$label.length) {
|
646
|
-
$cell.prepend(document.createTextNode(" "));
|
647
|
-
$cell.prepend($newHeader);
|
648
|
-
} else {
|
649
|
-
// only if changed
|
650
|
-
$label.replaceWith($newHeader);
|
651
|
-
}
|
652
|
-
});
|
653
|
-
};
|
654
|
-
|
655
|
-
Stack.prototype.destroy = function() {
|
656
|
-
this.$table.removeClass(classes.stackTable);
|
657
|
-
this.$table.find("." + classes.cellLabels).remove();
|
658
|
-
this.$table.find("." + classes.cellContentLabels).each(function() {
|
659
|
-
$(this).replaceWith($(this.childNodes));
|
660
|
-
});
|
661
|
-
};
|
662
|
-
|
663
|
-
// on tablecreate, init
|
664
|
-
$(document)
|
665
|
-
.on(Tablesaw.events.create, function(e, tablesaw) {
|
666
|
-
if (tablesaw.mode === "stack") {
|
667
|
-
var table = new Stack(tablesaw.table, tablesaw);
|
668
|
-
table.init();
|
669
|
-
}
|
670
|
-
})
|
671
|
-
.on(Tablesaw.events.refresh, function(e, tablesaw) {
|
672
|
-
if (tablesaw.mode === "stack") {
|
673
|
-
$(tablesaw.table)
|
674
|
-
.data(data.key)
|
675
|
-
.init();
|
676
|
-
}
|
677
|
-
})
|
678
|
-
.on(Tablesaw.events.destroy, function(e, tablesaw) {
|
679
|
-
if (tablesaw.mode === "stack") {
|
680
|
-
$(tablesaw.table)
|
681
|
-
.data(data.key)
|
682
|
-
.destroy();
|
683
|
-
}
|
684
|
-
});
|
685
|
-
|
686
|
-
Tablesaw.Stack = Stack;
|
687
|
-
})();
|
688
|
-
return Tablesaw;
|
689
|
-
|
690
|
-
}));
|
19
|
+
!function(e,a){"function"==typeof define&&define.amd?define(["jquery"],function(t){return e.Tablesaw=a(t,e)}):"object"==typeof exports?"document"in e?module.exports=a(require("jquery"),e):module.exports=a(require("jquery")(e),e):e.Tablesaw=a(jQuery,e)}("undefined"!=typeof window?window:this,function(h,c){"use strict";var u=c.document,a=/complete|loaded/.test(u.readyState);u.addEventListener("DOMContentLoaded",function(){a=!0});var p={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"},breakpoint:{xl:"1200px",lg:"992px",md:"768px",sm:"576px",xs:"575px",default:"992px"},mustard:"head"in u&&(!c.blackberry||c.WebKitPoint)&&!c.operamini,$:h,_init:function(t,e){p.$(t||u).trigger("enhance.tablesaw"),p.options=e},init:function(t,e){(a=a||/complete|loaded/.test(u.readyState))?p._init(t,e):"addEventListener"in u&&u.addEventListener("DOMContentLoaded",function(){p._init(t,e)})}};return h(u).on("enhance.tablesaw",function(){"undefined"!=typeof TablesawConfig&&TablesawConfig.i18n&&(p.i18n=h.extend(p.i18n,TablesawConfig.i18n||{})),p.i18n.modes=[p.i18n.modeStack,p.i18n.modeSwipe,p.i18n.modeToggle]}),p.mustard&&h(u.documentElement).addClass("tablesaw-enhanced"),function(){var e="tablesaw",a="tablesaw-bar",n={create:"tablesawcreate",destroy:"tablesawdestroy",refresh:"tablesawrefresh",resize:"tablesawresize"},i={},r=log4javascript.getLogger("j1.rtable");function t(t){if(!t)throw new Error("Tablesaw requires an element.");this.table=t,this.$table=h(t),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()}p.events=n,t.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",e+"-"+Math.round(1e4*Math.random())),this.createToolbar(),this._initCells(),this.$table.data(e,this),this.$table.trigger(n.create,[this])},t.prototype.getConfig=function(t){t=h.extend(i,t||{});return h.extend(t,"undefined"!=typeof TablesawConfig?TablesawConfig:{})},t.prototype._getPrimaryHeaderRow=function(){return this._getHeaderRows().eq(0)},t.prototype._getHeaderRows=function(){return this.$thead.children().filter("tr").filter(function(){return!h(this).is("[data-tablesaw-ignorerow]")})},t.prototype._getRowIndex=function(t){return t.prevAll().length},t.prototype._getHeaderRowIndeces=function(){var t=this,e=[];return this._getHeaderRows().each(function(){e.push(t._getRowIndex(h(this)))}),e},t.prototype._getPrimaryHeaderCells=function(t){return(t||this._getPrimaryHeaderRow()).find("th")},t.prototype._$getCells=function(t){var a=this;return h(t).add(t.cells).filter(function(){var t=h(this),e=t.parent(),t=t.is("[colspan]");return!(e.is("["+a.attributes.subrow+"]")||e.is("["+a.attributes.ignorerow+"]")&&t)})},t.prototype._getVisibleColspan=function(){var e=0;return this._getPrimaryHeaderCells().each(function(){var t=h(this);"none"!==t.css("display")&&(e+=parseInt(t.attr("colspan"),10)||1)}),e},t.prototype.getColspanForCell=function(t){var e=this._getVisibleColspan(),a=0;return t.closest("tr").data("tablesaw-rowspanned")&&a++,t.siblings().each(function(){var t=h(this),e=parseInt(t.attr("colspan"),10)||1;"none"!==t.css("display")&&(a+=e)}),e-a},t.prototype.isCellInColumn=function(t,e){return h(t).add(t.cells).filter(function(){return this===e}).length},t.prototype.updateColspanCells=function(n,i,r){var o=this,t=o._getPrimaryHeaderRow();this.$table.find("[rowspan][data-tablesaw-priority]").each(function(){var t,e=h(this);"persist"===e.attr("data-tablesaw-priority")&&(t=e.closest("tr"),1<(e=parseInt(e.attr("rowspan"),10))&&((t=t.next()).data("tablesaw-rowspanned",!0),e--))}),this.$table.find("[colspan],[data-tablesaw-maxcolspan]").filter(function(){return h(this).closest("tr")[0]!==t[0]}).each(function(){var t,e,a=h(this);void 0!==r&&!o.isCellInColumn(i,this)||(t=o.getColspanForCell(a),n&&void 0!==r&&a[0===t?"addClass":"removeClass"](n),(e=parseInt(a.attr("data-tablesaw-maxcolspan"),10))?e<t&&(t=e):a.attr("data-tablesaw-maxcolspan",a.attr("colspan")),a.attr("colspan",t))})},t.prototype._findPrimaryHeadersForCell=function(t){for(var e=this._getPrimaryHeaderRow(),a=this._getRowIndex(e),n=[],i=0;i<this.headerMapping.length;i++)if(i!==a)for(var r=0;r<this.headerMapping[i].length;r++)this.headerMapping[i][r]===t&&n.push(this.headerMapping[a][r]);return n},t.prototype.getRows=function(){var t=this;return this.$table.find("tr").filter(function(){return h(this).closest("table").is(t.$table)})},t.prototype.getBodyRows=function(t){return(t?h(t):this.$tbody).children().filter("tr")},t.prototype.getHeaderCellIndex=function(t){for(var e=this.headerMapping[0],a=0;a<e.length;a++)if(e[a]===t)return a;return-1},t.prototype._initCells=function(){this.$table.find("[data-tablesaw-maxcolspan]").each(function(){var t=h(this);t.attr("colspan",t.attr("data-tablesaw-maxcolspan"))});var t=this.getRows(),o=[];t.each(function(t){o[t]=[]}),t.each(function(i){var r=0;h(this).children().each(function(){for(var t=parseInt(this.getAttribute("data-tablesaw-maxcolspan")||this.getAttribute("colspan"),10),e=parseInt(this.getAttribute("rowspan"),10);o[i][r];)r++;if(o[i][r]=this,t)for(var a=0;a<t-1;a++)r++,o[i][r]=this;if(e)for(var n=1;n<e;n++)o[i+n][r]=this;r++})});for(var e=this._getHeaderRowIndeces(),a=0;a<o[0].length;a++)for(var n=0,i=e.length;n<i;n++){var r,s=o[e[n]][a],l=e[n];for(s.cells||(s.cells=[]);l<o.length;)s!==(r=o[l][a])&&s.cells.push(r),l++}this.headerMapping=o},t.prototype.refresh=function(){this._initCells(),this.$table.trigger(n.refresh,[this])},t.prototype._getToolbarAnchor=function(){var t=this.$table.parent();return t.is(".tablesaw-overflow")?t:this.$table},t.prototype._getToolbar=function(t){return(t=t||this._getToolbarAnchor()).prev().filter("."+a)},t.prototype.createToolbar=function(){var t=this._getToolbarAnchor(),e=this._getToolbar(t);e.length||(e=h("<div>").addClass(a).insertBefore(t)),this.$toolbar=e,this.mode&&this.$toolbar.addClass("tablesaw-mode-"+this.mode)},t.prototype.destroy=function(){this._getToolbar().each(function(){this.className=this.className.replace(/\btablesaw-mode\-\w*\b/gi,"")});var t=this.$table.attr("id");h(u).off("."+t),h(c).off("."+t),this.$table.trigger(n.destroy,[this]),this.$table.removeData(e)},h.fn[e]=function(){return this.each(function(){h(this).data(e)||new t(this)})};var o=h(u);o.on("enhance.tablesaw",function(t){p.mustard&&((t=h(t.target)).parent().length&&(t=t.parent()),t.find("table").filter("[data-tablesaw],[data-tablesaw-mode],[data-tablesaw-sortable]")[e]())});var s,l,d=!1;o.on("scroll.tablesaw",function(){d=!0,c.clearTimeout(s),s=c.setTimeout(function(){d=!1},300)}),h(c).on("resize",function(){h("table").each(function(){var t,e=h(this);h(e).hasClass("rtable")&&(h(c).width(),h(c).width()<p.options.breakpoint?(t="\nhide colgroups: "+e.attr("id"),e.find("colgroup").hide()):(t="\nshow colgroup: "+e.attr("id"),e.find("colgroup").show()),r.debug(t))}),d||(c.clearTimeout(l),l=c.setTimeout(function(){o.trigger(n.resize)},150))}),p.Table=t}(),function(){function a(t,e){this.tablesaw=e,this.$table=h(t),this.labelless=this.$table.is("["+o+"]"),this.hideempty=this.$table.is("["+s+"]"),this.$table.data(r,this)}var t="tablesaw-stack",n="tablesaw-cell-label",i="tablesaw-cell-content",r="tablesaw-stack",o="data-tablesaw-no-labels",s="data-tablesaw-hide-empty";a.prototype.init=function(){var a;this.$table.addClass(t),this.labelless||(a=this).$table.find("th, td").filter(function(){return!h(this).closest("thead").length}).filter(function(){return!(h(this).is("["+o+"]")||h(this).closest("tr").is("["+o+"]")||a.hideempty&&!h(this).html())}).each(function(){var o=h(u.createElement("b")).addClass(n),t=h(this);h(a.tablesaw._findPrimaryHeadersForCell(this)).each(function(t){var e=h(this.cloneNode(!0)),a=e.find(".tablesaw-sortable-btn");e.find(".tablesaw-sortable-arrow").remove();var n=e.find("[data-tablesaw-checkall]");if(n.closest("label").remove(),n.length)o=h([]);else{0<t&&o.append(u.createTextNode(", "));for(var i,r=(a.length?a:e)[0];i=r.firstChild;)o[0].appendChild(i)}}),o.length&&!t.find("."+i).length&&t.wrapInner("<span class='"+i+"'></span>");var e=t.find("."+n);e.length?e.replaceWith(o):(t.prepend(u.createTextNode(" ")),t.prepend(o))})},a.prototype.destroy=function(){this.$table.removeClass(t),this.$table.find("."+n).remove(),this.$table.find("."+i).each(function(){h(this).replaceWith(h(this.childNodes))})},h(u).on(p.events.create,function(t,e){"stack"===e.mode&&new a(e.table,e).init()}).on(p.events.refresh,function(t,e){"stack"===e.mode&&h(e.table).data(r).init()}).on(p.events.destroy,function(t,e){"stack"===e.mode&&h(e.table).data(r).destroy()}),p.Stack=a}(),p});
|