「MediaWiki:Gadget-friendlytag.js」:修訂間差異

出自竹園Wiki
跳至導覽 跳至搜尋
(已匯入 1 筆修訂:Twinkle)
(繁簡轉換)
 
行 20: 行 20:
if( Morebits.wiki.isPageRedirect() ) {
if( Morebits.wiki.isPageRedirect() ) {
Twinkle.tag.mode = '重定向';
Twinkle.tag.mode = '重定向';
Twinkle.addPortletLink( Twinkle.tag.callback, "标记", "friendly-tag", "标记重定向" );
Twinkle.addPortletLink( Twinkle.tag.callback, "標記", "friendly-tag", "標記重定向" );
}
}
// article/draft tagging
// article/draft tagging
else if( ( ( mw.config.get('wgNamespaceNumber') === 0 || mw.config.get('wgNamespaceNumber') === 118 ) && mw.config.get('wgCurRevisionId') ) || ( Morebits.pageNameNorm === 'Wikipedia:沙盒' ) ) {
else if( ( ( mw.config.get('wgNamespaceNumber') === 0 || mw.config.get('wgNamespaceNumber') === 118 ) && mw.config.get('wgCurRevisionId') ) || ( Morebits.pageNameNorm === 'Wikipedia:沙盒' ) ) {
Twinkle.tag.mode = '目';
Twinkle.tag.mode = '目';
Twinkle.addPortletLink( Twinkle.tag.callback, "标记", "friendly-tag", "标记条目" );
Twinkle.addPortletLink( Twinkle.tag.callback, "標記", "friendly-tag", "標記條目" );
}
}
};
};


