j1-template 2024.1.5 → 2024.2.1
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 +0 -34
- data/_includes/themes/j1/modules/searcher/generator.html +4 -1
- data/_includes/themes/j1/modules/searcher/procedures/topsearch.proc +59 -56
- data/assets/data/authclient.html +1 -8
- data/assets/data/banner.html +1 -7
- data/assets/data/fab.html +2 -13
- data/assets/data/footer.html +0 -3
- data/assets/data/galeries.html +2 -13
- data/assets/data/gemini-ui.html +74 -21
- data/assets/data/iframes.html +1 -4
- data/assets/data/masonry.html +1 -13
- data/assets/data/masterslider.html +10 -21
- data/assets/data/menu.html +6 -14
- data/assets/data/mmenu.html +6 -5
- data/assets/data/mmenu_toc.html +2 -1
- data/assets/data/panel.html +4 -11
- data/assets/data/particles.yml +8 -8
- data/assets/data/quicklinks.html +4 -23
- data/assets/data/rtext_resizer.html +3 -1
- data/assets/data/slick.html +9 -11
- data/assets/data/translator.html +0 -1
- data/assets/themes/j1/adapter/js/advertising.js +143 -182
- data/assets/themes/j1/adapter/js/algolia.js +61 -54
- data/assets/themes/j1/adapter/js/analytics.js +68 -52
- data/assets/themes/j1/adapter/js/asciidoctor.js +32 -20
- data/assets/themes/j1/adapter/js/attic.js +75 -69
- data/assets/themes/j1/adapter/js/bmd.js +44 -26
- data/assets/themes/j1/adapter/js/carousel.js +117 -92
- data/assets/themes/j1/adapter/js/chatbot.js +77 -35
- data/assets/themes/j1/adapter/js/clipboard.js +67 -49
- data/assets/themes/j1/adapter/js/comments.js +93 -70
- data/assets/themes/j1/adapter/js/cookieConsent.js +157 -159
- data/assets/themes/j1/adapter/js/customFunctions.js +52 -35
- data/assets/themes/j1/adapter/js/customModule.js +61 -50
- data/assets/themes/j1/adapter/js/docsearch.js +55 -34
- data/assets/themes/j1/adapter/js/dropdowns.js +66 -52
- data/assets/themes/j1/adapter/js/fab.js +124 -109
- data/assets/themes/j1/adapter/js/gallery.js +68 -49
- data/assets/themes/j1/adapter/js/gemini.js +961 -301
- data/assets/themes/j1/adapter/js/iconPicker.js +76 -54
- data/assets/themes/j1/adapter/js/iconPickerPage.js +279 -0
- data/assets/themes/j1/adapter/js/iframer.js +84 -63
- data/assets/themes/j1/adapter/js/j1.js +605 -542
- data/assets/themes/j1/adapter/js/lazyLoader.js +43 -24
- data/assets/themes/j1/adapter/js/lightbox.js +53 -52
- data/assets/themes/j1/adapter/js/logger.js +78 -66
- data/assets/themes/j1/adapter/js/lunr.js +684 -86
- data/assets/themes/j1/adapter/js/masonry.js +84 -68
- data/assets/themes/j1/adapter/js/masterslider.js +136 -137
- data/assets/themes/j1/adapter/js/mmenu.js +102 -66
- data/assets/themes/j1/adapter/js/navigator.js +291 -356
- data/assets/themes/j1/adapter/js/particles.js +62 -40
- data/assets/themes/j1/adapter/js/rangeSlider.js +66 -48
- data/assets/themes/j1/adapter/js/rouge.js +63 -44
- data/assets/themes/j1/adapter/js/rtable.js +56 -40
- data/assets/themes/j1/adapter/js/rtextResizer.js +57 -44
- data/assets/themes/j1/adapter/js/scroller.js +170 -133
- data/assets/themes/j1/adapter/js/slick.js +99 -97
- data/assets/themes/j1/adapter/js/slimSelect.js +288 -0
- data/assets/themes/j1/adapter/js/speak2me.js +124 -128
- data/assets/themes/j1/adapter/js/themeToggler.js +118 -97
- data/assets/themes/j1/adapter/js/{themer.js → themes.js} +144 -113
- data/assets/themes/j1/adapter/js/toccer.js +88 -54
- data/assets/themes/j1/adapter/js/translator.js +74 -70
- data/assets/themes/j1/adapter/js/waves.js +75 -58
- data/assets/themes/j1/core/css/themes/unolight/bootstrap.css +29 -11
- data/assets/themes/j1/core/css/themes/unolight/bootstrap.min.css +2 -2
- data/assets/themes/j1/core/js/template.js +474 -420
- data/assets/themes/j1/core/js/template.min.js +7 -7
- data/assets/themes/j1/core/js/template.min.js.map +1 -1
- data/assets/themes/j1/modules/carousel/css/theme/uno.css +4 -4
- data/assets/themes/j1/modules/carousel/css/theme/uno.min.css +1 -1
- data/assets/themes/j1/modules/clipboard/js/clipboard.js +0 -1
- data/assets/themes/j1/modules/cookieConsent/js/cookieConsent.js +27 -21
- data/assets/themes/j1/modules/iconPicker/css/theme/uno.css +58 -0
- data/assets/themes/j1/modules/iconPicker/css/theme/uno.min.css +16 -0
- data/assets/themes/j1/modules/iconPicker/js/universal-icon-picker.0.js +493 -0
- data/assets/themes/j1/modules/iconPicker/js/universal-icon-picker.js +7 -7
- data/assets/themes/j1/modules/js-cookies/js/js.cookie.js +147 -0
- data/assets/themes/j1/modules/js-cookies/js/js.cookie.min.js +2 -0
- data/assets/themes/j1/modules/lightGallery/js/plugins/lg-video.js +4 -4
- data/assets/themes/j1/modules/lightGallery/js/plugins/lg-video.min.js +2 -10
- data/assets/themes/j1/modules/lunr/css/j1.css +12 -6
- data/assets/themes/j1/modules/lunr/css/j1.min.css +1 -1
- data/assets/themes/j1/modules/lunr/js/j1.js +46 -43
- data/assets/themes/j1/modules/lunr/js/j1.min.js +1 -1
- data/assets/themes/j1/modules/masterslider/js/masterslider.js +1 -1
- data/assets/themes/j1/modules/scroller/js/scroller.js +64 -74
- data/assets/themes/j1/modules/scroller/js/scroller.min.js +1 -1
- data/assets/themes/j1/modules/slick/slider/css/theme/uno.css +4 -4
- data/assets/themes/j1/modules/slick/slider/css/theme/uno.min.css +1 -1
- data/assets/themes/j1/modules/slimSelect/js/select.js +1865 -1821
- data/assets/themes/j1/modules/slimSelect/js/select.min.js +2 -1
- data/assets/themes/j1/modules/themeSwitcher/js/switcher.js +87 -89
- data/assets/themes/j1/modules/themeSwitcher/js/switcher.min.js +1 -1
- data/assets/themes/j1/modules/videojs/js/plugins/vm/api/player.min.js +5 -7
- data/assets/themes/j1/modules/videojs/js/plugins/vm/api/v2.20.1/player.min.js +23 -0
- data/lib/j1/version.rb +1 -1
- data/lib/starter_web/Gemfile +2 -2
- data/lib/starter_web/README.md +5 -5
- data/lib/starter_web/_config.yml +1 -1
- data/lib/starter_web/_data/blocks/_panel.yml +775 -0
- data/lib/starter_web/_data/blocks/panel.yml +53 -53
- data/lib/starter_web/_data/j1_config.yml +3 -2
- data/lib/starter_web/_data/layouts/default.yml +0 -2
- data/lib/starter_web/_data/modules/_scroller.yml +102 -0
- data/lib/starter_web/_data/modules/carousel.yml +3 -3
- data/lib/starter_web/_data/modules/defaults/attics.yml +5 -5
- data/lib/starter_web/_data/modules/defaults/docsearch.yml +1 -1
- data/lib/starter_web/_data/modules/defaults/gemini.yml +204 -46
- data/lib/starter_web/_data/modules/defaults/{iconPicker.yml → icon_picker.yml} +6 -12
- data/lib/starter_web/_data/modules/defaults/lunr.yml +20 -5
- data/lib/starter_web/_data/modules/defaults/masterslider.yml +4 -4
- data/lib/starter_web/_data/modules/defaults/navigator.yml +20 -24
- data/lib/starter_web/_data/modules/defaults/particles.yml +3 -3
- data/lib/starter_web/_data/modules/defaults/slim_select.yml +54 -0
- data/lib/starter_web/_data/modules/defaults/{themer.yml → themes.yml} +10 -10
- data/lib/starter_web/_data/modules/defaults/toccer.yml +1 -1
- data/lib/starter_web/_data/modules/gallery.yml +33 -38
- data/lib/starter_web/_data/modules/gemini.yml +42 -3
- data/lib/starter_web/_data/modules/{iconPicker.yml → icon_picker.yml} +31 -3
- data/lib/starter_web/_data/modules/lunr.yml +12 -1
- data/lib/starter_web/_data/modules/masonry.yml +37 -38
- data/lib/starter_web/_data/modules/masterslider.yml +78 -95
- data/lib/starter_web/_data/modules/navigator_menu.yml +12 -20
- data/lib/starter_web/_data/modules/particles.yml +3 -3
- data/lib/starter_web/_data/modules/scroller.yml +3 -3
- data/lib/starter_web/_data/modules/slim_select.yml +110 -0
- data/lib/starter_web/_data/modules/{themer.yml → themes.yml} +4 -4
- data/lib/starter_web/_data/resources.yml +83 -47
- data/lib/starter_web/_data/templates/feed.xml +1 -1
- data/lib/starter_web/_includes/attributes.asciidoc +354 -355
- data/lib/starter_web/_plugins/asciidoctor/gemini-ui-block.rb +1 -1
- data/lib/starter_web/_plugins/asciidoctor/slim-select-block.rb +45 -0
- data/lib/starter_web/_plugins/index/lunr.rb +1 -1
- data/lib/starter_web/collections/asciidoc_skeletons/simple-post/_posts/yyyy-mm-dd-your-post-name.asciidoc +5 -2
- data/lib/starter_web/collections/posts/public/featured/_posts/0000-00-00-welcome-to-j1.adoc.erb +3 -3
- data/lib/starter_web/collections/posts/public/featured/_posts/2021-01-01-about-cookies.adoc +9 -9
- data/lib/starter_web/collections/posts/public/featured/_posts/2021-02-01-static-site-generators.adoc +4 -4
- data/lib/starter_web/collections/posts/public/featured/_posts/2022-02-01-about-j1.adoc +3 -2
- data/lib/starter_web/collections/posts/public/featured/_posts/2023-10-18-url-types.adoc +12 -12
- data/lib/starter_web/package.json +1 -1
- data/lib/starter_web/pages/public/about/features.adoc +1 -1
- data/lib/starter_web/pages/public/about/reporting_issues.adoc +1 -0
- data/lib/starter_web/pages/public/asciidoc_skeletons/documentation/_includes/attributes.asciidoc +44 -44
- data/lib/starter_web/pages/public/asciidoc_skeletons/documentation/documentation.adoc +1 -0
- data/lib/starter_web/pages/public/asciidoc_skeletons/multi-document/_includes/attributes.asciidoc +12 -12
- data/lib/starter_web/pages/public/blog/navigator/archive/allview.html +1 -1
- data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/_includes/attributes.asciidoc +42 -28
- data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/highlghter_rouge.adoc +1 -0
- data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/lunr_search.adoc +1 -0
- data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/present_audio_video.adoc +18 -2
- data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/present_images.adoc +43 -50
- data/lib/starter_web/pages/public/legal/en/100_copyright.adoc +6 -11
- data/lib/starter_web/pages/public/legal/en/200_impress.adoc +4 -11
- data/lib/starter_web/pages/public/legal/en/300_privacy.adoc +5 -12
- data/lib/starter_web/pages/public/legal/en/400_comment_policy.adoc +5 -10
- data/lib/starter_web/pages/public/tools/previewer/_includes/attributes.asciidoc +10 -9
- data/lib/starter_web/pages/public/tools/previewer/preview_bootstrap_theme.adoc +77 -75
- metadata +52 -46
- data/lib/starter_web/pages/public/manuals/integrations/gemini/_includes/attributes.asciidoc +0 -47
- data/lib/starter_web/pages/public/manuals/integrations/gemini/_includes/documents/preview_google_adsense.asciidoc +0 -448
- data/lib/starter_web/pages/public/manuals/integrations/gemini/_includes/documents/readme +0 -0
- data/lib/starter_web/pages/public/manuals/integrations/gemini/_includes/tables/readme +0 -0
- data/lib/starter_web/pages/public/manuals/integrations/gemini/gemini.adoc +0 -525
- data/lib/starter_web/pages/public/manuals/integrations/gemini/security.asccidoc +0 -274
- data/lib/starter_web/pages/public/manuals/integrations/gemini/security.hrml +0 -560
- /data/lib/starter_web/pages/public/{legal/learn → learn}/bookshelf/article_previewer/viewer_biography.adoc +0 -0
- /data/lib/starter_web/pages/public/{legal/learn → learn}/bookshelf/article_previewer/viewer_fantasy.adoc +0 -0
- /data/lib/starter_web/pages/public/{legal/learn → learn}/bookshelf/article_previewer/viewer_romance.adoc +0 -0
- /data/lib/starter_web/pages/public/{legal/learn → learn}/bookshelf/jekyll_collections.adoc +0 -0
- /data/lib/starter_web/pages/public/{legal/learn → learn}/bookshelf/viewer_all_books.adoc +0 -0
- /data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/_includes/documents/100_gistblock.asciidoc +0 -0
- /data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/_includes/documents/410_bottom_info.asciidoc +0 -0
- /data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/_includes/documents/410_bottom_left_warning.asciidoc +0 -0
- /data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/_includes/documents/410_bottom_right_danger.asciidoc +0 -0
- /data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/_includes/documents/410_central_success.asciidoc +0 -0
- /data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/_includes/documents/410_full_height_left_info.asciidoc +0 -0
- /data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/_includes/documents/410_full_height_right_success.asciidoc +0 -0
- /data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/_includes/documents/410_table_bs_modal_examples.asciidoc +0 -0
- /data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/_includes/documents/410_top_info.asciidoc +0 -0
- /data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/_includes/documents/410_top_left_info.asciidoc +0 -0
- /data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/_includes/documents/410_top_right_success.asciidoc +0 -0
- /data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/_includes/documents/419_advanced_modals_demo.asciidoc +0 -0
- /data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/_includes/documents/tables/bs_modal_examples.asciidoc +0 -0
- /data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/_includes/documents/themes_bootstrap.asciidoc +0 -0
- /data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/_includes/documents/themes_rouge.asciidoc +0 -0
- /data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/asciidoc_extensions.adoc +0 -0
- /data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/bootstrap_themes.adoc +0 -0
- /data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/icon_fonts.adoc +0 -0
- /data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/modal_extentions.adoc +0 -0
- /data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/responsive_tables.adoc +0 -0
- /data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/typography.adoc +0 -0
- /data/lib/starter_web/pages/public/{legal/learn → learn}/where_to_go.adoc +0 -0
@@ -547,9 +547,9 @@
|
|
547
547
|
|
548
548
|
// zoom and chapter tracks only available for HTML5 video
|
549
549
|
//
|
550
|
-
if (videoInfo.html5) {
|
550
|
+
if (this.core.galleryItems[this.core.index].video !== undefined && videoInfo.html5) {
|
551
551
|
videoData = JSON.parse(this.core.galleryItems[this.core.index].video);
|
552
|
-
if (videoData.tracks.length > 0) {
|
552
|
+
if (videoData.tracks !== undefined && videoData.tracks.length > 0) {
|
553
553
|
for (var i=0; i<videoData.tracks.length; i++) {
|
554
554
|
if (videoData.tracks[i].kind == 'chapters') {
|
555
555
|
trackSrc = videoData.tracks[i].src;
|
@@ -567,7 +567,7 @@
|
|
567
567
|
|
568
568
|
// jadams, 2024-01-22: added video start position
|
569
569
|
// ---------------------------------------------------------------
|
570
|
-
if (this.settings.videojsOptions.videoStart) {
|
570
|
+
if (zoomPlugin !== undefined && this.settings.videojsOptions.videoStart) {
|
571
571
|
videoStart = this.settings.videojsOptions.videoStart[index];
|
572
572
|
videojsPlayer.on("play", function() {
|
573
573
|
var startFromSecond = new Date('1970-01-01T' + videoStart + 'Z').getTime() / 1000;
|
@@ -576,7 +576,7 @@
|
|
576
576
|
}); // END on "play"
|
577
577
|
} // END if videoStart
|
578
578
|
|
579
|
-
if (zoomPlugin
|
579
|
+
if (zoomPlugin !== undefined && zoomPlugin.enabled) {
|
580
580
|
zoomPlugin.settings = __assign(__assign({}, zoomPluginDefaults), zoomPlugin.options);
|
581
581
|
videojsPlayer.zoomPlugin({
|
582
582
|
moveX: zoomPlugin.settings.moveX,
|
@@ -22,13 +22,5 @@
|
|
22
22
|
* Copyright (c) 2020 Sachin Neravath;
|
23
23
|
* @license GPLv3
|
24
24
|
*/
|
25
|
-
|
26
|
-
/*!
|
27
|
-
* lightgallery | 2.7.2 | September 20th 2023
|
28
|
-
* http://www.lightgalleryjs.com/
|
29
|
-
* Copyright (c) 2020 Sachin Neravath;
|
30
|
-
* @license GPLv3
|
31
|
-
*/
|
32
|
-
|
33
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).lgVideo=t()}(this,(function(){"use strict";
|
34
|
-
var e=new URL(window.location.href).origin,t=function(){return t=Object.assign||function(e){for(var t,i=1,o=arguments.length;i<o;i++)for(var s in t=arguments[i])Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e},t.apply(this,arguments)},i={autoplayFirstVideo:!0,htmlPlayerParams:!1,youTubePlayerParams:!1,vimeoPlayerParams:!1,dailymotionPlayerParams:!1,wistiaPlayerParams:!1,tiktokPlayerParams:!1,gotoNextSlideOnVideoEnd:!0,autoplayVideoOnSlide:!1,videojs:!1,videojsTheme:"",videojsOptions:{}},o="lgHasVideo",s="lgSlideItemLoad",n="lgBeforeSlide",r="lgAfterSlide",a="lgPosterClick",l=function(e){return Object.keys(e).map((function(t){return encodeURIComponent(t)+"="+encodeURIComponent(e[t])})).join("&")},d=function(i,o){if(!i.youtube)return"";var s=i.youtube[2]?function(e){return e.slice(1).split("&").map((function(e){return e.split("=")})).reduce((function(e,t){var i=t.map(decodeURIComponent),o=i[0],s=i[1];return e[o]=s,e}),{})}(i.youtube[2]):"",n=o||{},r=t(t(t({},{autoplay:0,controls:1,enablejsapi:1,hl:"en",loop:0,mute:1,wmode:"opaque",origin:e}),n),s);return"?"+l(r)},c=function(){function e(e){return this.core=e,this.settings=t(t({},i),this.core.settings),this}return e.prototype.init=function(){var e=this;this.core.LGel.on(o+".video",this.onHasVideo.bind(this)),this.core.LGel.on(a+".video",(function(){var t=e.core.getSlideItem(e.core.index);e.loadVideoOnPosterClick(t)})),this.core.LGel.on(s+".video",this.onSlideItemLoad.bind(this)),this.core.LGel.on(n+".video",this.onBeforeSlide.bind(this)),this.core.LGel.on(r+".video",this.onAfterSlide.bind(this))},e.prototype.onSlideItemLoad=function(e){var t=this,i=e.detail,o=i.isFirstSlide,s=i.index;this.settings.autoplayFirstVideo&&o&&s===this.core.index&&setTimeout((function(){t.loadAndPlayVideo(s)}),200),!o&&this.settings.autoplayVideoOnSlide&&s===this.core.index&&this.loadAndPlayVideo(s)},e.prototype.onHasVideo=function(e){var t=e.detail,i=t.index,o=t.src,s=t.html5Video;if(t.hasPoster)this.core.getSlideItem(i);else this.appendVideos(this.core.getSlideItem(i),{src:o,addClass:"lg-object",index:i,html5Video:s}),this.gotoNextSlideOnVideoEnd(o,i)},e.prototype.onBeforeSlide=function(e){if(this.core.lGalleryOn){var t=e.detail.prevIndex;this.pauseVideo(t)}},e.prototype.onAfterSlide=function(e){var t=this,i=e.detail,o=i.index,s=i.prevIndex,n=this.core.getSlideItem(o);this.settings.autoplayVideoOnSlide&&o!==s&&n.hasClass("lg-complete")&&setTimeout((function(){t.loadAndPlayVideo(o)}),100)},e.prototype.loadAndPlayVideo=function(e){var t=this.core.getSlideItem(e);this.core.galleryItems[e].poster?this.loadVideoOnPosterClick(t,!0):this.playVideo(e)},e.prototype.playVideo=function(e){this.controlVideo(e,"play")},e.prototype.pauseVideo=function(e){this.controlVideo(e,"pause")},e.prototype.getVideoHtml=function(e,t,i,o){var s="",n=this.core.galleryItems[i].__slideVideoInfo||{},r=this.core.galleryItems[i],a=r.title||r.alt;a=a?'title="'+a+'"':"";var c='allowtransparency="true"\n frameborder="0"\n scrolling="no"\n allowfullscreen\n mozallowfullscreen\n webkitallowfullscreen\n msallowfullscreen';if(n.youtube){var u="lg-youtube"+i,f=d(n,this.settings.youTubePlayerParams),m=function(e){return e.includes("youtube-nocookie.com")}(e);s='<iframe allow="autoplay" id='+u+' class="lg-video-object lg-youtube '+t+'" '+a+' src="'+(m?"//www.youtube-nocookie.com/":"//www.youtube.com/")+"embed/"+(n.youtube[1]+f)+'" '+c+"></iframe>"}else if(n.vimeo){u="lg-vimeo"+i;var h=function(e,t){if(!t||!t.vimeo)return"";var i=t.vimeo[2]||"",o=e&&0!==Object.keys(e).length?"&"+l(e):"",s=((t.vimeo[0].split("/").pop()||"").split("?")[0]||"").split("#")[0],n=t.vimeo[1]!==s;return n&&(i=i.replace("/"+s,"")),"?autoplay=0&muted=1"+(n?"&h="+s:"")+o+("?"==i[0]?"&"+i.slice(1):i||"")}(this.settings.vimeoPlayerParams,n);s='<iframe allow="autoplay" id='+u+' class="lg-video-object lg-vimeo '+t+'" '+a+' src="//player.vimeo.com/video/'+(n.vimeo[1]+h)+'" '+c+"></iframe>"}else if(n.wistia){var g="lg-wistia"+i;h=(h=l(this.settings.wistiaPlayerParams))?"?"+h:"",s='<iframe allow="autoplay" id="'+g+'" src="//fast.wistia.net/embed/iframe/'+(n.wistia[4]+h)+'" '+a+' class="wistia_embed lg-video-object lg-wistia '+t+'" name="wistia_embed" '+c+"></iframe>"}else if(n.dailymotion){var v="lg-dailymotion"+i;h=(h=l(this.settings.dailymotionPlayerParams))?"?"+h:"",s='<iframe allow="autoplay" id="'+v+'" src="//www.dailymotion.com/embed/video/'+(n.dailymotion[1]+h)+'" '+a+' class="dailymotion_embed lg-video-object lg-dailymotion '+t+'" name="dailymotion_embed" '+c+"></iframe>"}else if(n.tiktoc){h=function(e,t){if(!t||!t.tiktok)return"";var i=t.tiktok[2]||"",o=e&&0!==Object.keys(e).length?"&"+l(e):"",s=((t.tiktok[0].split("/").pop()||"").split("?")[0]||"").split("#")[0];return t.tiktok[1]!==s&&(i=i.replace("/"+s,"")),"?autoplay=0&muted=1"+o+("?"==i[0]?"&"+i.slice(1):i||"")}(this.settings.TicTocPlayerParams);s='<iframe allow="autoplay" id='+u+' class="lg-video-object lg-tictoc '+t+'" '+a+' src="//tiktok.com/embed/'+n.tiktoc[1]+'" '+a+c+"></iframe>"}else if(n.html5){for(var p="",y=0;y<o.source.length;y++)p+='<source src="'+o.source[y].src+'" type="'+o.source[y].type+'">';if(o.tracks){var w=function(e){var t="",i=o.tracks[e];Object.keys(i||{}).forEach((function(e){t+=e+'="'+i[e]+'" '})),p+="<track "+t+">"};for(y=0;y<o.tracks.length;y++)w(y)}var b="",V=o.attributes||{};Object.keys(V||{}).forEach((function(e){b+=e+'="'+V[e]+'" '})),s='<video class="lg-video-object lg-html5 '+(this.settings.videojs&&this.settings.videojsTheme?this.settings.videojsTheme+" ":"")+" "+(this.settings.videojs?" video-js":"")+'" '+b+">\n "+p+"\n Your browser does not support HTML5 video.\n </video>"}return s},e.prototype.appendVideos=function(e,t){var i,o=this.getVideoHtml(t.src,t.addClass,t.index,t.html5Video);e.find(".lg-video-cont").append(o);var s=e.find(".lg-video-object").first();if(t.html5Video&&s.on("mousedown.lg.video",(function(e){e.stopPropagation()})),this.settings.videojs&&(null===(i=this.core.galleryItems[t.index].__slideVideoInfo)||void 0===i?void 0:i.html5))try{return videojs(s.get(),this.settings.videojsOptions)}catch(e){console.warn("lightGallery: Make sure you have included videojs")}},e.prototype.gotoNextSlideOnVideoEnd=function(e,t){var i=this,o=this.core.getSlideItem(t).find(".lg-video-object").first(),s=this.core.galleryItems[t].__slideVideoInfo||{};if(this.settings.gotoNextSlideOnVideoEnd)if(s.html5)o.on("ended",(function(){i.core.goToNextSlide()}));else if(s.vimeo)try{new Vimeo.Player(o.get()).on("ended",(function(){i.core.goToNextSlide()}))}catch(e){console.warn("lightGallery: Make sure you have included //github.com/vimeo/player.js")}else if(s.wistia)try{window._wq=window._wq||[],window._wq.push({id:o.attr("id"),onReady:function(e){e.bind("end",(function(){i.core.goToNextSlide()}))}})}catch(e){console.warn("lightGallery: Make sure you have included //fast.wistia.com/assets/external/E-v1.js")}},e.prototype.controlVideo=function(e,i){var o,s,n,r,a,l,d,c,u,f=!1;if(n=this.core.galleryItems[e].__slideVideoInfo||{},s=this.core.getSlideItem(e).find(".lg-video-object").first(),n.html5){if((a=JSON.parse(this.core.galleryItems[this.core.index].video)).tracks.length>0)for(var m=0;m<a.tracks.length;m++)"chapters"==a.tracks[m].kind&&(o=a.tracks[m].src,f=!0);l=s.selector.id,d=videojs(l);var h=this.settings.videojsOptions.zoomPlugin;this.settings.videojsOptions.videoStart&&(r=this.settings.videojsOptions.videoStart[e],d.on("play",(function(){var e=new Date("1970-01-01T"+r+"Z").getTime()/1e3;d.currentTime(e)}))),null!=h&&h.enabled&&(h.settings=t(t({},{moveX:0,moveY:0,rotate:0,zoom:1}),h.options),d.zoomPlugin({moveX:h.settings.moveX,moveY:h.settings.moveY,rotate:h.settings.rotate,zoom:h.settings.zoom}))}if(f){var g=new WebVTTParser,v=[];function p(e){for(var t,i=g.parse(e,"metadata"),o=0;o<i.cues.length;o++)t={time:i.cues[o].startTime,label:i.cues[o].text},v.push(t)}c=o,u=p,new WebVTTParser,$.ajax({url:c,type:"GET",success:u,error:function(e){JSON.stringify(e,void 0,2)}}),d.on("play",(function(){d.currentTime(r);var e=d.duration(),t=$(d.controlBar.progressControl.children_[0].el_);setTimeout((function(){var i=setInterval((function(){if(v.length){for(var o=0;o<v.length;o++){var s=v[o].time/e*100+"%",n=v[o].time,r=$('<div class="vjs-chapter-marker" style="left: '+s+'" data-time="'+n+'"> <span>'+v[o].label+"</span></div>");r.click((function(){d.currentTime($(this).data("time"))})),t.append(r)}clearInterval(i)}}),10)}),1e3)}))}if(s.get())if(n.youtube)try{s.get().contentWindow.postMessage('{"event":"command","func":"'+i+'Video","args":""}',"*")}catch(y){console.error("lightGallery:- "+y)}else if(n.vimeo)try{new Vimeo.Player(s.get())[i]()}catch(w){console.warn("lightGallery: Make sure you have included //github.com/vimeo/player.js")}else if(n.html5)if(this.settings.videojs)try{videojs(s.get())[i]()}catch(b){console.warn("lightGallery: Make sure you have included videojs")}else s.get()[i]();else if(n.wistia)try{window._wq=window._wq||[],window._wq.push({id:s.attr("id"),onReady:function(e){e[i]()}})}catch(V){console.warn("lightGallery: Make sure you have included //fast.wistia.com/assets/external/E-v1.js")}},e.prototype.loadVideoOnPosterClick=function(e,t){var i=this;if(e.hasClass("lg-video-loaded"))t&&this.playVideo(this.core.index);else if(e.hasClass("lg-has-video"))this.playVideo(this.core.index);else{e.addClass("lg-has-video");var o=void 0,s=this.core.galleryItems[this.core.index].src,n=this.core.galleryItems[this.core.index].video;n&&(o="string"==typeof n?JSON.parse(n):n);var r=this.appendVideos(e,{src:s,addClass:"",index:this.core.index,html5Video:o});this.gotoNextSlideOnVideoEnd(s,this.core.index);var a=e.find(".lg-object").first().get();e.find(".lg-video-cont").first().append(a),e.addClass("lg-video-loading"),r&&r.ready((function(){r.on("loadedmetadata",(function(){i.onVideoLoadAfterPosterClick(e,i.core.index)}))})),e.find(".lg-video-object").first().on("load.lg error.lg loadedmetadata.lg",(function(){setTimeout((function(){i.onVideoLoadAfterPosterClick(e,i.core.index)}),50)}))}},e.prototype.onVideoLoadAfterPosterClick=function(e,t){e.addClass("lg-video-loaded"),this.playVideo(t)},e.prototype.destroy=function(){this.core.LGel.off(".lg.video"),this.core.LGel.off(".video")},e}();return c}));
|
25
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).lgVideo=t()}(this,function(){"use strict";
|
26
|
+
var e=new URL(window.location.href).origin,t=function(){return(t=Object.assign||function(e){for(var t,i=1,o=arguments.length;i<o;i++)for(var s in t=arguments[i])Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e}).apply(this,arguments)},i={autoplayFirstVideo:!0,htmlPlayerParams:!1,youTubePlayerParams:!1,vimeoPlayerParams:!1,dailymotionPlayerParams:!1,wistiaPlayerParams:!1,tiktokPlayerParams:!1,gotoNextSlideOnVideoEnd:!0,autoplayVideoOnSlide:!1,videojs:!1,videojsTheme:"",videojsOptions:{}},o="lgHasVideo",s="lgSlideItemLoad",n="lgBeforeSlide",r="lgAfterSlide",a="lgPosterClick",l=function(e){return Object.keys(e).map(function(t){return encodeURIComponent(t)+"="+encodeURIComponent(e[t])}).join("&")},d=function(i,o){if(!i.youtube)return"";var s=i.youtube[2]?i.youtube[2].slice(1).split("&").map(function(e){return e.split("=")}).reduce(function(e,t){var i=t.map(decodeURIComponent),o=i[0],s=i[1];return e[o]=s,e},{}):"",n=o||{},r=t(t(t({},{autoplay:0,controls:1,enablejsapi:1,hl:"en",loop:0,mute:1,wmode:"opaque",origin:e}),n),s);return"?"+l(r)};return function(){function e(e){return this.core=e,this.settings=t(t({},i),this.core.settings),this}return e.prototype.init=function(){var e=this;this.core.LGel.on(o+".video",this.onHasVideo.bind(this)),this.core.LGel.on(a+".video",function(){var t=e.core.getSlideItem(e.core.index);e.loadVideoOnPosterClick(t)}),this.core.LGel.on(s+".video",this.onSlideItemLoad.bind(this)),this.core.LGel.on(n+".video",this.onBeforeSlide.bind(this)),this.core.LGel.on(r+".video",this.onAfterSlide.bind(this))},e.prototype.onSlideItemLoad=function(e){var t=this,i=e.detail,o=i.isFirstSlide,s=i.index;this.settings.autoplayFirstVideo&&o&&s===this.core.index&&setTimeout(function(){t.loadAndPlayVideo(s)},200),!o&&this.settings.autoplayVideoOnSlide&&s===this.core.index&&this.loadAndPlayVideo(s)},e.prototype.onHasVideo=function(e){var t=e.detail,i=t.index,o=t.src,s=t.html5Video;if(t.hasPoster)this.core.getSlideItem(i);else this.appendVideos(this.core.getSlideItem(i),{src:o,addClass:"lg-object",index:i,html5Video:s}),this.gotoNextSlideOnVideoEnd(o,i)},e.prototype.onBeforeSlide=function(e){if(this.core.lGalleryOn){var t=e.detail.prevIndex;this.pauseVideo(t)}},e.prototype.onAfterSlide=function(e){var t=this,i=e.detail,o=i.index,s=i.prevIndex,n=this.core.getSlideItem(o);this.settings.autoplayVideoOnSlide&&o!==s&&n.hasClass("lg-complete")&&setTimeout(function(){t.loadAndPlayVideo(o)},100)},e.prototype.loadAndPlayVideo=function(e){var t=this.core.getSlideItem(e);this.core.galleryItems[e].poster?this.loadVideoOnPosterClick(t,!0):this.playVideo(e)},e.prototype.playVideo=function(e){this.controlVideo(e,"play")},e.prototype.pauseVideo=function(e){this.controlVideo(e,"pause")},e.prototype.getVideoHtml=function(e,t,i,o){var s="",n=this.core.galleryItems[i].__slideVideoInfo||{},r=this.core.galleryItems[i],a=r.title||r.alt;a=a?'title="'+a+'"':"";var c='allowtransparency="true"\n frameborder="0"\n scrolling="no"\n allowfullscreen\n mozallowfullscreen\n webkitallowfullscreen\n msallowfullscreen';if(n.youtube){var u="lg-youtube"+i,f=d(n,this.settings.youTubePlayerParams);s='<iframe allow="autoplay" id='+u+' class="lg-video-object lg-youtube '+t+'" '+a+' src="'+(e.includes("youtube-nocookie.com")?"//www.youtube-nocookie.com/":"//www.youtube.com/")+"embed/"+(n.youtube[1]+f)+'" '+c+"></iframe>"}else if(n.vimeo){u="lg-vimeo"+i;var h=function(e,t){if(!t||!t.vimeo)return"";var i=t.vimeo[2]||"",o=e&&0!==Object.keys(e).length?"&"+l(e):"",s=((t.vimeo[0].split("/").pop()||"").split("?")[0]||"").split("#")[0],n=t.vimeo[1]!==s;return n&&(i=i.replace("/"+s,"")),"?autoplay=0&muted=1"+(n?"&h="+s:"")+o+(i="?"==i[0]?"&"+i.slice(1):i||"")}(this.settings.vimeoPlayerParams,n);s='<iframe allow="autoplay" id='+u+' class="lg-video-object lg-vimeo '+t+'" '+a+' src="//player.vimeo.com/video/'+(n.vimeo[1]+h)+'" '+c+"></iframe>"}else if(n.wistia){var m="lg-wistia"+i;h=(h=l(this.settings.wistiaPlayerParams))?"?"+h:"",s='<iframe allow="autoplay" id="'+m+'" src="//fast.wistia.net/embed/iframe/'+(n.wistia[4]+h)+'" '+a+' class="wistia_embed lg-video-object lg-wistia '+t+'" name="wistia_embed" '+c+"></iframe>"}else if(n.dailymotion){var v="lg-dailymotion"+i;h=(h=l(this.settings.dailymotionPlayerParams))?"?"+h:"",s='<iframe allow="autoplay" id="'+v+'" src="//www.dailymotion.com/embed/video/'+(n.dailymotion[1]+h)+'" '+a+' class="dailymotion_embed lg-video-object lg-dailymotion '+t+'" name="dailymotion_embed" '+c+"></iframe>"}else if(n.tiktoc){h=function(e,t){if(!t||!t.tiktok)return"";var i=t.tiktok[2]||"",o=e&&0!==Object.keys(e).length?"&"+l(e):"",s=((t.tiktok[0].split("/").pop()||"").split("?")[0]||"").split("#")[0];return t.tiktok[1]!==s&&(i=i.replace("/"+s,"")),"?autoplay=0&muted=1"+o+(i="?"==i[0]?"&"+i.slice(1):i||"")}(this.settings.TicTocPlayerParams);s='<iframe allow="autoplay" id='+u+' class="lg-video-object lg-tictoc '+t+'" '+a+' src="//tiktok.com/embed/'+n.tiktoc[1]+'" '+a+c+"></iframe>"}else if(n.html5){for(var g="",p=0;p<o.source.length;p++)g+='<source src="'+o.source[p].src+'" type="'+o.source[p].type+'">';if(o.tracks){var y=function(e){var t="",i=o.tracks[e];Object.keys(i||{}).forEach(function(e){t+=e+'="'+i[e]+'" '}),g+="<track "+t+">"};for(p=0;p<o.tracks.length;p++)y(p)}var w="",b=o.attributes||{};Object.keys(b||{}).forEach(function(e){w+=e+'="'+b[e]+'" '}),s='<video class="lg-video-object lg-html5 '+(this.settings.videojs&&this.settings.videojsTheme?this.settings.videojsTheme+" ":"")+" "+(this.settings.videojs?" video-js":"")+'" '+w+">\n "+g+"\n Your browser does not support HTML5 video.\n </video>"}return s},e.prototype.appendVideos=function(e,t){var i,o=this.getVideoHtml(t.src,t.addClass,t.index,t.html5Video);e.find(".lg-video-cont").append(o);var s=e.find(".lg-video-object").first();if(t.html5Video&&s.on("mousedown.lg.video",function(e){e.stopPropagation()}),this.settings.videojs&&(null===(i=this.core.galleryItems[t.index].__slideVideoInfo)||void 0===i?void 0:i.html5))try{return videojs(s.get(),this.settings.videojsOptions)}catch(e){console.warn("lightGallery: Make sure you have included videojs")}},e.prototype.gotoNextSlideOnVideoEnd=function(e,t){var i=this,o=this.core.getSlideItem(t).find(".lg-video-object").first(),s=this.core.galleryItems[t].__slideVideoInfo||{};if(this.settings.gotoNextSlideOnVideoEnd)if(s.html5)o.on("ended",function(){i.core.goToNextSlide()});else if(s.vimeo)try{new Vimeo.Player(o.get()).on("ended",function(){i.core.goToNextSlide()})}catch(e){console.warn("lightGallery: Make sure you have included //github.com/vimeo/player.js")}else if(s.wistia)try{window._wq=window._wq||[],window._wq.push({id:o.attr("id"),onReady:function(e){e.bind("end",function(){i.core.goToNextSlide()})}})}catch(e){console.warn("lightGallery: Make sure you have included //fast.wistia.com/assets/external/E-v1.js")}},e.prototype.controlVideo=function(e,i){var o,s,n,r,a,l,d,c=!1;if(n=this.core.galleryItems[e].__slideVideoInfo||{},s=this.core.getSlideItem(e).find(".lg-video-object").first(),void 0!==this.core.galleryItems[this.core.index].video&&n.html5){if(void 0!==(a=JSON.parse(this.core.galleryItems[this.core.index].video)).tracks&&a.tracks.length>0)for(var u=0;u<a.tracks.length;u++)"chapters"==a.tracks[u].kind&&(o=a.tracks[u].src,c=!0);var f;l=s.selector.id,d=videojs(l),void 0!==(f=this.settings.videojsOptions.zoomPlugin)&&this.settings.videojsOptions.videoStart&&(r=this.settings.videojsOptions.videoStart[e],d.on("play",function(){var e=new Date("1970-01-01T"+r+"Z").getTime()/1e3;d.currentTime(e)})),void 0!==f&&f.enabled&&(f.settings=t(t({},{moveX:0,moveY:0,rotate:0,zoom:1}),f.options),d.zoomPlugin({moveX:f.settings.moveX,moveY:f.settings.moveY,rotate:f.settings.rotate,zoom:f.settings.zoom}))}if(c){var h=new WebVTTParser,m=[];!function(e,t){new WebVTTParser;$.ajax({url:e,type:"GET",success:t,error:function(e){JSON.stringify(e,void 0,2)}})}(o,function(e){for(var t,i=h.parse(e,"metadata"),o=0;o<i.cues.length;o++)t={time:i.cues[o].startTime,label:i.cues[o].text},m.push(t)}),d.on("play",function(){d.currentTime(r);var e=d.duration(),t=$(d.controlBar.progressControl.children_[0].el_);setTimeout(function(){var i=setInterval(function(){if(m.length){for(var o=0;o<m.length;o++){var s=m[o].time/e*100+"%",n=m[o].time,r=$('<div class="vjs-chapter-marker" style="left: '+s+'" data-time="'+n+'"> <span>'+m[o].label+"</span></div>");r.click(function(){d.currentTime($(this).data("time"))}),t.append(r)}clearInterval(i)}},10)},1e3)})}if(s.get())if(n.youtube)try{s.get().contentWindow.postMessage('{"event":"command","func":"'+i+'Video","args":""}',"*")}catch(e){console.error("lightGallery:- "+e)}else if(n.vimeo)try{new Vimeo.Player(s.get())[i]()}catch(e){console.warn("lightGallery: Make sure you have included //github.com/vimeo/player.js")}else if(n.html5)if(this.settings.videojs)try{videojs(s.get())[i]()}catch(e){console.warn("lightGallery: Make sure you have included videojs")}else s.get()[i]();else if(n.wistia)try{window._wq=window._wq||[],window._wq.push({id:s.attr("id"),onReady:function(e){e[i]()}})}catch(e){console.warn("lightGallery: Make sure you have included //fast.wistia.com/assets/external/E-v1.js")}},e.prototype.loadVideoOnPosterClick=function(e,t){var i=this;if(e.hasClass("lg-video-loaded"))t&&this.playVideo(this.core.index);else if(e.hasClass("lg-has-video"))this.playVideo(this.core.index);else{e.addClass("lg-has-video");var o=void 0,s=this.core.galleryItems[this.core.index].src,n=this.core.galleryItems[this.core.index].video;n&&(o="string"==typeof n?JSON.parse(n):n);var r=this.appendVideos(e,{src:s,addClass:"",index:this.core.index,html5Video:o});this.gotoNextSlideOnVideoEnd(s,this.core.index);var a=e.find(".lg-object").first().get();e.find(".lg-video-cont").first().append(a),e.addClass("lg-video-loading"),r&&r.ready(function(){r.on("loadedmetadata",function(){i.onVideoLoadAfterPosterClick(e,i.core.index)})}),e.find(".lg-video-object").first().on("load.lg error.lg loadedmetadata.lg",function(){setTimeout(function(){i.onVideoLoadAfterPosterClick(e,i.core.index)},50)})}},e.prototype.onVideoLoadAfterPosterClick=function(e,t){e.addClass("lg-video-loaded"),this.playVideo(t)},e.prototype.destroy=function(){this.core.LGel.off(".lg.video"),this.core.LGel.off(".video")},e}()});
|
@@ -19,14 +19,20 @@
|
|
19
19
|
background-color: unset;
|
20
20
|
overflow-y: scroll!important;
|
21
21
|
margin-top: .25rem;
|
22
|
-
/* margin-right: 3rem; */
|
23
22
|
margin-bottom: .25rem;
|
24
|
-
/* margin-left: 1rem; */
|
25
23
|
}
|
26
24
|
|
27
25
|
p.result-item-text {
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
26
|
+
font-size: .875rem;
|
27
|
+
margin-bottom: .5rem;
|
28
|
+
text-align: justify;
|
29
|
+
line-height: 1.25rem;
|
30
|
+
}
|
31
|
+
|
32
|
+
span#clear-topsearch > i:hover {
|
33
|
+
color: var(--md-gray-500) !important;
|
34
|
+
}
|
35
|
+
|
36
|
+
span#send-to-history > i:hover {
|
37
|
+
color: var(--md-gray-500) !important;
|
32
38
|
}
|
@@ -12,4 +12,4 @@
|
|
12
12
|
# See: https://github.com/jekyll-one-org/j1-template/blob/main/LICENSE.md
|
13
13
|
# -----------------------------------------------------------------------------
|
14
14
|
*/
|
15
|
-
.search-results{max-height:450px;width:98%;background-color:unset;overflow-y:scroll!important;margin-top:.25rem;margin-bottom:.25rem}p.result-item-text{font-size:.875rem;margin-bottom:.5rem;text-align:justify;line-height:1.25rem}
|
15
|
+
.search-results{max-height:450px;width:98%;background-color:unset;overflow-y:scroll !important;margin-top:.25rem;margin-bottom:.25rem}p.result-item-text{font-size:.875rem;margin-bottom:.5rem;text-align:justify;line-height:1.25rem}span#clear-topsearch>i:hover{color:#424242 !important}span#send-to-history>i:hover{color:#424242 !important}
|
@@ -16,14 +16,13 @@
|
|
16
16
|
# -----------------------------------------------------------------------------
|
17
17
|
*/
|
18
18
|
'use strict';
|
19
|
+
;(function ($) {
|
19
20
|
|
20
|
-
|
21
|
-
|
22
|
-
var debounce = function(fn) {
|
21
|
+
var debounce = function (fn) {
|
23
22
|
var timeout;
|
24
23
|
var slice = Array.prototype.slice;
|
25
24
|
|
26
|
-
return function() {
|
25
|
+
return function () {
|
27
26
|
var args = slice.call(arguments),
|
28
27
|
ctx = this;
|
29
28
|
|
@@ -36,37 +35,38 @@
|
|
36
35
|
};
|
37
36
|
|
38
37
|
// parse a date in yyyy-mm-dd format
|
39
|
-
var parseDate = function(input) {
|
38
|
+
var parseDate = function (input) {
|
40
39
|
var parts = input.match(/(\d+)/g);
|
41
40
|
return new Date(parts[0], parts[1]-1, parts[2]); // months are 0-based
|
42
41
|
};
|
43
42
|
|
44
|
-
var LunrSearch = (function() {
|
43
|
+
var LunrSearch = (function () {
|
45
44
|
function LunrSearch(elem, options) {
|
46
|
-
this.$elem
|
47
|
-
this.$results
|
48
|
-
this.indexData
|
49
|
-
this.template
|
50
|
-
this.titleMsg
|
51
|
-
this.emptyMsg
|
52
|
-
this.
|
45
|
+
this.$elem = elem;
|
46
|
+
this.$results = $(options.results);
|
47
|
+
this.indexData = options.index_file;
|
48
|
+
this.template = this.compileTemplate($(options.template));
|
49
|
+
this.titleMsg = options.titleMsg;
|
50
|
+
this.emptyMsg = options.emptyMsg;
|
51
|
+
this.onResultShown = options.onResultShown;
|
53
52
|
|
54
53
|
this.initialize();
|
55
54
|
}
|
56
55
|
|
57
|
-
LunrSearch.prototype.initialize = function() {
|
56
|
+
LunrSearch.prototype.initialize = function () {
|
58
57
|
var self = this;
|
59
58
|
|
60
|
-
this.loadIndexData(function(data) {
|
61
|
-
self.docs
|
59
|
+
this.loadIndexData(function (data) {
|
60
|
+
self.docs = $.map(data.docs, self.createEntry);
|
62
61
|
self.index = lunr.Index.load(data.index);
|
62
|
+
|
63
63
|
self.populateSearchFromQuery();
|
64
64
|
self.bindKeypress();
|
65
65
|
});
|
66
66
|
};
|
67
67
|
|
68
68
|
// compile search results template
|
69
|
-
LunrSearch.prototype.compileTemplate = function($template) {
|
69
|
+
LunrSearch.prototype.compileTemplate = function ($template) {
|
70
70
|
var template = $template.text();
|
71
71
|
Mustache.parse(template);
|
72
72
|
return function (view, partials) {
|
@@ -75,11 +75,11 @@
|
|
75
75
|
};
|
76
76
|
|
77
77
|
// load the search index data
|
78
|
-
LunrSearch.prototype.loadIndexData = function(callback) {
|
78
|
+
LunrSearch.prototype.loadIndexData = function (callback) {
|
79
79
|
$.getJSON(this.indexData, callback);
|
80
80
|
};
|
81
81
|
|
82
|
-
LunrSearch.prototype.createEntry = function(raw, index) {
|
82
|
+
LunrSearch.prototype.createEntry = function (raw, index) {
|
83
83
|
var entry = $.extend({
|
84
84
|
id: index + 1
|
85
85
|
}, raw);
|
@@ -87,12 +87,12 @@
|
|
87
87
|
// include pub date for posts
|
88
88
|
if (raw.date) {
|
89
89
|
$.extend(entry, {
|
90
|
-
date:
|
91
|
-
pubdate:
|
90
|
+
date: parseDate(raw.date),
|
91
|
+
pubdate: function () {
|
92
92
|
// HTML5 pubdate
|
93
93
|
return dateFormat(parseDate(raw.date), 'yyyy-mm-dd');
|
94
94
|
},
|
95
|
-
displaydate: function() {
|
95
|
+
displaydate: function () {
|
96
96
|
// only for posts (e.g. Oct 12, 2012)
|
97
97
|
return dateFormat(parseDate(raw.date), 'mmm dd, yyyy');
|
98
98
|
}
|
@@ -102,11 +102,11 @@
|
|
102
102
|
return entry;
|
103
103
|
};
|
104
104
|
|
105
|
-
LunrSearch.prototype.bindKeypress = function() {
|
106
|
-
var self
|
105
|
+
LunrSearch.prototype.bindKeypress = function () {
|
106
|
+
var self = this;
|
107
107
|
var oldValue = this.$elem.val();
|
108
108
|
|
109
|
-
this.$elem.bind('keyup', debounce(function() {
|
109
|
+
this.$elem.bind('keyup', debounce(function () {
|
110
110
|
var newValue = self.$elem.val();
|
111
111
|
if (newValue !== oldValue) {
|
112
112
|
self.search(newValue);
|
@@ -116,34 +116,36 @@
|
|
116
116
|
}));
|
117
117
|
};
|
118
118
|
|
119
|
-
LunrSearch.prototype.search = function(query) {
|
119
|
+
LunrSearch.prototype.search = function (query) {
|
120
120
|
var docs = this.docs;
|
121
121
|
|
122
122
|
if (query.length < 3) {
|
123
123
|
this.$results.hide().empty();
|
124
124
|
} else {
|
125
|
-
var results = $.map(this.index.search(query), function(result) {
|
125
|
+
var results = $.map(this.index.search(query), function (result) {
|
126
126
|
return $.grep(docs, function(entry) {
|
127
127
|
return entry.id === parseInt(result.ref, 10); })[0];
|
128
128
|
});
|
129
129
|
|
130
130
|
this.displayResults(results);
|
131
|
-
this.
|
131
|
+
this.onResultShown();
|
132
132
|
}
|
133
133
|
};
|
134
134
|
|
135
|
-
LunrSearch.prototype.displayResults = function(docs) {
|
135
|
+
LunrSearch.prototype.displayResults = function (docs) {
|
136
136
|
var $results = this.$results;
|
137
137
|
|
138
138
|
$results.empty();
|
139
139
|
|
140
140
|
if (docs.length === 0) {
|
141
|
-
$results.append(
|
141
|
+
$results.append(this.emptyMsg);
|
142
142
|
} else {
|
143
143
|
if (this.titleMsg && 0 !== this.titleMsg.length) {
|
144
|
-
$results.append(
|
144
|
+
$results.append(this.titleMsg);
|
145
145
|
}
|
146
|
-
$results.append(this.template({
|
146
|
+
$results.append(this.template({
|
147
|
+
docs: docs
|
148
|
+
}));
|
147
149
|
}
|
148
150
|
|
149
151
|
$results.show();
|
@@ -159,11 +161,11 @@
|
|
159
161
|
logger.info(log_text);
|
160
162
|
|
161
163
|
// Remove unwanted trailing (dot) delimiters
|
162
|
-
$('.sr-tags').each(function() {
|
164
|
+
$('.sr-tags').each(function () {
|
163
165
|
sr_tags = $(this).html().replace(/^\s+(.*)(\s+·\s+$)/, "$1");
|
164
166
|
$(this).text(sr_tags);
|
165
167
|
});
|
166
|
-
$('.sr-categories').each(function() {
|
168
|
+
$('.sr-categories').each(function () {
|
167
169
|
sr_categories = $(this).html().replace(/^(.*)(\s+·\s+$)/, "$1");
|
168
170
|
$(this).text(sr_categories);
|
169
171
|
});
|
@@ -171,8 +173,8 @@
|
|
171
173
|
};
|
172
174
|
|
173
175
|
// Populate the search input with 'q' querystring parameter if set
|
174
|
-
LunrSearch.prototype.populateSearchFromQuery = function() {
|
175
|
-
var uri
|
176
|
+
LunrSearch.prototype.populateSearchFromQuery = function () {
|
177
|
+
var uri = new URI(window.location.search.toString());
|
176
178
|
var queryString = uri.search(true);
|
177
179
|
|
178
180
|
if (queryString.hasOwnProperty('q')) {
|
@@ -184,7 +186,7 @@
|
|
184
186
|
return LunrSearch;
|
185
187
|
})();
|
186
188
|
|
187
|
-
$.fn.lunrSearch = function(options) {
|
189
|
+
$.fn.lunrSearch = function (options) {
|
188
190
|
// apply default options
|
189
191
|
options = $.extend({}, $.fn.lunrSearch.defaults, options);
|
190
192
|
|
@@ -196,11 +198,12 @@
|
|
196
198
|
|
197
199
|
// configuration defaults
|
198
200
|
$.fn.lunrSearch.defaults = {
|
199
|
-
index_file:
|
200
|
-
results:
|
201
|
-
template:
|
202
|
-
titleMsg:
|
203
|
-
emptyMsg:
|
204
|
-
|
201
|
+
index_file: '/assets/data/lunr-index.json', // url for the .json file containing search index data
|
202
|
+
results: '#search-results', // selector for containing search results element
|
203
|
+
template: '#search-results-template', // selector for Mustache.js template
|
204
|
+
titleMsg: '<h1>Search results<h1>', // message attached in front of results
|
205
|
+
emptyMsg: '<p>Nothing found.</p>', // shown message if search returns no results
|
206
|
+
onResultShown: function () {} // a callback to process the page after the search results have been shown
|
205
207
|
};
|
208
|
+
|
206
209
|
})(jQuery);
|
@@ -14,4 +14,4 @@
|
|
14
14
|
# TODO:
|
15
15
|
# -----------------------------------------------------------------------------
|
16
16
|
*/
|
17
|
-
"use strict"
|
17
|
+
"use strict";!function(t){var e=function(t){var e=t.match(/(\d+)/g);return new Date(e[0],e[1]-1,e[2])},n=function(){function n(e,n){this.$elem=e,this.$results=t(n.results),this.indexData=n.index_file,this.template=this.compileTemplate(t(n.template)),this.titleMsg=n.titleMsg,this.emptyMsg=n.emptyMsg,this.onResultShown=n.onResultShown,this.initialize()}return n.prototype.initialize=function(){var e=this;this.loadIndexData(function(n){e.docs=t.map(n.docs,e.createEntry),e.index=lunr.Index.load(n.index),e.populateSearchFromQuery(),e.bindKeypress()})},n.prototype.compileTemplate=function(t){var e=t.text();return Mustache.parse(e),function(t,n){return Mustache.render(e,t,n)}},n.prototype.loadIndexData=function(e){t.getJSON(this.indexData,e)},n.prototype.createEntry=function(n,s){var i=t.extend({id:s+1},n);return n.date&&t.extend(i,{date:e(n.date),pubdate:function(){return dateFormat(e(n.date),"yyyy-mm-dd")},displaydate:function(){return dateFormat(e(n.date),"mmm dd, yyyy")}}),i},n.prototype.bindKeypress=function(){var t,e,n,s=this,i=this.$elem.val();this.$elem.bind("keyup",(t=function(){var t=s.$elem.val();t!==i&&s.search(t),i=t},n=Array.prototype.slice,function(){var s=n.call(arguments),i=this;clearTimeout(e),e=setTimeout(function(){t.apply(i,s)},100)}))},n.prototype.search=function(e){var n=this.docs;if(e.length<3)this.$results.hide().empty();else{var s=t.map(this.index.search(e),function(e){return t.grep(n,function(t){return t.id===parseInt(e.ref,10)})[0]});this.displayResults(s),this.onResultShown()}},n.prototype.displayResults=function(e){var n=this.$results;if(n.empty(),0===e.length?n.append(this.emptyMsg):(this.titleMsg&&0!==this.titleMsg.length&&n.append(this.titleMsg),n.append(this.template({docs:e}))),n.show(),e.length>0){var s,i;log4javascript.getLogger("j1.lunr").info("\npost cleanup of tags and categories"),t(".sr-tags").each(function(){i=t(this).html().replace(/^\s+(.*)(\s+·\s+$)/,"$1"),t(this).text(i)}),t(".sr-categories").each(function(){s=t(this).html().replace(/^(.*)(\s+·\s+$)/,"$1"),t(this).text(s)})}},n.prototype.populateSearchFromQuery=function(){var t=new URI(window.location.search.toString()).search(!0);t.hasOwnProperty("q")&&(this.$elem.val(t.q),this.search(t.q.toString()))},n}();t.fn.lunrSearch=function(e){return e=t.extend({},t.fn.lunrSearch.defaults,e),new n(this,e),this},t.fn.lunrSearch.defaults={index_file:"/assets/data/lunr-index.json",results:"#search-results",template:"#search-results-template",titleMsg:"<h1>Search results<h1>",emptyMsg:"<p>Nothing found.</p>",onResultShown:function(){}}}(jQuery);
|