j1-template 2020.0.22 → 2020.0.24
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_page.html +1 -1
- data/_includes/themes/j1/layouts/content_generator_post.html +63 -161
- data/_includes/themes/j1/modules/connectors/ad/google-adsense.html +14 -0
- data/_includes/themes/j1/modules/connectors/analytic/google-analytics.html +1 -3
- data/_includes/themes/j1/modules/connectors/comment/disqus.html +37 -24
- data/_includes/themes/j1/modules/navigator/generator.html +8 -3
- data/_includes/themes/j1/modules/navigator/procedures/topsearch.proc +36 -26
- data/_includes/themes/j1/procedures/layouts/module_writer.proc +1 -1
- data/_includes/themes/j1/procedures/posts/create_series_header.proc +9 -5
- data/assets/data/banner.html +1 -1
- data/assets/data/fam.html +124 -0
- data/assets/data/mmenu_sidebar.html +3 -3
- data/assets/data/panel.html +9 -9
- data/assets/data/quicklinks.html +13 -13
- data/assets/error_pages/HTTP204.html +1 -0
- data/assets/error_pages/HTTP400.html +3 -2
- data/assets/error_pages/HTTP401.html +3 -2
- data/assets/error_pages/HTTP403.html +3 -2
- data/assets/error_pages/HTTP404.html +3 -2
- data/assets/error_pages/HTTP500.html +3 -2
- data/assets/error_pages/HTTP501.html +3 -2
- data/assets/error_pages/HTTP502.html +3 -2
- data/assets/error_pages/HTTP503.html +3 -2
- data/assets/error_pages/HTTP520.html +3 -2
- data/assets/error_pages/HTTP521.html +3 -2
- data/assets/error_pages/HTTP533.html +3 -2
- data/assets/themes/j1/adapter/js/{ssm.js → fam.js} +248 -138
- data/assets/themes/j1/adapter/js/framer.js +72 -56
- data/assets/themes/j1/adapter/js/gallery_customizer.js +2 -1
- data/assets/themes/j1/adapter/js/j1.js +8 -2
- data/assets/themes/j1/adapter/js/{searcher.js → lunr_search.js} +68 -65
- data/assets/themes/j1/adapter/js/toccer.js +62 -30
- data/assets/themes/j1/core/css/bootstrap.css +7154 -0
- data/assets/themes/j1/core/css/bootstrap.min.css +6 -0
- data/assets/themes/j1/core/css/custom.scss +28 -0
- data/assets/themes/j1/core/css/globals.css +14523 -0
- data/assets/themes/j1/core/css/globals.min.css +1 -0
- data/assets/themes/j1/core/css/globals.scss +28 -0
- data/assets/themes/j1/core/css/theme_extensions.css +11558 -0
- data/assets/themes/j1/core/css/theme_extensions.min.css +1 -0
- data/assets/themes/j1/core/css/themes/bootstrap/bootstrap.css +7 -4
- data/assets/themes/j1/core/css/themes/bootstrap/bootstrap.min.css +2 -2
- data/assets/themes/j1/core/css/themes/uno-dark/bootstrap.css +7 -4
- data/assets/themes/j1/core/css/themes/uno-dark/bootstrap.min.css +2 -2
- data/assets/themes/j1/core/css/themes/uno-light/bootstrap.css +514 -417
- data/assets/themes/j1/core/css/themes/uno-light/bootstrap.min.css +2 -2
- data/assets/themes/j1/core/css/uno.css +11823 -0
- data/assets/themes/j1/core/css/uno.min.css +1 -0
- data/assets/themes/j1/core/css/uno.scss +28 -0
- data/assets/themes/j1/core/css/vendor.css +5 -4
- data/assets/themes/j1/core/css/vendor.min.css +1 -1
- data/assets/themes/j1/core/css/vendor.scss +28 -0
- data/assets/themes/j1/core/js/template.js +6 -11
- data/assets/themes/j1/core/js/template.js.map +1 -1
- data/assets/themes/j1/core/js/template.min.js +1 -1
- data/assets/themes/j1/modules/bmd/js/bootstrap-material-design.js +6 -0
- data/assets/themes/j1/modules/cash/js/cash.js +1374 -0
- data/assets/themes/j1/modules/cash/js/cash.min.js +42 -0
- data/assets/themes/j1/modules/fam/css/uno/fam.css +369 -0
- data/assets/themes/j1/modules/fam/js/fam.js +477 -0
- data/assets/themes/j1/modules/iframeResizer/examples/frame.nested.html +1 -1
- data/assets/themes/j1/modules/iframeResizer/js/{iframeResizer.js → resizer.js} +0 -0
- data/assets/themes/j1/modules/iframeResizer/js/{iframeResizer.map → resizer.map} +0 -0
- data/assets/themes/j1/modules/iframeResizer/js/{iframeResizer.min.js → resizer.min.js} +0 -0
- data/assets/themes/j1/modules/jquery/js/require.js +2145 -0
- data/assets/themes/j1/modules/jquery/js/require.min.js +5 -0
- data/assets/themes/j1/modules/lunrSearch/css/lunr_search.css +32 -0
- data/assets/themes/j1/modules/lunrSearch/css/lunr_search.min.css +25 -0
- data/assets/themes/j1/modules/lunrSearch/js/dateformat.js +125 -0
- data/assets/themes/j1/modules/lunrSearch/js/dateformat.min.js +14 -0
- data/assets/themes/j1/modules/lunrSearch/js/lunr.js +3475 -0
- data/assets/themes/j1/modules/lunrSearch/js/lunr.min.js +51 -0
- data/assets/themes/j1/modules/lunrSearch/js/lunr_search.js +184 -0
- data/assets/themes/j1/modules/lunrSearch/js/lunr_search.min.js +17 -0
- data/assets/themes/j1/modules/lunrSearch/js/mustache.js +772 -0
- data/assets/themes/j1/modules/lunrSearch/js/mustache.min.js +772 -0
- data/assets/themes/j1/modules/lunrSearch/js/uri.js +2340 -0
- data/assets/themes/j1/modules/lunrSearch/js/uri.min.js +93 -0
- data/assets/themes/j1/modules/materialize/js/anime.js +1283 -0
- data/assets/themes/j1/modules/materialize/js/anime.min.js +34 -0
- data/assets/themes/j1/modules/materialize/js/autocomplete.js +450 -0
- data/assets/themes/j1/modules/materialize/js/buttons.js +409 -0
- data/assets/themes/j1/modules/materialize/js/cards.js +40 -0
- data/assets/themes/j1/modules/materialize/js/carousel.js +717 -0
- data/assets/themes/j1/modules/materialize/js/cash-dom.js +1044 -0
- data/assets/themes/j1/modules/materialize/js/cash.js +960 -0
- data/assets/themes/j1/modules/materialize/js/characterCounter.js +136 -0
- data/assets/themes/j1/modules/materialize/js/chips.js +481 -0
- data/assets/themes/j1/modules/materialize/js/collapsible.js +275 -0
- data/assets/themes/j1/modules/materialize/js/component.js +44 -0
- data/assets/themes/j1/modules/materialize/js/datepicker.js +975 -0
- data/assets/themes/j1/modules/materialize/js/dropdown.js +617 -0
- data/assets/themes/j1/modules/materialize/js/forms.js +275 -0
- data/assets/themes/j1/modules/materialize/js/global.js +427 -0
- data/assets/themes/j1/modules/materialize/js/materialbox.js +453 -0
- data/assets/themes/j1/modules/materialize/js/modal.js +382 -0
- data/assets/themes/j1/modules/materialize/js/parallax.js +138 -0
- data/assets/themes/j1/modules/materialize/js/pushpin.js +145 -0
- data/assets/themes/j1/modules/materialize/js/range.js +263 -0
- data/assets/themes/j1/modules/materialize/js/ripple.js +335 -0
- data/assets/themes/j1/modules/materialize/js/scrollspy.js +295 -0
- data/assets/themes/j1/modules/materialize/js/select.js +432 -0
- data/assets/themes/j1/modules/materialize/js/sidenav.js +580 -0
- data/assets/themes/j1/modules/materialize/js/slider.js +359 -0
- data/assets/themes/j1/modules/materialize/js/tabs.js +402 -0
- data/assets/themes/j1/modules/materialize/js/tapTarget.js +314 -0
- data/assets/themes/j1/modules/materialize/js/timepicker.js +647 -0
- data/assets/themes/j1/modules/materialize/js/toasts.js +310 -0
- data/assets/themes/j1/modules/materialize/js/tooltip.js +303 -0
- data/assets/themes/j1/modules/materialize/js/waves.js +335 -0
- data/assets/themes/j1/modules/materialize/scss/components/_badges.scss +55 -0
- data/assets/themes/j1/modules/materialize/scss/components/_buttons.scss +322 -0
- data/assets/themes/j1/modules/materialize/scss/components/_cards.scss +195 -0
- data/assets/themes/j1/modules/materialize/scss/components/_carousel.scss +90 -0
- data/assets/themes/j1/modules/materialize/scss/components/_chips.scss +90 -0
- data/assets/themes/j1/modules/materialize/scss/components/_collapsible.scss +91 -0
- data/assets/themes/j1/modules/materialize/scss/components/_color-classes.scss +32 -0
- data/assets/themes/j1/modules/materialize/scss/components/_color-variables.scss +370 -0
- data/assets/themes/j1/modules/materialize/scss/components/_datepicker.scss +191 -0
- data/assets/themes/j1/modules/materialize/scss/components/_dropdown.scss +85 -0
- data/assets/themes/j1/modules/materialize/scss/components/_global.scss +769 -0
- data/assets/themes/j1/modules/materialize/scss/components/_grid.scss +156 -0
- data/assets/themes/j1/modules/materialize/scss/components/_icons-material-design.scss +5 -0
- data/assets/themes/j1/modules/materialize/scss/components/_materialbox.scss +43 -0
- data/assets/themes/j1/modules/materialize/scss/components/_modal.scss +94 -0
- data/assets/themes/j1/modules/materialize/scss/components/_navbar.scss +208 -0
- data/assets/themes/j1/modules/materialize/scss/components/_normalize.scss +447 -0
- data/assets/themes/j1/modules/materialize/scss/components/_preloader.scss +334 -0
- data/assets/themes/j1/modules/materialize/scss/components/_pulse.scss +34 -0
- data/assets/themes/j1/modules/materialize/scss/components/_sidenav.scss +216 -0
- data/assets/themes/j1/modules/materialize/scss/components/_slider.scss +92 -0
- data/assets/themes/j1/modules/materialize/scss/components/_table_of_contents.scss +33 -0
- data/assets/themes/j1/modules/materialize/scss/components/_tabs.scss +99 -0
- data/assets/themes/j1/modules/materialize/scss/components/_tapTarget.scss +103 -0
- data/assets/themes/j1/modules/materialize/scss/components/_timepicker.scss +183 -0
- data/assets/themes/j1/modules/materialize/scss/components/_toast.scss +58 -0
- data/assets/themes/j1/modules/materialize/scss/components/_tooltip.scss +32 -0
- data/assets/themes/j1/modules/materialize/scss/components/_transitions.scss +13 -0
- data/assets/themes/j1/modules/materialize/scss/components/_typography.scss +60 -0
- data/assets/themes/j1/modules/materialize/scss/components/_variables.scss +349 -0
- data/assets/themes/j1/modules/materialize/scss/components/_waves.scss +114 -0
- data/assets/themes/j1/modules/materialize/scss/components/forms/_checkboxes.scss +200 -0
- data/assets/themes/j1/modules/materialize/scss/components/forms/_file-input.scss +44 -0
- data/assets/themes/j1/modules/materialize/scss/components/forms/_forms.scss +22 -0
- data/assets/themes/j1/modules/materialize/scss/components/forms/_input-fields.scss +354 -0
- data/assets/themes/j1/modules/materialize/scss/components/forms/_radio-buttons.scss +115 -0
- data/assets/themes/j1/modules/materialize/scss/components/forms/_range.scss +161 -0
- data/assets/themes/j1/modules/materialize/scss/components/forms/_select.scss +180 -0
- data/assets/themes/j1/modules/materialize/scss/components/forms/_switches.scss +89 -0
- data/assets/themes/j1/modules/materialize/scss/materialize.scss +41 -0
- data/assets/themes/j1/modules/{bsThemeSwitcher → themeSwitcher}/js/switcher.js +0 -0
- data/assets/themes/j1/modules/{bsThemeSwitcher → themeSwitcher}/js/switcher.min.js +0 -0
- data/lib/j1/version.rb +1 -1
- data/lib/starter_web/Gemfile +12 -16
- data/lib/starter_web/_config.yml +95 -21
- data/lib/starter_web/_data/blocks/banner.yml +1 -1
- data/lib/starter_web/_data/blocks/panel.yml +6 -6
- data/lib/starter_web/_data/j1_config.yml +7 -6
- data/lib/starter_web/_data/layouts/home.yml +13 -3
- data/lib/starter_web/_data/layouts/page.yml +10 -0
- data/lib/starter_web/_data/layouts/post.yml +10 -0
- data/lib/starter_web/_data/modules/defaults/{ssm.yml → fam.yml} +12 -15
- data/lib/starter_web/_data/modules/defaults/lunr_search.yml +171 -0
- data/lib/starter_web/_data/modules/defaults/navigator.yml +4 -4
- data/lib/starter_web/_data/modules/defaults/toccer.yml +4 -2
- data/lib/starter_web/_data/modules/fam.yml +158 -0
- data/lib/starter_web/_data/modules/{back2top.yml → lunr_search.yml} +15 -9
- data/lib/starter_web/_data/modules/navigator.yml +2 -2
- data/lib/starter_web/_data/modules/navigator_menu.yml +57 -6
- data/lib/starter_web/_data/modules/toccer.yml +0 -73
- data/lib/starter_web/_data/resources.yml +151 -104
- data/lib/starter_web/_includes/attributes.asciidoc +2 -2
- data/lib/starter_web/_includes/breadcrumbs.html +11 -0
- data/lib/starter_web/_plugins/debug.rb +0 -1
- data/lib/starter_web/_plugins/filters.rb +0 -1
- data/lib/starter_web/_plugins/{lorem-inline.rb → lorem_inline.rb} +1 -2
- data/lib/starter_web/_plugins/lunr_index.rb +313 -0
- data/lib/starter_web/_plugins/prettify.rb +0 -3
- data/lib/starter_web/_plugins/simple_search_filter.rb +0 -1
- data/lib/starter_web/_plugins/symlink_watcher.rb +2 -3
- data/lib/starter_web/assets/images/modules/attics/banner/lunr-banner-1280x800.jpg +0 -0
- data/lib/starter_web/assets/images/pages/winlogbeat/coordinate-map.png +0 -0
- data/lib/starter_web/assets/images/pages/winlogbeat/kibana-powershell.jpg +0 -0
- data/lib/starter_web/assets/images/pages/winlogbeat/option_ignore_outgoing.png +0 -0
- data/lib/starter_web/assets/images/pages/winlogbeat/winlogbeat-dashboard.png +0 -0
- data/lib/starter_web/collections/posts/public/featured/_posts/2018-05-01-confusion-about-base-url.adoc +2 -4
- data/lib/starter_web/collections/posts/public/featured/_posts/2019-05-01-top-open-source-static-site-generators.adoc +4 -2
- data/lib/starter_web/collections/posts/public/featured/_posts/2019-06-01-about-cookies.adoc +3 -2
- data/lib/starter_web/collections/posts/public/series/_posts/2018-11-01-docker-using-shared-folders.adoc +5 -4
- data/lib/starter_web/collections/posts/public/series/_posts/2020-01-01-post-test-series.adoc +144 -0
- data/lib/starter_web/collections/posts/public/series/_posts/2020-01-02-post-test-series.adoc +146 -0
- data/lib/starter_web/collections/posts/public/series/_posts/2020-01-03-post-test-series.adoc +146 -0
- data/lib/starter_web/collections/posts/public/series/_posts/2020-01-04-post-test-series.adoc +146 -0
- data/lib/starter_web/collections/posts/public/test_posts/_posts/2020-09-11-test_post.adoc +2 -4
- data/lib/starter_web/collections/posts/public/wikipedia/_posts/2016-11-20-minneapolis.adoc +2 -3
- data/lib/starter_web/collections/posts/public/wikipedia/_posts/2016-11-24-narcisse-snake-dens.adoc +2 -7
- data/lib/starter_web/collections/posts/public/wikipedia/_posts/2016-11-26-columbia-river.adoc +2 -6
- data/lib/starter_web/index.html +16 -10
- data/lib/starter_web/package.json +5 -2
- data/lib/starter_web/pages/public/about/about_site.adoc +0 -2
- data/lib/starter_web/pages/public/about/become_a_patron.adoc +1 -3
- data/lib/starter_web/pages/public/blog/navigator/archive.html +8 -1
- data/lib/starter_web/pages/public/blog/navigator/archive/categoryview.html +7 -3
- data/lib/starter_web/pages/public/blog/navigator/archive/dateview.html +8 -1
- data/lib/starter_web/pages/public/blog/navigator/archive/tagview.html +7 -2
- data/lib/starter_web/pages/public/blog/navigator/index.html +6 -2
- data/lib/starter_web/pages/public/learn/kickstarter/web_in_a_day/100_meet_and_greet_jekyll.adoc +3 -4
- data/lib/starter_web/pages/public/learn/kickstarter/web_in_a_day/200_preparations.adoc +3 -4
- data/lib/starter_web/pages/public/learn/kickstarter/web_in_a_day/300_first_awesome_web.adoc +3 -4
- data/lib/starter_web/pages/public/learn/roundtrip/100_present_images.adoc +25 -20
- data/lib/starter_web/pages/public/learn/roundtrip/100_present_videos.adoc +14 -12
- data/lib/starter_web/pages/public/learn/roundtrip/200_typography.adoc +20 -20
- data/lib/starter_web/pages/public/learn/roundtrip/300_icon_fonts.adoc +13 -8
- data/lib/starter_web/pages/public/learn/roundtrip/400_asciidoc_extensions.adoc +14 -9
- data/lib/starter_web/pages/public/learn/roundtrip/410_bs_modals_extentions.adoc +9 -6
- data/lib/starter_web/pages/public/learn/roundtrip/420_responsive_tables_extensions.adoc +62 -8
- data/lib/starter_web/pages/public/learn/roundtrip/500_themes.adoc +9 -7
- data/lib/starter_web/pages/public/learn/roundtrip/600_lunr.adoc +237 -0
- data/lib/starter_web/pages/public/learn/roundtrip/610_fam.adoc +302 -0
- data/lib/starter_web/pages/public/learn/where_to_go.adoc +3 -7
- data/lib/starter_web/pages/public/legal/de/100_impress.adoc +3 -2
- data/lib/starter_web/pages/public/legal/de/200_terms_of_use.adoc +2 -1
- data/lib/starter_web/pages/public/legal/de/300_privacy.adoc +2 -1
- data/lib/starter_web/pages/public/legal/de/400_license_agreement.adoc +2 -1
- data/lib/starter_web/pages/public/legal/de/500_support.adoc +2 -1
- data/lib/starter_web/pages/public/legal/en/000_copyright.adoc +30 -27
- data/lib/starter_web/pages/public/legal/en/100_impress.adoc +8 -5
- data/lib/starter_web/pages/public/legal/en/200_terms_of_use.adoc +12 -8
- data/lib/starter_web/pages/public/legal/en/300_privacy.adoc +7 -0
- data/lib/starter_web/pages/public/legal/en/400_license_agreement.adoc +8 -1
- data/lib/starter_web/pages/public/legal/en/500_support.adoc +8 -1
- data/lib/starter_web/pages/public/previewer/bootstrap_theme.adoc +3 -1
- data/lib/starter_web/pages/public/previewer/iframer.adoc +36 -28
- data/lib/starter_web/pages/public/previewer/justified_gallery.html +2 -1
- data/lib/starter_web/pages/public/previewer/mdi_icons_preview.adoc +2 -1
- data/lib/starter_web/pages/public/previewer/rouge.adoc +4 -2
- data/lib/starter_web/pages/public/previewer/twitter_emoji_preview.adoc +2 -1
- data/lib/starter_web/pages/public/test_pages/breadcrumbs_tester.adoc +62 -0
- data/lib/starter_web/pages/public/test_pages/deck_of_posts.adoc +3 -0
- data/lib/starter_web/pages/public/test_pages/floating_actions_button.adoc +523 -0
- data/lib/starter_web/pages/public/test_pages/floating_ad.adoc +1 -0
- data/lib/starter_web/pages/public/test_pages/floating_div.adoc +1 -0
- data/lib/starter_web/pages/public/test_pages/lunr_tester.adoc +89 -0
- data/lib/starter_web/pages/public/test_pages/nav_pagination_tester.adoc +1 -0
- data/lib/starter_web/pages/public/test_pages/page_attribute_tester.adoc +1 -0
- data/lib/starter_web/pages/public/test_pages/responsive_images.adoc +3 -2
- data/lib/starter_web/pages/public/test_pages/responsive_tables.adoc +1 -0
- data/lib/starter_web/pages/public/test_pages/toccer_tester.adoc +2245 -0
- data/lib/starter_web/utilsrv/_defaults/package.json +1 -1
- data/lib/starter_web/utilsrv/package.json +1 -1
- metadata +137 -29
- data/assets/data/search.json +0 -165
- data/assets/data/ssm.html +0 -242
- data/assets/themes/j1/adapter/js/back2top.js +0 -231
- data/assets/themes/j1/modules/jekyllSearch/js/simple-jekyll-search.js +0 -468
- data/assets/themes/j1/modules/jekyllSearch/js/simple-jekyll-search.min.js +0 -6
- data/assets/themes/j1/modules/tocbot/css/theme/uno.css +0 -95
- data/assets/themes/j1/modules/tocbot/css/theme/uno.min.css +0 -15
- data/assets/themes/j1/modules/tocbot/css/tocbot.css +0 -75
- data/assets/themes/j1/modules/tocbot/css/tocbot.min.css +0 -19
- data/assets/themes/j1/modules/tocbot/js/tocbot.js +0 -19
- data/assets/themes/j1/modules/tocbot/js/tocbot.min.js +0 -19
- data/lib/starter_web/_data/modules/defaults/back2top.yml +0 -146
- data/lib/starter_web/_data/modules/defaults/stickybits.yml +0 -36
- data/lib/starter_web/_data/modules/ssm.yml +0 -142
@@ -1,468 +0,0 @@
|
|
1
|
-
/*!
|
2
|
-
* Simple-Jekyll-Search v1.7.12
|
3
|
-
* Copyright 2015-2020, Christian Fei
|
4
|
-
* Licensed under the MIT License.
|
5
|
-
*/
|
6
|
-
|
7
|
-
;(function(){
|
8
|
-
|
9
|
-
var _$Templater_7 = {
|
10
|
-
compile: compile,
|
11
|
-
|
12
|
-
setOptions: setOptions
|
13
|
-
};
|
14
|
-
|
15
|
-
var options = {};
|
16
|
-
options.pattern = /\{(.*?)\}/g;
|
17
|
-
options.template = '';
|
18
|
-
options.middleware = function () {};
|
19
|
-
|
20
|
-
// jadams, 2020-07-11: added resultsOutput option
|
21
|
-
function setOptions (_options) {
|
22
|
-
options.pattern = _options.pattern || options.pattern;
|
23
|
-
options.template = _options.template || options.template;
|
24
|
-
options.results_output = _options.results_output;
|
25
|
-
if (typeof _options.middleware === 'function') {
|
26
|
-
options.middleware = _options.middleware;
|
27
|
-
}
|
28
|
-
}
|
29
|
-
|
30
|
-
/* jadams, 2017-07-09: Added resultsOutput for J1 Searcher
|
31
|
-
------------------------------------------------------------- */
|
32
|
-
function compile(data) {
|
33
|
-
var tags;
|
34
|
-
|
35
|
-
return options.template.replace(options.pattern, function(match, prop) {
|
36
|
-
var value = options.middleware(prop, data[prop], options.template);
|
37
|
-
var resultsOutput = document.getElementById(options.results_output);
|
38
|
-
resultsOutput.style.display = 'none'; // to hide
|
39
|
-
if (value !== undefined) {
|
40
|
-
return value;
|
41
|
-
}
|
42
|
-
// jadams: show the results container
|
43
|
-
resultsOutput.style.display = 'block';
|
44
|
-
// jadams: beautify tags string for results output
|
45
|
-
if ( prop == 'tags' ) {
|
46
|
-
tags = data[prop].replace(/\s+/g, '');
|
47
|
-
data[prop] = tags.replace(/,/g, ' · ');
|
48
|
-
}
|
49
|
-
if ( prop == 'date' ) {
|
50
|
-
if (data[prop].length) {
|
51
|
-
data[prop] = data[prop].substring(0,10);
|
52
|
-
} else {
|
53
|
-
data[prop] = '2020-01-01';
|
54
|
-
}
|
55
|
-
}
|
56
|
-
|
57
|
-
return data[prop] || match;
|
58
|
-
});
|
59
|
-
}
|
60
|
-
|
61
|
-
function fuzzysearch (needle, haystack) {
|
62
|
-
var tlen = haystack.length;
|
63
|
-
var qlen = needle.length;
|
64
|
-
if (qlen > tlen) {
|
65
|
-
return false;
|
66
|
-
}
|
67
|
-
if (qlen === tlen) {
|
68
|
-
return needle === haystack;
|
69
|
-
}
|
70
|
-
outer: for (var i = 0, j = 0; i < qlen; i++) {
|
71
|
-
var nch = needle.charCodeAt(i);
|
72
|
-
while (j < tlen) {
|
73
|
-
if (haystack.charCodeAt(j++) === nch) {
|
74
|
-
continue outer;
|
75
|
-
}
|
76
|
-
}
|
77
|
-
return false;
|
78
|
-
}
|
79
|
-
return true;
|
80
|
-
}
|
81
|
-
|
82
|
-
var _$fuzzysearch_1 = fuzzysearch;
|
83
|
-
|
84
|
-
/* removed: var _$fuzzysearch_1 = require('fuzzysearch'); */;
|
85
|
-
|
86
|
-
var _$FuzzySearchStrategy_5 = new FuzzySearchStrategy();
|
87
|
-
|
88
|
-
function FuzzySearchStrategy () {
|
89
|
-
this.matches = function (string, crit) {
|
90
|
-
return _$fuzzysearch_1(crit, string);
|
91
|
-
};
|
92
|
-
}
|
93
|
-
|
94
|
-
var _$LiteralSearchStrategy_6 = new LiteralSearchStrategy();
|
95
|
-
|
96
|
-
function LiteralSearchStrategy () {
|
97
|
-
this.matches = function (string, crit) {
|
98
|
-
if (typeof string !== 'string') {
|
99
|
-
return false;
|
100
|
-
}
|
101
|
-
string = string.trim();
|
102
|
-
return string.toLowerCase().indexOf(crit.toLowerCase()) >= 0;
|
103
|
-
};
|
104
|
-
}
|
105
|
-
|
106
|
-
var _$Repository_4 = {
|
107
|
-
put: put,
|
108
|
-
clear: clear,
|
109
|
-
get: get,
|
110
|
-
search: search,
|
111
|
-
setOptions: __setOptions_4
|
112
|
-
};
|
113
|
-
|
114
|
-
/* removed: var _$FuzzySearchStrategy_5 = require('./SearchStrategies/FuzzySearchStrategy'); */;
|
115
|
-
/* removed: var _$LiteralSearchStrategy_6 = require('./SearchStrategies/LiteralSearchStrategy'); */;
|
116
|
-
|
117
|
-
var data = [];
|
118
|
-
var opt = {};
|
119
|
-
opt.fuzzy = false;
|
120
|
-
opt.limit = 10;
|
121
|
-
|
122
|
-
/* jadams, 2017-07-09: added additional options J1 Template
|
123
|
-
------------------------------------------------------------- */
|
124
|
-
opt.searchStrategy = opt.fuzzy ? _$FuzzySearchStrategy_5 : _$LiteralSearchStrategy_6;
|
125
|
-
// jadams, 2017-07-09: Added minSearchItemLen as an option
|
126
|
-
opt.minSearchItemLen = 4;
|
127
|
-
// jadams, 2017-07-09: Added resultsOutput as an option
|
128
|
-
opt.resultsOutput = document.getElementById('jss-panel');
|
129
|
-
|
130
|
-
function put (data) {
|
131
|
-
if (isObject(data)) {
|
132
|
-
return addObject(data);
|
133
|
-
}
|
134
|
-
if (isArray(data)) {
|
135
|
-
return addArray(data);
|
136
|
-
}
|
137
|
-
return undefined;
|
138
|
-
}
|
139
|
-
function clear () {
|
140
|
-
data.length = 0;
|
141
|
-
return data;
|
142
|
-
}
|
143
|
-
|
144
|
-
function get () {
|
145
|
-
return data;
|
146
|
-
}
|
147
|
-
|
148
|
-
function isObject (obj) { return !!obj && Object.prototype.toString.call(obj) === '[object Object]'; }
|
149
|
-
function isArray (obj) { return !!obj && Object.prototype.toString.call(obj) === '[object Array]'; }
|
150
|
-
|
151
|
-
function addObject (_data) {
|
152
|
-
data.push(_data);
|
153
|
-
return data;
|
154
|
-
}
|
155
|
-
|
156
|
-
function addArray (_data) {
|
157
|
-
var added = [];
|
158
|
-
for (var i = 0; i < _data.length; i++) {
|
159
|
-
if (isObject(_data[i])) {
|
160
|
-
added.push(addObject(_data[i]));
|
161
|
-
}
|
162
|
-
}
|
163
|
-
return added;
|
164
|
-
}
|
165
|
-
|
166
|
-
/* jadams, 2017-07-09: search function modified
|
167
|
-
------------------------------------------------------------- */
|
168
|
-
function search(crit) {
|
169
|
-
var n = crit.length;
|
170
|
-
|
171
|
-
// jadams: Added|Evaluate minSearchItemLen
|
172
|
-
if (n < opt.minSearchItemLen) {
|
173
|
-
return [];
|
174
|
-
}
|
175
|
-
if (!crit) {
|
176
|
-
return [];
|
177
|
-
//return
|
178
|
-
}
|
179
|
-
return findMatches(data, crit, opt.searchStrategy, opt);
|
180
|
-
}
|
181
|
-
|
182
|
-
/* jadams, 2017-07-09: added additional options J1 Template
|
183
|
-
------------------------------------------------------------- */
|
184
|
-
function __setOptions_4(_opt) {
|
185
|
-
opt = _opt || {};
|
186
|
-
|
187
|
-
opt.fuzzy = _opt.fuzzy || false;
|
188
|
-
opt.limit = _opt.limit || 10;
|
189
|
-
// jadams: Added minSearchItemLen as an option
|
190
|
-
opt.minSearchItemLen = _opt.minSearchItemLen || 3;
|
191
|
-
opt.searchStrategy = _opt.fuzzy ? _$FuzzySearchStrategy_5 : _$LiteralSearchStrategy_6;
|
192
|
-
// jadams: Added show|hide for resultsOutput as an option
|
193
|
-
opt.resultsOutput = _opt.resultsOutput || 'jss-panel';
|
194
|
-
}
|
195
|
-
|
196
|
-
/*
|
197
|
-
function setOptions (_opt) {
|
198
|
-
opt = _opt || {}
|
199
|
-
|
200
|
-
opt.fuzzy = _opt.fuzzy || false
|
201
|
-
opt.limit = _opt.limit || 10
|
202
|
-
opt.searchStrategy = _opt.fuzzy ? FuzzySearchStrategy : LiteralSearchStrategy
|
203
|
-
}
|
204
|
-
*/
|
205
|
-
|
206
|
-
function findMatches (data, crit, strategy, opt) {
|
207
|
-
var matches = [];
|
208
|
-
for (var i = 0; i < data.length && matches.length < opt.limit; i++) {
|
209
|
-
var match = findMatchesInObject(data[i], crit, strategy, opt);
|
210
|
-
if (match) {
|
211
|
-
matches.push(match);
|
212
|
-
}
|
213
|
-
}
|
214
|
-
return matches;
|
215
|
-
}
|
216
|
-
|
217
|
-
function findMatchesInObject (obj, crit, strategy, opt) {
|
218
|
-
for (var key in obj) {
|
219
|
-
if (!isExcluded(obj[key], opt.exclude) && strategy.matches(obj[key], crit)) {
|
220
|
-
return obj;
|
221
|
-
}
|
222
|
-
}
|
223
|
-
}
|
224
|
-
|
225
|
-
function isExcluded (term, excludedTerms) {
|
226
|
-
var excluded = false;
|
227
|
-
excludedTerms = excludedTerms || [];
|
228
|
-
for (var i = 0; i < excludedTerms.length; i++) {
|
229
|
-
var excludedTerm = excludedTerms[i];
|
230
|
-
if (!excluded && new RegExp(term).test(excludedTerm)) {
|
231
|
-
excluded = true;
|
232
|
-
}
|
233
|
-
}
|
234
|
-
return excluded;
|
235
|
-
}
|
236
|
-
|
237
|
-
var _$JSONLoader_2 = {
|
238
|
-
load: load
|
239
|
-
};
|
240
|
-
|
241
|
-
function load (location, callback) {
|
242
|
-
var xhr = getXHR();
|
243
|
-
xhr.open('GET', location, true);
|
244
|
-
xhr.onreadystatechange = createStateChangeListener(xhr, callback);
|
245
|
-
xhr.send();
|
246
|
-
}
|
247
|
-
|
248
|
-
function createStateChangeListener (xhr, callback) {
|
249
|
-
return function () {
|
250
|
-
if (xhr.readyState === 4 && xhr.status === 200) {
|
251
|
-
try {
|
252
|
-
callback(null, JSON.parse(xhr.responseText));
|
253
|
-
} catch (err) {
|
254
|
-
callback(err, null);
|
255
|
-
}
|
256
|
-
}
|
257
|
-
};
|
258
|
-
}
|
259
|
-
|
260
|
-
function getXHR () {
|
261
|
-
return (window.XMLHttpRequest) ? new XMLHttpRequest() : new ActiveXObject('Microsoft.XMLHTTP');
|
262
|
-
}
|
263
|
-
|
264
|
-
var _$OptionsValidator_3 = function OptionsValidator (params) {
|
265
|
-
if (!validateParams(params)) {
|
266
|
-
throw new Error('-- OptionsValidator: required options missing');
|
267
|
-
}
|
268
|
-
if (!(this instanceof OptionsValidator)) {
|
269
|
-
return new OptionsValidator(params);
|
270
|
-
}
|
271
|
-
|
272
|
-
var requiredOptions = params.required;
|
273
|
-
|
274
|
-
this.getRequiredOptions = function () {
|
275
|
-
return requiredOptions;
|
276
|
-
};
|
277
|
-
|
278
|
-
this.validate = function (parameters) {
|
279
|
-
var errors = [];
|
280
|
-
requiredOptions.forEach(function (requiredOptionName) {
|
281
|
-
if (parameters[requiredOptionName] === undefined) {
|
282
|
-
errors.push(requiredOptionName);
|
283
|
-
}
|
284
|
-
});
|
285
|
-
return errors;
|
286
|
-
};
|
287
|
-
|
288
|
-
function validateParams (params) {
|
289
|
-
if (!params) {
|
290
|
-
return false;
|
291
|
-
}
|
292
|
-
return params.required !== undefined && params.required instanceof Array;
|
293
|
-
}
|
294
|
-
};
|
295
|
-
|
296
|
-
var _$utils_9 = {
|
297
|
-
merge: merge,
|
298
|
-
isJSON: isJSON
|
299
|
-
};
|
300
|
-
|
301
|
-
function merge (defaultParams, mergeParams) {
|
302
|
-
var mergedOptions = {};
|
303
|
-
for (var option in defaultParams) {
|
304
|
-
mergedOptions[option] = defaultParams[option];
|
305
|
-
if (mergeParams[option] !== undefined) {
|
306
|
-
mergedOptions[option] = mergeParams[option];
|
307
|
-
}
|
308
|
-
}
|
309
|
-
return mergedOptions;
|
310
|
-
}
|
311
|
-
|
312
|
-
function isJSON (json) {
|
313
|
-
try {
|
314
|
-
if (json instanceof Object && JSON.parse(JSON.stringify(json))) {
|
315
|
-
return true;
|
316
|
-
}
|
317
|
-
return false;
|
318
|
-
} catch (e) {
|
319
|
-
return false;
|
320
|
-
}
|
321
|
-
}
|
322
|
-
|
323
|
-
var _$src_8 = {};
|
324
|
-
|
325
|
-
;(function (window, document) {
|
326
|
-
// Global variables
|
327
|
-
var message = {};
|
328
|
-
|
329
|
-
var options = {
|
330
|
-
searchInput: null,
|
331
|
-
resultsContainer: null,
|
332
|
-
results_output: null,
|
333
|
-
json: [],
|
334
|
-
searchResultTemplate: '<li><a href="{url}" title="{desc}">{title}</a></li>',
|
335
|
-
templateMiddleware: function () {},
|
336
|
-
noResultsText: 'No results found',
|
337
|
-
limit: 10,
|
338
|
-
fuzzy: false,
|
339
|
-
exclude: []
|
340
|
-
};
|
341
|
-
|
342
|
-
var requiredOptions = ['searchInput', 'resultsContainer', 'results_output', 'json'];
|
343
|
-
/* removed: var _$Templater_7 = require('./Templater'); */;
|
344
|
-
/* removed: var _$Repository_4 = require('./Repository'); */;
|
345
|
-
/* removed: var _$JSONLoader_2 = require('./JSONLoader'); */;
|
346
|
-
var optionsValidator = _$OptionsValidator_3({ required: requiredOptions });
|
347
|
-
/* removed: var _$utils_9 = require('./utils'); */;
|
348
|
-
var logger;
|
349
|
-
var logText;
|
350
|
-
|
351
|
-
/*
|
352
|
-
Public API
|
353
|
-
*/
|
354
|
-
window.SimpleJekyllSearch = function SimpleJekyllSearch (_options) {
|
355
|
-
logger = log4javascript.getLogger('j1.core.j1_searcher');
|
356
|
-
logger.info('start initialization');
|
357
|
-
|
358
|
-
var errors = optionsValidator.validate(_options);
|
359
|
-
if (errors.length > 0) {
|
360
|
-
logger.error('missing required options: ' + requiredOptions);
|
361
|
-
// throwError('You must specify the following required options: ' + requiredOptions);
|
362
|
-
}
|
363
|
-
|
364
|
-
options = _$utils_9.merge(options, _options);
|
365
|
-
|
366
|
-
_$Templater_7.setOptions({
|
367
|
-
template: options.searchResultTemplate,
|
368
|
-
results_output: options.results_output,
|
369
|
-
middleware: options.templateMiddleware
|
370
|
-
});
|
371
|
-
|
372
|
-
_$Repository_4.setOptions({
|
373
|
-
fuzzy: options.fuzzy,
|
374
|
-
limit: options.limit
|
375
|
-
});
|
376
|
-
|
377
|
-
if (_$utils_9.isJSON(options.json)) {
|
378
|
-
initWithJSON(options.json);
|
379
|
-
} else {
|
380
|
-
initWithURL(options.json);
|
381
|
-
}
|
382
|
-
|
383
|
-
return true;
|
384
|
-
};
|
385
|
-
|
386
|
-
// for backwards compatibility
|
387
|
-
window.SimpleJekyllSearch.init = window.SimpleJekyllSearch;
|
388
|
-
|
389
|
-
if (typeof window.SimpleJekyllSearchInit === 'function') {
|
390
|
-
window.SimpleJekyllSearchInit.call(this, window.SimpleJekyllSearch);
|
391
|
-
}
|
392
|
-
|
393
|
-
function initWithJSON (json) {
|
394
|
-
_$Repository_4.put(json);
|
395
|
-
registerInput();
|
396
|
-
}
|
397
|
-
|
398
|
-
function initWithURL (url) {
|
399
|
-
_$JSONLoader_2.load(url, function (err, json) {
|
400
|
-
if (err) {
|
401
|
-
logger.error('failed to get data at: ' + url);
|
402
|
-
// throwError('failed to get JSON (' + url + ')');
|
403
|
-
}
|
404
|
-
initWithJSON(json);
|
405
|
-
});
|
406
|
-
}
|
407
|
-
|
408
|
-
function emptyResultsContainer () {
|
409
|
-
options.resultsContainer.innerHTML = '';
|
410
|
-
}
|
411
|
-
|
412
|
-
function appendToResultsContainer (text) {
|
413
|
-
options.resultsContainer.innerHTML += text;
|
414
|
-
}
|
415
|
-
|
416
|
-
function registerInput () {
|
417
|
-
options.searchInput.addEventListener('keyup', function (e) {
|
418
|
-
var key = e.which;
|
419
|
-
if (isWhitelistedKey(key)) {
|
420
|
-
emptyResultsContainer();
|
421
|
-
var query = e.target.value;
|
422
|
-
if (isValidQuery(query)) {
|
423
|
-
render(_$Repository_4.search(query));
|
424
|
-
// highlight the query (word) in description text
|
425
|
-
// see: https://stackoverflow.com/questions/17232820/change-the-color-of-a-text-in-div-using-jquery-contains
|
426
|
-
// see: https://stackoverflow.com/questions/187537/is-there-a-case-insensitive-jquery-contains-selector
|
427
|
-
$('.result-group-item-text:contains(' +query+ ')').each(function () {
|
428
|
-
var regex = new RegExp(query,'gi');
|
429
|
-
$(this).html($(this).text().replace(regex, '<code style="color: red !important; font-weight: 700;font-size: 125% !important">' +query+ '</code>'));
|
430
|
-
});
|
431
|
-
// highlight the query (word) in (documents) tagline
|
432
|
-
$('h6.result-item:contains(' +query+ ')').each(function () {
|
433
|
-
var regex = new RegExp(query,'gi');
|
434
|
-
$(this).html($(this).html().replace(regex, ' <code style="color: red !important; font-weight: 700;font-size: 135% !important">' +query+ '</code> '));
|
435
|
-
});
|
436
|
-
}
|
437
|
-
}
|
438
|
-
});
|
439
|
-
}
|
440
|
-
|
441
|
-
/* jadams, 2017-07-09: added resultsOutput for J1 Searcher
|
442
|
-
-------------------------------------------------------------------------- */
|
443
|
-
function render (results) {
|
444
|
-
if (results.length === 0) {
|
445
|
-
var resultsOutput = document.getElementById(options.results_output);
|
446
|
-
resultsOutput.style.display = 'none'; // to hide
|
447
|
-
return appendToResultsContainer(options.noResultsText);
|
448
|
-
}
|
449
|
-
for (var i = 0; i < results.length; i++) {
|
450
|
-
appendToResultsContainer(_$Templater_7.compile(results[i]));
|
451
|
-
}
|
452
|
-
}
|
453
|
-
|
454
|
-
function isValidQuery (query) {
|
455
|
-
return query && query.length > 0;
|
456
|
-
}
|
457
|
-
|
458
|
-
function isWhitelistedKey (key) {
|
459
|
-
return [13, 16, 20, 37, 38, 39, 40, 91].indexOf(key) === -1;
|
460
|
-
}
|
461
|
-
|
462
|
-
function throwError (message) {
|
463
|
-
throw new Error('SimpleJekyllSearch --- ' + message);
|
464
|
-
}
|
465
|
-
|
466
|
-
})(window, document);
|
467
|
-
|
468
|
-
}());
|