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

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

      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

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

          Basil Crow created issue -
          Basil Crow made changes -
          Assignee Original: Vladislav Bauer [ vbauer ]
          Basil Crow made changes -
          Description Original: h4. Problems

          {noformat}
          == 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>
          ----

          == 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>
          ----
          {noformat}

          h4. Solution

          [https://www.jenkins.io/doc/developer/security/csp/#inline-javascript-blocks]
          New: h4. Problem

          {noformat}
          == 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>
          ----
          {noformat}

          h4. Solution

          [https://www.jenkins.io/doc/developer/security/csp/#inline-javascript-blocks]
          Summary Original: [yandex-metrica] Extract inline script blocks in jenkins/plugin/yandex/metrica/YandexMetricaPageDecorator/header.jelly New: [yandex-metrica] Extract inline script block in jenkins/plugin/yandex/metrica/YandexMetricaPageDecorator/header.jelly

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

              Created:
              Updated: