Sha256: 0822db32cbdf4693c7be6d4b7e366d30afe9e41000b6bc1dd6075e86f705ada8

Contents?: true

Size: 586 Bytes

Versions: 142

Compression:

Stored size: 586 Bytes

Contents

const htmlElement = document.querySelector('html');
const DARK_MODE_BUTTON_ID = 'darkModeButton';

function darkModeClickHandler(e) {
  return htmlElement.classList.toggle('dark-mode');
}

function darkMode() {
  console.info('Dark Mode (is the best)!');
  window.localStorage.getItem('darkModeSetting') === 'true' ? htmlElement.classList.add('dark-mode') : null;
  if (window.location.pathname !== '/settings/') return;
  const darkModeButton = document.getElementById(DARK_MODE_BUTTON_ID);

  darkModeButton.addEventListener('click', darkModeClickHandler);
}

export default darkMode;

Version data entries

142 entries across 142 versions & 2 rubygems

Version Path
kcc-gem-theme-2.4.0 assets/js/src/darkMode.js
kcc-gem-theme-2.3.0 assets/js/src/darkMode.js