Sha256: 80c99b55bbc00f00f9d17e6d8f8f2ee6e9c31ad413c46858ade5b83fec064e9d

Contents?: true

Size: 1019 Bytes

Versions: 10

Compression:

Stored size: 1019 Bytes

Contents

(function() {
  var marker = document.getElementsByTagName('script')[0]
  var scripts = [
    '<%= path_to_javascript("govuk_publishing_components/vendor/lux/lux-polyfill") %>',
    '<%= path_to_javascript("govuk_publishing_components/vendor/lux/lux") %>'
  ]
  var parsedCookie = (function() {
    try {
      var cookies = document.cookie.split(';')

      for (var i = 0; i < cookies.length; i++) {
        var cookie = cookies[i].replace(/\s/g, '') // Remove all whitespace.
        var cookieName = 'cookies_policy='

        if (cookie.indexOf(cookieName) === 0) {
          return JSON.parse(cookie.substring(cookieName.length))
        }
      }
    } catch (error) {
      console.error(error)
    }

    return {}
  })()

  if (parsedCookie.usage === true) {
    for (var i = 0; i < scripts.length; i++) {
      var script = document.createElement('script')
      script.src = scripts[i]
      script.async = true
      script.defer = true

      marker.parentNode.insertBefore(script, marker)
    }
  }
})()

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
govuk_publishing_components-24.18.0 app/assets/javascripts/govuk_publishing_components/rum-loader.js.erb
govuk_publishing_components-24.17.0 app/assets/javascripts/govuk_publishing_components/rum-loader.js.erb
govuk_publishing_components-24.16.1 app/assets/javascripts/govuk_publishing_components/rum-loader.js.erb
govuk_publishing_components-24.16.0 app/assets/javascripts/govuk_publishing_components/rum-loader.js.erb
govuk_publishing_components-24.15.3 app/assets/javascripts/govuk_publishing_components/rum-loader.js.erb
govuk_publishing_components-24.15.2 app/assets/javascripts/govuk_publishing_components/rum-loader.js.erb
govuk_publishing_components-24.15.1 app/assets/javascripts/govuk_publishing_components/rum-loader.js.erb
govuk_publishing_components-24.15.0 app/assets/javascripts/govuk_publishing_components/rum-loader.js.erb
govuk_publishing_components-24.14.1 app/assets/javascripts/govuk_publishing_components/rum-loader.js.erb
govuk_publishing_components-24.14.0 app/assets/javascripts/govuk_publishing_components/rum-loader.js.erb