MediaWiki:Gadget-SendWelcomeMessage.js:修订间差异
imported>=海豚= [InPageEdit] 没有编辑摘要 (编辑自Special:Diff/34284) |
imported>=海豚= 无编辑摘要 |
||
| (未显示同一用户的6个中间版本) | |||
| 第8行: | 第8行: | ||
}; | }; | ||
mw.loader.implement('AnnToolsSendWelcomeMessage', function() { | mw.loader.implement('AnnToolsSendWelcomeMessage', function() { | ||
var message = '{{ | var message = '{{欢迎}}', | ||
errorFun = function errorFun(_, self) { | errorFun = function errorFun(_, self) { | ||
unbindFun(); | unbindFun(); | ||
| 第28行: | 第28行: | ||
var self = $(that), | var self = $(that), | ||
href = self.attr('href'), | href = self.attr('href'), | ||
userName = decodeURIComponent(href.match(/(?=user\_talk\:)[^\&]+/i)[0].replace(/ | userName = decodeURIComponent(href.match(/(?=user\_talk\:)[^\&]+/i)[0].replace(/%E7%94%A8%E6%88%B7%E8%AE%A8%E8%AE%BA\:/i, '')); | ||
if (href.includes(' | if (href.includes('%E7%94%A8%E6%88%B7%E8%AE%A8%E8%AE%BA') && href.includes('redlink=1') && href.includes('action=edit') && !userName.includes('/')) { | ||
self.addClass('sendWelcomeMessageLink unsend nopopus').on('click.sendWelcomeMessage', function() { | self.addClass('sendWelcomeMessageLink unsend nopopus').on('click.sendWelcomeMessage', function() { | ||
if ($('#welcomeAskFinished')[0]) $('#welcomeClear').click(); | if ($('#welcomeAskFinished')[0]) $('#welcomeClear').click(); | ||
| 第56行: | 第56行: | ||
'action': 'edit', | 'action': 'edit', | ||
'format': 'json', | 'format': 'json', | ||
'title': ' | 'title': '用户讨论:' + userName, | ||
'summary': ' | 'summary': '欢迎新用户', | ||
'text': message, | 'text': message, | ||
'tags': ' | 'tags': '欢迎新用户', | ||
'createonly': true | 'createonly': true | ||
}).then(function(data) { | }).then(function(data) { | ||
| 第97行: | 第97行: | ||
else reason += '. '; | else reason += '. '; | ||
$('#welcomeAsk').empty().append('<span id="welcomeAskFinished">正在通信中……失败!请重试!【 ' + reason + '】</span>'); | $('#welcomeAsk').empty().append('<span id="welcomeAskFinished">正在通信中……失败!请重试!【 ' + reason + '】</span>'); | ||
errorFun(' | errorFun('和H萌服务器通信成功,但编辑失败!\n编辑详情:' + JSON.stringify(s).replace(/[{}\"]/g, '').replace(/\:\,/g, ','), self); | ||
unbindFun(); | unbindFun(); | ||
self.addClass('unsend'); | self.addClass('unsend'); | ||