<commit_before>/* global Morebits */
(function() {
	function main() {
		var summarySuffix = ' via [[User:Xiplus/js/bulletin-editor|bulletin-editor]]';
		var flagStart = '请在此行下方编辑 -->';
		var flagEnd = '<!-- 请在此行上方编辑';

		var api = new mw.Api();
		var date = new Morebits.date();
		var bulletinTitle = 'Template:Bulletin';
		var archiveTitle = 'Wikipedia:公告欄/存檔/' + date.format('YYYY年');

		$('#firstHeading').text('公告欄編輯器');

		$('#be-editor').remove();
		var $wrapper = $('<div>').attr('id', 'be-editor');
		$('#bodyContent').html($wrapper);

		if (mw.config.get('wgUserGroups').indexOf('autoconfirmed') === -1) {
			$wrapper.append(
				$('<div>').addClass('errorbox')
					.append('您沒有權限使用公告欄編輯器。')
			);
			return;
		}

		var params = {
			action: 'query',
			format: 'json',
			prop: 'revisions',
			titles: bulletinTitle,
			rvprop: ['content', 'timestamp'],
			formatversion: '2',
			curtimestamp: true,
		};

		if (mw.config.get('wgPageName') === 'Template:Bulletin' && mw.config.get('wgRevisionId') !== mw.config.get('wgCurRevisionId')) {
			params.rvstartid = mw.config.get('wgRevisionId');

			$wrapper.append(
				$('<div>').addClass('warningbox')
					.append($('<b>').text('警告：'))
					.append('您正在編輯的是本頁的舊版本。如果您保存它的話，在本版本之後的任何修改都會丟失。')
			);
		}

		api.get(params).done(function(data) {
			var revision = data.query.pages[0].revisions[0];
			var basetimestamp = revision.timestamp;
			var curtimestamp = data.curtimestamp;
			var bulletinText = revision.content;
			var idxStart = bulletinText.indexOf(flagStart);
			var idxEnd = bulletinText.indexOf(flagEnd);
			if (idxStart === -1 || idxEnd === -1) {<commit_msg>Fix missing wgRevisionId<commit_after>/* global Morebits */
(function() {
	function main() {
		var summarySuffix = ' via [[User:Xiplus/js/bulletin-editor|bulletin-editor]]';
		var flagStart = '请在此行下方编辑 -->';
		var flagEnd = '<!-- 请在此行上方编辑';

		var api = new mw.Api();
		var date = new Morebits.date();
		var bulletinTitle = 'Template:Bulletin';
		var archiveTitle = 'Wikipedia:公告欄/存檔/' + date.format('YYYY年');

		$('#firstHeading').text('公告欄編輯器');

		$('#be-editor').remove();
		var $wrapper = $('<div>').attr('id', 'be-editor');
		$('#bodyContent').html($wrapper);

		if (mw.config.get('wgUserGroups').indexOf('autoconfirmed') === -1) {
			$wrapper.append(
				$('<div>').addClass('errorbox')
					.append('您沒有權限使用公告欄編輯器。')
			);
			return;
		}

		var params = {
			action: 'query',
			format: 'json',
			prop: 'revisions',
			titles: bulletinTitle,
			rvprop: ['content', 'timestamp'],
			formatversion: '2',
			curtimestamp: true,
		};

		if (mw.config.get('wgPageName') === 'Template:Bulletin'
			&& mw.config.get('wgRevisionId') !== 0
			&& mw.config.get('wgRevisionId') !== mw.config.get('wgCurRevisionId')
		) {
			params.rvstartid = mw.config.get('wgRevisionId');

			$wrapper.append(
				$('<div>').addClass('warningbox')
					.append($('<b>').text('警告：'))
					.append('您正在編輯的是本頁的舊版本。如果您保存它的話，在本版本之後的任何修改都會丟失。')
			);
		}

		api.get(params).done(function(data) {
			var revision = data.query.pages[0].revisions[0];
			var basetimestamp = revision.timestamp;
			var curtimestamp = data.curtimestamp;
			var bulletinText = revision.content;
			var idxStart = bulletinText.indexOf(flagStart);
			var idxEnd = bulletinText.indexOf(flagEnd);
			if (idxStart === -1 || idxEnd === -1) {
{'fraction_non_alphanumeric': 0.2033745103946972, 'fraction_numerical': 0.00391684242241639, 'mean_word_length': 4.07645259938838, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1258274', 'n_tokens_mistral': 1486, 'n_tokens_neox': 1320, 'n_words': 198}