User:1234qwer1234qwer4/warnings.js

//Warning: Does not work with syntax highlighting //Fork of ru:Участник:OneLittleMouse/warnings.js //Автор исходного скрипта - DerLetzteRegenbogen ( function { function warnbuttons {	if (!$('#warnbuttonselect').length) {		$(' ').append([ $('').click(qwarnVandalism)[0], $('').click(qwarnSpam)[0], $('').click(qwarnSpamPage)[0], $('').click(qwarnTest)[0], $('').click(qwarnTestAnon)[0], $('').click(qwarnBlanking)[0], $('').click(qwarnStop)[0], $('').click(qwarnBlocked)[0], $('').click(qwarnNPOV)[0], $('').click(qwarnFacts)[0], $('').click(qwarnUseCategories)[0], $('').click(qwarnUseTalk)[0], $('').click(qwarnUseEditSum)[0], $('').click(qwarnWelcome)[0], $('').click(qwarnWelcomeCopyright)[0] ]).prependTo($('#editform'));	} else {		$('#warnbuttonselect').toggle;	} } function hideInitialWarnbuttonselect {	document.getElementById('warnbuttonselect').style.display = 'none'; } function postWarn(sumString, warnString) {	var text = document.getElementById('wpTextbox1');	text.value += warnString+'\n';	var minorcb = document.getElementById('wpMinoredit');	if (minorcb && minorcb.checked) minorcb.checked = false;       var section = document.getElementsByName('wpSection')[0];	var sum = document.getElementById('wpSummary');	if (sum && (section.value != "new")) sum.value = sumString + ' (using warnings.js)'; } function qwarnVandalism {	postWarn('Warning: Blatant vandalism', '\n== Vandalism ==\n\{\{subst:Blatantvandal|1=\~\~\~\~\}\}'); } function qwarnSpam {	postWarn('Warning: Spamming or promotional content', '\n== Spamming or promotion ==\n\{\{subst:spam|1=\~\~\~\~\}\}'); }

function qwarnSpamPage { postWarn('Warning: Promotional page', '\n== Spamming or promotion ==\n\{\{subst:spam page|1=\~\~\~\~\}\}'); }

function qwarnTest { postWarn('Warning: Please use the sandbox for testing', '\n== Editing tests ==\n\{\{subst:test|1=\~\~\~\~\}\}'); }

function qwarnTestAnon { postWarn('Warning: Please use the sandbox for testing', '\n== Editing tests ==\n\{\{subst:TestAnon|1=\~\~\~\~\}\}'); }

function qwarnBlanking { postWarn('Warning: Do not blank pages', '\n== Blanking ==\n\{\{subst:Blanking|1=\~\~\~\~\}\}'); }

function qwarnStop { postWarn('Warning: Please contribute constructively', '\n== Vandalism ==\n\{\{subst:Please stop|2=\~\~\~\~\}\}'); }

function qwarnBlocked { postWarn('You have been blocked from editing Wikibooks', '\n== Blocked ==\n\{\{subst:blocked|time=|reason=|sig=yes\}\}'); }

function qwarnNPOV { postWarn('Warning: Please maintain a neutral point of view', '\n== Neutral point of view ==\n\{\{subst:NPOV note|1=\~\~\~\~\}\}'); }

function qwarnFacts { postWarn('Warning: Please only introduce factual information', '\n== Factual information ==\n\{\{subst:Please facts|1=\~\~\~\~\}\}'); }

function qwarnUseCategories { postWarn('Warning: Please use categories', '\n== Using categories ==\n\{\{subst:Use categories|1=\~\~\~\~\}\}'); }

function qwarnUseTalk { postWarn('Warning: Please use the talk page', '\n== Talk pages ==\n\{\{subst:Use talk page|2=\~\~\~\~\}\}'); }

function qwarnUseEditSum { postWarn('Warning: Please use edit summaries', '\n== Edit summaries ==\n\{\{subst:Edit summary|1=\~\~\~\~\}\}'); }

function qwarnWelcome { postWarn('Welcome!', '\n== Welcome ==\n\{\{subst:welcome\}\} \~\~\~\~'); }

function qwarnWelcomeCopyright { postWarn('Welcome! Please respect copyrights.', '\n== Welcome ==\n\{\{subst:welcome-copyright\}\} \~\~\~\~'); }

var customizeToolbar = function { /*start*/ $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {	'section': 'main',       'group': 'insert',	'tools': {		'warnbuttons': {			label: 'Warnings', // or use labelMsg for a localized label, see above			type: 'button',			icon: '//upload.wikimedia.org/wikipedia/commons/6/6d/Button_exclamation_1.png',			filters: [ 'body.ns-3' ],			action: {				type: 'callback',				execute: function(context){					warnbuttons;				}			}		}	} } );

/*end*/ };

if ( $.inArray( mw.config.get( 'wgAction' ), [ 'edit', 'submit' ] ) !== -1 ) { mw.loader.using( 'user.options' ).then( function {			if ( mw.user.options.get( 'usebetatoolbar' ) == 1 ) {			$.when( mw.loader.using( 'ext.wikiEditor' ), $.ready ).then( customizeToolbar );		}	} ); } } );