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

提供:エケペディア
ナビゲーションに移動 検索に移動
(推奨表記の定型文挿入の方法を変更。メンバー情報テンプレートの表記ガイドを追加)
(カテゴリ:メッセージボックスのテンプレートを追加)
45行目: 45行目:
                             },
                             },
                             {
                             {
                                 label: '{{MSG WRITERWANTED}}',
                                 label: '{{編集合戦}}',
                                 action: {
                                 action: {
                                     type: 'encapsulate',
                                     type: 'encapsulate',
                                     options: {
                                     options: {
                                         pre: '{{MSG WRITERWANTED|text=',
                                         pre: '{{編集合戦|text=',
                                         post: '}}',
                                         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
                                         ownline: true
                                     }
                                     }
259行目: 369行目:
if ( $.inArray( mw.config.get( 'wgAction' ), [ 'edit', 'submit' ] ) !== -1 ) {
if ( $.inArray( mw.config.get( 'wgAction' ), [ 'edit', 'submit' ] ) !== -1 ) {
     mw.loader.using( 'user.options', function () {
     mw.loader.using( 'user.options', function () {
         if ( mw.user.options.get('usebetatoolbar') && mw.user.options.get( 'showtoolbar' ) ) {
         if ( mw.user.options.get( 'usebetatoolbar' ) == 1 && mw.user.options.get( 'showtoolbar' ) == 1 ) {
            mw.loader.using( 'ext.wikiEditor.toolbar', customizeToolbar );
$.when(
        }
mw.loader.using( 'ext.wikiEditor.toolbar' ),
$.ready
).then( customizeToolbar );
}
     } );
     } );
}
}

2014年9月18日 (木) 19:25時点における版

function customizeToolbar() {
    $('#wpTextbox1').wikiEditor('addToToolbar', {
        sections: {
            cheatsheet: {
                type: 'booklet',
                label: '記述ガイド',
                deferLoad: true,
                pages: {
                    'style': {
                        'layout': 'characters',
                        'label': '表記ガイドの推奨表記',
                        'characters': [
                            '48グループ',
                            'AKB48', 'SKE48', 'NMB48', 'HKT48',
                            'JKT48', 'SNH48', 'SDN48', '乃木坂46',
                            'チームA', 'チームK', 'チームB', 'チーム4', 'チーム8', '研究生',
                            'チームS', 'チームKII', 'チームE',
                            'チームN', 'チームM', 'チームBII',
                            'チームH', 'チームKIV',
                        ]
                    },
                    'templates': {
                        'layout': 'characters',
                        'label': '編集用テンプレート',
                        'characters': [
                            {
                                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(\'{[要出典|範囲=\',\'}}\')">{{要出典|範囲=ページ本文}}</span>。' },
                            //     result: { html: '<span class="fix-domain">ページ本文</span><sup>[<i><a href="#">要出典</a></i>]</sup>。' }
                            // },
                            // {
                            //     description: { html: '注釈' },
                            //     syntax: { html: 'ページ本文<span style="cursor:pointer;" onclick="insertTags(\'&lt;ref&gt;\',\'&lt;/ref&gt;\')">&lt;ref&gt;脚注テキスト&lt;/ref&gt;</span>。' },
                            //     result: { html: 'ページ本文<sup class="reference"><a href="#">[1]</a></sup>。' }
                            // },
                            {
                                description: { html: '脚注の表示' },
                                syntax: { html: '<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>' }
                            },
                            {
                                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:AKB48]]</span><br><span style="cursor:pointer;" onclick="insertTags(\'[[akb49:\',\']]\\n\')">[[akb49:AKB48]]</span><br><span style="cursor:pointer;" onclick="insertTags(\'[[stage48:\',\']]\\n\')">[[stage48:AKB48]]</span><br><span style="cursor:pointer;" onclick="insertTags(\'[[akb48wikia:\',\']]\\n\')">[[akb48wikia:AKB48]]</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: '選抜総選挙' },
                                example: { html: '{{総選挙|19位|10位|14位|9位|6位|4位}}' },
                                description: { html: '' }
                            },
                            {
                                name: { html: 'じゃんけん大会' },
                                example: { html: '{{じゃんけん大会||SKE48予備戦→3回戦敗退|1回戦敗退|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>' }
                            },
                        ]
                    }
                }
            }
        }
    });
}

/* 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 );
		}
    } );
}