MediaWiki:Gadget-StyleGuide.js

提供:エケペディア
ナビゲーションに移動 検索に移動

注意: 保存後、変更を確認するにはブラウザーのキャッシュを消去する必要がある場合があります。

  • Firefox / Safari: Shift を押しながら 再読み込み をクリックするか、Ctrl-F5 または Ctrl-R を押してください (Mac では ⌘-R)
  • Google Chrome: Ctrl-Shift-R を押してください (Mac では ⌘-Shift-R)
  • Internet Explore/Edger: Ctrl を押しながら 最新の情報に更新 をクリックするか、Ctrl-F5 を押してください
  • Opera: Ctrl-F5を押してください
// <nowiki>

function customizeToolbar() {
    $('#wpTextbox1').wikiEditor('addToToolbar', {
        sections: {
            cheatsheet: {
                type: 'booklet',
                label: '記述ガイド',
                deferLoad: true,
                pages: {
                    'headers': {
                        'layout': 'characters',
                        'label': 'ヘッダ要素',
                        'characters': [
                            {
                                label: '{{グループ情報}}',
                                action: {
                                    type: 'encapsulate',
                                    options: {
                                        pre: '{{グループ情報\n| グループ名 = \n| 画像 = \n| 関連ページ = \n| 活動期間 = \n| チーム = \n| レーベル = \n| 総合プロデューサー = \n| 公式サイト = \n}}',
                                        ownline: true
                                    }
                                }
                            },
                            {
                                label: '{{ユニット情報}}',
                                action: {
                                    type: 'encapsulate',
                                    options: {
                                        pre: '{{ユニット情報\n| 名前 = \n| 画像 = \n| 活動期間 = \n| レーベル = \n| 事務所 = \n| 公式サイト = \n| メンバー = \n| 旧メンバー = \n}}',
                                        ownline: true
                                    }
                                }
                            },
                            {
                                label: '{{メンバー情報}}',
                                action: {
                                    type: 'encapsulate',
                                    options: {
                                        pre: '{{メンバー情報\n| グループ = \n| チーム = \n| 名前 = \n| 読み = \n| 画像 = \n| 公式ニックネーム = \n| 所属事務所 = \n| 生年月日 = \n| 出身地 = \n| 血液型 = \n| 身長 = \n| 体重 = \n| スリーサイズ = \n| 靴のサイズ = \n| 合格期 = \n| 所属ユニット = \n| 選抜回数 = \n| サイリウム = \n}}',
                                        ownline: true
                                    }
                                }
                            },
                            {
                                label: '{{関係者情報}}',
                                action: {
                                    type: 'encapsulate',
                                    options: {
                                        pre: '{{関係者情報\n| 名前 = \n| 読み = \n| 役職 = \n| bgcolor = \n| 画像 = \n| ニックネーム = \n| 所属事務所 = \n| 生年月日 = \n| 出身地 = \n| 血液型 = \n| 身長 = \n| 体重 = \n}}',
                                        ownline: true
                                    }
                                }
                            },
                            {
                                label: '{{シングル情報}}',
                                action: {
                                    type: 'encapsulate',
                                    options: {
                                        pre: '{{シングル情報\n| タイトル = \n| アーティスト = \n| 通算枚数 = \n| 区分 = シングル\n| 画像 = \n| 発売日 = \n| レーベル = \n| 選抜人数 = \n| 販売形態 = \n| 週間ランキング = \n| 初週売上 = \n| 月間ランキング = \n| 初月売上 = \n| 年間ランキング = \n| 売上枚数 = \n| 前作 = \n| 次作 = \n}}',
                                        ownline: true
                                    }
                                }
                            },
                            {
                                label: '{{アルバム情報}}',
                                action: {
                                    type: 'encapsulate',
                                    options: {
                                        pre: '{{アルバム情報\n| タイトル = \n| アーティスト = \n| 通算枚数 = \n| 区分 = シングル\n| 画像 = \n| 発売日 = \n| レーベル = \n| 選抜人数 = \n| 販売形態 = \n| 週間ランキング = \n| 初週売上 = \n| 月間ランキング = \n| 初月売上 = \n| 年間ランキング = \n| 売上枚数 = \n| 前作 = \n| 次作 = \n}}',
                                        ownline: true
                                    }
                                }
                            },
                            {
                                label: '{{楽曲情報}}',
                                action: {
                                    type: 'encapsulate',
                                    options: {
                                        pre: '{{楽曲情報\n| タイトル = \n| 名義 = \n| 画像 = \n| 作詞 = \n| 作曲 = \n| 編曲 = \n| YouTube = \n| MV監督 = \n| 振付 = \n| タイアップ = \n}}',
                                        ownline: true
                                    }
                                }
                            },
                            {
                                label: '[[ファイル:<ファイル名>|250px]]',
                                action: {
                                    type: 'encapsulate',
                                    options: {
                                        pre: '[[ファイル:',
                                        post: '|250px]]'
                                    }
                                }
                            },
                            {
                                label: '{{書きかけ}}',
                                action: {
                                    type: 'encapsulate',
                                    options: {
                                        pre: '{{書きかけ}}',
                                        ownline: true
                                    }
                                }
                            },
                            {
                                label: '{{編集者希望}}',
                                action: {
                                    type: 'encapsulate',
                                    options: {
                                        pre: '{{編集者希望}}',
                                        ownline: true
                                    }
                                }
                            },
                            {
                                label: '{{情報希望}}',
                                action: {
                                    type: 'encapsulate',
                                    options: {
                                        pre: '{{情報希望|',
                                        post: '}}',
                                        ownline: true
                                    }
                                }
                            },
                            {
                                label: '{{更新}}',
                                action: {
                                    type: 'encapsulate',
                                    options: {
                                        pre: '{{更新}}',
                                        ownline: true
                                    }
                                }
                            },
                            {
                                label: '{{雑多}}',
                                action: {
                                    type: 'encapsulate',
                                    options: {
                                        pre: '{{雑多}}',
                                        ownline: true
                                    }
                                }
                            },
                            {
                                label: '{{発売前}}',
                                action: {
                                    type: 'encapsulate',
                                    options: {
                                        pre: '{{発売前|',
                                        post: '}}',
                                        ownline: true
                                    }
                                }
                            },
                            {
                                label: '{{予定}}',
                                action: {
                                    type: 'encapsulate',
                                    options: {
                                        pre: '{{予定}}',
                                        ownline: true
                                    }
                                }
                            },
                            {
                                label: '{{最新の出来事}}',
                                action: {
                                    type: 'encapsulate',
                                    options: {
                                        pre: '{{最新の出来事}}',
                                        ownline: true
                                    }
                                }
                            },
                            {
                                label: '{{最終更新}}',
                                action: {
                                    type: 'encapsulate',
                                    options: {
                                        pre: '{{最終更新}}',
                                        ownline: true
                                    }
                                }
                            },
                            {
                                label: '{{出典明記}}',
                                action: {
                                    type: 'encapsulate',
                                    options: {
                                        pre: '{{出典明記}}',
                                        ownline: true
                                    }
                                }
                            },
                            {
                                label: '{{編集合戦}}',
                                action: {
                                    type: 'encapsulate',
                                    options: {
                                        pre: '{{編集合戦}}',
                                        ownline: true
                                    }
                                }
                            },
                            {
                                label: '{{保護中}}',
                                action: {
                                    type: 'encapsulate',
                                    options: {
                                        pre: '{{保護中|reason=',
                                        post: '}}',
                                        ownline: true
                                    }
                                }
                            },
                        ]
                    },
                    'templates': {
                        'layout': 'characters',
                        'label': '編集用テンプレート',
                        'characters': [
                            {
                                label: '{{要出典}}',
                                action: {
                                    type: 'encapsulate',
                                    options: {
                                        pre: '{{要出典}}'
                                    }
                                }
                            },
                            {
                                label: '{{要出典|}}',
                                action: {
                                    type: 'encapsulate',
                                    options: {
                                        pre: '{{要出典|',
                                        post: '}}'
                                    }
                                }
                            },
                            {
                                label: '<ref></ref>',
                                action: {
                                    type: 'encapsulate',
                                    options: {
                                        pre: '<ref>',
                                        post: '</ref>'
                                    }
                                }
                            },
                            {
                                label: '<ref name=""></ref>',
                                action: {
                                    type: 'encapsulate',
                                    options: {
                                        pre: '<ref name="">',
                                        post: '</ref>'
                                    }
                                }
                            },
                            {
                                label: '{{出典 Google+|url= |by= |date= }}',
                                action: {
                                    type: 'encapsulate',
                                    options: {
                                        pre: '{{出典 Google+|url=',
                                        post: '|by=|date=}}'
                                    }
                                }
                            },
                            {
                                label: '{{注釈}}',
                                action: {
                                    type: 'encapsulate',
                                    options: {
                                        pre: '{{注釈|',
                                        post: '}}'
                                    }
                                }
                            },
                        ]
                    },
                    'footers': {
                        'layout': 'characters',
                        'label': 'フッタ要素',
                        'characters': [
                            {
                                label: '== 注釈 ==',
                                action: {
                                    type: 'encapsulate',
                                    options: {
                                        pre: '== 注釈 ==\n<references group="注釈" />',
                                        ownline: true
                                    }
                                }
                            },
                            {
                                label: '== 出典 ==',
                                action: {
                                    type: 'encapsulate',
                                    options: {
                                        pre: '== 出典 ==\n<references />',
                                        ownline: true
                                    }
                                }
                            },
                            {
                                label: '{{DEFAULTSORT:}}',
                                action: {
                                    type: 'encapsulate',
                                    options: {
                                        pre: '{{DEFAULTSORT:',
                                        post: '}}',
                                        ownline: true
                                    }
                                }
                            },
                            {
                                label: '[[カテゴリ:]]',
                                action: {
                                    type: 'encapsulate',
                                    options: {
                                        pre: '[[カテゴリ:',
                                        post: ']]',
                                        ownline: true
                                    }
                                }
                            },
                            {
                                label: '[[jawp:]]',
                                action: {
                                    type: 'encapsulate',
                                    options: {
                                        pre: '[[jawp:',
                                        post: ']]',
                                        ownline: true
                                    }
                                }
                            },
                            {
                                label: '[[akb49:]]',
                                action: {
                                    type: 'encapsulate',
                                    options: {
                                        pre: '[[akb49:',
                                        post: ']]',
                                        ownline: true
                                    }
                                }
                            },
                            {
                                label: '[[stage48:]]',
                                action: {
                                    type: 'encapsulate',
                                    options: {
                                        pre: '[[stage48:',
                                        post: ']]',
                                        ownline: true
                                    }
                                }
                            },
                            {
                                label: '[[akb48wikia:]]',
                                action: {
                                    type: 'encapsulate',
                                    options: {
                                        pre: '[[akb48wikia:',
                                        post: ']]',
                                        ownline: true
                                    }
                                }
                            },
                            {
                                label: '[[nogipedia:]]',
                                action: {
                                    type: 'encapsulate',
                                    options: {
                                        pre: '[[nogipedia:',
                                        post: ']]',
                                        ownline: true
                                    }
                                }
                            },
                            {
                                label: '[[baidu:]]',
                                action: {
                                    type: 'encapsulate',
                                    options: {
                                        pre: '[[baidu:',
                                        post: ']]',
                                        ownline: true
                                    }
                                }
                            },
                            {
                                label: '[[namuwiki:]]',
                                action: {
                                    type: 'encapsulate',
                                    options: {
                                        pre: '[[namuwiki:',
                                        post: ']]',
                                        ownline: true
                                    }
                                }
                            },
                        ]
                    },
                    memberInfo: {
                        layout: 'table',
                        label: 'メンバー情報テンプレート',
                        headings: [
                            { text: '引数' },
                            { text: '入力例' },
                            { text: '解説' }
                        ],
                        rows: [
                            {
                                name: { html: 'グループ<br>グループ<i>n</i>' },
                                example: { html: 'AKB48' },
                                description: { html: '所属グループ' }
                            },
                            {
                                name: { html: 'チーム<br>チーム<i>n</i>' },
                                example: { html: 'チームA、研究生' },
                                description: { html: '「グループ」に対応する所属チーム' }
                            },
                            {
                                name: { html: '元グループ<br>元グループ<i>n</i>' },
                                example: { html: 'AKB48' },
                                description: { html: '過去の所属グループ<br>現在48・46グループに所属している場合は入力しない' }
                            },
                            {
                                name: { html: '名前' },
                                example: { html: '松井 珠理奈' },
                                description: { html: '姓と名の間には半角スペースを入れる' }
                            },
                            {
                                name: { html: '読み' },
                                example: { html: 'まつい じゅりな' },
                                description: { html: 'ひらがなで、姓と名の間には半角スペースを入れる' }
                            },
                            {
                                name: { html: '画像' },
                                example: { html: '[[ファイル:example.jpg|250px]]' },
                                description: { html: '公式のプロフィール画像を指定' }
                            },
                            {
                                name: { html: 'ニックネーム' },
                                example: { html: '' },
                                description: { html: '公式プロフィールによるニックネーム' }
                            },
                            {
                                name: { html: '所属事務所' },
                                example: { html: '' },
                                description: { html: '' }
                            },
                            {
                                name: { html: '生年月日' },
                                example: { html: '1997/3/8' },
                                description: { html: '' }
                            },
                            {
                                name: { html: '出身地' },
                                example: { html: '愛知県' },
                                description: { html: '' }
                            },
                            {
                                name: { html: '血液型' },
                                example: { html: 'A型、B型、O型、AB型、不明' },
                                description: { html: '' }
                            },
                            {
                                name: { html: '身長' },
                                example: { html: '163cm' },
                                description: { html: '' }
                            },
                            {
                                name: { html: '体重' },
                                example: { html: '' },
                                description: { html: '' }
                            },
                            {
                                name: { html: 'スリーサイズ' },
                                example: { html: 'B78 W60 H85' },
                                description: { html: '' }
                            },
                            {
                                name: { html: '靴のサイズ' },
                                example: { html: '24.5cm' },
                                description: { html: '' }
                            },
                            {
                                name: { html: '合格期' },
                                example: { html: '1期生、<br>SKE48 1期生' },
                                description: { html: '' }
                            },
                            {
                                name: { html: 'ユニット' },
                                example: { html: '' },
                                description: { html: '' }
                            },
                            {
                                name: { html: '選抜回数' },
                                example: { html: '' },
                                description: { html: '' }
                            },
                            {
                                name: { html: 'サイリウム' },
                                example: { html: '{{サイリウム|オレンジ|緑}}' },
                                description: { html: '' }
                            },
                            {
                                name: { html: '第<i>n</i>回総選挙' },
                                example: { html: '19位' },
                                description: { html: '' }
                            },
                            {
                                name: { html: '第<i>n</i>回じゃんけん大会' },
                                example: { html: 'SKE48予備戦→3回戦敗退、<br>1回戦敗退、<br>1位' },
                                description: { html: '' }
                            },
                        ]
                    },
                    setlist: {
                        layout: 'table',
                        label: 'セットリストの記述',
                        headings: [
                            { text: '解説' },
                            { text: '入力例' },
                            { text: '出力結果' }
                        ],
                        rows: [
                            {
                                description: { html: '開始 / 終了' },
                                syntax: { html: '<span style="cursor:pointer;" onclick="insertTags(\'<div class=&quot;setlist with-overture&quot;>\\n\',\'\\n</div>\',\'<!--ここにセットリストを記述-->\')">&lt;div class="setlist with-overture"&gt;<br><span style="color:#999;">&lt;!--ここにセットリストを記述--&gt;</span><br>&lt;/div&gt;</span>' },
                                result: { html: '' }
                            },
                            {
                                description: { html: '曲目' },
                                syntax: { html: "# '''overture'''<br># '''Jane Doe'''/高橋みなみ<br># '''ギンガムチェック'''<br># '''チョコの奴隷'''" },
                                result: { html: '<div class="setlist with-overture"><ol><li><b>overture</b></li><li><b>Jane Doe</b>/高橋みなみ</li><li><b>ギンガムチェック</b></li><li><b>チョコの奴隷</b></li></ol></div>' }
                            },
                            {
                                description: { html: '歌唱メンバー' },
                                syntax: { html: "# '''キリギリス人'''/ノースリーブス<br>#: 高橋みなみ・小嶋陽菜・峯岸みなみ " },
                                result: { html: '<div class="setlist" style="counter-reset: setlist-item 3;"><ol><li><b>キリギリス人</b>/ノースリーブス<dl><dd>高橋みなみ・小嶋陽菜・峯岸みなみ </dd></dl></li></ol></div>' }
                            },
                            {
                                description: { html: 'メドレー' },
                                syntax: { html: "# '''AKB48グループメドレー'''<br>## UZA<br>## GAGAGA<br>## 美しい稲妻" },
                                result: { html: '<div class="setlist" style="counter-reset: setlist-item 4;"><ol><li><b>AKB48グループメドレー</b><ol><li>UZA</li><li>GAGAGA</li><li>美しい稲妻</li></ol></li></ol></div>' }
                            },
                            {
                                description: { html: 'アンコール' },
                                syntax: { html: '<span style="cursor:pointer;" onclick="insertTags(\'<div class=&quot;setlist encore&quot;>\\n\',\'\\n</div>\',\'<!--ここにセットリストを記述-->\')">&lt;div class=\"setlist encore\"&gt;<br># \'\'\'ラブラドール・レトリバー\'\'\'<br># \'\'\'少女たちよ\'\'\'<br># \'\'\'After rain\'\'\'<br>&lt;/div&gt;</span>' },
                                result: { html: '<div class="setlist encore"><ol><li><b>ラブラドール・レトリバー</b></li><li><b>少女たちよ</b></li><li><b>After rain</b></li></ol></div>' }
                            },
                            {
                                description: { html: 'ダブルアンコール' },
                                syntax: { html: '<span style="cursor:pointer;" onclick="insertTags(\'<div class=&quot;setlist double-encore&quot;>\\n\',\'\\n</div>\',\'<!--ここにセットリストを記述-->\')">&lt;div class=\"setlist double-encore\"&gt;<br># \'\'\'ラブラドール・レトリバー\'\'\'<br># \'\'\'少女たちよ\'\'\'<br># \'\'\'After rain\'\'\'<br>&lt;/div&gt;</span>' },
                                result: { html: '<div class="setlist double-encore"><ol><li><b>ラブラドール・レトリバー</b></li><li><b>少女たちよ</b></li><li><b>After rain</b></li></ol></div>' }
                            },
                        ]
                    }
                }
            }
        }
    });
}

/* Check if view is in edit mode and that the required modules are available. Then, customize the toolbar . . . */
if ( $.inArray( mw.config.get( 'wgAction' ), [ 'edit', 'submit' ] ) !== -1 ) {
    mw.loader.using( 'user.options').then( function() { 
        if ( mw.user.options.get( 'usebetatoolbar' ) == 1 ) {
			$.when(
				mw.loader.using( 'ext.wikiEditor' ),
				$.ready
			).then( customizeToolbar );
		}
    } );
}

// </nowiki>