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
@@ -0,0 +1,442 @@
1
+ ---
2
+ regenerate: true
3
+ ---
4
+
5
+ {% capture cache %}
6
+
7
+ {% comment %}
8
+ # -----------------------------------------------------------------------------
9
+ # ~/assets/themes/j1/adapter/js/advertising.js
10
+ # Liquid template to adapt advertising plugin
11
+ #
12
+ # Product/Info:
13
+ # https://jekyll.one
14
+ # Copyright (C) 2021 Juergen Adams
15
+ #
16
+ # J1 Template is licensed under the MIT License.
17
+ # For details, see https://jekyll.one
18
+ # -----------------------------------------------------------------------------
19
+ # Test data:
20
+ # {{ liquid_var | debug }}
21
+ # advertising_options: {{ advertising_options | debug }}
22
+ # -----------------------------------------------------------------------------
23
+ {% endcomment %}
24
+
25
+ {% comment %} Liquid procedures
26
+ -------------------------------------------------------------------------------- {% endcomment %}
27
+
28
+ {% comment %} Set global settings
29
+ -------------------------------------------------------------------------------- {% endcomment %}
30
+ {% assign environment = site.environment %}
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
+ {% assign blocks = site.data.blocks %}
40
+ {% assign modules = site.data.modules %}
41
+
42
+ {% comment %} Set config data (settings only)
43
+ -------------------------------------------------------------------------------- {% endcomment %}
44
+ {% assign cookie_defaults = modules.defaults.cookies.defaults %}
45
+ {% assign cookie_settings = modules.cookies.settings %}
46
+ {% assign advertising_defaults = modules.defaults.advertising.defaults %}
47
+ {% assign advertising_settings = modules.advertising.settings %}
48
+
49
+ {% comment %} Set config options (settings only)
50
+ -------------------------------------------------------------------------------- {% endcomment %}
51
+ {% assign cookie_options = cookie_defaults | merge: cookie_settings %}
52
+ {% assign advertising_options = advertising_defaults | merge: advertising_settings %}
53
+
54
+ {% comment %} Variables
55
+ -------------------------------------------------------------------------------- {% endcomment %}
56
+ {% assign advertising = advertising_options.enabled %}
57
+ {% assign advertising_provider = advertising_options.provider %}
58
+
59
+ {% assign production = false %}
60
+ {% if environment == 'prod' or environment == 'production' %}
61
+ {% assign production = true %}
62
+ {% endif %}
63
+
64
+ /*
65
+ # -----------------------------------------------------------------------------
66
+ # ~/assets/themes/j1/adapter/js/advertising.js
67
+ # J1 Adapter for advertising
68
+ #
69
+ # Product/Info:
70
+ # https://jekyll.one
71
+ #
72
+ # Copyright (C) 2021 Juergen Adams
73
+ #
74
+ # J1 Template is licensed under the MIT License.
75
+ # For details, see https://jekyll.one
76
+ # -----------------------------------------------------------------------------
77
+ # Adapter generated: {{site.time}}
78
+ # -----------------------------------------------------------------------------
79
+ */
80
+
81
+ // -----------------------------------------------------------------------------
82
+ // ESLint shimming
83
+ // -----------------------------------------------------------------------------
84
+ /* eslint indent: "off" */
85
+ // -----------------------------------------------------------------------------
86
+ 'use strict';
87
+ j1.adapter.advertising = (function (j1, window) {
88
+
89
+ {% comment %} Set global variables
90
+ -------------------------------------------------------------------------------- {% endcomment %}
91
+ var environment = '{{environment}}';
92
+ var date = new Date();
93
+ var timestamp_now = date.toISOString();
94
+ var gadScript = document.createElement('script');
95
+ var adInitializerScript = document.createElement('script');
96
+ var autoHideOnUnfilled = {{advertising_options.google.autoHideOnUnfilled}};
97
+ var addBorderOnUnfilled = {{advertising_options.google.addBorderOnUnfilled}};
98
+ var checkTrackingProtection = {{advertising_options.google.checkTrackingProtection}};
99
+ var showErrorPageOnBlocked = {{advertising_options.google.showErrorPageOnBlocked}};
100
+ var adInitializerScriptText;
101
+ var tracking_protection;
102
+ var url;
103
+ var baseUrl;
104
+ var hostname;
105
+ var cookie_names;
106
+ var user_consent;
107
+ var advertisingProvider;
108
+ var providerID;
109
+ var validProviderID;
110
+ var _this;
111
+ var logger;
112
+ var logText;
113
+
114
+ // var domain;
115
+ // var domainAttribute;
116
+ // var cookie_option_domain;
117
+ // var cookie_domain;
118
+
119
+ // ---------------------------------------------------------------------------
120
+ // Main object
121
+ // ---------------------------------------------------------------------------
122
+ return {
123
+
124
+ // -------------------------------------------------------------------------
125
+ // init()
126
+ // adapter initializer
127
+ // -------------------------------------------------------------------------
128
+ init: function (options) {
129
+
130
+ {% if advertising %}
131
+ // [INFO ] [j1.adapter.advertising ] [ detected advertising provider (j1_config): {{advertising_provider}}} ]
132
+ // [INFO ] [j1.adapter.advertising ] [ start processing load region head, layout: {{page.layout}} ]
133
+
134
+ // -----------------------------------------------------------------------
135
+ // Default module settings
136
+ // -----------------------------------------------------------------------
137
+ var settings = $.extend({
138
+ module_name: 'j1.adapter.advertising',
139
+ generated: '{{site.time}}'
140
+ }, options);
141
+
142
+ // -----------------------------------------------------------------------
143
+ // Global variable settings
144
+ // -----------------------------------------------------------------------
145
+ cookie_names = j1.getCookieNames();
146
+ user_consent = j1.readCookie(cookie_names.user_consent);
147
+ url = new liteURL(window.location.href);
148
+ hostname = url.hostname;
149
+
150
+ // domain = hostname.substring(hostname.lastIndexOf('.', hostname.lastIndexOf('.') - 1) + 1);
151
+ // cookie_option_domain = '{{cookie_options.domain}}';
152
+
153
+ // // set domain used by cookies
154
+ // if (cookie_option_domain == 'auto') {
155
+ // domainAttribute = domain ;
156
+ // } else {
157
+ // domainAttribute = hostname;
158
+ // }
159
+
160
+ {% case advertising_provider %}
161
+ {% when "google" %}
162
+ // [INFO ] [j1.adapter.advertising ] [ place provider: Google Adsense ]
163
+
164
+ _this = j1.adapter.advertising;
165
+ logger = log4javascript.getLogger('j1.adapter.advertising.google');
166
+
167
+ // initialize state flag
168
+ _this.setState('started');
169
+ logger.info('\n' + 'state: ' + _this.getState());
170
+ logger.info('\n' + 'module is being initialized');
171
+
172
+ var dependencies_met_page_ready = setInterval(function() {
173
+ if (j1.getState() == 'finished') {
174
+
175
+ providerID = '{{advertising_options.google.publisherID}}';
176
+ advertisingProvider = 'Google Adsense';
177
+ validProviderID = (providerID.includes('your')) ? false : true;
178
+ if (!validProviderID) {
179
+ logger.warn('\n' + 'invalid publisherID detected for Google Adsense: ' + providerID);
180
+ logger.info('\n' + 'skip initialization for provider: ' + advertisingProvider);
181
+ clearInterval(dependencies_met_page_ready);
182
+ return false;
183
+ }
184
+
185
+ if (user_consent.personalization) {
186
+ // place all ads configured for the page
187
+ // NOTE: currently NOT implemented/used
188
+ // -----------------------------------------------------------------
189
+ // _this.place_ads();
190
+
191
+ // add gad api dynamically in the head section
192
+ // -----------------------------------------------------------------
193
+ logger.info('\n' + 'add gad api dynamically in section: head');
194
+ gadScript.async = true;
195
+ gadScript.id = 'gad-api';
196
+ gadScript.src = '//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js';
197
+ gadScript.setAttribute('data-ad-client', 'ca-pub-3885670015316130');
198
+ document.head.appendChild(gadScript);
199
+
200
+ // setup monitor for state changes on all ads configured
201
+ // ---------------------------------------------------------------
202
+ logger.info('\n' + 'setup monitoring');
203
+ _this.monitor_ads();
204
+
205
+ // run protection check
206
+ // -------------------------------------------------------------------
207
+ if (checkTrackingProtection) {
208
+ logger.info('\n' + 'run checks for tracking protection');
209
+ _this.check_tracking_protection();
210
+
211
+ var dependencies_met_tracking_check_ready = setInterval (function (options) {
212
+ if (typeof tracking_protection !== 'undefined' ) {
213
+
214
+ var browser_tracking_feature = navigator.DoNotTrack;
215
+
216
+ if (!tracking_protection && !browser_tracking_feature) {
217
+ logText = '\n' + 'tracking protection: disabled';
218
+ logger.info(logText);
219
+ } else {
220
+ logText = '\n' + 'tracking protection: enabled';
221
+ logger.warn(logText);
222
+
223
+ if (showErrorPageOnBlocked) {
224
+ logger.error('\n' + 'redirect to error page (blocked content): HTML-447');
225
+ // redirect to error page: blocked content
226
+ window.location.href = '/447.html';
227
+ }
228
+ }
229
+ }
230
+ clearInterval(dependencies_met_tracking_check_ready);
231
+ }, 25);
232
+ } else {
233
+ // setup monitor for state changes on all ads configured
234
+ // ---------------------------------------------------------------
235
+ logger.info('\n' + 'setup monitoring');
236
+ _this.monitor_ads();
237
+
238
+ _this.setState('finished');
239
+ logger.info('\n' + 'state: ' + _this.getState());
240
+ logger.info('\n' + 'module initialized successfully');
241
+ clearInterval(dependencies_met_tracking_check_ready);
242
+ }
243
+ clearInterval(dependencies_met_page_ready);
244
+ } else {
245
+ // manage GAD cookies if no consent is given|rejected
246
+ // -----------------------------------------------------------------
247
+ var gasCookies = j1.findCookie('__ga');
248
+ logger.warn('\n' + 'consent on cookies disabled for personalization');
249
+ logger.warn('\n' + 'initialization of module advertising skipped');
250
+
251
+ // remove cookies on invalid GAS config or left from a previous
252
+ // session/page view if they exists
253
+ // ---------------------------------------------------------------------
254
+ gasCookies.forEach(function (item) {
255
+ // Remove cookies from Google Ads
256
+ if (hostname == 'localhost') {
257
+ j1.removeCookie({ name: item, domain: false, secure: false });
258
+ } else {
259
+ j1.removeCookie({ name: item, domain: '.' + hostname, secure: false });
260
+ }
261
+ });
262
+
263
+ // manage tracking protection
264
+ // -----------------------------------------------------------------
265
+ if (checkTrackingProtection) {
266
+ if (!user_consent.personalization) {
267
+ logText = '\n' + 'consent on cookies disabled for personalization';
268
+ logger.warn(logText);
269
+
270
+ if (showErrorPageOnBlocked) {
271
+ logger.error('\n' + 'redirect to error page (blocked content): HTML-447');
272
+ // redirect to error page: blocked content
273
+ window.location.href = '/448.html';
274
+ }
275
+ }
276
+ }
277
+ clearInterval(dependencies_met_page_ready);
278
+ } // END if user_consent.personalization
279
+ } // END if getState 'finished'
280
+ }, 25);
281
+
282
+ {% when "custom" %}
283
+ // [INFO ] [j1.adapter.advertising ] [ place provider: Custom Provider ]
284
+ {% endcase %}
285
+ // [INFO ] [j1.adapter.advertising ] [ end processing ]
286
+ {% else %}
287
+ var dependencies_met_page_ready = setInterval(function() {
288
+ if (j1.getState() == 'finished') {
289
+ var ads_found = document.getElementsByClassName('adsbygoogle').length;
290
+ logger = log4javascript.getLogger('j1.adapter.advertising.google');
291
+ logger.warn('\n' + 'found ads in page: #' + ads_found);
292
+ logger.warn('\n' + 'no ads initialized, advertising disabled');
293
+ clearInterval(dependencies_met_page_ready);
294
+ }
295
+ }, 25);
296
+ {% endif %}
297
+ return;
298
+ }, // END init
299
+
300
+ // -------------------------------------------------------------------------
301
+ // monitor_ads()
302
+ // monitor for state changes on the ad placed in pages (if any)
303
+ // -------------------------------------------------------------------------
304
+ monitor_ads: function () {
305
+
306
+ $('.adsbygoogle').attrchange({
307
+ trackValues: true,
308
+ callback: function (event) {
309
+ if (event.newValue === 'unfilled') {
310
+ var elm = event.target.dataset;
311
+ if (addBorderOnUnfilled) { $('.adsbygoogle').addClass('border--dotted'); }
312
+ if (elm.adClient) {
313
+ logger.warn('\n' + 'found ad state ' + event.newValue + ' for slot: ' + elm.adSlot);
314
+ if (autoHideOnUnfilled) {
315
+ logger.warn('\n' + ' hide ad for slot: ' + elm.adSlot);
316
+ $('#' + elm.adSlot ).hide();
317
+ }
318
+ }
319
+ }
320
+ }
321
+ });
322
+ },
323
+
324
+ // -------------------------------------------------------------------------
325
+ // check_tracking_protection()
326
+ // detect if a user is using tracking protection
327
+ // NOTE:
328
+ // Firefox uses a list obtained from 'https://disconnect.me/trackerprotection'
329
+ // for its tracking protection. The checker use an image loaded from a
330
+ // domain that is on that list (facebook.com), and an image that will
331
+ // exist (tracking pixel).
332
+ //
333
+ // See for more details:
334
+ // https://stackoverflow.com/questions/33959324/how-to-detect-if-a-user-is-using-tracking-protection-in-firefox-42
335
+ // -------------------------------------------------------------------------
336
+ check_tracking_protection: function () {
337
+ var logger = log4javascript.getLogger('j1.adapter.advertising.tracking.monitor');
338
+
339
+ logText = '\n' + 'check for trackingprotection';
340
+ logger.info(logText);
341
+
342
+ function checkTrackingProtection() {
343
+ if (!checkTrackingProtection.promise) {
344
+ checkTrackingProtection.promise = new Promise(function(resolve, reject) {
345
+
346
+ var time = Date.now();
347
+ var img = new Image();
348
+ img.onload = resolve;
349
+ img.onerror = function() {
350
+ if ((Date.now() - time) < 50) {
351
+ reject(new Error("Rejected."));
352
+ } else {
353
+ resolve(new Error("Takes too long."));
354
+ }
355
+ };
356
+ img.src = '//www.facebook.com/tr/';
357
+ }).then((result) => {
358
+ tracking_protection = false;
359
+ }).catch(e => {
360
+ tracking_protection = true;
361
+ logger.debug('\n' + 'detection details: ' + e);
362
+ });
363
+ }
364
+ }
365
+ checkTrackingProtection();
366
+ }, // END check_tracking_protection
367
+
368
+ // -------------------------------------------------------------------------
369
+ // place_ads()
370
+ // place ads configured|enabled
371
+ // -------------------------------------------------------------------------
372
+ place_ads: function () {
373
+
374
+ logText = '\n' + 'ads are being placed';
375
+ logger.info(logText);
376
+
377
+ // START loadig ads
378
+ var dependencies_met_page_ready = setInterval (function (options) {
379
+ if (j1.getState() === 'finished') {
380
+
381
+ {% comment %} See loop for loading elements with adapter/scroller.js
382
+ ---------------------------------------------------------------------- {% endcomment %}
383
+ clearInterval(dependencies_met_page_ready);
384
+
385
+ }
386
+ });
387
+ // END place ads
388
+ },
389
+
390
+ // -------------------------------------------------------------------------
391
+ // messageHandler()
392
+ // manage messages send from other J1 modules
393
+ // -------------------------------------------------------------------------
394
+ messageHandler: function (sender, message) {
395
+ var json_message = JSON.stringify(message, undefined, 2);
396
+
397
+ logText = '\n' + 'received message from ' + sender + ': ' + json_message;
398
+ logger.debug(logText);
399
+
400
+ // -----------------------------------------------------------------------
401
+ // Process commands|actions
402
+ // -----------------------------------------------------------------------
403
+ if (message.type === 'command' && message.action === 'module_initialized') {
404
+ //
405
+ // Place handling of command|action here
406
+ //
407
+ logger.info('\n' + message.text);
408
+ }
409
+
410
+ //
411
+ // Place handling of other command|action here
412
+ //
413
+
414
+ return true;
415
+ }, // END messageHandler
416
+
417
+ // -------------------------------------------------------------------------
418
+ // setState()
419
+ // Sets the current (processing) state of the module
420
+ // -------------------------------------------------------------------------
421
+ setState: function (stat) {
422
+ _this.state = stat;
423
+ }, // END setState
424
+
425
+ // -------------------------------------------------------------------------
426
+ // getState()
427
+ // Returns the current (processing) state of the module
428
+ // -------------------------------------------------------------------------
429
+ getState: function () {
430
+ return _this.state;
431
+ } // END getState
432
+
433
+ }; // END return
434
+ })(j1, window);
435
+
436
+ {% endcapture %}
437
+ {% if production %}
438
+ {{ cache | minifyJS }}
439
+ {% else %}
440
+ {{ cache | strip_empty_lines }}
441
+ {% endif %}
442
+ {% assign cache = nil %}
@@ -74,10 +74,7 @@ regenerate: false
74
74
  /* eslint indent: "off" */
