User talk:Quentinv57/HideButtonsFromNonGsProjects.js

From Meta, a Wikimedia project coordination wiki

function IsGlobalSysopWiki[edit]

Hi Quentinv57, is there no "offizial way" to determine whether a wiki is "small" or not? axpdeHello! 11:41, 26 April 2011 (UTC)[reply]

This scripts breaks Notifications (bug 52194[1] (links from mw m w))[edit]

This scripts breaks Notifications due to rewriting the innerHTML. Everything below // Beginning should be deleted and replaced with the following snippet (not all of the changes are necessary to fix this particular issue, but the other innerHTMLs here might bite someone later):

if (userIsInGroup('sysop')) {
	$('#p-personal ul').prepend( $.parseHTML( '<li id="pt-gsinfo" style="color:green">[local sysop]</li>' ) );

} else if (IsGlobalSysopWiki()) {
	$('#p-personal ul').prepend( $.parseHTML( '<li id="pt-gsinfo" style="color:blue">[GS wiki]</li>' ) );

} else {
	$('#p-personal ul').prepend( $.parseHTML( '<li id="pt-gsinfo" style="color:red">[non-GS wiki]</li>' ) );

	// buttons become red
	$('#ca-delete, #ca-protect, #ca-unprotect').css('background-color', 'red');

	// warning if the deletion/protection/block page is opened
	if (location.href.match(/&action=delete/))
		$('#deleteconfirm').prepend( $.parseHTML( '<p id="wpDeleteWarning" style="color:red; font-size:200%; text-align: center">Warning : you\'re about to delete a page on a non-GS wiki !</p>' ) );

	if (location.href.match(/&action=(un)?protect/))
		$('#mw-Protect-Form').prepend( $.parseHTML( '<p id="wpProtectWarning" style="color:red; font-size:200%; text-align: center">Warning : you\'re about to protect a page on a non-GS wiki !</p>' ) );

	if (wgCanonicalNamespace=='Special' && wgCanonicalSpecialPageName == 'Block')
		$('form:first').prepend( $.parseHTML( '<p id="wpBlockWarning" style="color:red; text-align: center"><span style="font-size:200%">Warning : you\'re about to block a user on a non-GS wiki !</span><br />This should be done for emergencies only.</p>' ) );

	if (wgCanonicalNamespace=='Special' && wgCanonicalSpecialPageName == 'Revisiondelete')
		$('form:first').prepend( $.parseHTML( '<p id="wpDeleterevisionWarning" style="color:red; text-align: center; font-size:200%">Warning : you\'re about to delete a revision on a non-GS wiki !</p>' ) );
}

Please note that the code is largely untested (but should work). Matma Rex (talk) 18:32, 29 July 2013 (UTC)[reply]

I've changed the script. It seems like everything works fine now. Great! Thanks. --MF-W 02:29, 30 July 2013 (UTC)[reply]

Please update script: wgDBName => mw.config.get('wgDBname')[edit]

This is throwing a reference error for certain users trying to load it on mediawiki.org (Run

mw.loader.getScript('https://meta.wikimedia.org/w/index.php?title=User%3AQuentinv57%2FHideButtonsFromNonGsProjects.js&action=raw&ctype=text/javascript')

on Mediawiki.org to replicate. Jdlrobson (talk) 17:58, 1 August 2020 (UTC)[reply]

Edit request[edit]

-amwiki, -incubatorwiki, +urwiki as per Special:WikiSets/7. --Minorax (talk) 12:14, 9 October 2020 (UTC)[reply]

Done though @Minorax: this user is long inactive - is this script heavily imported by others right now - perhaps it should be moved to a community page? — xaosflux Talk 13:39, 9 October 2020 (UTC)[reply]
@Xaosflux: Seems like a viable option. Should this be converted into a gadget? --Minorax (talk) 13:41, 9 October 2020 (UTC)[reply]
@Minorax: do you know if it is heavily used? At the least it could just be moved to mediawiki space, indicating that it is more a "community owned" script. — xaosflux Talk 14:22, 9 October 2020 (UTC)[reply]
@Xaosflux: 33 users using this script. --Minorax (talk) 14:24, 9 October 2020 (UTC)[reply]
Thanks, may be a good candidate to move/fork to MediaWiki - will put on the to look after list. — xaosflux Talk 21:16, 9 October 2020 (UTC)[reply]

Edit request[edit]

-eswikt as per Special:WikiSets/7. --Minorax (talk) 22:40, 9 December 2020 (UTC)[reply]

-plwikinews --Minorax (talk) 05:23, 12 December 2020 (UTC)[reply]
Comment. If this script is widely used by others, and considering that Quentinv57 seems no longer around, I propose to move this page to the MediaWiki namespace. Shall we discuss this here or Babel? —MarcoAurelio (talk) 12:46, 12 December 2020 (UTC)[reply]
Done at MediaWiki:HideButtonsFromNonGsProjects.js. —MarcoAurelio (talk) 16:00, 3 January 2021 (UTC)[reply]