User:94rain/common.js

From Meta, a Wikimedia project coordination wiki

Note: After publishing, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Press Ctrl-F5.
/* CentralAuth */
/**
 * Extra buttons in toolbar
 * @stats [[File:Krinkle_InsertWikiEditorButton.js]]
 */
// <nowiki>
if (!mw.libs.getInsertWikiEditorButton) {
  mw.libs.getInsertWikiEditorButton = $.ajax({ dataType: 'script', cache: true,
    url: 'https://meta.wikimedia.org/w/index.php?title=User:Krinkle/Scripts/InsertWikiEditorButton.js&action=raw&ctype=text/javascript'
  });
}
mw.libs.getInsertWikiEditorButton.then(function () {
	/* Spam
	krInsertWikiEditorButton({
			id: 'Delete1',
			icon: '//upload.wikimedia.org/wikipedia/commons/thumb/4/4d/Symbol_delete_vote_darkened.svg/20px-Symbol_delete_vote_darkened.svg.png',
			label: 'Spam',
			insertBefore: '{{delete|Spam}}',
			insertAfter: '',
			sampleText: '',
			autoSummary: { summary: 'Request for deletion : Spam', position: 'replace' }
	});
	// Vandalism
	krInsertWikiEditorButton({
			id: 'Delete2',
			icon: '//upload.wikimedia.org/wikipedia/commons/thumb/8/89/Symbol_delete_vote.svg/20px-Symbol_delete_vote.svg.png',
			label: 'Vandalism',
			insertBefore: '{{delete|Vandalism}}',
			insertAfter: '',
			sampleText: '',
			autoSummary: { summary: 'Request for deletion : Vandalism', position: 'replace' }
	});
	// gibberish
	krInsertWikiEditorButton({
			id: 'Delete3',
			icon: '//upload.wikimedia.org/wikipedia/commons/thumb/8/85/Symbol_unrelated.svg/20px-Symbol_unrelated.svg.png',
			label: 'gibberish',
			insertBefore: '{{delete|gibberish}}',
			insertAfter: '',
			sampleText: '',
			autoSummary: { summary: 'Request for deletion : gibberish', position: 'replace' }
	}); */
	// Warning
	krInsertWikiEditorButton({
			id: 'Warning1',
			icon: '//upload.wikimedia.org/wikipedia/commons/thumb/b/b0/Symbol_1.svg/20px-Symbol_1.svg.png',
			label: 'warning1',
			insertBefore: '',
			insertAfter: '<div style="background-color:#FFFFFF; padding: 1.2rem; margin-top: 0.5em; border: 1px solid #c8ccd1; border-top-color:#36C; border-top-width: .4rem; border-radius: .20rem; box-shadow: 2px 2px #F7F8F9;">[[File:OOjs UI icon notice-progressive.svg|85px|right|link=]]Hello,<br/>I wanted to let you know that one or more of your recent contributions have been undone because they did not appear constructive. If you would like to experiment, please use the sandbox. If you have any questions, you can ask for assistance at the Help Desk. Thanks.</div>',
			sampleText: '',
			autoSummary: { summary: 'Warning', position: 'replace' }
	});
	krInsertWikiEditorButton({
			id: 'Warningé',
			icon: '//upload.wikimedia.org/wikipedia/commons/thumb/3/3d/Symbol_2.svg/20px-Symbol_2.svg.png',
			label: 'warning2',
			insertBefore: '',
			insertAfter: '<div style="background-color:#FFFFFF; padding: 1.2rem; margin-top: 0.5em; border: 1px solid #c8ccd1; border-top-color:#f16633; border-top-width: .4rem; border-radius: .20rem; box-shadow: 2px 2px #F7F8F9;">[[File:OOjs UI icon notice-warning.svg|85px|right|link=]]Hello,<br/>Please refrain from making unconstructive edits to Wikimedia projects. Your edits appear to constitute vandalism and have been reverted. If you would like to experiment, please use the sandbox. Repeated vandalism may result in the loss of editing privileges. Thank you.</div>',
			sampleText: '',
			autoSummary: { summary: 'Warning 2', position: 'replace' }
	});
	krInsertWikiEditorButton({
			id: 'Warning3',
			icon: '//upload.wikimedia.org/wikipedia/commons/thumb/2/29/Symbol_3.svg/20px-Symbol_3.svg.png',
			label: 'warning3',
			insertBefore: '',
			insertAfter: '<div style="background-color:#FFFFFF; padding: 1.2rem; margin-top: 0.5em; border: 1px solid #c8ccd1; border-top-color:#D33; border-top-width: .4rem; border-radius: .20rem; box-shadow: 2px 2px #F7F8F9;">[[File:OOjs UI icon notice-destructive.svg|85px|right|link=]]Hello,<br/>Please stop your disruptive editing. If you continue to vandalize Wikimedia projects, you may be blocked from editing. Thank you.</div>',
			sampleText: '',
			autoSummary: { summary: 'Last Warning', position: 'replace' }
	});
	krInsertWikiEditorButton({
			id: 'Warning4',
			icon: '//upload.wikimedia.org/wikipedia/commons/thumb/3/3a/Symbol_4.svg/20px-Symbol_4.svg.png',
			label: 'warning4',
			insertBefore: '',
			insertAfter: '<div style="background-color:#FFFFFF; padding: 1.2rem; margin-top: 0.5em; border: 1px solid #c8ccd1; border-top-color:#D33; border-top-width: .4rem; border-radius: .20rem; box-shadow: 2px 2px #F7F8F9;">[[File:OOjs UI icon notice-destructive.svg|70px|right|link=]]Hello,<br/>You may be blocked from editing without further warning the next time you vandalize Wikimedia projects.</div>',
			sampleText: '',
			autoSummary: { summary: 'Final Warning', position: 'replace' }
	});
});
// </nowiki>
//<nowiki>
//Copied from [[User:Abelmoschus Esculentus/AjaxRollbackSummary.js]
jQuery(document).ready(function ($) {
	function SetAjaxRollback() {
		$('span.mw-rollback-link').click(function(e) {
			e.preventDefault();
			var $rblink = $(this);
			var href = this.getElementsByTagName('a')[0].href;
			this.innerHTML = '<img src="http://images2.wikia.nocookie.net/dev/images/8/82/Facebook_throbber.gif" style="vertical-align: baseline;" height="15" width="15" border="0" alt="Rollingback..." />';
			var summary = prompt("Enter summary (leave blank will cancel the action)", "[[Help:Reverting|Reverted]] edits by [[Special:Contributions/$2|$2]] ([[User talk:$2|talk]]) to last version by $1");
			if (summary === null || summary === "") {
				$rblink.text(function (i, val) {return val + '[rollback cancelled]';});
				return;
			}
			$.ajax({
				url: href.replace("?", "?summary=" + encodeURIComponent(summary) + "&"),
				success: function() {
					$rblink.text(function (i, val) {return val + '[reverted]';});
					loadPageData();
				},
				error: function() {
					$rblink.text(function (i, val) {return val + '[rollback failed]';});
					loadPageData();
				}
			});
		});
	}
	mw.loader.using(['mediawiki.util', 'mediawiki.api', 'mediawiki.Title', 'mediawiki.RegExp'], function() {
		SetAjaxRollback();
	});
});
//</nowiki>
mw.loader.load( '//www.wikidata.org/w/index.php?title=User:Matěj_Suchánek/patrolRevisions.js&action=raw&ctype=text/javascript' );