Updating to match github version.
This commit is contained in:
parent
e8c0a99363
commit
7e758c8909
1 changed files with 10 additions and 19 deletions
29
custom.js
29
custom.js
|
@ -1,15 +1,3 @@
|
|||
window._paq = window._paq || [];
|
||||
/* tracker methods like "setCustomDimension" should be called before "trackPageView" */
|
||||
window._paq.push(['trackPageView']);
|
||||
window._paq.push(['enableLinkTracking']);
|
||||
(function() {
|
||||
var u="//t.thebreadsticks.com/";
|
||||
window._paq.push(['setTrackerUrl', u+'js/']);
|
||||
window._paq.push(['setSiteId', '1']);
|
||||
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
|
||||
g.type='text/javascript'; g.async="true"; g.defer="true"; g.src=u+'js/'; s.parentNode.insertBefore(g,s);
|
||||
})();
|
||||
|
||||
const darkModeDefault = false;
|
||||
|
||||
const darkModeSymbol = `<svg id="icon-darkmode" viewBox="0 0 468 468" fill="currentColor">
|
||||
|
@ -31,22 +19,25 @@ const darkModeToggleText = {
|
|||
'en': 'Toggle Dark Mode',
|
||||
'de': 'Dark Mode umschalten',
|
||||
'fr': 'Toggle Dark Mode',
|
||||
'es': 'Toggle Dark Mode',
|
||||
'es': 'Alternar Modo Obscuro',
|
||||
'hu': 'Sötét mód be/ki',
|
||||
'it': 'Toggle Dark Mode',
|
||||
'nl': 'Toggle Dark Mode',
|
||||
'pl': 'Toggle Dark Mode',
|
||||
'pt': 'Toggle Dark Mode',
|
||||
'ru': 'Смена оформления'
|
||||
'pt': 'Alternar Modo Escuro',
|
||||
'ru': 'Смена оформления',
|
||||
'he': 'מצב לילה',
|
||||
'hi': 'डार्क मोड'
|
||||
}[defaultUserLanguage()] || 'Toggle Dark Mode';
|
||||
|
||||
const toggleButton = `<button class="sidebar__toolbar-button rc-tooltip rc-tooltip--down js-button" aria-label="${darkModeToggleText}">D</button>`;
|
||||
const toggleButton = `<button id="dark-mode-button" class="rcx-box rcx-box--full rcx-button--small-square rcx-button--square rcx-button--small rcx-button--ghost rcx-button rcx-button-group__item rcx-@ue04p" aria-label="${darkModeToggleText}">D</button>`;
|
||||
|
||||
function isDarkModeSet() {
|
||||
return localStorage.getItem('dark-mode') === 'true';
|
||||
}
|
||||
|
||||
function getDarkModeIcon() {
|
||||
return `<svg class="rc-icon sidebar__toolbar-button-icon sidebar__toolbar-button-icon--darkmode" aria-hidden="true">
|
||||
return `<svg class="rcx-box rcx-box--full rcx-icon--name-darkmode rcx-icon rcx-@4pvxx3" aria-hidden="true">
|
||||
<use xlink:href="#icon-darkmode"></use>
|
||||
${isDarkModeSet() ? lightModeSymbol : darkModeSymbol}
|
||||
</svg>`;
|
||||
|
@ -59,7 +50,7 @@ function toggleDarkMode() {
|
|||
}
|
||||
|
||||
function addDarkModeToggle() {
|
||||
const sidebarToolbar = $('.sidebar__toolbar');
|
||||
const sidebarToolbar = $('.rcx-\\@vi4iz8').first();
|
||||
|
||||
// wait for the sidebar toolbar to be visible
|
||||
// this will also be false if the toolbar doesn't exist yet
|
||||
|
@ -68,7 +59,7 @@ function addDarkModeToggle() {
|
|||
return;
|
||||
}
|
||||
|
||||
var darkModeButton = $(`.js-button[aria-label="${darkModeToggleText}"]`);
|
||||
var darkModeButton = $('#dark-mode-button');
|
||||
|
||||
// do nothing if button is already on the screen
|
||||
if (darkModeButton.is(':visible')) {
|
||||
|
|
Loading…
Reference in a new issue