remoção de função: desativando o modo escuro padrão do sistema quarto
This commit is contained in:
1 parent
6626b8fd07
commit
2acbab3eaf
28 files changed
+50
-1905
No files matched your search
@@ -49,13 +49,11 @@ ul.task-list li input[type="checkbox"] {
|
||||
<script src="site_libs/quarto-html/anchor.min.js">
|
||||
</script>
|
||||
<link href="site_libs/quarto-html/tippy.css" rel="stylesheet"/>
|
||||
<link class="quarto-color-scheme" href="site_libs/quarto-html/quarto-syntax-highlighting-e26003cea8cd680ca0c55a263523d882.css" id="quarto-text-highlighting-styles" rel="stylesheet"/>
|
||||
<link class="quarto-color-scheme quarto-color-alternate" href="site_libs/quarto-html/quarto-syntax-highlighting-dark-d166b450ba5a8e9f7a0ab969bf6592c1.css" id="quarto-text-highlighting-styles" rel="prefetch"/>
|
||||
<link href="site_libs/quarto-html/quarto-syntax-highlighting-e26003cea8cd680ca0c55a263523d882.css" id="quarto-text-highlighting-styles" rel="stylesheet"/>
|
||||
<script src="site_libs/bootstrap/bootstrap.min.js">
|
||||
</script>
|
||||
<link href="site_libs/bootstrap/bootstrap-icons.css" rel="stylesheet"/>
|
||||
<link append-hash="true" class="quarto-color-scheme" data-mode="light" href="site_libs/bootstrap/bootstrap-08772f00f0fbc2a611b36d0d93c3338c.min.css" id="quarto-bootstrap" rel="stylesheet"/>
|
||||
<link append-hash="true" class="quarto-color-scheme quarto-color-alternate" data-mode="dark" href="site_libs/bootstrap/bootstrap-dark-695e3c6d05a96c055294ffde44d6a771.min.css" id="quarto-bootstrap" rel="prefetch"/>
|
||||
<link append-hash="true" data-mode="light" href="site_libs/bootstrap/bootstrap-08772f00f0fbc2a611b36d0d93c3338c.min.css" id="quarto-bootstrap" rel="stylesheet"/>
|
||||
<script id="quarto-search-options" type="application/json">
|
||||
{
|
||||
"location": "navbar",
|
||||
@@ -155,7 +153,7 @@ cookieconsent.run({
|
||||
</span>
|
||||
</a>
|
||||
</div>
|
||||
<div class="quarto-navbar-tools tools-wide tools-end">
|
||||
<div class="quarto-navbar-tools tools-end">
|
||||
<div class="dropdown">
|
||||
<a aria-expanded="false" aria-label="Compartilhar" class="quarto-navigation-tool dropdown-toggle px-1" data-bs-toggle="dropdown" href="" id="quarto-navigation-tool-dropdown-0" role="link" title="Compartilhar">
|
||||
<i class="bi bi-share">
|
||||
@@ -178,10 +176,6 @@ cookieconsent.run({
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<a class="quarto-color-scheme-toggle quarto-navigation-tool px-1" href="" onclick="window.quartoToggleColorScheme(); return false;" title="Alternar modo escuro">
|
||||
<i class="bi">
|
||||
</i>
|
||||
</a>
|
||||
<a class="quarto-reader-toggle quarto-navigation-tool px-1" href="" onclick="window.quartoToggleReader(); return false;" title="Alternar modo de leitor">
|
||||
<div class="quarto-reader-toggle-btn">
|
||||
<i class="bi">
|
||||
@@ -492,150 +486,6 @@ cookieconsent.run({
|
||||
}
|
||||
}
|
||||
toggleBodyColorPrimary();
|
||||
const disableStylesheet = (stylesheets) => {
|
||||
for (let i=0; i < stylesheets.length; i++) {
|
||||
const stylesheet = stylesheets[i];
|
||||
stylesheet.rel = 'prefetch';
|
||||
}
|
||||
}
|
||||
const enableStylesheet = (stylesheets) => {
|
||||
for (let i=0; i < stylesheets.length; i++) {
|
||||
const stylesheet = stylesheets[i];
|
||||
stylesheet.rel = 'stylesheet';
|
||||
}
|
||||
}
|
||||
const manageTransitions = (selector, allowTransitions) => {
|
||||
const els = window.document.querySelectorAll(selector);
|
||||
for (let i=0; i < els.length; i++) {
|
||||
const el = els[i];
|
||||
if (allowTransitions) {
|
||||
el.classList.remove('notransition');
|
||||
} else {
|
||||
el.classList.add('notransition');
|
||||
}
|
||||
}
|
||||
}
|
||||
const toggleGiscusIfUsed = (isAlternate, darkModeDefault) => {
|
||||
const baseTheme = document.querySelector('#giscus-base-theme')?.value ?? 'light';
|
||||
const alternateTheme = document.querySelector('#giscus-alt-theme')?.value ?? 'dark';
|
||||
let newTheme = '';
|
||||
if(darkModeDefault) {
|
||||
newTheme = isAlternate ? baseTheme : alternateTheme;
|
||||
} else {
|
||||
newTheme = isAlternate ? alternateTheme : baseTheme;
|
||||
}
|
||||
const changeGiscusTheme = () => {
|
||||
// From: https://github.com/giscus/giscus/issues/336
|
||||
const sendMessage = (message) => {
|
||||
const iframe = document.querySelector('iframe.giscus-frame');
|
||||
if (!iframe) return;
|
||||
iframe.contentWindow.postMessage({ giscus: message }, 'https://giscus.app');
|
||||
}
|
||||
sendMessage({
|
||||
setConfig: {
|
||||
theme: newTheme
|
||||
}
|
||||
});
|
||||
}
|
||||
const isGiscussLoaded = window.document.querySelector('iframe.giscus-frame') !== null;
|
||||
if (isGiscussLoaded) {
|
||||
changeGiscusTheme();
|
||||
}
|
||||
}
|
||||
const toggleColorMode = (alternate) => {
|
||||
// Switch the stylesheets
|
||||
const alternateStylesheets = window.document.querySelectorAll('link.quarto-color-scheme.quarto-color-alternate');
|
||||
manageTransitions('#quarto-margin-sidebar .nav-link', false);
|
||||
if (alternate) {
|
||||
enableStylesheet(alternateStylesheets);
|
||||
for (const sheetNode of alternateStylesheets) {
|
||||
if (sheetNode.id === "quarto-bootstrap") {
|
||||
toggleBodyColorMode(sheetNode);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
disableStylesheet(alternateStylesheets);
|
||||
toggleBodyColorPrimary();
|
||||
}
|
||||
manageTransitions('#quarto-margin-sidebar .nav-link', true);
|
||||
// Switch the toggles
|
||||
const toggles = window.document.querySelectorAll('.quarto-color-scheme-toggle');
|
||||
for (let i=0; i < toggles.length; i++) {
|
||||
const toggle = toggles[i];
|
||||
if (toggle) {
|
||||
if (alternate) {
|
||||
toggle.classList.add("alternate");
|
||||
} else {
|
||||
toggle.classList.remove("alternate");
|
||||
}
|
||||
}
|
||||
}
|
||||
// Hack to workaround the fact that safari doesn't
|
||||
// properly recolor the scrollbar when toggling (#1455)
|
||||
if (navigator.userAgent.indexOf('Safari') > 0 && navigator.userAgent.indexOf('Chrome') == -1) {
|
||||
manageTransitions("body", false);
|
||||
window.scrollTo(0, 1);
|
||||
setTimeout(() => {
|
||||
window.scrollTo(0, 0);
|
||||
manageTransitions("body", true);
|
||||
}, 40);
|
||||
}
|
||||
}
|
||||
const isFileUrl = () => {
|
||||
return window.location.protocol === 'file:';
|
||||
}
|
||||
const hasAlternateSentinel = () => {
|
||||
let styleSentinel = getColorSchemeSentinel();
|
||||
if (styleSentinel !== null) {
|
||||
return styleSentinel === "alternate";
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
const setStyleSentinel = (alternate) => {
|
||||
const value = alternate ? "alternate" : "default";
|
||||
if (!isFileUrl()) {
|
||||
window.localStorage.setItem("quarto-color-scheme", value);
|
||||
} else {
|
||||
localAlternateSentinel = value;
|
||||
}
|
||||
}
|
||||
const getColorSchemeSentinel = () => {
|
||||
if (!isFileUrl()) {
|
||||
const storageValue = window.localStorage.getItem("quarto-color-scheme");
|
||||
return storageValue != null ? storageValue : localAlternateSentinel;
|
||||
} else {
|
||||
return localAlternateSentinel;
|
||||
}
|
||||
}
|
||||
const darkModeDefault = false;
|
||||
let localAlternateSentinel = darkModeDefault ? 'alternate' : 'default';
|
||||
// Dark / light mode switch
|
||||
window.quartoToggleColorScheme = () => {
|
||||
// Read the current dark / light value
|
||||
let toAlternate = !hasAlternateSentinel();
|
||||
toggleColorMode(toAlternate);
|
||||
setStyleSentinel(toAlternate);
|
||||
toggleGiscusIfUsed(toAlternate, darkModeDefault);
|
||||
};
|
||||
// Ensure there is a toggle, if there isn't float one in the top right
|
||||
if (window.document.querySelector('.quarto-color-scheme-toggle') === null) {
|
||||
const a = window.document.createElement('a');
|
||||
a.classList.add('top-right');
|
||||
a.classList.add('quarto-color-scheme-toggle');
|
||||
a.href = "";
|
||||
a.onclick = function() { try { window.quartoToggleColorScheme(); } catch {} return false; };
|
||||
const i = window.document.createElement("i");
|
||||
i.classList.add('bi');
|
||||
a.appendChild(i);
|
||||
window.document.body.appendChild(a);
|
||||
}
|
||||
// Switch to dark mode if need be
|
||||
if (hasAlternateSentinel()) {
|
||||
toggleColorMode(true);
|
||||
} else {
|
||||
toggleColorMode(false);
|
||||
}
|
||||
const icon = "";
|
||||
const anchorJS = new window.AnchorJS();
|
||||
anchorJS.options = {
|
||||
|
||||
Reference in new issue
Block a user