Kullanıcı:Kml serhan/cologneblue.js

Vikisözlük sitesinden
function addAutoStandart()
{
    if ((wgCurRevisionId == null) || (wgCurRevisionId != false)) return;
    if(!/action=edit/.test(window.location.href) && !/action=submit/.test(window.location.href)) return;
    if(/section=new/.test(window.location.href)) return;
    if(!document.forms.editform) return;
    document.forms.editform.wpSave.onclick = AutoStandart;
}
 
function regex(search,replace,repeat) {
		if(!repeat || repeat<0) {
			var repeat = 1;
		}
		for(var i=0; i<repeat; i++) {
			editbox.value = editbox.value.replace(search,replace);
		}
	}

function AutoStandart()
{
  editbox = document.getElementById('wpTextbox1');
  regex(/^(?![\n\s]*{{\Çalışma var}}|[\n\s]*{{\düzenle}})/g, '{{\düzenle}}\r');
  regex(/^[\n\s]*{{\Çalışma var}}/g, '{{\düzenle}}');
  regex(/Türkçe}}==/g, 'Osmanlıca}}==');

  return true;
}
 
$(addAutoStandart);