User:Harsh4101991/common.js
Appearance
Code that you insert on this page could contain malicious content capable of compromising your account. If you import a script from another page with "importScript", "mw.loader.load", "iusc", or "lusc", take note that this causes you to dynamically load a remote script, which could be changed by others. Editors are responsible for all edits and actions they perform, including by scripts. User scripts are not centrally supported and may malfunction or become inoperable due to software changes. A guide to help you find broken scripts is available. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. This code will be executed when previewing this page. |
The accompanying .css page for this skin can be added at User:Harsh4101991/common.css. |
//alert('Hello World');
jQuery('#firstHeading').css('color','red');
mw.loader.using('mediawiki.api', function(){
var api = new mw.Api();
///w/api.php?action=query&list=users&format=json&usprop=editcount&ususers=Harsh4101991
api.get({
action:'query',
list:'users',
format:'json',
usprop:'editcount',
ususers:'Harsh4101991'
})
.done(function(data){
//alert('Successfully fetch data');
console.log(data);
})
})
mw.loader.using('mediawiki.api', function(){
var api = new mw.Api();
///w/api.php?action=query&list=users&format=json&usprop=editcount&ususers=Harsh4101991
api.get({
action:'query',
list: 'users',
format:'json',
usprop:'editcount',
ususers:'Harsh4101991'
})
.done(function(data){
console.log(data);
// alert(data.query.users[0].editcount);
x = data.query.users[0].editcount;
})
//mw.notify( 'This is a notification.' );
var link = mw.util.addPortletLink(
'p-views',
'#',
'Edit Count',
't-prettylinkwidget',
'Show Edit Count of User',
null,
'#t-whatlinkshere'
);
$(link).click( function( e ) {
// Avoid the browser going to '#'
e.preventDefault();
//Adding Dialog
mw.loader.using( 'jquery.ui.dialog', function () {
$dialog = $('<div></div>')
.html('Your Edit Count is : '+ x)
.dialog({
autoOpen: true,
title: 'Thanks For Your Contribution',
width: '70%',
modal: true,
});
});
//END
});
})
//importScript('User:Harsh4101991/EditCount.js');
/*
var link = mw.util.addPortletLink(
'p-tb',
'#',
'Language Support',
't-prettylinkwidget',
'Show Edit Count of User',
null,
'#t-whatlinkshere'
);
*/