User:逆襲的天邪鬼/+1s.js: Difference between revisions

Content added Content deleted
(Created page with "(function () { if (mw.config.get('wgUserGroups').indexOf('sysop') === -1) { return; } var SUMMARY = 'Test +1s by +1s.js...")
 
(via Wikiplus)
Line 29: Line 29:
var getUserName = function (item) {
var getUserName = function (item) {
var title = item.getAttribute('title');
var title = item.getAttribute('title');

if (title.indexOf('/') > -1) {
return null;
}

// deal with markblocked
// deal with markblocked
if (title.indexOf(';') > -1) {
if (title.indexOf(';') > -1) {
Line 61: Line 66:
$('a[title^="User:"]', '#mw-content-text').each(function (index, item) {
$('a[title^="User:"]', '#mw-content-text').each(function (index, item) {
var username = getUserName(item);
var username = getUserName(item);
if (username) {
var x = $('<a href="#" class="donate1second"><sup>+1s</sup></a>')
.attr('data-username', username)
var x = $('<a href="#" class="donate1second"><sup>+1s</sup></a>')
.click(donate1second);
.attr('data-username', username)
$(item).after(x);
.click(donate1second);
$(item).after(x);
}
});
});
};
};