Skip to content

Commit 78cd2c8

Browse files
authored
Merge pull request #3319 from majecty/webpage_link_category
Website: Make lint categories linkable
2 parents 0f4b13b + 4c88362 commit 78cd2c8

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

util/gh-pages/index.html

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,19 @@ <h4 class="list-group-item-heading">
167167
});
168168
}
169169

170+
function selectGroup($scope, selectedGroup) {
171+
var groups = $scope.groups;
172+
for (var group in groups) {
173+
if (groups.hasOwnProperty(group)) {
174+
if (group === selectedGroup) {
175+
groups[group] = true;
176+
} else {
177+
groups[group] = false;
178+
}
179+
}
180+
}
181+
}
182+
170183
angular.module("clippy", [])
171184
.filter('markdown', function ($sce) {
172185
return function (text) {
@@ -223,6 +236,11 @@ <h4 class="list-group-item-heading">
223236
return result;
224237
}, {});
225238

239+
var selectedGroup = getQueryVariable("sel");
240+
if (selectedGroup) {
241+
selectGroup($scope, selectedGroup.toLowerCase());
242+
}
243+
226244
scrollToLintByURL($scope);
227245
})
228246
.error(function (data) {
@@ -243,6 +261,17 @@ <h4 class="list-group-item-heading">
243261
}, false);
244262
});
245263
})();
264+
265+
function getQueryVariable(variable) {
266+
var query = window.location.search.substring(1);
267+
var vars = query.split('&');
268+
for (var i = 0; i < vars.length; i++) {
269+
var pair = vars[i].split('=');
270+
if (decodeURIComponent(pair[0]) == variable) {
271+
return decodeURIComponent(pair[1]);
272+
}
273+
}
274+
}
246275
</script>
247276
</body>
248277
</html>

0 commit comments

Comments
 (0)