MediaWiki:Mobile.js

From ICE List Wiki
Revision as of 21:54, 16 December 2025 by ICEListAdmin6 (talk | contribs) (Created page with "All JavaScript here will be loaded for users of the mobile site: ( function () { if ( mw.config.get( 'skin' ) !== 'minerva' ) { return; } function addLinks() { var menu = document.querySelector( '.menu' ); if ( !menu ) { return; } var ul = document.createElement( 'ul' ); ul.className = 'mobile-custom-links'; var links = [ { title: 'Home', href: mw.util.getUrl( 'Main Page' ) }, { title: 'All Agents', href: mw.util.getUrl( 'Category:Agent'...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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.
/* All JavaScript here will be loaded for users of the mobile site */
( function () {
	if ( mw.config.get( 'skin' ) !== 'minerva' ) {
		return;
	}

	function addLinks() {
		var menu = document.querySelector( '.menu' );
		if ( !menu ) {
			return;
		}

		var ul = document.createElement( 'ul' );
		ul.className = 'mobile-custom-links';

		var links = [
			{ title: 'Home', href: mw.util.getUrl( 'Main Page' ) },
			{ title: 'All Agents', href: mw.util.getUrl( 'Category:Agent' ) },
			{ title: 'All Incidents', href: mw.util.getUrl( 'Category:Incidents' ) },
			{ title: 'All Vehicles', href: mw.util.getUrl( 'Category:Vehicles' ) },
			{ title: 'Submit an Incident', href: mw.util.getUrl( 'ICE List:Submit incident' ) },
			{ title: 'Submit an Agent', href: mw.util.getUrl( 'ICE List:Submit Agent' ) },
			{ title: 'About ICE List', href: mw.util.getUrl( 'ICE List Wiki:About' ) },
			{ title: 'Join as a Volunteer', href: mw.util.getUrl( 'ICE List Wiki:Volunteer' ) },
			{ title: 'Donate to ICE List', href: mw.util.getUrl( 'ICE List Wiki:Donate' ) }
		];

		links.forEach( function ( link ) {
			var li = document.createElement( 'li' );
			var a = document.createElement( 'a' );
			a.textContent = link.title;
			a.href = link.href;
			li.appendChild( a );
			ul.appendChild( li );
		} );

		menu.appendChild( ul );
	}

	mw.hook( 'mobileFrontend.menuReady' ).add( addLinks );
}() );