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

[image-gallery] Extract inline script block in org/jenkinsci/plugins/imagegallery/comparative/ComparativeImagesGalleryBuildAction/summary.jelly

XMLWordPrintable

      Note

      While testing this plugin, evaluate whether the third-party libraries in src/main/webapp are compatible with CSP in restrictive mode. The plugin may need to be upgraded from jQuery 1.x to 3.x to fully function in CSP restrictive mode.

      Problem

      == Inline Script Block
      Line: 6
      ----
      <script type="text/javascript">
          jQuery.noConflict();
          jQuery(document).ready(function(){
            jQuery("a.leaf").each(function(idx, el) {
              var html = jQuery(el).clone().find('img').attr("width", ${from.imageInnerWidthText}).end().html();
      
                jQuery(el).colorbox({
                    inline: false,
                    photo: true,
                    close: '${%Close}',
                    innerWidth: Math.min((2 * ${from.imageInnerWidthText}) + 25, jQuery(window).width() - 50),
                    height: '100%',
                    html: '<div style="overflow: auto; float: left;">' + html + "</div>"
                });
            });
      
              var tree = jQuery(".comparative-gallery-tree").jstree({
                  "plugins" : [ "themes", "html_data" ]  ,
                  core : {
                      "animation" : 0
                  }
              });
              tree.find('.leaf').css('height', ${from.imageWidthText} + 10);
      
      
              });
          </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: