« MediaWiki:Gadget-LiveRC.js » : différence entre les versions

Contenu supprimé Contenu ajouté
Dr Brains (discuter | contributions)
Mise en place d'une blacklist d'utilisateurs pour les outils automatiques
Dr Brains (discuter | contributions)
Mise à jour variables globales via mw.config.get( )
Ligne 1 083 :
// Informations sur l'utilisateur courant
LiveRC_Config["UserInfos"] = new Object();
LiveRC_Config["UserInfos"].Rights = new Array(); // Liste des droits
LiveRC_Config["UserInfos"].Groups = new Array(); // Liste des groupes
LiveRC_Config["UserInfos"].isAdmin = (mw.config.get('wgUserGroups').indexOf("sysop") != -1); // Utilisateur administrateur;
LiveRC_Config["UserInfos"].isBlocked = false; // Utilisateur bloqué
LiveRC_Config["UserInfos"].EditCount = 0; // Editcount
LiveRC_Config["UserInfos"].RealName = ""; // "Vrai" nom (si renseigné)
LiveRC_Config["UserInfos"].eMail = ""; // adresse mail (si renseignée)
LiveRC_Config["UserInfos"].Preferences = new Object(); // Préférences
LiveRC_Config["UserInfos"].APIlimit = 499; // Limite de requête API
 
// Gestion des langues
Ligne 1 364 :
 
// Chargement styles et javascript utilisateur
importScript('User:'+mw.config.get('wgUserName')+'/LiveRCparam.js');
importStylesheet('User:'+mw.config.get('wgUserName')+'/LiveRCparam.css');
 
// Variables obsolètes, conservées pour compatibilité avec anciennes personnalisations
Ligne 1 606 :
 
