Kullanıcı:Vito Genovese/geryar.js

Not: Sayfayı kaydettikten sonra değişiklikleri görebilmek için tarayıcınızın önbelleğinizi temizlemeniz gerekir. Google Chrome, Firefox, Microsoft Edge ve Safari: ⇧ Shift tuşuna basılı tutun ve Yeniden Yükle araç çubuğu düğmesine tıklayın. Ayrıntılar ve diğer tarayıcılara yönelik yönergeler için Vikipedi:Önbelleğinizi atlayın sayfasını inceleyin.
function addSumButton(name, text) {
 $('<a title="'+text+'">'+name+'</a>').click(insertSummary).appendTo(wpSummaryButtons);
}
function insertSummary ( txt ) {
	if ( typeof txt !== 'string' ) {
		txt = this.title;
	}
	var vv = $( '#wpReason' ).val();
	if ( vv.indexOf( txt ) !== -1 ) {
		return;
	}
	if ( /[^,; \/]$/.test( vv ) ) {
		vv += ',';
	}
	if ( /[^ ]$/.test( vv ) ) {
		vv += ' ';
	}
	$( '#wpReason' ).val( vv + txt );
}
$(function (){
 var sum = document.getElementById('wpReason');
 if (!sum || (sum.form && sum.form.wpSection && sum.form.wpSection.value == 'new')) return;
 mw.util.addCSS('\
 #userSummaryButtonsA a {background:#cef; border:1px solid #adf; padding:0 2px; margin:0 2px;\
  cursor:pointer; font-size:80%; color:#666}\
 #userSummaryButtonsA a:hover {background:#bdf; color:black; text-decoration:none}');
 wpSummaryButtons = $('<div id=userSummaryButtonsA />').insertAfter(sum); //global var
 var ss = ["&#91;&#91;VP:Vandalizm&#124;vandalizm&#93;&#93;|amaçlı değişiklik", 
			"deneme|amaçlı değişiklik", 
			"&#91;&#91;VP:Reklam&#124;reklam&#93;&#93;|amaçlı değişiklik", 
			"yapıcı|olmayan değişiklik", 
			"&#91;&#91;VP:Telif&#124;telif&#93;&#93;|hakkının ısrarlı ihlali", 
			"nedensiz içerik silinmesi" ];
 for (var i=0; i<ss.length; i++)
   addSumButton(ss[i].replace(/\|.*/,' '), ss[i].replace(/\|/,' '));
});