Twinkle.tag.callback = function friendlytagCallback( uid ) {
Twinkle.tag.callback = function friendlytagCallback( uid ) {
var Window = new Morebits.simpleWindow( 630, (Twinkle.tag.mode === "目") ? 500 : 400 );
var Window = new Morebits.simpleWindow( 630, (Twinkle.tag.mode === "目") ? 500 : 400 );
Window.setScriptName( "Twinkle" );
Window.setScriptName( "Twinkle" );
// anyone got a good policy/guideline/info page/instructional page link??
// anyone got a good policy/guideline/info page/instructional page link??
Window.addFooterLink( "Twinkle助", "WP:TW/DOC#tag" );
Window.addFooterLink( "Twinkle助", "WP:TW/DOC#tag" );


var form = new Morebits.quickForm( Twinkle.tag.callback.evaluate );
var form = new Morebits.quickForm( Twinkle.tag.callback.evaluate );
行 42: 行 42:
list: [
list: [
{
{
label: '标记页已巡查',
label: '標記頁已巡查',
value: 'patrolPage',
value: 'patrolPage',
name: 'patrolPage',
name: 'patrolPage',
行 52: 行 52:


switch( Twinkle.tag.mode ) {
switch( Twinkle.tag.mode ) {
case '目':
case '目':
Window.setTitle( "维护标记" );
Window.setTitle( "維護標記" );


form.append({
form.append({
行 59: 行 59:
name: 'sortorder',
name: 'sortorder',
label: '察看列表:',
label: '察看列表:',
tooltip: '您可以在Twinkle参数设置(WP:TWPREFS)中更改此。',
tooltip: '您可以在Twinkle參數設置(WP:TWPREFS)中更改此。',
event: Twinkle.tag.updateSortOrder,
event: Twinkle.tag.updateSortOrder,
list: [
list: [
{ type: 'option', value: 'cat', label: '按类别', selected: Twinkle.getFriendlyPref('tagArticleSortOrder') === 'cat' },
{ type: 'option', value: 'cat', label: '按類別', selected: Twinkle.getFriendlyPref('tagArticleSortOrder') === 'cat' },
{ type: 'option', value: 'alpha', label: '按字母', selected: Twinkle.getFriendlyPref('tagArticleSortOrder') === 'alpha' }
{ type: 'option', value: 'alpha', label: '按字母', selected: Twinkle.getFriendlyPref('tagArticleSortOrder') === 'alpha' }
]
]
行 78: 行 78:
list: [
list: [
{
{
label: '如可能,合入{{multiple issues}}',
label: '如可能,合入{{multiple issues}}',
value: 'group',
value: 'group',
name: 'group',
name: 'group',
tooltip: '如果添加{{multiple issues}}支持的三以上的模板,所有支持的模板都被合入{{multiple issues}}模板中。',
tooltip: '如果添加{{multiple issues}}支持的三以上的模板,所有支持的模板都被合入{{multiple issues}}模板中。',
checked: Twinkle.getFriendlyPref('groupByDefault')
checked: Twinkle.getFriendlyPref('groupByDefault')
}
}
行 91: 行 91:


case '重定向':
case '重定向':
Window.setTitle( "重定向标记" );
Window.setTitle( "重定向標記" );


form.append({ type: 'header', label:'常用模板' });
form.append({ type: 'header', label:'常用模板' });
行 99: 行 99:
form.append({ type: 'checkbox', name: 'redirectTags', list: Twinkle.tag.lessFrequentList });
form.append({ type: 'checkbox', name: 'redirectTags', list: Twinkle.tag.lessFrequentList });


form.append({ type: 'header', label:'用模板' });
form.append({ type: 'header', label:'用模板' });
form.append({ type: 'checkbox', name: 'redirectTags', list: Twinkle.tag.rareList });
form.append({ type: 'checkbox', name: 'redirectTags', list: Twinkle.tag.rareList });
break;
break;
行 114: 行 114:
Window.display();
Window.display();


if (Twinkle.tag.mode === "目") {
if (Twinkle.tag.mode === "目") {
// fake a change event on the sort dropdown, to initialize the tag list
// fake a change event on the sort dropdown, to initialize the tag list
var evt = document.createEvent("Event");
var evt = document.createEvent("Event");
行 158: 行 158:
name: 'mergeTarget',
name: 'mergeTarget',
type: 'input',
type: 'input',
label: '其他目:',
label: '其他目:',
tooltip: '如指定多个条目,用管道符分隔:目甲|目乙'
tooltip: '如指定多個條目,用管道符分隔:目甲|目乙'
},
},
{
{
行 166: 行 166:
list: [
list: [
{
{
label: '用{{' + otherTagName + '}}标记其他目',
label: '用{{' + otherTagName + '}}標記其他目',
checked: true,
checked: true,
tooltip: '在只入了一个条目名可用'
tooltip: '在只入了一個條目名可用'
}
}
]
]
行 177: 行 177:
name: 'mergeReason',
name: 'mergeReason',
type: 'textarea',
type: 'textarea',
label: '合理由(上' +
label: '合理由(上' +
(tag === "merge to" ? '其他' : '') + '目的讨论页):',
(tag === "merge to" ? '其他' : '') + '目的討論頁):',
tooltip: '可,但烈推。如不需要留空。在只入了一个条目名可用。'
tooltip: '可,但烈推。如不需要留空。在只入了一個條目名可用。'
});
});
}
}
行 188: 行 188:
type: 'select',
type: 'select',
list: [
list: [
{ label: "{{notability}}:通用的注度指引", value: "none" },
{ label: "{{notability}}:通用的注度指引", value: "none" },
{ label: "{{notability|Biographies}}:人物传记", value: "Biographies" },
{ label: "{{notability|Biographies}}:人物傳記", value: "Biographies" },
{ label: "{{notability|Book}}:籍", value: "Book" },
{ label: "{{notability|Book}}:籍", value: "Book" },
{ label: "{{notability|Number}}:字", value: "Number" },
{ label: "{{notability|Number}}:字", value: "Number" },
{ label: "{{notability|Fiction}}:虚构事物", value: "Fiction" },
{ label: "{{notability|Fiction}}:虛構事物", value: "Fiction" },
{ label: "{{notability|Neologisms}}:明、研究", value: "Neologisms" },
{ label: "{{notability|Neologisms}}:明、研究", value: "Neologisms" },
{ label: "{{notability|Web}}:站、网络内容", value: "Web"}
{ label: "{{notability|Web}}:站、網絡內容", value: "Web"}
]
]
};
};
行 250: 行 250:
// append any custom tags
// append any custom tags
if (Twinkle.getFriendlyPref('customTagList').length) {
if (Twinkle.getFriendlyPref('customTagList').length) {
container.append({ type: 'header', label: '自定模板' });
container.append({ type: 'header', label: '自定模板' });
container.append({ type: 'checkbox', name: 'articleTags', list: Twinkle.getFriendlyPref('customTagList') });
container.append({ type: 'checkbox', name: 'articleTags', list: Twinkle.getFriendlyPref('customTagList') });
}
}
行 284: 行 284:


Twinkle.tag.article.tags = {
Twinkle.tag.article.tags = {
"advert": "广告或宣容",
"advert": "告或宣容",
"autobiography": "似一篇自,或容主要由目描述的事人或组织编辑",
"autobiography": "似一篇自,或容主要由目描述的事人或組織編輯",
"blpdispute": "可能反了维基百科关于生者传记的方",
"blpdispute": "可能反了竹園Wiki關於生者傳記的方",
"blpsources": "生者传记需要充更多可供查源",
"blpsources": "生者傳記需要充更多可供查源",
"blpunsourced": "生者传记没有列出任何考或源",
"blpunsourced": "生者傳記沒有列出任何考或源",
"catimprove": "需要更多面分",
"catimprove": "需要更多面分",
"citation style": "引用需要行清理",
"citation style": "引用需要行清理",
"citecheck": "可能包含不用或被曲解的引用料,部分容的准确法被证实",
"citecheck": "可能包含不用或被曲解的引用料,部分容的準確法被證實",
"cleanup": "可能需要行清理,以符合维基百科标准",
"cleanup": "可能需要行清理,以符合竹園Wiki標準",
"cleanup-jargon": "包含多行专业术语,可能需要化或提出一步解",
"cleanup-jargon": "包含多行專業術語,可能需要化或提出一步解",
"coi": "主要贡献目所宣容可能存在利益突",
"coi": "主要貢獻目所宣容可能存在利益突",
"copypaste": "容可能是个来贝后贴上",
"copypaste": "容可能是個來貝後貼上",
"contradict": "容自相矛盾",
"contradict": "容自相矛盾",
"copyedit": "需要修,以保文法、用语气、格式、标点等使用恰",
"copyedit": "需要修,以保文法、用語氣、格式、標點等使用恰",
"dead end": "需要更多接以构筑百科全网络",
"dead end": "需要更多接以構築百科全網絡",
"disputed": "容疑欠准确,有待查",
"disputed": "容疑欠準確,有待查",
"expand": "需要充",
"expand": "需要充",
"expert": "需要精通或熟悉本主专业人士参与编辑",
"expert": "需要精通或熟悉本主專業人士參與編輯",
"external links": "使用外部接的方式可能不符合维基百科的方或指引",
"external links": "使用外部接的方式可能不符合竹園Wiki的方或指引",
"fansite": "好者网页",
"fansite": "好者網頁",
"globalize": "具有一部分地的信息或观点",
"globalize": "具有一部分地的信息或觀點",
"hoax": "真性被疑",
"hoax": "真性被疑",
"howto": "包含指南或教学内容",
"howto": "包含指南或教學內容",
"in-universe": "使用小故事观点描述一个虚构事物",
"in-universe": "使用小故事觀點描述一個虛構事物",
"inappropriate person": "使用不适当的第一人和第二人",
"inappropriate person": "使用不適當的第一人和第二人",
"inappropriate tone": "语调格可能不合百科全作方式",
"inappropriate tone": "語調格可能不合百科全作方式",
"lead section": "言部分也不足以概括其容",
"lead section": "言部分也不足以概括其容",
"lead section too long": "言部分也许过于",
"lead section too long": "言部分也許過於",
"merge": "建与页面合",
"merge": "建與頁面合",
"merge from": "建议将页入本面",
"merge from": "建議將頁入本面",
"merge to": "建议将面",
"merge to": "建議將面",
"newsrelease": "阅读像是新稿及包含度的宣语调",
"newsrelease": "閱讀像是新稿及包含度的宣語調",
"no footnotes": "因为没文引用而源仍然不明",
"no footnotes": "因爲沒文引用而源仍然不明",
"non-free": "可能多或不地使用了受版的文字、像或/及多媒文件",
"non-free": "可能多或不地使用了受版的文字、像或/及多媒文件",
"notability": "可能不符合通用注度指引",
"notability": "可能不符合通用注度指引",
"notmandarin": "包含多不是标准汉语容",
"notmandarin": "包含多不是標準漢語容",
"onesource": "大或完全地依赖于个单一的源",
"onesource": "大或完全地依賴於個單一的源",
"original research": "可能包含原研究或未查证内容",
"original research": "可能包含原研究或未查證內容",
"orphan": "有或只有很少面",
"orphan": "有或只有很少面",
"overlinked": "含有多、重、或不必要的接",
"overlinked": "含有多、重、或不必要的接",
"overly detailed": "包含太多细节内容",
"overly detailed": "包含太多細節內容",
"plot": "可能包含过于详细情摘要",
"plot": "可能包含過於詳細情摘要",
"pov": "中立性有争议容、语调可能有明观点或地方色彩",
"pov": "中立性有爭議容、語調可能有明觀點或地方色彩",
"primarysources": "依第一手源",
"primarysources": "依第一手源",
"prose": "使用了日期或时间列表式述,需要改写为连贯述性文字",
"prose": "使用了日期或時間列表式述,需要改寫爲連貫述性文字",
"refimprove": "需要充更多源",
"refimprove": "需要充更多源",
"review": "阅读来类评论,需要清理",
"review": "閱讀來類評論,需要清理",
"rewrite": "不符合维基百科标准,需要完全重",
"rewrite": "不符合竹園Wiki標準,需要完全重",
"roughtranslation": "翻不佳",
"roughtranslation": "翻不佳",
"substub": "过于短小",
"substub": "過於短小",
"trivia": "避免有杂项料的部分",
"trivia": "避免有雜項料的部分",
"uncategorized": "缺少面分",
"uncategorized": "缺少面分",
"unencyclopedic": "可能不入百科全",
"unencyclopedic": "可能不入百科全",
"unreferenced": "有列出任何考或源",
"unreferenced": "有列出任何考或源",
"update": "目或章需要更新",
"update": "目或章需要更新",
"verylong": "可能过于",
"verylong": "可能過於",
"weasel": "意模棱可而及其中立性或准确性"
"weasel": "意模棱可而及其中立性或準確性"
};
};


行 348: 行 348:


Twinkle.tag.article.tagCategories = {
Twinkle.tag.article.tagCategories = {
"清理和维护模板": {
"清理和維護模板": {
"常清理": [
"常清理": [
"cleanup",
"cleanup",
"cleanup-jargon",
"cleanup-jargon",
"copyedit"
"copyedit"
],
],
"可能多余的容": [
"可能多余的容": [
"copypaste",
"copypaste",
"external links",
"external links",
"non-free"
"non-free"
],
],
"结构言": [
"結構言": [
"lead section",
"lead section",
"lead section too long",
"lead section too long",
"verylong"
"verylong"
],
],
"虚构作品相清理": [
"虛構作品相清理": [
"in-universe",
"in-universe",
"plot"
"plot"
]
]
},
},
"常规条问题": {
"常規條問題": {
"重要性和知名度": [
"重要性和知名度": [
"notability" // has subcategories and special-cased code
"notability" // has subcategories and special-cased code
],
],
"格": [
"格": [
"advert",
"advert",
"fansite",
"fansite",
行 383: 行 383:
"review"
"review"
],
],
"容": [
"容": [
"expand",
"expand",
"substub",
"substub",
"unencyclopedic"
"unencyclopedic"
],
],
"信息和细节": [
"信息和細節": [
"expert",
"expert",
"overly detailed",
"overly detailed",
"trivia"
"trivia"
],
],
"时间性": [
"時間性": [
"update"
"update"
],
],
"中立、偏和事实准确性": [
"中立、偏和事實準確性": [
"autobiography",
"autobiography",
"coi",
"coi",
行 406: 行 406:
"weasel"
"weasel"
],
],
"可供查源": [
"可供查源": [
"blpdispute",
"blpdispute",
"blpsources",
"blpsources",
行 419: 行 419:
]
]
},
},
"具体内问题": {
"具體內問題": {
"言": [
"言": [
"notmandarin",
"notmandarin",
"roughtranslation"
"roughtranslation"
],
],
"接": [
"接": [
"dead end",
"dead end",
"orphan",
"orphan",
"overlinked"
"overlinked"
],
],
"考技": [
"考技": [
"citation style"
"citation style"
],
],
"分": [
"分": [
"catimprove",
"catimprove",
"uncategorized"
"uncategorized"
]
]
},
},
"合": [ // these three have a subgroup with several options
"合": [ // these three have a subgroup with several options
"merge",
"merge",
"merge from",
"merge from",
行 448: 行 448:
Twinkle.tag.frequentList = [
Twinkle.tag.frequentList = [
{
{
label: '{{合重定向}}:保持名至相目,令容在合并后仍能保存其编辑历史',
label: '{{合重定向}}:保持名至相目,令容在合併後仍能保存其編輯曆史',
value: '合重定向'
value: '合重定向'
},
},
{
{
label: '{{繁重定向}}:引导简体至繁,或繁简体',
label: '{{繁重定向}}:引導簡體至繁,或繁簡體',
value: '繁重定向'
value: '繁重定向'
},
},
{
{
label: '{{模板重定向}}:指向模板的重定向面',
label: '{{模板重定向}}:指向模板的重定向面',
value: '模板重定向'
value: '模板重定向'
},
},
{
{
label: '{{名重定向}}:标题的其他名名、绰号、同字等',
label: '{{名重定向}}:標題的其他名名、綽號、同字等',
value: '名重定向'
value: '名重定向'
},
},
{
{
label: '{{名重定向}}:人物、作品等各事物的其他翻',
label: '{{名重定向}}:人物、作品等各事物的其他翻',
value: '名重定向'
value: '名重定向'
},
},
{
{
label: '{{缩写重定向}}:标题缩写',
label: '{{縮寫重定向}}:標題縮寫',
value: '缩写重定向'
value: '縮寫重定向'
},
},
{
{
label: '{{拼重定向}}:标题的其他不同拼',
label: '{{拼重定向}}:標題的其他不同拼',
value: '拼重定向'
value: '拼重定向'
},
},
{
{
label: '{{字重定向}}:标题的常见错误植',
label: '{{字重定向}}:標題的常見錯誤植',
value: '字重定向'
value: '字重定向'
},
},
{
{
label: '{{名重定向}}:事物早前的名至更改的主',
label: '{{名重定向}}:事物早前的名至更改的主',
value: '名重定向'
value: '名重定向'
},
},
{
{
label: '{{史名重定向}}:具有史意名、名、同义词',
label: '{{史名重定向}}:具有史意名、名、同義詞',
value: '史名重定向'
value: '史名重定向'
},
},
{
{
label: '{{全名重定向}}:标题的完整或更完整名',
label: '{{全名重定向}}:標題的完整或更完整名',
value: '全名重定向'
value: '全名重定向'
},
},
{
{
label: '{{短名重定向}}:完整标题或人物全名的部分、不完整的名简称',
label: '{{短名重定向}}:完整標題或人物全名的部分、不完整的名簡稱',
value: '短名重定向'
value: '短名重定向'
},
},
行 508: 行 508:
},
},
{
{
label: '{{非中文重定向}}:非中文标题',
label: '{{非中文重定向}}:非中文標題',
value: '非中文重定向'
value: '非中文重定向'
},
},
{
{
label: '{{日文重定向}}:日',
label: '{{日文重定向}}:日',
value: '日文重定向'
value: '日文重定向'
}
}
行 519: 行 519:
Twinkle.tag.lessFrequentList = [
Twinkle.tag.lessFrequentList = [
{
{
label: '{{角色重定向}}:电视剧影、籍等作品的角色',
label: '{{角色重定向}}:電視劇影、籍等作品的角色',
value: '角色重定向'
value: '角色重定向'
},
},
{
{
label: '{{章重定向}}:向至高密度组织面',
label: '{{章重定向}}:向至高密度組織面',
value: '章重定向'
value: '章重定向'
},
},
{
{
label: '{{列表重定向}}:向至低密度的列表',
label: '{{列表重定向}}:向至低密度的列表',
value: '列表重定向'
value: '列表重定向'
},
},
{
{
label: '{{可能性重定向}}:向至前提供容更为详尽的目标页面',
label: '{{可能性重定向}}:向至前提供容更爲詳盡的目標頁面',
value: '可能性重定向'
value: '可能性重定向'
},
},
{
{
label: '{{关联字重定向}}:标题称关联字',
label: '{{關聯字重定向}}:標題稱關聯字',
value: '关联字重定向'
value: '關聯字重定向'
},
},
{
{
label: '{{求重定向}}:需要目的面',
label: '{{求重定向}}:需要目的面',
value: '求重定向'
value: '求重定向'
},
},
{
{
label: '{{快捷方式重定向}}:维基百科快捷方式',
label: '{{快捷方式重定向}}:竹園Wiki快捷方式',
value: '快捷方式重定向'
value: '快捷方式重定向'
}
}
行 550: 行 550:
Twinkle.tag.rareList = [
Twinkle.tag.rareList = [
{
{
label: '{{词组重定向}}:将词组/词组/成指向切目及恰',
label: '{{詞組重定向}}:將詞組/詞組/成指向切目及恰',
value: '词组重定向'
value: '詞組重定向'
},
},
{
{
label: '{{消歧义页重定向}}:指向消歧义页',
label: '{{消歧義頁重定向}}:指向消歧義頁',
value: '消歧义页重定向'
value: '消歧義頁重定向'
},
},
{
{
label: '{{域名重定向}}:域名',
label: '{{域名重定向}}:域名',
value: '域名重定向'
value: '域名重定向'
},
},
{
{
label: '{{年代重定向}}:年份向至年代目',
label: '{{年代重定向}}:年份向至年代目',
value: '年代重定向'
value: '年代重定向'
},
},
{
{
label: '{{用框模板重定向}}:用框模板',
label: '{{用框模板重定向}}:用框模板',
value: '用框模板重定向'
value: '用框模板重定向'
},
},
{
{
label: '{{重定向模板用重定向}}:向至重定向模板',
label: '{{重定向模板用重定向}}:向至重定向模板',
value: '重定向模板用重定向'
value: '重定向模板用重定向'
},
},
{
{
label: '{{EXIF重定向}}:JPEG像包含EXIF信息',
label: '{{EXIF重定向}}:JPEG像包含EXIF信息',
value: 'EXIF重定向'
value: 'EXIF重定向'
}
}
行 632: 行 632:
// nonDiscussArticle is the article which won't have the discussion
// nonDiscussArticle is the article which won't have the discussion
params.nonDiscussArticle = (tagName === "merge to" ? mw.config.get('wgTitle') : params.mergeTarget);
params.nonDiscussArticle = (tagName === "merge to" ? mw.config.get('wgTitle') : params.mergeTarget);
params.talkDiscussionTitle = '' + params.nonDiscussArticle + '合';
params.talkDiscussionTitle = '' + params.nonDiscussArticle + '合';
}
}
currentTag += '|discuss=Talk:' + params.discussArticle + '#' + params.talkDiscussionTitle;
currentTag += '|discuss=Talk:' + params.discussArticle + '#' + params.talkDiscussionTitle;
行 665: 行 665:
if( !tagRe.exec( pageText ) ) {
if( !tagRe.exec( pageText ) ) {
if( params.tags[i] == 'notability' ) {
if( params.tags[i] == 'notability' ) {
wikipedia_page = new Morebits.wiki.page("Wikipedia:注度/提", "添加注度记录项");
wikipedia_page = new Morebits.wiki.page("Wikipedia:注度/提", "添加注度記錄項");
wikipedia_page.setFollowRedirect(true);
wikipedia_page.setFollowRedirect(true);
wikipedia_page.setCallbackParameters(params);
wikipedia_page.setCallbackParameters(params);
行 676: 行 676:
}
}
} else {
} else {
Morebits.status.warn( '信息', '在面上找到{{' + params.tags[i] +
Morebits.status.warn( '信息', '在面上找到{{' + params.tags[i] +
'}}…跳' );
'}}…跳' );
// don't do anything else with merge tags
// don't do anything else with merge tags
if (params.tags[i] === "merge" || params.tags[i] === "merge from" ||
if (params.tags[i] === "merge" || params.tags[i] === "merge from" ||
行 691: 行 691:


if( ( miTest || miOldStyleTest ) && groupableTags.length > 0 ) {
if( ( miTest || miOldStyleTest ) && groupableTags.length > 0 ) {
Morebits.status.info( '信息', '添加支持的标记入已存在的{{multiple issues}}' );
Morebits.status.info( '信息', '添加支持的標記入已存在的{{multiple issues}}' );


groupableTags.sort();
groupableTags.sort();
行 699: 行 699:
$.each(groupableTags, addTag);
$.each(groupableTags, addTag);


summaryText += '标记' + '(在{{[[T:multiple issues|multiple issues]]}})';
summaryText += '標記' + '(在{{[[T:multiple issues|multiple issues]]}})';
if( tags.length > 0 ) {
if( tags.length > 0 ) {
summaryText += '和';
summaryText += '和';
行 717: 行 717:
tagText = "";
tagText = "";
} else if( params.group && groupableTags.length >= 3 ) {
} else if( params.group && groupableTags.length >= 3 ) {
Morebits.status.info( '信息', '合支持的模板入{{multiple issues}}' );
Morebits.status.info( '信息', '合支持的模板入{{multiple issues}}' );


groupableTags.sort();
groupableTags.sort();
行 725: 行 725:
$.each(groupableTags, addTag);
$.each(groupableTags, addTag);


summaryText += '等标记({{[[T:multiple issues|multiple issues]]}})';
summaryText += '等標記({{[[T:multiple issues|multiple issues]]}})';
if( tags.length > 0 ) {
if( tags.length > 0 ) {
summaryText += '及';
summaryText += '及';
行 741: 行 741:
} else {
} else {
Morebits.status.warn( '信息', '在重定向上找到{{' + params.tags[i] +
Morebits.status.warn( '信息', '在重定向上找到{{' + params.tags[i] +
'}}…跳' );
'}}…跳' );
}
}
}
}
行 759: 行 759:
"$1" + tagText);
"$1" + tagText);
}
}
summaryText += ( tags.length > 0 ? '标记' : '' ) +
summaryText += ( tags.length > 0 ? '標記' : '' ) +
'到' + Twinkle.tag.mode;
'到' + Twinkle.tag.mode;


行 776: 行 776:
if (params.mergeReason) {
if (params.mergeReason) {
// post the rationale on the talk page (only operates in main namespace)
// post the rationale on the talk page (only operates in main namespace)
var talkpageText = "\n\n== [[" + params.nonDiscussArticle + "]]合 ==\n\n";
var talkpageText = "\n\n== [[" + params.nonDiscussArticle + "]]合 ==\n\n";
talkpageText += params.mergeReason.trim() + "--~~~~";
talkpageText += params.mergeReason.trim() + "--~~~~";


var talkpage = new Morebits.wiki.page("Talk:" + params.discussArticle, "理由贴进讨论页");
var talkpage = new Morebits.wiki.page("Talk:" + params.discussArticle, "理由貼進討論頁");
talkpage.setAppendText(talkpageText);
talkpage.setAppendText(talkpageText);
talkpage.setEditSummary('[[' + params.nonDiscussArticle + ']]' +
talkpage.setEditSummary('[[' + params.nonDiscussArticle + ']]' +
'' + '[[' + params.discussArticle + ']]合' +
'' + '[[' + params.discussArticle + ']]合' +
Twinkle.getPref('summaryAd'));
Twinkle.getPref('summaryAd'));
talkpage.setWatchlist(Twinkle.getFriendlyPref('watchMergeDiscussions'));
talkpage.setWatchlist(Twinkle.getFriendlyPref('watchMergeDiscussions'));
行 802: 行 802:
talkDiscussionTitle: params.talkDiscussionTitle
talkDiscussionTitle: params.talkDiscussionTitle
};
};
var otherpage = new Morebits.wiki.page(params.mergeTarget, "标记其他面(" +
var otherpage = new Morebits.wiki.page(params.mergeTarget, "標記其他面(" +
params.mergeTarget + ")");
params.mergeTarget + ")");
otherpage.setCallbackParameters(newParams);
otherpage.setCallbackParameters(newParams);
行 818: 行 818:
var params = pageobj.getCallbackParameters();
var params = pageobj.getCallbackParameters();


pageobj.setAppendText("\n{{subst:Wikipedia:注度/提/item|title=" + Morebits.pageNameNorm + "}}");
pageobj.setAppendText("\n{{subst:Wikipedia:注度/提/item|title=" + Morebits.pageNameNorm + "}}");
pageobj.setEditSummary("添加[[" + Morebits.pageNameNorm + "]]" + Twinkle.getPref('summaryAd'));
pageobj.setEditSummary("添加[[" + Morebits.pageNameNorm + "]]" + Twinkle.getPref('summaryAd'));
pageobj.setCreateOption('recreate');
pageobj.setCreateOption('recreate');
行 833: 行 833:


switch (Twinkle.tag.mode) {
switch (Twinkle.tag.mode) {
case '目':
case '目':
params.tags = form.getChecked( 'articleTags' );
params.tags = form.getChecked( 'articleTags' );
params.group = form.group.checked;
params.group = form.group.checked;
行 854: 行 854:
// form validation
// form validation
if( !params.tags.length ) {
if( !params.tags.length ) {
alert( '必须选择至少一个标记!' );
alert( '必須選擇至少一個標記!' );
return;
return;
}
}
if( ((params.tags.indexOf("merge") !== -1) + (params.tags.indexOf("merge from") !== -1) +
if( ((params.tags.indexOf("merge") !== -1) + (params.tags.indexOf("merge from") !== -1) +
(params.tags.indexOf("merge to") !== -1)) > 1 ) {
(params.tags.indexOf("merge to") !== -1)) > 1 ) {
alert( '在{{merge}}、{{merge from}}和{{merge to}}中选择。如果需要多次合使用{{merge}}用管道符分隔目名(但在这种情形中Twinkle不能自动标记其他目)。' );
alert( '在{{merge}}、{{merge from}}和{{merge to}}中選擇。如果需要多次合使用{{merge}}用管道符分隔目名(但在這種情形中Twinkle不能自動標記其他目)。' );
return;
return;
}
}
if( (params.mergeTagOther || params.mergeReason) && params.mergeTarget.indexOf('|') !== -1 ) {
if( (params.mergeTagOther || params.mergeReason) && params.mergeTarget.indexOf('|') !== -1 ) {
alert( '目前不支持在一次合标记个条目,与开启关于个条目的讨论不要勾标记其他目”和/或清理“理由”框,。' );
alert( '目前不支持在一次合標記個條目,與開啓關於個條目的討論不要勾標記其他目”和/或清理“理由”框,。' );
return;
return;
}
}
行 871: 行 871:


Morebits.wiki.actionCompleted.redirect = Morebits.pageNameNorm;
Morebits.wiki.actionCompleted.redirect = Morebits.pageNameNorm;
Morebits.wiki.actionCompleted.notice = "标记完成,在刷新面";
Morebits.wiki.actionCompleted.notice = "標記完成,在刷新面";
if (Twinkle.tag.mode === '重定向') {
if (Twinkle.tag.mode === '重定向') {
Morebits.wiki.actionCompleted.followRedirect = false;
Morebits.wiki.actionCompleted.followRedirect = false;
}
}


var wikipedia_page = new Morebits.wiki.page(Morebits.pageNameNorm, "正在标记" + Twinkle.tag.mode);
var wikipedia_page = new Morebits.wiki.page(Morebits.pageNameNorm, "正在標記" + Twinkle.tag.mode);
wikipedia_page.setCallbackParameters(params);
wikipedia_page.setCallbackParameters(params);
switch (Twinkle.tag.mode) {
switch (Twinkle.tag.mode) {
case '目':
case '目':
/* falls through */
/* falls through */
case '重定向':
case '重定向':

於 2016年4月10日 (日) 15:02 的最新修訂

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


(function($){


/*
 ****************************************
 *** friendlytag.js: Tag module
 ****************************************
 * Mode of invocation:     Tab ("Tag")
 * Active on:              Existing articles;
 *                         all redirects
 * Config directives in:   FriendlyConfig
 */

Twinkle.tag = function friendlytag() {
	// redirect tagging
	if( Morebits.wiki.isPageRedirect() ) {
		Twinkle.tag.mode = '重定向';
		Twinkle.addPortletLink( Twinkle.tag.callback, "標記", "friendly-tag", "標記重定向" );
	}
	// article/draft tagging
	else if( ( ( mw.config.get('wgNamespaceNumber') === 0 || mw.config.get('wgNamespaceNumber') === 118 ) && mw.config.get('wgCurRevisionId') ) || ( Morebits.pageNameNorm === 'Wikipedia:沙盒' ) ) {
		Twinkle.tag.mode = '條目';
		Twinkle.addPortletLink( Twinkle.tag.callback, "標記", "friendly-tag", "標記條目" );
	}
};

Twinkle.tag.callback = function friendlytagCallback( uid ) {
	var Window = new Morebits.simpleWindow( 630, (Twinkle.tag.mode === "條目") ? 500 : 400 );
	Window.setScriptName( "Twinkle" );
	// anyone got a good policy/guideline/info page/instructional page link??
	Window.addFooterLink( "Twinkle幫助", "WP:TW/DOC#tag" );

	var form = new Morebits.quickForm( Twinkle.tag.callback.evaluate );

	if (document.getElementsByClassName("patrollink").length) {
		form.append( {
			type: 'checkbox',
			list: [
				{
					label: '標記頁面爲已巡查',
					value: 'patrolPage',
					name: 'patrolPage',
					checked: Twinkle.getFriendlyPref('markTaggedPagesAsPatrolled')
				}
			]
		} );
	}

	switch( Twinkle.tag.mode ) {
		case '條目':
			Window.setTitle( "條目維護標記" );

			form.append({
				type: 'select',
				name: 'sortorder',
				label: '察看列表:',
				tooltip: '您可以在Twinkle參數設置(WP:TWPREFS)中更改此項。',
				event: Twinkle.tag.updateSortOrder,
				list: [
					{ type: 'option', value: 'cat', label: '按類別', selected: Twinkle.getFriendlyPref('tagArticleSortOrder') === 'cat' },
					{ type: 'option', value: 'alpha', label: '按字母', selected: Twinkle.getFriendlyPref('tagArticleSortOrder') === 'alpha' }
				]
			});

			form.append({
				type: 'div',
				id: 'tagWorkArea',
				className: 'morebits-scrollbox',
				style: 'max-height: 28em'
			});

			form.append( {
					type: 'checkbox',
					list: [
						{
							label: '如可能,合併入{{multiple issues}}',
							value: 'group',
							name: 'group',
							tooltip: '如果添加{{multiple issues}}支持的三個以上的模板,所有支持的模板都會被合併入{{multiple issues}}模板中。',
							checked: Twinkle.getFriendlyPref('groupByDefault')
						}
					]
				}
			);

			break;

		case '重定向':
			Window.setTitle( "重定向標記" );

			form.append({ type: 'header', label:'常用模板' });
			form.append({ type: 'checkbox', name: 'redirectTags', list: Twinkle.tag.frequentList });

			form.append({ type: 'header', label:'偶用模板' });
			form.append({ type: 'checkbox', name: 'redirectTags', list: Twinkle.tag.lessFrequentList });

			form.append({ type: 'header', label:'鮮用模板' });
			form.append({ type: 'checkbox', name: 'redirectTags', list: Twinkle.tag.rareList });
			break;

		default:
			alert("Twinkle.tag:未知模式 " + Twinkle.tag.mode);
			break;
	}

	form.append( { type:'submit' } );

	var result = form.render();
	Window.setContent( result );
	Window.display();

	if (Twinkle.tag.mode === "條目") {
		// fake a change event on the sort dropdown, to initialize the tag list
		var evt = document.createEvent("Event");
		evt.initEvent("change", true, true);
		result.sortorder.dispatchEvent(evt);
	}
};

Twinkle.tag.checkedTags = [];

Twinkle.tag.updateSortOrder = function(e) {
	var sortorder = e.target.value;

	Twinkle.tag.checkedTags = e.target.form.getChecked("articleTags");
	if (!Twinkle.tag.checkedTags) {
		Twinkle.tag.checkedTags = [];
	}

	var container = new Morebits.quickForm.element({ type: "fragment" });

	// function to generate a checkbox, with appropriate subgroup if needed
	var makeCheckbox = function(tag, description) {
		var checkbox = { value: tag, label: "{{" + tag + "}}: " + description };
		if (Twinkle.tag.checkedTags.indexOf(tag) !== -1) {
			checkbox.checked = true;
		}
		switch (tag) {
			case "merge":
			case "merge from":
			case "merge to":
				var otherTagName = "merge";
				switch (tag)
				{
					case "merge from":
						otherTagName = "merge to";
						break;
					case "merge to":
						otherTagName = "merge from";
						break;
				}
				checkbox.subgroup = [
					{
						name: 'mergeTarget',
						type: 'input',
						label: '其他條目:',
						tooltip: '如指定多個條目,請用管道符分隔:條目甲|條目乙'
					},
					{
						name: 'mergeTagOther',
						type: 'checkbox',
						list: [
							{
								label: '用{{' + otherTagName + '}}標記其他條目',
								checked: true,
								tooltip: '僅在只輸入了一個條目名時可用'
							}
						]
					}
				];
				if (mw.config.get('wgNamespaceNumber') === 0) {
					checkbox.subgroup.push({
						name: 'mergeReason',
						type: 'textarea',
						label: '合併理由(會被貼上' +
							(tag === "merge to" ? '其他' : '這') + '條目的討論頁):',
						tooltip: '可選,但強烈推薦。如不需要請留空。僅在只輸入了一個條目名時可用。'
					});
				}
				break;
			case "notability":
				checkbox.subgroup = {
					name: 'notability',
					type: 'select',
					list: [
						{ label: "{{notability}}:通用的關注度指引", value: "none" },
						{ label: "{{notability|Biographies}}:人物傳記", value: "Biographies" },
						{ label: "{{notability|Book}}:書籍", value: "Book" },
						{ label: "{{notability|Number}}:數字", value: "Number" },
						{ label: "{{notability|Fiction}}:虛構事物", value: "Fiction" },
						{ label: "{{notability|Neologisms}}:發明、研究", value: "Neologisms" },
						{ label: "{{notability|Web}}:網站、網絡內容", value: "Web"}
					]
				};
				break;
			default:
				break;
		}
		return checkbox;
	};

	// categorical sort order
	if (sortorder === "cat") {
		// function to iterate through the tags and create a checkbox for each one
		var doCategoryCheckboxes = function(subdiv, array) {
			var checkboxes = [];
			$.each(array, function(k, tag) {
				var description = Twinkle.tag.article.tags[tag];
				checkboxes.push(makeCheckbox(tag, description));
			});
			subdiv.append({
				type: "checkbox",
				name: "articleTags",
				list: checkboxes
			});
		};

		var i = 0;
		// go through each category and sub-category and append lists of checkboxes
		$.each(Twinkle.tag.article.tagCategories, function(title, content) {
			container.append({ type: "header", id: "tagHeader" + i, label: title });
			var subdiv = container.append({ type: "div", id: "tagSubdiv" + i++ });
			if ($.isArray(content)) {
				doCategoryCheckboxes(subdiv, content);
			} else {
				$.each(content, function(subtitle, subcontent) {
					subdiv.append({ type: "div", label: [ Morebits.htmlNode("b", subtitle) ] });
					doCategoryCheckboxes(subdiv, subcontent);
				});
			}
		});
	}
	// alphabetical sort order
	else {
		var checkboxes = [];
		$.each(Twinkle.tag.article.tags, function(tag, description) {
			checkboxes.push(makeCheckbox(tag, description));
		});
		container.append({
			type: "checkbox",
			name: "articleTags",
			list: checkboxes
		});
	}

	// append any custom tags
	if (Twinkle.getFriendlyPref('customTagList').length) {
		container.append({ type: 'header', label: '自定義模板' });
		container.append({ type: 'checkbox', name: 'articleTags', list: Twinkle.getFriendlyPref('customTagList') });
	}

	var $workarea = $(e.target.form).find("div#tagWorkArea");
	var rendered = container.render();
	$workarea.empty().append(rendered);

	// style adjustments
	$workarea.find("h5").css({ 'font-size': '110%' });
	$workarea.find("h5:not(:first-child)").css({ 'margin-top': '1em' });
	$workarea.find("div").filter(":has(span.quickformDescription)").css({ 'margin-top': '0.4em' });

	// add a link to each template's description page
	$.each(Morebits.quickForm.getElements(e.target.form, "articleTags"), function(index, checkbox) {
		var $checkbox = $(checkbox);
		var link = Morebits.htmlNode("a", ">");
		link.setAttribute("class", "tag-template-link");
		link.setAttribute("href", mw.util.getUrl("Template:" +
			Morebits.string.toUpperCaseFirstChar(checkbox.values)));
		link.setAttribute("target", "_blank");
		$checkbox.parent().append(["\u00A0", link]);
	});
};


// Tags for ARTICLES start here

Twinkle.tag.article = {};

// A list of all article tags, in alphabetical order
// To ensure tags appear in the default "categorized" view, add them to the tagCategories hash below.

Twinkle.tag.article.tags = {
	"advert": "類似廣告或宣傳性內容",
	"autobiography": "類似一篇自傳,或內容主要由條目描述的當事人或組織撰寫、編輯",
	"blpdispute": "可能違反了竹園Wiki關於生者傳記的方針",
	"blpsources": "生者傳記需要補充更多可供查證的來源",
	"blpunsourced": "生者傳記沒有列出任何參考或來源",
	"catimprove": "需要更多頁面分類",
	"citation style": "引用需要進行清理",
	"citecheck": "可能包含不適用或被曲解的引用資料,部分內容的準確性無法被證實",
	"cleanup": "可能需要進行清理,以符合竹園Wiki的質量標準",
	"cleanup-jargon": "包含過多行話或專業術語,可能需要簡化或提出進一步解釋",
	"coi": "主要貢獻者與本條目所宣揚的內容可能存在利益沖突",
	"copypaste": "內容可能是從某個來源處拷貝後貼上",
	"contradict": "內容自相矛盾",
	"copyedit": "需要編修,以確保文法、用詞、語氣、格式、標點等使用恰當",
	"dead end": "需要更多內部連接以構築百科全書的鏈接網絡",
	"disputed": "內容疑欠準確,有待查證",
	"expand": "需要擴充",
	"expert": "需要精通或熟悉本主題的專業人士參與及協助編輯",
	"external links": "使用外部鏈接的方式可能不符合竹園Wiki的方針或指引",
	"fansite": "類似愛好者網頁",
	"globalize": "僅具有一部分地區的信息或觀點",
	"hoax": "真實性被質疑",
	"howto": "包含指南或教學內容",
	"in-universe": "使用小說故事內的觀點描述一個虛構事物",
	"inappropriate person": "使用不適當的第一人稱和第二人稱",
	"inappropriate tone": "語調或風格可能不適合百科全書的寫作方式",
	"lead section": "導言部分也許不足以概括其內容",
	"lead section too long": "導言部分也許過於冗長",
	"merge": "建議此頁面與頁面合併",
	"merge from": "建議將頁面並入本頁面",
	"merge to": "建議將此頁面並入頁面",
	"newsrelease": "閱讀起來像是新聞稿及包含過度的宣傳性語調",
	"no footnotes": "因爲沒有內文引用而來源仍然不明",
	"non-free": "可能過多或不當地使用了受版權保護的文字、圖像或/及多媒體文件",
	"notability": "可能不符合通用關注度指引",
	"notmandarin": "包含過多不是現代標準漢語的內容",
	"onesource": "極大或完全地依賴於某個單一的來源",
	"original research": "可能包含原創研究或未查證內容",
	"orphan": "沒有或只有很少鏈入頁面",
	"overlinked": "含有過多、重複、或不必要的內部鏈接",
	"overly detailed": "包含太多過度細節內容",
	"plot": "可能包含過於詳細的劇情摘要",
	"pov": "中立性有爭議。內容、語調可能帶有明顯的個人觀點或地方色彩",
	"primarysources": "依賴第一手來源",
	"prose": "使用了日期或時間列表式記述,需要改寫爲連貫的敘述性文字",
	"refimprove": "需要補充更多來源",
	"review": "閱讀起來類似評論,需要清理",
	"rewrite": "不符合竹園Wiki的質量標準,需要完全重寫",
	"roughtranslation": "翻譯品質不佳",
	"substub": "過於短小",
	"trivia": "應避免有陳列雜項、瑣碎資料的部分",
	"uncategorized": "缺少頁面分類",
	"unencyclopedic": "可能不適合寫入百科全書",
	"unreferenced": "沒有列出任何參考或來源",
	"update": "當前條目或章節需要更新",
	"verylong": "可能過於冗長",
	"weasel": "語意模棱兩可而損及其中立性或準確性"
};

// A list of tags in order of category
// Tags should be in alphabetical order within the categories
// Add new categories with discretion - the list is long enough as is!

Twinkle.tag.article.tagCategories = {
	"清理和維護模板": {
		"常規清理": [
			"cleanup",
			"cleanup-jargon",
			"copyedit"
		],
		"可能多余的內容": [
			"copypaste",
			"external links",
			"non-free"
		],
		"結構和導言": [
			"lead section",
			"lead section too long",
			"verylong"
		],
		"虛構作品相關清理": [
			"in-universe",
			"plot"
		]
	},
	"常規條目問題": {
		"重要性和知名度": [
			"notability"  // has subcategories and special-cased code
		],
		"寫作風格": [
			"advert",
			"fansite",
			"howto",
			"inappropriate person",
			"inappropriate tone",
			"newsrelease",
			"prose",
			"review"
		],
		"內容": [
			"expand",
			"substub",
			"unencyclopedic"
		],
		"信息和細節": [
			"expert",
			"overly detailed",
			"trivia"
		],
		"時間性": [
			"update"
		],
		"中立、偏見和事實準確性": [
			"autobiography",
			"coi",
			"contradict",
			"disputed",
			"globalize",
			"hoax",
			"pov",
			"weasel"
		],
		"可供查證和來源": [
			"blpdispute",
			"blpsources",
			"blpunsourced",
			"citecheck",
			"no footnotes",
			"onesource",
			"original research",
			"primarysources",
			"refimprove",
			"unreferenced"
		]
	},
	"具體內容問題": {
		"語言": [
			"notmandarin",
			"roughtranslation"
		],
		"鏈接": [
			"dead end",
			"orphan",
			"overlinked"
		],
		"參考技術": [
			"citation style"
		],
		"分類": [
			"catimprove",
			"uncategorized"
		]
	},
	"合併": [  // these three have a subgroup with several options
		"merge",
		"merge from",
		"merge to"
	]
};

// Tags for REDIRECTS start here

Twinkle.tag.frequentList = [
	{
		label: '{{合併重定向}}:保持頁面題名至相應主條目,令頁面內容在合併後仍能保存其編輯曆史',
		value: '合併重定向'
	},
	{
		label: '{{簡繁重定向}}:引導簡體至繁體,或繁體至簡體',
		value: '簡繁重定向'
	},
	{
		label: '{{模板重定向}}:指向模板的重定向頁面',
		value: '模板重定向'
	},
	{
		label: '{{別名重定向}}:標題的其他名稱、筆名、綽號、同義字等',
		value: '別名重定向'
	},
	{
		label: '{{譯名重定向}}:人物、作品等各項事物的其他翻譯名稱',
		value: '譯名重定向'
	},
	{
		label: '{{縮寫重定向}}:標題縮寫',
		value: '縮寫重定向'
	},
	{
		label: '{{拼寫重定向}}:標題的其他不同拼寫',
		value: '拼寫重定向'
	},
	{
		label: '{{錯字重定向}}:糾正標題的常見錯誤拼寫或誤植',
		value: '錯字重定向'
	},
	{
		label: '{{舊名重定向}}:將事物早前的名稱引導至更改後的主題',
		value: '舊名重定向'
	},
	{
		label: '{{曆史名稱重定向}}:具有曆史意義的別名、筆名、同義詞',
		value: '曆史名稱重定向'
	},
	{
		label: '{{全名重定向}}:標題的完整或更完整名稱',
		value: '全名重定向'
	},
	{
		label: '{{短名重定向}}:完整標題名稱或人物全名的部分、不完整的名稱或簡稱',
		value: '短名重定向'
	},
	{
		label: '{{姓氏重定向}}:人物姓氏',
		value: '姓氏重定向'
	},
	{
		label: '{{名字重定向}}:人物人名',
		value: '名字重定向'
	},
	{
		label: '{{本名重定向}}:人物本名',
		value: '本名重定向'
	},
	{
		label: '{{非中文重定向}}:非中文標題',
		value: '非中文重定向'
	},
	{
		label: '{{日文重定向}}:日語名稱',
		value: '日文重定向'
	}
];

Twinkle.tag.lessFrequentList = [
	{
		label: '{{角色重定向}}:電視劇、電影、書籍等作品的角色',
		value: '角色重定向'
	},
	{
		label: '{{章節重定向}}:導向至較高密度組織的頁面',
		value: '章節重定向'
	},
	{
		label: '{{列表重定向}}:導向至低密度的列表',
		value: '列表重定向'
	},
	{
		label: '{{可能性重定向}}:導向至當前提供內容更爲詳盡的目標頁面',
		value: '可能性重定向'
	},
	{
		label: '{{關聯字重定向}}:標題名稱關聯字',
		value: '關聯字重定向'
	},
	{
		label: '{{條目請求重定向}}:需要獨立條目的頁面',
		value: '條目請求重定向'
	},
	{
		label: '{{快捷方式重定向}}:竹園Wiki快捷方式',
		value: '快捷方式重定向'
	}
];

Twinkle.tag.rareList = [
	{
		label: '{{詞組重定向}}:將詞組/詞組/成語指向切題的條目及恰當章節',
		value: '詞組重定向'
	},
	{
		label: '{{消歧義頁重定向}}:指向消歧義頁',
		value: '消歧義頁重定向'
	},
	{
		label: '{{域名重定向}}:網域名稱',
		value: '域名重定向'
	},
	{
		label: '{{年代重定向}}:於年份條目導向至年代條目',
		value: '年代重定向'
	},
	{
		label: '{{用戶框模板重定向}}:用戶框模板',
		value: '用戶框模板重定向'
	},
	{
		label: '{{重定向模板用重定向}}:導向至重定向模板',
		value: '重定向模板用重定向'
	},
	{
		label: '{{EXIF重定向}}:JPEG圖像包含EXIF信息',
		value: 'EXIF重定向'
	}
];


// Contains those article tags that *do not* work inside {{multiple issues}}.
Twinkle.tag.multipleIssuesExceptions = [
	'catimprove',
	'merge',
	'merge from',
	'merge to',
	'notability',
	'notmandarin',
	"substub",
	'uncategorized'
];


Twinkle.tag.callbacks = {
	main: function( pageobj ) {
		var params = pageobj.getCallbackParameters(),
		    tagRe, tagText = '', summaryText = '添加',
		    tags = [], groupableTags = [], i, totalTags;

		// Remove tags that become superfluous with this action
		var pageText = pageobj.getPageText().replace(/\{\{\s*([Nn]ew unreviewed article|[Uu]nreviewed|[Uu]serspace draft)\s*(\|(?:\{\{[^{}]*\}\}|[^{}])*)?\}\}\s*/g, "");

		var addTag = function friendlytagAddTag( tagIndex, tagName ) {
			var currentTag = "";
			if( tagName === 'uncategorized' || tagName === 'catimprove' ) {
				pageText += '\n\n{{' + tagName +
					'|time={{subst:#time:c}}}}';
			} else {
				currentTag += ( Twinkle.tag.mode === '重定向' ? '\n' : '' ) + '{{' + tagName;

				if( tagName === 'notability' && params.tagParameters.notability !== 'none' ) {
					currentTag += '|||' + params.tagParameters.notability;
				}

				// prompt for other parameters, based on the tag
				switch( tagName ) {
					case 'merge':
					case 'merge to':
					case 'merge from':
						if (params.mergeTarget) {
							// normalize the merge target for now and later
							params.mergeTarget = Morebits.string.toUpperCaseFirstChar(params.mergeTarget.replace(/_/g, ' '));

							currentTag += '|' + params.mergeTarget;

							// link to the correct section on the talk page, for article space only
							if (mw.config.get('wgNamespaceNumber') === 0 && (params.mergeReason || params.discussArticle)) {
								if (!params.discussArticle) {
									// discussArticle is the article whose talk page will contain the discussion
									params.discussArticle = (tagName === "merge to" ? params.mergeTarget : mw.config.get('wgTitle'));
									// nonDiscussArticle is the article which won't have the discussion
									params.nonDiscussArticle = (tagName === "merge to" ? mw.config.get('wgTitle') : params.mergeTarget);
									params.talkDiscussionTitle = '請求與' + params.nonDiscussArticle + '合併';
								}
								currentTag += '|discuss=Talk:' + params.discussArticle + '#' + params.talkDiscussionTitle;
							}
						}
						break;
					default:
						break;
				}

				currentTag += (Twinkle.tag.mode === '重定向') ? '}}' : '|time={{subst:#time:c}}}}\n';
				tagText += currentTag;
			}

			if ( tagIndex > 0 ) {
				if( tagIndex === (totalTags - 1) ) {
					summaryText += '和';
				} else if ( tagIndex < (totalTags - 1) ) {
					summaryText += '、';
				}
			}

			summaryText += '{{[[';
			summaryText += (tagName.indexOf(":") !== -1 ? tagName : ("T:" + tagName + "|" + tagName));
			summaryText += ']]}}';
		};

		if( Twinkle.tag.mode !== '重定向' ) {
			// Check for preexisting tags and separate tags into groupable and non-groupable arrays
			for( i = 0; i < params.tags.length; i++ ) {
				tagRe = new RegExp( '(\\{\\{' + params.tags[i] + '(\\||\\}\\})|\\|\\s*' + params.tags[i] + '\\s*=[a-z ]+\\d+)', 'im' );
				if( !tagRe.exec( pageText ) ) {
					if( params.tags[i] == 'notability' ) {
						wikipedia_page = new Morebits.wiki.page("Wikipedia:關注度/提報", "添加關注度記錄項");
						wikipedia_page.setFollowRedirect(true);
						wikipedia_page.setCallbackParameters(params);
						wikipedia_page.load(Twinkle.tag.callbacks.notabilityList);
					}
					if( Twinkle.tag.multipleIssuesExceptions.indexOf(params.tags[i]) === -1 ) {
						groupableTags = groupableTags.concat( params.tags[i] );
					} else {
						tags = tags.concat( params.tags[i] );
					}
				} else {
					Morebits.status.warn( '信息', '在頁面上找到{{' + params.tags[i] +
						'}}…跳過' );
					// don't do anything else with merge tags
					if (params.tags[i] === "merge" || params.tags[i] === "merge from" ||
						params.tags[i] === "merge to") {
						params.mergeTarget = params.mergeReason = params.mergeTagOther = false;
					}
				}
			}

			var miTest = /\{\{(multiple ?issues|article ?issues|mi)[^}]+\{/im.exec(pageText);
			var miOldStyleRegex = /\{\{(multiple ?issues|article ?issues|mi)\s*\|([^{]+)\}\}/im;
			var miOldStyleTest = miOldStyleRegex.exec(pageText);

			if( ( miTest || miOldStyleTest ) && groupableTags.length > 0 ) {
				Morebits.status.info( '信息', '添加支持的標記入已存在的{{multiple issues}}' );

				groupableTags.sort();
				tagText = "";

				totalTags = groupableTags.length;
				$.each(groupableTags, addTag);

				summaryText += '標記' + '(在{{[[T:multiple issues|multiple issues]]}}內)';
				if( tags.length > 0 ) {
					summaryText += '和';
				}

				if( miOldStyleTest ) {
					// convert tags from old-style to new-style
					var split = miOldStyleTest[2].split("|");
					$.each(split, function(index, val) {
						split[index] = val.replace("=", "|time=").trim();
					});
					pageText = pageText.replace(miOldStyleRegex, "{{$1|\n{{" + split.join("}}\n{{") + "}}\n" + tagText + "}}\n");
				} else {
					var miRegex = new RegExp("(\\{\\{\\s*" + miTest[1] + "\\s*(?:\\|(?:\\{\\{[^{}]*\\}\\}|[^{}])*)?)\\}\\}\\s*", "im");
					pageText = pageText.replace(miRegex, "$1" + tagText + "}}\n");
				}
				tagText = "";
			} else if( params.group && groupableTags.length >= 3 ) {
				Morebits.status.info( '信息', '合併支持的模板入{{multiple issues}}' );

				groupableTags.sort();
				tagText += '{{multiple issues|\n';

				totalTags = groupableTags.length;
				$.each(groupableTags, addTag);

				summaryText += '等標記({{[[T:multiple issues|multiple issues]]}})';
				if( tags.length > 0 ) {
					summaryText += '及';
				}
				tagText += '}}\n';
			} else {
				tags = tags.concat( groupableTags );
			}
		} else {
			// Redirect tagging: Check for pre-existing tags
			for( i = 0; i < params.tags.length; i++ ) {
				tagRe = new RegExp( '(\\{\\{' + params.tags[i] + '(\\||\\}\\}))', 'im' );
				if( !tagRe.exec( pageText ) ) {
					tags = tags.concat( params.tags[i] );
				} else {
					Morebits.status.warn( '信息', '在重定向上找到{{' + params.tags[i] +
						'}}…跳過' );
				}
			}
		}

		tags.sort();
		totalTags = tags.length;
		$.each(tags, addTag);

		if( Twinkle.tag.mode === '重定向' ) {
			pageText += tagText;
		} else {
			// smartly insert the new tags after any hatnotes. Regex is a bit more
			// complicated than it'd need to be, to allow templates as parameters,
			// and to handle whitespace properly.
			pageText = pageText.replace(/^\s*(?:((?:\s*\{\{\s*(?:about|correct title|dablink|distinguish|for|other\s?(?:hurricaneuses|people|persons|places|uses(?:of)?)|redirect(?:-acronym)?|see\s?(?:also|wiktionary)|selfref|the)\d*\s*(\|(?:\{\{[^{}]*\}\}|[^{}])*)?\}\})+(?:\s*\n)?)\s*)?/i,
				"$1" + tagText);
		}
		summaryText += ( tags.length > 0 ? '標記' : '' ) +
			'到' + Twinkle.tag.mode;

		// avoid truncated summaries
		if (summaryText.length > (254 - Twinkle.getPref('summaryAd').length)) {
			summaryText = summaryText.replace(/\[\[[^\|]+\|([^\]]+)\]\]/g, "$1");
		}

		pageobj.setPageText(pageText);
		pageobj.setEditSummary(summaryText + Twinkle.getPref('summaryAd'));
		pageobj.setWatchlist(Twinkle.getFriendlyPref('watchTaggedPages'));
		pageobj.setMinorEdit(Twinkle.getFriendlyPref('markTaggedPagesAsMinor'));
		pageobj.setCreateOption('nocreate');
		pageobj.save(function() {
			// special functions for merge tags
			if (params.mergeReason) {
				// post the rationale on the talk page (only operates in main namespace)
				var talkpageText = "\n\n== 請求與[[" + params.nonDiscussArticle + "]]合併 ==\n\n";
				talkpageText += params.mergeReason.trim() + "--~~~~";

				var talkpage = new Morebits.wiki.page("Talk:" + params.discussArticle, "將理由貼進討論頁");
				talkpage.setAppendText(talkpageText);
				talkpage.setEditSummary('請求將[[' + params.nonDiscussArticle + ']]' +
					'與' + '[[' + params.discussArticle + ']]合併' +
					Twinkle.getPref('summaryAd'));
				talkpage.setWatchlist(Twinkle.getFriendlyPref('watchMergeDiscussions'));
				talkpage.setCreateOption('recreate');
				talkpage.append();
			}
			if (params.mergeTagOther) {
				// tag the target page if requested
				var otherTagName = "merge";
				if (tags.indexOf("merge from") !== -1) {
					otherTagName = "merge to";
				} else if (tags.indexOf("merge to") !== -1) {
					otherTagName = "merge from";
				}
				var newParams = {
					tags: [otherTagName],
					mergeTarget: Morebits.pageNameNorm,
					discussArticle: params.discussArticle,
					talkDiscussionTitle: params.talkDiscussionTitle
				};
				var otherpage = new Morebits.wiki.page(params.mergeTarget, "標記其他頁面(" +
					params.mergeTarget + ")");
				otherpage.setCallbackParameters(newParams);
				otherpage.load(Twinkle.tag.callbacks.main);
			}
		});

		if( params.patrol ) {
			pageobj.patrol();
		}
	},

	notabilityList: function(pageobj) {
		var text = pageobj.getPageText();
		var params = pageobj.getCallbackParameters();

		pageobj.setAppendText("\n{{subst:Wikipedia:關注度/提報/item|title=" + Morebits.pageNameNorm + "}}");
		pageobj.setEditSummary("添加[[" + Morebits.pageNameNorm + "]]" + Twinkle.getPref('summaryAd'));
		pageobj.setCreateOption('recreate');
		pageobj.append();
	}
};

Twinkle.tag.callback.evaluate = function friendlytagCallbackEvaluate(e) {
	var form = e.target;
	var params = {};
	if (form.patrolPage) {
		params.patrol = form.patrolPage.checked;
	}

	switch (Twinkle.tag.mode) {
		case '條目':
			params.tags = form.getChecked( 'articleTags' );
			params.group = form.group.checked;
			params.tagParameters = {
				notability: form["articleTags.notability"] ? form["articleTags.notability"].value : null
			};
			// common to {{merge}}, {{merge from}}, {{merge to}}
			params.mergeTarget = form["articleTags.mergeTarget"] ? form["articleTags.mergeTarget"].value : null;
			params.mergeReason = form["articleTags.mergeReason"] ? form["articleTags.mergeReason"].value : null;
			params.mergeTagOther = form["articleTags.mergeTagOther"] ? form["articleTags.mergeTagOther"].checked : false;
			break;
		case '重定向':
			params.tags = form.getChecked( 'redirectTags' );
			break;
		default:
			alert("Twinkle.tag:未知模式 " + Twinkle.tag.mode);
			break;
	}

	// form validation
	if( !params.tags.length ) {
		alert( '必須選擇至少一個標記!' );
		return;
	}
	if( ((params.tags.indexOf("merge") !== -1) + (params.tags.indexOf("merge from") !== -1) +
		(params.tags.indexOf("merge to") !== -1)) > 1 ) {
		alert( '請在{{merge}}、{{merge from}}和{{merge to}}中選擇一個。如果需要多次合併,請使用{{merge}}並用管道符分隔條目名(但在這種情形中Twinkle不能自動標記其他條目)。' );
		return;
	}
	if( (params.mergeTagOther || params.mergeReason) && params.mergeTarget.indexOf('|') !== -1 ) {
		alert( '目前還不支持在一次合併中標記多個條目,與開啓關於多個條目的討論。請不要勾選“標記其他條目”和/或清理“理由”框,並重試。' );
		return;
	}

	Morebits.simpleWindow.setButtonsEnabled( false );
	Morebits.status.init( form );

	Morebits.wiki.actionCompleted.redirect = Morebits.pageNameNorm;
	Morebits.wiki.actionCompleted.notice = "標記完成,在幾秒內刷新頁面";
	if (Twinkle.tag.mode === '重定向') {
		Morebits.wiki.actionCompleted.followRedirect = false;
	}

	var wikipedia_page = new Morebits.wiki.page(Morebits.pageNameNorm, "正在標記" + Twinkle.tag.mode);
	wikipedia_page.setCallbackParameters(params);
	switch (Twinkle.tag.mode) {
		case '條目':
			/* falls through */
		case '重定向':
			wikipedia_page.load(Twinkle.tag.callbacks.main);
			return;
		default:
			alert("Twinkle.tag:未知模式 " + Twinkle.tag.mode);
			break;
	}
};
})(jQuery);


//</nowiki>