MediaWiki:Mobile.js: Difference between revisions
Jump to navigation
Jump to search
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'..." |
No edit summary |
||
| Line 40: | Line 40: | ||
mw.hook( 'mobileFrontend.menuReady' ).add( addLinks ); | mw.hook( 'mobileFrontend.menuReady' ).add( addLinks ); | ||
}() ); | }() ); | ||
alert('Mobile.js loaded'); | |||
Revision as of 21:56, 16 December 2025
/* 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 );
}() );
alert('Mobile.js loaded');