MediaWiki:Mobile.js: Difference between revisions
Appearance
Content deleted Content added
About 1 in 5 pages do not seem to work in dark mode. Get some concrete data to help decision making before further roll out. Tag: Reverted |
Restrict to anons and bump rate to 10% Tag: Reverted |
||
Line 6: | Line 6: | ||
/* Added by [[User:Jon (WMF)]]. Will be removed 8th July 2024 at latest. Please remove this if this exists beyond that date. 1% sampling rate: Work out which pages are not ready for dark mode. */ |
/* Added by [[User:Jon (WMF)]]. Will be removed 8th July 2024 at latest. Please remove this if this exists beyond that date. 1% sampling rate: Work out which pages are not ready for dark mode. */ |
||
(function () { |
mw.loader.using('mediawiki.user').then(function () { |
||
if ( Math.random() > 0. |
if ( Math.random() > 0.1 || !mw.user.isAnon() ) { |
||
return; |
return; |
||
} |
} |
||
const name = document.documentElement.classList.contains('skin-theme-clientpref-day') ? 'ready' : 'notReady'; |
const name = document.documentElement.classList.contains('skin-theme-clientpref-day') ? 'ready' : 'notReady'; |
||
mw.track( `counter.MediaWiki.minerva.darkmode.${name}`, 1 ); |
mw.track( `counter.MediaWiki.minerva.darkmode.${name}`, 1 ); |
||
} |
}); |
Revision as of 17:59, 5 July 2024
/* All JavaScript here will be loaded for users of the mobile site */
/* Note, there is no corresponding User:Username/mobile.js; however users may use User:Username/minerva.js */
function addPortletLink() {
mw.log.warn('addPortletLink is deprecated on desktop and never implemented on mobile', 'More information on https://www.mediawiki.org/wiki/ResourceLoader/Migration_guide_(users)#addPortletLink');
}
/* Added by [[User:Jon (WMF)]]. Will be removed 8th July 2024 at latest. Please remove this if this exists beyond that date. 1% sampling rate: Work out which pages are not ready for dark mode. */
mw.loader.using('mediawiki.user').then(function () {
if ( Math.random() > 0.1 || !mw.user.isAnon() ) {
return;
}
const name = document.documentElement.classList.contains('skin-theme-clientpref-day') ? 'ready' : 'notReady';
mw.track( `counter.MediaWiki.minerva.darkmode.${name}`, 1 );
});