From 9173780568144717da3a4986f67ad375b8fa1ded Mon Sep 17 00:00:00 2001
From: Serial <69764315+Serial-ATA@users.noreply.github.com>
Date: Fri, 29 Apr 2022 19:57:16 -0400
Subject: [PATCH] Make filters implicit; Update symbols
---
util/gh-pages/index.html | 15 ++++++++-------
util/gh-pages/script.js | 31 +++++++++++++------------------
2 files changed, 21 insertions(+), 25 deletions(-)
diff --git a/util/gh-pages/index.html b/util/gh-pages/index.html
index 552c30f83..0a990df96 100644
--- a/util/gh-pages/index.html
+++ b/util/gh-pages/index.html
@@ -109,6 +109,10 @@ Otherwise, have a great day =^.^=
right: 0;
left: auto;
}
+
+ #version-filter-count {
+ display: none;
+ }
}
.label {
@@ -297,7 +301,7 @@ Otherwise, have a great day =^.^=
#version-filter li label {
padding-right: 0;
- width: 80%;
+ width: 40%;
}
.version-filter-input {
@@ -425,7 +429,7 @@ Otherwise, have a great day =^.^=
diff --git a/util/gh-pages/script.js b/util/gh-pages/script.js
index 469a9306a..8fbd3f50d 100644
--- a/util/gh-pages/script.js
+++ b/util/gh-pages/script.js
@@ -137,13 +137,13 @@
$scope.themes = THEMES_DEFAULT;
const DEFAULT_VERSION_FILTERS = {
- ">=": { enabled: false, version_str: "" },
- "<=": { enabled: false, version_str: "" },
- "==": { enabled: false, version_str: "" },
+ "≥": { enabled: false, version_str: "" },
+ "≤": { enabled: false, version_str: "" },
+ "=": { enabled: false, version_str: "" },
};
// Weird workaround to get a copy of the object
$scope.version_filters = JSON.parse(JSON.stringify(DEFAULT_VERSION_FILTERS));
- $scope.version_regex = new RegExp('\\d\.\\d{2}\.\\d');
+ $scope.version_regex = new RegExp('1\.\\d{2}\.\\d');
$scope.selectTheme = function (theme) {
setTheme(theme, true);
@@ -175,16 +175,8 @@
$scope.version_filters = JSON.parse(JSON.stringify(DEFAULT_VERSION_FILTERS));
}
- $scope.versionSymbol = function() {
- const version_filters = $scope.version_filters;
- let filter = ">=";
- for (const key in version_filters) {
- if (version_filters[key]) {
- filter = key;
- }
- }
-
- return filter;
+ $scope.versionFilterCount = function(obj) {
+ return Object.values(obj).filter(x => x.enabled).length;
}
$scope.byVersion = function(lint) {
@@ -214,10 +206,13 @@
let version_str = filters[filter].version_str;
// Skip the work for version strings with invalid lengths or characters
- if (!filters[filter].enabled || !validate_version_str(version_str)) {
+ if (!validate_version_str(version_str)) {
+ filters[filter].enabled = false;
continue;
}
+ filters[filter].enabled = true;
+
let result = cmp_version(lint_version, version_str, filter);
if (result && filter === "==") {
return true;
@@ -226,10 +221,10 @@
}
let cmp_filter;
- if (filter === ">=") {
- cmp_filter = "<=";
+ if (filter === "≥") {
+ cmp_filter = "≤";
} else {
- cmp_filter = ">=";
+ cmp_filter = "≥";
}
let cmp_version_str = filters[cmp_filter].version_str;