fomantic-ui 2.9.1-beta.2 → 2.9.1-beta.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +111 -0
- package/.github/workflows/ci.yml +14 -4
- package/.stylelintrc.js +59 -0
- package/dist/components/accordion.css +19 -26
- package/dist/components/accordion.js +568 -595
- package/dist/components/accordion.min.css +1 -1
- package/dist/components/accordion.min.js +2 -2
- package/dist/components/ad.css +31 -41
- package/dist/components/ad.min.css +1 -1
- package/dist/components/api.js +1156 -1179
- package/dist/components/api.min.js +2 -2
- package/dist/components/breadcrumb.css +1 -1
- package/dist/components/breadcrumb.min.css +1 -1
- package/dist/components/button.css +71 -106
- package/dist/components/button.min.css +1 -1
- package/dist/components/calendar.css +18 -16
- package/dist/components/calendar.js +1902 -1809
- package/dist/components/calendar.min.css +2 -2
- package/dist/components/calendar.min.js +2 -2
- package/dist/components/card.css +83 -115
- package/dist/components/card.min.css +1 -1
- package/dist/components/checkbox.css +47 -64
- package/dist/components/checkbox.js +842 -841
- package/dist/components/checkbox.min.css +1 -1
- package/dist/components/checkbox.min.js +2 -2
- package/dist/components/comment.css +37 -51
- package/dist/components/comment.min.css +1 -1
- package/dist/components/container.css +6 -5
- package/dist/components/container.min.css +2 -2
- package/dist/components/dimmer.css +31 -41
- package/dist/components/dimmer.js +708 -737
- package/dist/components/dimmer.min.css +1 -1
- package/dist/components/dimmer.min.js +2 -2
- package/dist/components/divider.css +32 -44
- package/dist/components/divider.min.css +1 -1
- package/dist/components/dropdown.css +129 -166
- package/dist/components/dropdown.js +4161 -4234
- package/dist/components/dropdown.min.css +2 -2
- package/dist/components/dropdown.min.js +2 -2
- package/dist/components/embed.css +13 -19
- package/dist/components/embed.js +651 -675
- package/dist/components/embed.min.css +1 -1
- package/dist/components/embed.min.js +2 -2
- package/dist/components/emoji.css +7 -6
- package/dist/components/feed.css +24 -32
- package/dist/components/feed.min.css +1 -1
- package/dist/components/flag.css +5 -3
- package/dist/components/flag.min.css +1 -1
- package/dist/components/flyout.css +44 -58
- package/dist/components/flyout.js +1464 -1465
- package/dist/components/flyout.min.css +2 -2
- package/dist/components/flyout.min.js +2 -2
- package/dist/components/form.css +85 -111
- package/dist/components/form.js +1979 -2004
- package/dist/components/form.min.css +1 -1
- package/dist/components/form.min.js +2 -2
- package/dist/components/grid.css +70 -96
- package/dist/components/grid.min.css +1 -1
- package/dist/components/header.css +47 -65
- package/dist/components/header.min.css +1 -1
- package/dist/components/icon.css +45 -66
- package/dist/components/icon.min.css +2 -2
- package/dist/components/image.css +32 -42
- package/dist/components/image.min.css +1 -1
- package/dist/components/input.css +182 -65
- package/dist/components/input.min.css +2 -2
- package/dist/components/item.css +55 -77
- package/dist/components/item.min.css +1 -1
- package/dist/components/label.css +68 -91
- package/dist/components/label.min.css +2 -2
- package/dist/components/list.css +44 -59
- package/dist/components/list.min.css +1 -1
- package/dist/components/loader.css +16 -22
- package/dist/components/loader.min.css +1 -1
- package/dist/components/menu.css +126 -186
- package/dist/components/message.css +25 -35
- package/dist/components/message.min.css +1 -1
- package/dist/components/modal.css +39 -40
- package/dist/components/modal.js +1491 -1485
- package/dist/components/modal.min.css +2 -2
- package/dist/components/modal.min.js +2 -2
- package/dist/components/nag.css +21 -28
- package/dist/components/nag.js +518 -526
- package/dist/components/nag.min.css +2 -2
- package/dist/components/nag.min.js +2 -2
- package/dist/components/placeholder.css +10 -12
- package/dist/components/placeholder.min.css +1 -1
- package/dist/components/popup.css +352 -59
- package/dist/components/popup.js +1437 -1456
- package/dist/components/popup.min.css +2 -2
- package/dist/components/popup.min.js +2 -2
- package/dist/components/progress.css +29 -39
- package/dist/components/progress.js +969 -997
- package/dist/components/progress.min.css +1 -1
- package/dist/components/progress.min.js +2 -2
- package/dist/components/rail.css +15 -20
- package/dist/components/rail.min.css +1 -1
- package/dist/components/rating.css +9 -13
- package/dist/components/rating.js +505 -523
- package/dist/components/rating.min.css +1 -1
- package/dist/components/rating.min.js +2 -2
- package/dist/components/reset.css +1 -1
- package/dist/components/reset.min.css +1 -1
- package/dist/components/reveal.css +19 -26
- package/dist/components/reveal.min.css +1 -1
- package/dist/components/search.css +43 -58
- package/dist/components/search.js +1498 -1534
- package/dist/components/search.min.css +2 -2
- package/dist/components/search.min.js +2 -2
- package/dist/components/segment.css +64 -83
- package/dist/components/segment.min.css +2 -2
- package/dist/components/shape.css +10 -14
- package/dist/components/shape.js +792 -809
- package/dist/components/shape.min.css +1 -1
- package/dist/components/shape.min.js +2 -2
- package/dist/components/sidebar.css +43 -58
- package/dist/components/sidebar.js +1071 -1098
- package/dist/components/sidebar.min.css +2 -2
- package/dist/components/sidebar.min.js +2 -2
- package/dist/components/site.css +5 -5
- package/dist/components/site.js +462 -476
- package/dist/components/site.min.css +1 -1
- package/dist/components/site.min.js +2 -2
- package/dist/components/slider.css +27 -37
- package/dist/components/slider.js +1287 -1306
- package/dist/components/slider.min.js +2 -2
- package/dist/components/state.js +639 -657
- package/dist/components/state.min.js +2 -2
- package/dist/components/statistic.css +32 -41
- package/dist/components/statistic.min.css +2 -2
- package/dist/components/step.css +26 -35
- package/dist/components/step.min.css +1 -1
- package/dist/components/sticky.css +1 -1
- package/dist/components/sticky.js +857 -902
- package/dist/components/sticky.min.css +1 -1
- package/dist/components/sticky.min.js +2 -2
- package/dist/components/tab.css +6 -8
- package/dist/components/tab.js +922 -963
- package/dist/components/tab.min.css +1 -1
- package/dist/components/tab.min.js +2 -2
- package/dist/components/table.css +93 -119
- package/dist/components/table.min.css +2 -2
- package/dist/components/text.css +1 -1
- package/dist/components/text.min.css +1 -1
- package/dist/components/toast.css +4 -6
- package/dist/components/toast.js +886 -887
- package/dist/components/toast.min.css +1 -1
- package/dist/components/toast.min.js +2 -2
- package/dist/components/transition.css +179 -42
- package/dist/components/transition.js +1041 -1077
- package/dist/components/transition.min.css +2 -2
- package/dist/components/transition.min.js +2 -2
- package/dist/components/visibility.js +1220 -1244
- package/dist/components/visibility.min.js +2 -2
- package/dist/semantic.css +2558 -1807
- package/dist/semantic.js +28960 -29413
- package/dist/semantic.min.css +2 -2
- package/dist/semantic.min.js +2 -2
- package/dist/themes/default/assets/fonts/Lato-Bold.woff +0 -0
- package/dist/themes/default/assets/fonts/Lato-Bold.woff2 +0 -0
- package/dist/themes/default/assets/fonts/Lato-BoldItalic.woff +0 -0
- package/dist/themes/default/assets/fonts/Lato-BoldItalic.woff2 +0 -0
- package/dist/themes/default/assets/fonts/Lato-Italic.woff +0 -0
- package/dist/themes/default/assets/fonts/Lato-Italic.woff2 +0 -0
- package/dist/themes/default/assets/fonts/Lato-Regular.woff +0 -0
- package/dist/themes/default/assets/fonts/Lato-Regular.woff2 +0 -0
- package/dist/themes/default/assets/fonts/LatoLatin-Bold.woff +0 -0
- package/dist/themes/default/assets/fonts/LatoLatin-Bold.woff2 +0 -0
- package/dist/themes/default/assets/fonts/LatoLatin-BoldItalic.woff +0 -0
- package/dist/themes/default/assets/fonts/LatoLatin-BoldItalic.woff2 +0 -0
- package/dist/themes/default/assets/fonts/LatoLatin-Italic.woff +0 -0
- package/dist/themes/default/assets/fonts/LatoLatin-Italic.woff2 +0 -0
- package/dist/themes/default/assets/fonts/LatoLatin-Regular.woff +0 -0
- package/dist/themes/default/assets/fonts/LatoLatin-Regular.woff2 +0 -0
- package/examples/assets/show-examples.js +13 -13
- package/gulpfile.js +9 -10
- package/package.json +13 -8
- package/scripts/nightly-version.js +81 -75
- package/src/_site/collections/menu.overrides +1 -1
- package/src/_site/elements/flag.variables +2 -2
- package/src/_site/globals/site.variables +1 -1
- package/src/definitions/behaviors/api.js +1157 -1180
- package/src/definitions/behaviors/form.js +1978 -2003
- package/src/definitions/behaviors/state.js +645 -663
- package/src/definitions/behaviors/visibility.js +1219 -1243
- package/src/definitions/collections/breadcrumb.less +41 -45
- package/src/definitions/collections/form.less +864 -882
- package/src/definitions/collections/grid.less +1689 -1697
- package/src/definitions/collections/menu.less +1490 -1508
- package/src/definitions/collections/message.less +292 -295
- package/src/definitions/collections/table.less +1616 -1620
- package/src/definitions/elements/button.less +1710 -1754
- package/src/definitions/elements/container.less +209 -209
- package/src/definitions/elements/divider.less +200 -209
- package/src/definitions/elements/emoji.less +38 -45
- package/src/definitions/elements/flag.less +44 -46
- package/src/definitions/elements/header.less +337 -345
- package/src/definitions/elements/icon.less +516 -451
- package/src/definitions/elements/image.less +219 -225
- package/src/definitions/elements/input.less +657 -663
- package/src/definitions/elements/label.less +783 -804
- package/src/definitions/elements/list.less +808 -812
- package/src/definitions/elements/loader.less +269 -266
- package/src/definitions/elements/placeholder.less +171 -168
- package/src/definitions/elements/rail.less +91 -91
- package/src/definitions/elements/reveal.less +190 -196
- package/src/definitions/elements/segment.less +738 -747
- package/src/definitions/elements/step.less +424 -435
- package/src/definitions/elements/text.less +32 -34
- package/src/definitions/globals/reset.less +9 -6
- package/src/definitions/globals/site.js +461 -475
- package/src/definitions/globals/site.less +106 -108
- package/src/definitions/modules/accordion.js +567 -594
- package/src/definitions/modules/accordion.less +242 -246
- package/src/definitions/modules/calendar.js +1901 -1808
- package/src/definitions/modules/calendar.less +98 -95
- package/src/definitions/modules/checkbox.js +841 -840
- package/src/definitions/modules/checkbox.less +524 -545
- package/src/definitions/modules/dimmer.js +707 -736
- package/src/definitions/modules/dimmer.less +300 -303
- package/src/definitions/modules/dropdown.js +4160 -4233
- package/src/definitions/modules/dropdown.less +1570 -1596
- package/src/definitions/modules/embed.js +650 -674
- package/src/definitions/modules/embed.less +80 -82
- package/src/definitions/modules/flyout.js +1463 -1464
- package/src/definitions/modules/flyout.less +444 -454
- package/src/definitions/modules/modal.js +1490 -1484
- package/src/definitions/modules/modal.less +459 -465
- package/src/definitions/modules/nag.js +517 -525
- package/src/definitions/modules/nag.less +134 -147
- package/src/definitions/modules/popup.js +1436 -1455
- package/src/definitions/modules/popup.less +733 -690
- package/src/definitions/modules/progress.js +968 -996
- package/src/definitions/modules/progress.less +521 -497
- package/src/definitions/modules/rating.js +504 -522
- package/src/definitions/modules/rating.less +94 -101
- package/src/definitions/modules/search.js +1497 -1533
- package/src/definitions/modules/search.less +373 -392
- package/src/definitions/modules/shape.js +791 -808
- package/src/definitions/modules/shape.less +68 -77
- package/src/definitions/modules/sidebar.js +1070 -1097
- package/src/definitions/modules/sidebar.less +462 -474
- package/src/definitions/modules/slider.js +1286 -1305
- package/src/definitions/modules/slider.less +307 -308
- package/src/definitions/modules/sticky.js +873 -918
- package/src/definitions/modules/sticky.less +22 -23
- package/src/definitions/modules/tab.js +921 -962
- package/src/definitions/modules/tab.less +46 -52
- package/src/definitions/modules/toast.js +885 -886
- package/src/definitions/modules/toast.less +584 -586
- package/src/definitions/modules/transition.js +1040 -1076
- package/src/definitions/modules/transition.less +62 -28
- package/src/definitions/views/ad.less +205 -206
- package/src/definitions/views/card.less +963 -969
- package/src/definitions/views/comment.less +190 -198
- package/src/definitions/views/feed.less +220 -224
- package/src/definitions/views/item.less +435 -446
- package/src/definitions/views/statistic.less +271 -277
- package/src/theme.less +29 -32
- package/src/themes/amazon/elements/button.overrides +23 -24
- package/src/themes/amazon/elements/button.variables +11 -11
- package/src/themes/amazon/globals/site.variables +2 -3
- package/src/themes/basic/collections/table.overrides +0 -1
- package/src/themes/basic/collections/table.variables +3 -3
- package/src/themes/basic/elements/button.overrides +0 -1
- package/src/themes/basic/elements/button.variables +2 -2
- package/src/themes/basic/elements/icon.overrides +12 -13
- package/src/themes/basic/elements/icon.variables +13 -13
- package/src/themes/basic/elements/step.overrides +2 -2
- package/src/themes/basic/elements/step.variables +2 -2
- package/src/themes/basic/globals/reset.overrides +1 -1
- package/src/themes/basic/globals/reset.variables +1 -1
- package/src/themes/basic/views/card.overrides +0 -1
- package/src/themes/basic/views/card.variables +3 -3
- package/src/themes/bookish/elements/header.overrides +3 -3
- package/src/themes/bookish/elements/header.variables +2 -2
- package/src/themes/bootstrap3/elements/button.variables +7 -8
- package/src/themes/chubby/collections/form.overrides +9 -9
- package/src/themes/chubby/collections/form.variables +3 -3
- package/src/themes/chubby/collections/menu.variables +1 -1
- package/src/themes/chubby/elements/button.overrides +7 -9
- package/src/themes/chubby/elements/button.variables +2 -2
- package/src/themes/chubby/elements/header.variables +3 -3
- package/src/themes/chubby/modules/accordion.overrides +2 -2
- package/src/themes/chubby/modules/accordion.variables +3 -3
- package/src/themes/chubby/views/comment.overrides +5 -5
- package/src/themes/chubby/views/comment.variables +4 -4
- package/src/themes/classic/collections/table.variables +2 -2
- package/src/themes/classic/elements/button.variables +20 -21
- package/src/themes/classic/elements/header.variables +3 -3
- package/src/themes/classic/modules/progress.variables +1 -1
- package/src/themes/classic/views/card.overrides +14 -14
- package/src/themes/classic/views/card.variables +4 -4
- package/src/themes/colored/modules/checkbox.variables +1 -1
- package/src/themes/default/assets/fonts/Lato-Bold.woff +0 -0
- package/src/themes/default/assets/fonts/Lato-Bold.woff2 +0 -0
- package/src/themes/default/assets/fonts/Lato-BoldItalic.woff +0 -0
- package/src/themes/default/assets/fonts/Lato-BoldItalic.woff2 +0 -0
- package/src/themes/default/assets/fonts/Lato-Italic.woff +0 -0
- package/src/themes/default/assets/fonts/Lato-Italic.woff2 +0 -0
- package/src/themes/default/assets/fonts/Lato-Regular.woff +0 -0
- package/src/themes/default/assets/fonts/Lato-Regular.woff2 +0 -0
- package/src/themes/default/assets/fonts/LatoLatin-Bold.woff +0 -0
- package/src/themes/default/assets/fonts/LatoLatin-Bold.woff2 +0 -0
- package/src/themes/default/assets/fonts/LatoLatin-BoldItalic.woff +0 -0
- package/src/themes/default/assets/fonts/LatoLatin-BoldItalic.woff2 +0 -0
- package/src/themes/default/assets/fonts/LatoLatin-Italic.woff +0 -0
- package/src/themes/default/assets/fonts/LatoLatin-Italic.woff2 +0 -0
- package/src/themes/default/assets/fonts/LatoLatin-Regular.woff +0 -0
- package/src/themes/default/assets/fonts/LatoLatin-Regular.woff2 +0 -0
- package/src/themes/default/collections/breadcrumb.variables +4 -4
- package/src/themes/default/collections/form.variables +12 -12
- package/src/themes/default/collections/grid.overrides +0 -1
- package/src/themes/default/collections/grid.variables +14 -16
- package/src/themes/default/collections/menu.variables +19 -31
- package/src/themes/default/collections/message.variables +83 -84
- package/src/themes/default/collections/table.variables +16 -18
- package/src/themes/default/elements/button.variables +30 -31
- package/src/themes/default/elements/container.variables +4 -12
- package/src/themes/default/elements/divider.overrides +8 -9
- package/src/themes/default/elements/divider.variables +4 -5
- package/src/themes/default/elements/emoji.overrides +0 -1
- package/src/themes/default/elements/emoji.variables +3555 -3555
- package/src/themes/default/elements/flag.variables +1594 -1594
- package/src/themes/default/elements/header.overrides +0 -1
- package/src/themes/default/elements/header.variables +16 -16
- package/src/themes/default/elements/icon.variables +2017 -2001
- package/src/themes/default/elements/image.variables +6 -7
- package/src/themes/default/elements/input.variables +10 -10
- package/src/themes/default/elements/label.variables +19 -20
- package/src/themes/default/elements/list.variables +16 -16
- package/src/themes/default/elements/loader.variables +15 -16
- package/src/themes/default/elements/placeholder.variables +6 -7
- package/src/themes/default/elements/rail.variables +4 -5
- package/src/themes/default/elements/segment.variables +18 -29
- package/src/themes/default/elements/step.overrides +4 -4
- package/src/themes/default/elements/step.variables +14 -16
- package/src/themes/default/elements/text.variables +2 -3
- package/src/themes/default/globals/colors.less +588 -588
- package/src/themes/default/globals/reset.overrides +57 -57
- package/src/themes/default/globals/reset.variables +1 -1
- package/src/themes/default/globals/site.variables +869 -875
- package/src/themes/default/globals/variation.variables +13 -4
- package/src/themes/default/modules/accordion.overrides +11 -11
- package/src/themes/default/modules/accordion.variables +14 -15
- package/src/themes/default/modules/calendar.variables +2 -0
- package/src/themes/default/modules/chatroom.variables +1 -1
- package/src/themes/default/modules/checkbox.overrides +6 -7
- package/src/themes/default/modules/checkbox.variables +17 -22
- package/src/themes/default/modules/dimmer.variables +7 -8
- package/src/themes/default/modules/dropdown.overrides +17 -17
- package/src/themes/default/modules/dropdown.variables +20 -21
- package/src/themes/default/modules/embed.variables +9 -10
- package/src/themes/default/modules/flyout.variables +6 -6
- package/src/themes/default/modules/modal.variables +18 -18
- package/src/themes/default/modules/nag.variables +11 -14
- package/src/themes/default/modules/popup.variables +14 -13
- package/src/themes/default/modules/progress.variables +10 -11
- package/src/themes/default/modules/rating.variables +10 -11
- package/src/themes/default/modules/search.variables +9 -11
- package/src/themes/default/modules/shape.variables +6 -6
- package/src/themes/default/modules/sidebar.variables +4 -4
- package/src/themes/default/modules/slider.variables +48 -49
- package/src/themes/default/modules/sticky.variables +1 -1
- package/src/themes/default/modules/toast.variables +1 -1
- package/src/themes/default/modules/transition.overrides +936 -915
- package/src/themes/default/modules/transition.variables +8 -1
- package/src/themes/default/views/card.variables +20 -22
- package/src/themes/default/views/comment.variables +6 -8
- package/src/themes/default/views/feed.variables +6 -6
- package/src/themes/default/views/item.variables +6 -9
- package/src/themes/default/views/statistic.variables +8 -8
- package/src/themes/duo/elements/loader.variables +1 -1
- package/src/themes/famfamfam/elements/flag.overrides +263 -268
- package/src/themes/famfamfam/elements/flag.variables +3 -3
- package/src/themes/fixed-width/collections/grid.variables +1 -1
- package/src/themes/fixed-width/modules/modal.variables +3 -5
- package/src/themes/flat/collections/form.overrides +9 -9
- package/src/themes/flat/collections/form.variables +4 -5
- package/src/themes/flat/globals/site.variables +61 -66
- package/src/themes/github/collections/breadcrumb.variables +0 -1
- package/src/themes/github/collections/form.overrides +7 -8
- package/src/themes/github/collections/form.variables +12 -13
- package/src/themes/github/collections/grid.variables +1 -2
- package/src/themes/github/collections/menu.overrides +2 -2
- package/src/themes/github/collections/menu.variables +11 -12
- package/src/themes/github/collections/message.overrides +3 -3
- package/src/themes/github/collections/message.variables +5 -5
- package/src/themes/github/collections/table.variables +1 -1
- package/src/themes/github/elements/button.overrides +0 -1
- package/src/themes/github/elements/button.variables +14 -14
- package/src/themes/github/elements/header.variables +2 -2
- package/src/themes/github/elements/icon.overrides +179 -179
- package/src/themes/github/elements/icon.variables +10 -10
- package/src/themes/github/elements/image.variables +1 -1
- package/src/themes/github/elements/input.overrides +16 -16
- package/src/themes/github/elements/input.variables +3 -3
- package/src/themes/github/elements/label.overrides +3 -3
- package/src/themes/github/elements/label.variables +0 -1
- package/src/themes/github/elements/segment.variables +2 -3
- package/src/themes/github/elements/step.overrides +13 -13
- package/src/themes/github/elements/step.variables +2 -2
- package/src/themes/github/globals/site.variables +2 -2
- package/src/themes/github/modules/dropdown.overrides +18 -19
- package/src/themes/github/modules/dropdown.variables +1 -1
- package/src/themes/github/modules/popup.variables +0 -2
- package/src/themes/instagram/views/card.overrides +3 -4
- package/src/themes/instagram/views/card.variables +3 -4
- package/src/themes/joypixels/elements/emoji.overrides +0 -2
- package/src/themes/joypixels/elements/emoji.variables +3554 -3554
- package/src/themes/material/collections/menu.variables +1 -1
- package/src/themes/material/elements/button.overrides +6 -8
- package/src/themes/material/elements/button.variables +28 -28
- package/src/themes/material/elements/header.overrides +2 -2
- package/src/themes/material/elements/header.variables +2 -4
- package/src/themes/material/elements/icon.overrides +932 -932
- package/src/themes/material/elements/icon.variables +11 -11
- package/src/themes/material/globals/site.variables +78 -79
- package/src/themes/material/modules/dropdown.overrides +1 -1
- package/src/themes/material/modules/dropdown.variables +1 -1
- package/src/themes/material/modules/modal.overrides +2 -2
- package/src/themes/material/modules/modal.variables +1 -2
- package/src/themes/pulsar/elements/loader.overrides +58 -58
- package/src/themes/raised/elements/button.variables +8 -8
- package/src/themes/resetcss/globals/reset.overrides +115 -33
- package/src/themes/resetcss/globals/reset.variables +1 -1
- package/src/themes/round/elements/button.variables +11 -14
- package/src/themes/rtl/globals/site.variables +5 -6
- package/src/themes/striped/modules/progress.overrides +20 -16
- package/src/themes/systemfont/globals/reset.overrides +1 -1
- package/src/themes/systemfont/globals/site.variables +5 -5
- package/src/themes/timeline/views/feed.overrides +12 -12
- package/src/themes/timeline/views/feed.variables +4 -4
- package/src/themes/twitter/elements/button.overrides +4 -5
- package/src/themes/twitter/elements/button.variables +6 -7
- package/src/themes/twitter/elements/emoji.variables +3555 -3555
- package/tasks/admin/components/create.js +274 -276
- package/tasks/admin/components/init.js +123 -130
- package/tasks/admin/components/update.js +149 -157
- package/tasks/admin/distributions/create.js +184 -187
- package/tasks/admin/distributions/init.js +123 -130
- package/tasks/admin/distributions/update.js +145 -152
- package/tasks/admin/publish.js +5 -7
- package/tasks/admin/register.js +36 -38
- package/tasks/admin/release.js +8 -10
- package/tasks/build/assets.js +42 -39
- package/tasks/build/css.js +225 -216
- package/tasks/build/javascript.js +118 -113
- package/tasks/build.js +10 -10
- package/tasks/check-install.js +14 -16
- package/tasks/clean.js +5 -5
- package/tasks/collections/admin.js +34 -36
- package/tasks/collections/build.js +18 -20
- package/tasks/collections/docs.js +9 -11
- package/tasks/collections/install.js +9 -11
- package/tasks/collections/rtl.js +9 -11
- package/tasks/collections/various.js +8 -10
- package/tasks/config/admin/github.js +17 -17
- package/tasks/config/admin/oauth.example.js +4 -4
- package/tasks/config/admin/release.js +98 -98
- package/tasks/config/admin/templates/component-package.js +9 -10
- package/tasks/config/admin/templates/css-package.js +18 -20
- package/tasks/config/admin/templates/less-package.js +11 -13
- package/tasks/config/defaults.js +116 -114
- package/tasks/config/docs.js +23 -23
- package/tasks/config/npm/gulpfile.js +8 -9
- package/tasks/config/project/config.js +127 -134
- package/tasks/config/project/install.js +715 -713
- package/tasks/config/project/release.js +32 -38
- package/tasks/config/tasks.js +165 -156
- package/tasks/config/user.js +23 -26
- package/tasks/docs/build.js +97 -95
- package/tasks/docs/metadata.js +90 -96
- package/tasks/docs/serve.js +80 -81
- package/tasks/install.js +370 -378
- package/tasks/rtl/build.js +2 -2
- package/tasks/rtl/watch.js +2 -2
- package/tasks/version.js +4 -4
- package/tasks/watch.js +28 -30
- package/test/meteor/assets.js +10 -13
- package/test/meteor/fonts.js +12 -13
- package/test/modules/accordion.spec.js +6 -8
- package/test/modules/checkbox.spec.js +5 -7
- package/test/modules/dropdown.spec.js +5 -7
- package/test/modules/modal.spec.js +6 -8
- package/test/modules/module.spec.js +158 -178
- package/test/modules/popup.spec.js +5 -7
- package/test/modules/search.spec.js +5 -7
- package/test/modules/shape.spec.js +5 -7
- package/test/modules/sidebar.spec.js +5 -7
- package/test/modules/tab.spec.js +6 -8
- package/test/modules/transition.spec.js +5 -7
- package/test/modules/video.spec.js +5 -7
package/dist/components/tab.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
/*!
|
2
|
-
* # Fomantic-UI 2.9.1-beta.
|
2
|
+
* # Fomantic-UI 2.9.1-beta.21+2722e1b - Tab
|
3
3
|
* https://github.com/fomantic/Fomantic-UI/
|
4
4
|
*
|
5
5
|
*
|
@@ -8,1012 +8,971 @@
|
|
8
8
|
*
|
9
9
|
*/
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
}
|
21
|
-
|
22
|
-
window = (typeof window != 'undefined' && window.Math == Math)
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
;
|
48
|
-
|
49
|
-
$allModules
|
50
|
-
.each(function() {
|
51
|
-
var
|
52
|
-
|
53
|
-
settings = ( $.isPlainObject(parameters) )
|
54
|
-
? $.extend(true, {}, $.fn.tab.settings, parameters)
|
55
|
-
: $.extend({}, $.fn.tab.settings),
|
56
|
-
|
57
|
-
className = settings.className,
|
58
|
-
metadata = settings.metadata,
|
59
|
-
selector = settings.selector,
|
60
|
-
error = settings.error,
|
61
|
-
regExp = settings.regExp,
|
62
|
-
|
63
|
-
eventNamespace = '.' + settings.namespace,
|
64
|
-
moduleNamespace = 'module-' + settings.namespace,
|
65
|
-
|
66
|
-
$module = $(this),
|
67
|
-
$context,
|
68
|
-
$tabs,
|
69
|
-
|
70
|
-
cache = {},
|
71
|
-
firstLoad = true,
|
72
|
-
recursionDepth = 0,
|
73
|
-
element = this,
|
74
|
-
instance = $module.data(moduleNamespace),
|
75
|
-
|
76
|
-
activeTabPath,
|
77
|
-
parameterArray,
|
78
|
-
module,
|
79
|
-
|
80
|
-
historyEvent
|
81
|
-
|
82
|
-
;
|
83
|
-
|
84
|
-
module = {
|
85
|
-
|
86
|
-
initialize: function() {
|
87
|
-
module.debug('Initializing tab menu item', $module);
|
88
|
-
module.fix.callbacks();
|
89
|
-
module.determineTabs();
|
90
|
-
|
91
|
-
module.debug('Determining tabs', settings.context, $tabs);
|
92
|
-
// set up automatic routing
|
93
|
-
if(settings.auto) {
|
94
|
-
module.set.auto();
|
95
|
-
}
|
96
|
-
module.bind.events();
|
97
|
-
|
98
|
-
if(settings.history && !initializedHistory) {
|
99
|
-
module.initializeHistory();
|
100
|
-
initializedHistory = true;
|
101
|
-
}
|
102
|
-
|
103
|
-
var activeTab = module.determine.activeTab();
|
104
|
-
if(settings.autoTabActivation && instance === undefined && activeTab == null) {
|
105
|
-
activeTab = settings.autoTabActivation === true ? module.get.initialPath() : settings.autoTabActivation;
|
106
|
-
module.debug('No active tab detected, setting tab active', activeTab);
|
107
|
-
module.changeTab(activeTab);
|
108
|
-
}
|
109
|
-
if(activeTab != null && settings.history) {
|
110
|
-
var autoUpdate = $.address.autoUpdate();
|
111
|
-
$.address.autoUpdate(false);
|
112
|
-
$.address.value(activeTab);
|
113
|
-
$.address.autoUpdate(autoUpdate);
|
114
|
-
}
|
115
|
-
|
116
|
-
module.instantiate();
|
117
|
-
},
|
11
|
+
(function ($, window, document, undefined) {
|
12
|
+
'use strict';
|
13
|
+
|
14
|
+
function isWindow(obj) {
|
15
|
+
return obj != null && obj === obj.window;
|
16
|
+
}
|
17
|
+
|
18
|
+
function isFunction(obj) {
|
19
|
+
return typeof obj === 'function' && typeof obj.nodeType !== 'number';
|
20
|
+
}
|
21
|
+
|
22
|
+
window = (typeof window != 'undefined' && window.Math == Math)
|
23
|
+
? window
|
24
|
+
: globalThis;
|
25
|
+
|
26
|
+
$.fn.tab = function (parameters) {
|
27
|
+
var
|
28
|
+
// use window context if none specified
|
29
|
+
$allModules = isFunction(this)
|
30
|
+
? $(window)
|
31
|
+
: $(this),
|
32
|
+
$document = $(document),
|
33
|
+
moduleSelector = $allModules.selector || '',
|
34
|
+
time = new Date().getTime(),
|
35
|
+
performance = [],
|
36
|
+
|
37
|
+
query = arguments[0],
|
38
|
+
methodInvoked = (typeof query == 'string'),
|
39
|
+
queryArguments = [].slice.call(arguments, 1),
|
40
|
+
|
41
|
+
initializedHistory = false,
|
42
|
+
returnedValue
|
43
|
+
;
|
44
|
+
|
45
|
+
$allModules.each(function () {
|
46
|
+
var
|
118
47
|
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
$module
|
123
|
-
.data(moduleNamespace, module)
|
124
|
-
;
|
125
|
-
},
|
48
|
+
settings = ($.isPlainObject(parameters))
|
49
|
+
? $.extend(true, {}, $.fn.tab.settings, parameters)
|
50
|
+
: $.extend({}, $.fn.tab.settings),
|
126
51
|
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
;
|
133
|
-
},
|
52
|
+
className = settings.className,
|
53
|
+
metadata = settings.metadata,
|
54
|
+
selector = settings.selector,
|
55
|
+
error = settings.error,
|
56
|
+
regExp = settings.regExp,
|
134
57
|
|
135
|
-
|
136
|
-
|
137
|
-
// if using $.tab don't add events
|
138
|
-
if( !$.isWindow( element ) ) {
|
139
|
-
module.debug('Attaching tab activation events to element', $module);
|
140
|
-
$module
|
141
|
-
.on('click' + eventNamespace, module.event.click)
|
142
|
-
;
|
143
|
-
}
|
144
|
-
}
|
145
|
-
},
|
58
|
+
eventNamespace = '.' + settings.namespace,
|
59
|
+
moduleNamespace = 'module-' + settings.namespace,
|
146
60
|
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
;
|
61
|
+
$module = $(this),
|
62
|
+
$context,
|
63
|
+
$tabs,
|
151
64
|
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
}
|
158
|
-
else {
|
159
|
-
$reference = $module;
|
160
|
-
}
|
161
|
-
$context = $reference.parent();
|
162
|
-
module.verbose('Determined parent element for creating context', $context);
|
163
|
-
}
|
164
|
-
else if(settings.context) {
|
165
|
-
$context = [window,document].indexOf(settings.context) < 0 ? $(document).find(settings.context) : $(settings.context);
|
166
|
-
module.verbose('Using selector for tab context', settings.context, $context);
|
167
|
-
}
|
168
|
-
else {
|
169
|
-
$context = $('body');
|
170
|
-
}
|
171
|
-
// find tabs
|
172
|
-
if(settings.childrenOnly) {
|
173
|
-
$tabs = $context.children(selector.tabs);
|
174
|
-
module.debug('Searching tab context children for tabs', $context, $tabs);
|
175
|
-
}
|
176
|
-
else {
|
177
|
-
$tabs = $context.find(selector.tabs);
|
178
|
-
module.debug('Searching tab context for tabs', $context, $tabs);
|
179
|
-
}
|
180
|
-
},
|
65
|
+
cache = {},
|
66
|
+
firstLoad = true,
|
67
|
+
recursionDepth = 0,
|
68
|
+
element = this,
|
69
|
+
instance = $module.data(moduleNamespace),
|
181
70
|
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
if(parameters.onTabLoad) {
|
186
|
-
parameters.onLoad = parameters.onTabLoad;
|
187
|
-
delete parameters.onTabLoad;
|
188
|
-
module.error(error.legacyLoad, parameters.onLoad);
|
189
|
-
}
|
190
|
-
if(parameters.onTabInit) {
|
191
|
-
parameters.onFirstLoad = parameters.onTabInit;
|
192
|
-
delete parameters.onTabInit;
|
193
|
-
module.error(error.legacyInit, parameters.onFirstLoad);
|
194
|
-
}
|
195
|
-
settings = $.extend(true, {}, $.fn.tab.settings, parameters);
|
196
|
-
}
|
197
|
-
}
|
198
|
-
},
|
71
|
+
activeTabPath,
|
72
|
+
parameterArray,
|
73
|
+
module,
|
199
74
|
|
200
|
-
|
201
|
-
module.debug('Initializing page state');
|
202
|
-
if( $.address === undefined ) {
|
203
|
-
module.error(error.state);
|
204
|
-
return false;
|
205
|
-
}
|
206
|
-
else {
|
207
|
-
if(settings.historyType == 'state') {
|
208
|
-
module.debug('Using HTML5 to manage state');
|
209
|
-
if(settings.path !== false) {
|
210
|
-
$.address
|
211
|
-
.history(true)
|
212
|
-
.state(settings.path)
|
213
|
-
;
|
214
|
-
$(window).trigger('popstate');
|
215
|
-
}
|
216
|
-
else {
|
217
|
-
module.error(error.path);
|
218
|
-
return false;
|
219
|
-
}
|
220
|
-
}
|
221
|
-
$.address
|
222
|
-
.bind('change', module.event.history.change)
|
75
|
+
historyEvent
|
223
76
|
;
|
224
|
-
}
|
225
|
-
},
|
226
77
|
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
}
|
262
|
-
}
|
263
|
-
}
|
264
|
-
},
|
78
|
+
module = {
|
79
|
+
|
80
|
+
initialize: function () {
|
81
|
+
module.debug('Initializing tab menu item', $module);
|
82
|
+
module.fix.callbacks();
|
83
|
+
module.determineTabs();
|
84
|
+
|
85
|
+
module.debug('Determining tabs', settings.context, $tabs);
|
86
|
+
// set up automatic routing
|
87
|
+
if (settings.auto) {
|
88
|
+
module.set.auto();
|
89
|
+
}
|
90
|
+
module.bind.events();
|
91
|
+
|
92
|
+
if (settings.history && !initializedHistory) {
|
93
|
+
module.initializeHistory();
|
94
|
+
initializedHistory = true;
|
95
|
+
}
|
96
|
+
|
97
|
+
var activeTab = module.determine.activeTab();
|
98
|
+
if (settings.autoTabActivation && instance === undefined && activeTab == null) {
|
99
|
+
activeTab = settings.autoTabActivation === true ? module.get.initialPath() : settings.autoTabActivation;
|
100
|
+
module.debug('No active tab detected, setting tab active', activeTab);
|
101
|
+
module.changeTab(activeTab);
|
102
|
+
}
|
103
|
+
if (activeTab != null && settings.history) {
|
104
|
+
var autoUpdate = $.address.autoUpdate();
|
105
|
+
$.address.autoUpdate(false);
|
106
|
+
$.address.value(activeTab);
|
107
|
+
$.address.autoUpdate(autoUpdate);
|
108
|
+
}
|
109
|
+
|
110
|
+
module.instantiate();
|
111
|
+
},
|
265
112
|
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
113
|
+
instantiate: function () {
|
114
|
+
module.verbose('Storing instance of module', module);
|
115
|
+
instance = module;
|
116
|
+
$module
|
117
|
+
.data(moduleNamespace, module)
|
118
|
+
;
|
119
|
+
},
|
272
120
|
|
273
|
-
|
121
|
+
destroy: function () {
|
122
|
+
module.debug('Destroying tabs', $module);
|
123
|
+
$module
|
124
|
+
.removeData(moduleNamespace)
|
125
|
+
.off(eventNamespace)
|
126
|
+
;
|
127
|
+
},
|
274
128
|
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
remove: function(cacheKey) {
|
287
|
-
cacheKey = cacheKey || activeTabPath;
|
288
|
-
module.debug('Removing cached content for', cacheKey);
|
289
|
-
delete cache[cacheKey];
|
290
|
-
}
|
291
|
-
},
|
129
|
+
bind: {
|
130
|
+
events: function () {
|
131
|
+
// if using $.tab don't add events
|
132
|
+
if (!isWindow(element)) {
|
133
|
+
module.debug('Attaching tab activation events to element', $module);
|
134
|
+
$module
|
135
|
+
.on('click' + eventNamespace, module.event.click)
|
136
|
+
;
|
137
|
+
}
|
138
|
+
},
|
139
|
+
},
|
292
140
|
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
141
|
+
determineTabs: function () {
|
142
|
+
var
|
143
|
+
$reference
|
144
|
+
;
|
145
|
+
|
146
|
+
// determine tab context
|
147
|
+
if (settings.context === 'parent') {
|
148
|
+
if ($module.closest(selector.ui).length > 0) {
|
149
|
+
$reference = $module.closest(selector.ui);
|
150
|
+
module.verbose('Using closest UI element as parent', $reference);
|
151
|
+
} else {
|
152
|
+
$reference = $module;
|
153
|
+
}
|
154
|
+
$context = $reference.parent();
|
155
|
+
module.verbose('Determined parent element for creating context', $context);
|
156
|
+
} else if (settings.context) {
|
157
|
+
$context = [window, document].indexOf(settings.context) < 0 ? $document.find(settings.context) : $(settings.context);
|
158
|
+
module.verbose('Using selector for tab context', settings.context, $context);
|
159
|
+
} else {
|
160
|
+
$context = $('body');
|
161
|
+
}
|
162
|
+
// find tabs
|
163
|
+
if (settings.childrenOnly) {
|
164
|
+
$tabs = $context.children(selector.tabs);
|
165
|
+
module.debug('Searching tab context children for tabs', $context, $tabs);
|
166
|
+
} else {
|
167
|
+
$tabs = $context.find(selector.tabs);
|
168
|
+
module.debug('Searching tab context for tabs', $context, $tabs);
|
169
|
+
}
|
170
|
+
},
|
299
171
|
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
loading: function(tabPath) {
|
318
|
-
var
|
319
|
-
$tab = module.get.tabElement(tabPath),
|
320
|
-
isLoading = $tab.hasClass(className.loading)
|
321
|
-
;
|
322
|
-
if(!isLoading) {
|
323
|
-
module.verbose('Setting loading state for', $tab);
|
324
|
-
$tab
|
325
|
-
.addClass(className.loading)
|
326
|
-
.siblings($tabs)
|
327
|
-
.removeClass(className.active + ' ' + className.loading)
|
328
|
-
;
|
329
|
-
if($tab.length > 0) {
|
330
|
-
settings.onRequest.call($tab[0], tabPath);
|
331
|
-
}
|
332
|
-
}
|
333
|
-
},
|
334
|
-
state: function(state) {
|
335
|
-
$.address.value(state);
|
336
|
-
}
|
337
|
-
},
|
172
|
+
fix: {
|
173
|
+
callbacks: function () {
|
174
|
+
if ($.isPlainObject(parameters) && (parameters.onTabLoad || parameters.onTabInit)) {
|
175
|
+
if (parameters.onTabLoad) {
|
176
|
+
parameters.onLoad = parameters.onTabLoad;
|
177
|
+
delete parameters.onTabLoad;
|
178
|
+
module.error(error.legacyLoad, parameters.onLoad);
|
179
|
+
}
|
180
|
+
if (parameters.onTabInit) {
|
181
|
+
parameters.onFirstLoad = parameters.onTabInit;
|
182
|
+
delete parameters.onTabInit;
|
183
|
+
module.error(error.legacyInit, parameters.onFirstLoad);
|
184
|
+
}
|
185
|
+
settings = $.extend(true, {}, $.fn.tab.settings, parameters);
|
186
|
+
}
|
187
|
+
},
|
188
|
+
},
|
338
189
|
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
190
|
+
initializeHistory: function () {
|
191
|
+
module.debug('Initializing page state');
|
192
|
+
if ($.address === undefined) {
|
193
|
+
module.error(error.state);
|
194
|
+
|
195
|
+
return false;
|
196
|
+
} else {
|
197
|
+
if (settings.historyType == 'state') {
|
198
|
+
module.debug('Using HTML5 to manage state');
|
199
|
+
if (settings.path !== false) {
|
200
|
+
$.address
|
201
|
+
.history(true)
|
202
|
+
.state(settings.path)
|
203
|
+
;
|
204
|
+
$(window).trigger('popstate');
|
205
|
+
} else {
|
206
|
+
module.error(error.path);
|
207
|
+
|
208
|
+
return false;
|
209
|
+
}
|
210
|
+
}
|
211
|
+
$.address
|
212
|
+
.bind('change', module.event.history.change)
|
213
|
+
;
|
214
|
+
}
|
215
|
+
},
|
354
216
|
|
355
|
-
|
356
|
-
|
217
|
+
event: {
|
218
|
+
click: function (event) {
|
219
|
+
var
|
220
|
+
tabPath = $(this).data(metadata.tab)
|
221
|
+
;
|
222
|
+
if (tabPath !== undefined) {
|
223
|
+
if (settings.history) {
|
224
|
+
module.verbose('Updating page state', event);
|
225
|
+
$.address.value(tabPath);
|
226
|
+
} else {
|
227
|
+
module.verbose('Changing tab', event);
|
228
|
+
module.changeTab(tabPath);
|
229
|
+
}
|
230
|
+
event.preventDefault();
|
231
|
+
} else {
|
232
|
+
module.debug('No tab specified');
|
233
|
+
}
|
234
|
+
},
|
235
|
+
history: {
|
236
|
+
change: function (event) {
|
237
|
+
var
|
238
|
+
tabPath = event.pathNames.join('/') || module.get.initialPath(),
|
239
|
+
pageTitle = settings.templates.determineTitle(tabPath) || false
|
240
|
+
;
|
241
|
+
module.performance.display();
|
242
|
+
module.debug('History change event', tabPath, event);
|
243
|
+
historyEvent = event;
|
244
|
+
if (tabPath !== undefined) {
|
245
|
+
module.changeTab(tabPath);
|
246
|
+
}
|
247
|
+
if (pageTitle) {
|
248
|
+
$.address.title(pageTitle);
|
249
|
+
}
|
250
|
+
},
|
251
|
+
},
|
252
|
+
},
|
357
253
|
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
module.verbose('Looking for tab', tab);
|
365
|
-
if(isTab) {
|
366
|
-
module.verbose('Tab was found', tab);
|
367
|
-
// scope up
|
368
|
-
activeTabPath = currentPath;
|
369
|
-
parameterArray = module.utilities.filterArray(pathArray, currentPathArray);
|
370
|
-
|
371
|
-
if(isLastIndex) {
|
372
|
-
isLastTab = true;
|
373
|
-
}
|
374
|
-
else {
|
375
|
-
nextPathArray = pathArray.slice(0, index + 2);
|
376
|
-
nextPath = module.utilities.arrayToPath(nextPathArray);
|
377
|
-
isLastTab = ( !module.is.tab(nextPath) );
|
378
|
-
if(isLastTab) {
|
379
|
-
module.verbose('Tab parameters found', nextPathArray);
|
380
|
-
}
|
381
|
-
}
|
382
|
-
if (settings.onBeforeChange.call(element, currentPath) === false) {
|
383
|
-
module.debug('onBeforeChange returned false, cancelling tab change', $tab);
|
384
|
-
return false;
|
385
|
-
}
|
386
|
-
if(isLastTab && remoteContent) {
|
387
|
-
if(!shouldIgnoreLoad) {
|
388
|
-
module.activate.navigation(currentPath);
|
389
|
-
module.fetch.content(currentPath, tabPath);
|
390
|
-
}
|
391
|
-
else {
|
392
|
-
module.debug('Ignoring remote content on first tab load', currentPath);
|
393
|
-
firstLoad = false;
|
394
|
-
module.cache.add(tabPath, $tab.html());
|
395
|
-
module.activate.all(currentPath);
|
396
|
-
settings.onFirstLoad.call($tab[0], currentPath, parameterArray, historyEvent);
|
397
|
-
settings.onLoad.call($tab[0], currentPath, parameterArray, historyEvent);
|
398
|
-
}
|
399
|
-
return false;
|
400
|
-
}
|
401
|
-
else {
|
402
|
-
module.debug('Opened local tab', currentPath);
|
403
|
-
module.activate.all(currentPath);
|
404
|
-
if( !module.cache.read(currentPath) ) {
|
405
|
-
module.cache.add(currentPath, true);
|
406
|
-
module.debug('First time tab loaded calling tab init');
|
407
|
-
settings.onFirstLoad.call($tab[0], currentPath, parameterArray, historyEvent);
|
408
|
-
}
|
409
|
-
settings.onLoad.call($tab[0], currentPath, parameterArray, historyEvent);
|
410
|
-
}
|
254
|
+
refresh: function () {
|
255
|
+
if (activeTabPath) {
|
256
|
+
module.debug('Refreshing tab', activeTabPath);
|
257
|
+
module.changeTab(activeTabPath);
|
258
|
+
}
|
259
|
+
},
|
411
260
|
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
}
|
431
|
-
module.activate.all(currentPath);
|
432
|
-
if( !module.cache.read(currentPath) ) {
|
433
|
-
module.cache.add(currentPath, true);
|
434
|
-
module.debug('First time tab loaded calling tab init');
|
435
|
-
settings.onFirstLoad.call($tab[0], currentPath, parameterArray, historyEvent);
|
436
|
-
}
|
437
|
-
settings.onLoad.call($tab[0], currentPath, parameterArray, historyEvent);
|
438
|
-
return false;
|
439
|
-
}
|
440
|
-
}
|
441
|
-
else {
|
442
|
-
module.error(error.missingTab, $module, $context, currentPath);
|
443
|
-
return false;
|
444
|
-
}
|
445
|
-
});
|
446
|
-
},
|
261
|
+
cache: {
|
262
|
+
|
263
|
+
read: function (cacheKey) {
|
264
|
+
return (cacheKey !== undefined)
|
265
|
+
? cache[cacheKey]
|
266
|
+
: false;
|
267
|
+
},
|
268
|
+
add: function (cacheKey, content) {
|
269
|
+
cacheKey = cacheKey || activeTabPath;
|
270
|
+
module.debug('Adding cached content for', cacheKey);
|
271
|
+
cache[cacheKey] = content;
|
272
|
+
},
|
273
|
+
remove: function (cacheKey) {
|
274
|
+
cacheKey = cacheKey || activeTabPath;
|
275
|
+
module.debug('Removing cached content for', cacheKey);
|
276
|
+
delete cache[cacheKey];
|
277
|
+
},
|
278
|
+
},
|
447
279
|
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
? $element.offset().top
|
452
|
-
: false
|
453
|
-
;
|
454
|
-
if(scrollOffset !== false) {
|
455
|
-
module.debug('Forcing scroll to an in-page link in a hidden tab', scrollOffset, $element);
|
456
|
-
$(document).scrollTop(scrollOffset);
|
457
|
-
}
|
458
|
-
},
|
280
|
+
escape: {
|
281
|
+
string: function (text) {
|
282
|
+
text = String(text);
|
459
283
|
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
284
|
+
return text.replace(regExp.escape, '\\$&');
|
285
|
+
},
|
286
|
+
},
|
287
|
+
|
288
|
+
set: {
|
289
|
+
auto: function () {
|
290
|
+
var
|
291
|
+
url = (typeof settings.path == 'string')
|
292
|
+
? settings.path.replace(/\/$/, '') + '/{$tab}'
|
293
|
+
: '/{$tab}'
|
294
|
+
;
|
295
|
+
module.verbose('Setting up automatic tab retrieval from server', url);
|
296
|
+
if ($.isPlainObject(settings.apiSettings)) {
|
297
|
+
settings.apiSettings.url = url;
|
298
|
+
} else {
|
299
|
+
settings.apiSettings = {
|
300
|
+
url: url,
|
301
|
+
};
|
302
|
+
}
|
303
|
+
},
|
304
|
+
loading: function (tabPath) {
|
305
|
+
var
|
306
|
+
$tab = module.get.tabElement(tabPath),
|
307
|
+
isLoading = $tab.hasClass(className.loading)
|
308
|
+
;
|
309
|
+
if (!isLoading) {
|
310
|
+
module.verbose('Setting loading state for', $tab);
|
311
|
+
$tab
|
312
|
+
.addClass(className.loading)
|
313
|
+
.siblings($tabs)
|
314
|
+
.removeClass(className.active + ' ' + className.loading)
|
315
|
+
;
|
316
|
+
if ($tab.length > 0) {
|
317
|
+
settings.onRequest.call($tab[0], tabPath);
|
318
|
+
}
|
319
|
+
}
|
320
|
+
},
|
321
|
+
state: function (state) {
|
322
|
+
$.address.value(state);
|
323
|
+
},
|
324
|
+
},
|
488
325
|
|
489
|
-
|
326
|
+
changeTab: function (tabPath) {
|
327
|
+
var
|
328
|
+
pushStateAvailable = (window.history && window.history.pushState),
|
329
|
+
shouldIgnoreLoad = (pushStateAvailable && settings.ignoreFirstLoad && firstLoad),
|
330
|
+
remoteContent = (settings.auto || $.isPlainObject(settings.apiSettings)),
|
331
|
+
// only add default path if not remote content
|
332
|
+
pathArray = (remoteContent && !shouldIgnoreLoad)
|
333
|
+
? module.utilities.pathToArray(tabPath)
|
334
|
+
: module.get.defaultPathArray(tabPath)
|
335
|
+
;
|
336
|
+
tabPath = module.utilities.arrayToPath(pathArray);
|
337
|
+
$.each(pathArray, function (index, tab) {
|
338
|
+
var
|
339
|
+
currentPathArray = pathArray.slice(0, index + 1),
|
340
|
+
currentPath = module.utilities.arrayToPath(currentPathArray),
|
341
|
+
|
342
|
+
isTab = module.is.tab(currentPath),
|
343
|
+
isLastIndex = (index + 1 == pathArray.length),
|
344
|
+
|
345
|
+
$tab = module.get.tabElement(currentPath),
|
346
|
+
$anchor,
|
347
|
+
nextPathArray,
|
348
|
+
nextPath,
|
349
|
+
isLastTab
|
350
|
+
;
|
351
|
+
module.verbose('Looking for tab', tab);
|
352
|
+
if (isTab) {
|
353
|
+
module.verbose('Tab was found', tab);
|
354
|
+
// scope up
|
355
|
+
activeTabPath = currentPath;
|
356
|
+
parameterArray = module.utilities.filterArray(pathArray, currentPathArray);
|
357
|
+
|
358
|
+
if (isLastIndex) {
|
359
|
+
isLastTab = true;
|
360
|
+
} else {
|
361
|
+
nextPathArray = pathArray.slice(0, index + 2);
|
362
|
+
nextPath = module.utilities.arrayToPath(nextPathArray);
|
363
|
+
isLastTab = (!module.is.tab(nextPath));
|
364
|
+
if (isLastTab) {
|
365
|
+
module.verbose('Tab parameters found', nextPathArray);
|
366
|
+
}
|
367
|
+
}
|
368
|
+
if (settings.onBeforeChange.call(element, currentPath) === false) {
|
369
|
+
module.debug('onBeforeChange returned false, cancelling tab change', $tab);
|
370
|
+
|
371
|
+
return false;
|
372
|
+
}
|
373
|
+
if (isLastTab && remoteContent) {
|
374
|
+
if (!shouldIgnoreLoad) {
|
375
|
+
module.activate.navigation(currentPath);
|
376
|
+
module.fetch.content(currentPath, tabPath);
|
377
|
+
} else {
|
378
|
+
module.debug('Ignoring remote content on first tab load', currentPath);
|
379
|
+
firstLoad = false;
|
380
|
+
module.cache.add(tabPath, $tab.html());
|
381
|
+
module.activate.all(currentPath);
|
382
|
+
settings.onFirstLoad.call($tab[0], currentPath, parameterArray, historyEvent);
|
383
|
+
settings.onLoad.call($tab[0], currentPath, parameterArray, historyEvent);
|
384
|
+
}
|
385
|
+
|
386
|
+
return false;
|
387
|
+
} else {
|
388
|
+
module.debug('Opened local tab', currentPath);
|
389
|
+
module.activate.all(currentPath);
|
390
|
+
if (!module.cache.read(currentPath)) {
|
391
|
+
module.cache.add(currentPath, true);
|
392
|
+
module.debug('First time tab loaded calling tab init');
|
393
|
+
settings.onFirstLoad.call($tab[0], currentPath, parameterArray, historyEvent);
|
394
|
+
}
|
395
|
+
settings.onLoad.call($tab[0], currentPath, parameterArray, historyEvent);
|
396
|
+
}
|
397
|
+
} else if (tabPath.search('/') == -1 && tabPath !== '') {
|
398
|
+
// look for in page anchor
|
399
|
+
tabPath = module.escape.string(tabPath);
|
400
|
+
$anchor = $('#' + tabPath + ', a[name="' + tabPath + '"]');
|
401
|
+
currentPath = $anchor.closest('[data-tab]').data(metadata.tab);
|
402
|
+
$tab = module.get.tabElement(currentPath);
|
403
|
+
// if anchor exists use parent tab
|
404
|
+
if ($anchor && $anchor.length > 0 && currentPath) {
|
405
|
+
module.debug('Anchor link used, opening parent tab', $tab, $anchor);
|
406
|
+
if (settings.onBeforeChange.call(element, currentPath) === false) {
|
407
|
+
module.debug('onBeforeChange returned false, cancelling tab change', $tab);
|
408
|
+
|
409
|
+
return false;
|
410
|
+
}
|
411
|
+
if (!$tab.hasClass(className.active)) {
|
412
|
+
setTimeout(function () {
|
413
|
+
module.scrollTo($anchor);
|
414
|
+
}, 0);
|
415
|
+
}
|
416
|
+
module.activate.all(currentPath);
|
417
|
+
if (!module.cache.read(currentPath)) {
|
418
|
+
module.cache.add(currentPath, true);
|
419
|
+
module.debug('First time tab loaded calling tab init');
|
420
|
+
settings.onFirstLoad.call($tab[0], currentPath, parameterArray, historyEvent);
|
421
|
+
}
|
422
|
+
settings.onLoad.call($tab[0], currentPath, parameterArray, historyEvent);
|
423
|
+
|
424
|
+
return false;
|
425
|
+
}
|
426
|
+
} else {
|
427
|
+
module.error(error.missingTab, $module, $context, currentPath);
|
428
|
+
|
429
|
+
return false;
|
430
|
+
}
|
431
|
+
});
|
432
|
+
},
|
490
433
|
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
434
|
+
scrollTo: function ($element) {
|
435
|
+
var
|
436
|
+
scrollOffset = ($element && $element.length > 0)
|
437
|
+
? $element.offset().top
|
438
|
+
: false
|
439
|
+
;
|
440
|
+
if (scrollOffset !== false) {
|
441
|
+
module.debug('Forcing scroll to an in-page link in a hidden tab', scrollOffset, $element);
|
442
|
+
$document.scrollTop(scrollOffset);
|
443
|
+
}
|
501
444
|
},
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
}, 0);
|
528
|
-
}
|
529
|
-
else {
|
530
|
-
module.cache.add(fullTabPath, $tab.html());
|
531
|
-
}
|
445
|
+
|
446
|
+
update: {
|
447
|
+
content: function (tabPath, html, evaluateScripts) {
|
448
|
+
var
|
449
|
+
$tab = module.get.tabElement(tabPath),
|
450
|
+
tab = $tab[0]
|
451
|
+
;
|
452
|
+
evaluateScripts = (evaluateScripts !== undefined)
|
453
|
+
? evaluateScripts
|
454
|
+
: settings.evaluateScripts;
|
455
|
+
if (typeof settings.cacheType == 'string' && settings.cacheType.toLowerCase() == 'dom' && typeof html !== 'string') {
|
456
|
+
$tab
|
457
|
+
.empty()
|
458
|
+
.append($(html).clone(true))
|
459
|
+
;
|
460
|
+
} else {
|
461
|
+
if (evaluateScripts) {
|
462
|
+
module.debug('Updating HTML and evaluating inline scripts', tabPath, html);
|
463
|
+
$tab.html(html);
|
464
|
+
} else {
|
465
|
+
module.debug('Updating HTML', tabPath, html);
|
466
|
+
tab.innerHTML = html;
|
467
|
+
}
|
468
|
+
}
|
469
|
+
},
|
532
470
|
},
|
533
|
-
urlData: {
|
534
|
-
tab: fullTabPath
|
535
|
-
}
|
536
|
-
},
|
537
|
-
request = $tab.api('get request') || false,
|
538
|
-
existingRequest = ( request && request.state() === 'pending' ),
|
539
|
-
requestSettings,
|
540
|
-
cachedContent
|
541
|
-
;
|
542
471
|
|
543
|
-
|
544
|
-
|
472
|
+
fetch: {
|
473
|
+
|
474
|
+
content: function (tabPath, fullTabPath) {
|
475
|
+
var
|
476
|
+
$tab = module.get.tabElement(tabPath),
|
477
|
+
apiSettings = {
|
478
|
+
dataType: 'html',
|
479
|
+
encodeParameters: false,
|
480
|
+
on: 'now',
|
481
|
+
cache: settings.alwaysRefresh,
|
482
|
+
headers: {
|
483
|
+
'X-Remote': true,
|
484
|
+
},
|
485
|
+
onSuccess: function (response) {
|
486
|
+
if (settings.cacheType == 'response') {
|
487
|
+
module.cache.add(fullTabPath, response);
|
488
|
+
}
|
489
|
+
module.update.content(tabPath, response);
|
490
|
+
if (tabPath == activeTabPath) {
|
491
|
+
module.debug('Content loaded', tabPath);
|
492
|
+
module.activate.tab(tabPath);
|
493
|
+
} else {
|
494
|
+
module.debug('Content loaded in background', tabPath);
|
495
|
+
}
|
496
|
+
settings.onFirstLoad.call($tab[0], tabPath, parameterArray, historyEvent);
|
497
|
+
settings.onLoad.call($tab[0], tabPath, parameterArray, historyEvent);
|
498
|
+
|
499
|
+
if (settings.loadOnce) {
|
500
|
+
module.cache.add(fullTabPath, true);
|
501
|
+
} else if (typeof settings.cacheType == 'string' && settings.cacheType.toLowerCase() == 'dom' && $tab.children().length > 0) {
|
502
|
+
setTimeout(function () {
|
503
|
+
var
|
504
|
+
$clone = $tab.children().clone(true)
|
505
|
+
;
|
506
|
+
$clone = $clone.not('script');
|
507
|
+
module.cache.add(fullTabPath, $clone);
|
508
|
+
}, 0);
|
509
|
+
} else {
|
510
|
+
module.cache.add(fullTabPath, $tab.html());
|
511
|
+
}
|
512
|
+
},
|
513
|
+
urlData: {
|
514
|
+
tab: fullTabPath,
|
515
|
+
},
|
516
|
+
},
|
517
|
+
request = $tab.api('get request') || false,
|
518
|
+
existingRequest = (request && request.state() === 'pending'),
|
519
|
+
requestSettings,
|
520
|
+
cachedContent
|
521
|
+
;
|
522
|
+
|
523
|
+
fullTabPath = fullTabPath || tabPath;
|
524
|
+
cachedContent = module.cache.read(fullTabPath);
|
525
|
+
|
526
|
+
if (settings.cache && cachedContent) {
|
527
|
+
module.activate.tab(tabPath);
|
528
|
+
module.debug('Adding cached content', fullTabPath);
|
529
|
+
if (!settings.loadOnce) {
|
530
|
+
if (settings.evaluateScripts == 'once') {
|
531
|
+
module.update.content(tabPath, cachedContent, false);
|
532
|
+
} else {
|
533
|
+
module.update.content(tabPath, cachedContent);
|
534
|
+
}
|
535
|
+
}
|
536
|
+
settings.onLoad.call($tab[0], tabPath, parameterArray, historyEvent);
|
537
|
+
} else if (existingRequest) {
|
538
|
+
module.set.loading(tabPath);
|
539
|
+
module.debug('Content is already loading', fullTabPath);
|
540
|
+
} else if ($.api !== undefined) {
|
541
|
+
requestSettings = $.extend(true, {}, settings.apiSettings, apiSettings);
|
542
|
+
module.debug('Retrieving remote content', fullTabPath, requestSettings);
|
543
|
+
module.set.loading(tabPath);
|
544
|
+
$tab.api(requestSettings);
|
545
|
+
} else {
|
546
|
+
module.error(error.api);
|
547
|
+
}
|
548
|
+
},
|
549
|
+
},
|
545
550
|
|
551
|
+
activate: {
|
552
|
+
all: function (tabPath) {
|
553
|
+
module.activate.tab(tabPath);
|
554
|
+
module.activate.navigation(tabPath);
|
555
|
+
},
|
556
|
+
tab: function (tabPath) {
|
557
|
+
var
|
558
|
+
$tab = module.get.tabElement(tabPath),
|
559
|
+
$deactiveTabs = (settings.deactivate == 'siblings')
|
560
|
+
? $tab.siblings($tabs)
|
561
|
+
: $tabs.not($tab),
|
562
|
+
isActive = $tab.hasClass(className.active)
|
563
|
+
;
|
564
|
+
module.verbose('Showing tab content for', $tab);
|
565
|
+
if (!isActive) {
|
566
|
+
$tab
|
567
|
+
.addClass(className.active)
|
568
|
+
;
|
569
|
+
$deactiveTabs
|
570
|
+
.removeClass(className.active + ' ' + className.loading)
|
571
|
+
;
|
572
|
+
if ($tab.length > 0) {
|
573
|
+
settings.onVisible.call($tab[0], tabPath);
|
574
|
+
}
|
575
|
+
}
|
576
|
+
},
|
577
|
+
navigation: function (tabPath) {
|
578
|
+
var
|
579
|
+
$navigation = module.get.navElement(tabPath),
|
580
|
+
$deactiveNavigation = (settings.deactivate == 'siblings')
|
581
|
+
? $navigation.siblings($allModules)
|
582
|
+
: $allModules.not($navigation),
|
583
|
+
isActive = $navigation.hasClass(className.active)
|
584
|
+
;
|
585
|
+
module.verbose('Activating tab navigation for', $navigation, tabPath);
|
586
|
+
if (!isActive) {
|
587
|
+
$navigation
|
588
|
+
.addClass(className.active)
|
589
|
+
;
|
590
|
+
$deactiveNavigation
|
591
|
+
.removeClass(className.active + ' ' + className.loading)
|
592
|
+
;
|
593
|
+
}
|
594
|
+
},
|
595
|
+
},
|
546
596
|
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
|
551
|
-
|
552
|
-
|
597
|
+
deactivate: {
|
598
|
+
all: function () {
|
599
|
+
module.deactivate.navigation();
|
600
|
+
module.deactivate.tabs();
|
601
|
+
},
|
602
|
+
navigation: function () {
|
603
|
+
$allModules
|
604
|
+
.removeClass(className.active)
|
605
|
+
;
|
606
|
+
},
|
607
|
+
tabs: function () {
|
608
|
+
$tabs
|
609
|
+
.removeClass(className.active + ' ' + className.loading)
|
610
|
+
;
|
611
|
+
},
|
612
|
+
},
|
613
|
+
|
614
|
+
is: {
|
615
|
+
tab: function (tabName) {
|
616
|
+
return (tabName !== undefined)
|
617
|
+
? (module.get.tabElement(tabName).length > 0)
|
618
|
+
: false;
|
619
|
+
},
|
620
|
+
},
|
621
|
+
|
622
|
+
get: {
|
623
|
+
initialPath: function () {
|
624
|
+
return $allModules.eq(0).data(metadata.tab) || $tabs.eq(0).data(metadata.tab);
|
625
|
+
},
|
626
|
+
path: function () {
|
627
|
+
return $.address.value();
|
628
|
+
},
|
629
|
+
// adds default tabs to tab path
|
630
|
+
defaultPathArray: function (tabPath) {
|
631
|
+
return module.utilities.pathToArray(module.get.defaultPath(tabPath));
|
632
|
+
},
|
633
|
+
defaultPath: function (tabPath) {
|
634
|
+
var
|
635
|
+
$defaultNav = $allModules.filter('[data-' + metadata.tab + '^="' + module.escape.string(tabPath) + '/"]').eq(0),
|
636
|
+
defaultTab = $defaultNav.data(metadata.tab) || false
|
637
|
+
;
|
638
|
+
if (defaultTab) {
|
639
|
+
module.debug('Found default tab', defaultTab);
|
640
|
+
if (recursionDepth < settings.maxDepth) {
|
641
|
+
recursionDepth++;
|
642
|
+
|
643
|
+
return module.get.defaultPath(defaultTab);
|
644
|
+
}
|
645
|
+
module.error(error.recursion);
|
646
|
+
} else {
|
647
|
+
module.debug('No default tabs found for', tabPath, $tabs);
|
648
|
+
}
|
649
|
+
recursionDepth = 0;
|
650
|
+
|
651
|
+
return tabPath;
|
652
|
+
},
|
653
|
+
navElement: function (tabPath) {
|
654
|
+
tabPath = tabPath || activeTabPath;
|
655
|
+
|
656
|
+
return $allModules.filter('[data-' + metadata.tab + '="' + module.escape.string(tabPath) + '"]');
|
657
|
+
},
|
658
|
+
tabElement: function (tabPath) {
|
659
|
+
var
|
660
|
+
$fullPathTab,
|
661
|
+
$simplePathTab,
|
662
|
+
tabPathArray,
|
663
|
+
lastTab
|
664
|
+
;
|
665
|
+
tabPath = tabPath || activeTabPath;
|
666
|
+
tabPathArray = module.utilities.pathToArray(tabPath);
|
667
|
+
lastTab = module.utilities.last(tabPathArray);
|
668
|
+
$fullPathTab = $tabs.filter('[data-' + metadata.tab + '="' + module.escape.string(tabPath) + '"]');
|
669
|
+
$simplePathTab = $tabs.filter('[data-' + metadata.tab + '="' + module.escape.string(lastTab) + '"]');
|
670
|
+
|
671
|
+
return ($fullPathTab.length > 0)
|
672
|
+
? $fullPathTab
|
673
|
+
: $simplePathTab;
|
674
|
+
},
|
675
|
+
tab: function () {
|
676
|
+
return activeTabPath;
|
677
|
+
},
|
678
|
+
},
|
679
|
+
|
680
|
+
determine: {
|
681
|
+
activeTab: function () {
|
682
|
+
var activeTab = null;
|
683
|
+
|
684
|
+
$tabs.each(function (_index, tab) {
|
685
|
+
var $tab = $(tab);
|
686
|
+
|
687
|
+
if ($tab.hasClass(className.active)) {
|
688
|
+
var
|
689
|
+
tabPath = $(this).data(metadata.tab),
|
690
|
+
$anchor = $allModules.filter('[data-' + metadata.tab + '="' + module.escape.string(tabPath) + '"]')
|
691
|
+
;
|
692
|
+
|
693
|
+
if ($anchor.hasClass(className.active)) {
|
694
|
+
activeTab = tabPath;
|
695
|
+
}
|
696
|
+
}
|
697
|
+
});
|
698
|
+
|
699
|
+
return activeTab;
|
700
|
+
},
|
701
|
+
},
|
702
|
+
|
703
|
+
utilities: {
|
704
|
+
filterArray: function (keepArray, removeArray) {
|
705
|
+
return $.grep(keepArray, function (keepValue) {
|
706
|
+
return ($.inArray(keepValue, removeArray) == -1);
|
707
|
+
});
|
708
|
+
},
|
709
|
+
last: function (array) {
|
710
|
+
return Array.isArray(array)
|
711
|
+
? array[array.length - 1]
|
712
|
+
: false;
|
713
|
+
},
|
714
|
+
pathToArray: function (pathName) {
|
715
|
+
if (pathName === undefined) {
|
716
|
+
pathName = activeTabPath;
|
717
|
+
}
|
718
|
+
|
719
|
+
return typeof pathName == 'string'
|
720
|
+
? pathName.split('/')
|
721
|
+
: [pathName];
|
722
|
+
},
|
723
|
+
arrayToPath: function (pathArray) {
|
724
|
+
return Array.isArray(pathArray)
|
725
|
+
? pathArray.join('/')
|
726
|
+
: false;
|
727
|
+
},
|
728
|
+
},
|
729
|
+
|
730
|
+
setting: function (name, value) {
|
731
|
+
module.debug('Changing setting', name, value);
|
732
|
+
if ($.isPlainObject(name)) {
|
733
|
+
$.extend(true, settings, name);
|
734
|
+
} else if (value !== undefined) {
|
735
|
+
if ($.isPlainObject(settings[name])) {
|
736
|
+
$.extend(true, settings[name], value);
|
737
|
+
} else {
|
738
|
+
settings[name] = value;
|
739
|
+
}
|
740
|
+
} else {
|
741
|
+
return settings[name];
|
742
|
+
}
|
743
|
+
},
|
744
|
+
internal: function (name, value) {
|
745
|
+
if ($.isPlainObject(name)) {
|
746
|
+
$.extend(true, module, name);
|
747
|
+
} else if (value !== undefined) {
|
748
|
+
module[name] = value;
|
749
|
+
} else {
|
750
|
+
return module[name];
|
751
|
+
}
|
752
|
+
},
|
753
|
+
debug: function () {
|
754
|
+
if (!settings.silent && settings.debug) {
|
755
|
+
if (settings.performance) {
|
756
|
+
module.performance.log(arguments);
|
757
|
+
} else {
|
758
|
+
module.debug = Function.prototype.bind.call(console.info, console, settings.name + ':');
|
759
|
+
module.debug.apply(console, arguments);
|
760
|
+
}
|
761
|
+
}
|
762
|
+
},
|
763
|
+
verbose: function () {
|
764
|
+
if (!settings.silent && settings.verbose && settings.debug) {
|
765
|
+
if (settings.performance) {
|
766
|
+
module.performance.log(arguments);
|
767
|
+
} else {
|
768
|
+
module.verbose = Function.prototype.bind.call(console.info, console, settings.name + ':');
|
769
|
+
module.verbose.apply(console, arguments);
|
770
|
+
}
|
771
|
+
}
|
772
|
+
},
|
773
|
+
error: function () {
|
774
|
+
if (!settings.silent) {
|
775
|
+
module.error = Function.prototype.bind.call(console.error, console, settings.name + ':');
|
776
|
+
module.error.apply(console, arguments);
|
777
|
+
}
|
778
|
+
},
|
779
|
+
performance: {
|
780
|
+
log: function (message) {
|
781
|
+
var
|
782
|
+
currentTime,
|
783
|
+
executionTime,
|
784
|
+
previousTime
|
785
|
+
;
|
786
|
+
if (settings.performance) {
|
787
|
+
currentTime = new Date().getTime();
|
788
|
+
previousTime = time || currentTime;
|
789
|
+
executionTime = currentTime - previousTime;
|
790
|
+
time = currentTime;
|
791
|
+
performance.push({
|
792
|
+
Name: message[0],
|
793
|
+
Arguments: [].slice.call(message, 1) || '',
|
794
|
+
Element: element,
|
795
|
+
'Execution Time': executionTime,
|
796
|
+
});
|
797
|
+
}
|
798
|
+
clearTimeout(module.performance.timer);
|
799
|
+
module.performance.timer = setTimeout(module.performance.display, 500);
|
800
|
+
},
|
801
|
+
display: function () {
|
802
|
+
var
|
803
|
+
title = settings.name + ':',
|
804
|
+
totalTime = 0
|
805
|
+
;
|
806
|
+
time = false;
|
807
|
+
clearTimeout(module.performance.timer);
|
808
|
+
$.each(performance, function (index, data) {
|
809
|
+
totalTime += data['Execution Time'];
|
810
|
+
});
|
811
|
+
title += ' ' + totalTime + 'ms';
|
812
|
+
if (moduleSelector) {
|
813
|
+
title += ' \'' + moduleSelector + '\'';
|
814
|
+
}
|
815
|
+
if ((console.group !== undefined || console.table !== undefined) && performance.length > 0) {
|
816
|
+
console.groupCollapsed(title);
|
817
|
+
if (console.table) {
|
818
|
+
console.table(performance);
|
819
|
+
} else {
|
820
|
+
$.each(performance, function (index, data) {
|
821
|
+
console.log(data.Name + ': ' + data['Execution Time'] + 'ms');
|
822
|
+
});
|
823
|
+
}
|
824
|
+
console.groupEnd();
|
825
|
+
}
|
826
|
+
performance = [];
|
827
|
+
},
|
828
|
+
},
|
829
|
+
invoke: function (query, passedArguments, context) {
|
830
|
+
var
|
831
|
+
object = instance,
|
832
|
+
maxDepth,
|
833
|
+
found,
|
834
|
+
response
|
835
|
+
;
|
836
|
+
passedArguments = passedArguments || queryArguments;
|
837
|
+
context = context || element;
|
838
|
+
if (typeof query == 'string' && object !== undefined) {
|
839
|
+
query = query.split(/[\. ]/);
|
840
|
+
maxDepth = query.length - 1;
|
841
|
+
$.each(query, function (depth, value) {
|
842
|
+
var camelCaseValue = (depth != maxDepth)
|
843
|
+
? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
|
844
|
+
: query
|
845
|
+
;
|
846
|
+
if ($.isPlainObject(object[camelCaseValue]) && (depth != maxDepth)) {
|
847
|
+
object = object[camelCaseValue];
|
848
|
+
} else if (object[camelCaseValue] !== undefined) {
|
849
|
+
found = object[camelCaseValue];
|
850
|
+
|
851
|
+
return false;
|
852
|
+
} else if ($.isPlainObject(object[value]) && (depth != maxDepth)) {
|
853
|
+
object = object[value];
|
854
|
+
} else if (object[value] !== undefined) {
|
855
|
+
found = object[value];
|
856
|
+
|
857
|
+
return false;
|
858
|
+
} else {
|
859
|
+
module.error(error.method, query);
|
860
|
+
|
861
|
+
return false;
|
862
|
+
}
|
863
|
+
});
|
864
|
+
}
|
865
|
+
if (isFunction(found)) {
|
866
|
+
response = found.apply(context, passedArguments);
|
867
|
+
} else if (found !== undefined) {
|
868
|
+
response = found;
|
869
|
+
}
|
870
|
+
if (Array.isArray(returnedValue)) {
|
871
|
+
returnedValue.push(response);
|
872
|
+
} else if (returnedValue !== undefined) {
|
873
|
+
returnedValue = [returnedValue, response];
|
874
|
+
} else if (response !== undefined) {
|
875
|
+
returnedValue = response;
|
876
|
+
}
|
877
|
+
|
878
|
+
return found;
|
879
|
+
},
|
880
|
+
};
|
881
|
+
if (methodInvoked) {
|
882
|
+
if (instance === undefined) {
|
883
|
+
module.initialize();
|
553
884
|
}
|
554
|
-
|
555
|
-
|
885
|
+
module.invoke(query);
|
886
|
+
} else {
|
887
|
+
if (instance !== undefined) {
|
888
|
+
instance.invoke('destroy');
|
556
889
|
}
|
557
|
-
|
558
|
-
settings.onLoad.call($tab[0], tabPath, parameterArray, historyEvent);
|
559
|
-
}
|
560
|
-
else if(existingRequest) {
|
561
|
-
module.set.loading(tabPath);
|
562
|
-
module.debug('Content is already loading', fullTabPath);
|
563
|
-
}
|
564
|
-
else if($.api !== undefined) {
|
565
|
-
requestSettings = $.extend(true, {}, settings.apiSettings, apiSettings);
|
566
|
-
module.debug('Retrieving remote content', fullTabPath, requestSettings);
|
567
|
-
module.set.loading(tabPath);
|
568
|
-
$tab.api(requestSettings);
|
569
|
-
}
|
570
|
-
else {
|
571
|
-
module.error(error.api);
|
890
|
+
module.initialize();
|
572
891
|
}
|
573
|
-
|
574
|
-
},
|
892
|
+
});
|
575
893
|
|
576
|
-
|
577
|
-
|
578
|
-
|
579
|
-
|
580
|
-
},
|
581
|
-
tab: function(tabPath) {
|
582
|
-
var
|
583
|
-
$tab = module.get.tabElement(tabPath),
|
584
|
-
$deactiveTabs = (settings.deactivate == 'siblings')
|
585
|
-
? $tab.siblings($tabs)
|
586
|
-
: $tabs.not($tab),
|
587
|
-
isActive = $tab.hasClass(className.active)
|
588
|
-
;
|
589
|
-
module.verbose('Showing tab content for', $tab);
|
590
|
-
if(!isActive) {
|
591
|
-
$tab
|
592
|
-
.addClass(className.active)
|
593
|
-
;
|
594
|
-
$deactiveTabs
|
595
|
-
.removeClass(className.active + ' ' + className.loading)
|
596
|
-
;
|
597
|
-
if($tab.length > 0) {
|
598
|
-
settings.onVisible.call($tab[0], tabPath);
|
599
|
-
}
|
600
|
-
}
|
601
|
-
},
|
602
|
-
navigation: function(tabPath) {
|
603
|
-
var
|
604
|
-
$navigation = module.get.navElement(tabPath),
|
605
|
-
$deactiveNavigation = (settings.deactivate == 'siblings')
|
606
|
-
? $navigation.siblings($allModules)
|
607
|
-
: $allModules.not($navigation),
|
608
|
-
isActive = $navigation.hasClass(className.active)
|
609
|
-
;
|
610
|
-
module.verbose('Activating tab navigation for', $navigation, tabPath);
|
611
|
-
if(!isActive) {
|
612
|
-
$navigation
|
613
|
-
.addClass(className.active)
|
614
|
-
;
|
615
|
-
$deactiveNavigation
|
616
|
-
.removeClass(className.active + ' ' + className.loading)
|
617
|
-
;
|
618
|
-
}
|
619
|
-
}
|
620
|
-
},
|
894
|
+
return (returnedValue !== undefined)
|
895
|
+
? returnedValue
|
896
|
+
: this;
|
897
|
+
};
|
621
898
|
|
622
|
-
|
623
|
-
|
624
|
-
|
625
|
-
|
626
|
-
},
|
627
|
-
navigation: function() {
|
628
|
-
$allModules
|
629
|
-
.removeClass(className.active)
|
630
|
-
;
|
631
|
-
},
|
632
|
-
tabs: function() {
|
633
|
-
$tabs
|
634
|
-
.removeClass(className.active + ' ' + className.loading)
|
635
|
-
;
|
636
|
-
}
|
637
|
-
},
|
899
|
+
// shortcut for tabbed content with no defined navigation
|
900
|
+
$.tab = function () {
|
901
|
+
$(window).tab.apply(this, arguments);
|
902
|
+
};
|
638
903
|
|
639
|
-
|
640
|
-
tab: function(tabName) {
|
641
|
-
return (tabName !== undefined)
|
642
|
-
? ( module.get.tabElement(tabName).length > 0 )
|
643
|
-
: false
|
644
|
-
;
|
645
|
-
}
|
646
|
-
},
|
904
|
+
$.fn.tab.settings = {
|
647
905
|
|
648
|
-
|
649
|
-
|
650
|
-
return $allModules.eq(0).data(metadata.tab) || $tabs.eq(0).data(metadata.tab);
|
651
|
-
},
|
652
|
-
path: function() {
|
653
|
-
return $.address.value();
|
654
|
-
},
|
655
|
-
// adds default tabs to tab path
|
656
|
-
defaultPathArray: function(tabPath) {
|
657
|
-
return module.utilities.pathToArray( module.get.defaultPath(tabPath) );
|
658
|
-
},
|
659
|
-
defaultPath: function(tabPath) {
|
660
|
-
var
|
661
|
-
$defaultNav = $allModules.filter('[data-' + metadata.tab + '^="' + module.escape.string(tabPath) + '/"]').eq(0),
|
662
|
-
defaultTab = $defaultNav.data(metadata.tab) || false
|
663
|
-
;
|
664
|
-
if( defaultTab ) {
|
665
|
-
module.debug('Found default tab', defaultTab);
|
666
|
-
if(recursionDepth < settings.maxDepth) {
|
667
|
-
recursionDepth++;
|
668
|
-
return module.get.defaultPath(defaultTab);
|
669
|
-
}
|
670
|
-
module.error(error.recursion);
|
671
|
-
}
|
672
|
-
else {
|
673
|
-
module.debug('No default tabs found for', tabPath, $tabs);
|
674
|
-
}
|
675
|
-
recursionDepth = 0;
|
676
|
-
return tabPath;
|
677
|
-
},
|
678
|
-
navElement: function(tabPath) {
|
679
|
-
tabPath = tabPath || activeTabPath;
|
680
|
-
return $allModules.filter('[data-' + metadata.tab + '="' + module.escape.string(tabPath) + '"]');
|
681
|
-
},
|
682
|
-
tabElement: function(tabPath) {
|
683
|
-
var
|
684
|
-
$fullPathTab,
|
685
|
-
$simplePathTab,
|
686
|
-
tabPathArray,
|
687
|
-
lastTab
|
688
|
-
;
|
689
|
-
tabPath = tabPath || activeTabPath;
|
690
|
-
tabPathArray = module.utilities.pathToArray(tabPath);
|
691
|
-
lastTab = module.utilities.last(tabPathArray);
|
692
|
-
$fullPathTab = $tabs.filter('[data-' + metadata.tab + '="' + module.escape.string(tabPath) + '"]');
|
693
|
-
$simplePathTab = $tabs.filter('[data-' + metadata.tab + '="' + module.escape.string(lastTab) + '"]');
|
694
|
-
return ($fullPathTab.length > 0)
|
695
|
-
? $fullPathTab
|
696
|
-
: $simplePathTab
|
697
|
-
;
|
698
|
-
},
|
699
|
-
tab: function() {
|
700
|
-
return activeTabPath;
|
701
|
-
}
|
702
|
-
},
|
906
|
+
name: 'Tab',
|
907
|
+
namespace: 'tab',
|
703
908
|
|
704
|
-
|
705
|
-
|
706
|
-
|
909
|
+
silent: false,
|
910
|
+
debug: false,
|
911
|
+
verbose: false,
|
912
|
+
performance: true,
|
707
913
|
|
708
|
-
|
709
|
-
|
914
|
+
auto: false, // uses pjax style endpoints fetching content from same url with remote-content headers
|
915
|
+
history: false, // use browser history
|
916
|
+
historyType: 'hash', // #/ or html5 state
|
917
|
+
path: false, // base path of url
|
710
918
|
|
711
|
-
|
712
|
-
|
713
|
-
|
714
|
-
$anchor = $allModules.filter('[data-' + metadata.tab + '="' + module.escape.string(tabPath) + '"]')
|
715
|
-
;
|
919
|
+
context: false, // specify a context that tabs must appear inside
|
920
|
+
childrenOnly: false, // use only tabs that are children of context
|
921
|
+
maxDepth: 25, // max depth a tab can be nested
|
716
922
|
|
717
|
-
|
718
|
-
activeTab = tabPath;
|
719
|
-
}
|
720
|
-
}
|
721
|
-
});
|
923
|
+
deactivate: 'siblings', // whether tabs should deactivate sibling menu elements or all elements initialized together
|
722
924
|
|
723
|
-
|
724
|
-
|
725
|
-
|
925
|
+
alwaysRefresh: false, // load tab content new every tab click
|
926
|
+
cache: true, // cache the content requests to pull locally
|
927
|
+
loadOnce: false, // Whether tab data should only be loaded once when using remote content
|
928
|
+
cacheType: 'response', // Whether to cache exact response, or to html cache contents after scripts execute
|
929
|
+
ignoreFirstLoad: false, // don't load remote content on first load
|
726
930
|
|
727
|
-
|
728
|
-
|
729
|
-
|
730
|
-
return ( $.inArray(keepValue, removeArray) == -1);
|
731
|
-
});
|
732
|
-
},
|
733
|
-
last: function(array) {
|
734
|
-
return Array.isArray(array)
|
735
|
-
? array[ array.length - 1]
|
736
|
-
: false
|
737
|
-
;
|
738
|
-
},
|
739
|
-
pathToArray: function(pathName) {
|
740
|
-
if(pathName === undefined) {
|
741
|
-
pathName = activeTabPath;
|
742
|
-
}
|
743
|
-
return typeof pathName == 'string'
|
744
|
-
? pathName.split('/')
|
745
|
-
: [pathName]
|
746
|
-
;
|
747
|
-
},
|
748
|
-
arrayToPath: function(pathArray) {
|
749
|
-
return Array.isArray(pathArray)
|
750
|
-
? pathArray.join('/')
|
751
|
-
: false
|
752
|
-
;
|
753
|
-
}
|
754
|
-
},
|
931
|
+
apiSettings: false, // settings for api call
|
932
|
+
evaluateScripts: 'once', // whether inline scripts should be parsed (true/false/once). Once will not re-evaluate on cached content
|
933
|
+
autoTabActivation: true, // whether a non existing active tab will auto activate the first available tab
|
755
934
|
|
756
|
-
|
757
|
-
|
758
|
-
|
759
|
-
|
760
|
-
|
761
|
-
|
762
|
-
|
763
|
-
|
764
|
-
}
|
765
|
-
else {
|
766
|
-
settings[name] = value;
|
767
|
-
}
|
768
|
-
}
|
769
|
-
else {
|
770
|
-
return settings[name];
|
771
|
-
}
|
935
|
+
onFirstLoad: function (tabPath, parameterArray, historyEvent) {}, // called first time loaded
|
936
|
+
onLoad: function (tabPath, parameterArray, historyEvent) {}, // called on every load
|
937
|
+
onVisible: function (tabPath, parameterArray, historyEvent) {}, // called every time tab visible
|
938
|
+
onRequest: function (tabPath, parameterArray, historyEvent) {}, // called ever time a tab beings loading remote content
|
939
|
+
onBeforeChange: function (tabPath) {}, // called before a tab is about to be changed. Returning false will cancel the tab change
|
940
|
+
|
941
|
+
templates: {
|
942
|
+
determineTitle: function (tabArray) {}, // returns page title for path
|
772
943
|
},
|
773
|
-
|
774
|
-
|
775
|
-
|
776
|
-
|
777
|
-
|
778
|
-
|
779
|
-
|
780
|
-
|
781
|
-
|
782
|
-
|
944
|
+
|
945
|
+
error: {
|
946
|
+
api: 'You attempted to load content without API module',
|
947
|
+
method: 'The method you called is not defined',
|
948
|
+
missingTab: 'Activated tab cannot be found. Tabs are case-sensitive.',
|
949
|
+
noContent: 'The tab you specified is missing a content url.',
|
950
|
+
path: 'History enabled, but no path was specified',
|
951
|
+
recursion: 'Max recursive depth reached',
|
952
|
+
legacyInit: 'onTabInit has been renamed to onFirstLoad in 2.0, please adjust your code.',
|
953
|
+
legacyLoad: 'onTabLoad has been renamed to onLoad in 2.0. Please adjust your code',
|
954
|
+
state: 'History requires Asual\'s Address library <https://github.com/asual/jquery-address>',
|
783
955
|
},
|
784
|
-
|
785
|
-
|
786
|
-
|
787
|
-
module.performance.log(arguments);
|
788
|
-
}
|
789
|
-
else {
|
790
|
-
module.debug = Function.prototype.bind.call(console.info, console, settings.name + ':');
|
791
|
-
module.debug.apply(console, arguments);
|
792
|
-
}
|
793
|
-
}
|
956
|
+
|
957
|
+
regExp: {
|
958
|
+
escape: /[-[\]{}()*+?.,\\^$|#\s:=@]/g,
|
794
959
|
},
|
795
|
-
|
796
|
-
|
797
|
-
|
798
|
-
|
799
|
-
|
800
|
-
else {
|
801
|
-
module.verbose = Function.prototype.bind.call(console.info, console, settings.name + ':');
|
802
|
-
module.verbose.apply(console, arguments);
|
803
|
-
}
|
804
|
-
}
|
960
|
+
|
961
|
+
metadata: {
|
962
|
+
tab: 'tab',
|
963
|
+
loaded: 'loaded',
|
964
|
+
promise: 'promise',
|
805
965
|
},
|
806
|
-
|
807
|
-
|
808
|
-
|
809
|
-
|
810
|
-
}
|
966
|
+
|
967
|
+
className: {
|
968
|
+
loading: 'loading',
|
969
|
+
active: 'active',
|
811
970
|
},
|
812
|
-
|
813
|
-
|
814
|
-
|
815
|
-
|
816
|
-
executionTime,
|
817
|
-
previousTime
|
818
|
-
;
|
819
|
-
if(settings.performance) {
|
820
|
-
currentTime = new Date().getTime();
|
821
|
-
previousTime = time || currentTime;
|
822
|
-
executionTime = currentTime - previousTime;
|
823
|
-
time = currentTime;
|
824
|
-
performance.push({
|
825
|
-
'Name' : message[0],
|
826
|
-
'Arguments' : [].slice.call(message, 1) || '',
|
827
|
-
'Element' : element,
|
828
|
-
'Execution Time' : executionTime
|
829
|
-
});
|
830
|
-
}
|
831
|
-
clearTimeout(module.performance.timer);
|
832
|
-
module.performance.timer = setTimeout(module.performance.display, 500);
|
833
|
-
},
|
834
|
-
display: function() {
|
835
|
-
var
|
836
|
-
title = settings.name + ':',
|
837
|
-
totalTime = 0
|
838
|
-
;
|
839
|
-
time = false;
|
840
|
-
clearTimeout(module.performance.timer);
|
841
|
-
$.each(performance, function(index, data) {
|
842
|
-
totalTime += data['Execution Time'];
|
843
|
-
});
|
844
|
-
title += ' ' + totalTime + 'ms';
|
845
|
-
if(moduleSelector) {
|
846
|
-
title += ' \'' + moduleSelector + '\'';
|
847
|
-
}
|
848
|
-
if( (console.group !== undefined || console.table !== undefined) && performance.length > 0) {
|
849
|
-
console.groupCollapsed(title);
|
850
|
-
if(console.table) {
|
851
|
-
console.table(performance);
|
852
|
-
}
|
853
|
-
else {
|
854
|
-
$.each(performance, function(index, data) {
|
855
|
-
console.log(data['Name'] + ': ' + data['Execution Time']+'ms');
|
856
|
-
});
|
857
|
-
}
|
858
|
-
console.groupEnd();
|
859
|
-
}
|
860
|
-
performance = [];
|
861
|
-
}
|
971
|
+
|
972
|
+
selector: {
|
973
|
+
tabs: '.ui.tab',
|
974
|
+
ui: '.ui',
|
862
975
|
},
|
863
|
-
|
864
|
-
|
865
|
-
|
866
|
-
maxDepth,
|
867
|
-
found,
|
868
|
-
response
|
869
|
-
;
|
870
|
-
passedArguments = passedArguments || queryArguments;
|
871
|
-
context = context || element;
|
872
|
-
if(typeof query == 'string' && object !== undefined) {
|
873
|
-
query = query.split(/[\. ]/);
|
874
|
-
maxDepth = query.length - 1;
|
875
|
-
$.each(query, function(depth, value) {
|
876
|
-
var camelCaseValue = (depth != maxDepth)
|
877
|
-
? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
|
878
|
-
: query
|
879
|
-
;
|
880
|
-
if( $.isPlainObject( object[camelCaseValue] ) && (depth != maxDepth) ) {
|
881
|
-
object = object[camelCaseValue];
|
882
|
-
}
|
883
|
-
else if( object[camelCaseValue] !== undefined ) {
|
884
|
-
found = object[camelCaseValue];
|
885
|
-
return false;
|
886
|
-
}
|
887
|
-
else if( $.isPlainObject( object[value] ) && (depth != maxDepth) ) {
|
888
|
-
object = object[value];
|
889
|
-
}
|
890
|
-
else if( object[value] !== undefined ) {
|
891
|
-
found = object[value];
|
892
|
-
return false;
|
893
|
-
}
|
894
|
-
else {
|
895
|
-
module.error(error.method, query);
|
896
|
-
return false;
|
897
|
-
}
|
898
|
-
});
|
899
|
-
}
|
900
|
-
if ( $.isFunction( found ) ) {
|
901
|
-
response = found.apply(context, passedArguments);
|
902
|
-
}
|
903
|
-
else if(found !== undefined) {
|
904
|
-
response = found;
|
905
|
-
}
|
906
|
-
if(Array.isArray(returnedValue)) {
|
907
|
-
returnedValue.push(response);
|
908
|
-
}
|
909
|
-
else if(returnedValue !== undefined) {
|
910
|
-
returnedValue = [returnedValue, response];
|
911
|
-
}
|
912
|
-
else if(response !== undefined) {
|
913
|
-
returnedValue = response;
|
914
|
-
}
|
915
|
-
return found;
|
916
|
-
}
|
917
|
-
};
|
918
|
-
if(methodInvoked) {
|
919
|
-
if(instance === undefined) {
|
920
|
-
module.initialize();
|
921
|
-
}
|
922
|
-
module.invoke(query);
|
923
|
-
}
|
924
|
-
else {
|
925
|
-
if(instance !== undefined) {
|
926
|
-
instance.invoke('destroy');
|
927
|
-
}
|
928
|
-
module.initialize();
|
929
|
-
}
|
930
|
-
})
|
931
|
-
;
|
932
|
-
return (returnedValue !== undefined)
|
933
|
-
? returnedValue
|
934
|
-
: this
|
935
|
-
;
|
936
|
-
|
937
|
-
};
|
938
|
-
|
939
|
-
// shortcut for tabbed content with no defined navigation
|
940
|
-
$.tab = function() {
|
941
|
-
$(window).tab.apply(this, arguments);
|
942
|
-
};
|
943
|
-
|
944
|
-
$.fn.tab.settings = {
|
945
|
-
|
946
|
-
name : 'Tab',
|
947
|
-
namespace : 'tab',
|
948
|
-
|
949
|
-
silent : false,
|
950
|
-
debug : false,
|
951
|
-
verbose : false,
|
952
|
-
performance : true,
|
953
|
-
|
954
|
-
auto : false, // uses pjax style endpoints fetching content from same url with remote-content headers
|
955
|
-
history : false, // use browser history
|
956
|
-
historyType : 'hash', // #/ or html5 state
|
957
|
-
path : false, // base path of url
|
958
|
-
|
959
|
-
context : false, // specify a context that tabs must appear inside
|
960
|
-
childrenOnly : false, // use only tabs that are children of context
|
961
|
-
maxDepth : 25, // max depth a tab can be nested
|
962
|
-
|
963
|
-
deactivate : 'siblings', // whether tabs should deactivate sibling menu elements or all elements initialized together
|
964
|
-
|
965
|
-
alwaysRefresh : false, // load tab content new every tab click
|
966
|
-
cache : true, // cache the content requests to pull locally
|
967
|
-
loadOnce : false, // Whether tab data should only be loaded once when using remote content
|
968
|
-
cacheType : 'response', // Whether to cache exact response, or to html cache contents after scripts execute
|
969
|
-
ignoreFirstLoad : false, // don't load remote content on first load
|
970
|
-
|
971
|
-
apiSettings : false, // settings for api call
|
972
|
-
evaluateScripts : 'once', // whether inline scripts should be parsed (true/false/once). Once will not re-evaluate on cached content
|
973
|
-
autoTabActivation: true, // whether a non existing active tab will auto activate the first available tab
|
974
|
-
|
975
|
-
onFirstLoad : function(tabPath, parameterArray, historyEvent) {}, // called first time loaded
|
976
|
-
onLoad : function(tabPath, parameterArray, historyEvent) {}, // called on every load
|
977
|
-
onVisible : function(tabPath, parameterArray, historyEvent) {}, // called every time tab visible
|
978
|
-
onRequest : function(tabPath, parameterArray, historyEvent) {}, // called ever time a tab beings loading remote content
|
979
|
-
onBeforeChange: function(tabPath) {}, // called before a tab is about to be changed. Returning false will cancel the tab change
|
980
|
-
|
981
|
-
templates : {
|
982
|
-
determineTitle: function(tabArray) {} // returns page title for path
|
983
|
-
},
|
984
|
-
|
985
|
-
error: {
|
986
|
-
api : 'You attempted to load content without API module',
|
987
|
-
method : 'The method you called is not defined',
|
988
|
-
missingTab : 'Activated tab cannot be found. Tabs are case-sensitive.',
|
989
|
-
noContent : 'The tab you specified is missing a content url.',
|
990
|
-
path : 'History enabled, but no path was specified',
|
991
|
-
recursion : 'Max recursive depth reached',
|
992
|
-
legacyInit : 'onTabInit has been renamed to onFirstLoad in 2.0, please adjust your code.',
|
993
|
-
legacyLoad : 'onTabLoad has been renamed to onLoad in 2.0. Please adjust your code',
|
994
|
-
state : 'History requires Asual\'s Address library <https://github.com/asual/jquery-address>'
|
995
|
-
},
|
996
|
-
|
997
|
-
regExp : {
|
998
|
-
escape : /[-[\]{}()*+?.,\\^$|#\s:=@]/g
|
999
|
-
},
|
1000
|
-
|
1001
|
-
metadata : {
|
1002
|
-
tab : 'tab',
|
1003
|
-
loaded : 'loaded',
|
1004
|
-
promise: 'promise'
|
1005
|
-
},
|
1006
|
-
|
1007
|
-
className : {
|
1008
|
-
loading : 'loading',
|
1009
|
-
active : 'active'
|
1010
|
-
},
|
1011
|
-
|
1012
|
-
selector : {
|
1013
|
-
tabs : '.ui.tab',
|
1014
|
-
ui : '.ui'
|
1015
|
-
}
|
1016
|
-
|
1017
|
-
};
|
1018
|
-
|
1019
|
-
})( jQuery, window, document );
|
976
|
+
|
977
|
+
};
|
978
|
+
})(jQuery, window, document);
|