From 559648a25774ae2be8668a871b1a8a8ef673b2d2 Mon Sep 17 00:00:00 2001 From: Sen Hastings Date: Thu, 28 Jul 2022 18:23:57 -0500 Subject: [PATCH] support/scripts/pkg-stats: re-implement the sortable_hint This attempts to re-implement the "sortable_hint" feature without relying on words. The column headers and CVE expand/contract buttons change color and cursor style on hover. If Javascript is enabled: Just like [PATCH 1/3] more rules are applied to the generated stylesheet before content is loaded. If Javascript is disabled: The headers stay pearly white. :-) Signed-off-by: Sen Hastings Signed-off-by: Thomas Petazzoni --- support/scripts/pkg-stats | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/support/scripts/pkg-stats b/support/scripts/pkg-stats index 8ce4e3f260..91d42206ca 100755 --- a/support/scripts/pkg-stats +++ b/support/scripts/pkg-stats @@ -750,11 +750,13 @@ var lastColumnName = false; const styleElement = document.createElement('style'); document.head.insertAdjacentElement("afterend", styleElement); const styleSheet = styleElement.sheet; -const collapseRule = ".collapse{ height: 200px; overflow: hidden scroll;}" -const buttonRule = ".see-more{ display: block;}" +addedCSSRules = [ +".collapse{ height: 200px; overflow: hidden scroll;}", +".see-more{ display: block;}", +".label:hover,.see-more:hover { cursor: pointer; background: #d2ffc4;}" +]; -styleSheet.insertRule(collapseRule); -styleSheet.insertRule(buttonRule); +addedCSSRules.forEach(rule => styleSheet.insertRule(rule)); function sortGrid(sortLabel){ let i = 0; @@ -816,8 +818,7 @@ function sortGrid(sortLabel){ let rule = "." + listing[0] + " { grid-row: " + i + "; }"; styleSheet.insertRule(rule); }); - styleSheet.insertRule(collapseRule); - styleSheet.insertRule(buttonRule); + addedCSSRules.forEach(rule => styleSheet.insertRule(rule)); }; function expandField(fieldId){ @@ -887,17 +888,10 @@ function expandField(fieldId){ Results
-

""" # noqa - tabs and spaces html_footer = """ - """