<commit_before>#= require cookieconsent

if window.folioCookieConsentConfiguration
  bindTurbolinks = Turbolinks?

  if bindTurbolinks
    detached = null

    onLoad = ->
      if detached
        $('body').append(detached)
        detached = null

    onBeforeRender = ->
      $main = $('#cc--main')
      return unless $main.length
      detached = $main.detach()

  onAccept = (cookie) ->
    if bindTurbolinks
      bindTurbolinks = false

      $(document)
        .off 'turbolinks:load', onLoad
        .off 'turbolinks:before-render', onBeforeRender

    if window.dataLayer
      window.dataLayer.push
        event: 'cookieConsent'
        level: cookie.level

  window.folioCookieConsent = initCookieConsent()

  window.folioCookieConsent.run(Object.assign({}, window.folioCookieConsentConfiguration, { onAccept: onAccept }))

  if bindTurbolinks
    $(document)
      .on 'turbolinks:load', onLoad
      .on 'turbolinks:before-render', onBeforeRender<commit_msg>bind f-cookie-consent-link to open settings<commit_after>#= require cookieconsent

if window.folioCookieConsentConfiguration
  bindTurbolinks = Turbolinks?

  if bindTurbolinks
    detached = null

    onLoad = ->
      if detached
        $('body').append(detached)
        detached = null

    onBeforeRender = ->
      $main = $('#cc--main')
      return unless $main.length
      detached = $main.detach()

  onAccept = (cookie) ->
    if bindTurbolinks
      bindTurbolinks = false

      $(document)
        .off 'turbolinks:load', onLoad
        .off 'turbolinks:before-render', onBeforeRender

    if window.dataLayer
      window.dataLayer.push
        event: 'cookieConsent'
        level: cookie.level

  window.folioCookieConsent = initCookieConsent()

  window.folioCookieConsent.run(Object.assign({}, window.folioCookieConsentConfiguration, { onAccept: onAccept }))

  if bindTurbolinks
    $(document)
      .on 'turbolinks:load', onLoad
      .on 'turbolinks:before-render', onBeforeRender

  $(document).on 'click', '.f-cookie-consent-link', (e) ->
    e.preventDefault()
    window.folioCookieConsent.showSettings()
{'fraction_non_alphanumeric': 0.11005692599620494, 'fraction_numerical': 0.0, 'mean_word_length': 3.001897533206831, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 10, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4327586', 'n_tokens_mistral': 656, 'n_tokens_neox': 647, 'n_words': 129}