משתמש:קובי כרמל/UserContributions.js
מראה
הערה: לאחר הפרסום, ייתכן שיהיה צורך לנקות את זיכרון המטמון (cache) של הדפדפן כדי להבחין בשינויים.
- פיירפוקס / ספארי: להחזיק את המקש Shift בעת לחיצה על טעינה מחדש (Reload) או ללחוץ על צירוף המקשים Ctrl-F5 או Ctrl-R (במחשב מק: ⌘-R).
- גוגל כרום: ללחוץ על צירוף המקשים Ctrl-Shift-R (במחשב מק: ⌘-Shift-R).
- אדג': להחזיק את המקש Ctrl בעת לחיצה על רענן (Refresh) או ללחוץ על צירוף המקשים Ctrl-F5.
$('#firstHeading span').on('contextmenu', function(){
if(wgNamespaceNumber != 2 && wgNamespaceNumber != 3) return;
$('#user-contributions').remove();
$('#mw-content-text').append($('<div>', {id: 'user-contributions'}).css({
position: 'absolute',
width: 200,
height: 73,
border: '1px solid blue',
top: -20,
right: 350,
background: '#fff',
fontSize: 18,
textAlign: 'center',
borderRadius: '4px',
boxShadow: '1px 2px 6px rgba(0,0,0,.3)'
}).html($('<p>').text('טוען נתונים...')));
var user = wgTitle.split('/')[0];
$.get('//he.wikipedia.org/w/api.php?action=query&list=users&ususers=' + encodeURIComponent(user) + '&usprop=editcount&format=json', function(e){
var count = e.query.users[0].editcount.toString().replace(/./g, function(c, i, a) {
return i && !((a.length - i) % 3) ? "," + c : c;
});
$('#user-contributions p').text('תרומות המשתמש: ' + count).after($('<button>').text('אישור').click(function(){
$('#user-contributions').remove();
}));
}, 'json');
return false;
})