Jump to content

MediaWiki:Common.js

From glossaLAB

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.
/* Cualquier código JavaScript escrito aquí se cargará para todos los usuarios en cada carga de página */
/*function waitForMathJax($content) {
  if (typeof MathJax === 'undefined') {
    setTimeout(function () { waitForMathJax($content); }, 1000);
  } else {
    MathJax.Hub.Queue(["Typeset", MathJax.Hub, $content[0]]).execute();
  }
}

mw.hook('wikipage.content').add(waitForMathJax);
*/

var currentPageName = mw.config.get('wgPageName');
var userGroups = mw.config.get('wgUserGroups');
var requiredGroups = ['sysop', 'patroller'];
var groupAddReviewLink = false;
var appliesAddReviewLink = $('a[title="glossaLAB:In review"]').length > 0;

for (var i = 0; i < requiredGroups.length; i++) {
    if (userGroups.includes(requiredGroups[i])) {
        groupAddReviewLink = true;
        break;
    }
}

if (groupAddReviewLink && appliesAddReviewLink) {
	mw.util.addPortletLink(
	        'p-views',
	        '/wiki/Special:FormEdit/Individual_rev?source=' + currentPageName,
	        'Add review',
	        'ca-add-review',
	        'Add new revision page to the article',
	        'd',
	        '#ca-history'
	);
}
This website only uses its own cookies for technical purposes; it does not collect or transfer users' personal data without their knowledge. However, it contains links to third-party websites with third-party privacy policies, which you can accept or reject when you access them.