Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-74675

[yandex-metrica] Extract inline script block in jenkins/plugin/yandex/metrica/YandexMetricaPageDecorator/header.jelly

XMLWordPrintable

      Problem

      == Inline Script Block
      Line: 4
      ----
      <script type="text/javascript">
                  (function (d, w, c) {
                      (w[c] = w[c] || []).push(function() {
                          try {
                              w.yaCounter${it.counterId} = new Ya.Metrika({
                                  id:${it.counterId},
                                  clickmap:true,
                                  trackLinks:true,
                                  accurateTrackBounce:true,
                                  webvisor:true,
                                  trackHash:true
                              });
                          } catch(e) { }
                      });
      
                      var n = d.getElementsByTagName("script")[0],
                          s = d.createElement("script"),
                          f = function () { n.parentNode.insertBefore(s, n); };
                      s.type = "text/javascript";
                      s.async = true;
                      s.src = "https://mc.yandex.ru/metrika/watch.js";
      
                      if (w.opera == "[object Opera]") {
                          d.addEventListener("DOMContentLoaded", f, false);
                      } else { f(); }
                  })(document, window, "yandex_metrika_callbacks");
              </script>
      ----
      

      Solution

      https://www.jenkins.io/doc/developer/security/csp/#inline-javascript-blocks

            Unassigned Unassigned
            basil Basil Crow
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: