ਸਮੱਗਰੀ 'ਤੇ ਜਾਓ

ਵਰਤੋਂਕਾਰ:Benipal hardarshan/QualityButton.js

ਵਿਕੀਸਰੋਤ ਤੋਂ
Note: After saving, changes may not occur immediately. Click here to learn how to bypass your browser's cache.
  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (Cmd-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (Cmd-Shift-R on a Mac)
  • Internet Explorer: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Clear the cache in Tools → Preferences

For details and instructions about other browsers, see Wikipedia:Bypass your cache.

/********************
Indicateurs de qualité
Auteur: ThomasV
*********************/
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";

/****
*Mode édition
*****/

if (mw.config.get('wgAction') == 'edit' || mw.config.get('wgAction') == 'submit') {


	/*
	 *Boutons Qualité
	 *Auteur: ThomasV
	 */
	window.addQuality = function (form,value){

		var text="";
		switch(value){
			case "25%": text = "Not scanned"; break;
			case "50%": text = "not proofread"; break;
			case "75%": text = "need formatting"; break;
			case "100%": text = "proofread"; break;
                        case "validated": text = "validated"; break;
			case "mode_page|": text = "Text in page mode"; 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)
	}

	$(addQualityButtons);
}