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

[xpath-config-viewer] Extract inline script block in WEB-INF/classes/org/jenkinsci/plugins/viewer/XPathConfigViewerPlugin/index.jelly

      Problem

      == Inline Script Block
      Line: 28
      ----
      <script type="text/javascript">
              function toggleAll(action) {
                  var xmlBlocks = [];
                  <j:forEach var="provider" items="${it.providers}">
                      <j:forEach var="conf" items="${provider.allConfigs}">
                          <util:replace value="${conf.id}" var="classId" old="." new="_" />
                  xmlBlocks.push("${classId}"); 
                      </j:forEach>
                  </j:forEach>
                  
                  if(action == "hide") {
                      for(var i = 0; i &lt; xmlBlocks.length; i++) {
                          $$("." + xmlBlocks[i]).each(Element.hide);
                          $$("." + xmlBlocks[i] + "a").each(Element.show);
                      }
                  } else {
                      for(var i = 0; i &lt; xmlBlocks.length; i++) {
                          $$("." + xmlBlocks[i] + "a").each(Element.hide);
                          $$("." + xmlBlocks[i]).each(Element.show);
                      }
                  }                        
              }
              
              
          </script>
      ----
      

      Solution

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

          [JENKINS-74558] [xpath-config-viewer] Extract inline script block in WEB-INF/classes/org/jenkinsci/plugins/viewer/XPathConfigViewerPlugin/index.jelly

          Basil Crow created issue -
          Basil Crow made changes -
          Description Original: h4. Problems

          {noformat}
          == Inline Script Block
          Line: 28
          ----
          <script type="text/javascript">
                  function toggleAll(action) {
                      var xmlBlocks = [];
                      <j:forEach var="provider" items="${it.providers}">
                          <j:forEach var="conf" items="${provider.allConfigs}">
                              <util:replace value="${conf.id}" var="classId" old="." new="_" />
                      xmlBlocks.push("${classId}");
                          </j:forEach>
                      </j:forEach>
                      
                      if(action == "hide") {
                          for(var i = 0; i &lt; xmlBlocks.length; i++) {
                              $$("." + xmlBlocks[i]).each(Element.hide);
                              $$("." + xmlBlocks[i] + "a").each(Element.show);
                          }
                      } else {
                          for(var i = 0; i &lt; xmlBlocks.length; i++) {
                              $$("." + xmlBlocks[i] + "a").each(Element.hide);
                              $$("." + xmlBlocks[i]).each(Element.show);
                          }
                      }
                  }
                  
                  
              </script>
          ----

          == Inline Script Block
          Line: 28
          ----
          <script type="text/javascript">
                  function toggleAll(action) {
                      var xmlBlocks = [];
                      <j:forEach var="provider" items="${it.providers}">
                          <j:forEach var="conf" items="${provider.allConfigs}">
                              <util:replace value="${conf.id}" var="classId" old="." new="_" />
                      xmlBlocks.push("${classId}");
                          </j:forEach>
                      </j:forEach>
                      
                      if(action == "hide") {
                          for(var i = 0; i &lt; xmlBlocks.length; i++) {
                              $$("." + xmlBlocks[i]).each(Element.hide);
                              $$("." + xmlBlocks[i] + "a").each(Element.show);
                          }
                      } else {
                          for(var i = 0; i &lt; xmlBlocks.length; i++) {
                              $$("." + xmlBlocks[i] + "a").each(Element.hide);
                              $$("." + xmlBlocks[i]).each(Element.show);
                          }
                      }
                  }
                  
                  
              </script>
          ----
          {noformat}

          h4. Solution

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

          {noformat}
          == Inline Script Block
          Line: 28
          ----
          <script type="text/javascript">
                  function toggleAll(action) {
                      var xmlBlocks = [];
                      <j:forEach var="provider" items="${it.providers}">
                          <j:forEach var="conf" items="${provider.allConfigs}">
                              <util:replace value="${conf.id}" var="classId" old="." new="_" />
                      xmlBlocks.push("${classId}");
                          </j:forEach>
                      </j:forEach>
                      
                      if(action == "hide") {
                          for(var i = 0; i &lt; xmlBlocks.length; i++) {
                              $$("." + xmlBlocks[i]).each(Element.hide);
                              $$("." + xmlBlocks[i] + "a").each(Element.show);
                          }
                      } else {
                          for(var i = 0; i &lt; xmlBlocks.length; i++) {
                              $$("." + xmlBlocks[i] + "a").each(Element.hide);
                              $$("." + xmlBlocks[i]).each(Element.show);
                          }
                      }
                  }
                  
                  
              </script>
          ----
          {noformat}

          h4. Solution

          [https://www.jenkins.io/doc/developer/security/csp/#inline-javascript-blocks]
          Summary Original: [xpath-config-viewer] Extract inline script blocks in WEB-INF/classes/org/jenkinsci/plugins/viewer/XPathConfigViewerPlugin/index.jelly New: [xpath-config-viewer] Extract inline script block in WEB-INF/classes/org/jenkinsci/plugins/viewer/XPathConfigViewerPlugin/index.jelly

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

              Created:
              Updated: