User:Ou0430/Friendly/friendlyfluff.js

注意:在发布之后,您可能需要清除浏览器缓存才能看到所作出的变更的影响。

  • Firefox或Safari:按住Shift的同时单击刷新,或按Ctrl-F5Ctrl-R(Mac为⌘-R
  • Google Chrome:Ctrl-Shift-R(Mac为⌘-Shift-R
  • Internet Explorer或Edge:按住Ctrl的同时单击刷新,或按Ctrl-F5
  • Opera:Ctrl-F5
// If FriendlyConfig aint exist.
if( typeof( FriendlyConfig ) == 'undefined' ) {
	FriendlyConfig = {};
}
 
/**
 FriendlyConfig.summaryAd (string)
 If ad should be added or not to summary, default [[WP:FRIENDLY|Friendly]]
 */
if( typeof( FriendlyConfig.summaryAd ) == 'undefined' ) {
	FriendlyConfig.summaryAd = " using [[WP:FRIENDLY|Friendly]]";
}
 
/**
 FriendlyConfig.revertMaxRevisions (int)
 defines how many revision to query maximum, maximum possible is 50, default is 50
 */
if( typeof( FriendlyConfig.revertMaxRevisions ) == 'undefined' ) {
	FriendlyConfig.revertMaxRevisions = 50;
}
 
/**
 FriendlyConfig.userTalkPageMode may take arguments:
 'window': open a new window, remmenber the opened window
 'tab': opens in a new tab, if possible.
 'blank': force open in a new window, even if a such window exist
 */
if( typeof( FriendlyConfig.userTalkPageMode ) == 'undefined' ) {
	FriendlyConfig.userTalkPageMode = 'tab';
}
 
/**
 FriendlyConfig.openTalkPage (array)
 What types of actions that should result in opening of talk page
 */
if( typeof( FriendlyConfig.openTalkPage ) == 'undefined' ) {
	FriendlyConfig.openTalkPage = [ /*'agf', 'norm', 'vand'*/ ];
}
 
/**
 FriendlyConfig.openTalkPageOnAutoRevert (bool)
 Defines if talk page should be opened when canling revert from contrib page, this because from there, actions may be multiple, and opening talk page not suitable. If set to true, openTalkPage defines then if talk page will be opened.
 */
if( typeof( FriendlyConfig.openTalkPageOnAutoRevert ) == 'undefined' ) {
	FriendlyConfig.openTalkPageOnAutoRevert = false;
}
 
/**
 FriendlyConfig.markRevertedPagesAsMinor (array)
 What types of actions that should result in marking edit as minor
 */
if( typeof( FriendlyConfig.markRevertedPagesAsMinor ) == 'undefined' ) {
	FriendlyConfig.markRevertedPagesAsMinor = [ 'vand' ];
}
 
/**
 FriendlyConfig.watchRevertedPages (array)
 What types of actions that should result in forced addition to watchlist
 */
if( typeof( FriendlyConfig.watchRevertedPages ) == 'undefined' ) {
	FriendlyConfig.watchRevertedPages = [ /*'agf', 'norm', 'vand', 'torev'*/ ];
}
 
/**
 FriendlyConfig.offerReasonOnNormalRevert (boolean)
 If to offer a promt for extra summary reason for normal reverts, default to true
 */
if( typeof( FriendlyConfig.offerReasonOnNormalRevert ) == 'undefined' ) {
	FriendlyConfig.offerReasonOnNormalRevert = true;
}
 
/**
 FriendlyConfig.showRollbackLinks (array)
 Where Friendly should show rollback links (diff, others, mine, contribs)
 */
if( typeof( FriendlyConfig.showRollbackLinks ) == 'undefined' ) {
	FriendlyConfig.showRollbackLinks = [ 'diff', 'others', 'mine', 'contribs' ];
}
 
// a list of usernames, usually only bots, that vandalism revert is jumped over, that is
// if vandalism revert was chosen on such username, then it's target in on the revision before.
// This is for handeling quick bots that makes edits seconds after the original edit is made.
// This only affect vandalism rollback, for good faith rollback, it will stop, indicating a bot 
// has no faith, and for normal rollback, it will rollback that edit.
var WHITELIST = ['Jimmy-bot'];
 
friendlyfluff = {
	auto: function() {
		if( QueryString.get( 'oldid' ) != wgCurRevisionId ) {
			// not latest revision
			return;
		}
 
		var ntitle = getElementsByClassName( document.getElementById('bodyContent'), 'td' , 'diff-ntitle' )[0];
		if( ntitle.getElementsByTagName('a')[0].firstChild.nodeValue.match( '當前修訂版本' ) != null ) {
			// not latest revision
			return;
		}
 
		vandal = ntitle.getElementsByTagName('a')[3].firstChild.nodeValue;
 
		if( !FriendlyConfig.openTalkPageOnAutoRevert ) {
			FriendlyConfig.openTalkPage = [];
		}
 
		return friendlyfluff.revert( QueryString.get( 'friendlyrevert' ), vandal );
	},
	normal: function() {
 
		var spanTag = function( color, content ) {
			var span = document.createElement( 'span' );
			span.style.color = color;
			span.appendChild( document.createTextNode( content ) );
			return span;
		}
 
		if( wgNamespaceNumber == -1 && wgCanonicalSpecialPageName == "Contributions" ) {
			//Get the username these contributions are for
			username = document.evaluate( 'substring-after(//div[@id="contentSub"]//a[@title="Special:日誌"][last()]/@href, "user=")', document, null, XPathResult.STRING_TYPE, null).stringValue;
			if( FriendlyConfig.showRollbackLinks.indexOf('contribs') != -1 || ( wgUserName != username && FriendlyConfig.showRollbackLinks.indexOf('others') != -1 ) || ( wgUserName == username && FriendlyConfig.showRollbackLinks.indexOf('mine') != -1 ) ) {
				var list = document.evaluate( '//div[@id="bodyContent"]//ul/li[contains(span[@class="mw-uctop"], " (頂)")]', document, null,  XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null );
				var vandal = document.evaluate( '//div[@id="contentSub"]/a[1]/@title', document, null, XPathResult.STRING_TYPE, null ).stringValue.replace(/^User( talk)?:/ , '').replace("'", "\\'");
 
				//var revNode = document.createElement('strong');
				var revNode = document.createElement('span');
				revNode.setAttribute( 'id', 'friendly-revert-contrib' );
				revNode.style.fontWeight = 'bold';
				var revLink = document.createElement('a');
				revLink.appendChild( spanTag( 'Black', ' [' ) );
				revLink.appendChild( spanTag( 'SteelBlue', '回退' ) );
				revLink.appendChild( spanTag( 'Black', ']' ) );
				revNode.appendChild(revLink);
 
				//var revVandNode = document.createElement('strong');
				var revVandNode = document.createElement('span');
				revVandNode.setAttribute( 'id', 'friendly-revert-vand-contrib' );
				revVandNode.style.fontWeight = 'bold'
				var revVandLink = document.createElement('a');
				revVandLink.appendChild( spanTag( 'Black', ' [' ) );
				revVandLink.appendChild( spanTag( 'Red', '破壞' ) );
				revVandLink.appendChild( spanTag( 'Black', ']' ) );
				revVandNode.appendChild(revVandLink);
 
				for(var i = 0; i < list.snapshotLength; ++i ) {
					var current = list.snapshotItem(i);
 
					var href = document.evaluate( 'a[3]/@href', current, null, XPathResult.STRING_TYPE, null ).stringValue;
					var tmpNode = revNode.cloneNode( true );
					tmpNode.firstChild.setAttribute( 'href', href + '&' + QueryString.create( { 'friendlyrevert': 'norm' } ) );
					current.appendChild( tmpNode );
					var tmpNode = revVandNode.cloneNode( true );
					tmpNode.firstChild.setAttribute( 'href', href + '&' + QueryString.create( { 'friendlyrevert': 'vand' } ) );
					current.appendChild( tmpNode );
				}
			}
		} else {
 
			if( wgCanonicalSpecialPageName == "Special:Undelete" ) {
				//You can't rollback deleted pages!
				return;
			}
 
 
			var body = document.getElementById('bodyContent');
 
			var firstRev = document.evaluate( 'boolean(/div[@class="firstrevisionheader"])', body, null, XPathResult.BOOLEAN_TYPE, null ).booleanValue;
			if( firstRev ) {
				// we have first revision here, nothing to do.
				return;
			}
 
			try {
				var otitle1 = document.getElementById('mw-diff-otitle1'); 
				var ntitle1 = document.getElementById('mw-diff-ntitle1'); 
				if (!otitle1 || !ntitle1) return;
				var otitle = otitle1.parentNode;
				var ntitle = ntitle1.parentNode;
			} catch( e ) {
				// no old, nor new title, nothing to do really, return;
				return;
			}
 
			var old_rev_url = document.evaluate( '//strong/a/@href',  document.getElementById('mw-diff-ntitle2'), null, XPathResult.STRING_TYPE, null ).stringValue;
 
			// Lets first add a [edit this revision] link
			var query = new QueryString( old_rev_url.split( '?', 2 )[1] );
 
			var oldrev = query.get( 'oldid' );
 
			var revertToRevision = document.createElement('div');
			revertToRevision.setAttribute( 'id', 'friendly-revert-to-revision' );
			revertToRevision.style.fontWeight = 'bold';
 
			var revertToRevisionLink = revertToRevision.appendChild( document.createElement('a') );
			revertToRevisionLink.href = "javascript:friendlyfluff.revertToRevision('" + oldrev + "')";
			revertToRevisionLink.appendChild( spanTag( 'Black', '[' ) );
			revertToRevisionLink.appendChild( spanTag( 'SaddleBrown', '回退至此' ) );
			revertToRevisionLink.appendChild( spanTag( 'Black', ']' ) );
 
			otitle.insertBefore( revertToRevision, otitle.firstChild );
 
			if( document.getElementById('differences-nextlink') ) {
				// Not latest revision
				curVersion = false;
				return;
			}
			if( FriendlyConfig.showRollbackLinks.indexOf('diff') != -1 ) {
				vandal = document.evaluate( 'a', document.getElementById('mw-diff-ntitle2') , null, XPathResult.STRING_TYPE, null ).stringValue.replace("'", "\\'");
 
				var revertNode = document.createElement('div');
				revertNode.setAttribute( 'id', 'friendly-revert' );
 
				var agfNode = document.createElement('strong');
				var vandNode = document.createElement('strong');
				var normNode = document.createElement('strong');
 
				var agfLink = document.createElement('a');
				var vandLink = document.createElement('a');
				var normLink = document.createElement('a');
 
				agfLink.href = "javascript:friendlyfluff.revert('agf' , '" + vandal + "')"; 
				vandLink.href = "javascript:friendlyfluff.revert('vand' , '" + vandal + "')"; 
				normLink.href = "javascript:friendlyfluff.revert('norm' , '" + vandal + "')"; 
 
				agfLink.appendChild( spanTag( 'Black', '[' ) );
				agfLink.appendChild( spanTag( 'DarkOliveGreen', 'AGF' ) );
				agfLink.appendChild( spanTag( 'Black', ']' ) );
 
				vandLink.appendChild( spanTag( 'Black', '[' ) );
				vandLink.appendChild( spanTag( 'Red', '破壞' ) );
				vandLink.appendChild( spanTag( 'Black', ']' ) );
 
				normLink.appendChild( spanTag( 'Black', '[' ) );
				normLink.appendChild( spanTag( 'SteelBlue', '回退' ) );
				normLink.appendChild( spanTag( 'Black', ']' ) );
 
				agfNode.appendChild(agfLink);
				vandNode.appendChild(vandLink);
				normNode.appendChild(normLink);
 
				revertNode.appendChild( agfNode );
				revertNode.appendChild( document.createTextNode(' || ') );
				revertNode.appendChild( normNode );
				revertNode.appendChild( document.createTextNode(' || ') );
				revertNode.appendChild( vandNode );
 
				ntitle.insertBefore( revertNode, ntitle.firstChild );
			}
		}
	}
}
 
friendlyfluff.revert = function revertPage( type, vandal, rev, page ) {
 
	wgPageName = page || wgPageName;
	wgCurRevisionId = rev || wgCurRevisionId;
 
	Status.init( document.getElementById('bodyContent') );
	var params = {
		type: type,
		user: vandal
	}
	var query = {
		'action': 'query',
		'prop': 'revisions',
		'titles': wgPageName,
		'rvlimit': 50, // max possible
		'rvprop': [ 'ids', 'timestamp', 'user', 'comment' ]
	}
	var wikipedia_api = new Wikipedia.api( '抓歷史版本數據', query, friendlyfluff.callbacks.main );
	wikipedia_api.params = params;
	wikipedia_api.post();
}
 
friendlyfluff.revertToRevision = function revertToRevision( oldrev ) {
 
	Status.init( document.getElementById('bodyContent') );
 
	var query = {
		'action': 'query',
		'prop': 'revisions',
		'titles': wgPageName,
		'rvlimit': 1,
		'rvstartid': oldrev,
		'rvprop': [ 'ids', 'timestamp', 'user', 'comment', 'content' ],
		'format': 'xml'
	}
 
	var wikipedia_api = new Wikipedia.api( '抓歷史版本數據', query, friendlyfluff.callbacks.toRevision.main );
	wikipedia_api.params = { rev: oldrev };
	wikipedia_api.post();
}
 
friendlyfluff.callbacks = {
	toRevision: {
		main: function( self ) {
			var xmlDoc = self.responseXML;
			self.params.revision = xmlDoc.evaluate('//rev', xmlDoc, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null ).singleNodeValue;
			var query = {
				'title': wgPageName,
				'action': 'submit'
			};
			var wikipedia_wiki = new Wikipedia.wiki( '回退頁面', query, friendlyfluff.callbacks.toRevision.reverting );
			wikipedia_wiki.params = self.params;
			wikipedia_wiki.get();
 
		},
		reverting: function( self ) {
			var form = self.responseXML.getElementById( 'editform' );
			var text = self.params.revision.textContent;
 
			if( !form ) {
				self.statelem.error( '無法取得"editform"位點,取消操作' );
				return;
			}
 
			var optional_summary = prompt( "如可能,請提供一個理由" );
			if (optional_summary == null)
			{
				self.statelem.error( '由用戶中斷' );
				return;
			}
			var summary = sprintf( "回退至[[Special:Contributions/%s|%1$s]]在%s編輯的%d版本%s%s", 
				self.params.revision.getAttribute( 'user' ),
				self.params.revision.getAttribute( 'timestamp' ),
				self.params.revision.getAttribute( 'revid' ),
				optional_summary ? "; " + optional_summary : '',
				FriendlyConfig.summaryAd
			);
			var postData = {
				'wpMinoredit': FriendlyConfig.markRevertedPagesAsMinor.indexOf( 'torev' ) != -1 ? '' : undefined, 
				'wpWatchthis': FriendlyConfig.watchRevertedPages.indexOf( 'torev' ) != -1 ? '' : form.wpWatchthis.checked ? '' : undefined,
				'wpStarttime': form.wpStarttime.value,
				'wpEdittime': form.wpEdittime.value,
				'wpAutoSummary': form.wpAutoSummary.value,
				'wpEditToken': form.wpEditToken.value,
				'wpSection': '',
				'wpSummary': summary,
				'wpTextbox1': text
			};
			Wikipedia.actionCompleted.redirect = wgPageName;
			Wikipedia.actionCompleted.notice = "完成"
 
			self.post( postData );
		}
	},
	main: function( self ) {
 
		var xmlDoc = self.responseXML;
		var revs = xmlDoc.evaluate( '//rev', xmlDoc, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null );
 
		if( revs.snapshotLength < 1 ) {
			self.statitem.error( '不存在歷史版本,無法回退' );
			return;
		}
		var top = revs.snapshotItem(0);
		if( top.getAttribute( 'revid' ) < wgCurRevisionId ) {
			Status.error( '錯誤', [ '本頁的當前修訂版本', htmlNode( 'strong', top.getAttribute('revid') ), '小於提供的修訂版本這可能是頁面已被刪除,或服務器的延遲,取消操作' ] );
			return;
		}
		var index = 1;
		if( wgCurRevisionId != top.getAttribute('revid') ) {
			Status.warn( '警告', [ '本頁的當前修訂版本', htmlNode( 'strong', top.getAttribute('revid') ), '不等於提供的修訂版本', htmlNode( 'strong', wgCurRevisionId) ] );
			if( top.getAttribute( 'user' ) == self.params.user ) {
				switch( self.params.type ) {
				case 'vand':
					Status.info( '信息', [ '本頁的當前修訂版本由', htmlNode( 'strong', self.params.user ) , ',被認為是破壞,回退' ]);
					break;
				case 'agf':
					Status.warn( '警告', [ '本頁的當前修訂版本由', htmlNode( 'strong', self.params.user ) , ',基於善意推定,問題可能已經解決,取消操作' ]);
					return;
				default:
					Status.warn( '提示', [ '本頁的當前修訂版本由', htmlNode( 'strong', self.params.user ) , ',取消回退' ] );
					return;
				}
			}
			else if( 
				self.params.type == 'vand' && 
				WHITELIST.indexOf( top.getAttribute( 'user' ) ) != -1 && revs.snapshotLength > 1 &&
				revs.snapshotItem(1).getAttribute( 'pageId' ) == wgCurRevisionId 
			) {
				Status.info( '信息', [ '本頁的當前修訂版本由', htmlNode( 'strong', top.getAttribute( 'user' ) ), ',一個可信的機器人,之前的版本被認為是破壞,回退' ] );
				index = 2;
			} else {
				Status.error( '錯誤', [ '本頁的當前修訂版本由', htmlNode( 'strong', top.getAttribute( 'user' ) ), ',所以此修訂可能已經被回退,取消操作'] );
				return;
			}
 
		}
 
		if( WHITELIST.indexOf( self.params.user ) != -1  ) {
			switch( self.params.type ) {
			case 'vand':
				Status.info( '信息', [ '試圖以破壞為由回退', htmlNode( 'strong', self.params.user ), '做出的編輯,但這是一個可信的機器人,回退之前用戶做出的破壞' ] );
				index = 2;
				vandal = revs.snapshotItem(1).getAttribute( 'user' );
				self.params.user = revs.snapshotItem(1).getAttribute( 'user' );
				break;
			case 'agf':
				Status.warn( '信息', [ '試圖以AGF回退', htmlNode( 'strong', self.params.user ), '做出的編輯,但這是一個機器人,此次編輯和AGF無關,取消操作' ] );
				return;
 
				break;
			case 'norm':
			default:
				var cont = confirm( '試圖常規回退(' + self.params.user + ')做出的編輯,但這是一個可信的機器人,確認回退?' );
				if( cont ) {
					Status.info( '信息', [ '試圖常規回退', htmlNode( 'strong', self.params.user ), '做出的編輯,但這是一個可信的機器人,將一併回退上一版本' ] );
					index = 2;
					self.params.user = revs.snapshotItem(1).getAttribute( 'user' );
				} else {
					Status.warn( '信息', [ '試圖常規回退', htmlNode( 'strong', self.params.user ), '做出的編輯,但這是一個可信的機器人,基於您的選擇,將執行回退' ] );
				}
				break;
			}
		}
		var found = false;
		var count = 0;
 
		for( var i = index; i < revs.snapshotLength; ++i ) {
			++count;
			if( revs.snapshotItem(i).getAttribute( 'user' ) != self.params.user ) {
				found = i;
				break;
			}
		}
 
 
		if( ! found ) {
			self.statelem.error( [ '未發現歷史版本,可能', htmlNode( 'strong', self.params.user ), '是唯一貢獻者,或其可能連續做出了多於' + FriendlyConfig.revertMaxRevisions + '次編輯' ] );
			return;
 
		}
 
		if( count == 0 ) {
			Status.error( '錯誤', "即將回退0個版本,這沒有任何意義,取消操作" );
			return;
		}
 
		var good_revision = revs.snapshotItem( found );
 
		if( 
			self.params.type != 'vand' && 
			count > 1  && 
			!confirm( self.params.user + '做出了' + count + '次編輯,希望一併回退嗎?' ) 
		) {
			Status.info( '提示', '由用戶取消' );
			return;
		}
 
		self.params.count = count;
 
		self.params.goodid = good_revision.getAttribute( 'revid' );
		self.params.gooduser = good_revision.getAttribute( 'user' );
 
 
		self.statelem.status( [ '修訂版本', htmlNode( 'strong', good_revision.getAttribute( 'revid' ) ), '在', htmlNode( 'strong', count ), ' 個版本之前由', htmlNode( 'strong', good_revision.getAttribute( 'user' ), '做出' ) ] );
 
		var query = {
			'action': 'query',
			'prop': 'revisions',
			'titles': wgPageName,
			'rvlimit': 1,
			'rvprop': 'content',
			'rvstartid': good_revision.getAttribute( 'revid' )
		}
 
		var wikipedia_api = new Wikipedia.api( [ '獲取修訂版本', htmlNode( 'strong', good_revision.getAttribute( 'revid' ) ) ], query, friendlyfluff.callbacks.grabbing );
		wikipedia_api.params = self.params;
		wikipedia_api.post();
	},
	grabbing: function( self ) {
 
		xmlDoc = self.responseXML;
 
		self.params.content = xmlDoc.evaluate( '//rev[1]', xmlDoc, null, XPathResult.STRING_TYPE, null ).stringValue;
 
		var query = {
			'title': wgPageName,
			'action': 'submit'
		};
		var wikipedia_wiki = new Wikipedia.wiki( '回退頁面', query, friendlyfluff.callbacks.reverting );
		wikipedia_wiki.params = self.params;
		wikipedia_wiki.get();
	},
	reverting: function( self ) {
		var doc = self.responseXML;
 
		var form = doc.getElementById( 'editform' );
		if( !form ) {
			self.statelem.error( '無法取得"editform"位點,取消操作' );
			return;
		}
 
		var text = self.params.content;
		if( !text ) {
			self.statelem.error( '獲得了0個修訂版本,發生了錯誤,取消操作' );
			return;
		}
 
		var summary;
 
		switch( self.params.type ) {
		case 'agf':
			var extra_summary = prompt( "可選的編輯摘要" );
			if (extra_summary == null)
			{
				self.statelem.error( '由用戶取消' );
				return;
			}
			summary = sprintf( "回退由[[Special:Contributions/%s|%1$s]]於%s做出的[[WP:AGF|善意]]編輯%s%s", 
				self.params.user.replace("\\'", "'"), 
				self.params.revision.getAttribute( 'timestamp' ),
				extra_summary ? "; " + extra_summary.toUpperCaseFirstChar() : '',
				FriendlyConfig.summaryAd
			);
			break;
		case 'vand':
			summary = sprintf( "取消[[Special:Contributions/%s|%1$s]]%d次被視為[[WP:VAND|破壞]]的編輯,更改回[[User:%s|%3$s]]的最後一個版本%s", 
				self.params.user.replace("\\'", "'"),
				self.params.count, 
				self.params.gooduser.replace("\\'", "'"),
				FriendlyConfig.summaryAd
			);
			break;
		case 'norm':
			if( FriendlyConfig.offerReasonOnNormalRevert ) {
				var extra_summary = prompt( "可選的編輯摘要" );
				if (extra_summary == null)
				{
					self.statelem.error( '由用戶取消' );
					return;
				}
			}
			summary = sprintf( "回退[[Special:Contributions/%s|%1$s]]的%d次編輯%s%s", 
				self.params.user.replace("\\'", "'"),
				self.params.count, 
				extra_summary ? "; " + extra_summary.toUpperCaseFirstChar() : '',
				FriendlyConfig.summaryAd 
			);
		}
 
		if( FriendlyConfig.openTalkPage.indexOf( self.params.type ) != -1 ) {
			Status.info( 'Info', [ '打開用戶討論頁', htmlNode( 'strong', self.params.user ) ] );
 
			var query = {
				'title': 'User talk:' + self.params.user,
				'action': 'edit',
				'preview': 'yes',
				'vanarticle': wgPageName.replace(/_/g, ' '),
				'vanarticlerevid': wgCurRevisionId,
				'vanarticlegoodrevid': self.params.goodid,
				'type': self.params.type,
				'count': self.params.count
			}
 
			switch( FriendlyConfig.userTalkPageMode ) {
			case 'tab':
				window.open( mw.config.get('wgServer') + mw.config.get('wgScriptPath') + '/index.php?' + QueryString.create( query ), '_tab' );
				break;
			case 'blank':
				window.open( mw.config.get('wgServer') + mw.config.get('wgScriptPath') + '/index.php?' + QueryString.create( query ), '_blank', 'location=no,toolbar=no,status=no,directories=no,scrollbars=yes,width=1200,height=800' );
				break;
			case 'window':
			default:
				window.open( mw.config.get('wgServer') + mw.config.get('wgScriptPath') + '/index.php?' + QueryString.create( query ), 'friendlywarnwindow', 'location=no,toolbar=no,status=no,directories=no,scrollbars=yes,width=1200,height=800' );
				break;
			}
		}
 
		var postData = {
			'wpMinoredit': FriendlyConfig.markRevertedPagesAsMinor.indexOf( self.params.type ) != -1  ? '' : undefined,
			'wpWatchthis': FriendlyConfig.watchRevertedPages.indexOf( self.params.type ) != -1 ? '' : form.wpWatchthis.checked ? '' : undefined,
			'wpStarttime': form.wpStarttime.value,
			'wpEdittime': form.wpEdittime.value,
			'wpAutoSummary': form.wpAutoSummary.value,
			'wpEditToken': form.wpEditToken.value,
			'wpSection': '',
			'wpSummary': summary,
			'wpTextbox1': text
		};
 
		Wikipedia.actionCompleted.redirect = wgPageName;
		Wikipedia.actionCompleted.notice = "完成"
 
		self.post( postData );
	}
}
 
$( function() {
		if( QueryString.exists( 'friendlyrevert' ) ) {
			friendlyfluff.auto();
		} else {
			friendlyfluff.normal();
		}
	}
);