「MediaWiki:Gadget-StyleGuide.js」の版間の差分

提供:エケペディア
ナビゲーションに移動 検索に移動
(単純ミス)
(基本情報テンプレートを挿入できるように)
7行目: 7行目:
                 deferLoad: true,
                 deferLoad: true,
                 pages: {
                 pages: {
                     'style': {
                     'infoboxes': {
                         'layout': 'characters',
                         'layout': 'characters',
                         'label': '表記ガイドの推奨表記',
                         'label': '基本情報テンプレート',
                         'characters': [
                         'characters': [
                             {
                             {
                                 label: '[[]]',
                                 label: '{{メンバー情報}}',
                                 action: {
                                 action: {
                                     type: 'encapsulate',
                                     type: 'encapsulate',
                                     options: {
                                     options: {
                                         pre: '[[',
                                         pre: '{{メンバー情報\n| グループ = \n| チーム = \n| 名前 = \n| 読み = \n| 画像 = \n| 公式ニックネーム = \n| 所属事務所 = \n| 生年月日 = \n| 出身地 = \n| 血液型 = \n| 身長 = \n| 体重 = \n| スリーサイズ = \n| 靴のサイズ = \n| 合格期 = \n| 所属ユニット = \n| 選抜回数 = \n| サイリウム = \n| 第○回総選挙 = \n| 第○回じゃんけん大会 = \n}}'
                                         post: ']]'
                                    }
                                }
                            },
                            {
                                label: '{{シングル情報}}',
                                action: {
                                    type: 'encapsulate',
                                    options: {
                                        pre: '{{シングル情報\n| タイトル = \n| アーティスト = \n| 通算枚数 = \n| 区分 = シングル\n| 画像 = \n| 発売日 = \n| レーベル = \n| 選抜人数 = \n| 販売形態 = \n| 週間ランキング = \n| 初週売上 = \n| 月間ランキング = \n| 初月売上 = \n| 年間ランキング = \n| 売上枚数 = \n| 前作 = \n| 次作 = \n}}'
                                    }
                                }
                            },
                            {
                                label: '{{楽曲情報}}',
                                action: {
                                    type: 'encapsulate',
                                    options: {
                                         pre: '{{楽曲情報\n| タイトル = \n| 名義 = \n| 画像 = \n| 作詞 = \n| 作曲 = \n| 編曲 = \n| YouTube = \n| MV監督 = \n| タイアップ = \n}}'
                                     }
                                     }
                                 }
                                 }
                             },
                             },
                            '48グループ',
                            'AKB48', 'SKE48', 'NMB48', 'HKT48', 'NGT48',
                            'JKT48', 'SNH48', 'SDN48', '乃木坂46',
                            'チームA', 'チームK', 'チームB', 'チーム4', 'チーム8',
                            'チームS', 'チームKII', 'チームE',
                            'チームN', 'チームM', 'チームBII',
                            'チームH', 'チームKIV',
                            '研究生',
                         ]
                         ]
                     },
                     },

2015年9月11日 (金) 20:14時点における版

function customizeToolbar() {
    $('#wpTextbox1').wikiEditor('addToToolbar', {
        sections: {
            cheatsheet: {
                type: 'booklet',
                label: '記述ガイド',
                deferLoad: true,
                pages: {
                    'infoboxes': {
                        'layout': 'characters',
                        'label': '基本情報テンプレート',
                        'characters': [
                            {
                                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| 第○回総選挙 = \n| 第○回じゃんけん大会 = \n}}'
                                    }
                                }
                            },
                            {
                                label: '{{シングル情報}}',
                                action: {
                                    type: 'encapsulate',
                                    options: {
                                        pre: '{{シングル情報\n| タイトル = \n| アーティスト = \n| 通算枚数 = \n| 区分 = シングル\n| 画像 = \n| 発売日 = \n| レーベル = \n| 選抜人数 = \n| 販売形態 = \n| 週間ランキング = \n| 初週売上 = \n| 月間ランキング = \n| 初月売上 = \n| 年間ランキング = \n| 売上枚数 = \n| 前作 = \n| 次作 = \n}}'
                                    }
                                }
                            },
                            {
                                label: '{{楽曲情報}}',
                                action: {
                                    type: 'encapsulate',
                                    options: {
                                        pre: '{{楽曲情報\n| タイトル = \n| 名義 = \n| 画像 = \n| 作詞 = \n| 作曲 = \n| 編曲 = \n| YouTube = \n| MV監督 = \n| タイアップ = \n}}'
                                    }
                                }
                            },
                        ]
                    },
                    'templates': {
                        'layout': 'characters',
                        'label': '編集用テンプレート',
                        'characters': [
                            {
                                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: '{{要出典}}',
                                action: {
                                    type: 'encapsulate',
                                    options: {
                                        pre: '{{要出典|範囲=',
                                        post: '}}'
                                    }
                                }
                            },
                            {
                                label: '{{出典 Google+}}',
                                action: {
                                    type: 'encapsulate',
                                    options: {
                                        pre: '{{出典 Google+|url=',
                                        post: '|by=|date=}}'
                                    }
                                }
                            },
                            {
                                label: '{{編集合戦}}',
                                action: {
                                    type: 'encapsulate',
                                    options: {
                                        pre: '{{編集合戦|text=',
                                        post: '}}',
                                        ownline: true
                                    }
                                }
                            },
                            {
                                label: '{{書きかけ}}',
                                action: {
                                    type: 'encapsulate',
                                    options: {
                                        pre: '{{書きかけ|text=',
                                        post: '}}',
                                        ownline: true
                                    }
                                }
                            },
                            {
                                label: '{{発売前}}',
                                action: {
                                    type: 'encapsulate',
                                    options: {
                                        pre: '{{発売前|text=',
                                        post: '}}',
                                        ownline: true
                                    }
                                }
                            },
                            {
                                label: '{{予定}}',
                                action: {
                                    type: 'encapsulate',
                                    options: {
                                        pre: '{{予定|date=',
                                        post: '|text=}}',
                                        ownline: true
                                    }
                                }
                            },
                            {
                                label: '{{出典明記}}',
                                action: {
                                    type: 'encapsulate',
                                    options: {
                                        pre: '{{出典明記|text=',
                                        post: '}}',
                                        ownline: true
                                    }
                                }
                            },
                            {
                                label: '{{編集者希望}}',
                                action: {
                                    type: 'encapsulate',
                                    options: {
                                        pre: '{{編集者希望|text=',
                                        post: '}}',
                                        ownline: true
                                    }
                                }
                            },
                            {
                                label: '{{情報希望}}',
                                action: {
                                    type: 'encapsulate',
                                    options: {
                                        pre: '{{情報希望|text=',
                                        post: '}}',
                                        ownline: true
                                    }
                                }
                            },
                            {
                                label: '{{更新}}',
                                action: {
                                    type: 'encapsulate',
                                    options: {
                                        pre: '{{更新|text=',
                                        post: '}}',
                                        ownline: true
                                    }
                                }
                            },
                            {
                                label: '{{雑多}}',
                                action: {
                                    type: 'encapsulate',
                                    options: {
                                        pre: '{{雑多|text=',
                                        post: '}}',
                                        ownline: true
                                    }
                                }
                            },
                            {
                                label: '{{最終更新}}',
                                action: {
                                    type: 'encapsulate',
                                    options: {
                                        pre: '{{最終更新|text=',
                                        post: '}}',
                                        ownline: true
                                    }
                                }
                            },
                            {
                                label: '{{最新の出来事}}',
                                action: {
                                    type: 'encapsulate',
                                    options: {
                                        pre: '{{最新の出来事|date=',
                                        post: '|text=}}',
                                        ownline: true
                                    }
                                }
                            },
                        ]
                    },
                    footer: {
                        layout: 'table',
                        label: 'フッタ要素',
                        headings: [
                            { text: '解説' },
                            { text: '入力例' },
                            { text: '出力結果' }
                        ],
                        rows: [
                            {
                                description: { html: '脚注の表示' },
                                syntax: { html: '<span style="cursor:pointer;" onclick="insertTags(\'== 注釈 ==\\n&lt;references group=&quot;注釈&quot; /&gt;\')">== 注釈 ==<br>&lt;references group=&quot;注釈&quot; /&gt;</span><br><span style="cursor:pointer;" onclick="insertTags(\'== 出典 ==\\n&lt;references /&gt;\')">== 出典 ==<br>&lt;references /&gt;</span>' },
                                result: { html: '<h2>注釈</h2><ol class="references"><li id="cite_note-test-0"><span class="mw-cite-backlink"><a href="#">^</a></span> <span class="reference-text">注釈テキスト</span></li></ol><h2>出典</h2><ol class="references"><li id="cite_note-test-0"><span class="mw-cite-backlink"><a href="#">^</a></span> <span class="reference-text">出典テキスト</span></li></ol>' }
                            },
                            {
                                description: { html: 'DEFAULTSORT' },
                                syntax: { html: '<span style="cursor:pointer;" onclick="insertTags(\'{{DEFAULTSORT:\',\'}}\\n\')">{{DEFAULTSORT:まついしゆりな}}</span>' },
                                result: { html: '<span style="color:#999;">DEFUALTSORTは、表示されません</span>' }
                            },
                            {
                                description: { html: '言語間リンク' },
                                syntax: { html: '<span style="cursor:pointer;" onclick="insertTags(\'[[jawp:\',\']]\\n\')">[[jawp:乃木坂46]]</span><br><span style="cursor:pointer;" onclick="insertTags(\'[[akb49:\',\']]\\n\')">[[akb49:乃木坂46]]</span><br><span style="cursor:pointer;" onclick="insertTags(\'[[stage48:\',\']]\\n\')">[[stage48:Nogizaka46]]</span><br><span style="cursor:pointer;" onclick="insertTags(\'[[akb48wikia:\',\']]\\n\')">[[akb48wikia:Nogizaka46]]</span><br><span style="cursor:pointer;" onclick="insertTags(\'[[nogipedia:\',\']]\\n\')">[[nogipedia:乃木坂46]]</span>' },
                                result: { html: '<span style="color:#999;">言語間リンクは、表示されません</span>' }
                            },
                        ]
                    },
                    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、研究生、<br>卒業生、元メンバー、兼任終了' },
                                description: { html: '「グループ」に対応する所属チーム<br>過去の所属は入力せず「卒業生」などとする' }
                            },
                            {
                                name: { html: '新グループ' },
                                example: { html: '' },
                                description: { html: '組閣などで異動予定のグループ' }
                            },
                            {
                                name: { html: '新チーム' },
                                example: { html: '' },
                                description: { html: '組閣などで異動予定のチーム' }
                            },
                            {
                                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', function () {
        if ( mw.user.options.get( 'usebetatoolbar' ) == 1 && mw.user.options.get( 'showtoolbar' ) == 1 ) {
			$.when(
				mw.loader.using( 'ext.wikiEditor.toolbar' ),
				$.ready
			).then( customizeToolbar );
		}
    } );
}