about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSerial <69764315+Serial-ATA@users.noreply.github.com>2022-04-29 19:57:16 -0400
committerSerial <69764315+Serial-ATA@users.noreply.github.com>2022-04-29 19:57:16 -0400
commit9173780568144717da3a4986f67ad375b8fa1ded (patch)
treeb0369f11577e7ca67e30660637c6401970588525
parent06cc1abbb1b64a60c059137b3d610bbe0e0f3bea (diff)
downloadrust-9173780568144717da3a4986f67ad375b8fa1ded.tar.gz
rust-9173780568144717da3a4986f67ad375b8fa1ded.zip
Make filters implicit; Update symbols
-rw-r--r--util/gh-pages/index.html15
-rw-r--r--util/gh-pages/script.js31
2 files changed, 21 insertions, 25 deletions
diff --git a/util/gh-pages/index.html b/util/gh-pages/index.html
index 552c30f8353..0a990df96f3 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 =^.^=
                         <div id="version-filter">
                             <div class="btn-group" filter-dropdown>
                                 <button type="button" class="btn btn-default dropdown-toggle">
-                                    Version <span class="caret"></span>
+                                    Version <span id="version-filter-count" class="badge">{{versionFilterCount(version_filters)}}</span> <span class="caret"></span>
                                 </button>
                                 <ul id="version-filter-selector" class="dropdown-menu">
                                     <li class="checkbox">
@@ -436,11 +440,8 @@ Otherwise, have a great day =^.^=
                                     </li>
                                     <li role="separator" class="divider"></li>
                                     <li class="checkbox" ng-repeat="(filter, vars) in version_filters">
-                                        <label>
-                                            <input type="checkbox" ng-model="version_filters[filter].enabled" />
-                                            {{filter}}
-                                        </label>
-                                        <input type="text" class="version-filter-input form-control filter-input" maxlength="6" placeholder="1.62.0" ng-model="version_filters[filter].version_str" ng-model-options="{debounce: 50}"/>
+                                        <label ng-attr-for="filter-{filter}">{{filter}}</label>
+                                        <input type="text" ng-attr-id="filter-{filter}" class="version-filter-input form-control filter-input" maxlength="6" placeholder="1.62.0" ng-model="version_filters[filter].version_str" ng-model-options="{debounce: 50}"/>
                                     </li>
                                 </ul>
                             </div>
diff --git a/util/gh-pages/script.js b/util/gh-pages/script.js
index 469a9306aee..8fbd3f50d3c 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;