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

Adds cute little audience pills #394

Merged
merged 1 commit into from
Jan 17, 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
27 changes: 27 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,24 @@
for (let p of document.querySelectorAll('div.practice > p')) {
if (/^\s*$/.test(p.textContent)) p.remove();
}
const audienceNames = {
websites: 'websites',
'user-agents': 'user agents',
'api-designers': 'API designers',
};
for (let prac of document.querySelectorAll('div.practice.advisement')) {
prac.classList.remove('advisement');
prac.classList.add('principle');
const audiences = prac.dataset.audiences?.split(/\s+/) ?? [];
const audDiv = document.createElement('div');
audDiv.setAttribute('class', 'audience-label');
audiences.forEach(lbl => {
const spn = document.createElement('span');
spn.setAttribute('class', `audience-${lbl}`);
spn.textContent = audienceNames[lbl];
audDiv.append(spn);
});
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');
Expand Down Expand Up @@ -482,6 +497,18 @@
q {
font-style: italic;
}
.audience-label {
font-size: 0.9em;
}
.audience-label > span {
display: inline-block;
padding: 0.1em 0.4em;
margin: 0 0.2em;
border-radius: 4px;
}
.audience-websites { background-color: gold; }
.audience-user-agents { background-color: mediumspringgreen; }
.audience-api-designers { background-color: mistyrose; }
</style>
</head>
<body data-cite="html indexedDB service-workers fingerprinting-guidance url infra">
Expand Down