User:DodoMan/qualitybutton.js: Difference between revisions
Jump to navigation
Jump to search
m Justarandomamerican moved page User:Rafdodo/qualitybutton.js to User:DodoMan/qualitybutton.js: Automatically moved page while renaming the user "Rafdodo" to "DodoMan" |
m FuzzyBot moved page User:DodoMan~usurped/qualitybutton.js to User:DodoMan/qualitybutton.js: Part of translatable page "User:DodoMan~usurped" |
(One intermediate revision by one other user not shown) | |
(No difference)
|
Latest revision as of 12:56, 2 April 2024
var q0 = "//upload.wikimedia.org/wikipedia/commons/8/8f/00%25.png";
var q25 = "//upload.wikimedia.org/wikipedia/commons/5/5b/25%25.png";
var q50 = "//upload.wikimedia.org/wikipedia/commons/3/3a/50%25.png";
var q75 = "//upload.wikimedia.org/wikipedia/commons/c/cd/75%25.png";
var q100 = "//upload.wikimedia.org/wikipedia/commons/6/64/100%25.png";
var qvalid = "//upload.wikimedia.org/wikipedia/commons/thumb/7/79/Mozilla.svg/10px-Mozilla.svg.png";
window.addQuality = function (form,value){
var text="";
switch(value){
case "25%": text = "Texte incomplet"; break;
case "50%": text = "Texte non formaté"; break;
case "75%": text = "Complet et formaté"; break;
case "100%": text = "Relu et corrigé"; break;
case "Textes validés": text = "Validé"; break;
case "mode_page|": text = "Texte en mode page"; break;
}
form.elements["wpSummary"].value="/* "+text+" */";
s = form.elements["wpTextbox1"].value;
s = s.replace(/\{\{TextQuality\|([^}]*?)\}\}\n/gi,"");
s = s.replace(/\{\{TextQuality\|([^}]*?)\}\}/gi,"");
form.elements["wpTextbox1"].value="{"+"{TextQuality|"+value+"}"+"}\n"+s;
};
function addQualityButtons(){
if( mw.config.get('wgNamespaceNumber') !== 0 ) return;
var ig = document.getElementsByClassName("editCheckboxes")[0];
if(!ig) return;
var f = document.createElement("span");
f.innerHTML = ' <input type="radio" name="quality" value="25%" onclick="window.addQuality(this.form,this.value)"><img src = "'+q25+'">'
+ '<input type="radio" name="quality" value="50%" onclick="window.addQuality(this.form,this.value)"><img src = "'+q50+'">'
+ '<input type="radio" name="quality" value="75%" onclick="window.addQuality(this.form,this.value)"><img src = "'+q75+'">'
+ '<input type="radio" name="quality" value="100%" onclick="window.addQuality(this.form,this.value)"><img src = "'+q100+'">'
+ '<input type="radio" name="quality" value="Textes validés" onclick="window.addQuality(this.form,this.value)"><img src = "'+qvalid+'">'
//+'<input type="radio" name="quality" value="mode_page|" onclick="window.addQuality(this.form,this.value)"><img src = "//upload.wikimedia.org/wikipedia/commons/thumb/9/92/Open_book_nae_02.svg/20px-Open_book_nae_02.svg.png">'
+ ' Niveau d\’avancement du texte';
ig.append(f);
}
/****
Seulement en mode édition
*****/
if ( !mw.user.isAnon() ) {
if (mw.config.get('wgAction') == 'edit' || mw.config.get('wgAction') == 'submit') {
$(addQualityButtons);
}
}