From dd344a02626dbaba1f0e88260cb623082b396f8c Mon Sep 17 00:00:00 2001 From: Aaron Qian Date: Thu, 10 Nov 2022 23:32:58 -0800 Subject: [PATCH] remove list.js. It adjusts post card height to be the same, but is actually not needed. --- layouts/_default/list.html | 4 ---- layouts/categories/list.html | 4 ---- layouts/tags/list.html | 4 ---- static/js/list.js | 44 ------------------------------------ 4 files changed, 56 deletions(-) delete mode 100644 static/js/list.js diff --git a/layouts/_default/list.html b/layouts/_default/list.html index 15759d3..07a0f00 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -55,7 +55,3 @@ {{ end }} - -{{ define "scripts" }} - -{{ end }} diff --git a/layouts/categories/list.html b/layouts/categories/list.html index 7b85ff4..ccc5746 100644 --- a/layouts/categories/list.html +++ b/layouts/categories/list.html @@ -56,7 +56,3 @@ {{ end }} - -{{ define "scripts" }} - -{{ end }} diff --git a/layouts/tags/list.html b/layouts/tags/list.html index 57072a9..d871b84 100644 --- a/layouts/tags/list.html +++ b/layouts/tags/list.html @@ -56,7 +56,3 @@ {{ end }} - -{{ define "scripts" }} - -{{ end }} diff --git a/static/js/list.js b/static/js/list.js deleted file mode 100644 index 2cfafc3..0000000 --- a/static/js/list.js +++ /dev/null @@ -1,44 +0,0 @@ -"use strict"; - -var isMobile = false, isTablet = false, isLaptop = false; -(function ($) { - jQuery(document).ready(function () { - function detectDevice() { - if (window.innerWidth <= 425) { - isMobile = true; - isTablet = false; - isLaptop = false; - } else if (window.innerWidth <= 768) { - isMobile = false; - isTablet = true; - isLaptop = false; - } else { - isMobile = false; - isTablet = false; - isLaptop = true; - } - } - detectDevice(); - - // ======= Adjust height of the post cards ============= - function adjustPostCardsHeight() { - if (!isMobile) { // no need to adjust height for mobile devices - let postCardHolder = document.getElementById("post-card-holder"); - if (postCardHolder == null ){ - return - } - let el = postCardHolder.children; - let maxHeight = 0; - for (let i = 0; i < el.length; i++) { - if (el[i].children[1].clientHeight > maxHeight) { - maxHeight = el[i].children[1].clientHeight; - } - } - for (let i = 0; i < el.length; i++) { - el[i].children[1].setAttribute("style", "min-height: " + maxHeight + "px;") - } - } - } - adjustPostCardsHeight(); - }); -})(jQuery);