User:Tobias Alcaraz/common.js
Jump to navigation
Jump to search
If you find a typo, inconsistency, or error, please sign up and help out the wiki! We can't do it without your help! :D Thank you!
Note: After saving, 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)
- Internet Explorer: Hold Ctrl while clicking Refresh, or press Ctrl-F5
- Opera: Go to Menu → Settings (Opera → Preferences on a Mac) and then to Privacy & security → Clear browsing data → Cached images and files.
/* Since there's no personal JS in this wiki, this code is run through an browser extension. */ /* Syntax highlight script. */ if (document.body.classList.contains('action-edit')) { mw.loader.load('//www.mediawiki.org/w/index.php?title=MediaWiki:Gadget-DotsSyntaxHighlighter.js&action=raw&ctype=text/javascript'); syntaxHighlighterConfig = { timeout: 500, boldOrItalicColor: '#44466d', wikilinkColor: '#245477', externalLinkColor: '#244d491', headingColor: '#44466d', listOrIndentColor: '#4d1a19', signatureColor: '#66331e', tableColor: '#5e5129', templateColor: '#5e5129', parameterColor: '#66331e', hrColor: '#44466d', tagColor: '#662946', commentColor: '#4d1a19', entityColor: '#474d23', backgroundColor: '#212121', foregroundColor: '#eee' } } /* Add true amount of displayed elements in a list page. */ (function() { const isSpecialPage = mw.config.get('wgNamespaceNumber') === -1, isInWhatLinksHere = mw.config.get('wgCanonicalSpecialPageName') === 'Whatlinkshere'; if (!isSpecialPage && !isInWhatLinksHere) return; const list = document.getElementById('mw-whatlinkshere-list'), listElements = list.children, limit = Number(document.querySelector('input[name="limit"]').value), listLength = listElements.length === limit ? `>=${listElements.length}` : listElements.length, totalElem = document.createElement('div'), totalCounterElem = document.createElement('b'); totalElem.classList.add('list-total-elements'); totalElem.style.margin = '7px 0'; totalElem.innerText = 'Total amount of pages: '; totalCounterElem.innerText = listLength; list.insertAdjacentElement('beforebegin', totalElem); totalElem.insertAdjacentElement('beforeend', totalCounterElem); }());