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

[kryptowire] Extract inline script blocks and event handlers in org/aerogear/kryptowire/BinaryHistoryAction/index.jelly

XMLWordPrintable

      Problems

      == Inline Script Block
      Line: 17
      ----
      <script>
                      <![CDATA[
                          function bootstrap() {
                              var container = document.getElementById('kw-report-links');
                              if (!container) {
                                  return;
                              }
                              var links = container.getElementsByTagName("a");
                              for (var i = 0; i < links.length; i++) {
                                  var link = links[i];
                                  link.addEventListener('click', function(e) {
                                      e.preventDefault();
                                      var index = this.dataset.index;
                                      select(links, index);
                                  });
                              }
      
                          }
                          function select(links, index) {
                              var content = document.getElementById('kw-pdf-content');
                              for (var i = 0; i < links.length; i++) {
                                  if (i == index) {
                                      links[i].setAttribute("class", "selected");
                                  } else {
                                      links[i].setAttribute("class", "");
                                  }
                                  content.innerHTML = [
                                      '<embed',
                                      'src="' + links[i].getAttribute('href') + '"',
                                      'width="600"',
                                      'height="500"',
                                      'alt="pdf"',
                                      'pluginspage="http://www.adobe.com/products/acrobat/readstep2.html"',
                                      '/>'
                                  ].join(' ');
                              }
                          }
                      ]]>
                  </script>
      ----
      
      == Inline Script Block
      Line: 126
      ----
      <script>
                  <![CDATA[
                      bootstrap();
                  ]]>
                  </script>
      ----
      
      == Inline Event Handler
      Line: 104
      ----
      <a style="color:#204A87" data-index="0" target="_blank" onclick="select(this, 0)" href="${it.reportPath}" class="selected">
      ----
      
      == Inline Event Handler
      Line: 106
      ----
      <a style="color:#204A87" data-index="1" target="_blank" onclick="select(this, 1)" href="${it.NIAPReportPath}">
      ----
      

      Solutions

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

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

              Created:
              Updated: