Difference between revisions 40419 and 40420 on zhwikivoyage

//<nowiki>
// vim: set noet sts=0 sw=8:


(function($){


/*
(contracted; show full)		if( latest.date > date ) {
			if( !confirm( "近1分钟内一个同样的 " + latest.type + " 模板已被发出。\n是否继续?" ) ) {
				pageobj.statelem.info( '用户取消' );
				return;
			}
		}

		var 
hdateHeaderRegexResult = new RegExp( "^==+\\s*" + date.getUTCFullYear() + "年" + (date.getUTCMonth() + 1) + "月" +  
			
			"\\s*==+", 'm' );.exec( text );
		// If dateHeaderRegexResult is null then lastHeaderIndex is never checked. If it is not null but
		// \n== is not found, then the date header must be at the very start of the page. lastIndexOf
		// returns -1 in this case, so lastHeaderIndex gets set to 0 as desired.
		var lastHeaderIndex = text.lastIndexOf( "\n==" ) + 1;   

		if( text.length > 0 ) {
			text += "\n\n";
		}

		if( params.main_group === 'block' ) {
			if( Twinkle.getPref('blankTalkpageOnIndefBlock') && ( messageData.indefinite || (/indef|\*|max/).exec( params.block_timer ) ) ) {
				Morebits.status.info( '信息', '根据参数设置清空讨论页并创建新标题' );
				text = "== " + date.getUTCFullYear() + "年" + (date.getUTCMonth() + 1) + "月 " + " ==\n";
			} else if( !hdateHeaderRe.gexec( text )Result || dateHeaderRegexResult.index !== lastHeaderIndex ) {
				Morebits.status.info( '信息', '未找到当月标题,将创建新的' );
				text += "== " + date.getUTCFullYear() + "年" + (date.getUTCMonth() + 1) + "月 " + " ==\n";
			}

			text += Twinkle.warn.callbacks.getBlockNoticeWikitext(params.sub_group, params.article, params.block_timer, params.reason, messageData.indefinite);
		} else {
			if( !hmessageData.heading ) {
				text += "== " + messageData.heading + " ==\n";
			} else if( !dateHeaderRe.gexec( text )Result || dateHeaderRegexResult.index !== lastHeaderIndex ) {
				Morebits.status.info( '信息', '未找到当月标题,将创建新的' );
				text += "== " + date.getUTCFullYear() + "年" + (date.getUTCMonth() + 1) + "月 " + " ==\n";
			}
			text += Twinkle.warn.callbacks.getWarningWikitext(params.sub_group, params.article, 
				params.reason, params.main_group === 'custom') + "--~~~~";
		}

(contracted; show full)	wikipedia_page.setCallbackParameters( params );
	wikipedia_page.setFollowRedirect( true );
	wikipedia_page.load( Twinkle.warn.callbacks.main );
};
})(jQuery);


//</nowiki>