j1-template 2022.0.9 → 2022.0.13

Sign up to get free protection for your applications and to get access to all the features.
Files changed (218) hide show
  1. checksums.yaml +4 -4
  2. data/_includes/themes/j1/modules/ads/google_ad_content_home.html +11 -0
  3. data/_includes/themes/j1/modules/ads/google_ad_top_home.html +11 -0
  4. data/apps/public/cc/index.adoc +0 -1
  5. data/assets/data/article_navigator/index.html +0 -1
  6. data/assets/data/news_panel_posts/index.html +0 -1
  7. data/assets/error_pages/HTTP445.html +5 -4
  8. data/assets/error_pages/HTTP446.html +2 -2
  9. data/assets/error_pages/HTTP447.html +110 -0
  10. data/assets/error_pages/HTTP448.html +111 -0
  11. data/assets/themes/j1/adapter/js/advertising.js +442 -0
  12. data/assets/themes/j1/adapter/js/algolia.js +10 -13
  13. data/assets/themes/j1/adapter/js/analytics.js +259 -0
  14. data/assets/themes/j1/adapter/js/asciidoctor.js +10 -13
  15. data/assets/themes/j1/adapter/js/attic.js +10 -5
  16. data/assets/themes/j1/adapter/js/bmd.js +10 -14
  17. data/assets/themes/j1/adapter/js/carousel.js +10 -13
  18. data/assets/themes/j1/adapter/js/clipboard.js +9 -10
  19. data/assets/themes/j1/adapter/js/comments.js +407 -0
  20. data/assets/themes/j1/adapter/js/cookieConsent.js +107 -84
  21. data/assets/themes/j1/adapter/js/fab.js +11 -11
  22. data/assets/themes/j1/adapter/js/framer.js +59 -64
  23. data/assets/themes/j1/adapter/js/j1.js +203 -258
  24. data/assets/themes/j1/adapter/js/justifiedGallery.js +12 -14
  25. data/assets/themes/j1/adapter/js/justifiedGalleryCustomizer.js +10 -13
  26. data/assets/themes/j1/adapter/js/lightbox.js +12 -9
  27. data/assets/themes/j1/adapter/js/logger.js +11 -5
  28. data/assets/themes/j1/adapter/js/mmenu.js +11 -12
  29. data/assets/themes/j1/adapter/js/navigator.js +13 -12
  30. data/assets/themes/j1/adapter/js/quicksearch.js +10 -13
  31. data/assets/themes/j1/adapter/js/rouge.js +11 -14
  32. data/assets/themes/j1/adapter/js/rtable.js +10 -13
  33. data/assets/themes/j1/adapter/js/rtextResizer.js +10 -13
  34. data/assets/themes/j1/adapter/js/scroller.js +14 -12
  35. data/assets/themes/j1/adapter/js/themer.js +12 -3
  36. data/assets/themes/j1/adapter/js/toccer.js +10 -13
  37. data/assets/themes/j1/adapter/js/translator.js +50 -96
  38. data/assets/themes/j1/core/css/themes/unolight/bootstrap.css +6 -0
  39. data/assets/themes/j1/core/css/themes/unolight/bootstrap.min.css +1 -1
  40. data/assets/themes/j1/core/js/template.js +13 -5
  41. data/assets/themes/j1/core/js/template.min.js +1 -1
  42. data/assets/themes/j1/core/js/template.min.js.map +1 -1
  43. data/assets/themes/j1/modules/advertising/js/google/adInitializer.js +127 -0
  44. data/assets/themes/j1/modules/cookieConsent/js/cookieConsent.js +11 -2
  45. data/assets/themes/j1/modules/cookieConsent/js/cookieConsent.min.js +1 -1
  46. data/assets/themes/j1/modules/deeplAPI/js/deeplAPI.2.js +1 -1
  47. data/assets/themes/j1/modules/deeplAPI/js/deeplAPI.js +1 -1
  48. data/assets/themes/j1/modules/scroller/js/scroller.js +1 -1
  49. data/lib/j1/version.rb +1 -1
  50. data/lib/starter_web/Gemfile +1 -1
  51. data/lib/starter_web/_config.yml +1 -13
  52. data/lib/starter_web/_data/apps/carousel.yml +2 -2
  53. data/lib/starter_web/_data/apps/defaults/carousel.yml +3 -2
  54. data/lib/starter_web/_data/apps/defaults/justifiedGallery.yml +2 -2
  55. data/lib/starter_web/_data/apps/defaults/justifiedGalleryCustomizer.yml +2 -2
  56. data/lib/starter_web/_data/apps/defaults/lightGallery.yml +2 -2
  57. data/lib/starter_web/_data/apps/defaults/lightbox.yml +2 -2
  58. data/lib/starter_web/_data/apps/justifiedGallery.yml +2 -2
  59. data/lib/starter_web/_data/apps/justifiedGalleryCustomizer.yml +2 -2
  60. data/lib/starter_web/_data/apps/lightGallery.yml +2 -2
  61. data/lib/starter_web/_data/apps/lightbox.yml +2 -2
  62. data/lib/starter_web/_data/blocks/banner.yml +3 -2
  63. data/lib/starter_web/_data/blocks/defaults/banner.yml +9 -0
  64. data/lib/starter_web/_data/blocks/defaults/footer.yml +9 -0
  65. data/lib/starter_web/_data/blocks/defaults/panel.yml +9 -0
  66. data/lib/starter_web/_data/blocks/footer.yml +3 -2
  67. data/lib/starter_web/_data/blocks/panel.yml +3 -2
  68. data/lib/starter_web/_data/builder/blog_navigator.yml +3 -2
  69. data/lib/starter_web/_data/builder/defaults/blog_navigator.yml +8 -8
  70. data/lib/starter_web/_data/j1_config.yml +0 -116
  71. data/lib/starter_web/_data/layouts/default.yml +21 -21
  72. data/lib/starter_web/_data/layouts/home.ads.yml +262 -0
  73. data/lib/starter_web/_data/layouts/home.no-ads.yml +262 -0
  74. data/lib/starter_web/_data/layouts/home.yml +24 -0
  75. data/lib/starter_web/_data/layouts/page.yml +7 -18
  76. data/lib/starter_web/_data/layouts/post.yml +0 -11
  77. data/lib/starter_web/_data/modules/advertising.yml +139 -12
  78. data/lib/starter_web/_data/modules/analytics.yml +99 -0
  79. data/lib/starter_web/_data/modules/attics.yml +3 -2
  80. data/lib/starter_web/_data/modules/comments.yml +55 -0
  81. data/lib/starter_web/_data/modules/cookieconsent.yml +2 -1
  82. data/lib/starter_web/_data/modules/cookies.yml +1 -1
  83. data/lib/starter_web/_data/modules/defaults/advertising.yml +105 -0
  84. data/lib/starter_web/_data/modules/defaults/analytics.yml +93 -0
  85. data/lib/starter_web/_data/modules/defaults/attics.yml +3 -2
  86. data/lib/starter_web/_data/modules/defaults/authentication.yml +51 -48
  87. data/lib/starter_web/_data/modules/defaults/comments.yml +114 -0
  88. data/lib/starter_web/_data/modules/defaults/cookieconsent.yml +3 -3
  89. data/lib/starter_web/_data/modules/defaults/cookies.yml +105 -26
  90. data/lib/starter_web/_data/modules/defaults/fab.yml +4 -2
  91. data/lib/starter_web/_data/modules/defaults/framer.yml +2 -3
  92. data/lib/starter_web/_data/modules/defaults/log4javascript.yml +3 -2
  93. data/lib/starter_web/_data/modules/defaults/log4r.yml +2 -2
  94. data/lib/starter_web/_data/modules/defaults/navigator.yml +4 -2
  95. data/lib/starter_web/_data/modules/defaults/quicksearch.yml +4 -3
  96. data/lib/starter_web/_data/modules/defaults/rtable.yml +3 -2
  97. data/lib/starter_web/_data/modules/defaults/scoller.yml +3 -2
  98. data/lib/starter_web/_data/modules/defaults/themer.yml +119 -118
  99. data/lib/starter_web/_data/modules/defaults/toccer.yml +1 -1
  100. data/lib/starter_web/_data/modules/defaults/translator.yml +1 -1
  101. data/lib/starter_web/_data/modules/fab.yml +3 -2
  102. data/lib/starter_web/_data/modules/framer.yml +3 -4
  103. data/lib/starter_web/_data/modules/log4r.yml +2 -2
  104. data/lib/starter_web/_data/modules/navigator.yml +4 -2
  105. data/lib/starter_web/_data/modules/quicksearch.yml +3 -3
  106. data/lib/starter_web/_data/modules/rtable.yml +3 -3
  107. data/lib/starter_web/_data/modules/scroller.yml +2 -3
  108. data/lib/starter_web/_data/modules/themer.yml +2 -3
  109. data/lib/starter_web/_data/modules/toccer.yml +3 -3
  110. data/lib/starter_web/_data/modules/translator.yml +1 -1
  111. data/lib/starter_web/_data/plugins/defaults/paginator.yml +2 -2
  112. data/lib/starter_web/_data/plugins/paginator.yml +2 -2
  113. data/lib/starter_web/_data/resources.yml +447 -290
  114. data/lib/starter_web/_includes/attributes.asciidoc +1 -1
  115. data/lib/starter_web/_includes/themes/j1/modules/ads/google_ad_content_home.html +11 -0
  116. data/lib/starter_web/_includes/themes/j1/modules/ads/google_ad_top_home.html +11 -0
  117. data/lib/starter_web/_plugins/lunr_index.rb +1 -1
  118. data/lib/starter_web/collections/posts/public/featured/_posts/0000-00-00-welcome-to-j1.adoc.erb +1 -1
  119. data/lib/starter_web/collections/posts/public/featured/_posts/2021-01-01-about-cookies.adoc +1 -1
  120. data/lib/starter_web/collections/posts/public/featured/_posts/2021-01-01-about-cookies.ads.asciidoc +196 -0
  121. data/lib/starter_web/collections/posts/public/featured/_posts/2021-01-01-about-cookies.comments.asciidoc +182 -0
  122. data/lib/starter_web/collections/posts/public/featured/_posts/2021-02-01-site-generators.adoc +1 -1
  123. data/lib/starter_web/collections/posts/public/featured/_posts/2021-03-03-about-j1.adoc +1 -1
  124. data/lib/starter_web/collections/posts/public/series/_posts/2020-01-01-post-wiki-series.adoc +1 -1
  125. data/lib/starter_web/collections/posts/public/series/_posts/2020-01-02-post-wiki-series.adoc +1 -1
  126. data/lib/starter_web/collections/posts/public/series/_posts/2020-01-03-post-wiki-series.adoc +1 -1
  127. data/lib/starter_web/index.html +0 -4
  128. data/lib/starter_web/package.json +1 -1
  129. data/lib/starter_web/pages/public/asciidoc_skeletons/documentation/documentation.adoc +0 -1
  130. data/lib/starter_web/pages/public/asciidoc_skeletons/multi-document/multi.adoc +0 -1
  131. data/lib/starter_web/pages/public/asciidoc_skeletons/simple-document/simple.adoc +0 -1
  132. data/lib/starter_web/pages/public/blog/navigator/archive/categoryview.html +0 -1
  133. data/lib/starter_web/pages/public/blog/navigator/archive/dateview.html +0 -1
  134. data/lib/starter_web/pages/public/blog/navigator/archive/tagview.html +0 -1
  135. data/lib/starter_web/pages/public/blog/navigator/archive.html +0 -1
  136. data/lib/starter_web/pages/public/blog/navigator/index.html +0 -1
  137. data/lib/starter_web/pages/public/learn/roundtrip/100_present_images.adoc +4 -3
  138. data/lib/starter_web/pages/public/learn/roundtrip/100_present_images.ads.asciidoc +265 -0
  139. data/lib/starter_web/pages/public/learn/roundtrip/100_present_images.base.asciidoc +237 -0
  140. data/lib/starter_web/pages/public/learn/roundtrip/100_present_images.comments.asciidoc +237 -0
  141. data/lib/starter_web/pages/public/learn/roundtrip/100_present_videos.adoc +62 -0
  142. data/lib/starter_web/pages/public/learn/roundtrip/_includes/google-ad.js +130 -0
  143. data/lib/starter_web/pages/public/legal/en/100_copyright.adoc +0 -1
  144. data/lib/starter_web/pages/public/legal/en/200_impress.adoc +0 -1
  145. data/lib/starter_web/pages/public/legal/en/400_comment_policy.adoc +0 -1
  146. data/lib/starter_web/pages/public/manuals/dropdown-help.adoc +23 -2
  147. data/lib/starter_web/pages/public/previewer/preview_bootstrap_theme.adoc +100 -166
  148. data/lib/starter_web/utilsrv/_defaults/package.json +1 -1
  149. data/lib/starter_web/utilsrv/package.json +1 -1
  150. metadata +25 -70
  151. data/_includes/themes/j1/blocks/ads/ad.html +0 -64
  152. data/_includes/themes/j1/modules/boards/news_pin_board.html +0 -183
  153. data/_includes/themes/j1/modules/connectors/ad/custom-provider.html +0 -30
  154. data/_includes/themes/j1/modules/connectors/ad/google-adsense.html +0 -62
  155. data/_includes/themes/j1/modules/connectors/ads +0 -56
  156. data/_includes/themes/j1/modules/connectors/analytic/custom-provider.html +0 -32
  157. data/_includes/themes/j1/modules/connectors/analytic/google-analytics.html +0 -30
  158. data/_includes/themes/j1/modules/connectors/analytics +0 -60
  159. data/_includes/themes/j1/modules/connectors/comment/commento.html +0 -31
  160. data/_includes/themes/j1/modules/connectors/comment/custom-provider.html +0 -30
  161. data/_includes/themes/j1/modules/connectors/comment/disqus.html +0 -32
  162. data/_includes/themes/j1/modules/connectors/comment/facebook.html +0 -30
  163. data/_includes/themes/j1/modules/connectors/comment/hyvor.html +0 -32
  164. data/_includes/themes/j1/modules/connectors/comment/just-comments.html +0 -31
  165. data/_includes/themes/j1/modules/connectors/comments +0 -64
  166. data/_includes/themes/j1/modules/connectors/sharing +0 -29
  167. data/_includes/themes/j1/modules/connectors/survey/custom-provider.html +0 -30
  168. data/_includes/themes/j1/modules/connectors/survey/jotform.html +0 -32
  169. data/_includes/themes/j1/modules/connectors/surveys +0 -58
  170. data/_includes/themes/j1/modules/connectors/translator +0 -58
  171. data/_includes/themes/j1/modules/connectors/translators/custom-translator.html +0 -32
  172. data/_includes/themes/j1/modules/connectors/translators/google-translator.html +0 -53
  173. data/_includes/themes/j1/modules/search/algolia.html +0 -181
  174. data/_includes/themes/j1/modules/search/docsearch.html +0 -42
  175. data/assets/data/disqus.js +0 -81
  176. data/assets/data/hyvor.js +0 -72
  177. data/lib/starter_web/pages/_test_pages/100_side-bar-tester.adoc +0 -244
  178. data/lib/starter_web/pages/_test_pages/_includes/attributes.asciidoc +0 -110
  179. data/lib/starter_web/pages/_test_pages/_includes/documents/100_gistblock.asciidoc +0 -28
  180. data/lib/starter_web/pages/_test_pages/_includes/documents/410_bottom_info.asciidoc +0 -14
  181. data/lib/starter_web/pages/_test_pages/_includes/documents/410_bottom_left_warning.asciidoc +0 -11
  182. data/lib/starter_web/pages/_test_pages/_includes/documents/410_bottom_right_danger.asciidoc +0 -11
  183. data/lib/starter_web/pages/_test_pages/_includes/documents/410_central_success.asciidoc +0 -11
  184. data/lib/starter_web/pages/_test_pages/_includes/documents/410_full_height_left_info.asciidoc +0 -11
  185. data/lib/starter_web/pages/_test_pages/_includes/documents/410_full_height_right_success.asciidoc +0 -11
  186. data/lib/starter_web/pages/_test_pages/_includes/documents/410_table_bs_modal_examples.asciidoc +0 -47
  187. data/lib/starter_web/pages/_test_pages/_includes/documents/410_top_info.asciidoc +0 -11
  188. data/lib/starter_web/pages/_test_pages/_includes/documents/410_top_left_info.asciidoc +0 -11
  189. data/lib/starter_web/pages/_test_pages/_includes/documents/410_top_right_success.asciidoc +0 -11
  190. data/lib/starter_web/pages/_test_pages/_includes/documents/419_advanced_modals_demo.asciidoc +0 -337
  191. data/lib/starter_web/pages/_test_pages/_includes/documents/tables/bs_modal_examples.asciidoc +0 -47
  192. data/lib/starter_web/pages/_test_pages/accordion-01-tester.adoc +0 -220
  193. data/lib/starter_web/pages/_test_pages/accordion-02-tester.adoc +0 -177
  194. data/lib/starter_web/pages/_test_pages/accordion-03-tester.adoc +0 -148
  195. data/lib/starter_web/pages/_test_pages/attribute-changes-01-tester.adoc +0 -226
  196. data/lib/starter_web/pages/_test_pages/backdrop-tester.adoc +0 -109
  197. data/lib/starter_web/pages/_test_pages/button-tester-1.adoc +0 -127
  198. data/lib/starter_web/pages/_test_pages/card-tester.adoc +0 -128
  199. data/lib/starter_web/pages/_test_pages/cookieConsent.adoc +0 -96
  200. data/lib/starter_web/pages/_test_pages/deepl.0.adoc +0 -258
  201. data/lib/starter_web/pages/_test_pages/deepl.adoc +0 -204
  202. data/lib/starter_web/pages/_test_pages/desandro-button.adoc +0 -171
  203. data/lib/starter_web/pages/_test_pages/desandro.adoc +0 -147
  204. data/lib/starter_web/pages/_test_pages/flipcard-1-tester.adoc +0 -308
  205. data/lib/starter_web/pages/_test_pages/formular-01-tester.adoc +0 -167
  206. data/lib/starter_web/pages/_test_pages/formular-02-tester.adoc +0 -727
  207. data/lib/starter_web/pages/_test_pages/google-translate-tester.0.adoc +0 -113
  208. data/lib/starter_web/pages/_test_pages/google-translate-tester.1.adoc +0 -231
  209. data/lib/starter_web/pages/_test_pages/google-translate-tester.3.adoc +0 -149
  210. data/lib/starter_web/pages/_test_pages/google-translate-tester.4.adoc +0 -237
  211. data/lib/starter_web/pages/_test_pages/infinite-scroll-tester-2.adoc +0 -183
  212. data/lib/starter_web/pages/_test_pages/infinite-scroll-tester-3.adoc +0 -235
  213. data/lib/starter_web/pages/_test_pages/infinite-scroll-tester-4.adoc +0 -222
  214. data/lib/starter_web/pages/_test_pages/infinite-scroll-tester-5.adoc +0 -119
  215. data/lib/starter_web/pages/_test_pages/infinite-scroll-tester.1.adoc +0 -236
  216. data/lib/starter_web/pages/_test_pages/infinite-scroll-tester.adoc +0 -225
  217. data/lib/starter_web/pages/_test_pages/list-group-tester.adoc +0 -265
  218. data/lib/starter_web/pages/_test_pages/tictok.adoc +0 -127