75
75
  // -----------------------------------------------------------------------------
76
76
  'use strict';
77
-
78
- {% comment %} Main
79
- -------------------------------------------------------------------------------- {% endcomment %}
80
- j1.adapter['algolia'] = (function (j1, window) {
77
+ j1.adapter.algolia = (function (j1, window) {
81
78
 
82
79
  {% comment %} Set global variables
83
80
  ------------------------------------------------------------------------------ {% endcomment %}
@@ -101,15 +98,6 @@ j1.adapter['algolia'] = (function (j1, window) {
101
98
  // -------------------------------------------------------------------------
102
99
  init: function (options) {
103
100
 
104
- // -----------------------------------------------------------------------
105
- // globals
106
- // -----------------------------------------------------------------------
107
- _this = j1.adapter.algolia;
108
- logger = log4javascript.getLogger('j1.adapter.algolia');
109
-
110
- // initialize state flag
111
- _this.state = 'pending';
112
-
113
101
  // -----------------------------------------------------------------------
114
102
  // Default module settings
115
103
  // -----------------------------------------------------------------------
@@ -118,6 +106,15 @@ j1.adapter['algolia'] = (function (j1, window) {
118
106
  generated: '{{site.time}}'
119
107
  }, options);
120
108
 
109
+ // -----------------------------------------------------------------------
110
+ // Global variable settings
111
+ // -----------------------------------------------------------------------
112
+ _this = j1.adapter.algolia;
113
+ logger = log4javascript.getLogger('j1.adapter.algolia');
114
+
115
+ // initialize state flag
116
+ _this.state = 'pending';
117
+
121
118
  _this.setState('started');
122
119
  logger.info('\n' + 'state: ' + _this.getState());
123
120
  logger.info('\n' + 'module is being initialized');