その他の操作
編集の要約なし |
編集の要約なし |
||
| (同じ利用者による、間の2版が非表示) | |||
| 1行目: | 1行目: | ||
$(function(){ | /* [[Template:Spoiler]] */ | ||
$(function () { | |||
$('.spoiler-content') | |||
. | .off('click') // in case this code is loaded twice | ||
.on('click', function(){ | .on('click', function(e){ | ||
$ | $(this).toggleClass('show'); | ||
}).find('a').on('click', function(e){ | |||
e.stopPropagation(); | |||
}); | }); | ||
}); | }); | ||
/* End Template:Spoiler */ | |||
/* Link to imported modules from Lua code */ | |||
$(function() { | |||
var config = mw.config.get([ | |||
'wgCanonicalNamespace', | |||
'wgFormattedNamespaces' | |||
]); | |||
if (config.wgCanonicalNamespace !== 'Module') { | |||
return; | |||
} | |||
var localizedNamespace = config.wgFormattedNamespaces[828]; | |||
$('.s1, .s2, .s').each(function() { | |||
var $this = $(this); | |||
var html = $this.html(); | |||
var quote = html[0]; | |||
var isLongStringQuote = quote === '['; | |||
var quoteRE = new RegExp('^\\' + quote + '|\\' + quote + '$', 'g'); | |||
if (isLongStringQuote) { | |||
quoteRE = /^\[\[|\]\]$/g; | |||
} | |||
var name = html.replace(quoteRE, ''); | |||
var isEnglishPrefix = name.startsWith('Module:'); | |||
var isLocalizedPrefix = name.startsWith(localizedNamespace + ':'); | |||
var isDevPrefix = name.startsWith('Dev:'); | |||
if (isEnglishPrefix || isLocalizedPrefix || isDevPrefix) { | |||
var attrs = { | |||
href: mw.util.getUrl(name) | |||
}; | |||
if (isDevPrefix) { | |||
attrs.href = 'https://commons.wiki.gg/wiki/Module:' + mw.util.wikiUrlencode(name.replace('Dev:', '')); | |||
attrs.target = '_blank'; | |||
attrs.rel = 'noopener'; | |||
} | |||
var link = mw.html.element('a', attrs, name); | |||
var str = quote + link + quote; | |||
if (isLongStringQuote) { | |||
str = '[[' + link + ']]'; | |||
} | |||
$this.html(str); | |||
} | |||
}); | |||
}); | |||
/* CharInserts */ | |||
$(function() { | |||
$('.mw-charinsert-item').each(function() { | |||
$(this).text($(this).closest('div').attr('data-ci-label')); | |||
$(this).css('display', 'inline-block'); | |||
}); | }); | ||
$('.ci-loading-text').css('display','none'); | |||
}); | |||
2025年1月12日 (日) 04:11時点における最新版
/* [[Template:Spoiler]] */
$(function () {
$('.spoiler-content')
.off('click') // in case this code is loaded twice
.on('click', function(e){
$(this).toggleClass('show');
}).find('a').on('click', function(e){
e.stopPropagation();
});
});
/* End Template:Spoiler */
/* Link to imported modules from Lua code */
$(function() {
var config = mw.config.get([
'wgCanonicalNamespace',
'wgFormattedNamespaces'
]);
if (config.wgCanonicalNamespace !== 'Module') {
return;
}
var localizedNamespace = config.wgFormattedNamespaces[828];
$('.s1, .s2, .s').each(function() {
var $this = $(this);
var html = $this.html();
var quote = html[0];
var isLongStringQuote = quote === '[';
var quoteRE = new RegExp('^\\' + quote + '|\\' + quote + '$', 'g');
if (isLongStringQuote) {
quoteRE = /^\[\[|\]\]$/g;
}
var name = html.replace(quoteRE, '');
var isEnglishPrefix = name.startsWith('Module:');
var isLocalizedPrefix = name.startsWith(localizedNamespace + ':');
var isDevPrefix = name.startsWith('Dev:');
if (isEnglishPrefix || isLocalizedPrefix || isDevPrefix) {
var attrs = {
href: mw.util.getUrl(name)
};
if (isDevPrefix) {
attrs.href = 'https://commons.wiki.gg/wiki/Module:' + mw.util.wikiUrlencode(name.replace('Dev:', ''));
attrs.target = '_blank';
attrs.rel = 'noopener';
}
var link = mw.html.element('a', attrs, name);
var str = quote + link + quote;
if (isLongStringQuote) {
str = '[[' + link + ']]';
}
$this.html(str);
}
});
});
/* CharInserts */
$(function() {
$('.mw-charinsert-item').each(function() {
$(this).text($(this).closest('div').attr('data-ci-label'));
$(this).css('display', 'inline-block');
});
$('.ci-loading-text').css('display','none');
});