|
|
| (2 intermediate revisions by the same user not shown) |
| Line 1: |
Line 1: |
| /* 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 );
| |
| }() );
| |