Kullanıcı:Srhat/metin kalitesi

Vikikaynak sitesinden
Gezinti kısmına atla Arama kısmına atla
/******************************************** Metin Kalitesi************************************/
/**********************
*** Quality indicators on "article" tab
*** by [[user:ThomasV]]
**********************/
function icon_src(t){
	var src='';
	switch(t){
		case "0%": src='http://upload.wikimedia.org/wikipedia/commons/8/8f/00%25.png'; break;
		case "25%": src='http://upload.wikimedia.org/wikipedia/commons/5/5b/25%25.png'; break;
		case "50%": src='http://upload.wikimedia.org/wikipedia/commons/3/3a/50%25.png'; break;
		case "75%": src='http://upload.wikimedia.org/wikipedia/commons/c/cd/75%25.png'; break;
		case "100%": src='http://upload.wikimedia.org/wikipedia/commons/6/64/100%25.png'; break;
	} 
	return src;
}
 
function pageQuality() {
	var a = document.getElementById("ca-nstab-main");
	if(!a) return;
 
	var q = document.getElementById("textquality")
	if(q) {
		var new_img = document.createElement("img");
		new_img.setAttribute("src", icon_src(q.className));
		a.firstChild.appendChild(new_img);
	}
 
	for(var i=0; spanElem = document.getElementsByTagName("span")[i]; i++) {
		if (spanElem.className == "pagequality")  {
			var new_img = document.createElement("img");
			new_img.setAttribute("src", icon_src(spanElem.title));
 
			if(wgCanonicalNamespace == "Page") {
				a.firstChild.appendChild(new_img);
			}
			else {
				s1 = spanElem.parentNode.previousSibling;
				opttext = s1.firstChild.firstChild;
				img = opttext.firstChild.nextSibling.nextSibling.nextSibling;
				next = img.nextSibling;
				opttext.removeChild(img);
				opttext.insertBefore(new_img,next);
			}
		}
	}
}
 
addOnloadHook(pageQuality);
 
 
 
/**********************
*** Add quality buttons on edit view
*** by [[user:ThomasV]]
**********************/
 
function addQuality(form,value){
	var text="";
	switch(value){
		case "25%": text = "Tamamlanmamış"; break;
		case "50%": text = "Formatlanmamış"; break;
		case "75%": text = "Tamamlanmış ve formtlanmış"; break;
		case "100%": text = "Düzenlendi"; break;
	} 
	form.elements["wpSummary"].value="/* "+text+" */";
 
	if(wgCanonicalNamespace == "Page") {
		s = form.elements["headerTextbox"].value;
		s = s.replace(/\{\{PageQuality\|(.*?)\}\}/gi,"")
		form.elements["headerTextbox"].value="{"+"{PageQuality|"+value+"}"+"}"+s;
 
	}
	else {
		s = form.elements["wpTextbox1"].value;
		s = s.replace(/\{\{TextQuality\|(.*?)\}\}/gi,"")
		form.elements["wpTextbox1"].value="{"+"{TextQuality|"+value+"}"+"}"+s;
	}
}
 
 
 
function addQualityButtons(){
	if( wgNamespaceNumber != 0) {
		return;
	}
	var ig  = document.getElementById("wpWatchthis"); 
	if(ig) {
		var f = document.createElement("span");
		f.innerHTML = ' <input type="radio" name="quality" value="25%" onclick="addQuality(this.form,this.value)"><img src = "/wiki/Special:Filepath/25%25.png">'+'<input type="radio" name="quality" value="50%" onclick="addQuality(this.form,this.value)"><img src = "/wiki/Special:Filepath/50%25.png">'+'<input type="radio" name="quality" value="75%" onclick="addQuality(this.form,this.value)"><img src = "/wiki/Special:Filepath/75%25.png">'+'<input type="radio" name="quality" value="100%" onclick="addQuality(this.form,this.value)"><img src = "/wiki/Special:Filepath/100%25.png"><a href="http://tr.wikisource.org/wiki/VikiKaynak:Metin_kalitesi">Metin kaliteleri hakkında</a>';
		ig.parentNode.insertBefore(f,ig.nextSibling.nextSibling.nextSibling)
	}
}
 
addOnloadHook(addQualityButtons);
/******************************************** Metin Kalitesi/SON************************************/