User:Ebrahim/global.js
Note: After publishing, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5.
// disable error logging for privacy reasons
mw.loader.using('mediawiki.storage').then(function () {
mw.storage.session.set('client-error-opt-out', 1);
});
if (mw.config.get('wgContentLanguage') !== 'fa') {
window.articleTranslatorConf = {
homeWiki: 'fa',
fromLang: mw.config.get('wgContentLanguage')
};
mw.loader.load("https://en.wikipedia.org/w/index.php?title=User:Ebrahim/ArticleTranslator.js&action=raw&ctype=text/javascript");
}
if (mw.config.get('wgCanonicalSpecialPageName') === 'Whatlinkshere') {
mw.loader.load('https://www.wikidata.org/w/index.php?title=MediaWiki:Linkscount.js&action=raw&ctype=text/javascript');
}
$(function () {
mw.util.addPortletLink('p-tb', 'https://wdvd.toolforge.org/index.php?lang=fa&description=on&labels=on&sitelinks=on', 'Wikidata Vandalism');
mw.util.addPortletLink('p-tb', 'https://global-search.toolforge.org/?q=hookEvent%5C%28®ex=1&namespaces=&title=', 'Global Search');
mw.util.addPortletLink('p-tb', 'https://notwikilambda.toolforge.org/', 'notwikilambda');
});
// Always enable dark mode, https://meta.wikimedia.org/w/index.php?title=User:Jdlrobson/global.js&oldid=26846657#L-16--L-36
(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' );
} );
}
}());