Jump to content

MediaWiki:Common.js: Difference between revisions

From CasinoLeaks
Footer: Sources and coverage
Footer: 18+ notice and help links
Line 13: Line 13:
places.appendChild( li );
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 = 'margin:0 0 1em;padding:.7em 1em;border:1px solid #c8ccd1;background:#f8f9fa;font-size:.9em;line-height:1.5';
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( 'strong' );
b.textContent = '18+ ';
box.appendChild( b );
box.appendChild( document.createTextNode( 'Gambling can be addictive. This site is for information only and is not an invitation to gamble. Need help? ' ) );
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';
box.appendChild( a );
box.appendChild( document.createTextNode( i < links.length - 1 ? ' · ' : ' · ' ) );
} );
var more = document.createElement( 'a' );
more.href = mw.config.get( 'wgScript' ) + '?title=CasinoLeaks:Get_help'; more.textContent = 'More help';
box.appendChild( more );
footer.insertBefore( box, footer.firstChild );
} );
} );

Revision as of 22:41, 5 November 2026

/* 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' ], [ '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.config.get( 'wgScript' ) + '?title=' + encodeURIComponent( 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 = 'margin:0 0 1em;padding:.7em 1em;border:1px solid #c8ccd1;background:#f8f9fa;font-size:.9em;line-height:1.5';
	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( 'strong' );
	b.textContent = '18+ ';
	box.appendChild( b );
	box.appendChild( document.createTextNode( 'Gambling can be addictive. This site is for information only and is not an invitation to gamble. Need help? ' ) );
	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';
		box.appendChild( a );
		box.appendChild( document.createTextNode( i < links.length - 1 ? ' · ' : ' · ' ) );
	} );
	var more = document.createElement( 'a' );
	more.href = mw.config.get( 'wgScript' ) + '?title=CasinoLeaks:Get_help'; more.textContent = 'More help';
	box.appendChild( more );
	footer.insertBefore( box, footer.firstChild );
} );