From ef4a1c3842a3e83a410a6300b34963ea6b74833f Mon Sep 17 00:00:00 2001
From: "Gervaise H. Henry" <gervaise.henry@utsouthwestern.edu>
Date: Wed, 28 Oct 2020 13:12:54 -0500
Subject: [PATCH] Make thumbnail size responsive

---
 layouts/custom/repository.html | 69 ++++++++++++++++++++++++++++++++--
 1 file changed, 66 insertions(+), 3 deletions(-)

diff --git a/layouts/custom/repository.html b/layouts/custom/repository.html
index 17641a6..9395d62 100644
--- a/layouts/custom/repository.html
+++ b/layouts/custom/repository.html
@@ -886,17 +886,29 @@
                             break
                         }
                     }
-                    thm_pr.height = "75"
+                    if (window.innerWidth > 1250) {
+                        thm_pr.height = "50"
+                    } else {
+                        thm_pr.height = "25"
+                    }
                     row_he_pr.appendChild(thm_pr)
                     thm_pr.onerror=function(){
                         this.remove()
                     }
-                    thm_bl.height = "75"
+                    if (window.innerWidth > 1250) {
+                        thm_bl.height = "50"
+                    } else {
+                        thm_bl.height = "25"
+                    }
                     row_he_bl.appendChild(thm_bl)
                     thm_bl.onerror=function(){
                         this.remove()
                     }
-                    thm_lut.height = "75"
+                    if (window.innerWidth > 1250) {
+                        thm_lut.height = "50"
+                    } else {
+                        thm_lut.height = "25"
+                    }
                     row_he_lut.appendChild(thm_lut)
                     thm_lut.onerror=function(){
                         this.remove()
@@ -918,5 +930,56 @@
                 return b.indexOf(e) > -1;
             });
         }
+        $(window).resize(function(e,data) {
+            var repo = {{ index .Site.Data.repository.repository }}
+            var filters = {{ index .Site.Data.repository.filters }}
+            var checked = $("#jstree").jstree("get_checked")
+                var filter = []
+                for (i = 0; i < checked.length; i++) {
+                    for (j = 0; j < filters.length; j++) {
+                        if (checked[i] == filters[j].id) {
+                            filter.push(filters[j].text)
+                        }
+                    }
+                }
+                filtered = filterRepo(repo, checked)
+                filterRepoGroups_out = filterRepoGroups(repo, filtered)
+                filtered_dis = filterRepoGroups_out[0]
+                filtered_bmi = filterRepoGroups_out[1]
+                filtered_t2d = filterRepoGroups_out[2]
+                filtered_eth = filterRepoGroups_out[3]
+                filtered_age = filterRepoGroups_out[4]
+                filtered_prv = filterRepoGroups_out[5]
+                filtered_psa = filterRepoGroups_out[6]
+                document.getElementById("total").innerHTML = filtered.length
+                if (checked.length == 0) {
+                    document.getElementById("filters").innerHTML = "NO"
+                } else {
+                    document.getElementById("filters").innerHTML = filter
+                }
+                filterDoughnut_out = filterDoughnut(filtered_bmi, filtered_t2d, filtered_eth, filtered_age, filtered_prv, filtered_psa)
+                doughnut_data_dis = filterDoughnut_out[0]
+                doughnut_data_bmi = filterDoughnut_out[1]
+                doughnut_data_t2d = filterDoughnut_out[2]
+                doughnut_data_eth = filterDoughnut_out[3]
+                doughnut_data_age = filterDoughnut_out[4]
+                doughnut_data_prv = filterDoughnut_out[5]
+                doughnut_data_psa = filterDoughnut_out[6]
+                dis.destroy()
+                dis = new Chart(document.getElementById("doughnut-dis"), { type: "doughnut", data: doughnut_data_dis, options: doughnut_options })
+                bmi.destroy()
+                bmi = new Chart(document.getElementById("doughnut-bmi"), { type: "doughnut", data: doughnut_data_bmi, options: doughnut_options })
+                t2d.destroy()
+                t2d = new Chart(document.getElementById("doughnut-t2d"), { type: "doughnut", data: doughnut_data_t2d, options: doughnut_options })
+                eth.destroy()
+                eth = new Chart(document.getElementById("doughnut-eth"), { type: "doughnut", data: doughnut_data_eth, options: doughnut_options })
+                age.destroy()
+                age = new Chart(document.getElementById("doughnut-age"), { type: "doughnut", data: doughnut_data_age, options: doughnut_options })
+                prv.destroy()
+                prv = new Chart(document.getElementById("doughnut-prv"), { type: "doughnut", data: doughnut_data_prv, options: doughnut_options })
+                psa.destroy()
+                psa = new Chart(document.getElementById("doughnut-psa"), { type: "doughnut", data: doughnut_data_psa, options: doughnut_options })
+                tableData(repo, filtered)
+        })
     </script>
 </head>
\ No newline at end of file
-- 
GitLab