編集の要約なし |
(相違点なし)
|
2025年4月26日 (土) 14:02時点における最新版
/* All JavaScript here will be loaded for users of the Citizen skin */
mw.hook('wikipage.content').add(function ($content) {
const relatedBox = $('<div id="related-articles-box"><em>関連記事を読み込み中…</em></div>');
$('#mw-content-text').append(relatedBox);
new mw.Api().get({
action: 'query',
prop: 'relatedarticles',
titles: mw.config.get('wgPageName'),
format: 'json'
}).then(function (data) {
const pages = data && data.query && data.query.pages;
if (!pages) return;
const pageId = Object.keys(pages)[0];
const articles = pages[pageId].relatedarticles;
if (!articles || articles.length === 0) {
relatedBox.text('');
return;
}
for (var i = 0; i < articles.length; i++) {
var a = articles[i];
html += '<li><a href="/wiki/' + encodeURIComponent(a.title) + '">' + a.title + '</a></li>';
}
html += '</ul>';
relatedBox.html(html);
});
});
// Citizenのダークモード自動検知を無効化する
mw.hook('citizen.ready').add(function() {
if (typeof Citizen !== 'undefined' && Citizen.Darkmode) {
Citizen.Darkmode.enabled = false;
Citizen.Darkmode.auto = false;
Citizen.Darkmode.manual = false;
document.documentElement.classList.remove('citizen-dark');
document.documentElement.classList.add('citizen-light');
}
});