مدیاویکی:Gadget-close.js: تفاوت میان نسخهها
ظاهر
imported>Yamaha5 بدون خلاصۀ ویرایش |
imported>Yamaha5 بدون خلاصۀ ویرایش |
||
| خط ۳۰: | خط ۳۰: | ||
str = str+"\n{{پایان بسته}}"; | str = str+"\n{{پایان بسته}}"; | ||
} | } | ||
if(type ==' | if(type =='done1'){ | ||
str = str+the_reason+ ' ~~' + '~~'; | str = str+the_reason+ ' ~~' + '~~'; | ||
} | } | ||
| خط ۵۹: | خط ۵۹: | ||
if(wgNamespaceNumber == 3 && wgPageName.search(wgUserName) > 0){ | if(wgNamespaceNumber == 3 && wgPageName.search(wgUserName) > 0){ | ||
$('.mw-headline').each(function(data){ var mq = data+1; $(this).before("<a id='answerIcon"+mq+"' href='javascript:void(0)' onclick='answered("+mq+", \"talk\")' title='جمعبندی بحث' style='float:left;color:#090;'>●</a>"); }); | $('.mw-headline').each(function(data){ var mq = data+1; $(this).before("<a id='answerIcon"+mq+"' href='javascript:void(0)' onclick='answered("+mq+", \"talk\")' title='جمعبندی بحث' style='float:left;color:#090;'>●</a>"); }); | ||
$('.mw-headline').each(function(data){ var mq = data+1; $(this).before("<a id='answerIcon"+mq+"' href='javascript:void(0)' onclick='answered("+mq+", \" | $('.mw-headline').each(function(data){ var mq = data+1; $(this).before("<a id='answerIcon"+mq+"' href='javascript:void(0)' onclick='answered("+mq+", \"done1\")' title='شد ✓' style='float:left;color:#00A2FF;'>✓</a>"); }); | ||
}else if(wgNamespaceNumber == 4 && wgUserGroups.indexOf('sysop') > -1){ | }else if(wgNamespaceNumber == 4 && wgUserGroups.indexOf('sysop') > -1){ | ||
$('.mw-headline').each(function(data){ var mq = data+1; $(this).before("<a id='answerIcon"+mq+"' href='javascript:void(0)' onclick='answered("+mq+", \"request\")' title='جمعبندی بحث' style='float:left;color:#090;'>●</a>"); }); | $('.mw-headline').each(function(data){ var mq = data+1; $(this).before("<a id='answerIcon"+mq+"' href='javascript:void(0)' onclick='answered("+mq+", \"request\")' title='جمعبندی بحث' style='float:left;color:#090;'>●</a>"); }); | ||
$('.mw-headline').each(function(data){ var mq = data+1; $(this).before("<a id='answerIcon"+mq+"' href='javascript:void(0)' onclick='answered("+mq+", \" | $('.mw-headline').each(function(data){ var mq = data+1; $(this).before("<a id='answerIcon"+mq+"' href='javascript:void(0)' onclick='answered("+mq+", \"done1\")' title='شد ✓' style='float:left;color:#00A2FF;'>✓</a>"); }); | ||
} | } | ||
}); | }); | ||
نسخهٔ ۲۱ ژانویهٔ ۲۰۱۵، ساعت ۱۵:۵۹
/* by Arash.pt */
function answered(sectionId, type){
$('#answerIcon'+sectionId).hide();
jQuery.getJSON( mw.util.wikiScript( 'api' ), {
format: 'json',
action: 'query',
titles: mw.config.get( 'wgPageName' ),
prop: 'revisions',
rvprop: 'content',
rvsection:sectionId
} ).done( function ( data ) {
var str = data.query.pages[Object.keys(data.query.pages)[0]].revisions[0]['*'];
var title = str.match('==[^]\w*[^]*==')[0];
var the_reason = prompt("توضیح در مورد بستن بحث ؟");
if(the_reason.length > 1){ }else{ the_reason = ""; }
if(type =='request'){
var requestStatus = confirm('آیا درخواست انجام شده است؟ یا ناموفق بود؟');
var the_reason2 = "";
if(!requestStatus){
the_reason2 = "|ناموفق=بله";
}
the_reason = the_reason + ' ~~' + '~~';
str = str.replace(title, title+"\n{{بسته"+the_reason2+"}}\n'''"+the_reason+"'''\n");
str = str+"\n{{پایان بسته}}";
}
if(type =='talk'){
the_reason = "|"+the_reason;
str = str.replace(title, title+"\n{{بحث بسته"+the_reason+"}}");
str = str+"\n{{پایان بسته}}";
}
if(type =='done1'){
str = str+the_reason+ ' ~~' + '~~';
}
$.ajax({
url: mw.util.wikiScript( 'api' ),
data: {
format: 'json',
action: 'edit',
title: mw.config.get( 'wgPageName' ),
section: sectionId,
summary: 'جمعبندی به کمک [[مدیاویکی:Gadget-close.js|ابزار جمعبندی بحث]]',
text: str,
token: mw.user.tokens.get('editToken')
},
dataType: 'json',
type: 'POST',
success: function( data ) {
mw.notify( 'انجام شد' );
location.reload(true);
}
});
} );
}
$(function(){
if(wgNamespaceNumber == 3 && wgPageName.search(wgUserName) > 0){
$('.mw-headline').each(function(data){ var mq = data+1; $(this).before("<a id='answerIcon"+mq+"' href='javascript:void(0)' onclick='answered("+mq+", \"talk\")' title='جمعبندی بحث' style='float:left;color:#090;'>●</a>"); });
$('.mw-headline').each(function(data){ var mq = data+1; $(this).before("<a id='answerIcon"+mq+"' href='javascript:void(0)' onclick='answered("+mq+", \"done1\")' title='شد ✓' style='float:left;color:#00A2FF;'>✓</a>"); });
}else if(wgNamespaceNumber == 4 && wgUserGroups.indexOf('sysop') > -1){
$('.mw-headline').each(function(data){ var mq = data+1; $(this).before("<a id='answerIcon"+mq+"' href='javascript:void(0)' onclick='answered("+mq+", \"request\")' title='جمعبندی بحث' style='float:left;color:#090;'>●</a>"); });
$('.mw-headline').each(function(data){ var mq = data+1; $(this).before("<a id='answerIcon"+mq+"' href='javascript:void(0)' onclick='answered("+mq+", \"done1\")' title='شد ✓' style='float:left;color:#00A2FF;'>✓</a>"); });
}
});