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

提供:エケペディア
ナビゲーションに移動 検索に移動
(WikiEditorに記述ガイドを拡張(mw:Extension:WikiEditor/Toolbar_customization))
 
(<references/>が正しく挿入できるよう修正)
18行目: 18行目:
                             {
                             {
                                 description: { text: '脚注・出典' },
                                 description: { text: '脚注・出典' },
                                 syntax: { html: '<span style="cursor:pointer;" onclick="insertTags(\'== 脚注・出典==\\n<references />\',\'\',\'\');return false">== 脚注・出典 ==<br>&lt;references /&gt;</span>' },
                                 syntax: { html: '<span style="cursor:pointer;" onclick="insertTags(\'== 脚注・出典==\\n&lt;references /&gt;\',\'\',\'\');return false">== 脚注・出典 ==<br>&lt;references /&gt;</span>' },
                                 result: { html: '<h2>脚注・注釈</h2>' }
                                 result: { html: '<h2>脚注・注釈</h2>' }
                             },
                             },

2014年5月6日 (火) 16:51時点における版

function customizeToolbar() {
    $('#wpTextbox1').wikiEditor('addToToolbar', {
        'sections': {
            'cheatsheet': {
                'type': 'booklet',
                'label': '記述ガイド',
                'deferLoad': true,
                'pages': {
                    'basic': {
                        'layout': 'table',
                        'label': '基本要素',
                        'headings': [
                            { textMsg: 'wikieditor-toolbar-help-heading-description' },
                            { textMsg: 'wikieditor-toolbar-help-heading-syntax' },
                            { textMsg: 'wikieditor-toolbar-help-heading-result' }
                        ],
                        'rows': [
                            {
                                description: { text: '脚注・出典' },
                                syntax: { html: '<span style="cursor:pointer;" onclick="insertTags(\'== 脚注・出典==\\n&lt;references /&gt;\',\'\',\'\');return false">== 脚注・出典 ==<br>&lt;references /&gt;</span>' },
                                result: { html: '<h2>脚注・注釈</h2>' }
                            },
                            {
                                description: { text: 'フッタ' },
                                syntax: { html: '<a href="#" onclick="insertTags(\'{{DEFAULTSORT:\',\'}}\\n\',\'\');return false">{{DEFAULTSORT:まついしゆりな}}</a><br><br><a href="#" onclick="insertTags(\'[[jawp:\',\']]\\n\',\'\');return false">[[jawp:AKB48]]</a><br><a href="#" onclick="insertTags(\'[[stage48:\',\']]\\n\',\'\');return false">[[stage48:AKB48]]</a><br><a href="#" onclick="insertTags(\'[[akb48wikia:\',\']]\\n\',\'\');return false">[[akb48wikia:AKB48]]</a>' },
                                result: { html: '' }
                            },
                        ]
                    },
                    'setlist': {
                        'layout': 'table',
                        'label': 'セットリスト',
                        'headings': [
                            { textMsg: 'wikieditor-toolbar-help-heading-description' },
                            { textMsg: 'wikieditor-toolbar-help-heading-syntax' },
                            { textMsg: 'wikieditor-toolbar-help-heading-result' }
                        ],
                        'rows': [
                            {
                                description: { html: '開始 / 終了<br>' },
                                syntax: { html: '<span style="cursor:pointer;" onclick="insertTags(\'<div class=&quot;setlist with-overture&quot;>\\n\',\'\\n</div>\',\'<!--ここにセットリストを記述-->\');return false">&lt;div class="setlist with-overture"&gt;<br><span style="color:#999;">&lt;!--ここにセットリストを記述--&gt;</span><br>&lt;/div&gt;</span>' },
                                result: { html: '' }
                            },
                            {
                                description: { text: '曲目' },
                                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: { text: '歌唱メンバー' },
                                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: { text: 'メドレー' },
                                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: { text: 'アンコール' },
                                syntax: { html: '<span style="cursor:pointer;" onclick="insertTags(\'<div class=&quot;setlist encore&quot;>\\n\',\'\\n</div>\',\'<!--ここにセットリストを記述-->\');return false">&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') && mw.user.options.get( 'showtoolbar' ) ) {
            mw.loader.using( 'ext.wikiEditor.toolbar', customizeToolbar );
        }
    } );
}

// Add the customizations to LiquidThreads' edit toolbar, if available
mw.hook( 'ext.lqt.textareaCreated' ).add( customizeToolbar );