User:Nixinova/gpmobile.js

/** * Disables FandomMobile */

const classes = $('body').attr('class'); if (classes.includes('skin-fandommobile')) {

// Mobile view const paramString = '&action=view&mobileaction=toggle_view_desktop&mobileaction=toggle_view_mobile'; if (!location.search) location.search = paramString;

} else if (classes.includes('skin-minerva')) {

// Collapse headings $('h2').click;

// Improve diff view if (location.pathname.includes('Special:MobileDiff')) { const urlRegex = /.*Special:MobileDiff\/([0-9]+).*/; const currentID = location.pathname.replace(urlRegex, '$1'); const prevID = $('#mw-mf-diffarea .revision-history-prev a[href]').attr('href').replace(urlRegex, '$1'); const pagelink = $('#mw-mf-diffarea a[href*="oldid"]'); const undoUrl = `/${pagelink.text.replace(/ /g, '_')}?action=edit&undoafter=${prevID}&undo=${currentID}mobileaction=toggle_view_desktop&mobileaction=toggle_view_mobile`; pagelink.after(` (View current page)`); $('#mw-mf-diffarea').append(`Undo`); }	// Add desktop view button $('#content').after(`Desktop view`);

}