Skip to content

Commit

Permalink
Run formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
another-rex committed Feb 3, 2025
1 parent 01c1013 commit eaed724
Showing 1 changed file with 23 additions and 27 deletions.
50 changes: 23 additions & 27 deletions internal/output/html/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@ function showPackageDetails(detailsId) {
const detailsElement = document.getElementById(
"table-tr-" + detailsId + "-details"
);
const icon = document.querySelector(
`#table-tr-${detailsId} .material-icons`
); // Select the icon within the row
const icon = document.querySelector(`#table-tr-${detailsId} .material-icons`); // Select the icon within the row

const hidBlock = detailsElement.classList.toggle("hide-block");
icon.classList.toggle("expanded", !hidBlock);
Expand Down Expand Up @@ -120,14 +118,15 @@ function openTab(activeTabId) {
const tabButtons = document.getElementsByClassName("tab-switch-button");
for (let i = 0; i < tabs.length; i += 1) {
tabs[i].classList.toggle("hide-block", tabs[i].id !== activeTabId);
tabButtons[i].classList.toggle("tab-switch-button-selected", tabs[i].id === activeTabId);
tabButtons[i].classList.toggle(
"tab-switch-button-selected",
tabs[i].id === activeTabId
);
}
}

function hideAllFilterOptions() {
const containers = document.getElementsByClassName(
"filter-option-container"
);
const containers = document.getElementsByClassName("filter-option-container");

for (const container of containers) {
container.classList.toggle("hide-block", true);
Expand All @@ -137,9 +136,7 @@ function hideAllFilterOptions() {
function toggleFilter(input) {
const targetID = input + "-filter-option-container";
let optionContainer = document.getElementById(targetID);
const containers = document.getElementsByClassName(
"filter-option-container"
);
const containers = document.getElementsByClassName("filter-option-container");
for (const loopContainer of containers) {
if (loopContainer.id === targetID) {
optionContainer.classList.toggle("hide-block");
Expand All @@ -150,9 +147,7 @@ function toggleFilter(input) {
}

function showAndHideParentSections() {
const ecosystemContainers = document.querySelectorAll(
".ecosystem-container"
);
const ecosystemContainers = document.querySelectorAll(".ecosystem-container");

ecosystemContainers.forEach(ecosystemContainer => {
const sourceContainers =
Expand All @@ -164,7 +159,9 @@ function showAndHideParentSections() {
let sourceHasVisibleRows = false;

packageRows.forEach(packageRow => {
let packageDetails = document.getElementById(packageRow.id + "-details");
let packageDetails = document.getElementById(
packageRow.id + "-details"
);
const vulnRows = packageDetails.querySelectorAll(".vuln-tr");
let packageHasVisibleRows = false;
vulnRows.forEach(vulnRow => {
Expand All @@ -191,18 +188,21 @@ function showAndHideParentSections() {

if (sourceHasVisibleRows) {
ecosystemHasVisibleSources = true;
return
return;
}
});

ecosystemContainer.classList.toggle("hide-block", !ecosystemHasVisibleSources);
ecosystemContainer.classList.toggle(
"hide-block",
!ecosystemHasVisibleSources
);
});
}

function showAllVulns() {
const vulnRows = document.getElementsByClassName("vuln-tr");
for (const row of vulnRows) {
let isUncalled = row.classList.contains("uncalled-tr")
let isUncalled = row.classList.contains("uncalled-tr");
row.classList.toggle("hide-block", isUncalled);
}

Expand Down Expand Up @@ -267,9 +267,7 @@ function updateTypeFilterText(_selectedValue) {

const allTypeCheckbox = document.getElementById("all-type-checkbox");
const osTypeCheckbox = document.getElementById("os-type-checkbox");
const projectTypeCheckbox = document.getElementById(
"project-type-checkbox"
);
const projectTypeCheckbox = document.getElementById("project-type-checkbox");
const uncalledTypeCheckbox = document.getElementById(
"uncalled-type-checkbox"
);
Expand Down Expand Up @@ -357,9 +355,7 @@ function resetSearchText() {
function resetTypeCheckbox() {
const allTypeCheckbox = document.getElementById("all-type-checkbox");
const osTypeCheckbox = document.getElementById("os-type-checkbox");
const projectTypeCheckbox = document.getElementById(
"project-type-checkbox"
);
const projectTypeCheckbox = document.getElementById("project-type-checkbox");
const uncalledTypeCheckbox = document.getElementById(
"uncalled-type-checkbox"
);
Expand Down Expand Up @@ -389,9 +385,7 @@ document.addEventListener("DOMContentLoaded", function () {
const allTypesCheckbox = document.getElementById("all-type-checkbox");
const projectCheckbox = document.getElementById("project-type-checkbox"); // Project vulnerabilities
const osCheckbox = document.getElementById("os-type-checkbox"); // OS vulnerabilities
const uncalledCheckbox = document.getElementById(
"uncalled-type-checkbox"
); // OS vulnerabilities
const uncalledCheckbox = document.getElementById("uncalled-type-checkbox"); // OS vulnerabilities
selectedTypeFilterValue.clear();

if (allTypesCheckbox != null) {
Expand Down Expand Up @@ -433,7 +427,9 @@ document.addEventListener("DOMContentLoaded", function () {
if (clickedOption) {
resetSearchText();
selectedLayer = clickedOption.getAttribute("data-layer-hash");
const selectedDisplay = document.getElementById("layer-filter-selected");
const selectedDisplay = document.getElementById(
"layer-filter-selected"
);
const layerCommand = clickedOption.querySelector("p:first-child");
selectedDisplay.textContent = layerCommand.textContent;

Expand Down

0 comments on commit eaed724

Please sign in to comment.