MediaWiki:Common.js

Revision as of 23:06, 5 November 2026 by Admin (talk | contribs) (Footer: Funding and independence)

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.
/* Footer links to the trust pages (CURACAOFIL-6). Owner-authorised 2026-11-05. */
mw.hook( 'wikipage.content' ).add( function () {
	var places = document.getElementById( 'footer-places' );
	if ( !places || places.querySelector( '[data-trust-links]' ) ) {
		return;
	}
	[ [ 'Methodology', 'CasinoLeaks:Methodology' ], [ 'Sources and coverage', 'CasinoLeaks:Sources_and_coverage' ], [ 'Corrections policy', 'CasinoLeaks:Corrections_policy' ], [ 'Editorial standards', 'CasinoLeaks:Editorial_standards' ], [ 'Funding and independence', 'CasinoLeaks:Funding_and_independence' ], [ 'Team and experts', 'CasinoLeaks:Team_and_experts' ], [ 'Contact', 'CasinoLeaks:Contact' ] ].forEach( function ( item ) {
		var li = document.createElement( 'li' ), a = document.createElement( 'a' );
		li.setAttribute( 'data-trust-links', '1' );
		a.href = mw.util.getUrl( item[ 1 ] );
		a.textContent = item[ 0 ];
		li.appendChild( a );
		places.appendChild( li );
	} );
} );

/* 18+ notice and independent help resources in the footer (CURACAOFIL-6) */
mw.hook( 'wikipage.content' ).add( function () {
	var footer = document.querySelector( 'footer' ) || document.getElementById( 'footer' );
	if ( !footer || footer.querySelector( '.cl-rg' ) ) {
		return;
	}
	var box = document.createElement( 'div' );
	box.className = 'cl-rg';
	box.style.cssText = 'display:flex;align-items:center;gap:1em;margin:0 0 1.2em;padding:1em 1.2em;border:1px solid #d33;border-left:6px solid #d33;border-radius:4px;background:#fff4f4;font-size:1em;line-height:1.55;color:#202122';
	var links = [ [ 'GambleAware', 'https://www.gambleaware.org' ], [ 'GamCare', 'https://www.gamcare.org.uk' ], [ 'GAMSTOP', 'https://www.gamstop.co.uk' ], [ 'Gambling Therapy', 'https://gamblingtherapy.org' ], [ 'NCPG', 'https://www.ncpgambling.org' ] ];
	var b = document.createElement( 'span' );
	b.textContent = '18+';
	b.style.cssText = 'flex:0 0 auto;display:inline-flex;align-items:center;justify-content:center;width:3.2em;height:3.2em;border-radius:50%;background:#d33;color:#fff;font-weight:bold;font-size:1.1em';
	box.appendChild( b );
	var txt = document.createElement( 'div' );
	var lead = document.createElement( 'strong' );
	lead.textContent = 'Gambling can be addictive. ';
	txt.appendChild( lead );
	txt.appendChild( document.createTextNode( 'This site is for information only and is not an invitation to gamble. You must be of legal age. Need help? ' ) );
	box.appendChild( txt );
	links.forEach( function ( l, i ) {
		var a = document.createElement( 'a' );
		a.href = l[ 1 ]; a.textContent = l[ 0 ]; a.rel = 'noopener nofollow'; a.target = '_blank';
		txt.appendChild( a );
		txt.appendChild( document.createTextNode( i < links.length - 1 ? ' · ' : ' · ' ) );
	} );
	var more = document.createElement( 'a' );
	more.href = mw.util.getUrl( 'CasinoLeaks:Get_help' ); more.textContent = 'More help';
	txt.appendChild( more );
	footer.insertBefore( box, footer.firstChild );
} );