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 = ``; // moon icon
const lightModeSymbol = ``; // sun icon
const darkModeToggleText = {
'en': 'Toggle Dark Mode',
'de': 'Dark Mode umschalten',
'fr': 'Toggle Dark Mode',
'es': 'Toggle Dark Mode',
'it': 'Toggle Dark Mode',
'nl': 'Toggle Dark Mode',
'pl': 'Toggle Dark Mode',
'pt': 'Toggle Dark Mode',
'ru': 'Смена оформления'
}[defaultUserLanguage()] || 'Toggle Dark Mode';
const toggleButton = ``;
function isDarkModeSet() {
return localStorage.getItem('dark-mode') === 'true';
}
function getDarkModeIcon() {
return ``;
}
function toggleDarkMode() {
document.body.classList.toggle('dark-mode');
const setting = (!isDarkModeSet()).toString();
localStorage.setItem('dark-mode', setting);
}
function addDarkModeToggle() {
const sidebarToolbar = $('.sidebar__toolbar');
// wait for the sidebar toolbar to be visible
// this will also be false if the toolbar doesn't exist yet
if(!sidebarToolbar.is(':visible')) {
setTimeout(addDarkModeToggle, 250);
return;
}
var darkModeButton = $(`.js-button[aria-label="${darkModeToggleText}"]`);
// do nothing if button is already on the screen
if (darkModeButton.is(':visible')) {
return;
}
darkModeButton = $(toggleButton).prependTo(sidebarToolbar);
darkModeButton.html(getDarkModeIcon());
darkModeButton.on('click', function() {
toggleDarkMode();
darkModeButton.html(getDarkModeIcon());
$(this).blur();
});
}
if (darkModeDefault) {
if (localStorage.getItem("dark-mode") === null) {
localStorage.setItem('dark-mode', 'true');
}
}
$(addDarkModeToggle);
// Apply dark mode immediately if it's been set previously
if(localStorage.getItem('dark-mode') === 'true') {
document.body.classList.add('dark-mode');
}