j1-template 2021.2.6 → 2021.2.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/_includes/themes/j1/modules/connectors/translators/google-translator.html +2 -1
- data/assets/data/translator.html +2 -2
- data/assets/themes/j1/adapter/js/cookieConsent.js +4 -3
- data/assets/themes/j1/adapter/js/translator.1.js +525 -0
- data/assets/themes/j1/adapter/js/translator.js +71 -118
- data/assets/themes/j1/modules/cookieConsent/js/cookieConsent.js +70 -10
- data/assets/themes/j1/modules/translator/js/translator.js +10 -7
- data/assets/themes/j1/modules/translator/js/translator.min.js +1 -1
- data/lib/j1/version.rb +1 -1
- data/lib/starter_web/Gemfile +1 -1
- data/lib/starter_web/_config.yml +1 -1
- data/lib/starter_web/_data/modules/cookieconsent.yml +0 -1
- data/lib/starter_web/_data/modules/defaults/cookieconsent.yml +3 -1
- data/lib/starter_web/_data/modules/defaults/translator.yml +1 -1
- data/lib/starter_web/_includes/attributes.asciidoc +1 -1
- data/lib/starter_web/_plugins/lunr_index.rb +1 -1
- data/lib/starter_web/package.json +1 -1
- data/lib/starter_web/utilsrv/_defaults/package.json +1 -1
- data/lib/starter_web/utilsrv/package.json +1 -1
- metadata +3 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 91ee0616f0905e55586302ee465112ca879423feebacb51e93e04f92f4978189
         | 
| 4 | 
            +
              data.tar.gz: c64b4a5cfab5cef176f43568c76c5ec0c2550fb7cc8a37df5e8ac97f5cbb957f
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 40b74cefa0cf230f69156a18b42e6df4932187c6b3b05083efdf11f6d84126e0bcc1279c375692a3360f539b183ab7de2b32a89eb584aadf8e039813bde69aba
         | 
| 7 | 
            +
              data.tar.gz: 14207a1cd40024aaae0fe3c83a1aa0a72b36e2ba348315e3e2c06b0a8625b38be8405bbce5719c85bb1f00d8f6819e604803575f76a4dbbadb5c5010eca8b09a
         | 
| @@ -28,10 +28,11 @@ | |
| 28 28 | 
             
            <!-- [INFO   ] [j1.modules.connectors.translation     ] [ place callback for the Google Translator API ] -->
         | 
| 29 29 | 
             
            <script>
         | 