function watchAPICall(title, watch) {
var url = mw.config.get('wgServer') + mw.config.get('wgScriptPath') + '/api.php?format=xml&action=query&prop=info&intoken=watch&titles='+encodeURIComponent(title);
wpajax.http({url: url, onSuccess: watchAPICallStep2, title: title, watch: watch});
}
Ligne 1 612 :
function watchAPICallStep2(xmlreq, data){
var pageNode = xmlreq.responseXML.getElementsByTagName("page")[0];
var url = mw.config.get('wgServer') + mw.config.get('wgScriptPath') + '/api.php?format=xml&action=watch';
var postdata = "title=" + encodeURIComponent(data.title)
+ "&token=" + encodeURIComponent(pageNode.getAttribute("watchtoken"))
Ligne 1 704 :
var UL = document.createElement('ul');
var ContactLi = document.createElement('li');
ContactLi.appendChild(lrcCreateWatchUserLink(mw.config.get('wgTitle'), ThisIsContact, 1));
var HiddenLi = document.createElement('li');
HiddenLi.appendChild(lrcCreateHideUserLink(mw.config.get('wgTitle'), ThisIsHidden, 1));
UL.appendChild(ContactLi);
UL.appendChild(HiddenLi);
Ligne 1 932 :
var timestamp = LiveRC_Config["Notificationtimestamp"][title];
if(!timestamp) continue;
var URL = mw.config.get('wgServer') + mw.config.get('wgScriptPath') + '/api.php?format=xml&action=query'
+ '&prop=info&intoken=edit&inprop=notificationtimestamp'
+ '&titles='+encodeURIComponent(title);
Ligne 1 962 :
var headers = new Array();
headers['Content-Type'] = 'application/x-www-form-urlencoded';
wpajax.http({ url: mw.config.get('wgServer') + mw.config.get('wgScriptPath') + '/api.php?action=setnotificationtimestamp',
method: "POST", headers: headers,
onSuccess:RAZthisnotificationtimestampDone,
Ligne 2 380 :
var APILimit = LiveRC_Config["UserInfos"].APIlimit;
if(Limit>APILimit) Limit = APILimit;
var URL = mw.config.get('wgServer') + mw.config.get('wgScriptPath')
+ "/api.php?format=xml&action=query&list=allpages"
+ "&apnamespace=" + ValueNamespace
+ "&apprefix=" + encodeURIComponent(Page)
Ligne 2 647 ⟶ 2 648 :
var APILimit = LiveRC_Config["UserInfos"].APIlimit;
if(Limit>APILimit) Limit = APILimit;
var URL = mw.config.get('wgServer') + mw.config.get('wgScriptPath')
+ "/api.php?format=xml&action=query&list=allusers"
+ "&auprefix=" + encodeURIComponent(Page)
Ligne 2 974 ⟶ 2 975 :
function liveOldPersonalJS(){
lrcDisplayDebug("Get LiveRC personal params");
var URL = mw.config.get('wgServer') + mw.config.get('wgScriptPath')
+ '/api.php?format=xml&action=query&prop=revisions&rvlimit=1&rvprop=ids'
+ '&titles=User:'+encodeURIComponent(mw.config.get('wgUserName')) + "/LiveRCparam.js"
wpajax.http({url: URL,
onSuccess: LiveRC_ManageParams_GetOldParamsOldid
Ligne 2 987 ⟶ 2 990 :
if (LastRevision){
var Oldid = LastRevision.getAttribute('revid');
var URL = mw.config.get('wgServer') + mw.config.get('wgScript')
wpajax.http({url:wgServer + wgScript + '?title=User:' + encodeURIComponent(mw.config.get('wgUserName')) + '/LiveRCparam.js&action=raw&oldid=' + Oldid, onSuccess:LiveRC_ManageParams_GetOldParams });
wpajax.http({url:URL, onSuccess:LiveRC_ManageParams_GetOldParams });
}
}
Ligne 3 036 ⟶ 3 041 :
function liveOldPersonalCSS(){
lrcDisplayDebug("Get LiveRC personal styles");
var URL = mw.config.get('wgServer') + mw.config.get('wgScriptPath')
+ '/api.php?format=xml&action=query&prop=revisions&rvlimit=1&rvprop=ids'
+ '&titles=User:'+encodeURIComponent(mw.config.get('wgUserName')) + "/LiveRCparam.css"
wpajax.http({url: URL,
onSuccess: LiveRC_ManageParams_GetOldCSSOldid
Ligne 3 048 ⟶ 3 055 :
if (LastRevision){
var Oldid = LastRevision.getAttribute('revid');
var URL = mw.config.get('wgServer') + mw.config.get('wgScript')
wpajax.http({url:wgServer + wgScript + '?title=User:' + encodeURIComponent(mw.config.get('wgUserName')) + '/LiveRCparam.css&action=raw&oldid=' + Oldid, onSuccess:LiveRC_ManageParams_GetOldCSS });
wpajax.http({url:URL, onSuccess:LiveRC_ManageParams_GetOldCSS });
}
}
Ligne 3 757 ⟶ 3 766 :
( NSMessages==2 && ( lrcUserHasRight("edituserjs")
||
LiveRC_Config["SiteConfigPage"].indexOf(mw.config.get('wgUserName')) !=- 1
)
)
Ligne 4 964 ⟶ 4 973 :
}
if(P){
P.innerHTML = lrcMakeText("EditRunning").split("$1").join(lrcGetNamespaceName(2)+":"+mw.config.get('wgUserName')+"/LiveRCparam.css")
+ '<span style="text-decoration:blink;">…</span>';
}
wpajax.http({ url: mw.config.get('wgServer') + mw.config.get('wgScript') + '?title='+lrcGetNamespaceName(2)+':' + encodeURIComponent(mw.config.get('wgUserName')) + '/LiveRCparam.css&action=edit',
onSuccess: LiveRC_ManageParams_SaveCSSParamsRunning, newtext:NewStyles.join(""), input:Input});
}
Ligne 4 984 ⟶ 4 993 :
if(P){
P.innerHTML += "<br />"
+ lrcMakeText("SaveRunning").split("$1").join(lrcGetNamespaceName(2)+":"+mw.config.get('wgUserName')+"/LiveRCparam.css")
+ '<span style=\"text-decoration:blink;\">…</span>';
}
Ligne 5 009 ⟶ 5 018 :
if(P){
P.innerHTML = ""
+ lrcMakeText("SaveDone").split("$1").join(lrcGetNamespaceName(2)+":"+ mw.config.get('wgUserName')+"/LiveRCparam.css" )
+ "<br/>"
+ '<span class="error">' + lrcMakeText("SaveRefresh") + '</span>'
Ligne 5 264 ⟶ 5 273 :
}
if(P){
P.innerHTML = lrcMakeText("EditRunning").split("$1").join(lrcGetNamespaceName(2)+":"+mw.config.get('wgUserName')+"/LiveRCparam.js")
+ '<span style="text-decoration:blink;">…</span>';
}
wpajax.http({ url: mw.config.get('wgServer') + mw.config.get('wgScript') + '?title='+lrcGetNamespaceName(2)+':' + encodeURIComponent(mw.config.get('wgUserName')) + '/LiveRCparam.js&action=edit',
onSuccess: LiveRC_ManageParams_SaveParams, param:NewPage});
}
Ligne 5 286 ⟶ 5 295 :
if(P){
P.innerHTML += "<br />"
+ lrcMakeText("SaveRunning").split("$1").join(lrcGetNamespaceName(2)+":"+mw.config.get('wgUserName')+"/LiveRCparam.js")
+ '<span style=\"text-decoration:blink;\">…</span>';
}
Ligne 5 309 ⟶ 5 318 :
 
function LiveRC_ManageParams_SaveParamsDone(Req){
RefreshText = lrcMakeText("SaveDone").split("$1").join(lrcGetNamespaceName(2)+":"+ mw.config.get('wgUserName')+"/LiveRCparam.js" )
+ "<br/>"
+ '<span class="error">' + lrcMakeText("SaveRefresh") + '</span>'
Ligne 6 041 ⟶ 6 050 :
function lrcGetPageURL(page) {
return mw.config.get('wgServer') + mw.config.get('wgArticlePath').split('$1').join(lrcEncode(page));
}
function lrcGetUglyPageURL(page, params) {
return mw.config.get('wgServer') + mw.config.get('wgScript') + '?title=' + lrcEncode(page)+ (params ? params : "");
}
Ligne 6 523 ⟶ 6 532 :
LiveRC_RunHooks("BeforeInitActivationProcess");
lrcDisplayDebug("Define LiveRC initialization process");
var lrcPage = (mw.config.get('wgPageName') == lrcMakeParam("PageTitle") && (mw.config.get('wgAction')=="view"||mw.config.get('wgAction')=="purge"));
LiveRC_Config["LaunchProcess"] = [
{functions:LiveRC_Launch, condition:true },
Ligne 6 621 ⟶ 6 630 :
}
 
if(mw.config.get('wgPageName') == lrcMakeParam("PageTitle") && (mw.config.get('wgAction')=="view"||mw.config.get('wgAction')=="purge")) {
lrcDisplayDebug('Starting page <b>'+mw.config.get('wgPageName')+'</b> detected : run LiveRC initialization process');
lrcDisplayDebug('<span style="color:darkGreen;">Hello <b>'+mw.config.get('wgUserName')+'</b>! You want to fight vandals? OK, let\'s go !</span>');
LiveRC_alert('<center><code><b><big>Hello <i>'+mw.config.get('wgUserName')+'</i>!</big></b></code></center>');
PleaseWait();
var LiveRCContainer = document.createElement("div");
Ligne 6 651 ⟶ 6 660 :
var LiveRCLink = document.createElement('a');
LiveRCLink.title = 'LiveRC';
LiveRCLink.href = mw.config.get('wgServer')+mw.config.get('wgArticlePath').split("$1").join(encodeURIComponent(lrcMakeParam("PageTitle")));
LiveRCLink.appendChild(document.createTextNode('LiveRC'));
LiveRCLi.appendChild(LiveRCLink);
RCLi.parentNode.insertBefore(LiveRCLi,RCLi.nextSibling);
if((mw.config.get('wgNamespaceNumber')==2 || mw.config.get('wgNamespaceNumber')==3) && mw.config.get('wgPageName').indexOf('/') == -1 ){
lrcDisplayDebug('Add watch/hide links in tools panel : check user status');
var URL = mw.config.get('wgServer') + mw.config.get('wgScriptPath')
+ '/api.php?format=xml&action=query'
+ '&prop=info'
+ '&inprop=watched'
+ '&titles=' + encodeURIComponent("LiveRCWatch:"+mw.config.get('wgTitle'))
+" '|"' + encodeURIComponent("LiveRCHidden:"+mw.config.get('wgTitle'));
wpajax.http({url : URL,
onSuccess : LiveWatchInitButtons, user:mw.config.get('wgTitle')
});
}
Ligne 6 706 ⟶ 6 716 :
function liveUserInfos(){
lrcDisplayDebug("Get user infos");
wpajax.http({url: mw.config.get('wgServer') + mw.config.get('wgScriptPath') + '/api.php?format=xml&action=query&meta=userinfo'
+ '&uiprop=blockinfo|groups|implicitgroups|rights|options|editcount|email|realname',
onSuccess: getUserInfos});
Ligne 6 753 ⟶ 6 763 :
function lrcUserHasGroup(Group){
var GroupList;
if(typeof(mw.config.get('wgUserGroups'))!=="undefined") GroupList = mw.config.get('wgUserGroups');
else GroupList = LiveRC_Config["UserInfos"].Groups;
return (GroupList.indexOf(Group)!=-1);
Ligne 6 759 ⟶ 6 769 :
 
function lrcUserCan(Function){
if(LiveRC_Config["LimitationsWhitelist"].indexOf(mw.config.get('wgUserName'))!=-1) return true;
if(LiveRC_Config["LimitationsBlacklist"].indexOf(mw.config.get('wgUserName'))!=-1) return false;
if(LiveRC_Config["UserInfos"].isBlocked) return false;
var right = LiveRC_Config["LimitationsRight"][Function];
Ligne 6 773 ⟶ 6 783 :
if(Buttons) UserInfosTD.style.width = Buttons.offsetWidth + "px";
if(!lrcMakeParam("ShowUserInfos")) return;
var text = '<span style="font-size:150%">'+mw.config.get('wgUserName')+'</span>';
if(LiveRC_Config["UserInfos"].RealName || LiveRC_Config["UserInfos"].eMail) text += '<br />';
if(LiveRC_Config["UserInfos"].RealName) text += '('+LiveRC_Config["UserInfos"].RealName+')';
Ligne 6 866 ⟶ 6 876 :
return;
}
var URL = mw.config.get('wgServer') + mw.config.get('wgScriptPath') + '/api.php?format=xml&action=query'
+ '&meta=' + meta.join("|")
+ '&siprop=' + siprop.join("|")
Ligne 7 047 ⟶ 7 057 :
}
lrcDisplayDebug("Get ("+NextLang+") system messages");
var URL = mw.config.get('wgServer') + mw.config.get('wgScriptPath') + '/api.php?format=xml&action=query'
+ '&meta=allmessages'
+ '&ammessages=' + messageslist.join("|")
Ligne 7 192 ⟶ 7 202 :
+ Tags
+ "}\n\n"+LiveRC_Config["MediawikiConfigComment2"];
var URL = mw.config.get('wgServer') + mw.config.get('wgScriptPath') + '/api.php?format=xml&action=query&prop=info&intoken=edit&inprop=protection&titles='+encodeURIComponent(LiveRC_Config["SiteConfigPage"])
wpajax.http({ url: URL,
onSuccess: UpdateSiteConfigRaw,
Ligne 7 240 ⟶ 7 250 :
var headers = new Array();
headers['Content-Type'] = 'application/x-www-form-urlencoded';
wpajax.http({ url: mw.config.get('wgServer') + mw.config.get('wgScriptPath') + '/api.php?action=edit',
method: "POST", headers: headers,
onSuccess:UpdateSiteConfigDone,
Ligne 7 385 ⟶ 7 395 :
function LiveRC_getVersion(){
lrcDisplayDebug("Check LiveRC version");
var URL = mw.config.get('wgServer') + mw.config.get('wgScriptPath') + '/api.php?format=xml&action=tokens&type=centralauth';
wpajax.http({url:URL, onSuccess: LiveRC_getVersionProperties});
}
Ligne 7 396 ⟶ 7 406 :
+ '&ids=Q7027060'
+ '&props=claims'
+ '&origin='+window.location.protocol+mw.config.get('wgServer')
+ '&centralauthtoken='+centralauthtoken;
wpajax.http({url:URL, onSuccess: LiveRC_getVersionProperty});
Ligne 8 519 ⟶ 8 529 :
function liveBotSysop(listcontinue) {
lrcDisplayDebug("Get sysop & bot names");
var URL = mw.config.get('wgServer') + mw.config.get('wgScriptPath') + '/api.php?format=xml&action=query&list=allusers'
+ '&augroup=sysop|bot'
+ '&auprop=groups'
Ligne 8 560 ⟶ 8 570 :
lrcDisplayDebug("Get watchlist");
var APIlimit = LiveRC_Config["UserInfos"].APIlimit;
var URL = mw.config.get('wgServer') + mw.config.get('wgScriptPath') + '/api.php?format=xml&action=query&list=watchlistraw';
if(lrcMakeParam("GetPageInfos")){ // we don't need all watchlist if we get each page infos
URL += '&wrcontinue=0|LiveRC';
Ligne 8 617 ⟶ 8 627 :
var wrcontinue = wc1.firstChild.getAttribute('wrcontinue');
if(!lrcMakeParam("GetPageInfos") || wrcontinue.indexOf("0|LiveRC")!=-1){
var URL = mw.config.get('wgServer') + mw.config.get('wgScriptPath')
+ '/api.php?format=xml&action=query&list=watchlistraw'
+ '&wrcontinue=' + encodeURIComponent(wrcontinue);
var APIlimit = LiveRC_Config["UserInfos"].APIlimit;
Ligne 8 650 ⟶ 8 661 :
var blocksLimit = 1000;
var queryLimit = Math.min(LiveRC_Config["UserInfos"].APIlimit, blocksLimit);
var URL = mw.config.get('wgServer') + mw.config.get('wgScriptPath')
+ '/api.php?action=query&list=logevents&letype=block&lelimit='+queryLimit+'&format=xml';
wpajax.http({url: URL,
onSuccess: readBlocks,
Ligne 8 677 ⟶ 8 689 :
var leContName = cancontinue.firstChild.getAttribute('lecontinue') ? 'lecontinue' : 'lestart';
var leContValue = cancontinue.firstChild.getAttribute(leContName);
var URL = mw.config.get('wgServer') + mw.config.get('wgScriptPath')
+ '/api.php?format=xml&action=query&list=logevents&letype=block'
+ '&lelimit=' + queryLimit
+ '&' + leContName + '=' + encodeURIComponent(leContValue);
Ligne 8 705 ⟶ 8 718 :
lrcDisplayDebug("Get category members: "+Cat);
LiveRC_Config["watchCategoriesLoaded"][Cat] = false;
var URL = mw.config.get('wgServer') + mw.config.get('wgScriptPath')
+ '/api.php?format=xml&action=query&list=categorymembers'
+ '&cmlimit=' + LiveRC_Config["UserInfos"].APIlimit
Ligne 8 734 ⟶ 8 747 :
if (xmlreq.responseXML.getElementsByTagName('query-continue')[0]) {
cmcontinue = xmlreq.responseXML.getElementsByTagName('query-continue')[0].getElementsByTagName('categorymembers')[0].getAttribute('cmcontinue');
var URL = mw.config.get('wgServer') + mw.config.get('wgScriptPath')
+ '/api.php?format=xml&action=query&list=categorymembers'
+ '&cmlimit=' + LiveRC_Config["UserInfos"].APIlimit
Ligne 8 766 ⟶ 8 779 :
LiveRC_alert('<center><code><b>Launch sequence completed in '+LiveRC_Config["LoadingTime"]+' seconds.</code></center>')
setTimeout("LiveRC_alert('<center><code><b><u>Assigned mission: <i>search and destroy</i></u></b></code></center>');",5000);
setTimeout("LiveRC_alert('<center><code><b><big>Good luck, <i>"+mw.config.get('wgUserName')+"</i>!</big></b></code></center>');",6000);
lrcDisplayDebug('<span style="color:darkGreen;">LiveRC launch sequence completed. Assigned mission: Search and destroy. Good luck, '+mw.config.get('wgUserName')+'!</span>');
LiveRC_LaunchProcessNextStep();
}
Ligne 8 802 ⟶ 8 815 :
var withCheckuser = (lrcUserHasRight("checkuser-log") && lrcIsExtensionInstalled("CheckUser"));
 
var URL = mw.config.get('wgServer') + mw.config.get('wgScriptPath') + '/api.php?action=query'
+ '&list=recentchanges|logevents' + (withFilters ? '|abuselog' : '') + (withCheckuser ? '|checkuserlog' : '')
+ (withEcho ? '&meta=notifications' : '')
Ligne 9 289 ⟶ 9 302 :
title = title.split("/"+pagetoken).join("").replace(/.*ArticleFeedbackv5\//, "");
}
var URL = mw.config.get('wgServer') + mw.config.get('wgScriptPath') + '/api.php?format=xml&action=query'
+ '&titles=' + encodeURIComponent(title)
+ '&prop=info|pageprops|categories|templates|langlinks' + (withFlags ? '|flagged' : '')
Ligne 9 436 ⟶ 9 449 :
 
function liveNotificationInfos(not){
wpajax.http({url: mw.config.get('wgServer') + mw.config.get('wgScriptPath') + '/api.php?format=xml&action=query'
+ '&meta=notifications&notformat=html',
onSuccess: getNotificationInfos,
Ligne 9 515 ⟶ 9 528 :
 
function markReadNotification(id, tr1ID){
var URL = mw.config.get('wgServer') + mw.config.get('wgScriptPath')
+ '/api.php?format=xml&action=query&prop=info&intoken=edit&titles=AnyPage';
wpajax.http({url: URL,
onSuccess: markReadNotificationRunning,
Ligne 9 530 ⟶ 9 544 :
var headers = new Array();
headers['Content-Type'] = 'application/x-www-form-urlencoded';
wpajax.http({ url: mw.config.get('wgServer') + mw.config.get('wgScriptPath') + '/api.php?action=echomarkread',
method: "POST", headers: headers,
data: Params,
Ligne 9 974 ⟶ 9 988 :
if (lrcHasState(state, "SYSOP"))
preEditor += lrcMakeIcon("SysopIcon")+'&nbsp;';
if (typeof(LiveRC_Config["Blocks"][user]) != 'undefined' && user != mw.config.get('wgUserName'))
preEditor += lrcMakeIcon("BlockedIcon")+'&nbsp;';
if (typeof(LiveRC_Config["Spam"][user]) != 'undefined' && user != mw.config.get('wgUserName'))
preEditor += lrcMakeIcon("SpamblacklistUserIcon")+'&nbsp;';
editor = lrcGetUserLink(user);
Ligne 10 191 ⟶ 10 205 :
if(lrcHasState(state, "SYSOP")) addClass(tr1, "RcSysop");
if(LiveRC_Config["Contact"][rc.user]) addClass(tr1, "RcContact");
if(rc.user == mw.config.get('wgUserName')) addClass(tr1, "RcSelf");
if(lrcHasState(state, "REVIEW_KO")) addClass(tr1, "RcNotReviewed");
if(lrcHasState(state, "MINOREDIT")) addClass(tr1, "RcMinorEdit");
Ligne 10 233 ⟶ 10 247 :
// In some cases, show line despite the user selectors
var ShowAllSelf = document.getElementById("showUser_ShowAllSelf");
if(user == mw.config.get('wgUserName') && ShowAllSelf && ShowAllSelf.checked) MustBeShown = true;
var ShowAllContact = document.getElementById("showUser_ShowAllContact");
if(LiveRC_Config["Contact"][user] && ShowAllContact && ShowAllContact.checked) MustBeShown = true;
Ligne 10 527 ⟶ 10 541 :
if (match) {
var userR = match[1];
if (userR != user && userR != mw.config.get('wgUserName')) {
if (!LiveRC_Config["Revoc"][userR]){
LiveRC_Config["Revoc"][userR] = new Object();
Ligne 12 332 ⟶ 12 346 :
var Id = lrcGetArgFromURL(Link.href, "ids");
var HideLink = document.createElement('a');
HideLink.href = mw.config.get('wgServer')+ mw.config.get('wgScript')+'?title=Special:Revisiondelete&type=revision&target='+encodeURIComponent(Page)+'&ids='+Id;
HideLink.onclick = function(){ liveRevisiondelete(Page,Id); return false; };
HideLink.title = lrcMakeText("REVISIONDELETE_TIP")+' '+Id;
Ligne 12 576 ⟶ 12 590 :
BlankButton.disabled = "disabled";
var message = BlankInput.value;
wpajax.http({ url: mw.config.get('wgServer') + mw.config.get('wgScriptPath') + '/api.php?format=xml&action=query&prop=info&intoken=edit&inprop=protection&titles='+encodeURIComponent(page),
onSuccess: postBlankPage,
page: page,
Ligne 12 596 ⟶ 12 610 :
var Type = PR[a].getAttribute("type");
var Level = PR[a].getAttribute("level");
if(Type=="edit" && wgUserGroups.indexOf!lrcUserHasGroup(Level)==-1) Isprotected = true;
}
if(Isprotected){
Ligne 12 618 ⟶ 12 632 :
var headers = new Array();
headers['Content-Type'] = 'application/x-www-form-urlencoded';
wpajax.http({ url: mw.config.get('wgServer') + mw.config.get('wgScriptPath') + '/api.php?action=edit',
method: "POST", headers: headers,
data: Params,
Ligne 12 690 ⟶ 12 704 :
lrcDisableLink("LiveTagReason");
lrcDisableLink("LiveTagLink");
wpajax.http({ url: mw.config.get('wgServer') + mw.config.get('wgScriptPath') + '/api.php?format=xml'
+ '&action=query&prop=info&intoken=edit'
+ '&inprop=protection'
Ligne 12 713 ⟶ 12 727 :
var Type = PR[a].getAttribute("type");
var Level = PR[a].getAttribute("level");
if(Type=="edit" && wgUserGroups.indexOf!lrcUserHasGroup(Level)==-1) Isprotected = true;
}
if(Isprotected){
Ligne 12 756 ⟶ 12 770 :
var headers = new Array();
headers['Content-Type'] = 'application/x-www-form-urlencoded';
wpajax.http({ url: mw.config.get('wgServer') + mw.config.get('wgScriptPath') + '/api.php?action=edit',
method: "POST", headers: headers,
data: Params,
Ligne 12 907 ⟶ 12 921 :
if(UndoMessageList) UndoMessageList.disabled = "disabled";
var summary = UndoMessage.value;
var requestHistory = mw.config.get('wgServer') + mw.config.get('wgScriptPath') + '/api.php?format=xml'
+ '&action=query&prop=revisions|info'
+ '&rvlimit='+LiveRC_Config["RevertLimit"]+'&rvprop=user|ids'
Ligne 12 926 ⟶ 12 940 :
var Type = PR[a].getAttribute("type");
var Level = PR[a].getAttribute("level");
if(Type=="edit" && wgUserGroups.indexOf!lrcUserHasGroup(Level)==-1) Isprotected = true;
}
if(Isprotected){
Ligne 12 970 ⟶ 12 984 :
var headers = new Array();
headers['Content-Type'] = 'application/x-www-form-urlencoded';
wpajax.http({url: mw.config.get('wgServer') + mw.config.get('wgScriptPath') + '/api.php?action=edit',
method: "POST", headers: headers, data: Params,
onSuccess: lrcUndoCBDone,
Ligne 13 015 ⟶ 13 029 :
lrcDisplayDebug("Automatic function (Thank)");
lrcDisableLink('LiveThankLink');
wpajax.http({ url: mw.config.get('wgServer') + mw.config.get('wgScriptPath') + '/api.php?format=xml&action=query&prop=info&intoken=edit&titles='+lrcGetNamespaceName(3)+":"+encodeURIComponent(user),
onSuccess: postLiveThank,
user: user, page:page, rev:rev });
Ligne 13 038 ⟶ 13 052 :
var headers = new Array();
headers['Content-Type'] = 'application/x-www-form-urlencoded';
wpajax.http({ url: mw.config.get('wgServer') + mw.config.get('wgScriptPath') + '/api.php?action=thank',
method: "POST", headers: headers,
data: Params,
Ligne 13 080 ⟶ 13 094 :
var Value = ListAverto[j].template;
if(!Value) continue;
if(ListAverto[j].addName) Value += "|user=" + mw.config.get('wgUserName')
if(ListAverto[j].hasPage && WithPage) Value += '|1='+Page.replace(/\"/g, "");
if(ListAverto[j].addSectionTitle) Value = Value + '|sectiontitle=1';
Ligne 13 096 ⟶ 13 110 :
 
function getLiveAverto(user, page, automessageconfirmed) {
if(user == mw.config.get('wgUserName') && !automessageconfirmed){
var text = lrcMakeText("USERMSG_AutoMessageConfirm");
LiveRC_confirm(text, function(){ getLiveAverto(user, page, true);});
Ligne 13 108 ⟶ 13 122 :
lrcDisableLink('LiveAvertoLink');
lrcDisableLink('averto');
wpajax.http({ url: mw.config.get('wgServer') + mw.config.get('wgScriptPath') + '/api.php?format=xml&action=query&prop=info&intoken=edit&inprop=protection&titles='+lrcGetNamespaceName(3)+":"+encodeURIComponent(user),
onSuccess: postLiveAverto,
user: user,
Ligne 13 133 ⟶ 13 147 :
var Type = PR[a].getAttribute("type");
var Level = PR[a].getAttribute("level");
if(Type=="edit" && wgUserGroups.indexOf!lrcUserHasGroup(Level)==-1) Isprotected = true;
}
if(Isprotected){
Ligne 13 158 ⟶ 13 172 :
var headers = new Array();
headers['Content-Type'] = 'application/x-www-form-urlencoded';
wpajax.http({ url: mw.config.get('wgServer') + mw.config.get('wgScriptPath') + '/api.php?action=edit',
method: "POST", headers: headers,
data: Params,
Ligne 13 363 ⟶ 13 377 :
lrcDisableLink('Report');
lrcDisableLink('ReportReasons');
var URL = mw.config.get('wgServer') + mw.config.get('wgScriptPath') + '/api.php?format=xml&action=query&prop=info&intoken=edit&inprop=protection&titles='+encodeURIComponent(buildReportPageMagicWords(GotOptionParams.page))
wpajax.http({ url : URL,
onSuccess : postReport,
Ligne 13 387 ⟶ 13 401 :
var Type = PR[a].getAttribute("type");
var Level = PR[a].getAttribute("level");
if(Type=="edit" && wgUserGroups.indexOf!lrcUserHasGroup(Level)==-1) Isprotected = true;
}
if(Isprotected){
Ligne 13 410 ⟶ 13 424 :
var headers = new Array();
headers['Content-Type'] = 'application/x-www-form-urlencoded';
wpajax.http({ url: mw.config.get('wgServer') + mw.config.get('wgScriptPath') + '/api.php?action=edit',
method: "POST", headers: headers,
data: Params,
Ligne 13 596 ⟶ 13 610 :
function liveDiff(page, id, oldid) {
LiveRC_Config["NextPreviewIndex"]++;
lrcAddToHistory("liveDiff", new Array(lrcEscapeStr(page), lrcEscapeStr(id), lrcEscapeStr(oldid)), mw.config.get('wgServer')+mw.config.get('wgScript')+'?title='+encodeURIComponent(page)+'&diff='+id+'&oldid='+oldid+'&unhide=1', page + " : diff="+id+' oldid='+oldid);
buildBlanckPreviewBar("<b style='text-decoration: blink;'>Diff : <span style='color:red'>"+page+"</span>...</b>");
wpajax.http({ url: lrcGetUglyPageURL(page, '&diffonly=1&unhide=1&diff='+id+'&oldid='+oldid),
Ligne 13 824 ⟶ 13 838 :
function liveArticle(page, user, oldid) {
LiveRC_Config["NextPreviewIndex"]++;
lrcAddToHistory("liveArticle", new Array(lrcEscapeStr(page), (user ? lrcEscapeStr(user):lrcEscapeStr("")), (oldid ? lrcEscapeStr(oldid):lrcEscapeStr(""))), mw.config.get('wgServer') + mw.config.get('wgScript') + '?title=' + encodeURIComponent(page) + '&redirect=no' + (oldid ? "&oldid="+oldid:""), page + (user ? " NewPage : User:"+user :""));
buildBlanckPreviewBar("<b style='text-decoration: blink;'><span style='color:red'>"+page+"</span>...</b>");
wpajax.http({url:lrcGetUglyPageURL(page, '&redirect=no'),
Ligne 14 040 ⟶ 14 054 :
}
}
lrcAddToHistory("liveLog", new Array(lrcEscapeStr(action), "{"+HistoryParams.join(",")+"}"), mw.config.get('wgServer') + mw.config.get('wgScript') + '?title=Special:Log&type=' + action + URLParams, titolo + " : " + HistoryParams.join(", "));
buildBlanckPreviewBar("<b style='text-decoration: blink;'><span style='color:red'>"+titolo+"</span>...</b>");
wpajax.http({url:lrcGetUglyPageURL('Special:Log', '&type=' + action + URLParams), onSuccess: getLog, page:params["page"] , user:params["user"], PreviewIndex:LiveRC_Config["NextPreviewIndex"] });
Ligne 14 108 ⟶ 14 122 :
function liveFilter(Page, params) {
LiveRC_Config["NextPreviewIndex"]++;
var URL = mw.config.get('wgServer');
if(Page=="AbuseFilter"){
URL += mw.config.get('wgArticlePath').split("$1").join("Special:AbuseFilter/"+params);
var FilterParams = params;
}else{
URL += mw.config.get('wgScript') + "?title=Special:AbuseLog";
var FilterParams = new Array();
 
Ligne 14 271 ⟶ 14 285 :
function liveProtect(Title){
LiveRC_Config["NextPreviewIndex"]++;
lrcAddToHistory("liveProtect", new Array(lrcEscapeStr(Title)), mw.config.get('wgServer') + mw.config.get('wgScript') + '?title=' + Title + '&action=protect', Title);
buildBlanckPreviewBar("<b style='text-decoration: blink;'>Protect : <span style='color:red'>"+Title+"</span>...</b>");
wpajax.http({url: lrcGetUglyPageURL(Title, '&action=protect'),
Ligne 14 290 ⟶ 14 304 :
buildPreviewBar({
"Mode" : "Protect",
"Url" : mw.config.get('wgServer') + mw.config.get('wgScript') + '?title=' + encodeURIComponent(c) + '&action=protect',
"Page" : c,
"User1" : ""
Ligne 14 447 ⟶ 14 461 :
buildPreviewBar({
"Mode" : "Block",
"Url" : mw.config.get('wgServer') + mw.config.get('wgScript') + '?title=Special:Blockip/' + encodeURIComponent(c),
"Page" : c,
"User1" : c
Ligne 14 525 ⟶ 14 539 :
function doBlockAverto(user){
var message = document.getElementById("BlockAvertoParam").value;
var URL = mw.config.get('wgServer') + mw.config.get('wgScriptPath') + '/api.php?format=xml&action=query&prop=info&intoken=edit&inprop=protection&titles='+lrcGetNamespaceName(3)+":"+encodeURIComponent(user)
wpajax.http({ url: URL,
onSuccess: postLiveAverto,
Ligne 14 540 ⟶ 14 554 :
function liveEdit(Title, Param, preload){
LiveRC_Config["NextPreviewIndex"]++;
lrcAddToHistory("liveEdit", new Array(lrcEscapeStr(Title), (Param?lrcEscapeStr(""+Param):'\'\'')), mw.config.get('wgServer') + mw.config.get('wgScript') + '?title=' + Title + '&action=edit' + (Param ? Param : ""), Title + (Param ? ' Param="'+Param+'"' : ""));
buildBlanckPreviewBar("<b style='text-decoration: blink;'>Edit : <span style='color:red'>"+Title+"</span>...</b>");
wpajax.http({url: lrcGetUglyPageURL(Title, '&action=edit' + (Param ? Param : "")),
Ligne 14 562 ⟶ 14 576 :
buildPreviewBar({
"Mode" : "Edit",
"Url" : mw.config.get('wgServer') + mw.config.get('wgScript') + '?title=' + encodeURIComponent(c) + '&action=edit',
"Page" : c,
"User1" : ""
Ligne 15 388 ⟶ 15 402 :
 
function liveFeedback_FlagComment(feedbackid, pageid, flag, Args){
var URL = mw.config.get('wgServer') + mw.config.get('wgScriptPath') + '/api.php?format=xml&action=articlefeedbackv5-flag-feedback'
+ '&feedbackid=' + feedbackid
+ '&pageid=' + pageid
Ligne 15 449 ⟶ 15 463 :
 
function liveFeedback_FlagAddNote(feedbackid, logid, pageid, flagtype, note, Args){
var URL = mw.config.get('wgServer') + mw.config.get('wgScriptPath')
+ '/api.php?format=xml&action=articlefeedbackv5-add-flag-note'
+ '&feedbackid=' + feedbackid
+ '&logid=' + logid
Ligne 15 518 ⟶ 15 533 :
// ---------------------------------------------------------------------------------- TODO
function liveFeedback_liveFlagActivity(Link, token, title, paramcontinue){
var URL = mw.config.get('wgServer') + mw.config.get('wgScriptPath')
+ '/api.php?format=xml&action=query&list=articlefeedbackv5-view-activity'
+ '&aafeedbackid=' + token
+ '&aatitle=' + encodeURIComponent(title)
Ligne 15 547 ⟶ 15 563 :
 
function liveFeedback_liveFlagActivity2(Link, token, title, paramcontinue){
var URL = mw.config.get('wgServer') + mw.config.get('wgScriptPath')
+ '/api.php?format=xml&action=query&list=articlefeedbackv5-view-activity'
+ '&aafeedbackid=' + token
+ '&aatitle=' + encodeURIComponent(title)
Ligne 15 588 ⟶ 15 605 :
function liveStabilization(Title){
LiveRC_Config["NextPreviewIndex"]++;
lrcAddToHistory("liveStabilization",new Array(lrcEscapeStr(Title)), mw.config.get('wgServer')+mw.config.get('wgScript')+'?title=Special:Stabilisation'+'&page='+Title, Title);
buildBlanckPreviewBar("<b style='text-decoration: blink;'>Stabilization : <span style='color:red'>"+Title+"</span>...</b>");
wpajax.http({url: lrcGetUglyPageURL("Special:Stabilisation","&page="+encodeURIComponent(Title)),
Ligne 15 737 ⟶ 15 754 :
var URL = lrcMakeParam("TchatURL");
URL = URL.split("$1").join(lrcMakeParam("TchatChannel"));
URL = URL.split("$2").join(encodeURIComponent(mw.config.get('wgUserName').replace(/ /, "_")))
var NewWindowParams = lrcEscapeStr("NewWindowTchat")
+ ','