User:逆襲的天邪鬼/Twinkle-lzh/twinklewarn.js: Difference between revisions

m
no edit summary
mNo edit summary
mNo edit summary
Line 87:
 
// This is all the messages that might be dispatched by the code
// Each of the individual templates require the following information:
// label (required): A short description displayed in the dialog
// summary (required): The edit summary used. If an article name is entered, the summary is postfixed with "on [[article]]", and it is always postfixed with ". $summaryAd"
// suppressArticleInSummary (optional): Set to true to suppress showing the article name in the edit summary. Useful if the warning relates to attack pages, or some such.
Twinkle.warn.messages = {
"非建設編輯": {
"uw-vandalism1": "毀文觀(提醒)",
"uw-vandalism2": "毀文觀(警告)",
"uw-vandalism3": "毀文觀(最後警告)",
},
"文法": {
Line 112 ⟶ 108:
"uw-baduserpage": "政治、宗教用戶頁"
},
};
Twinkle.warn.summary = {
"uw-vandalism1": "提醒:毀文觀",
"uw-vandalism2": "警告:毀文觀",
"uw-vandalism3": "最後警告:毀文觀",
"uw-lzh1": "非文言",
"uw-lzh2": "最後警告:非文言",
"uw-lzh-en": "Warning: Not Classical Chinese / 警告:非文言",
"uw-lzh-en-2": "FINAL Warning: Not Classical Chinese / 最後警告:非文言",
"uw-simp": "提醒:莫用簡體字",
"uw-blp": "提醒:生不立傳",
"uw-sign": "提醒:請簽名",
"uw-civil1": "提醒:不文明",
"uw-civil2": "警告:不文明",
"uw-editwar": "警告:編輯戰",
"uw-baduserpage": "提醒:禁止政治、宗教用戶頁"
};
 
Line 175 ⟶ 187:
var text = pageobj.getPageText();
var params = pageobj.getCallbackParameters();
var messageData = params.messageData;
var date = new Date();
 
Line 193 ⟶ 204:
}
 
} else if( !dateHeaderRegexResult || dateHeaderRegexResult.index !== lastHeaderIndex ) {
if( messageData.heading ) {
text += "== " + messageData.heading + " ==\n";
} else if( !dateHeaderRegexResult || dateHeaderRegexResult.index !== lastHeaderIndex ) {
Morebits.status.info( '信息', '未找到當月標題,將建立新的' );
text += "== " + date.getUTCFullYear() + "年" + (date.getUTCMonth() + 1) + "月 " + " ==\n";
Line 210 ⟶ 219:
var summary;
 
summary = messageDataTwinkle.warn.summary[params.sub_group] || '';
if ( messageData.suppressArticleInSummary !== true && params.article ) {
summary += ",於[[" + params.article + "]]";
}
Line 226 ⟶ 235:
Twinkle.warn.callback.evaluate = function twinklewarnCallbackEvaluate(e) {
var userTalkPage = 'User_talk:' + Morebits.wiki.flow.relevantUserName();
 
// Find the selected <option> element so we can fetch the data structure
var selectedEl = $(e.target.sub_group).find('option[value="' + $(e.target.sub_group).val() + '"]');
 
// Then, grab all the values provided by the form
Line 235 ⟶ 241:
sub_group: e.target.sub_group.value,
article: e.target.article.value, // .replace( /^(Image|Category):/i, ':$1:' ), -- apparently no longer needed...
messageData: selectedEl.data("messageData")
};