Jump to content

MediaWiki talk:Vector-night-mode-gadget-names

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

Protected edit request on 3 July 2024

[edit]

Change the content to dark-mode. I want to keep using the dark mode toggle gadget but also fix pages, templates and scripts for the native dark mode. Currently this is difficult because the skin doesn't allow me to turn the native dark mode on without disabling the toggle gadget. Changing this message to just dark-mode allows the the native dark mode to be enabled while the toggle gadget is enabled (but not the dark mode gadget). Nardog (talk) 02:28, 3 July 2024 (UTC)[reply]

I tested this and it seems to create a lot of new ways to break things (i.e open a page, turn on native dark mode, then turn on gadget dark mode gives you both at once for that page load since Vector 2022 checks what gadgets are enabled only on page load). Hence  Not done. You can use a script similar to m:User:Jdlrobson/global.js (
(function () {
   const c = document.documentElement.classList;
   if ( c.contains( 'skin-night-mode-page-disabled' ) || c.contains( 'skin-theme-clientpref--excluded' ) ) {
     c.remove( 'skin-night-mode-page-disabled' );
     c.remove( 'skin-theme-clientpref--excluded' );

     if ( mw.user.options.values[mw.config.get('skin').replace('-2022','') + '-theme'] === 'day' ) {
       c.add( 'skin-theme-clientpref-day' );
     } else {
       c.add( 'skin-theme-clientpref-night' );
     }
     const btn = document.createElement('button');
     btn.textContent = 'restore day theme';
     btn.setAttribute('style', 'position: fixed; bottom: 0; right: 0;' );
     document.body.appendChild(btn);
     btn.addEventListener('click', () => {
          c.add( 'skin-night-mode-page-disabled' );
          c.remove( 'skin-theme-clientpref-night' );
     } );
   }
}());
) to forcibly activate native dark mode even if the skin doesn't think you should. * Pppery * it has begun... 16:04, 3 July 2024 (UTC)[reply]
That to me is like saying "It will hurt if you hit yourself in the head." (I get the point from the engineer's perspective though, a lot of people will hit themselves in the head.) That snippet is particularly retrogressive to me given the interface for toggling already exists, just disabled. Anyway, I've found a way to confuse the skin not to disable the radio buttons—hopefully it won't break soon. Nardog (talk) 13:17, 8 July 2024 (UTC)[reply]