j1-template 2024.1.5 → 2024.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (193) hide show
  1. checksums.yaml +4 -4
  2. data/_includes/themes/j1/layouts/content_generator_page.html +0 -34
  3. data/_includes/themes/j1/modules/searcher/generator.html +4 -1
  4. data/_includes/themes/j1/modules/searcher/procedures/topsearch.proc +59 -56
  5. data/assets/data/authclient.html +1 -8
  6. data/assets/data/banner.html +1 -7
  7. data/assets/data/fab.html +2 -13
  8. data/assets/data/footer.html +0 -3
  9. data/assets/data/galeries.html +2 -13
  10. data/assets/data/gemini-ui.html +74 -21
  11. data/assets/data/iframes.html +1 -4
  12. data/assets/data/masonry.html +1 -13
  13. data/assets/data/masterslider.html +10 -21
  14. data/assets/data/menu.html +6 -14
  15. data/assets/data/mmenu.html +6 -5
  16. data/assets/data/mmenu_toc.html +2 -1
  17. data/assets/data/panel.html +4 -11
  18. data/assets/data/particles.yml +8 -8
  19. data/assets/data/quicklinks.html +4 -23
  20. data/assets/data/rtext_resizer.html +3 -1
  21. data/assets/data/slick.html +9 -11
  22. data/assets/data/translator.html +0 -1
  23. data/assets/themes/j1/adapter/js/advertising.js +141 -172
  24. data/assets/themes/j1/adapter/js/algolia.js +61 -54
  25. data/assets/themes/j1/adapter/js/analytics.js +67 -47
  26. data/assets/themes/j1/adapter/js/asciidoctor.js +32 -20
  27. data/assets/themes/j1/adapter/js/attic.js +75 -69
  28. data/assets/themes/j1/adapter/js/bmd.js +195 -177
  29. data/assets/themes/j1/adapter/js/carousel.js +786 -761
  30. data/assets/themes/j1/adapter/js/chatbot.js +77 -35
  31. data/assets/themes/j1/adapter/js/clipboard.js +66 -49
  32. data/assets/themes/j1/adapter/js/comments.js +92 -70
  33. data/assets/themes/j1/adapter/js/cookieConsent.js +466 -462
  34. data/assets/themes/j1/adapter/js/customFunctions.js +52 -35
  35. data/assets/themes/j1/adapter/js/customModule.js +56 -46
  36. data/assets/themes/j1/adapter/js/docsearch.js +54 -34
  37. data/assets/themes/j1/adapter/js/dropdowns.js +65 -52
  38. data/assets/themes/j1/adapter/js/fab.js +123 -109
  39. data/assets/themes/j1/adapter/js/gallery.js +494 -476
  40. data/assets/themes/j1/adapter/js/gemini.js +933 -299
  41. data/assets/themes/j1/adapter/js/iconPicker.js +255 -235
  42. data/assets/themes/j1/adapter/js/iconPickerPage.js +279 -0
  43. data/assets/themes/j1/adapter/js/iframer.js +81 -61
  44. data/assets/themes/j1/adapter/js/j1.js +3285 -3222
  45. data/assets/themes/j1/adapter/js/lazyLoader.js +241 -222
  46. data/assets/themes/j1/adapter/js/lightbox.js +241 -241
  47. data/assets/themes/j1/adapter/js/logger.js +77 -66
  48. data/assets/themes/j1/adapter/js/lunr.js +688 -86
  49. data/assets/themes/j1/adapter/js/masonry.js +426 -411
  50. data/assets/themes/j1/adapter/js/masterslider.js +526 -527
  51. data/assets/themes/j1/adapter/js/mmenu.js +101 -66
  52. data/assets/themes/j1/adapter/js/navigator.js +291 -356
  53. data/assets/themes/j1/adapter/js/particles.js +61 -40
  54. data/assets/themes/j1/adapter/js/rangeSlider.js +65 -48
  55. data/assets/themes/j1/adapter/js/rouge.js +287 -269
  56. data/assets/themes/j1/adapter/js/rtable.js +309 -293
  57. data/assets/themes/j1/adapter/js/rtextResizer.js +57 -44
  58. data/assets/themes/j1/adapter/js/scroller.js +170 -133
  59. data/assets/themes/j1/adapter/js/slick.js +487 -485
  60. data/assets/themes/j1/adapter/js/slimSelect.js +290 -0
  61. data/assets/themes/j1/adapter/js/speak2me.js +124 -128
  62. data/assets/themes/j1/adapter/js/themeToggler.js +280 -260
  63. data/assets/themes/j1/adapter/js/{themer.js → themes.js} +145 -113
  64. data/assets/themes/j1/adapter/js/toccer.js +87 -54
  65. data/assets/themes/j1/adapter/js/translator.js +73 -70
  66. data/assets/themes/j1/adapter/js/waves.js +74 -58
  67. data/assets/themes/j1/core/css/themes/unolight/bootstrap.css +29 -11
  68. data/assets/themes/j1/core/css/themes/unolight/bootstrap.min.css +2 -2
  69. data/assets/themes/j1/core/js/template.js +474 -420
  70. data/assets/themes/j1/core/js/template.min.js +7 -7
  71. data/assets/themes/j1/core/js/template.min.js.map +1 -1
  72. data/assets/themes/j1/modules/carousel/css/theme/uno.css +4 -4
  73. data/assets/themes/j1/modules/carousel/css/theme/uno.min.css +1 -1
  74. data/assets/themes/j1/modules/clipboard/js/clipboard.js +0 -1
  75. data/assets/themes/j1/modules/cookieConsent/js/cookieConsent.js +4 -4
  76. data/assets/themes/j1/modules/iconPicker/css/theme/uno.css +58 -0
  77. data/assets/themes/j1/modules/iconPicker/css/theme/uno.min.css +16 -0
  78. data/assets/themes/j1/modules/iconPicker/js/universal-icon-picker.0.js +493 -0
  79. data/assets/themes/j1/modules/iconPicker/js/universal-icon-picker.js +7 -7
  80. data/assets/themes/j1/modules/lightGallery/js/plugins/lg-video.js +4 -4
  81. data/assets/themes/j1/modules/lightGallery/js/plugins/lg-video.min.js +2 -10
  82. data/assets/themes/j1/modules/lunr/css/j1.css +12 -6
  83. data/assets/themes/j1/modules/lunr/css/j1.min.css +1 -1
  84. data/assets/themes/j1/modules/lunr/js/j1.js +46 -43
  85. data/assets/themes/j1/modules/lunr/js/j1.min.js +1 -1
  86. data/assets/themes/j1/modules/masterslider/js/masterslider.js +1 -1
  87. data/assets/themes/j1/modules/scroller/js/scroller.js +64 -74
  88. data/assets/themes/j1/modules/scroller/js/scroller.min.js +1 -1
  89. data/assets/themes/j1/modules/slick/slider/css/theme/uno.css +4 -4
  90. data/assets/themes/j1/modules/slick/slider/css/theme/uno.min.css +1 -1
  91. data/assets/themes/j1/modules/slimSelect/js/select.js +1865 -1821
  92. data/assets/themes/j1/modules/slimSelect/js/select.min.js +2 -1
  93. data/assets/themes/j1/modules/themeSwitcher/js/switcher.js +87 -89
  94. data/assets/themes/j1/modules/themeSwitcher/js/switcher.min.js +1 -1
  95. data/assets/themes/j1/modules/videojs/js/plugins/vm/api/player.min.js +5 -7
  96. data/assets/themes/j1/modules/videojs/js/plugins/vm/api/v2.20.1/player.min.js +23 -0
  97. data/lib/j1/version.rb +1 -1
  98. data/lib/starter_web/Gemfile +2 -2
  99. data/lib/starter_web/README.md +5 -5
  100. data/lib/starter_web/_config.yml +1 -1
  101. data/lib/starter_web/_data/blocks/_panel.yml +775 -0
  102. data/lib/starter_web/_data/blocks/panel.yml +53 -53
  103. data/lib/starter_web/_data/j1_config.yml +3 -2
  104. data/lib/starter_web/_data/layouts/default.yml +0 -2
  105. data/lib/starter_web/_data/modules/_scroller.yml +102 -0
  106. data/lib/starter_web/_data/modules/carousel.yml +3 -3
  107. data/lib/starter_web/_data/modules/defaults/attics.yml +5 -5
  108. data/lib/starter_web/_data/modules/defaults/docsearch.yml +1 -1
  109. data/lib/starter_web/_data/modules/defaults/gemini.yml +204 -46
  110. data/lib/starter_web/_data/modules/defaults/{iconPicker.yml → icon_picker.yml} +6 -12
  111. data/lib/starter_web/_data/modules/defaults/lunr.yml +20 -5
  112. data/lib/starter_web/_data/modules/defaults/masterslider.yml +4 -4
  113. data/lib/starter_web/_data/modules/defaults/navigator.yml +20 -24
  114. data/lib/starter_web/_data/modules/defaults/particles.yml +3 -3
  115. data/lib/starter_web/_data/modules/defaults/slim_select.yml +54 -0
  116. data/lib/starter_web/_data/modules/defaults/{themer.yml → themes.yml} +171 -171
  117. data/lib/starter_web/_data/modules/defaults/toccer.yml +1 -1
  118. data/lib/starter_web/_data/modules/gallery.yml +33 -38
  119. data/lib/starter_web/_data/modules/gemini.yml +42 -3
  120. data/lib/starter_web/_data/modules/{iconPicker.yml → icon_picker.yml} +31 -3
  121. data/lib/starter_web/_data/modules/lunr.yml +12 -1
  122. data/lib/starter_web/_data/modules/masonry.yml +37 -38
  123. data/lib/starter_web/_data/modules/masterslider.yml +78 -95
  124. data/lib/starter_web/_data/modules/navigator_menu.yml +12 -20
  125. data/lib/starter_web/_data/modules/particles.yml +3 -3
  126. data/lib/starter_web/_data/modules/scroller.yml +3 -3
  127. data/lib/starter_web/_data/modules/slim_select.yml +110 -0
  128. data/lib/starter_web/_data/modules/{themer.yml → themes.yml} +4 -4
  129. data/lib/starter_web/_data/resources.yml +57 -47
  130. data/lib/starter_web/_data/templates/feed.xml +1 -1
  131. data/lib/starter_web/_includes/attributes.asciidoc +354 -355
  132. data/lib/starter_web/_plugins/asciidoctor/gemini-ui-block.rb +1 -1
  133. data/lib/starter_web/_plugins/asciidoctor/slim-select-block.rb +45 -0
  134. data/lib/starter_web/_plugins/index/lunr.rb +1 -1
  135. data/lib/starter_web/collections/asciidoc_skeletons/simple-post/_posts/yyyy-mm-dd-your-post-name.asciidoc +5 -2
  136. data/lib/starter_web/collections/posts/public/featured/_posts/0000-00-00-welcome-to-j1.adoc.erb +3 -3
  137. data/lib/starter_web/collections/posts/public/featured/_posts/2021-01-01-about-cookies.adoc +9 -9
  138. data/lib/starter_web/collections/posts/public/featured/_posts/2021-02-01-static-site-generators.adoc +4 -4
  139. data/lib/starter_web/collections/posts/public/featured/_posts/2022-02-01-about-j1.adoc +3 -2
  140. data/lib/starter_web/collections/posts/public/featured/_posts/2023-10-18-url-types.adoc +12 -12
  141. data/lib/starter_web/package.json +1 -1
  142. data/lib/starter_web/pages/public/about/features.adoc +1 -1
  143. data/lib/starter_web/pages/public/about/reporting_issues.adoc +1 -0
  144. data/lib/starter_web/pages/public/asciidoc_skeletons/documentation/_includes/attributes.asciidoc +44 -44
  145. data/lib/starter_web/pages/public/asciidoc_skeletons/documentation/documentation.adoc +1 -0
  146. data/lib/starter_web/pages/public/asciidoc_skeletons/multi-document/_includes/attributes.asciidoc +12 -12
  147. data/lib/starter_web/pages/public/blog/navigator/archive/allview.html +1 -1
  148. data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/_includes/attributes.asciidoc +42 -28
  149. data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/highlghter_rouge.adoc +1 -0
  150. data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/lunr_search.adoc +1 -0
  151. data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/present_audio_video.adoc +18 -2
  152. data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/present_images.adoc +500 -507
  153. data/lib/starter_web/pages/public/legal/en/100_copyright.adoc +6 -11
  154. data/lib/starter_web/pages/public/legal/en/200_impress.adoc +4 -11
  155. data/lib/starter_web/pages/public/legal/en/300_privacy.adoc +5 -12
  156. data/lib/starter_web/pages/public/legal/en/400_comment_policy.adoc +5 -10
  157. data/lib/starter_web/pages/public/tools/previewer/_includes/attributes.asciidoc +10 -9
  158. data/lib/starter_web/pages/public/tools/previewer/preview_bootstrap_theme.adoc +77 -75
  159. metadata +50 -46
  160. data/lib/starter_web/pages/public/manuals/integrations/gemini/_includes/attributes.asciidoc +0 -47
  161. data/lib/starter_web/pages/public/manuals/integrations/gemini/_includes/documents/preview_google_adsense.asciidoc +0 -448
  162. data/lib/starter_web/pages/public/manuals/integrations/gemini/_includes/documents/readme +0 -0
  163. data/lib/starter_web/pages/public/manuals/integrations/gemini/_includes/tables/readme +0 -0
  164. data/lib/starter_web/pages/public/manuals/integrations/gemini/gemini.adoc +0 -525
  165. data/lib/starter_web/pages/public/manuals/integrations/gemini/security.asccidoc +0 -274
  166. data/lib/starter_web/pages/public/manuals/integrations/gemini/security.hrml +0 -560
  167. /data/lib/starter_web/pages/public/{legal/learn → learn}/bookshelf/article_previewer/viewer_biography.adoc +0 -0
  168. /data/lib/starter_web/pages/public/{legal/learn → learn}/bookshelf/article_previewer/viewer_fantasy.adoc +0 -0
  169. /data/lib/starter_web/pages/public/{legal/learn → learn}/bookshelf/article_previewer/viewer_romance.adoc +0 -0
  170. /data/lib/starter_web/pages/public/{legal/learn → learn}/bookshelf/jekyll_collections.adoc +0 -0
  171. /data/lib/starter_web/pages/public/{legal/learn → learn}/bookshelf/viewer_all_books.adoc +0 -0
  172. /data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/_includes/documents/100_gistblock.asciidoc +0 -0
  173. /data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/_includes/documents/410_bottom_info.asciidoc +0 -0
  174. /data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/_includes/documents/410_bottom_left_warning.asciidoc +0 -0
  175. /data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/_includes/documents/410_bottom_right_danger.asciidoc +0 -0
  176. /data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/_includes/documents/410_central_success.asciidoc +0 -0
  177. /data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/_includes/documents/410_full_height_left_info.asciidoc +0 -0
  178. /data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/_includes/documents/410_full_height_right_success.asciidoc +0 -0
  179. /data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/_includes/documents/410_table_bs_modal_examples.asciidoc +0 -0
  180. /data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/_includes/documents/410_top_info.asciidoc +0 -0
  181. /data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/_includes/documents/410_top_left_info.asciidoc +0 -0
  182. /data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/_includes/documents/410_top_right_success.asciidoc +0 -0
  183. /data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/_includes/documents/419_advanced_modals_demo.asciidoc +0 -0
  184. /data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/_includes/documents/tables/bs_modal_examples.asciidoc +0 -0
  185. /data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/_includes/documents/themes_bootstrap.asciidoc +0 -0
  186. /data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/_includes/documents/themes_rouge.asciidoc +0 -0
  187. /data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/asciidoc_extensions.adoc +0 -0
  188. /data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/bootstrap_themes.adoc +0 -0
  189. /data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/icon_fonts.adoc +0 -0
  190. /data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/modal_extentions.adoc +0 -0
  191. /data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/responsive_tables.adoc +0 -0
  192. /data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/typography.adoc +0 -0
  193. /data/lib/starter_web/pages/public/{legal/learn → learn}/where_to_go.adoc +0 -0