@@ -60,8 +60,8 @@ regenerate: true
60
60
  {% assign themer_defaults = modules.defaults.themer.defaults %}
61
61
  {% assign themer_settings = modules.themer.settings %}
62
62
 
63
- {% assign tracking_enabled = template_config.analytics.enabled %}
64
- {% assign tracking_id = template_config.analytics.google.tracking_id %}
63
+ {% assign tracking_enabled = modules.analytics.enabled %}
64
+ {% assign tracking_id = modules.analytics.google.trackingID %}
65
65
 
66
66
  {% assign authentication_defaults = modules.defaults.authentication.defaults %}
67
67
  {% assign authentication_settings = modules.authentication.settings %}
@@ -82,24 +82,10 @@ regenerate: true
82
82
  {% assign themer_enabled = modules.themer_options.enabled %}
83
83
  {% assign themer_reloadPageOnChange = modules.themer_options.reloadPageOnChange %}
84
84
  {% assign themer_hideOnReload = modules.themer_options.hideOnReload %}
85
- {% assign comment_provider = template_config.comments.provider %}
85
+
86
86
 
87
87
  {% comment %} Set variables
88
88
  -------------------------------------------------------------------------------- {% endcomment %}
89
- {% if comment_provider == 'disqus' %}
90
- {% assign site_id = template_config.comments.disqus.site_id %}
91
- {% elsif comment_provider == 'hyvor' %}
92
- {% assign site_id = template_config.comments.hyvor.site_id %}
93
- {% elsif comment_provider == 'commento' %}
94
- {% assign site_id = template_config.comments.commento.site_id %}
95
- {% elsif comment_provider == 'just-comments' %}
96
- {% assign site_id = template_config.comments.just-comments.site_id %}
97
- {% elsif comment_provider == 'facebook' %}
98
- {% assign site_id = template_config.comments.facebook.site_id %}
99
- {% else %}
100
- {% assign site_id = false %}
101
- {% endif %}
102
-
103
89
  {% assign production = false %}
