MediaWiki:Gadget-ocr.js

Opomba: Da bodo spremembe prišle do veljave, po objavi izpraznite predpomnilnik svojega brskalnika.

  • Firefox/Safari: Držite Shift in kliknite Znova naloži (Reload) ali pritisnite Ctrl + Shift + R ali Ctrl + R (⌘ + R v sistemu Mac)
  • Internet Explorer/Edge: Držite Ctrl + F5 in kliknite Osveži (Refresh) ali pritisnite Ctrl + F5
  • Google Chrome: Pritisnite Ctrl + Shift + R (⌘ + Shift + R v sistemu Mac)
  • Opera: Pritisnite Ctrl + F5.
//po en:
/* Forked out of [[MediaWiki:Common.js]] per consensus on [[WS:S]] (see [http://en.wikisource.org/w/index.php?title=Wikisource:Scriptorium&oldid=766251#remove_the_OCR_button permalink]) into a Gadget. */
// <pre><nowiki>

/*
	OCR button
*/
 
function addOCR(form,value){
	if(value =="OCR"){
		s = form.elements["wpTextbox1"].value;
		if(s==""){
			form.elements["wpTextbox1"].value="{"+"{"+"OCR"+"}"+"}";
			form.elements["wpSummary"].value="/*OCR*/";
		}
		proofreadPageFillForm();
	}
}
 
function addOCRButton(){
 
	if((mw.config.get('wgCanonicalNamespace') == "Page") && (!wgCurRevisionId) && (self.proofreadPageViewURL)){
 
		var sb  = document.getElementById("wpSave"); 
		if(sb){
			//sb.parentNode.innerHTML = sb.parentNode.innerHTML+'<input id="wpOcr" name="ocr" type="submit" accesskey="o" value="OCR" title="OCR" onclick="addOCR(this.form,this.value);"/>';

			input=document.createElement("input");
			input.setAttribute('id','wpOcr');
			input.setAttribute('type','submit');
			input.setAttribute('title','OCR');
			input.setAttribute('value','OCR');
			input.setAttribute('tabindex','10');
			input.setAttribute('onclick',"addOCR(this.form,this.value);");
			sb.parentNode.insertBefore(input,sb) 

		}
		var msg  = document.getElementById("noTextMsg"); 
		if(msg){
			s = msg.innerHTML;
			s = s.replace(/vous pouvez <a href=(.*?)<\/a> ou (.*?)modifier cette page<\/a>\./g, 'vous pouvez ajouter le texte, ou demander une OCR automatique depuis la $2page d\'édition</a>.' );
			msg.innerHTML=s;
 
		}
		var msg  = document.getElementById("msgNewarticletext"); 
		if(msg){
			msg.innerHTML='You are editing a page that does not exist.<br/>You may request an OCR by clicking on the OCR button at the bottom of this page.';
		}
 
 
	}
}
$(addOCRButton);
 
var proofreadpage_debug=1;

// </nowiki></pre>