@@ -1,269 +1,287 @@
1
- ---
2
- regenerate: true
3
- ---
4
-
5
- {% capture cache %}
6
-
7
- {% comment %}
8
- # -----------------------------------------------------------------------------
9
- # ~/assets/themes/j1/adapter/js/rouge.js
10
- # Liquid template to adapt J1 Highlighter (Rouge)
11
- #
12
- # Product/Info:
13
- # https://jekyll.one
14
- # Copyright (C) 2023, 2024 Juergen Adams
15
- #
16
- # J1 Template is licensed under the MIT License.
17
- # For details, see: https://github.com/jekyll-one-org/j1-template/blob/main/LICENSE.md
18
- # -----------------------------------------------------------------------------
19
- # Test data:
20
- # {{ liquid_var | debug }}
21
- # -----------------------------------------------------------------------------
22
- {% endcomment %}
23
-
24
- {% comment %} Liquid procedures
25
- -------------------------------------------------------------------------------- {% endcomment %}
26
-
27
- {% comment %} Set global settings
28
- -------------------------------------------------------------------------------- {% endcomment %}
29
- {% assign environment = site.environment %}
30
- {% assign template_version = site.version %}
31
- {% assign asset_path = "/assets/themes/j1" %}
32
-
33
- {% comment %} Process YML config data
34
- ================================================================================ {% endcomment %}
35
-
36
- {% comment %} Set config files
37
- -------------------------------------------------------------------------------- {% endcomment %}
38
- {% assign template_config = site.data.j1_config %}
39
-
40
- {% comment %} Detect prod mode
41
- -------------------------------------------------------------------------------- {% endcomment %}
42
- {% assign production = false %}
43
- {% if environment == 'prod' or environment == 'production' %}
44
- {% assign production = true %}
45
- {% endif %}
46
-
47
-
48
- /*
49
- # -----------------------------------------------------------------------------
50
- # ~/assets/themes/j1/adapter/js/rouge.js
51
- # J1 Adapter for rouge
52
- #
53
- # Product/Info:
54
- # https://jekyll.one
55
- #
56
- # Copyright (C) 2023, 2024 Juergen Adams
57
- #
58
- # J1 Template is licensed under the MIT License.
59
- # For details, see: https://github.com/jekyll-one-org/j1-template/blob/main/LICENSE.md
60
- # -----------------------------------------------------------------------------
61
- # Note:
62
- # https://github.com/jirutka/asciidoctor-rouge/issues/9
63
- # -----------------------------------------------------------------------------
64
- # Adapter generated: {{site.time}}
65
- # -----------------------------------------------------------------------------
66
- */
67
-
68
- // -----------------------------------------------------------------------------
69
- // ESLint shimming
70
- // -----------------------------------------------------------------------------
71
- /* eslint indent: "off" */
72
- /* eslint quotes: "off" */
73
- // -----------------------------------------------------------------------------
74
- 'use strict';
75
- j1.adapter.rouge = (function (j1, window) {
76
-
77
- // ---------------------------------------------------------------------------
78
- // globals
79
- // ---------------------------------------------------------------------------
80
- var environment = '{{environment}}';
81
- var moduleOptions = {};
82
- var user_state = {};
83
- var cookie_names = j1.getCookieNames();
84
- var cookie_user_state_name = cookie_names.user_state;
85
- var state = 'not_started';
86
- var user_state_detected;
87
- var themeCss;
88
- var _this;
89
- var logger;
90
- var logText;
91
- var darkTheme;
92
-
93
- var templateOptions = $.extend({}, {{template_config | replace: 'nil', 'null' | replace: '=>', ':' }});
94
-
95
- // ---------------------------------------------------------------------------
96
- // Helper functions
97
- // ---------------------------------------------------------------------------
98
-
99
- // ---------------------------------------------------------------------------
100
- // Main object
101
- // ---------------------------------------------------------------------------
102
- return {
103
-
104
- // -------------------------------------------------------------------------
105
- // helper functions
106
- // -------------------------------------------------------------------------
107
-
108
- // -------------------------------------------------------------------------
109
- // Initializer
110
- // -------------------------------------------------------------------------
111
- init: function (options) {
112
-
113
- // -----------------------------------------------------------------------
114
- // Default module settings
115
- // -----------------------------------------------------------------------
116
- var settings = $.extend({
117
- module_name: 'j1.adapter.rouge',
118
- generated: '{{site.time}}'
119
- }, options);
120
-
121
- // -----------------------------------------------------------------------
122
- // Global variable settings
123
- // -----------------------------------------------------------------------
124
- _this = j1.adapter.rouge;
125
- logger = log4javascript.getLogger('j1.adapter.rouge');
126
-
127
-
128
- // -----------------------------------------------------------------------
129
- // rouge initializer
130
- // -----------------------------------------------------------------------
131
-
132
- var dependencies_met_j1_finished = setInterval(function() {
133
- if (j1.getState() == 'finished') {
134
-
135
- // initialize state flag
136
- _this.setState('started');
137
- logger.debug('\n' + 'state: ' + _this.getState());
138
- logger.info('\n' + 'module is being initialized');
139
-
140
- // Detect|Set J1 UserState
141
- user_state_detected = j1.existsCookie(cookie_user_state_name);
142
- if (user_state_detected) {
143
- user_state = j1.readCookie(cookie_user_state_name);
144
- themeCss = user_state.theme_css;
145
- darkTheme = themeCss.includes('dark') ||
146
- themeCss.includes('cyborg') ||
147
- themeCss.includes('darkly') ||
148
- themeCss.includes('slate') ||
149
- themeCss.includes('superhero');
150
- } else {
151
- log_text = '\n' + 'user_state cookie not found';
152
- logger.warn(log_text);
153
- }
154
-
155
- $('.dropdown-menu a').click(function(){
156
- $('#selected-theme').html('Current selection: <div class="md-gray-900 mt-1 p-2" style="background-color: #BDBDBD; font-weight: 700;">' +$(this).text() + '</div>');
157
- });
158
-
159
- // disable (Google) translation for all highlight HTML elements
160
- // used for rouge
161
- // see: https://www.codingexercises.com/replace-all-instances-of-css-class-in-vanilla-js
162
- //
163
- var highlight = document.getElementsByClassName('highlight');
164
- [...highlight].forEach(function(x) {
165
- if (!x.className.includes('notranslate')) {
166
- x.className += " notranslate"
167
- }
168
- });
169
-
170
- _this.setState('finished');
171
- logger.debug('\n' + 'state: ' + _this.getState());
172
- logger.info('\n' + 'initializing module finished');
173
-
174
- clearInterval(dependencies_met_j1_finished);
175
- } // END dependencies_met_j1_finished
176
- }, 10);
177
-
178
- var dependencies_met_rouge_theme_loaded = setInterval (function () {
179
- if (j1.adapter.rouge.getState() === 'finished') {
180
- if ( darkTheme ) {
181
- j1.adapter.rouge.reaplyStyles(templateOptions.rouge.theme_dark);
182
- } else {
183
- j1.adapter.rouge.reaplyStyles(templateOptions.rouge.theme_light);
184
- }
185
- clearInterval(dependencies_met_rouge_theme_loaded);
186
- }
187
- }, 10); // END 'dependencies_met_rouge_theme_loaded'
188
-
189
- }, // END init
190
-
191
- // -------------------------------------------------------------------------
192
- // load|apply new rouge theme
193
- // -------------------------------------------------------------------------
194
- reaplyStyles: function (themename) {
195
- _this.removeAllRougeStyles();
196
- _this.addStyle(themename);
197
- return true;
198
- },
199
-
200
- // -------------------------------------------------------------------------
201
- // remove existing rouge theme CSS (from section <head>)
202
- // -------------------------------------------------------------------------
203
- removeAllRougeStyles: function () {
204
- $('link[rel=stylesheet][href*="/assets/themes/j1/modules/rouge"]').remove();
205
- },
206
-
207
- // -------------------------------------------------------------------------
208
- // add rouge theme CSS (to section <head>)
209
- // -------------------------------------------------------------------------
210
- addStyle: function (themename) {
211
- $('<link>').attr('rel','stylesheet')
212
- .attr('type','text/css')
213
- .attr('href','/assets/themes/j1/modules/rouge/css/' +themename+ '/theme.min.css')
214
- .appendTo('head');
215
- },
216
-
217
- // -------------------------------------------------------------------------
218
- // messageHandler: MessageHandler for J1 CookieConsent module
219
- // Manage messages send from other J1 modules
220
- // -------------------------------------------------------------------------
221
- messageHandler: function (sender, message) {
222
- var json_message = JSON.stringify(message, undefined, 2);
223
-
224
- logText = '\n' + 'received message from ' + sender + ': ' + json_message;
225
- logger.debug(logText);
226
-
227
- // -----------------------------------------------------------------------
228
- // Process commands|actions
229
- // -----------------------------------------------------------------------
230
- if (message.type === 'command' && message.action === 'module_initialized') {
231
- //
232
- // Place handling of command|action here
233
- //
234
- logger.info('\n' + message.text);
235
- }
236
-
237
- //
238
- // Place handling of other command|action here
239
- //
240
-
241
- return true;
242
- }, // END messageHandler
243
-
244
- // -------------------------------------------------------------------------
245
- // setState()
246
- // Sets the current (processing) state of the module
247
- // -------------------------------------------------------------------------
248
- setState: function (stat) {
249
- _this.state = stat;
250
- }, // END setState
251
-
252
- // -------------------------------------------------------------------------
253
- // getState()
254
- // Returns the current (processing) state of the module
255
- // -------------------------------------------------------------------------
256
- getState: function () {
257
- return _this.state;
258
- } // END getState
259
-
260
- }; // END return
261
- })(j1, window);
262
-
263
- {% endcapture %}
264
- {% if production %}
265
- {{ cache | minifyJS }}
266
- {% else %}
267
- {{ cache | strip_empty_lines }}
268
- {% endif %}
269
- {% assign cache = nil %}
1
+ ---
2
+ regenerate: true
3
+ ---
4
+
5
+ {% capture cache %}
6
+
7
+ {% comment %}
8
+ # -----------------------------------------------------------------------------
9
+ # ~/assets/themes/j1/adapter/js/rouge.js
10
+ # Liquid template to adapt J1 Highlighter (Rouge)
11
+ #
12
+ # Product/Info:
13
+ # https://jekyll.one
14
+ # Copyright (C) 2023, 2024 Juergen Adams
15
+ #
16
+ # J1 Template is licensed under the MIT License.
17
+ # For details, see: https://github.com/jekyll-one-org/j1-template/blob/main/LICENSE.md
18
+ # -----------------------------------------------------------------------------
19
+ # Test data:
20
+ # {{ liquid_var | debug }}
21
+ # -----------------------------------------------------------------------------
22
+ {% endcomment %}
23
+
24
+ {% comment %} Liquid procedures
25
+ -------------------------------------------------------------------------------- {% endcomment %}
26
+
27
+ {% comment %} Set global settings
28
+ -------------------------------------------------------------------------------- {% endcomment %}
29
+ {% assign environment = site.environment %}
30
+ {% assign template_version = site.version %}
31
+ {% assign asset_path = "/assets/themes/j1" %}
32
+
33
+ {% comment %} Process YML config data
34
+ ================================================================================ {% endcomment %}
35
+
36
+ {% comment %} Set config files
37
+ -------------------------------------------------------------------------------- {% endcomment %}
38
+ {% assign template_config = site.data.j1_config %}
39
+
40
+ {% comment %} Detect prod mode
41
+ -------------------------------------------------------------------------------- {% endcomment %}
42
+ {% assign production = false %}
43
+ {% if environment == 'prod' or environment == 'production' %}
44
+ {% assign production = true %}
45
+ {% endif %}
46
+
47
+ /*
48
+ # -----------------------------------------------------------------------------
49
+ # ~/assets/themes/j1/adapter/js/rouge.js
50
+ # J1 Adapter for rouge
51
+ #
52
+ # Product/Info:
53
+ # https://jekyll.one
54
+ #
55
+ # Copyright (C) 2023, 2024 Juergen Adams
56
+ #
57
+ # J1 Template is licensed under the MIT License.
58
+ # For details, see: https://github.com/jekyll-one-org/j1-template/blob/main/LICENSE.md
59
+ # -----------------------------------------------------------------------------
60
+ # Note:
61
+ # https://github.com/jirutka/asciidoctor-rouge/issues/9
62
+ # -----------------------------------------------------------------------------
63
+ # Adapter generated: {{site.time}}
64
+ # -----------------------------------------------------------------------------
65
+ */
66
+
67
+ // -----------------------------------------------------------------------------
68
+ // ESLint shimming
69
+ // -----------------------------------------------------------------------------
70
+ /* eslint indent: "off" */
71
+ /* eslint quotes: "off" */
72
+ // -----------------------------------------------------------------------------
73
+ 'use strict';
74
+ j1.adapter.rouge = ((j1, window) => {
75
+
76
+ {% comment %} Set global variables
77
+ ------------------------------------------------------------------------------ {% endcomment %}
78
+ var environment = '{{environment}}';
79
+ var moduleOptions = {};
80
+ var user_state = {};
81
+ var cookie_names = j1.getCookieNames();
82
+ var cookie_user_state_name = cookie_names.user_state;
83
+ var state = 'not_started';
84
+ var user_state_detected;
85
+ var themeCss;
86
+ var darkTheme;
87
+
88
+ var _this;
89
+ var logger;
90
+ var logText;
91
+
92
+ // date|time
93
+ var startTime;
94
+ var endTime;
95
+ var startTimeModule;
96
+ var endTimeModule;
97
+ var timeSeconds;
98
+
99
+ var templateOptions = $.extend({}, {{template_config | replace: 'nil', 'null' | replace: '=>', ':' }});
100
+
101
+ // ---------------------------------------------------------------------------
102
+ // helper functions
103
+ // ---------------------------------------------------------------------------
104
+
105
+ // ---------------------------------------------------------------------------
106
+ // main
107
+ // ---------------------------------------------------------------------------
108
+ return {
109
+
110
+ // -------------------------------------------------------------------------
111
+ // helper functions
112
+ // -------------------------------------------------------------------------
113
+
114
+ // -------------------------------------------------------------------------
115
+ // adapter initializer
116
+ // -------------------------------------------------------------------------
117
+ init: (options) => {
118
+
119
+ // -----------------------------------------------------------------------
120
+ // default module settings
121
+ // -----------------------------------------------------------------------
122
+ var settings = $.extend({
123
+ module_name: 'j1.adapter.rouge',
124
+ generated: '{{site.time}}'
125
+ }, options);
126
+
127
+ // -----------------------------------------------------------------------
128
+ // global variable settings
129
+ // -----------------------------------------------------------------------
130
+ _this = j1.adapter.rouge;
131
+ logger = log4javascript.getLogger('j1.adapter.rouge');
132
+
133
+ // -----------------------------------------------------------------------
134
+ // module initializer
135
+ // -----------------------------------------------------------------------
136
+ var dependency_met_page_ready = setInterval(() => {
137
+ var pageState = $('#content').css("display");
138
+ var pageVisible = (pageState === 'block') ? true : false;
139
+ var j1CoreFinished = (j1.getState() === 'finished') ? true : false;
140
+
141
+ if (j1CoreFinished && pageVisible) {
142
+ startTimeModule = Date.now();
143
+
144
+ _this.setState('started');
145
+ logger.debug('\n' + 'set module state to: ' + _this.getState());
146
+ logger.info('\n' + 'initializing module: started');
147
+
148
+ // Detect|Set J1 UserState
149
+ user_state_detected = j1.existsCookie(cookie_user_state_name);
150
+ if (user_state_detected) {
151
+ user_state = j1.readCookie(cookie_user_state_name);
152
+ themeCss = user_state.theme_css;
153
+ darkTheme = themeCss.includes('dark') ||
154
+ themeCss.includes('cyborg') ||
155
+ themeCss.includes('darkly') ||
156
+ themeCss.includes('slate') ||
157
+ themeCss.includes('superhero');
158
+ } else {
159
+ log_text = '\n' + 'user_state cookie not found';
160
+ logger.warn(log_text);
161
+ }
162
+
163
+ $('.dropdown-menu a').click(() => {
164
+ $('#selected-theme').html('Current selection: <div class="md-gray-900 mt-1 p-2" style="background-color: #BDBDBD; font-weight: 700;">' +$(this).text() + '</div>');
165
+ });
166
+
167
+ // disable (Google) translation for all highlight HTML elements
168
+ // used for rouge
169
+ // see: https://www.codingexercises.com/replace-all-instances-of-css-class-in-vanilla-js
170
+ //
171
+ var highlight = document.getElementsByClassName('highlight');
172
+ [...highlight].forEach((x) => {
173
+ if (!x.className.includes('notranslate')) {
174
+ x.className += " notranslate"
175
+ }
176
+ });
177
+
178
+ _this.setState('finished');
179
+ logger.debug('\n' + 'state: ' + _this.getState());
180
+ logger.info('\n' + 'initializing module: finished');
181
+
182
+ endTimeModule = Date.now();
183
+ logger.info('\n' + 'module initializing time: ' + (endTimeModule-startTimeModule) + 'ms');
184
+
185
+ clearInterval(dependency_met_page_ready);
186
+ } // END if pageVisible
187
+ }, 10); // END dependency_met_page_ready
188
+
189
+ var dependencies_met_rouge_finished = setInterval(() => {
190
+ var moduleFinished = (j1.adapter.rouge.getState() === 'finished') ? true : false;
191
+
192
+ if (moduleFinished) {
193
+ if (darkTheme) {
194
+ j1.adapter.rouge.reaplyStyles(templateOptions.rouge.theme_dark);
195
+ } else {
196
+ j1.adapter.rouge.reaplyStyles(templateOptions.rouge.theme_light);
197
+ }
198
+
199
+ clearInterval(dependencies_met_rouge_finished);
200
+ } // END if darkTheme
201
+ }, 10); // END dependencies_met_rouge_finished
202
+ }, // END init
203
+
204
+ // -------------------------------------------------------------------------
205
+ // reaplyStyles()
206
+ // load|apply new rouge theme
207
+ // -------------------------------------------------------------------------
208
+ reaplyStyles: (themename) => {
209
+ _this.removeAllRougeStyles();
210
+ _this.addStyle(themename);
211
+ return true;
212
+ },
213
+
214
+ // -------------------------------------------------------------------------
215
+ // removeAllRougeStyles()
216
+ // remove existing rouge theme CSS (from section <head>)
217
+ // -------------------------------------------------------------------------
218
+ removeAllRougeStyles: () => {
219
+ $('link[rel=stylesheet][href*="/assets/themes/j1/modules/rouge"]').remove();
220
+ },
221
+
222
+ // -------------------------------------------------------------------------
223
+ // addStyle()
224
+ // add rouge theme CSS (to section <head>)
225
+ // -------------------------------------------------------------------------
226
+ addStyle: (themename) => {
227
+ $('<link>').attr('rel','stylesheet')
228
+ .attr('type','text/css')
229
+ .attr('href','/assets/themes/j1/modules/rouge/css/' +themename+ '/theme.min.css')
230
+ .appendTo('head');
231
+ },
232
+
233
+ // -------------------------------------------------------------------------
234
+ // messageHandler()
235
+ // manage messages send from other J1 modules
236
+ // -------------------------------------------------------------------------
237
+ messageHandler: (sender, message) => {
238
+ var json_message = JSON.stringify(message, undefined, 2);
239
+
240
+ logText = '\n' + 'received message from ' + sender + ': ' + json_message;
241
+ logger.debug(logText);
242
+
243
+ // -----------------------------------------------------------------------
244
+ // process commands|actions
245
+ // -----------------------------------------------------------------------
246
+ if (message.type === 'command' && message.action === 'module_initialized') {
247
+
248
+ //
249
+ // place handling of command|action here
250
+ //
251
+
252
+ logger.info('\n' + message.text);
253
+ }
254
+
255
+ //
256
+ // place handling of other command|action here
257
+ //
258
+
259
+ return true;
260
+ }, // END messageHandler
261
+
262
+ // -------------------------------------------------------------------------
263
+ // setState()
264
+ // sets the current (processing) state of the module
265
+ // -------------------------------------------------------------------------
266
+ setState: (stat) => {
267
+ _this.state = stat;
268
+ }, // END setState
269
+
270
+ // -------------------------------------------------------------------------
271
+ // getState()
272
+ // Returns the current (processing) state of the module
273
+ // -------------------------------------------------------------------------
274
+ getState: () => {
275
+ return _this.state;
276
+ } // END getState
277
+
278
+ }; // END main (return)
279
+ })(j1, window);
280
+
281
+ {% endcapture %}
282
+ {% if production %}
283
+ {{ cache | minifyJS }}
284
+ {% else %}
285
+ {{ cache | strip_empty_lines }}
286
+ {% endif %}
287
+ {% assign cache = nil %}