編集の要約なし |
編集の要約なし |
||
6行目: | 6行目: | ||
// ユーザー名歓迎表示 | // ユーザー名歓迎表示 | ||
mw.hook('wikipage.content').add(function () { | |||
const username = mw.config.get('wgUserName'); | |||
if (!username) return; | |||
// すでに表示済みならスキップ | |||
if ($('#welcome-message').length) return; | |||
const message = $('<div>', { | |||
id: 'welcome-message', | |||
text: `🌟 ようこそ、${username} さん!`, | |||
css: { | |||
background: '#1a73e8', | |||
color: '#fff', | |||
padding: '6px 12px', | |||
borderRadius: '6px', | |||
fontWeight: 'bold', | |||
textAlign: 'center', | |||
marginBottom: '8px' | |||
} | } | ||
}); | |||
// Citizenスキンでの挿入位置(ヘッダーの下) | |||
$('.citizen-header').first().after(message); | |||
}); | }); | ||
// 折りたたみ可能セクション | // 折りたたみ可能セクション |
2025年3月28日 (金) 02:08時点における版
mw.hook('wikipage.content').add(function ($content) { // すべての中身をここに入れて動かす // ユーザー名歓迎表示 mw.hook('wikipage.content').add(function () { const username = mw.config.get('wgUserName'); if (!username) return; // すでに表示済みならスキップ if ($('#welcome-message').length) return; const message = $('<div>', { id: 'welcome-message', text: `🌟 ようこそ、${username} さん!`, css: { background: '#1a73e8', color: '#fff', padding: '6px 12px', borderRadius: '6px', fontWeight: 'bold', textAlign: 'center', marginBottom: '8px' } }); // Citizenスキンでの挿入位置(ヘッダーの下) $('.citizen-header').first().after(message); }); // 折りたたみ可能セクション $(function() { $('.mw-headline').click(function() { $(this).parent().nextUntil('h2, h3, h4, h5, h6').slideToggle(); }).css('cursor', 'pointer'); }); // 目次トグル機能追加 $(function(){ var toc = $('#toc'); if(toc.length){ toc.before('<button id="toggle-toc">目次を開閉</button>'); $('#toggle-toc').css({ margin: '5px', padding: '3px 6px', cursor: 'pointer' }).click(function(){ toc.slideToggle(); }); } }); // 外部リンクを新規タブで開く $(function() { $('a.external').attr('target', '_blank'); }); // ユーステラ風✨星キラキラカーソル(頻度調整+水色強化版) var lastStarTime = 0; $(document).mousemove(function(e) { var now = Date.now(); if (now - lastStarTime < 100) return; // 出現頻度を調整(100を大きくすればさらに少なくなる) lastStarTime = now; var colors = ['#6ff', '#9cf', '#cff', '#8df', '#7af']; // より水色っぽく調整 var star = $('<div>').text('✦').css({ position: 'absolute', top: e.pageY - 10, left: e.pageX - 10, color: colors[Math.floor(Math.random() * colors.length)], fontSize: '14px', pointerEvents: 'none', opacity: 1, zIndex: 9999, userSelect: 'none', textShadow: '0 0 6px #8df, 0 0 12px #6ff' }).appendTo('body'); star.animate({ top: e.pageY - (Math.random() * 40 - 20), left: e.pageX - (Math.random() * 40 - 20), opacity: 0, fontSize: '4px' }, 1000, function() { $(this).remove(); }); }); });