104
90
  {% if environment == 'prod' or environment == 'production' %}
105
91
  {% assign production = true %}
@@ -115,14 +101,6 @@ regenerate: true
115
101
  {% assign language = "en" %}
116
102
  {% endif %}
117
103
 
118
- {% if language == "en" %}
119
- {% assign comments_headline = template_config.comments.comments_headline.en %}
120
- {% endif %}
121
-
122
- {% if language == "de" %}
123
- {% assign comments_headline = template_config.comments.comments_headline.de %}
124
- {% endif %}
125
-
126
104
  /*
127
105
  # -----------------------------------------------------------------------------
128
106
  # ~/assets/themes/j1/adapter/js/j1_template.js
@@ -151,30 +129,30 @@ regenerate: true
151
129
  /* eslint semi: "off" */
152
130
  // -----------------------------------------------------------------------------
153
131
  'use strict';
154
-
155
132
  var j1 = (function () {
156
133
 
157
134
  // ---------------------------------------------------------------------------
158
135
  // globals
159
136
  // ---------------------------------------------------------------------------
160
- var rePager = new RegExp('navigator|dateview|tagview|archive');
161
- var environment = '{{environment}}';
162
- var moduleOptions = {};
163
- var j1_runtime_data = {};
137
+ var rePager = new RegExp('navigator|dateview|tagview|archive');
138
+ var environment = '{{environment}}';
139
+ var moduleOptions = {};
140
+ var j1_runtime_data = {};
164
141
 
165
142
  // Status information
166
- var state = 'not_started';
167
- var mode = 'not_detected';
143
+ var state = 'not_started';
144
+ var mode = 'not_detected';
168
145
 
169
146
  // Default tracking provider information
170
- var tracking_enabled = ('{{tracking_enabled}}' === 'true') ? true: false;
171
- var tracking_id = '{{tracking_id}}';
172
- var tracking_id_valid = (tracking_id.includes('tracking-id')) ? false : true;
147
+ // var tracking_enabled = ('{{tracking_enabled}}' === 'true') ? true: false;
148
+ // var tracking_id = '{{tracking_id}}';
149
+ // var tracking_id_valid = (tracking_id.includes('tracking-id')) ? false : true;
173
150
 
174
151
  // Default comment provider information
175
- var comment_provider = '{{comment_provider}}';
176
- var site_id = '{{site_id}}';
177
- var check_cookies = {{cookie_options.check_cookies}};
152
+ var comment_provider = '{{comment_provider}}';
153
+ var site_id = '{{site_id}}';
154
+ var checkCookies = {{cookie_options.checkCookies}};
155
+ var expireCookiesOnRequiredOnly = ('{{cookie_options.expireCookiesOnRequiredOnly}}' === 'true') ? true: false;
178
156
 
179
157
  var current_user_data;
180
158
  var current_page;
@@ -275,7 +253,15 @@ var j1 = (function () {
275
253
  init: function (options) {
276
254
 
277
255
  // -----------------------------------------------------------------------
278
- // global var (function)
256
+ // Default module settings
257
+ // -----------------------------------------------------------------------
258
+ var settings = $.extend({
259
+ module_name: 'j1',
260
+ generated: '{{site.time}}'
261
+ }, options);
262
+
263
+ // -----------------------------------------------------------------------
264
+ // Global variable settings
279
265
  // -----------------------------------------------------------------------
280
266
  var logger = log4javascript.getLogger('j1.init');
281
267
  var url = new liteURL(window.location.href);
@@ -290,15 +276,6 @@ var j1 = (function () {
290
276
  var j1Cookies = j1.findCookie('j1');
291
277
  var themerOptions = $.extend({}, {{themer_options | replace: '=>', ':' | replace: 'nil', '""' }});
292
278
 
293
- // -----------------------------------------------------------------------
294
- // options loader
295
- // -----------------------------------------------------------------------
296
- var settings = $.extend({
297
- foo: 'foo_option',
298
- bar: 'bar_option'
299
- },
300
- options
301
- );
302
279
  // -----------------------------------------------------------------------
303
280
  // status settings
304
281
  // save status into the adapter object for (later) global access
@@ -371,7 +348,7 @@ var j1 = (function () {
371
348
 
372
349
  // jadams, 2021-12-06: Check if access to cookies for this site failed.
373
350
  // Possibly, a third-party domain or an attacker tries to access it.
374
- if (check_cookies) {
351
+ if (checkCookies) {
375
352
  if (!user_state) {
376
353
  logger.error('\n' + 'Access to cookie failed or cookie not found: ' + cookie_names.user_state);
377
354
  logger.debug('\n' + 'j1 cookies found:' + j1Cookies.length);
@@ -381,10 +358,12 @@ var j1 = (function () {
381
358
  }
382
359
 
383
360
  if (!user_consent.analysis || !user_consent.personalization) {
384
- // expire permanent cookies to session
385
- j1.expireCookie({ name: cookie_names.user_state });
386
- j1.expireCookie({ name: cookie_names.user_consent });
387
- j1.expireCookie({ name: cookie_names.user_translate });
361
+ if (expireCookiesOnRequiredOnly) {
362
+ // expire permanent cookies to session
363
+ j1.expireCookie({ name: cookie_names.user_state });
364
+ j1.expireCookie({ name: cookie_names.user_consent });
365
+ j1.expireCookie({ name: cookie_names.user_translate });
366
+ }
388
367
  }
389
368
 
390
369
  // initialize event handler for window/history/back on <ESC>
@@ -848,6 +827,7 @@ var j1 = (function () {
848
827
  var categoryAllowed;
849
828
 
850
829
  // provider APIs require user consent
830
+ // -----------------------------------------------------------------------
851
831
  var meta_analytics = $('meta[name=analytics]').attr('content');
852
832
  var analytics = (meta_analytics === 'true') ? true: false;
853
833
  var meta_comments = $('meta[name=comments]').attr('content');
@@ -864,6 +844,7 @@ var j1 = (function () {
864
844
  var personalization = (meta_personalization === 'true') ? true: false;
865
845
 
866
846
  // if personalized content detected, page requires user consent
847
+ // -----------------------------------------------------------------------
867
848
  if (personalization && !user_consent.personalization) {
868
849
  // redirect to error page: blocked content
869
850
  window.location.href = '/444.html';
@@ -873,7 +854,9 @@ var j1 = (function () {
873
854
  logText= '\n' + 'loading page partials: started';
874
855
  logger.info(logText);
875
856
 
876
- if (j1.appDetected()) { // app mode
857
+ if (j1.appDetected()) {
858
+ // app mode
859
+ // ---------------------------------------------------------------------
877
860
  logger.info('\n' + 'mode detected: app');
878
861
 
879
862
  $.when ($.ajax(ep_status))
@@ -916,78 +899,22 @@ var j1 = (function () {
916
899
 
917
900
  // show the page delayed
918
901
  setTimeout (function() {
919
- // Manage providers for personalization OptIn/Out (Comments|Ads)
920
- if (!user_consent.personalization) {
921
- logger.debug('\n' + 'disable comment provider: ' + comment_provider);
922
- logger.debug('\n' + 'personalization not allowed, privacy settings for personalization: ' + user_consent.personalization);
923
- $('#leave-a-comment').remove();
924
- if (comment_provider === 'disqus') {
925
- $('#dsq-count-scr').remove();
926
- $('#disqus-thread').remove();
927
- }
928
- if (comment_provider === 'hyvor') {
929
- $('#hyvor-embed').remove();
930
- $('#hyvor-talk-view').remove();
931
- }
932
- } else {
933
- if (comments) {
934
- logger.info('\n' + 'enable comment provider: ' + comment_provider);
935
- $('#main-content').append('<h2 id="leave-a-comment" class="mt-4">{{comments_headline}}</h2>');
936
- if (comment_provider === 'disqus') {
937
- logger.info('\n' + 'load comment provider code: ' + comment_provider);
938
- $('#main-content').append('<div id="disqus_thread"></div>');
939
- $('body').append('<script async id="dsq-count-scr" src="//' + site_id + '.disqus.com/count.js"></script>');
940
- j1.loadJS({
941
- xhr_data_path: '/assets/data/' + comment_provider + '.js',
942
- xhr_data_element: comment_provider
943
- });
944
- }
945
- if (comment_provider === 'hyvor') {
946
- $('body').append('<script> var HYVOR_TALK_WEBSITE = ' + site_id + '; var HYVOR_TALK_CONFIG = { url: false, id: false };');
947
- $('#main-content').append('<div id="hyvor-talk-view"></div>');
948
- $('body').append('<script async id="hyvor-embed" type="text/javascript" src="//talk.hyvor.com/web-api/embed.js"></script>');
949
- }
950
- }
951
- }
952
-
953
902
  // display page
954
- $('#no_flicker').css('display', 'block');
903
+ $('#no_flicker').css('display', 'block');
955
904
 
956
- // no dropcaps if translation enabled
957
- if (user_translate.translationEnabled) {
905
+ // manage Dropcaps if translation is enabled|disabled
906
+ // -----------------------------------------------------------------
907
+ if (user_translate.translationEnabled) {
958
908
  logger.info('\n' + 'translation enabled: ' + user_translate.translationEnabled);
959
909
  logger.debug('\n' + 'skipped processing of dropcaps');
960
- } else {
910
+ } else {
961
911
  // initialize dropcaps
962
912
  logger.info('\n' + 'post processing: createDropCap');
963
913
  j1.core.createDropCap();
964
- }
965
-
966
- // add recommended title to hyvor iframe for SEO optimization (if loadad)
967
- if (comment_provider === 'hyvor') {
968
- var dependencies_met_load_finished = setInterval (function () {
969
- if ($('#hyvor-talk-view').children().length) {
970
- $('#hyvor-talk-iframe').prop('title', 'Hyvor talk iframe');
971
- clearInterval(dependencies_met_load_finished);
972
- }
973
- }, 25);
974
- }
975
- // NOTE: Placed tracking warning/info here because page may reloaded
976
- // after cookie consent selection
977
- if (user_consent.analysis) {
978
- logger.info('\n' + 'tracking allowed, privacy settings for analysis: ' + user_consent.analysis);
979
- if (tracking_enabled && !tracking_id_valid) {
980
- logger.error('\n' + 'tracking enabled, but invalid tracking id found: ' + tracking_id);
981
- } else if (tracking_enabled && tracking_id_valid) {
982
- logger.info('\n' + 'tracking enabled, tracking id found: ' + tracking_id);
983
- } else {
984
- logger.info('\n' + 'tracking disabled, tracking id found: ' + tracking_id);
985
- }
986
- } else {
987
- logger.debug('\n' + 'tracking not allowed, privacy settings for analysis: ' + user_consent.analysis);
988
914
  }
989
915
 
990
- // show|hide cookie icon (should MOVED to Cookiebar ???)
916
+ // TODO: should MOVED to Cookiebar ???
917
+ // show|hide cookie icon
991
918
  if (j1.existsCookie(cookie_names.user_consent)) {
992
919
  // Display cookie icon
993
920
  logText = '\n' + 'show cookie icon';
@@ -1000,6 +927,7 @@ var j1 = (function () {
1000
927
  $('#quickLinksCookieButton').css('display', 'none');
1001
928
  }
1002
929
 
930
+ // TODO: should MOVED to ControlCenter Adapter ???
1003
931
  // -----------------------------------------------------------------
1004
932
  // show cc icon (currently NOT supported)
1005
933
  // $('#quickLinksControlCenterButton').css('display', 'block');
@@ -1020,6 +948,7 @@ var j1 = (function () {
1020
948
  $('#quickLinksSignInOutButton').css('display', 'block');
1021
949
  }
1022
950
 
951
+ // TODO: should MOVED to Themer ???
1023
952
  // jadams, 2021-07-25: hide|show themes menu on cookie consent
1024
953
  // (analysis|personalization) settings. BootSwatch is a 3rd party
1025
954
  // is using e.g GA. Because NO control is possible on 3rd parties,
@@ -1033,10 +962,7 @@ var j1 = (function () {
1033
962
  $("#themes_menu").show();
1034
963
  }
1035
964
 
1036
- // if the page requested contains an anchor element,
1037
- // do a smooth scroll to
1038
- j1.scrollTo();
1039
-
965
+ // detect if a loaded page has been chenged
1040
966
  if (user_session.previous_page !== user_session.current_page) {
1041
967
  logText = '\n' + 'page change detected';
1042
968
  logger.info(logText);
@@ -1052,56 +978,34 @@ var j1 = (function () {
1052
978
  current_user_data = j1.mergeData(user_session, user_state);
1053
979
  j1.core.navigator.updateSidebar(current_user_data);
1054
980
 
1055
- // Set|Log status
981
+ // set|log status
1056
982
  state = 'finished';
983
+ j1.setState(state);
1057
984
  logText = '\n' + 'state: ' + state;
1058
985
  logger.info(logText);
1059
986
  logText = '\n' + 'page finalized successfully';
1060
987
  logger.info(logText);
988
+
989
+ // do a (smooth) scroll if all nav elements ready
990
+ // -----------------------------------------------------------------
991
+ var dependencies_met_navigator_finished = setInterval(function() {
992
+ if (j1.adapter.navigator.getState() == 'finished') {
993
+ // if a page requested contains an anchor element, do a smooth scroll
994
+ j1.scrollTo();
995
+ clearInterval(dependencies_met_navigator_finished);
996
+ }
997
+ }, 25);
1061
998
  }, flickerTimeout);
1062
999
  });
1063
1000
  } else {
1064
1001
  // web mode
1002
+ // ---------------------------------------------------------------------
1065
1003
  setTimeout (function() {
1066
- j1.setState('finished');
1004
+ // j1.setState('finished');
1067
1005
  logger.info('\n' + 'state: finished');
1068
1006
  logger.info('\n' + 'page initialization: finished');
1069
1007
 
1070
- // Manage providers for personalization OptIn/Out (Comments|Ads)
1071
- if (!user_consent.personalization) {
1072
- logger.debug('\n' + 'disable comment provider: ' + comment_provider);
1073
- logger.debug('\n' + 'personalization not allowed, privacy settings for personalization: ' + user_consent.personalization);
1074
- $('#leave-a-comment').remove();
1075
- if (comment_provider === 'disqus') {
1076
- $('#dsq-count-scr').remove();
1077
- $('#disqus-thread').remove();
1078
- }
1079
- if (comment_provider === 'hyvor') {
1080
- $('#hyvor-embed').remove();
1081
- $('#hyvor-talk-view').remove();
1082
- }
1083
- } else {
1084
- if (comments) {
1085
- logger.info('\n' + 'enable comment provider: ' + comment_provider);
1086
- $('#main-content').append('<h2 id="leave-a-comment" class="mt-4">{{comments_headline}}</h2>');
1087
- if (comment_provider === 'disqus') {
1088
- logger.info('\n' + 'load comment provider code: ' + comment_provider);
1089
- $('#main-content').append('<div id="disqus_thread"></div>');
1090
- $('body').append('<script async id="dsq-count-scr" src="//' + site_id + '.disqus.com/count.js"></script>');
1091
- j1.loadJS({
1092
- xhr_data_path: '/assets/data/' + comment_provider + '.js',
1093
- xhr_data_element: comment_provider
1094
- });
1095
- }
1096
- if (comment_provider === 'hyvor') {
1097
- $('body').append('<script> var HYVOR_TALK_WEBSITE = ' + site_id + '; var HYVOR_TALK_CONFIG = { url: false, id: false };');
1098
- $('#main-content').append('<div id="hyvor-talk-view"></div>');
1099
- $('body').append('<script async id="hyvor-embed" type="text/javascript" src="//talk.hyvor.com/web-api/embed.js"></script>');
1100
- }
1101
- }
1102
- }
1103
-
1104
- // display page
1008
+ // display the page loaded
1105
1009
  $('#no_flicker').css('display', 'block');
1106
1010
 
1107
1011
  // jadams, 2021-11-19: test code for 'tapTarget' of 'materializeCss'
@@ -1128,7 +1032,8 @@ var j1 = (function () {
1128
1032
  $(this).parents(".card-header").toggleClass("highlight");
1129
1033
  });
1130
1034
 
1131
- // no dropcaps if translation enabled
1035
+ // manage Dropcaps if translation is enabled|disabled
1036
+ // -------------------------------------------------------------------
1132
1037
  if (user_translate.translationEnabled) {
1133
1038
  logger.info('\n' + 'translation enabled: ' + user_translate.translationEnabled);
1134
1039
  logger.debug('\n' + 'skipped processing of dropcaps');
@@ -1138,31 +1043,6 @@ var j1 = (function () {
1138
1043
  j1.core.createDropCap();
1139
1044
  }
1140
1045
 
1141
- // add recommended title to hyvor iframe for SEO optimization (if loadad)
1142
- if (comment_provider === 'hyvor') {
1143
- var dependencies_met_load_finished = setInterval (function () {
1144
- if ($('#hyvor-talk-view').children().length) {
1145
- $('#hyvor-talk-iframe').prop('title', 'Hyvor talk iframe');
1146
- clearInterval(dependencies_met_load_finished);
1147
- }
1148
- }, 25);
1149
- }
1150
-
1151
- // NOTE: Placed tracking warning/info here because page may reloaded
1152
- // after cookie consent selection
1153
- if (user_consent.analysis) {
1154
- logger.info('\n' + 'tracking allowed, privacy settings for analysis: ' + user_consent.analysis);
1155
- if (tracking_enabled && !tracking_id_valid) {
1156
- logger.error('\n' + 'tracking enabled, but invalid tracking id found: ' + tracking_id);
1157
- } else if (tracking_enabled && tracking_id_valid) {
1158
- logger.info('\n' + 'tracking enabled, tracking id found: ' + tracking_id);
1159
- } else {
1160
- logger.info('\n' + 'tracking disabled, tracking id found: ' + tracking_id);
1161
- }
1162
- } else {
1163
- logger.debug('\n' + 'tracking not allowed, privacy settings for analysis: ' + user_consent.analysis);
1164
- }
1165
-
1166
1046
  logger.info('\n' + 'mode detected: web');
1167
1047
  logger.info('\n' + 'hide signin icon');
1168
1048
  $('#quickLinksSignInOutButton').css('display', 'none');
@@ -1176,9 +1056,12 @@ var j1 = (function () {
1176
1056
  expires: 0
1177
1057
  });
1178
1058
 
1059
+ // TODO: should MOVED to ControlCenter Adapter ???
1060
+ // -----------------------------------------------------------------
1179
1061
  // show cc icon (currently NOT supported)
1180
1062
  // $('#quickLinksControlCenterButton').css('display', 'block');
1181
1063
 
1064
+ // TODO: should MOVED to Cookiebar ???
1182
1065
  // show|hide cookie icon
1183
1066
  if (j1.existsCookie(cookie_names.user_consent)) {
1184
1067
  // Display cookie icon
@@ -1192,6 +1075,7 @@ var j1 = (function () {
1192
1075
  $('#quickLinksCookieButton').css('display', 'none');
1193
1076
  }
1194
1077
 
1078
+ // TODO: should MOVED to Themer ???
1195
1079
  // jadams, 2021-07-25: hide|show themes menu on cookie consent
1196
1080
  // (analysis|personalization) settings. BootSwatch is a 3rd party
1197
1081
  // is using e.g GA. Because NO control is possible on 3rd parties,
@@ -1205,10 +1089,7 @@ var j1 = (function () {
1205
1089
  $("#themes_menu").show();
1206
1090
  }
1207
1091
 
1208
- // If the page requested contains an anchor element,
1209
- // do a smooth scroll
1210
- j1.scrollTo();
1211
-
1092
+ // detect if a loaded page has been chenged
1212
1093
  if (user_session.previous_page !== user_session.current_page) {
1213
1094
  logText = '\n' + 'page change detected';
1214
1095
  logger.info(logText);
@@ -1226,10 +1107,21 @@ var j1 = (function () {
1226
1107
 
1227
1108
  // set|log status
1228
1109
  state = 'finished';
1110
+ j1.setState(state);
1229
1111
  logText = '\n' + 'state: ' + state;
1230
1112
  logger.info(logText);
1231
1113
  logText = '\n' + 'page finalized successfully';
1232
1114
  logger.info(logText);
1115
+
1116
+ // do a (smooth) scroll if all nav elements ready
1117
+ // -------------------------------------------------------------------
1118
+ var dependencies_met_navigator_finished = setInterval(function() {
1119
+ if (j1.adapter.navigator.getState() == 'finished') {
1120
+ // if a page requested contains an anchor element, do a smooth scroll
1121
+ j1.scrollTo();
1122
+ clearInterval(dependencies_met_navigator_finished);
1123
+ }
1124
+ }, 25);
1233
1125
  }, flickerTimeout);
1234
1126
  }
1235
1127
  },
@@ -1322,9 +1214,9 @@ var j1 = (function () {
1322
1214
  var anchor = window.location.href.split('#')[1];
1323
1215
  var anchor_id = typeof anchor !== 'undefined' ? '#' + anchor : false;
1324
1216
  var scrollDuration = {{toccer_options.scrollSmoothDuration}};
1217
+ var scrollOffset = j1.getScrollOffset();
1325
1218
  var isSlider = false;
1326
1219
  var selector;
1327
- var scrollOffset;
1328
1220
 
1329
1221
  if (typeof anchor === 'undefined') {
1330
1222
  return false;
@@ -1332,15 +1224,13 @@ var j1 = (function () {
1332
1224
  return false;
1333
1225
  }
1334
1226
 
1335
- scrollOffset = j1.getScrollOffset();
1336
-
1337
1227
  // Check if the anchor is an slider/gallery element
1338
1228
  if (typeof anchor !== 'undefined') {
1339
- isSlider = anchor.includes('slide');
1229
+ isSlider = anchor.includes('slide');
1340
1230
  }
1341
1231
 
1342
1232
  if (anchor_id && anchor_id !== '#' && !isSlider) {
1343
- // scroll only, if an anchor is given with URL
1233
+ // scroll only, if an anchor is given with an URL
1344
1234
  selector = $(anchor_id);
1345
1235
  if (selector.length) {
1346
1236
  j1.core.scrollSmooth.scroll(anchor_id, {
@@ -1616,30 +1506,33 @@ var j1 = (function () {
1616
1506
  // -------------------------------------------------------------------------
1617
1507
  writeCookie: function (options /*name, data, [path, expires, domain, samesite, http_only, secure]*/) {
1618
1508
  var date = new Date();
1619
- var timestamp_now = date.toISOString()
1509
+ var timestamp_now = date.toISOString();
1620
1510
  var url = new liteURL(window.location.href);
1621
1511
  var baseUrl = url.origin;;
1622
1512
  var hostname = url.hostname;
1623
- var domain = hostname.substring(hostname.lastIndexOf('.', hostname.lastIndexOf('.') - 1) + 1);
1513
+ var auto_domain = hostname.substring(hostname.lastIndexOf('.', hostname.lastIndexOf('.') - 1) + 1);
1514
+ var auto_secure = (url.protocol.includes('https')) ? true : false;
1624
1515
  var stringifiedAttributes = '';
1625
1516
  var cookie_data = {};
1626
1517
  var data_json;
1627
1518
  var data_encoded;
1628
- var expires;
1629
- var domainAttribute;
1630
1519
 
1631
1520
  var defaults = {
1632
- data: {},
1633
- name: '',
1634
- path: '{{cookie_options.path}}',
1635
- expires: '{{cookie_options.expires}}',
1636
- domain: '{{cookie_options.domain}}',
1637
- samesite: '{{cookie_options.same_site}}',
1638
- http_only: '{{cookie_options.http_only}}',
1639
- secure: '{{cookie_options.secure}}'
1521
+ path: '{{cookie_options.path}}',
1522
+ expires: '{{cookie_options.expires}}',
1523
+ domain: ('{{cookie_options.domain}}' === 'false') ? false : '{{cookie_options.domain}}',
1524
+ samesite: '{{cookie_options.same_site}}',
1525
+ http_only: ('{{cookie_options.http_only}}' === 'true'),
1526
+ secure: ('{{cookie_options.secure}}' === 'false') ? false : '{{cookie_options.secure}}'
1640
1527
  };
1641
1528
  var settings = $.extend(defaults, options);
1642
1529
 
1530
+ // Failsafe: if 'None' is given for samesite in non-secure environments
1531
+ // -----------------------------------------------------------------------
1532
+ if (settings.samesite == 'None' && !settings.secure) {
1533
+ settings.samesite = 'Lax';
1534
+ }
1535
+
1643
1536
  cookie_data.timestamp = timestamp_now;
1644
1537
 
1645
1538
  if (j1.existsCookie(settings.name)) {
@@ -1653,6 +1546,8 @@ var j1 = (function () {
1653
1546
  data_encoded = window.btoa(data_json);
1654
1547
  }
1655
1548
 
1549
+ // collect the cookie attributes
1550
+ // -----------------------------------------------------------------------
1656
1551
  stringifiedAttributes += '; ' + 'Path=' + settings.path;
1657
1552
 
1658
1553
  if (settings.expires > 0) {
@@ -1663,20 +1558,25 @@ var j1 = (function () {
1663
1558
  stringifiedAttributes += '; ' + 'SameSite=' + settings.samesite;
1664
1559
 
1665
1560
  // set domain used by cookies
1666
- if (settings.domain == 'auto') {
1667
- domainAttribute = domain;
1668
- stringifiedAttributes += '; ' + 'Domain=' + domainAttribute;
1669
- } else {
1670
- domainAttribute = '';
1671
- stringifiedAttributes += '; ' + 'Domain=' + domainAttribute;
1561
+ if (settings.domain) {
1562
+ if (settings.domain == 'auto') {
1563
+ stringifiedAttributes += '; ' + 'Domain=' + auto_domain;
1564
+ } else {
1565
+ stringifiedAttributes += '; ' + 'Domain=' + settings.domain;
1566
+ }
1672
1567
  }
1673
1568
 
1674
- if (settings.secure == 'true') {
1675
- stringifiedAttributes += '; ' + 'Secure=' + settings.secure;
1569
+ // set secure attribute
1570
+ if (settings.secure) {
1571
+ if (settings.secure == 'auto') {
1572
+ stringifiedAttributes += '; ' + 'Secure=' + auto_secure;
1573
+ } else {
1574
+ stringifiedAttributes += '; ' + 'Secure=' + settings.secure;
1575
+ }
1676
1576
  }
1677
1577
 
1678
1578
  // write the cookie
1679
- // document.cookie = settings.name + '=' + content + '; path=' + settings.path + '; domain=' + settings.domain + '; ' + 'SameSite=' + settings.samesite + '; secure';
1579
+ // -----------------------------------------------------------------------
1680
1580
  document.cookie = settings.name + '=' + data_encoded + stringifiedAttributes;
1681
1581
 
1682
1582
  if (j1.existsCookie(settings.name)) {
@@ -1684,14 +1584,13 @@ var j1 = (function () {
1684
1584
  } else {
1685
1585
  return false;
1686
1586
  }
1687
-
1688
1587
  },
1689
1588
 
1690
1589
  // -------------------------------------------------------------------------
1691
1590
  // findCookie (Vanilla JS)
1692
- // Search for cookies (names) in the page header that matches a given
1693
- // name. Cookie name can be give as full name, like 'j1.user.state', or
1694
- // as a partial like 'j1'
1591
+ // Search for cookies (by name) in the page header that matches a given
1592
+ // (name) string. A cookie name can be given as full name, like 'j1.user.state',
1593
+ // or as a partial like 'j1'
1695
1594
  // Returns all names found as an array.
1696
1595
  // -------------------------------------------------------------------------
1697
1596
  // See: https://stackoverflow.com/questions/52287989/javascript-cookie-remove-or-delete-with-regex-regular-expression
@@ -1707,29 +1606,51 @@ var j1 = (function () {
1707
1606
  // removeCookie (Vanilla JS)
1708
1607
  // -------------------------------------------------------------------------
1709
1608
  removeCookie: function (options /*name, [path, domain]*/) {
1609
+ var url = new liteURL(window.location.href);
1610
+ var baseUrl = url.origin;;
1611
+ var hostname = url.hostname;
1612
+ var auto_domain = hostname.substring(hostname.lastIndexOf('.', hostname.lastIndexOf('.') - 1) + 1);
1613
+ var auto_secure = (url.protocol.includes('https')) ? true : false;
1614
+ var stringifiedAttributes = '';
1615
+
1710
1616
  var defaults = {
1711
1617
  path: '{{cookie_options.path}}',
1712
- expires: '{{cookie_options.expires}}',
1713
- domain: '{{cookie_options.domain}}',
1618
+ expires: 'Thu, 01 Jan 1970 00:00:00 UTC', // clear cookies by settting the expiry date in the PAST
1619
+ domain: ('{{cookie_options.domain}}' === 'false') ? false : '{{cookie_options.domain}}',
1714
1620
  samesite: '{{cookie_options.same_site}}',
1715
- http_only: '{{cookie_options.http_only}}',
1716
- secure: '{{cookie_options.secure}}'
1621
+ http_only: ('{{cookie_options.http_only}}' === 'true'),
1622
+ secure: ('{{cookie_options.secure}}' === 'false') ? false : '{{cookie_options.secure}}'
1717
1623
  };
1718
- var cookieExists;
1624
+ var settings = $.extend(defaults, options);
1719
1625
 
1720
- var settings = $.extend(defaults, options);
1626
+ // collect the cookie attributes
1627
+ // -----------------------------------------------------------------------
1628
+ stringifiedAttributes += '; ' + 'Path=' + settings.path;
1629
+ stringifiedAttributes += '; ' + 'SameSite=' + settings.samesite;
1630
+ stringifiedAttributes += '; ' + 'Expires=' + settings.expires;
1721
1631
 
1722
1632
  // set domain used by cookies
1723
- if (settings.domain == 'auto') {
1724
- domainAttribute = domain ;
1725
- } else {
1726
- // domainAttribute = hostname;
1727
- domainAttribute = '';
1633
+ if (settings.domain) {
1634
+ if (settings.domain == 'auto') {
1635
+ stringifiedAttributes += '; ' + 'Domain=' + auto_domain;
1636
+ } else if (typeof settings.domain == 'string') {
1637
+ stringifiedAttributes += '; ' + 'Domain=' + settings.domain;
1638
+ }
1639
+ }
1640
+
1641
+ // set secure attribute
1642
+ if (settings.secure) {
1643
+ if (settings.secure == 'auto') {
1644
+ stringifiedAttributes += '; ' + 'Secure=' + auto_secure;
1645
+ } else {
1646
+ stringifiedAttributes += '; ' + 'Secure=' + settings.secure;
1647
+ }
1728
1648
  }
1729
1649
 
1650
+ // clear|remove the cookie if exists
1651
+ // -----------------------------------------------------------------------
1730
1652
  if (j1.findCookie(settings.name)) {
1731
- // clear cookie CONTENT and set expiry date in the PAST
1732
- document.cookie = settings.name + '=; Domain=' + domainAttribute + '; Expires=Thu, 01 Jan 1970 00:00:00 UTC; Path=/;';
1653
+ document.cookie = settings.name + '=;' + stringifiedAttributes;
1733
1654
  return true;
1734
1655
  } else {
1735
1656
  return false;
@@ -1744,49 +1665,71 @@ var j1 = (function () {
1744
1665
  // automatically by the browser if the last session (browser tab|window)
1745
1666
  // is closed.
1746
1667
  // -------------------------------------------------------------------------
1747
- // expireCookie() returns 'true' if cookie is set successfully,
1748
- // otherwise 'false' (e.g NOT found)
1668
+ // expireCookie() returns 'true' if cookie is set successfully
1669
+ // (to session), otherwise 'false' (e.g. NOT found)
1749
1670
  // -------------------------------------------------------------------------
1750
1671
  // NOTE:
1751
1672
  // See: https://stackoverflow.com/questions/179355/clearing-all-cookies-with-javascript
1673
+ //
1752
1674
  // NOTE:
1753
1675
  // There is NO way you could get a trace of Path, Domain and other
1754
1676
  // attributes of cookies as they are only read by browsers and NOT shown
1755
- // to JavaScript. For that reason, attributes needs to be set explicitly.
1677
+ // to JavaScript. For that reason, attributes needs to be set explicitly
1678
+ // to already KNOWN values.
1679
+ //
1756
1680
  // -------------------------------------------------------------------------
1757
1681
  expireCookie: function (options /*name [,path, samesite, secure]*/) {
1758
- var url = new liteURL(window.location.href);
1759
- var baseUrl = url.origin;;
1760
- var hostname = url.hostname;
1761
- var domain = hostname.substring(hostname.lastIndexOf('.', hostname.lastIndexOf('.') - 1) + 1);
1762
- var domainAttribute;
1682
+ var url = new liteURL(window.location.href);
1683
+ var baseUrl = url.origin;;
1684
+ var hostname = url.hostname;
1685
+ var auto_domain = hostname.substring(hostname.lastIndexOf('.', hostname.lastIndexOf('.') - 1) + 1);
1686
+ var auto_secure = (url.protocol.includes('https')) ? true : false;
1687
+ var stringifiedAttributes = '';
1763
1688
 
1764
1689
  var defaults = {
1765
1690
  path: '{{cookie_options.path}}',
1766
1691
  expires: '{{cookie_options.expires}}',
1767
- domain: '{{cookie_options.domain}}',
1692
+ domain: ('{{cookie_options.domain}}' === 'false') ? false : '{{cookie_options.domain}}',
1768
1693
  samesite: '{{cookie_options.same_site}}',
1769
- http_only: '{{cookie_options.http_only}}',
1770
- secure: '{{cookie_options.secure}}'
1694
+ http_only: ('{{cookie_options.http_only}}' === 'true'),
1695
+ secure: ('{{cookie_options.secure}}' === 'false') ? false : '{{cookie_options.secure}}'
1771
1696
  };
1772
1697
  var settings = $.extend(defaults, options);
1773
1698
 
1699
+ // collect the cookie attributes
1700
+ // -----------------------------------------------------------------------
1701
+ stringifiedAttributes += '; ' + 'Path=' + settings.path;
1702
+ stringifiedAttributes += '; ' + 'SameSite=' + settings.samesite;
1703
+
1774
1704
  // set domain used by cookies
1775
- if (settings.domain == 'auto') {
1776
- domainAttribute = domain ;
1777
- } else {
1778
- // domainAttribute = hostname;
1779
- domainAttribute = '';
1705
+ if (settings.domain) {
1706
+ if (settings.domain == 'auto') {
1707
+ stringifiedAttributes += '; ' + 'Domain=' + auto_domain;
1708
+ } else if (typeof settings.domain == 'string') {
1709
+ if (settings.domain !== 'false') {
1710
+ stringifiedAttributes += '; ' + 'Domain=' + settings.domain;
1711
+ }
1712
+ }
1713
+ }
1714
+
1715
+ // set secure attribute
1716
+ if (settings.secure) {
1717
+ if (settings.secure == 'auto') {
1718
+ stringifiedAttributes += '; ' + 'Secure=' + auto_secure;
1719
+ } else {
1720
+ stringifiedAttributes += '; ' + 'Secure=' + settings.secure;
1721
+ }
1780
1722
  }
1781
1723
 
1782
- var dc = document.cookie; // all cookies in page
1783
- var end = dc.length; // default to end of the string
1784
- var prefix = settings.name + '='; // search string for the cookie name given
1724
+ var dc = document.cookie; // all cookies in page
1725
+ var end = dc.length; // default to end of the string
1726
+ var prefix = settings.name + '='; // search string for the cookie name given
1785
1727
  var begin = dc.indexOf('; ' + prefix);
1786
1728
  var content = '';
1787
1729
 
1788
1730
  // collect the cookie content
1789
- //
1731
+ // -----------------------------------------------------------------------
1732
+
1790
1733
  // found, and not in the first position
1791
1734
  if (begin !== -1) {
1792
1735
  // exclude the "; "
@@ -1804,20 +1747,17 @@ var j1 = (function () {
1804
1747
  end = dc.indexOf(';', begin);
1805
1748
  }
1806
1749
 
1807
- // expire cookie to session
1750
+ // write the cookie content, expire to session
1751
+ // -----------------------------------------------------------------------
1808
1752
  content = decodeURI(dc.substring(begin + prefix.length, end) ).replace(/"/g, '');
1809
- if (settings.secure == 'true') {
1810
- document.cookie = settings.name + '=' + content +'; Path=' + settings.path + '; ' + 'SameSite=' + settings.samesite + '; ' + 'Domain=' + domainAttribute + '; Secure' + '; ';
1811
- } else {
1812
- document.cookie = settings.name + '=' + content +'; Path=' + settings.path + '; ' + 'SameSite=' + settings.samesite + '; ' + 'Domain=' + domainAttribute + '; ';
1813
- }
1753
+ document.cookie = settings.name + '=' + content + stringifiedAttributes;
1814
1754
 
1815
1755
  return true;
1816
1756
  },
1817
1757
 
1818
1758
  // -------------------------------------------------------------------------
1819
1759
  // existsCookie (Vanilla JS)
1820
- // returns true if a given cookie exists
1760
+ // returns true if a cookie of given name exists
1821
1761
  // -------------------------------------------------------------------------
1822
1762
  existsCookie: function (name) {
1823
1763
  var dc = document.cookie;
@@ -1827,6 +1767,9 @@ var j1 = (function () {
1827
1767
  var cookieExists = false;
1828
1768
  var cookieContent = '';
1829
1769
 
1770
+ // collect the cookie content
1771
+ // -----------------------------------------------------------------------
1772
+
1830
1773
  // found, and not in first position
1831
1774
  if (begin !== -1) {
1832
1775
  // exclude the "; "
@@ -1844,6 +1787,8 @@ var j1 = (function () {
1844
1787
  end = dc.indexOf(';', begin);
1845
1788
  }
1846
1789
 
1790
+ // check if the cookie exists
1791
+ // -----------------------------------------------------------------------
1847
1792
  cookieContent = decodeURI(dc.substring(begin + prefix.length, end) ).replace(/"/g, '');
1848
1793
  cookieExists = cookieContent.length ? true : false;
1849
1794