コンテンツにスキップ

利用者:Fryed-peach/FA.js

お知らせ: 保存した後、ブラウザのキャッシュをクリアしてページを再読み込みする必要があります。

多くの WindowsLinux のブラウザ

  • Ctrl を押しながら F5 を押す。

Mac における Safari

  • Shift を押しながら、更新ボタン をクリックする。

Mac における ChromeFirefox

  • Cmd Shift を押しながら R を押す。

詳細についてはWikipedia:キャッシュを消すをご覧ください。

/**
 * Interwiki links to featured articles
 *
 * Highlights interwiki links to featured articles (or equivalents) by changing
 * the bullet before the interwiki link into a star.
 *
 * @author: [[User:R. Koot]]
 * @author: [[User:Helder.wiki]]
 * TODO: add support for
 * - featured portals (used in frwiki)
 * - localized class names (used by eswiki, frwiki, ptwiki, rowiki, etc)
 * - complex language fallbacks (see [[zh:MediaWiki:Gadget-site-lib.js]])
 *
 * Warning! Global gadget file!
 */
/*global mw, $ */
var i18n = {
	'badge-featured': {
		en: 'This is a featured article in this language.',
		ja: 'この記事は秀逸な記事に選ばれています。'
	},
	'badge-good': {
		en: 'This is a good article in this language.',
		ja: 'この記事は良質な記事に選ばれています。'
	},
	'badge-featured-list': {
		en: 'This is a featured list in this language.',
		ja: 'この記事は秀逸な一覧に選ばれています。'
	}
};

function msg( key ){
	return i18n[ key ][ mw.config.get( 'wgUserLanguage' ).split('-')[0] ] || i18n[ key ].en;
}

function linkFA() {
	var $list = mw.config.get( 'skin' ) === 'cologneblue' ?
		$( '#langlinks' ).find( 'span' ) :
		$( '#p-lang' ).find( 'li' );
	$list.each( function(){
		var $this = $( this ),
			lang = $this.find( '[lang]' ).attr( 'lang' ) || '',
			id = 'interwiki-' + lang.toLowerCase();
		if ( document.getElementById( id + '-fa' ) && !$this.hasClass( 'badge-featuredarticle' ) ) {
			$this.addClass( 'FA' )
				.attr( 'title', msg( 'badge-featured' ) );
		} else if ( document.getElementById( id + '-ga' ) && !$this.hasClass( 'badge-goodarticle' ) ) {
			$this.addClass( 'GA' )
				.attr( 'title', msg( 'badge-good' ) );
		} else if ( document.getElementById( id + '-fl' ) && !$this.hasClass( 'badge-featuredlist' ) ) {
			$this.addClass( 'FL' )
				.attr( 'title', msg( 'badge-featured-list' ) );
		}
	} );
}

mw.hook( 'wikipage.content' ).add( linkFA );