$(
    function() {
        var converter = new showdown.Converter();
        const loadedAttr = "loaded";
        const repoAttr = "repo";

        $("#load-md-btn-base").click(function () {
            var clickedElement = $(this);
            var mdDestinationID = $("#md-destination-base");
            var loaded = clickedElement.attr(loadedAttr);

            if (loaded === "false") {
                var repositoryUrl = clickedElement.attr(repoAttr);
                $.get(
                    repositoryUrl + "/master/license-report.md",
                    function (data) {
                        var html = converter.makeHtml(data);
                        mdDestinationID.html(html);
                        clickedElement.attr(loadedAttr, "true");
                        makeCollapsibleTitle(mdDestinationID);
                    }
                );
            }
        });

        function makeCollapsibleTitle(mdDestinationID) {
            var h1Elements = mdDestinationID.find("h1");
            var h2Elements = mdDestinationID.find("h2");
            var linkElements = mdDestinationID.find("a");

            h1Elements.addClass("dependencies-title");

            h1Elements.each(function() {
                var text = $(this).text();
                $(this).text(text.replace('Dependencies of', ''));
            });

            linkElements.addClass("external");
            linkElements.attr("target", "_blank");

            h2Elements.each(function(index, element) {
                const titleID = this.id + "_1";
                $(element).addClass("collapse-link collapsed");
                $(element).attr("href", "#" + titleID);
                $(element).attr("data-toggle", "collapse");
                $(element).next("ol").addClass("dependencies-container collapse");
                $(element).next("ol").attr("id", titleID);

                $(element).next("ol").next("p").addClass("report-info collapse");
                $(element).next("ol").next("p").attr("id", titleID + "_p");
            });

            $("<h2 class='report-info-title collapse-link collapsed'>Report info</h2>").insertBefore(".report-info");
            makeReportInfoCollapsible(mdDestinationID);
        }

        function makeReportInfoCollapsible(mdDestinationID) {
            var reportInfoContent = mdDestinationID.find(".report-info");

            reportInfoContent.each(function (index, element) {
                const reportInfoID = this.id;
                $(element).prev(".report-info-title").attr("href", "#" + reportInfoID);
                $(element).prev(".report-info-title").attr("data-toggle", "collapse");
            });
        }
    }
);

@@ -1,144 +1,487 @@
-$(%0A    function() %7B%0A        var converter = new showdown.Converter();%0A        const loadedAttr = %22loaded%22;%0A        const repoAttr = %22repo%22;%0A
+/**%0A * This is a JavaScript file which loads %60license-report%60 md-files from the external repositories.%0A *%0A * Please see %60/os-licenses/index.html%60 for usage.%0A */%0A%0A$(%0A    function() %7B%0A        var converter = new showdown.Converter();%0A        const loadedAttr = %22loaded%22;%0A        const repoAttr = %22repo%22;%0A%0A        /**%0A         * Loads %60license-report%60 file from the %60SpineEventEngine/base%60 repository.%0A         *%0A         * %3Cp%3EExecutes by clicking on the corresponding link.%0A         */
 %0A   
@@ -1222,32 +1222,198 @@
  %7D%0A        %7D);%0A%0A
+        /**%0A         * Makes a %60license-report%60 content collapsible.%0A         *%0A         * @param mdDestinationID id of the %60div%60 with a markdown content%0A         */%0A
         function
@@ -1678,24 +1678,119 @@
 s-title%22);%0A%0A
+            /**%0A             * Removes %60Dependencies of%60 words from the title.%0A             */%0A
             
@@ -1937,32 +1937,114 @@
            %7D);%0A%0A
+            /**%0A             * Makes all markdown links external.%0A             */%0A
             link
@@ -2142,98 +2142,361 @@
     
-h2Elements.each(function(index, element) %7B%0A                const titleID = this.id + %22_1%22;
+/**%0A             * Adds required classes and attributes to make titles and content collapsible.%0A             */%0A            h2Elements.each(function(index, element) %7B%0A                const titleID = this.id + %22_1%22;%0A                const collapsibleContent = $(element).next(%22ol%22);%0A                const reportInfoContent = collapsibleContent.next(%22p%22);%0A
 %0A   
@@ -2664,32 +2664,33 @@
 %22, %22collapse%22);%0A
+%0A
                 
@@ -2689,37 +2689,34 @@
         
-$(element).next(%22ol%22)
+collapsibleContent
 .addClas
@@ -2769,37 +2769,34 @@
         
-$(element).next(%22ol%22)
+collapsibleContent
 .attr(%22i
@@ -2830,39 +2830,25 @@
     
-$(element).next(%22ol%22).next(%22p%22)
+reportInfoContent
 .add
@@ -2898,39 +2898,25 @@
     
-$(element).next(%22ol%22).next(%22p%22)
+reportInfoContent
 .att
@@ -2949,32 +2949,158 @@
            %7D);%0A%0A
+            /**%0A             * Inserts a new collapsible title for the paragraph with the report information.%0A             */%0A
             $(%22%3C
@@ -3268,16 +3268,171 @@
      %7D%0A%0A
+        /**%0A         * Makes report information content collapsible.%0A         * @param mdDestinationID id of the %60div%60 with a markdown content%0A         */%0A
         
@@ -3676,32 +3676,56 @@
 %0A               
+ const reportInfoTitle =
  $(element).prev
@@ -3742,24 +3742,58 @@
 info-title%22)
+;%0A%0A                reportInfoTitle
 .attr(%22href%22
@@ -3835,45 +3835,23 @@
     
-$(element).prev(%22.
 report
--info-t
+InfoT
 itle
-%22)
 .att

Add JSDocs and variables for the repeating elements