MediaWiki:Common.js/Special:Contributions
Appearance
//
if (location.href.substring(location.href.length - 7, location.href.length) === 'newbies' && mw.config.get('wgUserGroups').join(' ').indexOf('editor') !== -1) {
mw.loader.load( '/w/index.php?title=' + 'User:Bawolff/mwapilib.js' + '&action=raw&ctype=text/javascript' );
wallMartGreet = function() {
if (!wallMartGreet.ok) {
alert("Please reload page before using wallmart greeter again");
return;
}
Bawolff.mwapi.getToken(function () {});
var redlinks = document.getElementById('bodyContent').getElementsByClassName('new');
var redtalk = {}, match;
var newTalk = /^http:\/\/en.wikinews.org\/w\/index.php\?title=(User_talk:[^&\/]*)&action=edit&redlink=1$/;
count=0;
for (var i = 0; i < redlinks.length; i++) {
match = redlinks[i].href.match(newTalk);
if (match &&match.indexOf('%3D') === -1) {
if (!(match[1] in redtalk)) {
count++;
redtalk[match[1]] = true;
}
}
}
var mesg = "Welcome to wall-mart greeter gadget!\n\nDo you wish to put{\{howdy}} on "+ count + " new user's talk pages (Everyone listed at [[special:contributions/newbies]] that has a non-existant talk page)?";
if (confirm(mesg)) {
for (i in redtalk) {
if (redtalk.hasOwnProperty(i)) {
Bawolff.mwapi.edit({content:'<!--from WM-GREET-->\n{{howdy}}\nSincerely, ~~\~~', summary: 'Welcome to Wikinews!', page: i, minor: true, section: 'new', createonly: true});
}
}
wallMartGreet.ok = false;
alert('done');
}
}
wallMartGreet.ok = true; //to stop it from adding to a persons talk twice.
$(function () {mw.util.addPortletLink('p-cactions', 'javascript:wallMartGreet();void%200;', 'Greet Newbiews', 'ca-WallMartGreeter');});
}
//