Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move the list of principles to the top. #443

Merged
merged 3 commits into from
Oct 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 49 additions & 9 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,36 @@
],
postProcess: [
() => {
// relabel each principle, and lose the numbering, delabel principle summary
for (let label of document.querySelectorAll('div.practice > a.marker > bdi, #bp-summary > ul > li > a.marker > bdi')) {
label.textContent = 'Principle';
// Remove the nested Best Practices Summary header.
document.querySelector('#best-practices-summary > div.header-wrapper').remove();
const bpSummarySection = document.querySelector('#best-practices-summary');
bpSummarySection.replaceWith(...bpSummarySection.children);
document.querySelector('ol:not(:has(ol)):has(a[href="#best-practices-summary"])').remove();
// Renumber principles by their sections.
const principleSections = new Set();
for (let label of document.querySelectorAll('div.practice > a.marker > bdi')) {
principleSections.add(label.closest('section:has(bdi.secno)'));
}
// I hate markdown
for (const section of principleSections) {
const principleLabels = section.querySelectorAll('div.practice > a.marker > bdi');
let index = 1;
for (const label of principleLabels) {
let labelText = `Principle ${section.querySelector('bdi.secno').textContent.trim()}`
if (principleLabels.length > 1) {
labelText += `.${index}`;
index++;
}
label.textContent = labelText;
const linkTarget = label.closest('div').querySelector('span.practicelab').id;
document.querySelector(`#bp-summary > ul > li > a.marker[href='#${linkTarget}'] > bdi`)
.textContent = labelText;
}
}
// Remove empty <p>s.
for (let p of document.querySelectorAll('div.practice > p')) {
if (/^\s*$/.test(p.textContent)) p.remove();
}
// Add audience chips.
const audienceNames = {
websites: 'websites',
'user-agents': 'user agents',
Expand All @@ -100,9 +122,6 @@
});
prac.append(audDiv);
}
for (let el of document.querySelectorAll('#bp-summary h2, #toc a[href="#bp-summary"]')) {
el.innerHTML = el.innerHTML.replace('Best Practices Summary', 'Principles Summary');
}
}
],
localBiblio: {
Expand Down Expand Up @@ -538,6 +557,14 @@
.audience-websites { background-color: gold; }
.audience-user-agents { background-color: mediumspringgreen; }
.audience-api-designers { background-color: mistyrose; }

ul:has(#include-websites) li { list-style:none }

/* Show summary principles if their audience is selected. */
#bp-summary li:has(.practicelab) { display: none }
#bp-summary ul:has(#include-websites:checked) + ul li:has(.audience-websites) { display: list-item; }
#bp-summary ul:has(#include-user-agents:checked) + ul li:has(.audience-user-agents) { display: list-item; }
#bp-summary ul:has(#include-api-designers:checked) + ul li:has(.audience-api-designers) { display: list-item; }
</style>
</head>
<body data-cite="html indexedDB service-workers fingerprinting-guidance url infra">
Expand Down Expand Up @@ -627,6 +654,21 @@

</section>

<section class="introductory" id="bp-summary">

## List of Principles {#principle-list}

This section is a list of all the privacy principles,
with links to their longer explanations in the rest of the document.

Which audiences should be included?

* <label><input type="checkbox" checked id="include-websites"> Websites</label>
* <label><input type="checkbox" checked id="include-user-agents"> User Agents</label>
* <label><input type="checkbox" checked id="include-api-designers"> API Designers</label>

</section>

# An Introduction to Privacy on the Web {#intro}

This is a document containing technical guidelines. However, in order to put those guidelines in context we
Expand Down Expand Up @@ -2351,8 +2393,6 @@

</section>

<section class="appendix" id="bp-summary"></section>

<section class="appendix">

# Conformance
Expand Down