注意:保存之后,你必须清除浏览器缓存才能看到做出的更改。Google ChromeFirefoxMicrosoft EdgeSafari:按住⇧ Shift键并单击工具栏的“刷新”按钮。参阅Help:绕过浏览器缓存以获取更多帮助。

/* eslint-disable compat/compat */
/**
 * Wiki cover
 * https://gist.github.com/sunny00217wm/57027e08108b78747513d7ca3cc4b033
 *
 * via. CC-BY-SA 3.0
 *
 * cover from https://github.com/Hyijun/wikipedia_cover/blob/a90f45ccb46021d509695226258b30fa327cb47c/main.js
 *
 * 不支援IE11
 */
// <nowiki>

$( function () {
	// 將你需要屏蔽的用戶寫在這個數組中,以逗號(半角)分隔,名字用雙引號(半角)包圍起來,不需要User:前綴
	// 例子:var users = [ "Sunny00217", "User2", "User3" ];
	// 請把空白換成下劃線
	var users = [ "Symplectopedia", "Hanteng", "Sysywjel", "PhiLiP", "Daniel J Zhao", "Liu116", "Martinoei", "淺藍雪", "Winertai", "Marvin 2009", "だ*ぜ", "啦啦啦巴拿马", "Wetrace", "UjuiUjuMandan", "诗琳童", "A1Cafel", "Suiseiseki", "虹易", "社会我佩奇", "KOKUYO", "AINH", "Billytanghh", "420peace", "和平奮鬥救地球", "Beta Lohman", "Wildcursive", "Mattc123456c", "Itw", "Kuon.Haku", "SickManWP", "Sanmosa", "SCP-2000", "Sunny00217", "人人生來平等", "Nightwayyyyy", "Streetdeck", "Matt_Zhuang", "CRHK128", "Ericliu1912", "Baycrest", "Milkypine", "StarryHome" ];

	// 如果您不了解js語言,請不要修改以下代碼
	if ( [ "view", "history" ].indexOf( mw.config.get( "wgAction" ) ) === -1 ) {
		return;
	}

	var nsid = mw.config.get( "wgNamespaceNumber" );

	if ( [ 2, 4 ].indexOf( nsid ) === -1 && nsid % 2 === 0 ) {
		return;
	}

	function escapeRegExp( str ) {
		return str.replace( /[.*+?^${}()|[\]\\]/g, "\\$&" ); // $& means the whole matched string
	}
	var userNS = ( window.wgMarkRightsUserNameSpace || "User" ) + ":";
	var userUrlRegExp = new RegExp( "^" + escapeRegExp( mw.config.get( "wgArticlePath" ).replace( /\$1/g, userNS ) ) + "([^\\/]+)$" );

	function getUsername( href ) {
		if ( !href ) {
			return null;
		}
		var url = new URL( href, window.location.href );
		var username = url.searchParams.has( "title" ) ? url.searchParams.get( "title" ) : null;
		if ( username !== null && username.indexOf( "/" ) === -1 ) {
			return username.replace( userNS, "" ).replace( /_/g, " " );
		}
		var m = url.pathname.match( userUrlRegExp );
		if ( m ) {
			return decodeURIComponent( m[ 1 ].replace( /_/g, " " ) );
		}
		return null;
	}

	console.log( "屏蔽工具正在運行中......" );

	// eslint-disable-next-line no-jquery/no-global-selector, no-jquery/no-parse-html-literal
	$( "p, dd, li, ul" ).find( "a" ).filter( function ( _i, a ) {
		return users.indexOf( getUsername( a.href ) ) > -1;
	} ).parents( "p, dd, li, ul" ).html( "<small><div class=\"cover_user\">[由於法律因素,本訊息已被屏蔽,感謝您的諒解!]</div></small>" );
} );

// </nowiki>