diff options
| author | unvalley <kirohi.code@gmail.com> | 2022-10-09 23:35:52 +0900 |
|---|---|---|
| committer | unvalley <kirohi.code@gmail.com> | 2022-10-09 23:35:52 +0900 |
| commit | 1688368b33fa3bc24913440078c415057d659bb4 (patch) | |
| tree | 84042a74fc9434b9d3c121182b317b4fe8212fcf /util | |
| parent | 272bbfb857650e0d3d05dd83a5ce1a522c94b4bd (diff) | |
feat: add Default to Lint groups
Diffstat (limited to 'util')
| -rw-r--r-- | util/gh-pages/index.html | 6 | ||||
| -rw-r--r-- | util/gh-pages/script.js | 17 |
2 files changed, 21 insertions, 2 deletions
diff --git a/util/gh-pages/index.html b/util/gh-pages/index.html index c5d602ea303..8dc4513325d 100644 --- a/util/gh-pages/index.html +++ b/util/gh-pages/index.html @@ -448,6 +448,12 @@ Otherwise, have a great day =^.^= None </label> </li> + <li class="checkbox"> + <label ng-click="resetGroupsToDefault()"> + <input type="checkbox" class="invisible" /> + Default + </label> + </li> <li role="separator" class="divider"></li> <li class="checkbox" ng-repeat="(group, enabled) in groups"> <label class="text-capitalize"> diff --git a/util/gh-pages/script.js b/util/gh-pages/script.js index 366e7c8843f..94a43d41379 100644 --- a/util/gh-pages/script.js +++ b/util/gh-pages/script.js @@ -114,7 +114,7 @@ return $scope.levels[lint.level]; }; - var GROUPS_FILTER_DEFAULT = { + const GROUPS_FILTER_DEFAULT = { cargo: true, complexity: true, correctness: true, @@ -125,8 +125,12 @@ restriction: true, style: true, suspicious: true, + } + + $scope.groups = { + ...GROUPS_FILTER_DEFAULT }; - $scope.groups = GROUPS_FILTER_DEFAULT; + const THEMES_DEFAULT = { light: "Light", rust: "Rust", @@ -164,6 +168,15 @@ } }; + $scope.resetGroupsToDefault = function () { + const groups = $scope.groups; + for (const [key, value] of Object.entries(GROUPS_FILTER_DEFAULT)) { + if (groups.hasOwnProperty(key)) { + groups[key] = value; + } + } + }; + $scope.selectedValuesCount = function (obj) { return Object.values(obj).filter(x => x).length; } |
