İstifadəçi:ReiKaze/test.js: lər arasındakı fərq
Silinən məzmun Əlavə edilmiş məzmun
Teq: Geri qaytarma |
nin izahı yoxdur Teq: Geri qaytarıldı |
||
Sətir 240:
});
});
mw.loader.using(['mediawiki.util'], function () {
// Əsas konteyner
var container = $('<div>')
.css({
border: '2px solid #36c',
padding: '20px',
borderRadius: '15px',
maxWidth: '350px',
margin: '20px auto', // Mərkəzdə olsun
boxShadow: '0 4px 12px rgba(0,0,0,0.15)',
background: '#f8faff',
textAlign: 'center',
fontFamily: 'Arial, sans-serif'
});
// Böyük düymə
var button = $('<button>')
.text('👋 Salam ver')
.css({
background: 'linear-gradient(45deg, #36c, #4a90e2)',
color: 'white',
padding: '12px 24px',
fontSize: '18px',
fontWeight: 'bold',
border: 'none',
borderRadius: '8px',
cursor: 'pointer',
transition: 'transform 0.2s ease, background 0.3s ease'
})
.hover(
function () { $(this).css({ transform: 'scale(1.05)', background: 'linear-gradient(45deg, #4a90e2, #36c)' }); },
function () { $(this).css({ transform: 'scale(1)', background: 'linear-gradient(45deg, #36c, #4a90e2)' }); }
);
// Başlıq
var title = $('<h3>').text('💬 Salam verənlər').css({
marginTop: '20px',
color: '#333',
fontWeight: 'bold'
});
// Siyahı stili
var list = $('<ul>').css({
listStyle: 'none',
padding: 0,
marginTop: '15px',
textAlign: 'left'
});
// LocalStorage-dan siyahını yüklə
var salamlayanlar = JSON.parse(localStorage.getItem('salamlayanlar') || '[]');
salamlayanlar.forEach(function (ad) {
list.append(
$('<li>').css({
padding: '8px 12px',
background: '#eaf1ff',
margin: '6px 0',
borderRadius: '6px',
boxShadow: '0 2px 5px rgba(0,0,0,0.05)',
fontWeight: '500'
}).text('👤 ' + ad)
);
});
// Düyməyə klik funksiyası
button.on('click', function () {
var username = mw.config.get('wgUserName');
if (!username) {
alert('Salam vermək üçün daxil olmalısınız.');
return;
}
if (salamlayanlar.includes(username)) {
alert('Sən artıq salam vermisən 😊');
return;
}
salamlayanlar.push(username);
localStorage.setItem('salamlayanlar', JSON.stringify(salamlayanlar));
list.append(
$('<li>').css({
padding: '8px 12px',
background: '#eaf1ff',
margin: '6px 0',
borderRadius: '6px',
boxShadow: '0 2px 5px rgba(0,0,0,0.05)',
fontWeight: '500'
}).text('👤 ' + username)
);
alert('Salam göndərildi, təşəkkürlər!');
});
// Əlavə et
container.append(button, title, list);
// Yalnız istifadəçi səhifəsində göstər
if (mw.config.get('wgPageName') === 'İstifadəçi:ReiKaze') {
$('#mw-content-text').prepend(container);
}
});
|