R-CMD-check / R CMD check (push) Successful in 3m52s
Integrate Civilytics Reveal.js slide extension, HTML/PDF/Typst document themes, and _brand.yml into the package under inst/quarto/. Three new helper functions (use_civilytics_revealjs, use_civilytics_theme, use_civilytics_brand) copy assets into a user's Quarto project. Logos are stored once in inst/img/ and distributed at install time.
81 lines
3.3 KiB
HTML
81 lines
3.3 KiB
HTML
<!-- Civilytics Reveal — brand chrome injector -->
|
|
<script>
|
|
(function () {
|
|
// The Civilytics wordmark is the bold serif "Civilytics" lockup with the pulse
|
|
// waveform riding inline at the end. It ships as a baked SVG in two variants:
|
|
// ink-on-paper (default) and paper-on-ink (reverse) for dark backgrounds.
|
|
// We render it as an <img> so the official artwork is preserved exactly —
|
|
// the file picks up its color from the SVG itself, not from CSS currentColor.
|
|
var ASSET_BASE = (function () {
|
|
// Find the URL this script's <link rel="stylesheet" href="..civilytics.css..">
|
|
// was loaded from, so we can resolve sibling assets the same way.
|
|
var links = document.querySelectorAll('link[rel="stylesheet"]');
|
|
for (var i = 0; i < links.length; i++) {
|
|
var href = links[i].getAttribute('href') || '';
|
|
var m = href.match(/^(.*\/)civilytics\.css(\?|$)/);
|
|
if (m) return m[1] + 'assets/';
|
|
}
|
|
// Fallback: assume Quarto-style sibling layout
|
|
return '_extensions/civilytics-reveal/assets/';
|
|
})();
|
|
|
|
function makeWordmarkImg(reverse) {
|
|
var img = document.createElement('img');
|
|
img.className = 'civilytics-wordmark';
|
|
img.alt = 'Civilytics';
|
|
img.src = ASSET_BASE + (reverse ? 'civilytics-wordmark-reverse.svg' : 'civilytics-wordmark.svg');
|
|
return img;
|
|
}
|
|
|
|
function injectWordmark(slide, reverse) {
|
|
if (!slide) return;
|
|
if (slide.querySelector(':scope > .civilytics-wordmark')) return;
|
|
slide.insertBefore(makeWordmarkImg(reverse), slide.firstChild);
|
|
}
|
|
|
|
function init() {
|
|
if (!window.Reveal) { setTimeout(init, 50); return; }
|
|
var root = document.querySelector('.reveal');
|
|
if (!root) return;
|
|
|
|
// Title slide — paper background, ink wordmark
|
|
document.querySelectorAll(
|
|
'.slides #title-slide, .slides section.title-slide'
|
|
).forEach(function (s) { injectWordmark(s, false); });
|
|
|
|
// Thank-you slide — ink background, reversed wordmark
|
|
document.querySelectorAll('.slides section.thank-you').forEach(function (s) {
|
|
injectWordmark(s, true);
|
|
});
|
|
|
|
// Brand footer (pulse glyph + "Civilytics") bottom-left on body slides.
|
|
// Uses inline SVG so it inherits the slide's text color via currentColor.
|
|
if (!root.querySelector('.civilytics-footer')) {
|
|
var footer = document.createElement('div');
|
|
footer.className = 'civilytics-footer';
|
|
footer.setAttribute('aria-hidden', 'true');
|
|
footer.innerHTML =
|
|
'<svg viewBox="0 0 30 14" aria-hidden="true" focusable="false" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="square" stroke-linejoin="miter">' +
|
|
'<path d="M0 8 L5 8 L8 3 L12 13 L16 1 L20 11 L23 8 L30 8"/>' +
|
|
'</svg>' +
|
|
'<span>Civilytics</span>';
|
|
root.appendChild(footer);
|
|
}
|
|
|
|
function updateChrome() {
|
|
var current = Reveal.getCurrentSlide();
|
|
if (!current) return;
|
|
var hide = current.matches('.title-slide, #title-slide, .section-divider, .section, .thank-you, .full-bleed, .no-chrome');
|
|
document.body.classList.toggle('civilytics-hide-chrome', !!hide);
|
|
}
|
|
Reveal.on('ready', updateChrome);
|
|
Reveal.on('slidechanged', updateChrome);
|
|
}
|
|
if (document.readyState === 'loading') {
|
|
document.addEventListener('DOMContentLoaded', init);
|
|
} else {
|
|
init();
|
|
}
|
|
})();
|
|
</script>
|