User:Nixinova/fdmobileplus.js

/**	Reimplementing parts of the old Gamepedia Mobile skin with modifications

function addUrlParam(txt) { return location.pathname.replace(/Special:\w+\//, '') + '?' + txt + location.search.replace('?', '&'); }

(function {	if (!$('body').attr('class').includes('skin-fandommobile')) return;	// Load CSS	$('head').append('');	// Add top banner	$('.wiki-page-header__title-wrapper').after(`    2 ? 'display:none;' : }"> &larr; Return to base page   Main   Talk    <li id="nn-action-watch"> <a href="${addUrlParam('action=watch')}">⭐</a> </li> <li id="nn-action-unwatch"> <a href="${addUrlParam('action=unwatch')}">🌟</a> </li> <li id="nn-action-history"> <a href="${addUrlParam('action=history')}">⏱️</a> </li> <li id="nn-action-edit"> <a href="${addUrlParam('action=edit&mobileaction=toggle_view_desktop')}">✏️</a> </li> <li id="nn-action-links"> <a href="/wiki/Special:Whatlinkshere/${location.pathname.replace(/\/wiki\//, '')}">🔗</a> </li> <li id="nn-action-logs" style="${location.pathname.startsWith('/wiki/User:') ? '' : 'display:none;'}"> <a href="/wiki/Special:Log/${location.pathname.replace('/wiki/', '')}">📚</a> </li> <li id="nn-action-contribs" style="${location.pathname.startsWith('/wiki/User:') ? '' : 'display:none;'}"> <a href="/wiki/Special:Contribs/${location.pathname.replace('/wiki/User:', '').replace('/', '?')}">👨</a> </li> </ul> `);	// 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(` (<a href="/${pagelink.text.replace(/ /g, '_')}" style="color:#36c">View current page</a>)`);    	$('#mw-mf-diffarea').append(`<a class="mw-ui-button" href="${undoUrl}">Undo</a>`);	}	// Show TOC	setInterval( => {$('#toc').removeClass('closed');}, 1000); // make sure its open by default; maybe .toc[onload] would work instead	// Cleanup and show recentchanges entries $('.mw-changeslist-minor').show; $('.mw-changeslist-line-prefix').hide; $('.mw-changeslist-line td:nth-child(1)').hide; $('.mw-changeslist-line td:nth-child(2)').hide; $('.mw-changeslist-minor.mw-changeslist-line td:nth-child(3)').hide; $('.mw-changeslist-minor .mw-enhanced-rc + td:not([class])').hide; $('.mw-enhanced-rc').attr('colspan', ''); // Collapse msgboxes $('#msgbox-text').attr('onclick', '$(this).toggleClass("msgbox-active")'); // Collapse sections $('.chevron-wrapper').click; // Add history link $('main').after(`		 <a href="${addUrlParam('action=history')}">View page history</a> 		 <a href="${addUrlParam('mobileaction=toggle_view_desktop')}">Desktop view</a> 	`); });