User:Ou0430/Friendly/friendlytag.js
< User:Ou0430 | Friendly
注意:在发布之后,您可能需要清除浏览器缓存才能看到所作出的变更的影响。
- Firefox或Safari:按住Shift的同时单击刷新,或按Ctrl-F5或Ctrl-R(Mac为⌘-R)
- Google Chrome:按Ctrl-Shift-R(Mac为⌘-Shift-R)
- Internet Explorer或Edge:按住Ctrl的同时单击刷新,或按Ctrl-F5
- Opera:按 Ctrl-F5。
// <nowiki>
// 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.groupByDefault ( boolean )
*/
if( typeof( FriendlyConfig.groupByDefault ) == 'undefined' ) {
FriendlyConfig.groupByDefault = true;
}
/**
FriendlyConfig.watchTaggedPages ( boolean )
*/
if( typeof( FriendlyConfig.watchTaggedPages ) == 'undefined' ) {
FriendlyConfig.watchTaggedPages = false;
}
/**
FriendlyConfig.markTaggedPagesAsMinor ( boolean )
*/
if( typeof( FriendlyConfig.markTaggedPagesAsMinor ) == 'undefined' ) {
FriendlyConfig.markTaggedPagesAsMinor = true;
}
/**
FriendlyConfig.markTaggedPagesAsPatrolled ( boolean )
*/
if( typeof( FriendlyConfig.markTaggedPagesAsPatrolled ) == 'undefined' ) {
FriendlyConfig.markTaggedPagesAsPatrolled = true;
}
var isRedirect;
function friendlytag() {
isRedirect = function () {
var allPageTags=document.getElementsByTagName("*");
for (i=0; i<allPageTags.length; i++) {
if (allPageTags[i].className=='redirectText') {
return true;
}
}
return false;
} ();
if( isRedirect ) {
twAddPortletLink( "javascript:friendlytag.callback()", wgULS("标记","標記"), "friendly-tag", wgULS("标记重定向","標記重定向"), "");
} else if( wgNamespaceNumber != 0 || wgCurRevisionId == false ) {
return;
} else {
twAddPortletLink( "javascript:friendlytag.callback()", wgULS("标记","標記"), "friendly-tag", wgULS("标记条目","標記條目"), "");
}
}
$(friendlytag);
friendlytag.callback = function friendlytagCallback( uid ) {
var Window = new SimpleWindow( 600, 400 );
var form = new QuickForm( friendlytag.callback.evaluate );
if( !isRedirect ) {
Window.setTitle( "条目维护标记" );
form.append( {
type: 'checkbox',
list: [
{
label: '如可能,合并到{{article issues}}',
value: 'group',
name: 'group',
checked: FriendlyConfig.groupByDefault
}
]
}
);
form.append( { type:'submit' } );
form.append( { type:'header', label:'维护模板' } );
form.append( { type:'checkbox', name: 'maintenance', list: friendlytag.maintenanceList } );
form.append( { type:'header', label:'问题模板' } );
form.append( { type:'checkbox', name: 'problem', list: friendlytag.problemList } );
form.append( { type:'header', label:'通知模板' } );
form.append( { type:'checkbox', name: 'notice', list: friendlytag.noticeList } );
if( typeof( FriendlyConfig.customTagList ) == 'object' ) {
form.append( { type:'header', label:'自定义模板' } );
form.append( { type: 'checkbox', name: 'custom', list: FriendlyConfig.customTagList } );
}
} else {
Window.setTitle( "重定向维护标记" );
form.append( { type:'submit' } );
form.append( { type:'header', label:'常用模板' } );
form.append( { type:'checkbox', name: 'commonredir', list: friendlytag.commonredirList } );
form.append( { type:'header', label:'偶用模板' } );
form.append( { type:'checkbox', name: 'rareredir', list: friendlytag.rareredirList } );
form.append( { type:'header', label:'鲜用模板' } );
form.append( { type:'checkbox', name: 'littleredir', list: friendlytag.littleredirList } );
}
form.append( { type:'submit' } );
var result = form.render();
Window.setContent( result );
Window.display();
}
friendlytag.maintenanceList = [
{
label: wgULS("\{\{attention\}\}: 此条目需要您的关注","\{\{attention\}\}: 此條目需要您的關注"),
value: 'attention'
},
{
label: wgULS("\{\{cleanup\}\}: 条目可能需要进行清理","\{\{cleanup\}\}: 條目可能需要進行清理"),
value: 'cleanup'
},
{
label: wgULS("\{\{copyedit\}\}: 条目需要校对,以确保语法、用语、语气、风格及表达恰当","\{\{copyedit\}\}: 條目需要校對,以確保語法、用語、語氣、風格及表達恰當"),
value: 'copyedit'
},
{
label: wgULS("\{\{expand\}\}: 此条目需要扩充","\{\{expand\}\}: 此條目需要擴充"),
value: 'expand'
},
{
label: wgULS("\{\{expert\}\}: 此条目需要精通或熟悉本主题的专家参与编辑","\{\{expert\}\}: 此條目需要精通或熟悉本主題的專家參與編輯"),
value: 'expert'
},
{
label: wgULS("\{\{fansite\}\}: 此条目类似爱好者站点","\{\{fansite\}\}: 此條目類似愛好者站點"),
value: 'fansite'
},
{
label: wgULS("\{\{grammar\}\}: 此条目或章节的文法需要改善","\{\{grammar\}\}: 此條目或章節的文法需要改善"),
value: 'grammar'
},
{
label: wgULS("\{\{howto\}\}: 此条目或章节包含指南或教学内容","\{\{howto\}\}: 此條目或章節包含指南或教學內容"),
value: 'howto'
},
{
label: wgULS("\{\{in-universe\}\}: 本条目以小说作品原始的写作风格叙述一个小说作品或情节","\{\{in-universe\}\}: 本條目以小說作品原始的寫作風格敍述一個小說作品或情節"),
value: 'in-universe'
},
{
label: wgULS("\{\{infoboxneeded\}\}: 此条目需要加上一个合适的信息框模板,或是现有的信息框需要更新","\{\{infoboxneeded\}\}: 此條目需要加上一個合適的訊息框模板,或是現有的訊息框需要更新"),
value: 'infoboxneeded'
},
{
label: wgULS("\{\{intro-missing\}\}: 这个条目的导言过于短小","\{\{intro-missing\}\}: 這個條目的導言過於短小"),
value: 'intromissing'
},
{
label: wgULS("\{\{newsrelease\}\}: 本条目或章节阅读起来像是新闻稿,或包含过度的宣传性语调","\{\{newsrelease\}\}: 本條目或章節閱讀起來像是新聞稿,或包含過度的宣傳性語調"),
value: 'newsrelease'
},
{
label: wgULS("\{\{nofootnotes\}\}: 本条目包含了一些参考来源或外部链接,但由于条目内部缺少内文脚注,本条目的来源仍然不明确","\{\{nofootnotes\}\}: 本條目包含了一些參考來源或外部鏈結,但由於條目內部缺乏內文腳注,本條目的來源仍然不明確"),
value: 'nofootnotes'
},
{
label: wgULS("\{\{notchinese\}\}: 此条目包含过多不是现代标准汉语的内容","\{\{notchinese\}\}: 此條目包含過多不是現代標準漢語的內容"),
value: 'notchinese'
},
{
label: wgULS("\{\{notchinesetitle\}\}: 据命名常规,本条目标题应使用中文","\{\{notchinesetitle\}\}: 據命名常規,本條目標題應使用中文"),
value: 'notchinesetitle'
},
{
label: wgULS("\{\{orphan\}\}: 这个条目只有或没有很少链入页面","\{\{orphan\}\}: 這個條目只有或沒有很少鏈入頁面"),
value: 'orphan'
},
{
label: wgULS("\{\{prosetimeline\}\}: 此条目或章节可能包含不适当的条列式年代表","\{\{prosetimeline\}\}: 此條目或章節可能包含不適當的條列式年代表"),
value: 'prosetimeline'
},
{
label: wgULS("\{\{roughtranslation\}\}: 此条目或章节翻译粗劣","\{\{roughtranslation\}\}: 此條目或章節翻譯粗劣"),
value: 'roughtranslation'
},
{
label: wgULS("\{\{tone\}\}: 此条目的语调或风格可能不适合百科全书的写作方式","\{\{tone\}\}: 此條目的語調或風格可能不適合百科全書的寫作方式"),
value: 'tone'
},
{
label: wgULS("\{\{translating\}\}: 此条目仍有文字未被翻译成中文","\{\{translating\}\}: 此條目仍有文字未被翻譯成中文"),
value: 'translating'
},
{
label: wgULS("\{\{trivia\}\}: 应避免有陈列杂项资料的章节","\{\{trivia\}\}: 應避免有陳列雜項資料的章節"),
value: 'trivia'
},
{
label: wgULS("\{\{uncategorized\}\}: 此条目缺少页面分类","\{\{uncategorized\}: 此條目缺乏頁面分類"),
value: 'uncategorized'
},
{
label: wgULS("\{\{verylong\}\}: 此条目可能过于冗长","\{\{verylong\}\}: 此條目可能過於冗長"),
value: 'verylong'
},
{
label: wgULS("\{\{wikify\}\}: 此条目格式需要被修正以符合维基标准","\{\{wikify\}\}: 此條目格式需要被修正以符合維基標準"),
value: 'wikify'
}
];
friendlytag.problemList = [
{
label: wgULS("\{\{advert\}\}: 此条目类似广告","\{\{advert\}\}: 此條目類似廣告"),
value: 'advert'
},
{
label: wgULS("\{\{blpdispute\}\}: 此条目可能违反了生者传记方针","\{\{blpdispute\}\}: 此條目可能違反了生者傳記方針"),
value: 'blpdispute'
},
{
label: wgULS("\{\{blpsource\}\}: 此传记条目需要补充性的引用以供查证","\{\{blpsource\}\}: 此傳記條目需要附加來源資料以供查證"),
value: 'blpsource'
},
{
label: wgULS("\{\{disputed\}\}: 此条目的准确性有争议","\{\{disputed\}\}: 此條目的準確性有爭議"),
value: 'disputed'
},
{
label: wgULS("\{\{globalize\}\}: 此条目仅具一部分地域的观点或资料,尚需补充世界性的内容","\{\{globalize\}\}: 此條目僅具一部份地域的觀點或資料,尚需補充世界性的內容"),
value: 'globalize',
},
{
label: wgULS("\{\{hoax\}\}: 此条目真实性成疑","\{\{hoax\}\}: 此條目真實性成疑"),
value: 'hoax'
},
{
label: wgULS("\{\{non-free\}\}: 此条目可能过多或不当地使用了受版权保护的文字、图像或/及多媒体文件","\{\{non-free\}\}: 此條目可能過多或不當地使用了受版權保護的文字、圖像或/及多媒體檔案"),
value: 'non-free'
},
{
label: wgULS("\{\{notability\}\}: 此条目可能不符合通用关注度指引","\{\{notability\}\}: 此條目可能不符合通用關注度指引"),
value: 'notability',
subgroup: {
name: 'notability',
type: 'select',
list: [
{
label: wgULS("\{\{notability\}\}: 通用的知名度标准","\{\{notability\}\}: 通用的知名度標準"),
value: "none"
},
{
label: wgULS("\{\{notability|Biographies\}\}: 人物传记","\{\{notability|Biographies\}\}: 人物傳記"),
value: "Biographies"
},
{
label: wgULS("\{\{notability|Fiction\}\}: 虚构事物","\{\{notability|Fiction\}\}: 虛構事物"),
value: "Fiction"
},
{
label: wgULS("\{\{notability|Neologisms\}\}: 发明、研究","\{\{notability|Neologisms\}\}: 發明或研究"),
value: "Neologisms"
},
{
label: wgULS("\{\{notability|Web\}\}: 网站、网络内容","\{\{notability|Web\}\}: 網站或網絡內容"),
value: "Web"
}
]
}
},
{
label: wgULS("\{\{notability unreferenced\}\}: 此条目也许具备关注度,但需要可靠的来源来加以彰显","\{\{notability unreferenced\}\}: 此條目也許具備關注度,但需要可靠的來源加以彰顯"),
value: 'notability unreferenced'
},
{
label: wgULS("\{\{npov\}\}: 此条目的中立性有争议。内容、语调可能带有明显的个人观点或地方色彩","\{\{npov\}\}: 此條目的中立性有爭議。內容、語調可能帶有明顯的個人觀點或地方色彩"),
value: 'npov'
},
{
label: wgULS("\{\{off-topic\}\}: 这篇文章的内容文不对题","\{\{off-topic\}\}: 這篇文章的內容文不對題"),
value: 'off-topic'
},
{
label: wgULS("\{\{original research\}\}: 此条目可能包含原创研究或未查证内容","\{\{original research\}\}: 此條目可能包含原創研究或未查證內容"),
value: 'original research'
},
{
label: wgULS("\{\{primarysources\}\}: 此条目需要可靠、公开、第三方的来源","\{\{primarysources\}\}: 此條目需要可靠、公開、第三方的來源"),
value: 'primarysources'
},
{
label: wgULS("\{\{refimprove\}\}: 此条目需要补充更多来源","\{\{refimprove\}\}: 此條目需要補充更多來源"),
value: 'refimprove'
},
{
label: wgULS("\{\{review\}\}: 此条目或章节阅读起来类似评论","\{\{review\}\}: 此條目或章節閱讀起來類似評論"),
value: 'review'
},
{
label: wgULS("\{\{rewrite\}\}: 此条目或段落的质量低劣,需要完全重写","\{\{rewrite\}\}: 此條目或段落的質量低劣,需要完全重寫"),
value: 'rewrite'
},
{
label: wgULS("\{\{substub\}\}: 这篇是过于短小的文章","\{\{substub\}\}: 這篇是過於短小的文章"),
value: 'substub'
},
{
label: wgULS("\{\{unencyclopedic\}\}: 此条目可能不适合写入百科全书","\{\{unencyclopedic\}\}: 此條目可能不適合寫入百科全書"),
value: 'unencyclopedic'
},
{
label: wgULS("\{\{unreferenced\}\}: 此条目没有列出任何参考或来源","\{\{unreferenced\}\}: 此條目沒有列出任何參考或來源"),
value: 'unreferenced'
},
{
label: wgULS("\{\{update\}\}: 这个条目需要更新","\{\{update\}\}: 這個條目需要更新"),
value: 'update'
},
{
label: wgULS("\{\{weasel\}\}: 此条目可能因为语意模棱两可而损及其中立性","\{\{weasel\}\}: 此條目可能因為語意模稜兩可而損及其中立性"),
value: 'weasel'
}
];
friendlytag.noticeList = [
{
label: wgULS("\{\{current\}\}: 本文记述一项新闻动态","\{\{current\}\}: 本文記述一項新聞動態"),
value: 'current',
subgroup: {
name: 'current',
type: 'select',
list: [
{
label: wgULS("\{\{current\}\}: 本文记述一项新闻动态","\{\{current\}\}: 本文記述一項新聞動態"),
value: "current"
},
{
label: wgULS("\{\{current spaceflight\}\}: 本文或本章节是关于目前或最近的太空任务","\{\{current spaceflight\}\}: 本文或本章節是關於目前或最近的太空任務"),
value: "current spaceflight"
},
{
label: wgULS("\{\{current sport\}\}: 此条目记述一项近期体育赛事","\{\{current sport\}\}: 此條目記述一項近期體育賽事"),
value: "current sport"
},
{
label: wgULS("\{\{current related\}\}: 本条目和一项新闻动态相关","\{\{current related\}\}: 本條目和一項新聞動態相關"),
value: "current related"
},
{
label: wgULS("\{\{recent death\}\}: 这是一篇关于最近逝世人物的文章","\{\{recent death\}\}: 這是一篇關於最近逝世人物的文章"),
value: "recent death"
}
]
}
},
{
label: wgULS("\{\{future\}\}: 此条目是关于未来已定或预期会发生的事件","\{\{future\}\}: 此條目是關於未來已定或預期會發生的事件"),
value: 'future',
subgroup: {
name: 'future',
type: 'select',
list: [
{
label: wgULS("\{\{future\}\}: 此条目是关于未来已定或预期会发生的事件","\{\{future\}\}: 此條目關於未來已定或預期會發生的事件"),
value: "future"
},
{
label: "Engineering",
list: [
{
label: wgULS("\{\{future infrastructure\}\}: 此条目是关于未来的建设或计划","\{\{future infrastructure\}\}: 此條目是關於未來的建設或計劃"),
value: "future infrastructure"
},
{
label: wgULS("\{\{future software\}\}: 此条目包含计划中或预期会发布的未来软件","\{\{future software\}\}: 此條目包含計劃中或預期會發布的未來軟件"),
value: "future software"
},
{
label: wgULS("\{\{future spaceflight\}\}: 本条目为已列入计划或可能进行的航天活动","\{\{future spaceflight\}\}: 本條目為已列入計劃或可能進行的航天活動"),
value: "future spaceflight"
}
]
},
{
label: "Entertainment",
list: [
{
label: wgULS("\{\{future film\}\}: 此条目是关于正在计划或拍摄中的电影","\{\{future film\}\}: 此條目是關於正在計劃或拍攝中的電影"),
value: "future film"
},
{
label: wgULS("\{\{future game\}\}: 此条目是关于尚未发行的电子游戏","\{\{future game\}\}: 此條目是關於尚未發行的電子遊戲"),
value: "future game"
},
{
label: wgULS("\{\{future tvshow\}\}: 此条目包含有关正在计划、拍摄中或有待播出的电视节目的信息","\{\{future tvshow\}\}: 此條目包含有關正在計劃、拍攝中或有待播出之電視節目訊息"),
value: "future tvshow"
},
{
label: wgULS("\{\{future tvshow information\}\}: 此条目包含有关正在播出的电视系列节目的信息","\{\{future tvshow information\}\}: 此條目包含有關正在播出的電視系列節目之訊息"),
value: "future tvshow information"
}
]
},
{
label: "Miscellaneous",
list: [
{
label: wgULS("\{\{future election\}\}: 此条目是关于将举办或进行中的选举","\{\{future election\}\}: 此條目是關於將舉辦或進行中的選舉"),
value: "future election"
},
{
label: wgULS("\{\{future product\}\}: 此条目是关于未上市产品的信息","\{\{future product\}\}: 此條目是關於未上市產品的訊息"),
value: "future product"
}
]
},
{
label: "Transportation",
list: [
{
label: wgULS("\{\{future public transportation\}\}: 本文是关于未来的公共运输建设或计划","\{\{future public transportation\}\}: 本文是關於未來的公共運輸建設或計劃"),
value: "future public transportation"
}
]
},
{
label: "Sports",
list: [
{
label: wgULS("\{\{future go\}\}: 此条目是关于一项预定进行的围棋赛","\{\{future go\}\}: 此條目是關於一項預定進行的圍棋賽"),
value: "future go"
},
{
label: wgULS("\{\{future sport\}\}: 此条目是关于一项预定进行的体育竞赛","\{\{future sport\}\}: 此條目是關於一項預定進行的體育競賽"),
value: "future sport"
}
]
}
]
}
},
{
label: wgULS("\{\{inuse\}\}: 这篇文章正在进行重大修改","\{\{inuse\}\}: 這篇文章正在進行重大修改"),
value: 'inuse' },
{
label: wgULS("\{\{underconstruction\}\}: 这个条目是一个扩展或大修改,它并未供使用","\{\{underconstruction\}\}: 這個條目是一個擴展或大修改,它並未供使用"),
value: 'underconstruction' }
];
friendlytag.commonredirList = [
{
label: "\{\{簡繁重定向\}\}: 引导简体至繁体,或繁体至简体",
value: '簡繁重定向'
},
{
label: "\{\{模板重定向\}\}: 指向模板",
value: '模板重定向'
},
{
label: "\{\{别名重定向\}\}: 标题的其他名称、笔名、绰号、同义字等",
value: '别名重定向'
},
{
label: "\{\{縮寫重定向\}\}: 标题缩写",
value: '縮寫重定向'
},
{
label: "\{\{拼寫重定向\}\}: 标题的其他不同拼写",
value: '拼寫重定向'
},
{
label: "\{\{錯字重定向\}\}: 标题的常见错误拼写或误植",
value: '錯字重定向'
},
{
label: "\{\{全名重定向\}\}: 标题的完整或更完整名称",
value: '全名重定向'
},
{
label: "\{\{短名重定向\}\}: 完整标题名称或人物全名的部分、不完整的名称或简称",
value: '短名重定向'
},
{
label: "\{\{姓氏重定向\}\}: 人物姓氏",
value: '姓氏重定向'
},
{
label: "\{\{人名重定向\}\}: 人物人名",
value: '人名重定向'
},
{
label: "\{\{非中文重定向\}\}: 非中文标题",
value: '非中文重定向'
},
{
label: "\{\{日文重定向\}\}: 日语名称",
value: '日文重定向'
}
];
friendlytag.rareredirList = [
{
label: "\{\{角色重定向\}\}: 电视剧、电影、书籍等作品的角色",
value: '角色重定向'
},
{
label: "\{\{章節重定向\}\}: 导向至较高密度(散文般密集)组织的页面",
value: '章節重定向'
},
{
label: "\{\{列表重定向\}\}: 导向至低密度的列表",
value: '列表重定向'
},
{
label: "\{\{可能性重定向\}\}: 导向至当前提供内容更为详尽的目标页面、或该页面的章节段落",
value: '可能性重定向'
},
{
label: "\{\{關聯字重定向\}\}: 标题名称关联字",
value: '關聯字重定向'
},
{
label: "\{\{捷徑重定向\}\}: 维基百科捷径",
value: '捷徑重定向'
}
];
friendlytag.littleredirList = [
{
label: "\{\{重定向模板用重定向\}\}: 重定向模板用",
value: '重定向模板用重定向'
},
{
label: "\{\{EXIF重定向\}\}: JPEG图像包含EXIF信息",
value: 'EXIF重定向'
}
];
// Set to true if template can be grouped into {{articleissues}}
friendlytag.groupHash = {
'blpsources' : true,
'citation style' : true,
'refimprove' : true,
'roughtranslation' : true,
'onesource' : true,
'primarysources' : true,
'review' : true,
'fansite' : true,
'howto' : true,
'contradiction' : true,
'intromissing' : true,
'update' : true,
'jargon' : true,
'inappropriate person' : true,
'npov' : true,
'or' : true,
'disputed' : true,
'blpdispute' : true,
'weasel' : true,
'notability' : true,
'globalize' : true,
'tone' : true,
'advert' : true,
'in-universe' : true,
'expert' : true,
'verylong' : true,
'expand' : true,
'orphan' : true,
'copyedit' : true,
'rewrite' : true,
'citecheck' : true,
'wikify' : true,
'trivia' : true,
'cleanup' : true,
'importance' : true,
'unencyclopedic' : true,
'newsrelease' : true,
'hoax' : true,
'grammar' : true,
'unreferenced' : true
}
friendlytag.callbacks = {
main: function( self ) {
var form = self.responseXML.getElementById( 'editform' );
var tagRe, text = '', summaryText = '添加';
var tags = new Array(), groupableTags = new Array();
var isNotability = false;
if( !isRedirect ) {
// Check for preexisting tags and separate tags into groupable and non-groupable arrays
Status.info( '信息', '检查条目已有模板' );
for( var i = 0; i < self.params.tags.length; i++ ) {
tagRe = new RegExp( '(\\{\\{' + self.params.tags[i] + '(\\||\\}\\}))', 'im' );
if( !tagRe.exec( form.wpTextbox1.value ) ) {
if( friendlytag.groupHash[ self.params.tags[i] ] ) {
groupableTags = groupableTags.concat( self.params.tags[i] );
} else {
tags = tags.concat( self.params.tags[i] );
}
} else {
Status.info( '信息', '已在条目中找到\{\{' + self.params.tags[i]
+ '\}\}...跳过' );
}
}
if( self.params.group && groupableTags.length >= 3 ) {
Status.info( '信息', '合并支持的模板至\{\{article issues\}\}' );
groupableTags.sort();
text += '\{\{article issues\n';
summaryText += ' \{\{[[Template:article issues|article issues]]\}\}参数:';
for( var i = 0; i < groupableTags.length; i++ ) {
text += '|' + groupableTags[i]
+ '=\{\{subst:#time:c\}\}\n';
if( i == (groupableTags.length - 1) ) {
summaryText += '和';
} else if ( i < (groupableTags.length - 1) && i != 0 ) {
summaryText += ',';
}
summaryText += '' + groupableTags[i];
}
text += '\}\}\n';
} else {
tags = tags.concat( groupableTags );
}
} else {
// Check for preexisting tags
Status.info( '信息', '检查重定向已有模板' );
for( var i = 0; i < self.params.tags.length; i++ ) {
tagRe = new RegExp( '(\\{\\{' + self.params.tags[i] + '(\\||\\}\\}))', 'im' );
if( !tagRe.exec( form.wpTextbox1.value ) ) {
tags = tags.concat( self.params.tags[i] );
} else {
Status.info( '信息', '已在重定向中找到\{\{' + self.params.tags[i]
+ '\}\}...跳过' );
}
}
}
tags.sort();
for( var i = 0; i < tags.length; i++ ) {
if( tags[i] == 'uncategorized' || tags[i] == 'catimprove' ) {
form.wpTextbox1.value += '\n\n\{\{' + tags[i]
+ '|time=\{\{subst:#time:c\}\}\}\}';
} else {
/*if( tags[i] == 'globalize' ) {
text += '\{\{' + self.params.globalizeSubcategory;
} else*/ if( tags[i] == 'current' ) {
text += '\{\{' + self.params.currentSubcategory;
} else if( tags[i] == 'future' ) {
text += '\{\{' + self.params.futureSubcategory;
} else {
text += ( isRedirect ? '\n' : '' ) + '\{\{' + tags[i];
}
if( tags[i] == 'notability' && self.params.notabilitySubcategory != 'none' ) {
text += '|3=' + self.params.notabilitySubcategory;
}
if( tags[i] == 'notability' ) {
isNotability = true;
}
if( tags[i] == 'do-attempt' ) {
text += '|att=\{\{subst:#time:c\}\}\}\}\n';
} else {
text += isRedirect ? '\}\}' : '|time=\{\{subst:#time:c\}\}\}\}\n';
}
}
if( i == (tags.length - 1) && ( i > 0 || groupableTags.length > 3 ) ) {
summaryText += '和';
} else if ( i < (tags.length - 1) && ( i != 0 || groupableTags.length > 3 ) ) {
summaryText += ', ';
}
summaryText += ' \{\{[[Template:';
/*if( tags[i] == 'globalize' ) {
summaryText += self.params.globalizeSubcategory + '|' + self.params.globalizeSubcategory;
} else*/ if( tags[i] == 'current' ) {
summaryText += self.params.currentSubcategory + '|' + self.params.currentSubcategory;
} else if( tags[i] == 'future' ) {
summaryText += self.params.futureSubcategory + '|' + self.params.futureSubcategory;
} else {
summaryText += tags[i] + '|' + tags[i];
}
summaryText += ']]\}\}';
}
if( !isRedirect ) {
text += form.wpTextbox1.value;
} else {
text = form.wpTextbox1.value + text;
}
summaryText += '标记至' + ( isRedirect ? '重定向' : '条目' ) + FriendlyConfig.summaryAd;
var postData = {
'wpMinoredit': FriendlyConfig.markTaggedPagesAsMinor ? 1 : undefined,
'wpWatchthis': form.wpWatchthis.checked ? 1 : (FriendlyConfig.watchTaggedPages ? 1 : undefined),
'wpStarttime': form.wpStarttime.value,
'wpEdittime': form.wpEdittime.value,
'wpAutoSummary': form.wpAutoSummary.value,
'wpEditToken': form.wpEditToken.value,
'wpSummary': summaryText,
'wpTextbox1': text
};
self.post( postData );
if( FriendlyConfig.markTaggedPagesAsPatrolled && self.params.rcid != '' ) {
var query = {
'title': wgPageName,
'action': 'markpatrolled',
'rcid': self.params.rcid
};
var wikipedia_wiki = new Wikipedia.wiki( '标记条目为已巡查', query );
wikipedia_wiki.post();
}
if( isNotability ) {
var query = {
'title': 'Wikipedia:关注度/提报',
'action': 'submit'
};
var callback = function( self ) {
var xmlDoc = self.responseXML;
if( wgPageName != ( 'Wikipedia:关注度/提报' ) ) {
var query = {
'title': 'Wikipedia:关注度/提报',
'action': 'submit'
};
var wikipedia_wiki = new Wikipedia.wiki( "提报至关注度报告页" , query, friendlytag.callbacks.tagNotability );
wikipedia_wiki.params = self.params;
wikipedia_wiki.get();
} else {
Status.info( "信息", "当前页面为关注度报告页,取消通知" );
}
}
var wikipedia_api = new Wikipedia.api( "抓关注度报告页数据", query, callback );
wikipedia_api.params = self.params;
wikipedia_api.post();
}
},
tagNotability: function( self ) {
var form = self.responseXML.getElementById( 'editform' );
var text = form.wpTextbox1.value;
text += "\{\{subst:Wikipedia:关注度/提报/item|title=" + wgPageName + "\}\}";
var postData = {
'wpMinoredit': form.wpMinoredit.checked ? '' : undefined,
'wpWatchthis': form.wpWatchthis.checked ? '' : undefined,
'wpStarttime': form.wpStarttime.value,
'wpEdittime': form.wpEdittime.value,
'wpAutoSummary': form.wpAutoSummary.value,
'wpEditToken': form.wpEditToken.value,
'wpSection': '',
'wpSummary': "报告:页面\[\[" + wgPageName + "\]\]关注度不足" + FriendlyConfig.summaryAd,
'wpTextbox1': text
};
self.post( postData );
}
}
friendlytag.callback.evaluate = function friendlytagCallbackEvaluate(e) {
var form = e.target;
if( isRedirect ) {
var tags = form.getChecked( 'commonredir' ).concat( form.getChecked( 'rareredir' ) ).concat( form.getChecked( 'littleredir' ) );
} else {
if( typeof( FriendlyConfig.customTagList ) == 'object' ) {
var tags = form.getChecked( 'notice' ).concat( form.getChecked( 'problem' ) ).concat( form.getChecked( 'maintenance' ) ).concat( form.getChecked( 'custom' ) );
} else {
var tags = form.getChecked( 'notice' ).concat( form.getChecked( 'problem' ) ).concat( form.getChecked( 'maintenance' ) );
}
var notabilitySubcategory = form.getChecked( 'problem.notability' );
var currentSubcategory = form.getChecked( 'notice.current' );
var futureSubcategory = form.getChecked( 'notice.future' );
}
var params;
if( tags.length == 0 ) {
alert( '你必须至少选择一个标签' );
return;
}
if( !isRedirect ) {
params = {
tags: tags,
group: form.group.checked,
notabilitySubcategory: notabilitySubcategory ? notabilitySubcategory[0] : null,
currentSubcategory: currentSubcategory ? currentSubcategory[0] : null,
futureSubcategory: futureSubcategory ? futureSubcategory[0] : null,
rcid: QueryString.exists( 'rcid' ) ? QueryString.get( 'rcid' ) : ''
}
} else {
params = {
tags: tags,
rcid: QueryString.exists( 'rcid' ) ? QueryString.get( 'rcid' ) : ''
}
}
Status.init( form );
var query = {
'title': wgPageName,
'action': 'submit'
};
Wikipedia.actionCompleted.redirect = wgPageName;
Wikipedia.actionCompleted.notice = "完成";
var wikipedia_wiki = new Wikipedia.wiki( '条目修改', query, friendlytag.callbacks.main );
wikipedia_wiki.params = params;
wikipedia_wiki.get();
}
// </nowiki>