| 30 30 | 
             
              function googleTranslateElementInit() {
         | 
| 31 | 
            -
                new google.translate.TranslateElement({
         | 
| 31 | 
            +
                var gtAPI = new google.translate.TranslateElement({
         | 
| 32 32 | 
             
                  pageLanguage: 'en',
         | 
| 33 33 | 
             
                  layout: google.translate.TranslateElement.FloatPosition.TOP_LEFT
         | 
| 34 34 | 
             
                },
         | 
| 35 35 | 
             
                'google_translate_element');
         | 
| 36 | 
            +
                j1.adapter.translator.postTranslateElementInit(gtAPI);
         | 
| 36 37 | 
             
              }
         | 
| 37 38 | 
             
            </script>
         | 
    
        data/assets/data/translator.html
    CHANGED
    
    | @@ -151,7 +151,7 @@ exclude_from_search:                    true | |
| 151 151 |  | 
| 152 152 | 
             
                  <div class="modal-footer">
         | 
| 153 153 | 
             
                    <button id="translator-buttonDoNotAgree" type="button" class="btn btn-link text-decoration-none" style="min-width: 20rem">
         | 
| 154 | 
            -
                    No,  | 
| 154 | 
            +
                    No, disable translation
         | 
| 155 155 | 
             
                    </button>
         | 
| 156 156 | 
             
                    <button id="translator-buttonAgree" type="button" class="btn btn-primary btn-raised" style="min-width: 20rem">
         | 
| 157 157 | 
             
                    Yes, please translate
         | 
| @@ -266,7 +266,7 @@ exclude_from_search:                    true | |
| 266 266 |  | 
| 267 267 | 
             
                  <div class="modal-footer">
         | 
| 268 268 | 
             
                    <button id="translator-buttonDoNotAgree" type="button" class="btn btn-link text-decoration-none" style="min-width: 20rem">
         | 
| 269 | 
            -
                    Nein,  | 
| 269 | 
            +
                    Nein, Übersetzung abschalten
         | 
| 270 270 | 
             
                    </button>
         | 
| 271 271 | 
             
                    <button id="translator-buttonAgree" type="button" class="btn btn-primary btn-raised" style="min-width: 20rem">
         | 
| 272 272 | 
             
                    Ja, bitte übersetzen
         | 
| @@ -174,7 +174,7 @@ j1.adapter['cookieConsent'] = (function (j1, window) { | |
| 174 174 | 
             
                      logger.info('\n' + 'state: ' + _this.getState());
         | 
| 175 175 | 
             
                      logger.info('\n' + 'module is being initialized');
         | 
| 176 176 |  | 
| 177 | 
            -
                      j1.cookieConsent = new  | 
| 177 | 
            +
                      j1.cookieConsent = new CookieConsent ({
         | 
| 178 178 | 
             
                        contentURL:             moduleOptions.contentURL,                   // dialog content (modals) for all supported languages
         | 
| 179 179 | 
             
                        cookieName:             moduleOptions.cookieName,                   // name of the consent cookie
         | 
| 180 180 | 
             
                        cookieSameSite:         moduleOptions.cookieSameSite,               // restrict consent cookie
         | 
| @@ -183,7 +183,7 @@ j1.adapter['cookieConsent'] = (function (j1, window) { | |
| 183 183 | 
             
                        reloadPageOnChange:     moduleOptions.reloadPageOnChange,           // reload if setzings has changed
         | 
| 184 184 | 
             
                        dialogContainerID:      moduleOptions.dialogContainerID,            // container, the dialog modal is (dynamically) loaded
         | 
| 185 185 | 
             
                        xhrDataElement:         moduleOptions.xhrDataElement,               // container for all language-specific dialogs (modals)
         | 
| 186 | 
            -
                        postSelectionCallback:  function  | 
| 186 | 
            +
                        postSelectionCallback:  moduleOptions.postSelectionCallback,        // callback function, called after the user has made his selection        
         | 
| 187 187 | 
             
                      });
         | 
| 188 188 |  | 
| 189 189 | 
             
                      _this.setState('finished');
         | 
| @@ -303,7 +303,8 @@ j1.adapter['cookieConsent'] = (function (j1, window) { | |
| 303 303 | 
             
                        name:     cookie_names.user_translate,
         | 
| 304 304 | 
             
                        data:     user_translate,
         | 
| 305 305 | 
             
                        samesite: 'Strict',
         | 
| 306 | 
            -
                        secure:   secure
         | 
| 306 | 
            +
                        secure:   secure,
         | 
| 307 | 
            +
                        expires:  365
         | 
| 307 308 | 
             
                      });
         | 
| 308 309 |  | 
| 309 310 | 
             
                    }
         | 
| @@ -0,0 +1,525 @@ | |
| 1 | 
            +
            ---
         | 
| 2 | 
            +
            regenerate:                             true
         | 
| 3 | 
            +
            ---
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            {% capture cache %}
         | 
| 6 | 
            +
             | 
| 7 | 
            +
            {% comment %}
         | 
| 8 | 
            +
             # -----------------------------------------------------------------------------
         | 
| 9 | 
            +
             # ~/assets/themes/j1/adapter/js/translator.js
         | 
| 10 | 
            +
             # Liquid template to create the Template Adapter for J1 Translator
         | 
| 11 | 
            +
             #
         | 
| 12 | 
            +
             # Product/Info:
         | 
| 13 | 
            +
             # http://jekyll.one
         | 
| 14 | 
            +
             #
         | 
| 15 | 
            +
             # Copyright (C) 2021 Juergen Adams
         | 
| 16 | 
            +
             #
         | 
| 17 | 
            +
             # J1 Template is licensed under the MIT License.
         | 
| 18 | 
            +
             # For details, see https://jekyll.one
         | 
| 19 | 
            +
             # -----------------------------------------------------------------------------
         | 
| 20 | 
            +
             # Test data:
         | 
| 21 | 
            +
             #  {{ liquid_var | debug }}
         | 
| 22 | 
            +
             # -----------------------------------------------------------------------------
         | 
| 23 | 
            +
            {% endcomment %}
         | 
| 24 | 
            +
             | 
| 25 | 
            +
            {% comment %} Liquid var initialization
         | 
| 26 | 
            +
            -------------------------------------------------------------------------------- {% endcomment %}
         | 
| 27 | 
            +
             | 
| 28 | 
            +
            {% comment %} Set config files
         | 
| 29 | 
            +
            -------------------------------------------------------------------------------- {% endcomment %}
         | 
| 30 | 
            +
            {% assign environment         = site.environment %}
         | 
| 31 | 
            +
            {% assign blocks              = site.data.blocks %}
         | 
| 32 | 
            +
            {% assign modules             = site.data.modules %}
         | 
| 33 | 
            +
            {% assign template_config     = site.data.j1_config %}
         | 
| 34 | 
            +
             | 
| 35 | 
            +
            {% comment %} Set config data
         | 
| 36 | 
            +
            -------------------------------------------------------------------------------- {% endcomment %}
         | 
| 37 | 
            +
            {% assign translator_defaults = modules.defaults.translator.defaults %}
         | 
| 38 | 
            +
            {% assign translator_settings = modules.translator.settings %}
         | 
| 39 | 
            +
            {% assign tracking_enabled    = template_config.analytics.enabled %}
         | 
| 40 | 
            +
             | 
| 41 | 
            +
             | 
| 42 | 
            +
            {% comment %} Set config options
         | 
| 43 | 
            +
            -------------------------------------------------------------------------------- {% endcomment %}
         | 
| 44 | 
            +
            {% assign translator_options     = translator_defaults | merge: translator_settings %}
         | 
| 45 | 
            +
             | 
| 46 | 
            +
            {% assign production = false %}
         | 
| 47 | 
            +
            {% if environment == 'prod' or environment == 'production' %}
         | 
| 48 | 
            +
              {% assign production = true %}
         | 
| 49 | 
            +
            {% endif %}
         | 
| 50 | 
            +
             | 
| 51 | 
            +
            /*
         | 
| 52 | 
            +
             # -----------------------------------------------------------------------------
         | 
| 53 | 
            +
             # ~/assets/themes/j1/adapter/js/translator.js
         | 
| 54 | 
            +
             # JS Adapter for J1 Translate
         | 
| 55 | 
            +
             #
         | 
| 56 | 
            +
             #  Product/Info:
         | 
| 57 | 
            +
             #  http://jekyll.one
         | 
| 58 | 
            +
             #
         | 
| 59 | 
            +
             #  Copyright (C) 2021 Juergen Adams
         | 
| 60 | 
            +
             #
         | 
| 61 | 
            +
             #  J1 Template is licensed under MIT License.
         | 
| 62 | 
            +
             #  See: https://github.com/jekyll-one/J1 Template/blob/master/LICENSE
         | 
| 63 | 
            +
             # -----------------------------------------------------------------------------
         | 
| 64 | 
            +
             #  Adapter generated: {{site.time}}
         | 
| 65 | 
            +
             # -----------------------------------------------------------------------------
         | 
| 66 | 
            +
            */
         | 
| 67 | 
            +
             | 
| 68 | 
            +
            // -----------------------------------------------------------------------------
         | 
| 69 | 
            +
            // ESLint shimming
         | 
| 70 | 
            +
            // -----------------------------------------------------------------------------
         | 
| 71 | 
            +
            /* eslint indent: "off"                                                       */
         | 
| 72 | 
            +
            /* eslint quotes: "off"                                                       */
         | 
| 73 | 
            +
            // -----------------------------------------------------------------------------
         | 
| 74 | 
            +
            // https://github.com/EdwardBalaj/Simple-DeepL-API-Integration
         | 
| 75 | 
            +
            // https://github.com/marghoobsuleman/ms-Dropdown
         | 
| 76 | 
            +
            // https://www.marghoobsuleman.com/image-dropdown/help
         | 
| 77 | 
            +
            // https://www.marghoobsuleman.com/image-dropdown/advanced-help
         | 
| 78 | 
            +
            'use strict';
         | 
| 79 | 
            +
             | 
| 80 | 
            +
            {% comment %} Main
         | 
| 81 | 
            +
            -------------------------------------------------------------------------------- {% endcomment %}
         | 
| 82 | 
            +
            j1.adapter['translator'] = (function (j1, window) {
         | 
| 83 | 
            +
             | 
| 84 | 
            +
              var environment       = '{{environment}}';
         | 
| 85 | 
            +
              var tracking_enabled  = ('{{tracking_enabled}}' === 'true') ? true: false;    // Analytics/GA enabled?
         | 
| 86 | 
            +
              var moduleOptions     = {};
         | 
| 87 | 
            +
              var user_translate    = {};
         | 
| 88 | 
            +
              var _this;
         | 
| 89 | 
            +
              var $modal;
         | 
| 90 | 
            +
              var domain;
         | 
| 91 | 
            +
              var cookie_names;
         | 
| 92 | 
            +
              var user_consent;
         | 
| 93 | 
            +
              var logger;
         | 
| 94 | 
            +
              var url;
         | 
| 95 | 
            +
              var baseUrl;
         | 
| 96 | 
            +
              var hostname;
         | 
| 97 | 
            +
              var domain;
         | 
| 98 | 
            +
              var cookie_sub_domains;
         | 
| 99 | 
            +
              var secure;
         | 
| 100 | 
            +
              var logText;
         | 
| 101 | 
            +
              var cookie_written;
         | 
| 102 | 
            +
              var modal_language;
         | 
| 103 | 
            +
              var navigator_language;
         | 
| 104 | 
            +
              var translation_language;
         | 
| 105 | 
            +
              var ddSourceLanguage;
         | 
| 106 | 
            +
              var head;
         | 
| 107 | 
            +
              var script;
         | 
| 108 | 
            +
              var languageList;
         | 
| 109 | 
            +
             | 
| 110 | 
            +
              // ---------------------------------------------------------------------------
         | 
| 111 | 
            +
              // helper functions
         | 
| 112 | 
            +
              // ---------------------------------------------------------------------------
         | 
| 113 | 
            +
             | 
| 114 | 
            +
              // ---------------------------------------------------------------------------
         | 
| 115 | 
            +
              // setCookie()
         | 
| 116 | 
            +
              // writes a flat cookie (not using an encoded JSON string)
         | 
| 117 | 
            +
              // ---------------------------------------------------------------------------
         | 
| 118 | 
            +
              function setCookie(options /*cName, cValue, expDays*/) {
         | 
| 119 | 
            +
                var defaults = {};
         | 
| 120 | 
            +
                var settings;
         | 
| 121 | 
            +
                var document_cookie;
         | 
| 122 | 
            +
                var stringifiedAttributes = '';
         | 
| 123 | 
            +
             | 
| 124 | 
            +
                defaults = {
         | 
| 125 | 
            +
                    name: '',
         | 
| 126 | 
            +
                    path: '/',
         | 
| 127 | 
            +
                    expires: 0,
         | 
| 128 | 
            +
                    domain: 'localhost',
         | 
| 129 | 
            +
                    samesite: 'Strict',
         | 
| 130 | 
            +
                    http_only: false,
         | 
| 131 | 
            +
                    secure: false
         | 
| 132 | 
            +
                };
         | 
| 133 | 
            +
                settings = $.extend(defaults, options);
         | 
| 134 | 
            +
             | 
| 135 | 
            +
                stringifiedAttributes += '; ' + 'path=' + settings.path;
         | 
| 136 | 
            +
             | 
| 137 | 
            +
                if (settings.expires > 0) {
         | 
| 138 | 
            +
                  date.setTime(date.getTime() + (settings.expires * 24 * 60 * 60 * 1000));
         | 
| 139 | 
            +
                  stringifiedAttributes += '; ' + 'expires=' + date.toUTCString();
         | 
| 140 | 
            +
                }
         | 
| 141 | 
            +
             | 
| 142 | 
            +
                stringifiedAttributes += '; ' + 'SameSite=' + settings.samesite;
         | 
| 143 | 
            +
             | 
| 144 | 
            +
                if (settings.secure) {
         | 
| 145 | 
            +
                  stringifiedAttributes += '; ' + 'secure=' + settings.secure;
         | 
| 146 | 
            +
                }
         | 
| 147 | 
            +
             | 
| 148 | 
            +
                // document_cookie = settings.name + '=' + settings.data  + '; path=' + settings.path + '; ' + 'domain=' + settings.domain + '; ' + 'SameSite=' + settings.samesite + ';';
         | 
| 149 | 
            +
                document_cookie = settings.name + '=' + settings.data + stringifiedAttributes;
         | 
| 150 | 
            +
             | 
| 151 | 
            +
                document.cookie = document_cookie;
         | 
| 152 | 
            +
              };
         | 
| 153 | 
            +
             | 
| 154 | 
            +
              // ---------------------------------------------------------------------------
         | 
| 155 | 
            +
              // Main object
         | 
| 156 | 
            +
              // ---------------------------------------------------------------------------
         | 
| 157 | 
            +
              return {
         | 
| 158 | 
            +
             | 
| 159 | 
            +
                // -------------------------------------------------------------------------
         | 
| 160 | 
            +
                // Initializer
         | 
| 161 | 
            +
                // -------------------------------------------------------------------------
         | 
| 162 | 
            +
                init: function (options) {
         | 
| 163 | 
            +
             | 
| 164 | 
            +
                  // -----------------------------------------------------------------------
         | 
| 165 | 
            +
                  // globals
         | 
| 166 | 
            +
                  // -----------------------------------------------------------------------
         | 
| 167 | 
            +
                  _this                 = j1.adapter.translator;
         | 
| 168 | 
            +
                  logger                = log4javascript.getLogger('j1.adapter.translator');
         | 
| 169 | 
            +
                  url                   = new liteURL(window.location.href);
         | 
| 170 | 
            +
                  baseUrl               = url.origin;
         | 
| 171 | 
            +
                  hostname              = url.hostname;
         | 
| 172 | 
            +
                  domain                = hostname.substring(hostname.lastIndexOf('.', hostname.lastIndexOf('.') - 1) + 1);
         | 
| 173 | 
            +
                  secure                = (url.protocol.includes('https')) ? true : false;
         | 
| 174 | 
            +
                  modal_language        = "{{site.language}}";
         | 
| 175 | 
            +
                  navigator_language    = navigator.language || navigator.userLanguage;     // userLanguage for MS IE compatibility
         | 
| 176 | 
            +
                  translation_language  = navigator_language.split('-')[0];
         | 
| 177 | 
            +
                  cookie_names          = j1.getCookieNames();
         | 
| 178 | 
            +
                  head                  = document.getElementsByTagName('head')[0];
         | 
| 179 | 
            +
                  script                = document.createElement('script');
         | 
| 180 | 
            +
                  script.id             = 'google-translate';
         | 
| 181 | 
            +
                  script.src            = '//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit';
         | 
| 182 | 
            +
             | 
| 183 | 
            +
                  user_translate = {
         | 
| 184 | 
            +
                    'translatorName':           'google',
         | 
| 185 | 
            +
                    'translationEnabled':       false,
         | 
| 186 | 
            +
                    'analysis':                 true,
         | 
| 187 | 
            +
                    'personalization':          true,
         | 
| 188 | 
            +
                    'translateAllPages':        true,
         | 
| 189 | 
            +
                    'useLanguageFromBrowser':   true,
         | 
| 190 | 
            +
                    'translationLanguage':      translation_language,
         | 
| 191 | 
            +
                  };
         | 
| 192 | 
            +
             | 
| 193 | 
            +
                  // set domain used by cookies
         | 
| 194 | 
            +
                  if(domain !== 'localhost') {
         | 
| 195 | 
            +
                    cookie_sub_domains = '.' + hostname;
         | 
| 196 | 
            +
                  } else {
         | 
| 197 | 
            +
                    cookie_sub_domains = hostname;
         | 
| 198 | 
            +
                  }
         | 
| 199 | 
            +
             | 
| 200 | 
            +
                  if (j1.existsCookie(cookie_names.user_translate)) {
         | 
| 201 | 
            +
                    user_translate = j1.readCookie(cookie_names.user_translate);
         | 
| 202 | 
            +
                  } else {
         | 
| 203 | 
            +
                    logger.debug('\n' + 'write to cookie : ' + cookie_names.user_translate);
         | 
| 204 | 
            +
                    cookie_written = j1.writeCookie({
         | 
| 205 | 
            +
                      name:     cookie_names.user_translate,
         | 
| 206 | 
            +
                      data:     user_translate,
         | 
| 207 | 
            +
                      samesite: 'Strict',
         | 
| 208 | 
            +
                      expires:  365
         | 
| 209 | 
            +
                    });
         | 
| 210 | 
            +
                  }
         | 
| 211 | 
            +
             | 
| 212 | 
            +
                  // set domain used by cookies
         | 
| 213 | 
            +
                  if(domain !== 'localhost') {
         | 
| 214 | 
            +
                    cookie_sub_domains = '.' + hostname;
         | 
| 215 | 
            +
                  } else {
         | 
| 216 | 
            +
                    cookie_sub_domains = hostname;
         | 
| 217 | 
            +
                  }
         | 
| 218 | 
            +
             | 
| 219 | 
            +
                  // initialize state flag
         | 
| 220 | 
            +
                  _this.state = 'pending';
         | 
| 221 | 
            +
                  // _this.settings.languageList = '/assets/data/ms_select.json';
         | 
| 222 | 
            +
             | 
| 223 | 
            +
                  // -----------------------------------------------------------------------
         | 
| 224 | 
            +
                  // Default module settings
         | 
| 225 | 
            +
                  // -----------------------------------------------------------------------
         | 
| 226 | 
            +
                  var settings = $.extend({
         | 
| 227 | 
            +
                    module_name: 'j1.adapter.translator',
         | 
| 228 | 
            +
                    generated:   '{{site.time}}'
         | 
| 229 | 
            +
                  }, options);
         | 
| 230 | 
            +
             | 
| 231 | 
            +
                  {% comment %} Load module config from yml data
         | 
| 232 | 
            +
                  -------------------------------------------------------------------------- {% endcomment %}
         | 
| 233 | 
            +
                  // Load  module DEFAULTS|CONFIG
         | 
| 234 | 
            +
                  /* eslint-disable */
         | 
| 235 | 
            +
                  moduleOptions = $.extend({}, {{translator_options | replace: '=>', ':' | replace: 'nil', '""'}});
         | 
| 236 | 
            +
                  /* eslint-enable */
         | 
| 237 | 
            +
             | 
| 238 | 
            +
                  if (typeof settings !== 'undefined') {
         | 
| 239 | 
            +
                    moduleOptions = j1.mergeData(moduleOptions, settings);
         | 
| 240 | 
            +
                  }
         | 
| 241 | 
            +
             | 
| 242 | 
            +
                  // -----------------------------------------------------------------------
         | 
| 243 | 
            +
                  // initializer
         | 
| 244 | 
            +
                  // -----------------------------------------------------------------------
         | 
| 245 | 
            +
                  var dependencies_met_page_ready = setInterval (function (options) {
         | 
| 246 | 
            +
                    user_consent = j1.readCookie(cookie_names.user_consent);
         | 
| 247 | 
            +
             | 
| 248 | 
            +
                    if ( j1.getState() === 'finished' ) {
         | 
| 249 | 
            +
                      _this.setState('started');
         | 
| 250 | 
            +
                      logger.info('\n' + 'state: ' + _this.getState());
         | 
| 251 | 
            +
                      logger.info('\n' + 'module is being initialized');
         | 
| 252 | 
            +
             | 
| 253 | 
            +
                      if ($('google_translate_element')) {
         | 
| 254 | 
            +
                        $('google_translate_element').hide();
         | 
| 255 | 
            +
                      }
         | 
| 256 | 
            +
             | 
| 257 | 
            +
                      // show|hide translate button if enabled
         | 
| 258 | 
            +
                      if (moduleOptions.hideTranslatorIcon) {
         | 
| 259 | 
            +
                        if (!user_consent.analysis || !user_consent.personalization) {
         | 
| 260 | 
            +
                          // disable google translate button if visible
         | 
| 261 | 
            +
                          if ($('#quickLinksTranslateButton').css('display') === 'block')  {
         | 
| 262 | 
            +
                            $('#quickLinksTranslateButton').css('display', 'none');
         | 
| 263 | 
            +
                          }
         | 
| 264 | 
            +
                        }
         | 
| 265 | 
            +
                        if (user_consent.analysis && user_consent.personalization) {
         | 
| 266 | 
            +
                          // enable google translate button if not visible
         | 
| 267 | 
            +
                          if ($('#quickLinksTranslateButton').css('display') === 'none')  {
         | 
| 268 | 
            +
                            $('#quickLinksTranslateButton').css('display', 'block');
         | 
| 269 | 
            +
                          }
         | 
| 270 | 
            +
                        }
         | 
| 271 | 
            +
                      }
         | 
| 272 | 
            +
             | 
| 273 | 
            +
                      // update user_translate cookie
         | 
| 274 | 
            +
                      user_translate.analysis         = user_consent.analysis;
         | 
| 275 | 
            +
                      user_translate.personalization  = user_consent.personalization;
         | 
| 276 | 
            +
                      cookie_written = j1.writeCookie({
         | 
| 277 | 
            +
                        name:     cookie_names.user_translate,
         | 
| 278 | 
            +
                        data:     user_translate,
         | 
| 279 | 
            +
                        samesite: 'Strict',
         | 
| 280 | 
            +
                        secure:   secure
         | 
| 281 | 
            +
                      });
         | 
| 282 | 
            +
             | 
| 283 | 
            +
                      j1.translator = new Translator({
         | 
| 284 | 
            +
                        contentURL:               moduleOptions.contentURL,                 // dialog content (modals) for all supported languages
         | 
| 285 | 
            +
                        cookieName:               moduleOptions.cookieName,                 // the name of the User State Cookie (primary data)
         | 
| 286 | 
            +
                        cookieConsentName:        moduleOptions.cookieConsentName,          // the name of the Cookie Consent Cookie (secondary data)
         | 
| 287 | 
            +
                        disableLanguageSelector:  moduleOptions.disableLanguageSelector,    // disable language dropdown for translation in dialog (modal)
         | 
| 288 | 
            +
                        dialogContainerID:        moduleOptions.dialogContainerID,          // dest container, the dialog modal is loaded (dynamically)
         | 
| 289 | 
            +
                        dialogLanguage:           moduleOptions.dialogLanguage,             // language for the dialog (modal)
         | 
| 290 | 
            +
                        translationLanguage:      moduleOptions.translationLanguage,        // default language for translation
         | 
| 291 | 
            +
                        translationLanguages:     moduleOptions.google.translationLanguages,// supported languages for translation
         | 
| 292 | 
            +
                        translationEnabled:       moduleOptions.translationEnabled,         // run translation enabled|disabled
         | 
| 293 | 
            +
                        translatorName:           moduleOptions.translatorName,             // translator used for translation
         | 
| 294 | 
            +
                        xhrDataElement:           moduleOptions.xhrDataElement,             // container for all language-specific dialogs (modals)
         | 
| 295 | 
            +
                        postSelectionCallback:    moduleOptions.google.postSelectionCallback
         | 
| 296 | 
            +
                      });
         | 
| 297 | 
            +
             | 
| 298 | 
            +
                      if (user_consent.analysis && user_consent.personalization && user_translate.translationEnabled) {
         | 
| 299 | 
            +
                        if (moduleOptions.translatorName === 'google') {
         | 
| 300 | 
            +
                          head.appendChild(script);
         | 
| 301 | 
            +
                          if ($('google_translate_element')) {
         | 
| 302 | 
            +
                            $('google_translate_element').hide();
         | 
| 303 | 
            +
                          }
         | 
| 304 | 
            +
                        }
         | 
| 305 | 
            +
                      } else {
         | 
| 306 | 
            +
                        if (moduleOptions.translatorName === 'google') {
         | 
| 307 | 
            +
                          j1.removeCookie({name: 'googtrans', domain: domain});
         | 
| 308 | 
            +
                        }
         | 
| 309 | 
            +
                      }
         | 
| 310 | 
            +
             | 
| 311 | 
            +
                      _this.setState('finished');
         | 
| 312 | 
            +
                      logger.info('\n' + 'state: ' + _this.getState());
         | 
| 313 | 
            +
                      logger.debug('\n' + 'module initialized successfully');
         | 
| 314 | 
            +
                      clearInterval(dependencies_met_page_ready);
         | 
| 315 | 
            +
                    }
         | 
| 316 | 
            +
                  });
         | 
| 317 | 
            +
                }, // END init
         | 
| 318 | 
            +
             | 
| 319 | 
            +
                // -------------------------------------------------------------------------
         | 
| 320 | 
            +
                // messageHandler: MessageHandler for J1 google_translate module
         | 
| 321 | 
            +
                // Manage messages send from other J1 modules
         | 
| 322 | 
            +
                // -------------------------------------------------------------------------
         | 
| 323 | 
            +
                messageHandler: function (sender, message) {
         | 
| 324 | 
            +
                  var json_message = JSON.stringify(message, undefined, 2);
         | 
| 325 | 
            +
             | 
| 326 | 
            +
                  logText = '\n' + 'received message from ' + sender + ': ' + json_message;
         | 
| 327 | 
            +
                  logger.debug(logText);
         | 
| 328 | 
            +
             | 
| 329 | 
            +
                  // -----------------------------------------------------------------------
         | 
| 330 | 
            +
                  //  Process commands|actions
         | 
| 331 | 
            +
                  // -----------------------------------------------------------------------
         | 
| 332 | 
            +
                  if (message.type === 'command' && message.action === 'module_initialized') {
         | 
| 333 | 
            +
                    //
         | 
| 334 | 
            +
                    // Place handling of command|action here
         | 
| 335 | 
            +
                    //
         | 
| 336 | 
            +
                    logger.info('\n' + message.text);
         | 
| 337 | 
            +
                  }
         | 
| 338 | 
            +
             | 
| 339 | 
            +
                  //
         | 
| 340 | 
            +
                  // Place handling of other command|action here
         | 
| 341 | 
            +
                  //
         | 
| 342 | 
            +
             | 
| 343 | 
            +
                  return true;
         | 
| 344 | 
            +
                }, // END messageHandler
         | 
| 345 | 
            +
             | 
| 346 | 
            +
                // -------------------------------------------------------------------------
         | 
| 347 | 
            +
                // setState()
         | 
| 348 | 
            +
                // Sets the current (processing) state of the module
         | 
| 349 | 
            +
                // -------------------------------------------------------------------------
         | 
| 350 | 
            +
                setState: function (stat) {
         | 
| 351 | 
            +
                  _this.state = stat;
         | 
| 352 | 
            +
                }, // END setState
         | 
| 353 | 
            +
             | 
| 354 | 
            +
                // -------------------------------------------------------------------------
         | 
| 355 | 
            +
                // getState()
         | 
| 356 | 
            +
                // Returns the current (processing) state of the module
         | 
| 357 | 
            +
                // -------------------------------------------------------------------------
         | 
| 358 | 
            +
                getState: function () {
         | 
| 359 | 
            +
                  return _this.state;
         | 
| 360 | 
            +
                }, // END getState
         | 
| 361 | 
            +
             | 
| 362 | 
            +
                // -------------------------------------------------------------------------
         | 
| 363 | 
            +
                // postTranslateElementInit()
         | 
| 364 | 
            +
                // ???
         | 
| 365 | 
            +
                // -------------------------------------------------------------------------
         | 
| 366 | 
            +
                postTranslateElementInit: function () {
         | 
| 367 | 
            +
                  // var transCode = '/en/de';
         | 
| 368 | 
            +
                  //
         | 
| 369 | 
            +
                  // // set the transCode cookie (googtrans)
         | 
| 370 | 
            +
                  // setCookie({
         | 
| 371 | 
            +
                  //   name: 'googtrans',
         | 
| 372 | 
            +
                  //   data: transCode
         | 
| 373 | 
            +
                  // });
         | 
| 374 | 
            +
                  // j1.removeCookie({name: 'googtrans', domain: domain});
         | 
| 375 | 
            +
                  return;
         | 
| 376 | 
            +
                }, // END postTranslateElementInit
         | 
| 377 | 
            +
             | 
| 378 | 
            +
                // -------------------------------------------------------------------------
         | 
| 379 | 
            +
                // cbGoogle()
         | 
| 380 | 
            +
                // Called by the translator CORE module after the user
         | 
| 381 | 
            +
                // has made the lanuage selection for translation (callback)
         | 
| 382 | 
            +
                // -------------------------------------------------------------------------
         | 
| 383 | 
            +
                cbGoogle: function () {
         | 
| 384 | 
            +
                  var cookie_names   = j1.getCookieNames();
         | 
| 385 | 
            +
                  var user_state     = j1.readCookie(cookie_names.user_state);
         | 
| 386 | 
            +
                  var user_consent   = j1.readCookie(cookie_names.user_consent);
         | 
| 387 | 
            +
                  var user_translate = j1.readCookie(cookie_names.user_translate);
         | 
| 388 | 
            +
                  var msDropdownLang = document.getElementById('dropdownJSON').msDropdown;
         | 
| 389 | 
            +
                  var msDropdown     = document.getElementById('dropdownJSON').msDropdown;
         | 
| 390 | 
            +
                  var head;
         | 
| 391 | 
            +
                  var script;
         | 
| 392 | 
            +
                  var srcLang;
         | 
| 393 | 
            +
                  var destLang;
         | 
| 394 | 
            +
                  var transCode;
         | 
| 395 | 
            +
                  var cookie_written;
         | 
| 396 | 
            +
                  var htmlScriptElement;
         | 
| 397 | 
            +
                  var selectedTranslationLanguage;
         | 
| 398 | 
            +
             | 
| 399 | 
            +
                  logger.info('\n' + 'entered post selection callback from google_translate');
         | 
| 400 | 
            +
                  logger.debug('\n' + 'current values from cookie consent: ' + JSON.stringify(user_consent));
         | 
| 401 | 
            +
                  logger.debug('\n' + 'current values from user state: ' + JSON.stringify(user_state));
         | 
| 402 | 
            +
             | 
| 403 | 
            +
                  selectedTranslationLanguage = msDropdownLang.value;
         | 
| 404 | 
            +
                  logger.info('\n' + 'selected translation language: ' + selectedTranslationLanguage);
         | 
| 405 | 
            +
             | 
| 406 | 
            +
                  // update cookie consent settings
         | 
| 407 | 
            +
                  user_consent.analysis         = user_translate.analysis;
         | 
| 408 | 
            +
                  user_consent.personalization  = user_translate.personalization;
         | 
| 409 | 
            +
             | 
| 410 | 
            +
                  cookie_written = j1.writeCookie({
         | 
| 411 | 
            +
                    name:     cookie_names.user_consent,
         | 
| 412 | 
            +
                    data:     user_consent,
         | 
| 413 | 
            +
                    samesite: 'Strict',
         | 
| 414 | 
            +
                    secure:   secure,
         | 
| 415 | 
            +
                    expires:  0
         | 
| 416 | 
            +
                  });
         | 
| 417 | 
            +
             | 
| 418 | 
            +
                  // translation allowed
         | 
| 419 | 
            +
                  if (user_consent.analysis && user_consent.personalization)  {
         | 
| 420 | 
            +
                    head              = document.getElementsByTagName('head')[0];
         | 
| 421 | 
            +
                    script            = document.createElement('script');
         | 
| 422 | 
            +
                    script.id         = 'google-translate';
         | 
| 423 | 
            +
                    script.src        = '//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit';
         | 
| 424 | 
            +
                    htmlScriptElement = document.getElementById(script.id);
         | 
| 425 | 
            +
             | 
| 426 | 
            +
                    if (user_translate.translationEnabled && moduleOptions.translatorName === 'google') {
         | 
| 427 | 
            +
                      // head.appendChild(script);
         | 
| 428 | 
            +
             | 
| 429 | 
            +
                      if ($('google_translate_element')) {
         | 
| 430 | 
            +
                        $('google_translate_element').hide();
         | 
| 431 | 
            +
                      }
         | 
| 432 | 
            +
             | 
| 433 | 
            +
                      // set transCode settings
         | 
| 434 | 
            +
                      srcLang   = "{{site.language}}";
         | 
| 435 | 
            +
                      destLang  = translation_language;
         | 
| 436 | 
            +
                      transCode = '/' + srcLang + '/' + selectedTranslationLanguage;
         | 
| 437 | 
            +
             | 
| 438 | 
            +
                      // set the transCode cookie (googtrans)
         | 
| 439 | 
            +
                      setCookie({
         | 
| 440 | 
            +
                        name: 'googtrans',
         | 
| 441 | 
            +
                        data: transCode
         | 
| 442 | 
            +
                      });
         | 
| 443 | 
            +
             | 
| 444 | 
            +
                      // enable google transalate button if not visible
         | 
| 445 | 
            +
                      if ($('#quickLinksTranslateButton').css('display') === 'none')  {
         | 
| 446 | 
            +
                        $('#quickLinksTranslateButton').css('display', 'block');
         | 
| 447 | 
            +
                      }
         | 
| 448 | 
            +
                    } else { // translation NOT allowed
         | 
| 449 | 
            +
             | 
| 450 | 
            +
                      // update cookie user translate settings
         | 
| 451 | 
            +
                      user_translate.translationEnabled = false;
         | 
| 452 | 
            +
                      cookie_written = j1.writeCookie({
         | 
| 453 | 
            +
                        name:     cookie_names.user_translate,
         | 
| 454 | 
            +
                        data:     user_translate,
         | 
| 455 | 
            +
                        samesite: 'Strict',
         | 
| 456 | 
            +
                        secure:   secure
         | 
| 457 | 
            +
                      });
         | 
| 458 | 
            +
             | 
| 459 | 
            +
                      // stop translation for all pages
         | 
| 460 | 
            +
                      if (htmlScriptElement) { htmlScriptElement.remove(); }
         | 
| 461 | 
            +
                      j1.removeCookie({name: 'googtrans', domain: domain});
         | 
| 462 | 
            +
                    }
         | 
| 463 | 
            +
                  }
         | 
| 464 | 
            +
             | 
| 465 | 
            +
                  // translation NOT allowed
         | 
| 466 | 
            +
                  if (!user_translate.analysis || !user_translate.personalization) {
         | 
| 467 | 
            +
                    head       = document.getElementsByTagName('head')[0];
         | 
| 468 | 
            +
                    script     = document.createElement('script');
         | 
| 469 | 
            +
                    script.id  = 'google-translate';
         | 
| 470 | 
            +
             | 
| 471 | 
            +
                    // update cookie consent settings
         | 
| 472 | 
            +
                    user_consent.analysis        = user_translate.analysis;
         | 
| 473 | 
            +
                    user_consent.personalization = user_translate.personalization;
         | 
| 474 | 
            +
                    cookie_written = j1.writeCookie({
         | 
| 475 | 
            +
                      name:     cookie_names.user_consent,
         | 
| 476 | 
            +
                      data:     user_consent,
         | 
| 477 | 
            +
                      samesite: 'Strict',
         | 
| 478 | 
            +
                      secure:   secure,
         | 
| 479 | 
            +
                      expires:  0
         | 
| 480 | 
            +
                    });
         | 
| 481 | 
            +
             | 
| 482 | 
            +
                    // update cookie user translate settings
         | 
| 483 | 
            +
                    user_translate.translationEnabled = false;
         | 
| 484 | 
            +
                    cookie_written = j1.writeCookie({
         | 
| 485 | 
            +
                      name:     cookie_names.user_translate,
         | 
| 486 | 
            +
                      data:     user_consent,
         | 
| 487 | 
            +
                      samesite: 'Strict',
         | 
| 488 | 
            +
                      secure:   secure,
         | 
| 489 | 
            +
                      expires:  0
         | 
| 490 | 
            +
                    });
         | 
| 491 | 
            +
             | 
| 492 | 
            +
                    // stop translation for all pages
         | 
| 493 | 
            +
                    if (htmlScriptElement) { htmlScriptElement.remove(); }
         | 
| 494 | 
            +
                    j1.removeCookie({name: 'googtrans', domain: domain});
         | 
| 495 | 
            +
                  }
         | 
| 496 | 
            +
             | 
| 497 | 
            +
                  if (moduleOptions.reloadPageOnChange) {
         | 
| 498 | 
            +
                    // reload current page (skip cache)
         | 
| 499 | 
            +
                    location.reload(true);
         | 
| 500 | 
            +
                  }
         | 
| 501 | 
            +
             | 
| 502 | 
            +
                  // disable google translate button if visible
         | 
| 503 | 
            +
                  if ($('#quickLinksTranslateButton').css('display') === 'block')  {
         | 
| 504 | 
            +
                    $('#quickLinksTranslateButton').css('display', 'none');
         | 
| 505 | 
            +
                  }
         | 
| 506 | 
            +
             | 
| 507 | 
            +
                }, // END cbGoogle
         | 
| 508 | 
            +
             | 
| 509 | 
            +
                // -------------------------------------------------------------------------
         | 
| 510 | 
            +
                // cbDeepl()
         | 
| 511 | 
            +
                // Called by the translator CORE module after the user
         | 
| 512 | 
            +
                // has made the lanuage selection for translation (callback)
         | 
| 513 | 
            +
                // -------------------------------------------------------------------------
         | 
| 514 | 
            +
                cbDeepl: function () {
         | 
| 515 | 
            +
             | 
| 516 | 
            +
                  // code for post procession on Deepl translations
         | 
| 517 | 
            +
             | 
| 518 | 
            +
                } // END cbDeepl
         | 
| 519 | 
            +
             | 
| 520 | 
            +
              }; // END return
         | 
| 521 | 
            +
            })(j1, window);
         | 
| 522 | 
            +
             | 
| 523 | 
            +
            {% endcapture %}
         | 
| 524 | 
            +
            {{ cache | strip_empty_lines }}
         | 
| 525 | 
            +
            {% assign cache = nil %}
         | 
| @@ -117,16 +117,37 @@ j1.adapter['translator'] = (function (j1, window) { | |
| 117 117 | 
             
              function setCookie(options /*cName, cValue, expDays*/) {
         | 
| 118 118 | 
             
                var defaults = {};
         | 
| 119 119 | 
             
                var settings;
         | 
| 120 | 
            +
                var document_cookie;
         | 
| 121 | 
            +
                var stringifiedAttributes = '';
         | 
| 120 122 |  | 
| 121 123 | 
             
                defaults = {
         | 
| 122 124 | 
             
                    name: '',
         | 
| 123 125 | 
             
                    path: '/',
         | 
| 124 126 | 
             
                    expires: 0,
         | 
| 125 | 
            -
                    domain: 'localhost'
         | 
| 127 | 
            +
                    domain: 'localhost',
         | 
| 128 | 
            +
                    samesite: 'Strict',
         | 
| 129 | 
            +
                    http_only: false,
         | 
| 130 | 
            +
                    secure: false
         | 
| 126 131 | 
             
                };
         | 
| 127 132 | 
             
                settings = $.extend(defaults, options);
         | 
| 128 133 |  | 
| 129 | 
            -
                 | 
| 134 | 
            +
                stringifiedAttributes += '; ' + 'path=' + settings.path;
         | 
| 135 | 
            +
             | 
| 136 | 
            +
                if (settings.expires > 0) {
         | 
| 137 | 
            +
                  date.setTime(date.getTime() + (settings.expires * 24 * 60 * 60 * 1000));
         | 
| 138 | 
            +
                  stringifiedAttributes += '; ' + 'expires=' + date.toUTCString();
         | 
| 139 | 
            +
                }
         | 
| 140 | 
            +
             | 
| 141 | 
            +
                stringifiedAttributes += '; ' + 'SameSite=' + settings.samesite;
         | 
| 142 | 
            +
             | 
| 143 | 
            +
                if (settings.secure) {
         | 
| 144 | 
            +
                  stringifiedAttributes += '; ' + 'secure=' + settings.secure;
         | 
| 145 | 
            +
                }
         | 
| 146 | 
            +
             | 
| 147 | 
            +
                // document_cookie = settings.name + '=' + settings.data  + '; path=' + settings.path + '; ' + 'domain=' + settings.domain + '; ' + 'SameSite=' + settings.samesite + ';';
         | 
| 148 | 
            +
                document_cookie = settings.name + '=' + settings.data + stringifiedAttributes;
         | 
| 149 | 
            +
             | 
| 150 | 
            +
                document.cookie = document_cookie;
         | 
| 130 151 | 
             
              };
         | 
| 131 152 |  | 
| 132 153 | 
             
              // ---------------------------------------------------------------------------
         | 
| @@ -148,6 +169,7 @@ j1.adapter['translator'] = (function (j1, window) { | |
| 148 169 | 
             
                  baseUrl               = url.origin;
         | 
| 149 170 | 
             
                  hostname              = url.hostname;
         | 
| 150 171 | 
             
                  domain                = hostname.substring(hostname.lastIndexOf('.', hostname.lastIndexOf('.') - 1) + 1);
         | 
| 172 | 
            +
                  cookie_domain         = (domain.includes('.')) ? '.' + domain : domain;
         | 
| 151 173 | 
             
                  secure                = (url.protocol.includes('https')) ? true : false;
         | 
| 152 174 | 
             
                  modal_language        = "{{site.language}}";
         | 
| 153 175 | 
             
                  navigator_language    = navigator.language || navigator.userLanguage;     // userLanguage for MS IE compatibility
         | 
| @@ -168,6 +190,7 @@ j1.adapter['translator'] = (function (j1, window) { | |
| 168 190 | 
             
                    'translationLanguage':      translation_language,
         | 
| 169 191 | 
             
                  };
         | 
| 170 192 |  | 
| 193 | 
            +
                  // load|initialize user translate cookie
         | 
| 171 194 | 
             
                  if (j1.existsCookie(cookie_names.user_translate)) {
         | 
| 172 195 | 
             
                    user_translate = j1.readCookie(cookie_names.user_translate);
         | 
| 173 196 | 
             
                  } else {
         | 
| @@ -176,17 +199,11 @@ j1.adapter['translator'] = (function (j1, window) { | |
| 176 199 | 
             
                      name:     cookie_names.user_translate,
         | 
| 177 200 | 
             
                      data:     user_translate,
         | 
| 178 201 | 
             
                      samesite: 'Strict',
         | 
| 202 | 
            +
                      secure:   secure,
         | 
| 179 203 | 
             
                      expires:  365
         | 
| 180 204 | 
             
                    });
         | 
| 181 205 | 
             
                  }
         | 
| 182 206 |  | 
| 183 | 
            -
                  // set domain used by cookies
         | 
| 184 | 
            -
                  if(domain !== 'localhost') {
         | 
| 185 | 
            -
                    cookie_domain = '.' + hostname;
         | 
| 186 | 
            -
                  } else {
         | 
| 187 | 
            -
                    cookie_domain = hostname;
         | 
| 188 | 
            -
                  }
         | 
| 189 | 
            -
             | 
| 190 207 | 
             
                  // initialize state flag
         | 
| 191 208 | 
             
                  _this.state = 'pending';
         | 
| 192 209 | 
             
                  // _this.settings.languageList = '/assets/data/ms_select.json';
         | 
| @@ -221,6 +238,7 @@ j1.adapter['translator'] = (function (j1, window) { | |
| 221 238 | 
             
                      logger.info('\n' + 'state: ' + _this.getState());
         | 
| 222 239 | 
             
                      logger.info('\n' + 'module is being initialized');
         | 
| 223 240 |  | 
| 241 | 
            +
                      // hide the google translate element if exists
         | 
| 224 242 | 
             
                      if ($('google_translate_element')) {
         | 
| 225 243 | 
             
                        $('google_translate_element').hide();
         | 
| 226 244 | 
             
                      }
         | 
| @@ -248,7 +266,8 @@ j1.adapter['translator'] = (function (j1, window) { | |
| 248 266 | 
             
                        name:     cookie_names.user_translate,
         | 
| 249 267 | 
             
                        data:     user_translate,
         | 
| 250 268 | 
             
                        samesite: 'Strict',
         | 
| 251 | 
            -
                        secure:   secure
         | 
| 269 | 
            +
                        secure:   secure,
         | 
| 270 | 
            +
                        expires:  365
         | 
| 252 271 | 
             
                      });
         | 
| 253 272 |  | 
| 254 273 | 
             
                      j1.translator = new Translator({
         | 
| @@ -266,15 +285,21 @@ j1.adapter['translator'] = (function (j1, window) { | |
| 266 285 | 
             
                        postSelectionCallback:    moduleOptions.google.postSelectionCallback
         | 
| 267 286 | 
             
                      });
         | 
| 268 287 |  | 
| 288 | 
            +
                      // enable|disable translation (after callback)
         | 
| 269 289 | 
             
                      if (user_consent.analysis && user_consent.personalization && user_translate.translationEnabled) {
         | 
| 270 290 | 
             
                        if (moduleOptions.translatorName === 'google') {
         | 
| 271 291 | 
             
                          head.appendChild(script);
         | 
| 272 | 
            -
                          $('google_translate_element') | 
| 292 | 
            +
                          if ($('google_translate_element')) {
         | 
| 293 | 
            +
                            $('google_translate_element').hide();
         | 
| 294 | 
            +
                          }
         | 
| 273 295 | 
             
                        }
         | 
| 274 296 | 
             
                      } else {
         | 
| 275 297 | 
             
                        if (moduleOptions.translatorName === 'google') {
         | 
| 276 | 
            -
                           | 
| 277 | 
            -
             | 
| 298 | 
            +
                          // remove all googtrans cookies that POTENTIALLY exists
         | 
| 299 | 
            +
                          Cookies.remove('googtrans', { domain: cookie_domain });
         | 
| 300 | 
            +
                          Cookies.remove('googtrans', { domain: hostname });
         | 
| 301 | 
            +
                          Cookies.remove('googtrans');
         | 
| 302 | 
            +
                        }
         | 
| 278 303 | 
             
                      }
         | 
| 279 304 |  | 
| 280 305 | 
             
                      _this.setState('finished');
         | 
| @@ -328,32 +353,35 @@ j1.adapter['translator'] = (function (j1, window) { | |
| 328 353 | 
             
                  return _this.state;
         | 
| 329 354 | 
             
                }, // END getState
         | 
| 330 355 |  | 
| 356 | 
            +
                // -------------------------------------------------------------------------
         | 
| 357 | 
            +
                // postTranslateElementInit()
         | 
| 358 | 
            +
                // ???
         | 
| 359 | 
            +
                // -------------------------------------------------------------------------
         | 
| 360 | 
            +
                postTranslateElementInit: function (response) {
         | 
| 361 | 
            +
                  // code for post processing
         | 
| 362 | 
            +
                  logger.info('\n' + 'postTranslateElementInit entered');
         | 
| 363 | 
            +
                  logger.info('\n' + response.T.Dh);
         | 
| 364 | 
            +
                  return;
         | 
| 365 | 
            +
                }, // END postTranslateElementInit
         | 
| 366 | 
            +
             | 
| 331 367 | 
             
                // -------------------------------------------------------------------------
         | 
| 332 368 | 
             
                // cbGoogle()
         | 
| 333 | 
            -
                // Called by the translator CORE module after the user
         | 
| 334 | 
            -
                //  | 
| 369 | 
            +
                // Called by the translator CORE module after the user made the
         | 
| 370 | 
            +
                // selection for a translation|language
         | 
| 335 371 | 
             
                // -------------------------------------------------------------------------
         | 
| 336 372 | 
             
                cbGoogle: function () {
         | 
| 373 | 
            +
                  var logger         = log4javascript.getLogger('j1.adapter.translator.cbGoogle');
         | 
| 337 374 | 
             
                  var cookie_names   = j1.getCookieNames();
         | 
| 338 375 | 
             
                  var user_state     = j1.readCookie(cookie_names.user_state);
         | 
| 339 376 | 
             
                  var user_consent   = j1.readCookie(cookie_names.user_consent);
         | 
| 340 377 | 
             
                  var user_translate = j1.readCookie(cookie_names.user_translate);
         | 
| 341 | 
            -
                  var msDropdownLang = document.getElementById('dropdownJSON').msDropdown;
         | 
| 342 378 | 
             
                  var msDropdown     = document.getElementById('dropdownJSON').msDropdown;
         | 
| 343 | 
            -
                  var  | 
| 344 | 
            -
                  var script;
         | 
| 379 | 
            +
                  var selectedTranslationLanguage;
         | 
| 345 380 | 
             
                  var srcLang;
         | 
| 346 381 | 
             
                  var destLang;
         | 
| 347 382 | 
             
                  var transCode;
         | 
| 348 | 
            -
                  var cookie_written;
         | 
| 349 | 
            -
                  var htmlScriptElement;
         | 
| 350 | 
            -
                  var selectedTranslationLanguage;
         | 
| 351 | 
            -
             | 
| 352 | 
            -
                  logger.info('\n' + 'entered post selection callback from google_translate');
         | 
| 353 | 
            -
                  logger.debug('\n' + 'current values from cookie consent: ' + JSON.stringify(user_consent));
         | 
| 354 | 
            -
                  logger.debug('\n' + 'current values from user state: ' + JSON.stringify(user_state));
         | 
| 355 383 |  | 
| 356 | 
            -
                  selectedTranslationLanguage =  | 
| 384 | 
            +
                  selectedTranslationLanguage = msDropdown.value;
         | 
| 357 385 | 
             
                  logger.info('\n' + 'selected translation language: ' + selectedTranslationLanguage);
         | 
| 358 386 |  | 
| 359 387 | 
             
                  // update cookie consent settings
         | 
| @@ -365,109 +393,34 @@ j1.adapter['translator'] = (function (j1, window) { | |
| 365 393 | 
             
                    data:     user_consent,
         | 
| 366 394 | 
             
                    samesite: 'Strict',
         | 
| 367 395 | 
             
                    secure:   secure,
         | 
| 368 | 
            -
                    expires:   | 
| 396 | 
            +
                    expires:  365
         | 
| 369 397 | 
             
                  });
         | 
| 370 398 |  | 
| 371 | 
            -
                  //  | 
| 372 | 
            -
                   | 
| 373 | 
            -
             | 
| 374 | 
            -
             | 
| 375 | 
            -
                    script.id         = 'google-translate';
         | 
| 376 | 
            -
                    script.src        = '//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit';
         | 
| 377 | 
            -
                    htmlScriptElement = document.getElementById(script.id);
         | 
| 378 | 
            -
             | 
| 379 | 
            -
                    if (user_translate.translationEnabled && moduleOptions.translatorName === 'google') {
         | 
| 380 | 
            -
                      head.appendChild(script);
         | 
| 381 | 
            -
             | 
| 382 | 
            -
                      if ($('google_translate_element')) {
         | 
| 383 | 
            -
                        $('google_translate_element').hide();
         | 
| 384 | 
            -
                      }
         | 
| 385 | 
            -
             | 
| 386 | 
            -
                      // set transCode settings
         | 
| 387 | 
            -
                      srcLang   = "{{site.language}}";
         | 
| 388 | 
            -
                      destLang  = translation_language;
         | 
| 389 | 
            -
                      transCode = '/' + srcLang + '/' + selectedTranslationLanguage;
         | 
| 399 | 
            +
                  // set transCode settings
         | 
| 400 | 
            +
                  srcLang   = "{{site.language}}";
         | 
| 401 | 
            +
                  destLang  = translation_language;
         | 
| 402 | 
            +
                  transCode = '/' + srcLang + '/' + selectedTranslationLanguage;
         | 
| 390 403 |  | 
| 391 | 
            -
             | 
| 392 | 
            -
             | 
| 393 | 
            -
             | 
| 394 | 
            -
             | 
| 395 | 
            -
                      });
         | 
| 404 | 
            +
                  // remove all googtrans cookies that POTENTIALLY exists
         | 
| 405 | 
            +
                  Cookies.remove('googtrans', { domain: cookie_domain });
         | 
| 406 | 
            +
                  Cookies.remove('googtrans', { domain: hostname });
         | 
| 407 | 
            +
                  Cookies.remove('googtrans');
         | 
| 396 408 |  | 
| 397 | 
            -
             | 
| 398 | 
            -
             | 
| 399 | 
            -
                        $('#quickLinksTranslateButton').css('display', 'block');
         | 
| 400 | 
            -
                      }
         | 
| 401 | 
            -
                    } else { // translation NOT allowed
         | 
| 402 | 
            -
             | 
| 403 | 
            -
                      // update cookie user translate settings
         | 
| 404 | 
            -
                      user_translate.translationEnabled = false;
         | 
| 405 | 
            -
                      cookie_written = j1.writeCookie({
         | 
| 406 | 
            -
                        name:     cookie_names.user_translate,
         | 
| 407 | 
            -
                        data:     user_translate,
         | 
| 408 | 
            -
                        samesite: 'Strict',
         | 
| 409 | 
            -
                        secure:   secure
         | 
| 410 | 
            -
                      });
         | 
| 411 | 
            -
             | 
| 412 | 
            -
                      // stop translation for all pages
         | 
| 413 | 
            -
                      if (htmlScriptElement) { htmlScriptElement.remove(); }
         | 
| 414 | 
            -
                      j1.removeCookie({name: 'googtrans'});
         | 
| 415 | 
            -
                    }
         | 
| 416 | 
            -
                  }
         | 
| 417 | 
            -
             | 
| 418 | 
            -
                  // translation NOT allowed
         | 
| 419 | 
            -
                  if (!user_translate.analysis || !user_translate.personalization) {
         | 
| 420 | 
            -
                    head       = document.getElementsByTagName('head')[0];
         | 
| 421 | 
            -
                    script     = document.createElement('script');
         | 
| 422 | 
            -
                    script.id  = 'google-translate';
         | 
| 423 | 
            -
             | 
| 424 | 
            -
                    // update cookie consent settings
         | 
| 425 | 
            -
                    user_consent.analysis        = user_translate.analysis;
         | 
| 426 | 
            -
                    user_consent.personalization = user_translate.personalization;
         | 
| 427 | 
            -
                    cookie_written = j1.writeCookie({
         | 
| 428 | 
            -
                      name:     cookie_names.user_consent,
         | 
| 429 | 
            -
                      data:     user_consent,
         | 
| 430 | 
            -
                      samesite: 'Strict',
         | 
| 431 | 
            -
                      secure:   secure,
         | 
| 432 | 
            -
                      expires:  0
         | 
| 433 | 
            -
                    });
         | 
| 434 | 
            -
             | 
| 435 | 
            -
                    // update cookie user translate settings
         | 
| 436 | 
            -
                    user_translate.translationEnabled = false;
         | 
| 437 | 
            -
                    cookie_written = j1.writeCookie({
         | 
| 438 | 
            -
                      name:     cookie_names.user_translate,
         | 
| 439 | 
            -
                      data:     user_consent,
         | 
| 440 | 
            -
                      samesite: 'Strict',
         | 
| 441 | 
            -
                      secure:   secure,
         | 
| 442 | 
            -
                      expires:  0
         | 
| 443 | 
            -
                    });
         | 
| 444 | 
            -
             | 
| 445 | 
            -
                    // stop translation for all pages
         | 
| 446 | 
            -
                    if (htmlScriptElement) { htmlScriptElement.remove(); }
         | 
| 447 | 
            -
                    j1.removeCookie({name: 'googtrans'});
         | 
| 448 | 
            -
                  }
         | 
| 449 | 
            -
             | 
| 450 | 
            -
                  if (moduleOptions.reloadPageOnChange) {
         | 
| 451 | 
            -
                    // reload current page (skip cache)
         | 
| 452 | 
            -
                    location.reload(true);
         | 
| 453 | 
            -
                  }
         | 
| 454 | 
            -
             | 
| 455 | 
            -
                  // disable google translate button if visible
         | 
| 456 | 
            -
                  if ($('#quickLinksTranslateButton').css('display') === 'block')  {
         | 
| 457 | 
            -
                    $('#quickLinksTranslateButton').css('display', 'none');
         | 
| 458 | 
            -
                  }
         | 
| 409 | 
            +
                  // write the googtrans cookie w/o DOMAIN!
         | 
| 410 | 
            +
                  Cookies.set('googtrans', transCode);
         | 
| 459 411 |  | 
| 412 | 
            +
                  // reload current page (skip cache)
         | 
| 413 | 
            +
                  location.reload(true);
         | 
| 460 414 | 
             
                }, // END cbGoogle
         | 
| 461 415 |  | 
| 462 416 | 
             
                // -------------------------------------------------------------------------
         | 
| 463 417 | 
             
                // cbDeepl()
         | 
| 464 | 
            -
                // Called by the translator CORE module after the user
         | 
| 465 | 
            -
                //  | 
| 418 | 
            +
                // Called by the translator CORE module after the user made the
         | 
| 419 | 
            +
                // selection for a translation language
         | 
| 466 420 | 
             
                // -------------------------------------------------------------------------
         | 
| 467 421 | 
             
                cbDeepl: function () {
         | 
| 468 | 
            -
             | 
| 469 | 
            -
                  // code for post  | 
| 470 | 
            -
             | 
| 422 | 
            +
                  var logger     = log4javascript.getLogger('j1.adapter.translator.cbDeepl');
         | 
| 423 | 
            +
                  // code for post processing
         | 
| 471 424 | 
             
                } // END cbDeepl
         | 
| 472 425 |  | 
| 473 426 | 
             
              }; // END return
         | 
| @@ -37,7 +37,7 @@ | |
| 37 37 | 
             
            /* eslint JSUnfilteredForInLoop: "off"                                        */
         | 
| 38 38 | 
             
            // -----------------------------------------------------------------------------
         | 
| 39 39 |  | 
| 40 | 
            -
            function  | 
| 40 | 
            +
            function CookieConsent(props) {
         | 
| 41 41 | 
             
              var logger                = log4javascript.getLogger('j1.core.bsCookieConsent');
         | 
| 42 42 | 
             
              var self                  = this;
         | 
| 43 43 | 
             
              var detailedSettingsShown = false;
         | 
| @@ -58,11 +58,12 @@ function BootstrapCookieConsent(props) { | |
| 58 58 | 
             
                contentURL:             '/assets/data/cookieconsent',                       // URL contain the consent dialogs (modals) for ALL supported languages
         | 
| 59 59 | 
             
                cookieName:             'j1.user.translate',                                // name of the cookie, in which the configuration is stored
         | 
| 60 60 | 
             
                cookieStorageDays:      365,                                                // duration the configuration cookie is stored on the client
         | 
| 61 | 
            -
                postSelectionCallback:   | 
| 61 | 
            +
                postSelectionCallback:  '',                                                 // callback function, called after the user has made his selection
         | 
| 62 62 | 
             
                whitelisted:            [],                                                 // pages NO consent modal dialog is issued
         | 
| 63 63 | 
             
                xhrDataElement:         'consent-data',                                     // src container for all language-specific consent dialogs (taken from contentURL)
         | 
| 64 64 | 
             
                dialogContainerID:      'consent-modal',                                    // dest container, the dialog modal is loaded (dynamically)
         | 
| 65 65 | 
             
                cookieSameSite:         'Strict',                                           // restrict the consent cookie to first-party (do NOT send cookie to other domains)
         | 
| 66 | 
            +
                cookieSecure:           true
         | 
| 66 67 | 
             
              };
         | 
| 67 68 |  | 
| 68 69 | 
             
              // merge property settings
         | 
| @@ -128,6 +129,59 @@ function BootstrapCookieConsent(props) { | |
| 128 129 | 
             
                }
         | 
| 129 130 | 
             
              };
         | 
| 130 131 |  | 
| 132 | 
            +
              // ---------------------------------------------------------------------------
         | 
| 133 | 
            +
              // extend()
         | 
| 134 | 
            +
              // deep merge of two objects
         | 
| 135 | 
            +
              // ---------------------------------------------------------------------------
         | 
| 136 | 
            +
              function extend () {
         | 
| 137 | 
            +
                var extended = {};
         | 
| 138 | 
            +
                var deep = false;
         | 
| 139 | 
            +
                var i = 0;
         | 
| 140 | 
            +
                var length = arguments.length;
         | 
| 141 | 
            +
             | 
| 142 | 
            +
                // Check if a deep merge
         | 
| 143 | 
            +
                if ( Object.prototype.toString.call( arguments[0] ) === '[object Boolean]' ) {
         | 
| 144 | 
            +
                    deep = arguments[0];
         | 
| 145 | 
            +
                    i++;
         | 
| 146 | 
            +
                }
         | 
| 147 | 
            +
             | 
| 148 | 
            +
                // Merge the object into the extended object
         | 
| 149 | 
            +
                var merge = function (obj) {
         | 
| 150 | 
            +
                    for ( var prop in obj ) {
         | 
| 151 | 
            +
                        if ( Object.prototype.hasOwnProperty.call( obj, prop ) ) {
         | 
| 152 | 
            +
                            // If deep merge and property is an object, merge properties
         | 
| 153 | 
            +
                            if ( deep && Object.prototype.toString.call(obj[prop]) === '[object Object]' ) {
         | 
| 154 | 
            +
                                extended[prop] = extend( true, extended[prop], obj[prop] );
         | 
| 155 | 
            +
                            } else {
         | 
| 156 | 
            +
                                extended[prop] = obj[prop];
         | 
| 157 | 
            +
                            }
         | 
| 158 | 
            +
                        }
         | 
| 159 | 
            +
                    }
         | 
| 160 | 
            +
                };
         | 
| 161 | 
            +
             | 
| 162 | 
            +
                // Loop through each object and conduct a merge
         | 
| 163 | 
            +
                for ( ; i < length; i++ ) {
         | 
| 164 | 
            +
                    var obj = arguments[i];
         | 
| 165 | 
            +
                    merge(obj);
         | 
| 166 | 
            +
                 }
         | 
| 167 | 
            +
                       return extended;
         | 
| 168 | 
            +
              }
         | 
| 169 | 
            +
             | 
| 170 | 
            +
              // ---------------------------------------------------------------------------
         | 
| 171 | 
            +
              // executeFunctionByName()
         | 
| 172 | 
            +
              // execute a function by NAME (functionName) in a browser context
         | 
| 173 | 
            +
              // (e.g. window) the function is published
         | 
| 174 | 
            +
              // ---------------------------------------------------------------------------
         | 
| 175 | 
            +
              function executeFunctionByName (functionName, context /*, args */) {
         | 
| 176 | 
            +
                var args = Array.prototype.slice.call(arguments, 2);
         | 
| 177 | 
            +
                var namespaces = functionName.split('.');
         | 
| 178 | 
            +
                var func = namespaces.pop();
         | 
| 179 | 
            +
                for(var i = 0; i < namespaces.length; i++) {
         | 
| 180 | 
            +
                  context = context[namespaces[i]];
         | 
| 181 | 
            +
                }
         | 
| 182 | 
            +
                return context[func].apply(context, args);
         | 
| 183 | 
            +
              }
         | 
| 184 | 
            +
             | 
| 131 185 | 
             
              function showDialog(options) {
         | 
| 132 186 | 
             
                Events.documentReady(function () {
         | 
| 133 187 |  | 
| @@ -143,11 +197,17 @@ function BootstrapCookieConsent(props) { | |
| 143 197 | 
             
                    document.body.append(self.modal);
         | 
| 144 198 | 
             
                    self.$modal = $(self.modal);
         | 
| 145 199 |  | 
| 146 | 
            -
                     | 
| 147 | 
            -
             | 
| 148 | 
            -
             | 
| 149 | 
            -
             | 
| 150 | 
            -
                     | 
| 200 | 
            +
                    // ---------------------------------------------------------------------
         | 
| 201 | 
            +
                    // register events for the dialog (modal)
         | 
| 202 | 
            +
                    // ---------------------------------------------------------------------
         | 
| 203 | 
            +
             | 
| 204 | 
            +
                    // ---------------------------------------------------------------------
         | 
| 205 | 
            +
                    // on 'hidden'
         | 
| 206 | 
            +
                    // ---------------------------------------------------------------------
         | 
| 207 | 
            +
                    self.$modal.on('hidden.bs.modal', function () {
         | 
| 208 | 
            +
                      // process settings after the user has made his selections
         | 
| 209 | 
            +
                      executeFunctionByName (self.props.postSelectionCallback, window);
         | 
| 210 | 
            +
                    }); // END modal on 'hidden'
         | 
| 151 211 |  | 
| 152 212 | 
             
                    // load modal content
         | 
| 153 213 | 
             
                    //
         | 
| @@ -253,12 +313,12 @@ function BootstrapCookieConsent(props) { | |
| 253 313 | 
             
              }
         | 
| 254 314 |  | 
| 255 315 | 
             
              function agreeAll() {
         | 
| 256 | 
            -
                Cookie.set(self.props.cookieName, JSON.stringify(gatherOptions(true)), self.props.cookieStorageDays, self.props.cookieSameSite,  | 
| 316 | 
            +
                Cookie.set(self.props.cookieName, JSON.stringify(gatherOptions(true)), self.props.cookieStorageDays, self.props.cookieSameSite, cookieSecure);
         | 
| 257 317 | 
             
                self.$modal.modal('hide');
         | 
| 258 318 | 
             
              }
         | 
| 259 319 |  | 
| 260 320 | 
             
              function doNotAgree() {
         | 
| 261 | 
            -
                Cookie.set(self.props.cookieName, JSON.stringify(gatherOptions(false)), self.props.cookieStorageDays, self.props.cookieSameSite,  | 
| 321 | 
            +
                Cookie.set(self.props.cookieName, JSON.stringify(gatherOptions(false)), self.props.cookieStorageDays, self.props.cookieSameSite, cookieSecure);
         | 
| 262 322 |  | 
| 263 323 | 
             
                // jadams, 2021-07-15: all cookies NOT longer supported by j1.expireCookie
         | 
| 264 324 | 
             
                // TODO: Create loop over all cookies found in page
         | 
| @@ -271,7 +331,7 @@ function BootstrapCookieConsent(props) { | |
| 271 331 | 
             
              }
         | 
| 272 332 |  | 
| 273 333 | 
             
              function saveSettings() {
         | 
| 274 | 
            -
                Cookie.set(self.props.cookieName, JSON.stringify(gatherOptions()), self.props.cookieStorageDays, self.props.cookieSameSite,  | 
| 334 | 
            +
                Cookie.set(self.props.cookieName, JSON.stringify(gatherOptions()), self.props.cookieStorageDays, self.props.cookieSameSite, cookieSecure);
         | 
| 275 335 | 
             
                self.$modal.modal('hide');
         | 
| 276 336 | 
             
              }
         | 
| 277 337 |  | 
| @@ -467,16 +467,17 @@ function Translator(props) { | |
| 467 467 |  | 
| 468 468 | 
             
              // ---------------------------------------------------------------------------
         | 
| 469 469 | 
             
              // agreeAll()
         | 
| 470 | 
            -
              // process current settings from checkboxes for button  | 
| 470 | 
            +
              // process current settings from checkboxes for button 'agreeAll'
         | 
| 471 | 
            +
              // On 'agreeAll', enable ALL settings required for translation
         | 
| 471 472 | 
             
              // ---------------------------------------------------------------------------
         | 
| 472 473 | 
             
              function agreeAll() {
         | 
| 473 | 
            -
                var  | 
| 474 | 
            -
                var consentSettings | 
| 474 | 
            +
                var translationSettings = gatherOptions(true);
         | 
| 475 | 
            +
                var consentSettings     = {};
         | 
| 475 476 |  | 
| 476 | 
            -
                settings | 
| 477 | 
            +
                // enable and write all settings required for translation (consent cookie)
         | 
| 477 478 | 
             
                consentSettings                 = JSON.parse(Cookie.get(self.props.cookieConsentName));
         | 
| 478 | 
            -
                consentSettings.analysis        =  | 
| 479 | 
            -
                consentSettings.personalization =  | 
| 479 | 
            +
                consentSettings.analysis        = translationSettings.analysis;
         | 
| 480 | 
            +
                consentSettings.personalization = translationSettings.personalization;
         | 
| 480 481 |  | 
| 481 482 | 
             
                Cookie.set(
         | 
| 482 483 | 
             
                  self.props.cookieConsentName,
         | 
| @@ -485,9 +486,11 @@ function Translator(props) { | |
| 485 486 | 
             
                  self.props.sameSite,
         | 
| 486 487 | 
             
                  self.props.secure
         | 
| 487 488 | 
             
                );
         | 
| 489 | 
            +
             | 
| 490 | 
            +
                // enable and write all settings required for translation (translation cookie)
         | 
| 488 491 | 
             
                Cookie.set(
         | 
| 489 492 | 
             
                  self.props.cookieName,
         | 
| 490 | 
            -
                  JSON.stringify( | 
| 493 | 
            +
                  JSON.stringify(translationSettings),
         | 
| 491 494 | 
             
                  self.props.cookieStorageDays,
         | 
| 492 495 | 
             
                  self.props.sameSite,
         | 
| 493 496 | 
             
                  self.props.secure
         | 
| @@ -12,4 +12,4 @@ | |
| 12 12 | 
             
             #  See: https://github.com/jekyll-one/J1 Template/blob/master/LICENSE
         | 
| 13 13 | 
             
             # -----------------------------------------------------------------------------
         | 
| 14 14 | 
             
            */
         | 
| 15 | 
            -
            function Translator(d){var p=this;var u=log4javascript.getLogger("j1.core.translator");var l=new liteURL(window.location.href);var c=(l.protocol.includes("https"))?true:false;var q=false;var g;var s;this.props={contentURL:"/assets/data/translator",cookieName:"j1.user.state",cookieConsentName:"j1.user.consent",cookieStorageDays:365,cookieSameSite:"Strict",cookieSecure:c,translationEnabled:false,disableLanguageSelector:false,translatorName:"google",translationLanguages:"all",translationLanguage:"auto",translateAllPages:true,hideSuggestionBox:true,hidePoweredBy:true,hideTopFrame:true,dialogLanguage:"content",dialogLanguages:["en","de"],dialogContainerID:"translator-modal",xhrDataElement:"",postSelectionCallback:"",};for(var e in d){this.props[e]=d[e]}if(this.props.dialogLanguage.indexOf("-")!==-1){this.props.dialogLanguage=this.props.dialogLanguage.split("-")[0]}if(!this.props.dialogLanguages.includes(this.props.dialogLanguage)){this.props.dialogLanguage=this.props.dialogLanguages[0]}this.props.xhrDataElement=this.props.xhrDataElement+"-"+this.props.dialogLanguage;u.info("\ninitializing core module: started");u.info("\nstate: started");var f={set:function(x,z,C,y,A){var B=window.btoa(z);var v="";if(C){var w=new Date();w.setTime(w.getTime()+(C*24*60*60*1000));v="; expires="+w.toUTCString()}if(A){document.cookie=x+"="+(B||"")+v+"; Path=/; SameSite="+y+"; secure="+A+";"}else{document.cookie=x+"="+(B||"")+v+"; Path=/; SameSite="+y+";"}},get:function(w){var z=w+"=";var v=document.cookie.split(";");for(var x=0;x<v.length;x++){var B=v[x];while(B.charAt(0)===" "){B=B.substring(1,B.length)}if(B.indexOf(z)===0){var A=B.substring(z.length,B.length);var y=window.atob(A);return y}}return undefined}};var n={documentReady:function(v){if(document.readyState!=="loading"){v()}else{document.addEventListener("DOMContentLoaded",v)}}};function t(){var v={};var w=false;var x=0;var y=arguments.length;if(Object.prototype.toString.call(arguments[0])==="[object Boolean]"){w=arguments[0];x++}var A=function(B){for(var C in B){if(Object.prototype.hasOwnProperty.call(B,C)){if(w&&Object.prototype.toString.call(B[C])==="[object Object]"){v[C]=t(true,v[C],B[C])}else{v[C]=B[C]}}}};for(;x<y;x++){var z=arguments[x];A(z)}return v}function h(A,x){var v=Array.prototype.slice.call(arguments,2);var z=A.split(".");var y=z.pop();for(var w=0;w<z.length;w++){x=x[z[w]]}return x[y].apply(x,v)}function j(w){var v;var x=t({size:0,width:250,multiple:false,selectedIndex:1,enableAutoFilter:false,visibleRows:null,},w);v="#"+x.selector;$.ajax({url:x.url,dataType:"json",success:function(A){var z=[];if(p.props.translationLanguages.includes("all")){z=A[x.elm]}else{for(var y=0;y<A[x.elm].length;y++){if(p.props.translationLanguages.includes(A[x.elm][y].value)){z.push(A[x.elm][y])}}}if(x.visibleRows>z.length){x.visibleRows=z.length}MsDropdown.make(v,{byJson:{data:z,name:x.name,size:x.size,width:x.width,multiple:x.multiple,},enableAutoFilter:x.enableAutoFilter,visibleRows:x.visibleRows,})},error:function(y,A,z){u.error("\nfailed to retrieve JSON data from: "+x.url)}})}function m(){n.documentReady(function(){p.modal=document.getElementById(p.props.dialogContainerID);if(!p.modal){u.info("\nload consent modal");p.modal=document.createElement("div");p.modal.id=p.props.dialogContainerID;p.modal.setAttribute("class","modal fade");p.modal.setAttribute("tabindex","-1");p.modal.setAttribute("role","dialog");p.modal.setAttribute("aria-labelledby",p.props.dialogContainerID);document.body.append(p.modal);p.$modal=$(p.modal);p.$modal.on("show.bs.modal",function(){var w;var x;u.info("\nshow.bs.modal: entered");$.when(j({url:"/assets/data/iso-639-language-codes-flags.json",elm:"iso-639-languages",selector:"dropdownJSON",width:400,visibleRows:8,})).then(function(y){u.info("\ncreating msDropdown from JSON data: finished")})});p.$modal.on("shown.bs.modal",function(){var w=document.getElementById("dropdownJSON").msDropdown;if(!w.length){u.error("\nno msDropdown found in translation dialog");p.$modal.hide()}else{if(p.props.translationLanguage==="auto"){g=navigator.language||navigator.userLanguage;s=g.split("-")[0]}w.selectedIndex=$("#dropdownJSON option[value="+s+"]").index();if(p.props.disableLanguageSelector){w.disabled=true}$("#dropdownJSON").show();$("body").addClass("stop-scrolling")}});p.$modal.on("hidden.bs.modal",function(){$("body").removeClass("stop-scrolling");h(p.props.postSelectionCallback,window)});var v=p.props.contentURL+"/index.html";$.get(v).done(function(w){u.info("\nloading consent modal: successfully");p.modal.innerHTML=w;p.modal.innerHTML=$("#"+p.props.xhrDataElement).eq(0).html();$(p.modal).modal({backdrop:"static",keyboard:false});p.$buttonDoNotAgree=$("#translator-buttonDoNotAgree");p.$buttonAgree=$("#translator-buttonAgree");p.$buttonSave=$("#translator-buttonSave");p.$buttonAgreeAll=$("#translator-buttonAgreeAll");u.info("\nload/initialze options from cookie");k();i();$("#google-options").on("hide.bs.collapse",function(){q=false;k()}).on("show.bs.collapse",function(){q=true;k()});u.info("\ninitialze button event handler");p.$buttonDoNotAgree.click(function(){b()});p.$buttonAgree.click(function(){o()});p.$buttonSave.click(function(){$("#google-options").collapse("hide");r();i()});p.$buttonAgreeAll.click(function(){$("#google-options").collapse("hide");o()})}).fail(function(){u.error("\nloading translator dialog (modal): failed");u.warn("\nprobably no|wrong `contentURL` set")})}else{p.$modal.modal("show")}}.bind(this))}function i(){var x=p.getSettings();if(x){for(var w in x){var v=p.$modal.find("#google-options .translator-option[data-name="+w+'] input[type="checkbox"]');v.prop("checked",x[w])}}}function k(){if(q){p.$buttonDoNotAgree.hide();p.$buttonAgree.hide();p.$buttonSave.show();p.$buttonAgreeAll.show()}else{p.$buttonDoNotAgree.show();p.$buttonAgree.show();p.$buttonSave.hide();p.$buttonAgreeAll.hide()}}function a(w){var v=p.$modal.find("#google-options .translator-option");var y={};for(var z=0;z<v.length;z++){var B=v[z];var x=B.getAttribute("data-name");if(x==="necessary"){y[x]=true}else{if(w===undefined){var A=$(B).find('input[type="checkbox"]');y[x]=A.prop("checked")}else{y[x]=!!w}}}return y}function o(){var w;var v={}; | 
| 15 | 
            +
            function Translator(d){var p=this;var u=log4javascript.getLogger("j1.core.translator");var l=new liteURL(window.location.href);var c=(l.protocol.includes("https"))?true:false;var q=false;var g;var s;this.props={contentURL:"/assets/data/translator",cookieName:"j1.user.state",cookieConsentName:"j1.user.consent",cookieStorageDays:365,cookieSameSite:"Strict",cookieSecure:c,translationEnabled:false,disableLanguageSelector:false,translatorName:"google",translationLanguages:"all",translationLanguage:"auto",translateAllPages:true,hideSuggestionBox:true,hidePoweredBy:true,hideTopFrame:true,dialogLanguage:"content",dialogLanguages:["en","de"],dialogContainerID:"translator-modal",xhrDataElement:"",postSelectionCallback:"",};for(var e in d){this.props[e]=d[e]}if(this.props.dialogLanguage.indexOf("-")!==-1){this.props.dialogLanguage=this.props.dialogLanguage.split("-")[0]}if(!this.props.dialogLanguages.includes(this.props.dialogLanguage)){this.props.dialogLanguage=this.props.dialogLanguages[0]}this.props.xhrDataElement=this.props.xhrDataElement+"-"+this.props.dialogLanguage;u.info("\ninitializing core module: started");u.info("\nstate: started");var f={set:function(x,z,C,y,A){var B=window.btoa(z);var v="";if(C){var w=new Date();w.setTime(w.getTime()+(C*24*60*60*1000));v="; expires="+w.toUTCString()}if(A){document.cookie=x+"="+(B||"")+v+"; Path=/; SameSite="+y+"; secure="+A+";"}else{document.cookie=x+"="+(B||"")+v+"; Path=/; SameSite="+y+";"}},get:function(w){var z=w+"=";var v=document.cookie.split(";");for(var x=0;x<v.length;x++){var B=v[x];while(B.charAt(0)===" "){B=B.substring(1,B.length)}if(B.indexOf(z)===0){var A=B.substring(z.length,B.length);var y=window.atob(A);return y}}return undefined}};var n={documentReady:function(v){if(document.readyState!=="loading"){v()}else{document.addEventListener("DOMContentLoaded",v)}}};function t(){var v={};var w=false;var x=0;var y=arguments.length;if(Object.prototype.toString.call(arguments[0])==="[object Boolean]"){w=arguments[0];x++}var A=function(B){for(var C in B){if(Object.prototype.hasOwnProperty.call(B,C)){if(w&&Object.prototype.toString.call(B[C])==="[object Object]"){v[C]=t(true,v[C],B[C])}else{v[C]=B[C]}}}};for(;x<y;x++){var z=arguments[x];A(z)}return v}function h(A,x){var v=Array.prototype.slice.call(arguments,2);var z=A.split(".");var y=z.pop();for(var w=0;w<z.length;w++){x=x[z[w]]}return x[y].apply(x,v)}function j(w){var v;var x=t({size:0,width:250,multiple:false,selectedIndex:1,enableAutoFilter:false,visibleRows:null,},w);v="#"+x.selector;$.ajax({url:x.url,dataType:"json",success:function(A){var z=[];if(p.props.translationLanguages.includes("all")){z=A[x.elm]}else{for(var y=0;y<A[x.elm].length;y++){if(p.props.translationLanguages.includes(A[x.elm][y].value)){z.push(A[x.elm][y])}}}if(x.visibleRows>z.length){x.visibleRows=z.length}MsDropdown.make(v,{byJson:{data:z,name:x.name,size:x.size,width:x.width,multiple:x.multiple,},enableAutoFilter:x.enableAutoFilter,visibleRows:x.visibleRows,})},error:function(y,A,z){u.error("\nfailed to retrieve JSON data from: "+x.url)}})}function m(){n.documentReady(function(){p.modal=document.getElementById(p.props.dialogContainerID);if(!p.modal){u.info("\nload consent modal");p.modal=document.createElement("div");p.modal.id=p.props.dialogContainerID;p.modal.setAttribute("class","modal fade");p.modal.setAttribute("tabindex","-1");p.modal.setAttribute("role","dialog");p.modal.setAttribute("aria-labelledby",p.props.dialogContainerID);document.body.append(p.modal);p.$modal=$(p.modal);p.$modal.on("show.bs.modal",function(){var w;var x;u.info("\nshow.bs.modal: entered");$.when(j({url:"/assets/data/iso-639-language-codes-flags.json",elm:"iso-639-languages",selector:"dropdownJSON",width:400,visibleRows:8,})).then(function(y){u.info("\ncreating msDropdown from JSON data: finished")})});p.$modal.on("shown.bs.modal",function(){var w=document.getElementById("dropdownJSON").msDropdown;if(!w.length){u.error("\nno msDropdown found in translation dialog");p.$modal.hide()}else{if(p.props.translationLanguage==="auto"){g=navigator.language||navigator.userLanguage;s=g.split("-")[0]}w.selectedIndex=$("#dropdownJSON option[value="+s+"]").index();if(p.props.disableLanguageSelector){w.disabled=true}$("#dropdownJSON").show();$("body").addClass("stop-scrolling")}});p.$modal.on("hidden.bs.modal",function(){$("body").removeClass("stop-scrolling");h(p.props.postSelectionCallback,window)});var v=p.props.contentURL+"/index.html";$.get(v).done(function(w){u.info("\nloading consent modal: successfully");p.modal.innerHTML=w;p.modal.innerHTML=$("#"+p.props.xhrDataElement).eq(0).html();$(p.modal).modal({backdrop:"static",keyboard:false});p.$buttonDoNotAgree=$("#translator-buttonDoNotAgree");p.$buttonAgree=$("#translator-buttonAgree");p.$buttonSave=$("#translator-buttonSave");p.$buttonAgreeAll=$("#translator-buttonAgreeAll");u.info("\nload/initialze options from cookie");k();i();$("#google-options").on("hide.bs.collapse",function(){q=false;k()}).on("show.bs.collapse",function(){q=true;k()});u.info("\ninitialze button event handler");p.$buttonDoNotAgree.click(function(){b()});p.$buttonAgree.click(function(){o()});p.$buttonSave.click(function(){$("#google-options").collapse("hide");r();i()});p.$buttonAgreeAll.click(function(){$("#google-options").collapse("hide");o()})}).fail(function(){u.error("\nloading translator dialog (modal): failed");u.warn("\nprobably no|wrong `contentURL` set")})}else{p.$modal.modal("show")}}.bind(this))}function i(){var x=p.getSettings();if(x){for(var w in x){var v=p.$modal.find("#google-options .translator-option[data-name="+w+'] input[type="checkbox"]');v.prop("checked",x[w])}}}function k(){if(q){p.$buttonDoNotAgree.hide();p.$buttonAgree.hide();p.$buttonSave.show();p.$buttonAgreeAll.show()}else{p.$buttonDoNotAgree.show();p.$buttonAgree.show();p.$buttonSave.hide();p.$buttonAgreeAll.hide()}}function a(w){var v=p.$modal.find("#google-options .translator-option");var y={};for(var z=0;z<v.length;z++){var B=v[z];var x=B.getAttribute("data-name");if(x==="necessary"){y[x]=true}else{if(w===undefined){var A=$(B).find('input[type="checkbox"]');y[x]=A.prop("checked")}else{y[x]=!!w}}}return y}function o(){var w=a(true);var v={};v=JSON.parse(f.get(p.props.cookieConsentName));v.analysis=w.analysis;v.personalization=w.personalization;f.set(p.props.cookieConsentName,JSON.stringify(v),p.props.cookieStorageDays,p.props.sameSite,p.props.secure);f.set(p.props.cookieName,JSON.stringify(w),p.props.cookieStorageDays,p.props.sameSite,p.props.secure);p.$modal.modal("hide")}function b(){var v=a();v.translationEnabled=false;f.set(p.props.cookieName,JSON.stringify(v),p.props.cookieStorageDays,p.props.sameSite,p.props.secure);p.$modal.modal("hide")}function r(){var w;var v={};w=a();v=JSON.parse(f.get(p.props.cookieConsentName));v.analysis=w.analysis;v.personalization=w.personalization;f.set(p.props.cookieConsentName,JSON.stringify(v),p.props.cookieStorageDays,p.props.sameSite,p.props.secure);f.set(p.props.cookieName,JSON.stringify(a()),p.props.cookieStorageDays,p.props.sameSite,p.props.secure);p.$modal.modal("hide")}this.showDialog=function(){m()};this.getSettings=function(w){var v=f.get(p.props.cookieName);if(v){var x=JSON.parse(f.get(p.props.cookieName));if(w===undefined){return x}else{if(x){return x[w]}else{return false}}}else{return undefined}};u.info("\ninitializing core module finished");u.info("\nstate: finished")};
         | 
    
        data/lib/j1/version.rb
    CHANGED
    
    
    
        data/lib/starter_web/Gemfile
    CHANGED
    
    | @@ -53,7 +53,7 @@ gem 'jekyll', '~> 4.2' | |
| 53 53 |  | 
| 54 54 | 
             
            # Theme Rubies, default: J1 Template (NOT used for the development system)
         | 
| 55 55 | 
             
            #
         | 
| 56 | 
            -
            gem 'j1-template', '~> 2021.2. | 
| 56 | 
            +
            gem 'j1-template', '~> 2021.2.10'
         | 
| 57 57 |  | 
| 58 58 | 
             
            # ------------------------------------------------------------------------------
         | 
| 59 59 | 
             
            # PRODUCTION: Gem needed for the Jekyll and J1 prod environment
         | 
    
        data/lib/starter_web/_config.yml
    CHANGED
    
    | @@ -53,7 +53,7 @@ environment:                            development | |
| 53 53 | 
             
            # ------------------------------------------------------------------------------
         | 
| 54 54 | 
             
            #   Sets the build version of J1 Template Gem
         | 
| 55 55 | 
             
            #
         | 
| 56 | 
            -
            version:                                2021.2. | 
| 56 | 
            +
            version:                                2021.2.10
         | 
| 57 57 |  | 
| 58 58 | 
             
            # version
         | 
| 59 59 | 
             
            # ------------------------------------------------------------------------------
         | 
| @@ -25,6 +25,8 @@ about_config: | |
| 25 25 | 
             
            defaults:
         | 
| 26 26 |  | 
| 27 27 | 
             
              enabled:                              false
         | 
| 28 | 
            +
             | 
| 29 | 
            +
              reloadPageOnChange:                   true
         | 
| 28 30 | 
             
              autoShowDialog:                       true                                    # show consent dialog if NO consent cookie found
         | 
| 29 31 | 
             
              dialogLanguage:                       content                                 # auto|content|one of dialogLanguages
         | 
| 30 32 | 
             
              dialogLanguages:                      [en, de]                                # supported dialog (modal) languages, defaults to FIRST language defined by languages
         | 
| @@ -36,7 +38,7 @@ defaults: | |
| 36 38 | 
             
              whitelisted:                          [ '/pages/public/legal/en/privacy' ]    # pages NO consent issued, currently NOT supported
         | 
| 37 39 | 
             
              xhrDataElement:                       consent-data                            # container for all language-specific consent modals (taken from contentURL)
         | 
| 38 40 | 
             
              dialogContainerID:                    consent-dialog                          # container, the dialog modal is (dynamically) loaded
         | 
| 39 | 
            -
              postSelectionCallback:                j1.adapter.cookieConsent.cbCookie       #  | 
| 41 | 
            +
              postSelectionCallback:                j1.adapter.cookieConsent.cbCookie       # called after the user has made his selection
         | 
| 40 42 |  | 
| 41 43 | 
             
              modal_settings:
         | 
| 42 44 |  | 
| @@ -46,7 +46,7 @@ defaults: | |
| 46 46 | 
             
            #
         | 
| 47 47 | 
             
              google:
         | 
| 48 48 |  | 
| 49 | 
            -
                postSelectionCallback:               | 
| 49 | 
            +
                postSelectionCallback:              j1.adapter.translator.cbGoogle          # callback to run the translation
         | 
| 50 50 | 
             
                hideSuggestionBox:                  true                                    # disable suggestions on translated text
         | 
| 51 51 | 
             
                hidePoweredBy:                      true                                    # disable label "Powered by Google"
         | 
| 52 52 | 
             
                hideTopFrame:                       true                                    # disable the (google) translator frame
         | 
| @@ -433,7 +433,7 @@ end::tables[] | |
| 433 433 | 
             
            // -----------------------------------------------------------------------------
         | 
| 434 434 | 
             
            tag::products[]
         | 
| 435 435 | 
             
            :j1--license:                                     MIT License
         | 
| 436 | 
            -
            :j1--version:                                     2021.2. | 
| 436 | 
            +
            :j1--version:                                     2021.2.10
         | 
| 437 437 | 
             
            :j1--site-name:                                   Jekyll One
         | 
| 438 438 | 
             
            end::products[]
         | 
| 439 439 |  | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: j1-template
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 2021.2. | 
| 4 | 
            +
              version: 2021.2.10
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - juergen_jekyll_one
         | 
| 8 8 | 
             
            autorequire:
         | 
| 9 9 | 
             
            bindir: exe
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2021-10- | 
| 11 | 
            +
            date: 2021-10-31 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: jekyll
         | 
| @@ -400,6 +400,7 @@ files: | |
| 400 400 | 
             
            - assets/themes/j1/adapter/js/rtextResizer.js
         | 
| 401 401 | 
             
            - assets/themes/j1/adapter/js/themer.js
         | 
| 402 402 | 
             
            - assets/themes/j1/adapter/js/toccer.js
         | 
| 403 | 
            +
            - assets/themes/j1/adapter/js/translator.1.js
         | 
| 403 404 | 
             
            - assets/themes/j1/adapter/js/translator.js
         | 
| 404 405 | 
             
            - assets/themes/j1/core/country-flags/1x1/ad.svg
         | 
| 405 406 | 
             
            - assets/themes/j1/core/country-flags/1x1/ae.svg
         |