「MediaWiki:Common.js」の版間の差分
ナビゲーションに移動
検索に移動
(テンプレート:タブの実装) |
(折り畳みボックス用のコードを書き直し) |
||
5行目: | 5行目: | ||
if (extraCSS && extraCSS.match(/\.css$/)) importStylesheet(extraCSS); | if (extraCSS && extraCSS.match(/\.css$/)) importStylesheet(extraCSS); | ||
/*[[テンプレート:折り畳みボックス]]*/ | /* [[テンプレート:折り畳みボックス]] */ | ||
var collapseCaption = '隠す'; | var collapseCaption = '隠す'; | ||
var expandCaption = '表示'; | var expandCaption = '表示'; | ||
function toggleCollapsible(key, e) { | function toggleCollapsible(key, e) { | ||
e.preventDefault(); | |||
if (this.hasClass('collapsed')) { | if (this.hasClass('collapsed')) { | ||
this.removeClass('collapsed').find('> tbody > tr:not(:first)').fadeIn(); | this.removeClass('collapsed').find('> tbody > tr:not(:first)').fadeIn(); | ||
19行目: | 20行目: | ||
if (key) $.cookie(key, 'collapsed', { path: '/', expires: 90 }); | if (key) $.cookie(key, 'collapsed', { path: '/', expires: 90 }); | ||
} | } | ||
} | } | ||
30行目: | 30行目: | ||
$table.addClass('made-collapsible'); | $table.addClass('made-collapsible'); | ||
var $button = | var $button = $table.find('tr:first > td:first > .collapseButton'); | ||
$table.$toggle = $button.append('[<a href="#"></a>]').children(); | |||
$table.$toggle = $button.children(); | |||
if (/^cookie-(.+)$/.test(collapse)) { | if (/^cookie-(.+)$/.test(collapse)) { | ||
43行目: | 42行目: | ||
if (collapse == 'collapsed' || (collapse == 'autocollapse' && | if (collapse == 'collapsed' || (collapse == 'autocollapse' && | ||
$table.siblings('table.collapsible').length | $table.siblings('table.collapsible').length)) { | ||
$table.addClass('collapsed').find('> tbody > tr:not(:first)').hide(); | $table.addClass('collapsed').find('> tbody > tr:not(:first)').hide(); | ||
$table.$toggle.text(expandCaption); | $table.$toggle.text(expandCaption); | ||
67行目: | 66行目: | ||
/*旧エケペディアへの言語間リンクで「_」を「%20」に変換する*/ | /* 旧エケペディアへの言語間リンクで「_」を「%20」に変換する */ | ||
$('#p-lang a:lang(akb49)').attr('href', function(i, href) { | $('#p-lang a:lang(akb49)').attr('href', function(i, href) { | ||
return href.replace('_', '%20', 'g'); | return href.replace('_', '%20', 'g'); | ||
73行目: | 72行目: | ||
/*非autoconfirmedユーザーの「ページを保存」ボタンをロックし、「プレビューを表示」ボタンへ誘導する*/ | /* 非autoconfirmedユーザーの「ページを保存」ボタンをロックし、「プレビューを表示」ボタンへ誘導する */ | ||
if (mw.config.get('wgAction') === 'edit' && mw.config.get('wgNamespaceNumber') === 0 && | if (mw.config.get('wgAction') === 'edit' && mw.config.get('wgNamespaceNumber') === 0 && | ||
$.inArray('autoconfirmed', mw.config.get('wgUserGroups')) < 0) { | $.inArray('autoconfirmed', mw.config.get('wgUserGroups')) < 0) { |