Sha256: 0822db32cbdf4693c7be6d4b7e366d30afe9e41000b6bc1dd6075e86f705ada8

Contents?: true

Size: 586 Bytes

Versions: 143

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

143 entries across 143 versions & 2 rubygems

Version Path
kcc-gem-theme-2.35.1 assets/js/src/darkMode.js
kcc-gem-theme-2.35.0 assets/js/src/darkMode.js
kcc-gem-theme-2.34.2 assets/js/src/darkMode.js
kcc-gem-theme-2.34.1 assets/js/src/darkMode.js
kcc-gem-theme-2.34.0 assets/js/src/darkMode.js
kcc-gem-theme-2.33.0 assets/js/src/darkMode.js
kcc-gem-theme-2.32.0 assets/js/src/darkMode.js
kcc-gem-theme-2.31.0 assets/js/src/darkMode.js
kcc-gem-theme-2.30.1 assets/js/src/darkMode.js
kcc-gem-theme-2.30.0 assets/js/src/darkMode.js
kcc-gem-theme-2.29.0 assets/js/src/darkMode.js
kcc-gem-theme-2.28.0 assets/js/src/darkMode.js
kcc-gem-theme-2.27.0 assets/js/src/darkMode.js
kcc-gem-theme-2.26.2 assets/js/src/darkMode.js
kcc-gem-theme-2.26.1 assets/js/src/darkMode.js
kcc-gem-theme-2.26.0 assets/js/src/darkMode.js
kcc-gem-theme-2.25.0 assets/js/src/darkMode.js
kcc-gem-theme-2.24.4 assets/js/src/darkMode.js
kcc-gem-theme-2.24.3 assets/js/src/darkMode.js
kcc-gem-theme-2.24.2 assets/js/src/darkMode.js