MediaWiki:Mobile.js: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
Tags: Manual revert Reverted
No edit summary
Tags: Manual revert Reverted
Line 1: Line 1:
/* Any JavaScript here will be loaded for users using the mobile site */
/**
/* MF broke the mobile styles loading in 1.31 */
* Scripts placed here are loaded for all skins on the mobile view
mw.loader.using( 'mobile.site.styles' );
*  
* Global scripts which should be loaded on both desktop and mobile should go in
* [[MediaWiki:Gadget-site.js]]
* Mobile-only scripts should go in [[MediaWiki:Mobile.js]]
*/


( function() {
( function() {
Line 26: Line 30:
/* Fires when DOM is ready */
/* Fires when DOM is ready */
$( function() {
$( 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>');




Navigation menu