Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Sen Hastings <sen@phobosdpl.com>
To: buildroot@buildroot.org
Cc: Sen Hastings <sen@phobosdpl.com>
Subject: [Buildroot] [PATCH 3/3] support/scripts/pkg-stats: re-implement the sortable_hint
Date: Thu, 28 Jul 2022 18:23:57 -0500	[thread overview]
Message-ID: <20220728232357.270130-3-sen@phobosdpl.com> (raw)
In-Reply-To: <20220728232357.270130-1-sen@phobosdpl.com>

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 <sen@phobosdpl.com>
---
 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 4b396d3217..7a68b5dca9 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){
 
 <a href=\"#results\">Results</a><br/>
 
-<p id=\"sortable_hint\"></p>
 """  # noqa - tabs and spaces
 
 
 html_footer = """
-<script>
-if (typeof sortGrid === "function") {
-  document.getElementById("sortable_hint").innerHTML =
-  "hint: the table can be sorted by clicking the column headers"
-}
-</script>
 </body>
 </html>
 """
-- 
2.34.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

  parent reply	other threads:[~2022-07-28 23:24 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-28 23:23 [Buildroot] [PATCH 1/3] support/scripts/pkg-stats: make cells with many CVEs collapsible Sen Hastings
2022-07-28 23:23 ` [Buildroot] [PATCH 2/3] support/scripts/pkg-stats: adjust column widths Sen Hastings
2022-08-01 17:04   ` Thomas Petazzoni via buildroot
2022-08-01 18:11     ` Arnout Vandecappelle
2022-08-02 20:30       ` Sen Hastings
2022-08-02 22:04         ` Thomas Petazzoni via buildroot
2022-07-28 23:23 ` Sen Hastings [this message]
2022-08-01 17:02   ` [Buildroot] [PATCH 3/3] support/scripts/pkg-stats: re-implement the sortable_hint Thomas Petazzoni via buildroot
2022-08-01 17:02 ` [Buildroot] [PATCH 1/3] support/scripts/pkg-stats: make cells with many CVEs collapsible Thomas Petazzoni via buildroot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220728232357.270130-3-sen@phobosdpl.com \
    --to=sen@phobosdpl.com \
    --cc=buildroot@buildroot.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox