MediaWiki:Minerva.js

Revision as of 07:18, 2 November 2023 by Diamondback88 (talk | contribs) (Created page with "→‎Any JavaScript here will be loaded for users using the mobile site: →‎MF broke the mobile styles loading in 1.31: mw.loader.using( 'mobile.site.styles' ); →‎Add "current revision" and "undo" links to Special:MobileDiff on old skin: $(function() { var urlRegex = /.*Special:MobileDiff\/([0-9]+).*/; var currentID = location.href.replace(urlRegex, '$1'); var prevID = $('#content #mw-mf-diffarea .revision-history-prev a[href]').attr('href').replace(url...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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)
  • Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Press Ctrl-F5.
/* Any JavaScript here will be loaded for users using the mobile site */
/* MF broke the mobile styles loading in 1.31 */
mw.loader.using( 'mobile.site.styles' );

/* Add "current revision" and "undo" links to Special:MobileDiff on old skin */
$(function() {
    var urlRegex = /.*Special:MobileDiff\/([0-9]+).*/;
    var currentID = location.href.replace(urlRegex, '$1');
    var prevID = $('#content #mw-mf-diffarea .revision-history-prev a[href]').attr('href').replace(urlRegex, '$1');

    var pagelink = $('#content #mw-mf-diffarea a[href*="oldid"]');
    pagelink.after('<br>(<a href="/' + pagelink.text().replace(/ /g, '_') + '" style="color:#36c">View current page</a>)');

    $('#content #mw-mf-diffarea').append('<a class="mw-ui-button" href="/' + pagelink.text().replace(/ /g, '_') + '?action=edit&amp;undoafter=' + prevID + '&amp;undo=' + currentID + '">Undo</a>');
});