Allow to go through clippy lints page without javascript
This commit is contained in:
parent
f883e28e3d
commit
82969e5c4e
@ -143,8 +143,10 @@ Otherwise, have a great day =^.^=
|
|||||||
</div> {# #}
|
</div> {# #}
|
||||||
</div>
|
</div>
|
||||||
{% for lint in lints %}
|
{% for lint in lints %}
|
||||||
<article class="panel panel-default collapsed" id="{{lint.id}}"> {# #}
|
<article class="panel panel-default" id="{{lint.id}}"> {# #}
|
||||||
<header class="panel-heading" onclick="expandLint('{{lint.id}}')"> {# #}
|
<input id="label-{{lint.id}}" type="checkbox"> {# #}
|
||||||
|
<label for="label-{{lint.id}}" onclick="highlightIfNeeded('{{lint.id}}')"> {# #}
|
||||||
|
<header class="panel-heading"> {# #}
|
||||||
<h2 class="panel-title"> {# #}
|
<h2 class="panel-title"> {# #}
|
||||||
<div class="panel-title-name" id="lint-{{lint.id}}"> {# #}
|
<div class="panel-title-name" id="lint-{{lint.id}}"> {# #}
|
||||||
<span>{{lint.id}}</span> {#+ #}
|
<span>{{lint.id}}</span> {#+ #}
|
||||||
@ -159,10 +161,11 @@ Otherwise, have a great day =^.^=
|
|||||||
|
|
||||||
<span class="label label-lint-level label-lint-level-{{lint.level}}">{{lint.level}}</span> {#+ #}
|
<span class="label label-lint-level label-lint-level-{{lint.level}}">{{lint.level}}</span> {#+ #}
|
||||||
|
|
||||||
<span class="label label-doc-folding">+</span> {# #}
|
<span class="label label-doc-folding"></span> {# #}
|
||||||
</div> {# #}
|
</div> {# #}
|
||||||
</h2> {# #}
|
</h2> {# #}
|
||||||
</header> {# #}
|
</header> {# #}
|
||||||
|
</label> {# #}
|
||||||
|
|
||||||
<div class="list-group lint-docs"> {# #}
|
<div class="list-group lint-docs"> {# #}
|
||||||
<div class="list-group-item lint-doc-md">{{Self::markdown(lint.docs)}}</div> {# #}
|
<div class="list-group-item lint-doc-md">{{Self::markdown(lint.docs)}}</div> {# #}
|
||||||
|
@ -138,18 +138,17 @@ function onEachLazy(lazyArray, func) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function highlightIfNeeded(elem) {
|
function highlightIfNeeded(lintId) {
|
||||||
onEachLazy(elem.querySelectorAll("pre > code.language-rust:not(.highlighted)"), el => {
|
onEachLazy(document.querySelectorAll(`#${lintId} pre > code:not(.hljs)`), el => {
|
||||||
hljs.highlightElement(el.parentElement)
|
hljs.highlightElement(el.parentElement)
|
||||||
el.classList.add("highlighted");
|
el.classList.add("highlighted");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function expandLint(lintId) {
|
function expandLint(lintId) {
|
||||||
const lintElem = document.getElementById(lintId);
|
const elem = document.querySelector(`#${lintId} > input[type="checkbox"]`);
|
||||||
const isCollapsed = lintElem.classList.toggle("collapsed");
|
elem.checked = true;
|
||||||
lintElem.querySelector(".label-doc-folding").innerText = isCollapsed ? "+" : "−";
|
highlightIfNeeded(lintId);
|
||||||
highlightIfNeeded(lintElem);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Show details for one lint
|
// Show details for one lint
|
||||||
|
@ -309,12 +309,12 @@ L4.75,12h2.5l0.5393066-2.1572876 c0.2276001-0.1062012,0.4459839-0.2269287,0.649
|
|||||||
.page-header {
|
.page-header {
|
||||||
border-color: var(--theme-popup-border);
|
border-color: var(--theme-popup-border);
|
||||||
}
|
}
|
||||||
.panel-default > .panel-heading {
|
.panel-default .panel-heading {
|
||||||
background: var(--theme-hover);
|
background: var(--theme-hover);
|
||||||
color: var(--fg);
|
color: var(--fg);
|
||||||
border: 1px solid var(--theme-popup-border);
|
border: 1px solid var(--theme-popup-border);
|
||||||
}
|
}
|
||||||
.panel-default > .panel-heading:hover {
|
.panel-default .panel-heading:hover {
|
||||||
filter: brightness(90%);
|
filter: brightness(90%);
|
||||||
}
|
}
|
||||||
.list-group-item {
|
.list-group-item {
|
||||||
@ -410,9 +410,25 @@ body {
|
|||||||
color: var(--fg);
|
color: var(--fg);
|
||||||
}
|
}
|
||||||
|
|
||||||
article.collapsed .lint-docs {
|
article > label {
|
||||||
|
width: 100%;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
article > input[type="checkbox"] {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
article > input[type="checkbox"] + label .label-doc-folding::before {
|
||||||
|
content: "+";
|
||||||
|
}
|
||||||
|
article > input[type="checkbox"]:checked + label .label-doc-folding::before {
|
||||||
|
content: "−";
|
||||||
|
}
|
||||||
|
.lint-docs {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
article > input[type="checkbox"]:checked ~ .lint-docs {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
.github-corner svg {
|
.github-corner svg {
|
||||||
fill: var(--fg);
|
fill: var(--fg);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user