User:Tommyang/Script/Friendly.js
外观
注意:保存之后,你必须清除浏览器缓存才能看到做出的更改。Google Chrome、Firefox、Microsoft Edge及Safari:按住⇧ Shift键并单击工具栏的“刷新”按钮。参阅Help:绕过浏览器缓存以获取更多帮助。
var twinkleConfigExists=false;if(userIsInGroup('sysop')||twUserIsWhitelisted()){twinkleConfigExists=true;}
function twUserIsWhitelisted(){return userIsInGroup('autoconfirmed')||userIsInGroup('confirmed');}
if(typeof(FriendlyConfig)=='undefined')FriendlyConfig={};switch(skin)
{case'vector':if(typeof(FriendlyConfig.portletArea)=='undefined')FriendlyConfig.portletArea='right-navigation';if(typeof(FriendlyConfig.portletId)=='undefined')FriendlyConfig.portletId='p-friendly';if(typeof(FriendlyConfig.portletName)=='undefined')FriendlyConfig.portletName='F';if(typeof(FriendlyConfig.portletType)=='undefined')FriendlyConfig.portletType='menu';if(typeof(FriendlyConfig.portletNext)=='undefined')FriendlyConfig.portletNext='p-search';break;default:if(typeof(FriendlyConfig.portletId)=='undefined')FriendlyConfig.portletId='p-cactions';break;}
function twAddPortlet(navigation,id,text,type,nextnodeid)
{var root=document.getElementById(navigation);if(!root)return null;var item=document.getElementById(id);if(item)
{if(item.parentNode&&item.parentNode==root)return item;return null;}
var nextnode;if(nextnodeid)nextnode=document.getElementById(nextnodeid);type=skin=="vector"&&type=="menu"&&(navigation=="left-navigation"||navigation=="right-navigation")?"menu":"";var outerDivClass;var innerDivClass;switch(skin)
{case"vector":if(navigation!="portal"&&navigation!="left-navigation"&&navigation!="right-navigation")navigation="panel";outerDivClass=navigation=="panel"?"portal":(type=="menu"?"vectorMenu extraMenu":"vectorTabs extraMenu");innerDivClass=navigation=="panel"?'body':(type=='menu'?'menu':'');break;case"modern":if(navigation!="mw_portlets"&&navigation!="mw_contentwrapper")navigation="mw_portlets";outerDivClass="portlet";innerDivClass="pBody";break;default:navigation="column-one";outerDivClass="portlet";innerDivClass="pBody";break;}
var outerDiv=document.createElement('div');outerDiv.className=outerDivClass+" emptyPortlet";outerDiv.id=id;var nextnode;if(nextnode&&nextnode.parentNode==root)root.insertBefore(outerDiv,nextnode);else root.appendChild(outerDiv);var h5=document.createElement('h5');if(type=='menu')
{var span=document.createElement('span');span.appendChild(document.createTextNode(text));h5.appendChild(span);var a=document.createElement('a');a.href="#";var span=document.createElement('span');span.appendChild(document.createTextNode(text));a.appendChild(span);h5.appendChild(a);}
else h5.appendChild(document.createTextNode(text));outerDiv.appendChild(h5);var innerDiv=document.createElement('div');innerDiv.className=innerDivClass;outerDiv.appendChild(innerDiv);var ul=document.createElement('ul');innerDiv.appendChild(ul);return outerDiv;}
function twAddPortletLink(href,text,id,tooltip,accesskey,nextnode)
{if(FriendlyConfig.portletArea)twAddPortlet(FriendlyConfig.portletArea,FriendlyConfig.portletId,FriendlyConfig.portletName,FriendlyConfig.portletType,FriendlyConfig.portletNext);addPortletLink(FriendlyConfig.portletId,href,text,id,tooltip,accesskey,nextnode);}
Cookies={create:function(name,value,max_age,path){if(Cookies.exists(name)){throw"cookie "+name+" already exists";}
Cookies.set(name,value,max_age,path);},set:function(name,value,max_age,path){var cookie=name+"="+encodeURIComponent(value);if(max_age){cookie+="; max-age="+max_age;}
cookie+="; path="+path||"/";document.cookie=cookie;},read:function(name){var cookies=document.cookie.split(";");for(var i=0;i<cookies.length;++i){var current=cookies[i];current=current.trim();if(current.indexOf(name+"=")==0){return decodeURIComponent(current.substring(name.length+1));}}
return null;},exists:function(name){var re=new RegExp(";\\s*"+name+"=");return re.test(document.cookie);},remove:function(name){Cookies.set(name,'',-1);}}
QuickForm=function QuickForm(event,eventType){this.root=new QuickForm.element({type:'form',event:event,eventType:eventType});var cssNode=document.createElement('style');cssNode.type='text/css';cssNode.rel='stylesheet';cssNode.appendChild(document.createTextNode(""));document.getElementsByTagName("head")[0].appendChild(cssNode);var styles=cssNode.sheet?cssNode.sheet:cssNode.stylesSheet;styles.insertRule("form.quickform { width: 96%; margin:auto; padding: .5em; vertical-align: middle}",0);styles.insertRule("form.quickform * { font-family: sans-serif; vertical-align: middle}",0);styles.insertRule("form.quickform select { width: 30em; border: 1px solid gray; font-size: 1.1em}",0);styles.insertRule("form.quickform h5 { border-top: 1px solid gray;}",0);styles.insertRule("form.quickform textarea { width: 100%; height: 6em }",0);styles.insertRule("form.quickform .tooltipButtonContainer { position: relative; width: 100%; }",0);styles.insertRule("form.quickform .tooltipButton { padding: .2em; color: blue; font-weight: bold; cursor:help;}",0);styles.insertRule(".quickformtooltip { z-index: 200; position: absolute; padding: .1em; border: 1px dotted red; background-color: Linen; font: caption; font-size: 10pt; max-width: 800px}",0);}
QuickForm.prototype.render=function QuickFormRender(){var ret=this.root.render();ret.names={};return ret;}
QuickForm.prototype.append=function QuickFormAppend(data){return this.root.append(data);}
QuickForm.element=function QuickFormElement(data){this.data=data;this.childs=[];this.id=QuickForm.element.id++;}
QuickForm.element.id=0;QuickForm.element.prototype.append=function QuickFormElementAppend(data){if(data instanceof QuickForm.element){var child=data;}else{var child=new QuickForm.element(data);}
this.childs.push(child);return child;}
QuickForm.element.prototype.render=function QuickFormElementRender(){var currentNode=this.compute(this.data);for(var i=0;i<this.childs.length;++i){currentNode[1].appendChild(this.childs[i].render());}
return currentNode[0];}
QuickForm.element.prototype.compute=function QuickFormElementCompute(data,in_id){var node;var childContainder=null;var label;var id=(in_id?in_id+'_':'')+'node_'+this.id;if(data.adminonly&&!userIsInGroup('sysop')){data.type=hidden;}
switch(data.type){case'form':node=document.createElement('form');node.setAttribute('name','id');node.className="quickform";node.setAttribute('action','javascript:void(0);');if(data.event){node.addEventListener(data.eventType||'submit',data.event,false);}
break;case'select':node=document.createElement('div');node.setAttribute('id','div_'+id);if(data.label){label=node.appendChild(document.createElement('label'));label.setAttribute('for',id);label.appendChild(document.createTextNode(data.label));}
var select=node.appendChild(document.createElement('select'));if(data.event){select.addEventListener('change',data.event,false);}
if(data.multiple){select.setAttribute('multiple','multiple');}
if(data.size){select.setAttribute('size',data.size);}
select.setAttribute('name',data.name);if(data.list){for(var i=0;i<data.list.length;++i){var current=data.list[i];if(current.list){current.type='optgroup';}else{current.type='option';}
var res=this.compute(current);select.appendChild(res[0]);}}
childContainder=select;break;case'option':node=document.createElement('option');node.values=data.value;node.setAttribute('value',data.value);if(data.selected){node.setAttribute('selected','selected');}
if(data.disabled){node.setAttribute('disabled','disabled');}
node.setAttribute('label',data.label);node.appendChild(document.createTextNode(data.label));break;case'optgroup':node=document.createElement('optgroup');node.setAttribute('label',data.label);if(data.list){for(var i=0;i<data.list.length;++i){var current=data.list[i];current.type='option';var res=this.compute(current);node.appendChild(res[0]);}}
break;case'field':node=document.createElement('fieldset');label=node.appendChild(document.createElement('legend'));label.appendChild(document.createTextNode(data.label));if(data.name){node.setAttribute('name',data.name);}
break;case'checkbox':case'radio':node=document.createElement('div');if(data.list){for(var i=0;i<data.list.length;++i){var cur_id=id+'_'+i;var current=data.list[i];if(current.type=='header'){cur_node=node.appendChild(document.createElement('h6'));cur_node.appendChild(document.createTextNode(current.label));if(current.tooltip){QuickForm.element.generateTooltip(cur_node,current);}
continue;}
cur_node=node.appendChild(document.createElement('div'));var input=cur_node.appendChild(document.createElement('input'));input.values=current.value;input.setAttribute('value',current.value);input.setAttribute('name',current.name||data.name);input.setAttribute('type',data.type);input.setAttribute('id',cur_id);if(current.checked){input.setAttribute('checked','checked');}
if(current.disabled){input.setAttribute('disabled','disabled');}
if(data.event){input.addEventListener('change',data.event,false);}else if(current.event){input.addEventListener('change',current.event,true);}
var label=cur_node.appendChild(document.createElement('label'));label.appendChild(document.createTextNode(current.label));label.setAttribute('for',cur_id);if(current.tooltip){QuickForm.element.generateTooltip(label,current);}
if(current.subgroup){var tmpgroup=current.subgroup;if(!tmpgroup.type){tmpgroup.type=data.type;}
tmpgroup.name=(current.name||data.name)+'.'+tmpgroup.name;var subgroup=this.compute(current.subgroup,cur_id)[0];subgroup.style.marginLeft='3em';input.subgroup=subgroup;input.shown=false;var event=function(e){if(e.target.checked){e.target.parentNode.appendChild(e.target.subgroup);if(e.target.type=='radio'){var name=e.target.name;if(typeof(e.target.form.names[name])!='undefined'){e.target.form.names[name].parentNode.removeChild(e.target.form.names[name].subgroup);}
e.target.form.names[name]=e.target;}}else{e.target.parentNode.removeChild(e.target.subgroup);}}
input.addEventListener('change',event,true);if(current.checked){input.parentNode.appendChild(subgroup);}}else if(data.type=='radio'){var event=function(e){if(e.target.checked){var name=e.target.name;if(typeof(e.target.form.names[name])!='undefined'){e.target.form.names[name].parentNode.removeChild(e.target.form.names[name].subgroup);}
delete e.target.form.names[name];}}
input.addEventListener('change',event,true);}}}
break;case'input':node=document.createElement('div');if(data.label){label=node.appendChild(document.createElement('label'));label.appendChild(document.createTextNode(data.label));label.setAttribute('for',id);}
var input=node.appendChild(document.createElement('input'));if(data.value){input.setAttribute('value',data.value);}
input.setAttribute('name',data.name);input.setAttribute('type','text');if(data.size){input.setAttribute('size',data.size);}
if(data.disabled){input.setAttribute('disabled','disabled');}
if(data.readonly){input.setAttribute('readonly','readonly');}
if(data.maxlength){input.setAttribute('maxlength',data.maxlength);}
if(data.event){input.addEventListener('keyup',data.event,false);}
break;case'dyninput':var min=data.min||1;var max=data.max||Infinity;node=document.createElement('div');label=node.appendChild(document.createElement('h5'));label.appendChild(document.createTextNode(data.label));var listNode=node.appendChild(document.createElement('div'));var more=this.compute({type:'button',label:'more',disabled:min>=max,event:function(e){var area=e.target.area;var new_node=new QuickForm.element(e.target.sublist);e.target.area.appendChild(new_node.render());if(++e.target.counter>=e.target.max){e.target.setAttribute('disabled','disabled');}
e.stopPropagation();}});node.appendChild(more[0]);moreButton=more[1];var sublist={type:'_dyninput_element',label:data.sublabel||data.label,name:data.name,value:data.value,size:data.size,remove:false,maxlength:data.maxlength,event:data.event}
for(var i=0;i<min;++i){var elem=new QuickForm.element(sublist);listNode.appendChild(elem.render());}
sublist.remove=true;sublist.morebutton=moreButton;sublist.listnode=listNode;moreButton.sublist=sublist;moreButton.area=listNode;moreButton.max=max-min;moreButton.counter=0;break;case'_dyninput_element':node=document.createElement('div');if(data.label){label=node.appendChild(document.createElement('label'));label.appendChild(document.createTextNode(data.label));label.setAttribute('for',id);}
var input=node.appendChild(document.createElement('input'));if(data.value){input.setAttribute('value',data.value);}
input.setAttribute('name',data.name);input.setAttribute('type','text');if(data.size){input.setAttribute('size',data.size);}
if(data.maxlength){input.setAttribute('maxlength',data.maxlength);}
if(data.event){input.addEventListener('keyup',data.event,false);}
if(data.remove){var remove=this.compute({type:'button',label:'remove',event:function(e){var list=e.target.listnode;var node=e.target.inputnode;var more=e.target.morebutton;list.removeChild(node);--more.counter;more.removeAttribute('disabled');e.stopPropagation();}});node.appendChild(remove[0]);removeButton=remove[1];removeButton.inputnode=node;removeButton.listnode=data.listnode;removeButton.morebutton=data.morebutton;}
break;case'hidden':var node=document.createElement('input');node.setAttribute('type','hidden');node.values=data.value;node.setAttribute('value',data.value);node.setAttribute('name',data.name);break;case'header':node=document.createElement('h5');node.appendChild(document.createTextNode(data.label));break;case'div':node=document.createElement('div');break;case'submit':node=document.createElement('span');childContainder=node.appendChild(document.createElement('input'));childContainder.setAttribute('type','submit');if(data.label){childContainder.setAttribute('value',data.label);}
childContainder.setAttribute('name',data.name||'submit');if(data.disabled){childContainder.setAttribute('disabled','disabled');}
break;case'button':node=document.createElement('span');childContainder=node.appendChild(document.createElement('input'));childContainder.setAttribute('type','button');if(data.label){childContainder.setAttribute('value',data.label);}
childContainder.setAttribute('name',data.name);if(data.disabled){childContainder.setAttribute('disabled','disabled');}
if(data.event){childContainder.addEventListener('click',data.event,false);}
break;case'textarea':node=document.createElement('div');if(data.label){label=node.appendChild(document.createElement('h5'));label.appendChild(document.createTextNode(data.label));label.setAttribute('for',id);}
node.appendChild(document.createElement('br'));textarea=node.appendChild(document.createElement('textarea'));textarea.setAttribute('name',data.name);if(data.cols){textarea.setAttribute('cols',data.cols);}
if(data.rows){textarea.setAttribute('rows',data.rows);}
if(data.disabled){textarea.setAttribute('disabled','disabled');}
if(data.readonly){textarea.setAttribute('readonly','readonly');}
if(data.value){textarea.value=data.value;}
break;}
if(childContainder==null){childContainder=node;}
if(data.tooltip){QuickForm.element.generateTooltip(label||node,data);}
if(data.extra){childContainder.extra=extra;}
childContainder.setAttribute('id',data.id||id);return[node,childContainder];}
QuickForm.element.generateTooltip=function QuickFormElementGenerateTooltip(node,data){var tooltipButtonContainer=node.appendChild(document.createElement('span'));tooltipButtonContainer.className='tooltipButtonContainer';var tooltipButton=tooltipButtonContainer.appendChild(document.createElement('span'));tooltipButton.className='tooltipButton';tooltipButton.appendChild(document.createTextNode('?'));var tooltip=document.createElement('div');tooltip.className='quickformtooltip';tooltip.appendChild(document.createTextNode(data.tooltip));tooltipButton.tooltip=tooltip;tooltipButton.showing=false;tooltipButton.interval=null;tooltipButton.addEventListener('mouseover',QuickForm.element.generateTooltip.display,false);tooltipButton.addEventListener('mouseout',QuickForm.element.generateTooltip.fade,false);}
QuickForm.element.generateTooltip.display=function QuickFormElementGenerateTooltipDisplay(e){window.clearInterval(e.target.interval);e.target.tooltip.style.setProperty('-moz-opacity',1,null);e.target.tooltip.style.setProperty('opacity',1,null);e.target.tooltip.style.left=(e.pageX-e.layerX+24)+"px";e.target.tooltip.style.top=(e.pageY-e.layerY+12)+"px";document.body.appendChild(e.target.tooltip);e.target.showing=true;}
QuickForm.element.generateTooltip.fade=function QuickFormElementGenerateTooltipFade(e){e.target.opacity=1.2;e.target.interval=window.setInterval(function(e){e.target.tooltip.style.setProperty('-moz-opacity',e.target.opacity,null);e.target.tooltip.style.setProperty('opacity',e.target.opacity,null);e.target.opacity-=0.1;if(e.target.opacity<=0){window.clearInterval(e.target.interval);document.body.removeChild(e.target.tooltip);e.target.showing=false;}},50,e);}
HTMLFormElement.prototype.getChecked=function(name,type){var elements=this.elements[name];if(!elements){return null;}
var return_array=[];if(elements instanceof HTMLSelectElement){var options=elements.options;for(var i=0;i<options.length;++i){if(options[i].selected){if(options[i].values){return_array.push(options[i].values);}else{return_array.push(options[i].value);}}}}else if(elements instanceof HTMLInputElement){if(type!=null&&elements.type!=type){return[];}else if(elements.checked){return[elements.value];}}else{for(var i=0;i<elements.length;++i){if(elements[i].checked){if(type!=null&&elements[i].type!=type){continue;}
if(elements[i].values){return_array.push(elements[i].values);}else{return_array.push(elements[i].value);}}}}
return return_array;}
HTMLFormElement.prototype.getTexts=function(name,type){type==type||'text';var elements=this.elements[name];if(!elements){return null;}
var return_array=[];for(var i=0;i<elements.length;++i){if(elements[i].value!=''){return_array.push(elements[i].value);}}
return return_array;}
RegExp.escape=function(text,space_fix){if(!arguments.callee.sRE){arguments.callee.sRE=/(\/|\.|\*|\+|\?|\||\(|\)|\[|\]|\{|\}|\\|\$|\^)/g;}
text=text.replace(arguments.callee.sRE,'\\$1');if(space_fix){text=text.replace(/ |_/g,'[_ ]');}
return text;}
function sprintf(){if(arguments.length==0){throw"Not enough arguments for sprintf";}
var result="";var format=arguments[0];var index=1;var current_index=1;var flags={};var in_operator=false;var relative=false;var precision=false;var fixed=false;var vector=false;var vector_delimiter='.';for(var i=0;i<format.length;++i){var current_char=format.charAt(i);if(in_operator){switch(current_char){case'i':current_char='d';break;case'F':current_char='f';break;case'%':case'c':case's':case'd':case'u':case'o':case'x':case'e':case'f':case'g':case'X':case'E':case'G':case'b':var value=arguments[current_index];if(vector){r=value.toString().split('');result+=value.toString().split('').map(function(value){return sprintf.format(current_char,value.charCodeAt(),flags);}).join(vector_delimiter);}else{result+=sprintf.format(current_char,value,flags);}
if(!fixed){++index;}
current_index=index;flags={};relative=false;in_operator=false;precision=false;fixed=false;vector=false;vector_delimiter='.';break;case'v':vector=true;break;case' ':case'0':case'-':case'+':case'#':flags[current_char]=true;break;case'*':relative=true;break;case'.':precision=true;break;}
if(/\d/.test(current_char)){var num=parseInt(format.substr(i));var len=num.toString().length;i+=len-1;var next=format.charAt(i+1);if(next=='$'){if(num<=0||num>=arguments.length){throw"out of bound";}
if(relative){if(precision){flags['precision']=arguments[num];precision=false;}else if(format.charAt(i+2)=='v'){vector_delimiter=arguments[num];}else{flags['width']=arguments[num];}
relative=false;}else{fixed=true;current_index=num;}
++i;}else if(precision){flags['precision']=num;precision=false;}else{flags['width']=num;}}else if(relative&&!/\d/.test(format.charAt(i+1))){if(precision){flags['precision']=arguments[current_index];precision=false;}else if(format.charAt(i+1)=='v'){vector_delimiter=arguments[current_index];}else{flags['width']=arguments[current_index];}
++index;if(!fixed){current_index++;}
relative=false;}}else{if(current_char=='%'){in_operator=true;continue;}else{result+=current_char;continue;}}}
return result;}
sprintf.format=function sprintfFormat(type,value,flags){if(value==undefined){if(type=='s'){return'';}else{return'0';}}
var result;var prefix='';var fill='';var fillchar=' ';switch(type){case'%':result='%';break;case'c':result=String.fromCharCode(parseInt(value));break;case's':result=value.toString();break;case'd':result=parseInt(value).toString();break;case'u':result=Math.abs(parseInt(value)).toString();break;case'o':result=(new Number(Math.abs(parseInt(value)))).toString(8);break;case'x':result=(new Number(Math.abs(parseInt(value)))).toString(16);break;case'b':result=(new Number(Math.abs(parseInt(value)))).toString(2);break;case'e':var digits=flags['precision']?flags['precision']:6;result=(new Number(value)).toExponential(digits).toString();break;case'f':var digits=flags['precision']?flags['precision']:6;result=(new Number(value)).toFixed(digits).toString();case'g':var digits=flags['precision']?flags['precision']:6;result=(new Number(value)).toPrecision(digits).toString();break;case'X':result=(new Number(Math.abs(parseInt(value)))).toString(16).toUpperCase();break;case'E':var digits=flags['precision']?flags['precision']:6;result=(new Number(value)).toExponential(digits).toString().toUpperCase();break;case'G':var digits=flags['precision']?flags['precision']:6;result=(new Number(value)).toPrecision(digits).toString().toUpperCase();break;}
if(flags['+']&&parseFloat(value)>0&&['d','e','f','g','E','G'].indexOf(type)!=-1){prefix='+';}
if(flags[' ']&&parseFloat(value)>0&&['d','e','f','g','E','G'].indexOf(type)!=-1){prefix=' ';}
if(flags['#']&&parseInt(value)!=0){switch(type){case'o':prefix='0';break;case'x':case'X':prefix='0x';break;case'b':prefix='0b';break;}}
if(flags['0']&&!flags['-']){fillchar='0';}
if(flags['width']&&flags['width']>(result.length+prefix.length)){var tofill=flags['width']-result.length-prefix.length;for(var i=0;i<tofill;++i){fill+=fillchar;}}
if(flags['-']&&!flags['0']){result+=fill;}else{result=fill+result;}
return prefix+result;}
Bytes=function(value){if(typeof(value)=='string'){var res=/(\d+) ?(\w?)(i?)B?/.exec(value);var number=res[1];var mag=res[2];var si=res[3];if(!number){this.number=0;return;}
if(!si){this.value=number*Math.pow(10,Bytes.magnitudes[mag]*3);}else{this.value=number*Math.pow(2,Bytes.magnitudes[mag]*10);}}else{this.value=value;}}
Bytes.magnitudes={'':0,'K':1,'M':2,'G':3,'T':4,'P':5,'E':6,'Z':7,'Y':8}
Bytes.rmagnitudes={0:'',1:'K',2:'M',3:'G',4:'T',5:'P',6:'E',7:'Z',8:'Y'}
Bytes.prototype.valueOf=function(){return this.value;}
Bytes.prototype.toString=function(magnitude){var tmp=this.value;if(magnitude){var si=/i/.test(magnitude);var mag=magnitude.replace(/.*?(\w)i?B?.*/g,'$1');if(si){tmp/=Math.pow(2,Bytes.magnitudes[mag]*10);}else{tmp/=Math.pow(10,Bytes.magnitudes[mag]*3);}
if(parseInt(tmp)!=tmp){tmp=(new Number(tmp)).toPrecision(4);}
return tmp+' '+mag+(si?'i':'')+'B';}else{var current=0;while(tmp>=1024){tmp/=1024;++current;}
tmp=this.value/Math.pow(2,current*10);if(parseInt(tmp)!=tmp){tmp=(new Number(tmp)).toPrecision(4);}
return tmp+' '+Bytes.rmagnitudes[current]+(current>0?'iB':'B');}}
String.prototype.ltrim=function stringPrototypeLtrim(chars){chars=chars||"\\s*";return this.replace(new RegExp("^["+chars+"]+","g"),"");}
String.prototype.rtrim=function stringPrototypeRtrim(chars){chars=chars||"\\s*";return this.replace(new RegExp("["+chars+"]+$","g"),"");}
String.prototype.trim=function stringPrototypeTrim(chars){return this.rtrim(chars).ltrim(chars);}
String.prototype.splitWeightedByKeys=function stringPrototypeSplitWeightedByKeys(start,end,skip){if(start.length!=end.length){throw'start marker and end marker must be of the same length';}
var level=0;var initial=null;var result=[];if(!(skip instanceof Array)){if(typeof(skip)=='undefined'){skip=[];}else if(typeof(skip)=='string'){skip=[skip];}else{throw"non-applicable skip parameter";}}
for(var i=0;i<this.length;++i){for(var j=0;j<skip.length;++j){if(this.substr(i,skip[j].length)==skip[j]){i+=skip[j].length-1;continue;}}
if(this.substr(i,start.length)==start){if(initial==null){initial=i;}
++level;i+=start.length-1;}else if(this.substr(i,end.length)==end){--level;i+=end.length-1;}
if(level==0&&initial!=null){result.push(this.substring(initial,i+1));initial=null;}}
return result;}
Array.prototype.uniq=function arrayPrototypeUniq(){var result=[];for(var i=0;i<this.length;++i){var current=this[i];if(result.indexOf(current)==-1){result.push(current);}}
return result;}
Array.prototype.dups=function arrayPrototypeUniq(){var uniques=[];var result=[];for(var i=0;i<this.length;++i){var current=this[i];if(uniques.indexOf(current)==-1){uniques.push(current);}else{result.push(current);}}
return result;}
Array.prototype.chunk=function arrayChunk(size){if(typeof(size)!='number'||size<=0){return[this];}
var result=[];var current;for(var i=0;i<this.length;++i){if(i%size==0){current=[];result.push(current);}
current.push(this[i]);}
return result;}
Unbinder=function unbinder(string){if(typeof(string)!='string'){throw"not a string";}
this.content=string;this.counter=0;this.history={};this.prefix='%UNIQ::'+Math.random()+'::';this.postfix='::UNIQ%';}
Unbinder.prototype={unbind:function UnbinderUnbind(prefix,postfix){var re=new RegExp(prefix+'(.*?)'+postfix,'g');this.content=this.content.replace(re,Unbinder.getCallback(this));},rebind:function UnbinderRebind(){var content=this.content;content.self=this;for(var current in this.history)
if(this.history.hasOwnProperty(current))
content=content.replace(current,this.history[current]);return content;},prefix:null,postfix:null,content:null,counter:null,history:null};Unbinder.getCallback=function UnbinderGetCallback(self){return function UnbinderCallback(match,a,b){var current=self.prefix+self.counter+self.postfix;self.history[current]=match;++self.counter;return current;};};function clone(obj,deep){var objectClone=new obj.constructor();for(var property in obj)
if(!deep){objectClone[property]=obj[property];}
else if(typeof obj[property]=='object'){objectClone[property]=clone(obj[property],deep);}
else{objectClone[property]=obj[property];}
return objectClone;}
namespaces={'-2':'Media','-1':'Special','0':'','1':'Talk','2':'User','3':'User_talk','4':'Project','5':'Project talk','6':'Image','7':'Image talk','8':'MediaWiki','9':'MediaWiki talk','10':'Template','11':'Template talk','12':'Help','13':'Help talk','14':'Category','15':'Category talk','100':'Portal','101':'Portal talk'};function ln(ns,title){var ns2ln={'0':'la','1':'lat','2':'lu','3':'lut','4':'lw','5':'lwt','6':'li','7':'lit','8':'lm','9':'lmt','10':'lt','11':'ltt','12':'lh','13':'lht','14':'lc','15':'lct','100':'lp','101':'lpt'};return"\{\{"+ns2ln[ns]+"|"+title+"\}\}";}
Namespace={MAIN:0,TALK:1,USER:2,USER_TALK:3,PROJECT:4,PROJECT_TALK:5,IMAGE:6,IMAGE_TALK:7,FILE:6,FILE_TALK:7,MEDIAWIKI:8,MEDIAWIKI_TALK:9,TEMPLATE:10,TEMPLATE_TALK:11,HELP:12,HELP_TALK:13,CATEGORY:14,CATEGORY_TALK:15,PORTAL:100,PORTAL_TALK:101,MEDIA:-2,SPECIAL:-1,"":0,WIKIPEDIA:4,WIKIPEDIA_TALK:5,WP:4,WT:5};String.prototype.toUpperCaseFirstChar=function(){return this.substr(0,1).toUpperCase()+this.substr(1);}
String.prototype.toLowerCaseFirstChar=function(){return this.substr(0,1).toLowerCase()+this.substr(1);}
String.prototype.toUpperCaseEachWord=function(delim){delim=delim?delim:' ';return this.split(delim).map(function(v){return v.toUpperCaseFirstChar()}).join(delim);}
String.prototype.toLowerCaseEachWord=function(delim){delim=delim?delim:' ';return this.split(delim).map(function(v){return v.toLowerCaseFirstChar()}).join(delim);}
Date.monthNames=['January','February','March','April','May','June','July','August','September','October','November','December'];Date.monthNamesAbbrev=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'];Date.prototype.getMonthName=function(){return Date.monthNames[this.getMonth()];}
Date.prototype.getMonthNameAbbrev=function(){return Date.monthNamesAbbrev[this.getMonth()];}
Date.prototype.getUTCMonthName=function(){return Date.monthNames[this.getUTCMonth()];}
Date.prototype.getUTCMonthNameAbbrev=function(){return Date.monthNamesAbbrev[this.getUTCMonth()];}
Wikipedia={};Wikipedia.dump=[];Wikipedia.numberOfActionsLeft=0;Wikipedia.nbrOfCheckpointsLeft=0;Wikipedia.actionCompleted=function(self){if(--Wikipedia.numberOfActionsLeft<=0&&Wikipedia.nbrOfCheckpointsLeft<=0){Wikipedia.actionCompleted.event(self);}}
Wikipedia.actionCompleted.event=function(){new Status(Wikipedia.actionCompleted.notice,Wikipedia.actionCompleted.postfix,'info');if(Wikipedia.actionCompleted.redirect!=null){if(!/^\w+\:\/\//.test(Wikipedia.actionCompleted.redirect)){Wikipedia.actionCompleted.redirect=mw.config.get('wgServer')+mw.config.get('wgArticlePath').replace('$1',encodeURIComponent(Wikipedia.actionCompleted.redirect).replace(/\%2F/g,'/'))+"?redirect=no";}
window.setTimeout(function(){window.location=Wikipedia.actionCompleted.redirect},Wikipedia.actionCompleted.timeOut);}}
wpActionCompletedTimeOut=typeof(wpActionCompletedTimeOut)=='undefined'?5000:wpActionCompletedTimeOut;wpMaxLag=typeof(wpMaxLag)=='undefined'?10:wpMaxLag;Wikipedia.editCount=10;Wikipedia.actionCompleted.timeOut=wpActionCompletedTimeOut;Wikipedia.actionCompleted.redirect=null;Wikipedia.actionCompleted.notice='操作';Wikipedia.actionCompleted.postfix='完成';Wikipedia.addCheckpoint=function(){++Wikipedia.nbrOfCheckpointsLeft;}
Wikipedia.removeCheckpoint=function(){if(--Wikipedia.nbrOfCheckpointsLeft<=0&&Wikipedia.numberOfActionsLeft<=0){Wikipedia.actionCompleted.event();}}
Wikipedia.api=function(currentAction,query,oninit,statelem){this.currentAction=currentAction;this.query=query;this.query['format']='xml';this.oninit=oninit;if(statelem){statelem.status(currentAction)}else{this.statelem=new Status(currentAction);}
++Wikipedia.numberOfActionsLeft;}
Wikipedia.api.prototype={currentAction:'',oninit:null,query:null,responseXML:null,statelem:null,counter:0,post:function(){var xmlhttp=sajax_init_object();Wikipedia.dump.push(xmlhttp);xmlhttp.obj=this;xmlhttp.overrideMimeType('text/xml');xmlhttp.open('POST',mw.config.get('wgServer')+mw.config.get('wgScriptPath')+'/api.php',true);xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded');xmlhttp.onerror=function(){this.obj.statelem.error("在API查询时发生了错误"+this.target.status);}
xmlhttp.onload=function(){this.obj.responseXML=this.responseXML;if(this.obj.oninit){this.obj.oninit(this.obj);}
Wikipedia.actionCompleted();};xmlhttp.send(QueryString.create(this.query));}}
Wikipedia.wiki=function(currentAction,query,oninit,onsuccess,onerror,onretry){this.currentAction=currentAction;this.query=query;this.oninit=oninit;this.onsuccess=onsuccess;this.onerror=onerror;this.onretry=onretry;this.statelem=new Status(currentAction);++Wikipedia.numberOfActionsLeft;}
Wikipedia.wiki.prototype={currentAction:'',onsuccess:null,onerror:null,onretry:null,oninit:null,query:null,postData:null,responseXML:null,statelem:null,counter:0,post:function(data){this.postData=data;if(Wikipedia.editCount<=0){this.query['maxlag']=wpMaxLag;}else{--Wikipedia.editCount;}
var xmlhttp=sajax_init_object();Wikipedia.dump.push(xmlhttp);xmlhttp.obj=this;xmlhttp.overrideMimeType('text/xml');xmlhttp.open('POST',mw.config.get('wgServer')+mw.config.get('wgScriptPath')+'/index.php?useskin=monobook&uselang=xxx&'+QueryString.create(this.query),true);xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded');xmlhttp.onerror=function(e){var self=this.obj;self.statelem.error("在POST页面时发生了错误"+e.target.status);}
xmlhttp.onload=function(e){var self=this.obj;var status=e.target.status;if(status!=200){if(status==503){var retry=e.target.getResponseHeader('Retry-After');var lag=e.target.getResponseHeader('X-Database-Lag');if(lag){self.statelem.warn("当前的延迟"+lag+"秒超过了定义的最大延迟"+wpMaxLag+"秒,将在"+retry+" 秒后重试");window.setTimeout(function(self){self.post(self.postData);},retry*1000,self);return;}else{self.statelem.error("在POST页面时发生了错误"+status);}}
return;}
var xmlDoc;xmlDoc=self.responseXML=this.responseXML;var xpathExpr='boolean(//div[@class=\'previewnote\']/p/strong[contains(.,\'抱歉!我们不能处理你在进程数据丢失时的编辑。请重试。如果再次失败,请登出后重新登陆。\')])';var nosession=xmlDoc.evaluate(xpathExpr,xmlDoc,null,XPathResult.BOOLEAN_TYPE,null).booleanValue;if(nosession){var new_token=xmlDoc.evaluate('//input[@name="wfEditToken"]/@value',xmlDoc,null,XPathResult.STRING_TYPE,null).stringValue;self.postData['wfEditToken']=new_token;self.post(self.postData);}else{if(self.onsuccess){self.onsuccess(self);}else{var link=document.createElement('a');link.setAttribute('href',wgArticlePath.replace('$1',self.query['title']));link.setAttribute('title',self.query['title']);link.appendChild(document.createTextNode(self.query['title']));self.statelem.info(['完成(',link,')']);}
Wikipedia.actionCompleted();}};xmlhttp.send(QueryString.create(this.postData));},get:function(){this.onloading(this);var redirect_query={'action':'query','titles':this.query['title'],'redirects':''}
var wikipedia_api=new Wikipedia.api("解释重定向",redirect_query,this.postget,this.statelem);wikipedia_api.parent=this;wikipedia_api.post();},postget:function(){var xmlDoc=self.responseXML=this.responseXML;var to=xmlDoc.evaluate('//redirects/r/@to',xmlDoc,null,XPathResult.STRING_TYPE,null).stringValue;if(!this.followRedirect){this.parent.statelem.info('忽略重定向');}else if(to){this.parent.query['title']=to;}
this.parent.onloading(this);var xmlhttp=sajax_init_object();Wikipedia.dump.push(xmlhttp);xmlhttp.obj=this.parent;xmlhttp.overrideMimeType('text/xml');xmlhttp.open('GET',mw.config.get('wgServer')+mw.config.get('wgScriptPath')+'/index.php?useskin=monobook&uselang=xxx&'+QueryString.create(this.parent.query),true);xmlhttp.onerror=function(){var self=this.obj;self.statelem.error("在接收数据时发生了错误"+this.status);}
xmlhttp.onload=function(){this.obj.onloaded(this.obj);this.obj.responseXML=this.responseXML;this.obj.responseText=this.responseText;this.obj.oninit(this.obj);};xmlhttp.send(null);},onloading:function(){this.statelem.status('加载数据...');},onloaded:function(){this.statelem.status('数据已加载...');}}
Number.prototype.zeroFill=function(length){var str=this.toFixed();if(!length){return str;}
while(str.length<length){str='0'+str;}
return str;}
Mediawiki={};Mediawiki.Template={parse:function(text,start){var count=-1;var level=-1;var equals=-1;var current='';var result={name:'',parameters:{}};for(var i=start;i<text.length;++i){var test3=text.substr(i,3);if(test3=='\{\{\{'){current+='\{\{\{';i+=2;++level;continue;}
if(test3=='\}\}\}'){current+='\}\}\}';i+=2;--level;continue;}
var test2=text.substr(i,2);if(test2=='\{\{'||test2=='\[\['){current+=test2;++i;++level;continue;}
if(test2=='\]\]'){current+=test2;++i;--level;continue;}
if(test2=='\}\}'){current+=test2;++i;--level;if(level<=0){if(count==-1){result.name=current.substring(2).trim();++count;}else{if(equals!=-1){var key=current.substring(0,equals).trim();var value=current.substring(equals).trim();result.parameters[key]=value;equals=-1;}else{result.parameters[count]=current;++count;}}
break;}
continue;}
if(text.charAt(i)=='|'&&level<=0){if(count==-1){result.name=current.substring(2).trim();++count;}else{if(equals!=-1){var key=current.substring(0,equals).trim();var value=current.substring(equals+1).trim();result.parameters[key]=value;equals=-1;}else{result.parameters[count]=current;++count;}}
current='';}else if(equals==-1&&text.charAt(i)=='='&&level<=0){equals=current.length;current+=text.charAt(i);}else{current+=text.charAt(i);}}
return result;}}
Mediawiki.Page=function mediawikiPage(text){this.text=text;}
Mediawiki.Page.prototype={text:'',removeLink:function(link_target){var first_char=link_target.substr(0,1);var link_re_string="["+first_char.toUpperCase()+first_char.toLowerCase()+']'+RegExp.escape(link_target.substr(1),true);var link_simple_re=new RegExp("\\[\\[("+link_re_string+")\\|?\\]\\]",'g');var link_named_re=new RegExp("\\[\\["+link_re_string+"\\|(.+?)\\]\\]",'g');if(link_simple_re.test(this.text)){this.text=this.text.replace(link_simple_re,"$1");}else{this.text=this.text.replace(link_named_re,"$1");}},commentOutImage:function(image,reason){var unbinder=new Unbinder(this.text);unbinder.unbind('<!--','-->');reason=reason?' '+reason+': ':'';var first_char=image.substr(0,1);var image_re_string="["+first_char.toUpperCase()+first_char.toLowerCase()+']'+RegExp.escape(image.substr(1),true);var links_re=new RegExp("\\[\\[(?:[Ii]mage|[Ff]ile):\\s*"+image_re_string);var allLinks=unbinder.content.splitWeightedByKeys('[[',']]').uniq();for(var i=0;i<allLinks.length;++i){if(links_re.test(allLinks[i])){var replacement='<!-- '+reason+allLinks[i]+' -->';unbinder.content=unbinder.content.replace(allLinks[i],replacement,'g');}}
unbinder.unbind('<!--','-->');var gallery_image_re=new RegExp("(^\\s*(?:[Ii]mage|[Ff]ile):\\s*"+image_re_string+".*?$)",'mg');unbinder.content.replace(gallery_image_re,"<!-- "+reason+"$1 -->");unbinder.unbind('<!--','-->');var free_image_re=new RegExp("(\\|\\s*(?:[\\w\\s]+\\=)?\\s*(?:(?:[Ii]mage|[Ff]ile):\\s*)?"+image_re_string+")",'mg');unbinder.content.replace(free_image_re,"<!-- "+reason+"$1 -->");this.text=unbinder.rebind();},addToImageComment:function(image,data){var first_char=image.substr(0,1);var image_re_string="(?:[Ii]mage|[Ff]ile):\\s*["+first_char.toUpperCase()+first_char.toLowerCase()+']'+RegExp.escape(image.substr(1),true);var links_re=new RegExp("\\[\\["+image_re_string);var allLinks=this.text.splitWeightedByKeys('[[',']]').uniq();for(var i=0;i<allLinks.length;++i){if(links_re.test(allLinks[i])){var replacement=allLinks[i];replacement=replacement.replace(/\]\]$/,'|'+data+']]');this.text=this.text.replace(allLinks[i],replacement,'g');}}
var gallery_re=new RegExp("^(\\s*"+image_re_string+'.*?)\\|?(.*?)$','mg');var replacement="$1|$2 "+data;this.text=this.text.replace(gallery_re,replacement);},removeTemplate:function(template){var first_char=template.substr(0,1);var template_re_string="(?:[Tt]emplate:)?\\s*["+first_char.toUpperCase()+first_char.toLowerCase()+']'+RegExp.escape(template.substr(1),true);var links_re=new RegExp("\\\{\\\{"+template_re_string);var allTemplates=this.text.splitWeightedByKeys('{\{','}}',['{{{','}}}']).uniq();for(var i=0;i<allTemplates.length;++i){if(links_re.test(allTemplates[i])){this.text=this.text.replace(allTemplates[i],'','g');}}},getText:function(){return this.text;}}
function userIsInGroup(group){return(wgUserGroups!=null&&wgUserGroups.indexOf(group)!=-1)||(wgUserGroups==null&&group=='anon');}
function userIsAnon(){return wgUserGroups==null;}
var AOLNetworks=[];var AOLClients=[];function isInNetwork(ipaddress,network){var iparr=ipaddress.split('.');var ip=(parseInt(iparr[0])<<24)+(parseInt(iparr[1])<<16)+(parseInt(iparr[2])<<8)+(parseInt(iparr[3]));var netmask=0xffffffff<<network.split('/')[1];var netarr=network.split('/')[0].split('.');var net=(parseInt(netarr[0])<<24)+(parseInt(netarr[1])<<16)+(parseInt(netarr[2])<<8)+(parseInt(netarr[3]));return(ip&netmask)==net;}
function isIPAddress(string){var res=/(\d{1,4})\.(\d{1,3})\.(\d{1,3})\.(\d{1,4})/.exec(string);return res!=null&&res.slice(1,5).every(function(e){return e<256;});}
function QueryString(qString){this.string=qString;this.params={};if(qString.length==0){return;}
qString.replace(/\+/,' ');var args=qString.split('&');for(var i=0;i<args.length;++i){var pair=args[i].split('=');var key=decodeURIComponent(pair[0]),value=key;if(pair.length==2){value=decodeURIComponent(pair[1]);}
this.params[key]=value;}}
QueryString.static=null;QueryString.staticInit=function(){if(QueryString.static==null){QueryString.static=new QueryString(location.search.substring(1));}}
QueryString.get=function(key){QueryString.staticInit();return QueryString.static.get(key);};QueryString.prototype.get=function(key){return this.params[key]?this.params[key]:null;};QueryString.exists=function(key){QueryString.staticInit();return QueryString.static.exists(key);}
QueryString.prototype.exists=function(key){return this.params[key]?true:false;}
QueryString.equals=function(key,value){QueryString.staticInit();return QueryString.static.equals(key,value);}
QueryString.prototype.equals=function(key,value){return this.params[key]==value?true:false;}
QueryString.toString=function(){QueryString.staticInit();return QueryString.static.toString();}
QueryString.prototype.toString=function(){return this.string?this.string:null;}
QueryString.create=function(arr){var resarr=Array();var editToken;for(var i in arr){if(typeof arr[i]=='undefined'){continue;}
var res;if(arr[i]instanceof Array){var v=Array();for(var j=0;j<arr[i].length;++j){v[j]=encodeURIComponent(arr[i][j]);}
res=v.join('|');}else{res=encodeURIComponent(arr[i]);}
if(i=='wpEditToken'){editToken=res;}else{resarr.push(encodeURIComponent(i)+'='+res);}}
if(typeof editToken!='undefined'){resarr.push('wpEditToken='+editToken);}
return resarr.join('&');}
QueryString.prototype.create=QueryString.create;Exception=function(message){this.message=message||'';this.name="Exception";}
Exception.prototype.what=function(){return this.message;}
function Status(text,stat,type){this.text=this.codify(text);this.stat=this.codify(stat);this.type=type||'status';this.generate();if(stat){this.render();}}
Status.init=function(root){if(!(root instanceof Element)){throw new Exception('object not an instance of Element');}
while(root.hasChildNodes()){root.removeChild(root.firstChild);}
Status.root=root;var cssNode=document.createElement('style');cssNode.type='text/css';cssNode.rel='stylesheet';cssNode.appendChild(document.createTextNode(""));document.getElementsByTagName("head")[0].appendChild(cssNode);var styles=cssNode.sheet?cssNode.sheet:cssNode.stylesSheet;styles.insertRule(".tw_status_status { color: SteelBlue; }",0);styles.insertRule(".tw_status_info { color: ForestGreen; }",0);styles.insertRule(".tw_status_warn { color: OrangeRed; }",0);styles.insertRule(".tw_status_error { color: OrangeRed; font-weight: 900; }",0);}
Status.root=null;Status.prototype={stat:null,text:null,type:'status',target:null,node:null,linked:false,link:function(){if(!this.linked&&Status.root){Status.root.appendChild(this.node);this.linked=true;}},unlink:function(){if(this.linked){Status.root.removeChild(this.node);this.linked=false;}},codify:function(obj){if(!(obj instanceof Array)){obj=[obj];}
var result;result=document.createDocumentFragment();for(var i=0;i<obj.length;++i){if(typeof obj[i]=='string'){result.appendChild(document.createTextNode(obj[i]));}else if(obj[i]instanceof Element){result.appendChild(obj[i]);}}
return result;},update:function(status,type){this.stat=this.codify(status);if(type){this.type=type;}
this.render();},generate:function(){this.node=document.createElement('div');this.node.appendChild(document.createElement('span')).appendChild(this.text);this.node.appendChild(document.createElement('span')).appendChild(document.createTextNode(': '));this.target=this.node.appendChild(document.createElement('span'));this.target.appendChild(document.createTextNode(''));},render:function(){this.node.className='tw_status_'+this.type;while(this.target.hasChildNodes()){this.target.removeChild(this.target.firstChild);}
this.target.appendChild(this.stat);this.link();},status:function(status){this.update(status,'status');},info:function(status){this.update(status,'info');},warn:function(status){this.update(status,'warn');},error:function(status){this.update(status,'error');}}
Status.status=function(text,status){return new Status(text,status,'status');}
Status.info=function(text,status){return new Status(text,status,'info');}
Status.warn=function(text,status){return new Status(text,status,'error');}
Status.error=function(text,status){return new Status(text,status,'error');}
function htmlNode(type,content,color){var node=document.createElement(type);if(color){node.style.color=color;}
node.appendChild(document.createTextNode(content));return node;}
function SimpleWindow(width,height){var stylesheet=document.createElement('style');stylesheet.type='text/css';stylesheet.rel='stylesheet';stylesheet.appendChild(document.createTextNode(""));document.getElementsByTagName("head")[0].appendChild(stylesheet);var styles=stylesheet.sheet?stylesheet.sheet:stylesheet.styleSheet;styles.insertRule(".simplewindow { "+"position: fixed; "+"background-color: AliceBlue; "+"border: 2px ridge Black; "+"z-index: 100; "+"}",0);styles.insertRule(".simplewindow .content { "+"position: absolute; "+"top: 20px; "+"bottom: 0; "+"overflow: auto; "+"width: 100%; "+"}",0);styles.insertRule(".simplewindow .resizebuttonhorizontal { "+"position: absolute; "+"background-color: MediumPurple; "+"opacity: 0.5; "+"right: -2px; "+"bottom: -2px; "+"width: 20px; "+"height: 4px; "+"cursor: se-resize; "+"}",0);styles.insertRule(".simplewindow .resizebuttonvertical { "+"position: absolute; "+"opacity: 0.5; "+"background-color: MediumPurple; "+"right: -2px; "+"bottom: -2px; "+"width: 4px; "+"height: 20px; "+"cursor: se-resize; "+"}",0);styles.insertRule(".simplewindow .closebutton {"+"position: absolute; "+"font: 100 0.8em sans-serif; "+"top: 1px; "+"left: 1px; "+"height: 100%; "+"cursor: pointer; "+"}",0);styles.insertRule(".simplewindow .topbar { "+"position: absolute; "+"background-color: LightSteelBlue; "+"font: 900 1em sans-serif; "+"vertical-align: baseline; "+"text-align: center; "+"width: 100%; "+"height: 20px; "+"cursor: move; "+"}",0);this.width=width;this.height=height;var frame=document.createElement('div');var content=document.createElement('div');var topbar=document.createElement('div');var title=document.createElement('span');var closeButton=document.createElement('span');var resizeButton2=document.createElement('div');var resizeButton1=document.createElement('div');this.frame=frame;this.title=title;this.content=content;frame.className='simplewindow';content.className='content';topbar.className='topbar';resizeButton1.className='resizebuttonvertical';resizeButton2.className='resizebuttonhorizontal';closeButton.className='closebutton';title.className='title';topbar.appendChild(closeButton);topbar.appendChild(title);frame.appendChild(topbar);frame.appendChild(content);frame.appendChild(resizeButton1);frame.appendChild(resizeButton2);frame.style.width=Math.min(parseInt(window.innerWidth),parseInt(width))+'px';frame.style.height=Math.min(parseInt(window.innerHeight),parseInt(height))+'px';frame.style.top=Math.max(0,parseInt(window.innerHeight-this.height)/2)+'px';frame.style.left=Math.max(0,parseInt(window.innerWidth-this.width)/2)+'px';var img=document.createElement('img');img.src="http://upload.wikimedia.org/wikipedia/commons/thumb/5/52/Nuvola_apps_error.png/18px-Crystal_button_cancel.svg.png";closeButton.appendChild(img);var self=this;frame.addEventListener('mousedown',function(event){self.focus(event);},false);closeButton.addEventListener('click',function(event){self.close(event);},false);topbar.addEventListener('mousedown',function(event){self.initMove(event);},false);resizeButton1.addEventListener('mousedown',function(event){self.initResize(event);},false);resizeButton2.addEventListener('mousedown',function(event){self.initResize(event);},false);window.addEventListener('mouseover',function(event){self.handleEvent(event);},false);window.addEventListener('mousemove',function(event){self.handleEvent(event);},false);window.addEventListener('mouseup',function(event){self.handleEvent(event);},false);this.currentState=this.initialState;}
SimpleWindow.prototype={focusLayer:100,width:800,height:600,initialState:"Inactive",currentState:null,focus:function(event){this.frame.style.zIndex=++this.focusLayer;},close:function(event){event.preventDefault();document.body.removeChild(this.frame);},initMove:function(event){event.preventDefault();this.initialX=parseInt(event.clientX-this.frame.offsetLeft);this.initialY=parseInt(event.clientY-this.frame.offsetTop);this.frame.style.opacity='0.5';this.currentState='Move';},initResize:function(event){event.preventDefault();this.frame.style.opacity='0.5';this.currentState='Resize';},handleEvent:function(event){event.preventDefault();var actionTransitionFunction=this.actionTransitionFunctions[this.currentState][event.type];if(!actionTransitionFunction){actionTransitionFunction=this.unexpectedEvent;}
var nextState=actionTransitionFunction.call(this,event);if(!nextState){nextState=this.currentState;}
if(!this.actionTransitionFunctions[nextState]){nextState=this.undefinedState(event,nextState);}
this.currentState=nextState;event.stopPropagation();},unexpectedEvent:function(event){throw("Handled unexpected event '"+event.type+"' in state '"+this.currentState);return this.initialState;},undefinedState:function(event,state){throw("Transitioned to undefined state '"+state+"' from state '"+this.currentState+"' due to event '"+event.type);return this.initialState;},actionTransitionFunctions:{Inactive:{mouseover:function(event){return this.currentState;},mousemove:function(event){return this.currentState;},mouseup:function(event){return this.currentState;}},Move:{mouseover:function(event){this.moveWindow(event.clientX,event.clientY);return this.currentState;},mousemove:function(event){return this.doActionTransition("Move","mouseover",event);},mouseup:function(event){this.frame.style.opacity='1';return'Inactive';}},Resize:{mouseover:function(event){this.resizeWindow(event.clientX,event.clientY);return this.currentState;},mousemove:function(event){return this.doActionTransition("Resize","mouseover",event);},mouseup:function(event){this.frame.style.opacity='1';return'Inactive';}}},doActionTransition:function(anotherState,anotherEventType,event){return this.actionTransitionFunctions[anotherState][anotherEventType].call(this,event);},display:function(){document.body.appendChild(this.frame);},setTitle:function(title){this.title.textContent=title;},setWidth:function(width){this.frame.style.width=width;},setHeight:function(height){this.frame.style.height=height;},setContent:function(content){this.purgeContent();this.addContent(content);},addContent:function(content){this.content.appendChild(content);},purgeContent:function(content){while(this.content.hasChildNodes()){this.content.removeChild(this.content.firstChild);}},moveWindow:function(x,y){this.frame.style.left=x-this.initialX+'px';this.frame.style.top=y-this.initialY+'px';},resizeWindow:function(x,y){this.frame.style.height=Math.max(parseInt(y-this.frame.offsetTop),200)+'px';this.frame.style.width=Math.max(parseInt(x-this.frame.offsetLeft),200)+'px';}}
var twinkleBlacklistedUsers=[];if(twinkleBlacklistedUsers.indexOf(wgUserName)!=-1&&twinkleConfigExists)twinkleConfigExists=false;morebits_js_loaded=true;if(typeof(FriendlyConfig)=='undefined'){FriendlyConfig={};}
if(typeof(FriendlyConfig.enableClock)=='undefined'){FriendlyConfig.enableClock=true;}
if(typeof(FriendlyConfig.clockStyle)=='undefined'){FriendlyConfig.clockStyle='dynamic';}
if(typeof(FriendlyConfig.clockLocal)=='undefined'){FriendlyConfig.clockLocal=true;}
if(typeof(FriendlyConfig.doubleClock)=='undefined'){FriendlyConfig.doubleClock=true;}
friendlyclock={showClock:function(){var query={'action':'purge','title':wgPageName};friendlyclock.clockNode=addPortletLink('p-personal',mw.config.get('wgServer')+mw.config.get('wgScriptPath')+'/index.php?'+QueryString.create(query),'--:--:-- UTC / --:--:-- LOCAL','friendly-clock','刷新缓存','');friendlyclock.clockNode.style.fontSize='normal';friendlyclock.clockNode.style.fontWeight='bold';friendlyclock.clockNode.style.textTransform='uppercase';friendlyclock.updateTime();if(FriendlyConfig.clockStyle!='static'){friendlyclock.intervalId=window.setInterval(friendlyclock.updateTime,1000);}},updateTime:function(){if(!friendlyclock.clockNode){return;}
var now=new Date();var hh=now.getHours();var mm=now.getMinutes();var ss=now.getSeconds();var time=(hh<10?'0'+hh:hh)+':'+(mm<10?'0'+mm:mm)+':'+(ss<10?'0'+ss:ss)+' Local';var uhh=now.getUTCHours();var umm=now.getUTCMinutes();var uss=now.getUTCSeconds();var utime=(uhh<10?'0'+uhh:uhh)+':'+(umm<10?'0'+umm:umm)+':'+(uss<10?'0'+uss:uss)+' UTC';if(FriendlyConfig.doubleClock){var res=utime+" / "+time;}else if(FriendlyConfig.clockLocal){var res=time;}else{var res=utime;}
friendlyclock.clockNode.firstChild.innerHTML=res;}}
$(function(){if(FriendlyConfig.enableClock){friendlyclock.showClock();}});if(typeof(FriendlyConfig)=='undefined'){FriendlyConfig={};}
if(typeof(FriendlyConfig.summaryAd)=='undefined'){FriendlyConfig.summaryAd=" using [[WP:FRIENDLY|Friendly]]";}
if(typeof(FriendlyConfig.markCopyvioAsMinor)=='undefined'){FriendlyConfig.markCopyvioAsMinor=false;}
if(typeof(FriendlyConfig.markCopyvioAsPatrolled)=='undefined'){FriendlyConfig.markCopyvioAsPatrolled=true;}
if(typeof(FriendlyConfig.autoNotifyCopyvio)=='undefined'){FriendlyConfig.autoNotifyCopyvio=true;}
if(typeof(FriendlyConfig.autoReportCopyvio)=='undefined'){FriendlyConfig.autoReportCopyvio=true;}
addOnloadHook(friendlycopyvio);function friendlycopyvio(){if(wgNamespaceNumber<0||wgCurRevisionId==false){return;}else{twAddPortletLink("javascript:friendlycopyvio.callback()",wgULS("侵权","侵權"),"friendly-cv",wgULS("提报侵权条目","提報侵權條目"),"");}}
friendlycopyvio.callback=function friendlycopyvioCallback(){var Window=new SimpleWindow(600,300);Window.setTitle(wgULS("提报侵权条目","提報侵權條目"));var form=new QuickForm(friendlycopyvio.callback.evaluate);form.append({type:'textarea',name:'source',label:wgULS("侵权来源","侵權來源")});form.append({type:'submit',label:wgULS("提交","提交")});var result=form.render();Window.setContent(result);Window.display();}
friendlycopyvio.callbacks={main:function(self){++Wikipedia.numberOfActionsLeft;var xmlDoc=self.responseXML;var exists=xmlDoc.evaluate('boolean(//pages/page[not(@missing)])',xmlDoc,null,XPathResult.BOOLEAN_TYPE,null).booleanValue;if(!exists){self.statelem.error(wgULS("页面不存在,可能已被删除","頁面不存在,可能已被刪除"));return;}
var query={'title':wgPageName,'action':'submit'};var wikipedia_wiki=new Wikipedia.wiki(wgULS("标记页面","標記頁面"),query,friendlycopyvio.callbacks.tagPage);wikipedia_wiki.params=self.params;wikipedia_wiki.followRedirect=false;wikipedia_wiki.get();},tagPage:function(self){form=this.responseXML.getElementById('editform');var code="";if(/\/temp$/i.test(wgPageName)){code+="\{\{d|G16\}\}\n";}
code+="\{\{subst:Copyvio/auto|url=\*"+self.params.source.replace(/http/g,'http').replace(/\n+/g,'\n').replace(/\n([^\*])/g,'\n*$1').replace(/\*$/,'').replace(/^\*/,'')+"\}\}";if(FriendlyConfig.markCopyvioAsPatrolled&&self.params.rcid!=''){var query={'title':wgPageName,'action':'markpatrolled','rcid':self.params.rcid};var wikipedia_wiki=new Wikipedia.wiki(wgULS("标记页面为已巡查","標記頁面為已巡查"),query);wikipedia_wiki.post();}
var query={'action':'query','prop':'revisions','titles':wgPageName,'rvlimit':1,'rvprop':'user','rvdir':'newer'}
var callback=function(self){var xmlDoc=self.responseXML;var user=xmlDoc.evaluate('//rev/@user',xmlDoc,null,XPathResult.STRING_TYPE,null).stringValue;if(wgPageName!=('User talk:'+user)){var query={'title':'User talk:'+user,'action':'submit'};var wikipedia_wiki=new Wikipedia.wiki(wgULS("通知页面创建者","通知頁面創建者")+user+'',query,friendlycopyvio.callbacks.userNotification);wikipedia_wiki.params=self.params;wikipedia_wiki.get();}else{Status.info(wgULS("信息","信息"),wgULS("当前页面为创建者讨论页,取消通知","當前頁面為創建者討論頁,取消通知"));}}
if(self.params.usertalk){var wikipedia_api=new Wikipedia.api(wgULS("抓创建者数据","抓創建者數據"),query,callback);wikipedia_api.params=self.params;wikipedia_api.post();}
var postData={'wpMinoredit':FriendlyConfig.markCopyvioAsMinor?'':undefined,'wpWatchthis':form.wpWatchthis.checked?'':undefined,'wpStarttime':form.wpStarttime.value,'wpEdittime':form.wpEdittime.value,'wpAutoSummary':form.wpAutoSummary.value,'wpEditToken':form.wpEditToken.value,'wpSection':'','wpSummary':wgULS("标记侵权页面","標記侵權頁面")+FriendlyConfig.summaryAd,'wpTextbox1':code};self.post(postData);var querywp={'action':'query','prop':'revisions','titles':wgPageName,'rvlimit':1,'rvprop':'user','rvdir':'newer'}
var callback=function(self){var xmlDoc=self.responseXML;var user=xmlDoc.evaluate('//rev/@user',xmlDoc,null,XPathResult.STRING_TYPE,null).stringValue;if(wgPageName!=('Wikipedia:頁面存廢討論/疑似侵權')){var query={'title':'Wikipedia:頁面存廢討論/疑似侵權','action':'submit'};var wikipedia_wiki=new Wikipedia.wiki(wgULS("报告给WP:CV","報告給WP:CV"),query,friendlycopyvio.callbacks.reportCopyvio);wikipedia_wiki.params=self.params;wikipedia_wiki.get();}else{Status.info(wgULS("信息","信息"),wgULS("当前页面为报告页,取消报告","當前頁面為報告頁,取消報告"));}}
if(self.params.toreport){var wikipedia_api=new Wikipedia.api(wgULS("抓报告页数据","抓報告頁數據"),query,callback);wikipedia_api.params=self.params;wikipedia_api.post();}
var postData={'wpMinoredit':FriendlyConfig.markCopyvioAsMinor?'':undefined,'wpWatchthis':form.wpWatchthis.checked?'':undefined,'wpStarttime':form.wpStarttime.value,'wpEdittime':form.wpEdittime.value,'wpAutoSummary':form.wpAutoSummary.value,'wpEditToken':form.wpEditToken.value,'wpSection':'','wpSummary':wgULS("标记侵权页面","標記侵權頁面")+FriendlyConfig.summaryAd,'wpTextbox1':code};self.post(postData);},userNotification:function(self){var form=self.responseXML.getElementById('editform');var text=form.wpTextbox1.value;if(text=='\n'){text+="\{\{subst:User:Tommyang/Welcome\}\}"}
text+="\n\{\{subst:CopyvioNotice|"+wgPageName+"\}\}";if(self.params.isbaidu){text+="\n\{\{subst:CopyvioBD\}\}";}
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':wgULS("通知:页面\[\[","通知:頁面\[\[")+wgPageName+wgULS("\]\]疑似侵权","\]\]疑似侵權")+FriendlyConfig.summaryAd,'wpTextbox1':text};self.post(postData);},reportCopyvio:function(self){var form=self.responseXML.getElementById('editform');var text=form.wpTextbox1.value;text+="\{\{subst:CopyvioVFDRecord|"+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':wgULS("报告:页面\[\[","報告:頁面\[\[")+wgPageName+wgULS("\]\]疑似侵权","\]\]疑似侵權")+FriendlyConfig.summaryAd,'wpTextbox1':text};self.post(postData);}}
friendlycopyvio.callback.evaluate=function friendlycopyvioCallbackEvaluate(e){wgPageName=wgPageName.replace(/_/g,' ');var params={usertalk:FriendlyConfig.autoNotifyCopyvio!=-1,toreport:FriendlyConfig.autoReportCopyvio!=-1,source:e.target.source.value,rcid:QueryString.exists('rcid')?QueryString.get('rcid'):'',isbaidu:(/.*baike.baidu.com.*/.exec(e.target.source.value))?true:false};Status.init(e.target);Wikipedia.actionCompleted.redirect=wgPageName;Wikipedia.actionCompleted.notice=wgULS("完成","完成");var query={'action':'query','titles':wgPageName}
var wikipedia_api=new Wikipedia.api(wgULS("检查页面是否存在","檢查頁面是否存在"),query,friendlycopyvio.callbacks.main);wikipedia_api.params=params;wikipedia_api.post();}
if(typeof(FriendlyConfig)=='undefined'){FriendlyConfig={};}
if(typeof(FriendlyConfig.summaryAd)=='undefined'){FriendlyConfig.summaryAd=" using [[WP:FRIENDLY|Friendly]]";}
if(typeof(FriendlyConfig.deletionSummaryAd)=='undefined'){FriendlyConfig.deletionSummaryAd=" using [[WP:FRIENDLY|Friendly]]";}
if(typeof(FriendlyConfig.watchSpeedyPages)=='undefined'){FriendlyConfig.watchSpeedyPages=[];}
if(typeof(FriendlyConfig.markSpeedyPagesAsMinor)=='undefined'){FriendlyConfig.markSpeedyPagesAsMinor=false;}
if(typeof(FriendlyConfig.markSpeedyPagesAsPatrolled)=='undefined'){FriendlyConfig.markSpeedyPagesAsPatrolled=true;}
if(typeof(FriendlyConfig.notifyUserOnSpeedyDeletionNomination)=='undefined'){FriendlyConfig.notifyUserOnSpeedyDeletionNomination=['g1','g2','g3','g5','g11','g12','g13','g14','a1','a2','a3','r4'];}
if(typeof(FriendlyConfig.welcomeUserOnSpeedyDeletionNotification)=='undefined'){FriendlyConfig.welcomeUserOnSpeedyDeletionNotification=FriendlyConfig.notifyUserOnSpeedyDeletionNomination;}
if(typeof(FriendlyConfig.openUserTalkPageOnSpeedyDelete)=='undefined'){FriendlyConfig.openUserTalkPageOnSpeedyDelete=[];}
if(typeof(FriendlyConfig.userTalkPageMode)=='undefined'){FriendlyConfig.userTalkPageMode='tab';}
if(typeof(FriendlyConfig.deleteTalkPageOnDelete)=='undefined'){FriendlyConfig.deleteTalkPageOnDelete=true;}
if(typeof(FriendlyConfig.orphanBacklinksOnSpeedyDelete)=='undefined'){FriendlyConfig.orphanBacklinksOnSpeedyDelete={orphan:false};}
if(typeof(FriendlyConfig.checkDeleteDup)=='undefined'){FriendlyConfig.checkDeleteDup=true;}
function friendlyspeedy(){if(wgNamespaceNumber<0||wgCurRevisionId==false){return;}
if(userIsInGroup('sysop')){twAddPortletLink("javascript:friendlyspeedy.callback()","速删","friendly-csd","快速删除","");}else if(userIsInGroup('autoconfirmed')){twAddPortletLink("javascript:friendlyspeedy.callback()","速删","friendly-csd","请求快速删除","");}
else
{twAddPortletLink('javascript:alert("您必须首先达到自动确认。");',"速删","friendly-csd","请求快速删除","");}}
addOnloadHook(friendlyspeedy);friendlyspeedy.callback=function friendlyspeedycallback(){var Window=new SimpleWindow(800,500);Window.setTitle("选择快速删除的标准");var form=new QuickForm(userIsInGroup('sysop')?friendlyspeedy.callback.evaluateSysop:friendlyspeedy.callback.evaluateUser,'change');var notalk=(document.evaluate('//div[@id="head"]//div[@id="left-navigation"]//div[@id="namespaces"]//ul//li[@class="new"]',document,null,XPathResult.STRING_TYPE,null).stringValue.length!=0)||(wgNamespaceNumber%2==1)
if(userIsInGroup('sysop')){form.append({type:'checkbox',list:[{label:'仅标记',value:'tag_only',name:'tag_only',checked:(document.getElementById("speedy-delete")==null),event:function(event){event.target.form.orphan_backlinks.disabled=event.target.checked;event.target.form.delete_talk.disabled=(event.target.checked||notalk||wgNamespaceNumber==2);event.stopPropagation();}},{label:'移除链入',value:'orphan_backlinks',name:'orphan_backlinks',disabled:(document.getElementById("speedy-delete")==null),checked:FriendlyConfig.orphanBacklinksOnSpeedyDelete.orphan,event:function(event){FriendlyConfig.orphanBacklinksOnSpeedyDelete.orphan=event.target.checked;event.stopPropagation();}},{label:'删除讨论页',value:'delete_talk',name:'delete_talk',disabled:notalk||(document.getElementById("speedy-delete")==null)||wgNamespaceNumber==2,checked:FriendlyConfig.deleteTalkPageOnDelete&&wgNamespaceNumber!=2,event:function(event){FriendlyConfig.deleteTalkPageOnDelete=event.target.checked;event.stopPropagation();}}]});}
form.append({type:'checkbox',list:[{label:'如果可能,通知创建者',value:'notify',name:'notify',checked:true,event:function(event){event.stopPropagation();}}]});if(wgNamespaceNumber==Namespace.IMAGE){form.append({type:'header',label:'文件'});form.append({type:'radio',name:'csd',list:[{label:'F1: 重复的文件,而且所有的链入连接已经被修改为指向保留的文件',value:'f1'},{label:'F5: 被高分辨率与SVG文件取代的图片',value:'f5',},{label:'F6: 孤立而没有被条目使用的非自由版权文件',value:'f6',},{label:'F7: 被维基共享资源文件取代的文件',value:'f7'}]});}
form.append({type:'header',label:'常规'});form.append({type:'radio',name:'csd',list:[{label:'G1: 没有实际内容或历史纪录的文章',value:'g1',},{label:'G2: 这是一个测试页',value:'g2'},{label:'G3: 纯粹破坏',value:'g3'},{label:'G5: 曾经根据各项存废讨论被除删除后又重新创建的内容',value:'g5'},{label:'G10: 原作者清空页面或提出删除,且贡献者只有一人',value:'g10'},{label:'G11: 其内容仅仅是联系信息,或明显以广告宣传为目的建立的页面',value:'g11'},{label:'G12: 并未列明来源及负面语调的人物传记',value:'g12'},{label:'G13: 明显的、拙劣的机器翻译',value:'g13'},{label:'G14: 超过两周没有进行任何翻译的非现代标准汉语页面',value:'g14'},{label:'G15: 孤立页面',value:'g15'},{label:'G16: 临时页面依然侵权',value:'g16'}]});if(wgNamespaceNumber==0){form.append({type:'header',label:'条目'});form.append({type:'radio',name:'csd',list:[{label:'A1: 非常短,而且没有定义或内容',value:'a1'},{label:'A2: 内容只包括外部连接、参见、图书参考、类别标签、模板标签、跨语言连接的条目',value:'a2'},{label:'A3: 复制自其他中文维基计划,或是与其他中文维基计划内容相同的文章',value:'a3'}]});}
form.append({type:'header',label:'重定向'});form.append({type:'radio',name:'csd',list:[{label:'R2: 跨命名空间重定向',value:'r2'},{label:'R3: 拼写错误的新页面',value:'r3'},{label:'R4: 故意破坏的结果',value:'r4'},{label:'R5: 指向本身的重定向或循环的重定向',value:'r5'}]});if(wgNamespaceNumber==14||wgNamespaceNumber==15){form.append({type:'header',label:'分类'});form.append({type:'radio',name:'csd',list:[{label:'O4: 空的类别',value:'o4'}]});}if(wgNamespaceNumber==2||wgNamespaceNumber==3){form.append({type:'header',label:'用户页'});form.append({type:'radio',name:'csd',list:[{label:'O1: 用户请求删除的他们自己的用户页子页面',value:'o1'},{label:'O3: 匿名用户的用户讨论页,其中的内容不再有用',value:'o3'}]});}
var result=form.render();Window.setContent(result);Window.display();}
friendlyspeedy.normalizeHash={'g1':'g1','g2':'g2','g3':'g3','g5':'g5','g10':'g10','g11':'g11','g12':'g12','g13':'g13','g14':'g14','g15':'g15','g16':'g16','a1':'a1','a2':'a2','a3':'a3','r2':'r2','r3':'r3','r5':'r5','f1':'f1','f5':'f5','f6':'f6','f7':'f7','o1':'o1','o3':'o3','o4':'o4'};friendlyspeedy.reasonHash={'g1':'无实际内容','g2':'测试页','g3':'破坏','g4':'非常短而无定义或内容','g5':'曾经依存废讨论被删除的重建内容','g7':'与其他中文维基计划内容相同的文章','g8':'删除以便移动','g10':'作者请求','g11':'广告或宣传','g12':'未列明来源或违反[[Wikipedia:生者传记]]的负面内容','g13':'明显且拙劣的机器翻译','g14':'超过两周没有翻译的非现代标准汉语页面','g15':'孤立页面','g16':'临时页面依然侵权','a1':'非常短而无定义或内容','a2':'内容只包含参考、链接、模板或/及分类','a3':'与其他中文维基计划内容相同的文章','r2':'跨名字空间重定向','r3':'名称错误的重定向','r4':'重定向破坏','r5':'指向本身的重定向或循环的重定向','o1':'用户请求删除自己的用户页','o3':'匿名用户的讨论页','o4':'空的类别','f1':'重复的图片','f5':'已有图片取代','f6':'孤立而没有被条目使用的非自由版权图片','f7':'与维基共享资源重复的档案'};friendlyspeedy.callbacks={sysop:{main:function(self){var xmlDoc=self.responseXML;var normal=xmlDoc.evaluate('//normalized/n/@to',xmlDoc,null,XPathResult.STRING_TYPE,null).stringValue;if(normal){wgPageName=normal;}
var exists=xmlDoc.evaluate('boolean(//pages/page[not(@missing)])',xmlDoc,null,XPathResult.BOOLEAN_TYPE,null).booleanValue;if(!exists){self.statelem.error("页面不存在,可能已被删除");return;}
if(self.params.openusertalk){var query={'action':'query','prop':'revisions','titles':wgPageName,'rvlimit':1,'rvprop':'user','rvdir':'newer'}
var wikipedia_api=new Wikipedia.api('抓创建者信息',query,friendlyspeedy.callbacks.sysop.openUserTalkPage);wikipedia_api.params=self.params;wikipedia_api.post();}
var query={'title':wgPageName,'action':'delete'};var wikipedia_wiki=new Wikipedia.wiki('删除页面',query,friendlyspeedy.callbacks.sysop.deletePage);wikipedia_wiki.params=self.params;wikipedia_wiki.followRedirect=false;wikipedia_wiki.get();if(FriendlyConfig.deleteTalkPageOnDelete&&self.params.normalized!='f7'&&wgNamespaceNumber%2==0&&wgNamespaceNumber!=2&&document.getElementById('ca-talk').className!='new'){var talk_page=namespaces[wgNamespaceNumber+1]+':'+wgTitle;var query=query={'title':talk_page,'action':'delete'};var wikipedia_wiki=new Wikipedia.wiki('删除讨论页',query,friendlyspeedy.callbacks.sysop.deleteTalkPage);wikipedia_wiki.params=self.params;wikipedia_wiki.followRedirect=false;wikipedia_wiki.get();}
var query={'action':'query','prop':'revisions','titles':wgPageName,'rvlimit':1,'rvprop':'user','rvdir':'newer'}
var callback=function(self){var xmlDoc=self.responseXML;var user=xmlDoc.evaluate('//rev/@user',xmlDoc,null,XPathResult.STRING_TYPE,null).stringValue;if(wgPageName!=('User talk:'+user)){var query={'title':'User talk:'+user,'action':'submit'};var wikipedia_wiki=new Wikipedia.wiki('通知页面创建者'+user,query,friendlyspeedy.callbacks.user.userNotification);wikipedia_wiki.params=self.params;wikipedia_wiki.get();}else{Status.info('信息','当前页面为创建者讨论页,取消通知');}}
if(self.params.usertalk){var wikipedia_api=new Wikipedia.api('抓创建者信息',query,callback);wikipedia_api.params=self.params;wikipedia_api.post();}
if(wgNamespaceNumber==6&&self.params.normalized!='f7'){var query={'action':'query','list':'imageusage','titles':wgPageName,'iulimit':userIsInGroup('sysop')?5000:500};var wikipedia_api=new Wikipedia.api('抓图像链接',query,friendlyspeedy.callbacks.sysop.unlinkImageInstancesMain);wikipedia_api.params=self.params;wikipedia_api.post();}
var doOrphan=FriendlyConfig.orphanBacklinksOnSpeedyDelete;if(doOrphan.orphan&&doOrphan.exclude.indexOf(self.params.normalized.toLowerCase())==-1){var query={'action':'query','list':'backlinks','blfilterredir':'nonredirects','bltitle':wgPageName,'bllimit':userIsInGroup('sysop')?5000:500,'blnamespace':[0,100]};var wikipedia_api=new Wikipedia.api('抓链入信息',query,friendlyspeedy.callbacks.sysop.unlinkBacklinksMain);wikipedia_api.params=self.params;wikipedia_api.post();}
var query={'action':'query','list':'backlinks','blfilterredir':'redirects','bltitle':wgPageName,'bllimit':userIsInGroup('sysop')?5000:500};var wikipedia_api=new Wikipedia.api('抓重定向信息',query,friendlyspeedy.callbacks.sysop.deleteRedirectsMain);wikipedia_api.params=self.params;wikipedia_api.post();},openUserTalkPage:function(self){var xmlDoc=self.responseXML;var user=xmlDoc.evaluate('//rev/@user',xmlDoc,null,XPathResult.STRING_TYPE,null).stringValue;var statusIndicator=new Status('开启用户'+user,'的讨论页');var query={'title':'User talk:'+user,'action':'edit','preview':'yes','vanarticle':wgPageName.replace(/_/g,' ')};switch(FriendlyConfig.userTalkPageMode){case'tab':window.open(mw.config.get('wgServer')+mw.config.get('wgScriptPath')+'/index.php?'+QueryString.create(query),'_tab');break;case'blank':window.open(mw.config.get('wgServer')+mw.config.get('wgScriptPath')+'/index.php?'+QueryString.create(query),'_blank','location=no,toolbar=no,status=no,directories=no,scrollbars=yes,width=1200,height=800');break;case'window':default:window.open(mw.config.get('wgServer')+mw.config.get('wgScriptPath')+'/index.php?'+QueryString.create(query),'Friendlywarnwindow','location=no,toolbar=no,status=no,directories=no,scrollbars=yes,width=1200,height=800');break;}
statusIndicator.info('完成');},unlinkBacklinksMain:function(self){var xmlDoc=self.responseXML;var snapshot=xmlDoc.evaluate('//backlinks/bl/@title',xmlDoc,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null);if(snapshot.snapshotLength==0){return;}
var statusIndicator=new Status('移除链入','0%');var total=snapshot.snapshotLength*2;var onsuccess=function(self){var obj=self.params.obj;var total=self.params.total;var now=parseInt(100*++(self.params.current)/total)+'%';obj.update(now);self.statelem.unlink();if(self.params.current>=total){obj.info(now+' (完成)');Wikipedia.removeCheckpoint();}}
var onloaded=onsuccess;var onloading=function(self){}
Wikipedia.addCheckpoint();if(snapshot.snapshotLength==0){statusIndicator.info('100% (完成)');Wikipedia.removeCheckpoint();return;}
var params=clone(self.params);params.current=0;params.total=total;params.obj=statusIndicator;params.page=wgPageName;for(var i=0;i<snapshot.snapshotLength;++i){var title=snapshot.snapshotItem(i).value;var query={'title':title,'action':'submit'}
var wikipedia_wiki=new Wikipedia.wiki("移除链入"+title,query,friendlyspeedy.callbacks.sysop.unlinkBacklinks);wikipedia_wiki.params=params;wikipedia_wiki.onloading=onloading;wikipedia_wiki.onloaded=onloaded;wikipedia_wiki.onsuccess=onsuccess;wikipedia_wiki.get();}},unlinkBacklinks:function(self){var form=self.responseXML.getElementById('editform');var text=form.wpTextbox1.value;var old_text=text;var wikiPage=new Mediawiki.Page(text);wikiPage.removeLink(self.params.page);text=wikiPage.getText();if(text==old_text){self.onsuccess(self);Wikipedia.actionCompleted(self);return;}
var postData={'wpMinoredit':form.wpMinoredit.checked?'':undefined,'wpWatchthis':undefined,'wpStarttime':form.wpStarttime.value,'wpEdittime':form.wpEdittime.value,'wpAutoSummary':form.wpAutoSummary.value,'wpEditToken':form.wpEditToken.value,'wpSection':'','wpSummary':'移除链入'+self.params.page+"因其已被快速删除([[WP:CSD#"+self.params.normalized.toUpperCase()+"|CSD "+self.params.normalized.toUpperCase()+"]])"+"; "+FriendlyConfig.deletionSummaryAd,'wpTextbox1':text};self.post(postData);},deleteRedirectsMain:function(self){var xmlDoc=self.responseXML;var snapshot=xmlDoc.evaluate('//backlinks/bl/@title',xmlDoc,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null);var total=snapshot.snapshotLength*2;if(snapshot.snapshotLength==0){return;}
var statusIndicator=new Status('删除重定向','0%');var onsuccess=function(self){var obj=self.params.obj;var total=self.params.total;var now=parseInt(100*++(self.params.current)/total)+'%';obj.update(now);self.statelem.unlink();if(self.params.current>=total){obj.info(now+' (完成)');Wikipedia.removeCheckpoint();}}
var onloaded=onsuccess;var onloading=function(self){}
Wikipedia.addCheckpoint();if(snapshot.snapshotLength==0){statusIndicator.info('100% (完成)');Wikipedia.removeCheckpoint();return;}
var params=clone(self.params);params.current=0;params.total=total;params.obj=statusIndicator;for(var i=0;i<snapshot.snapshotLength;++i){var title=snapshot.snapshotItem(i).value;var query={'title':title,'action':'delete'}
var wikipedia_wiki=new Wikipedia.wiki("删除"+title,query,friendlyspeedy.callbacks.sysop.deleteRedirects);wikipedia_wiki.params=params;wikipedia_wiki.onloading=onloading;wikipedia_wiki.onloaded=onloaded;wikipedia_wiki.onsuccess=onsuccess;wikipedia_wiki.followRedirect=false;wikipedia_wiki.get();}},deleteRedirects:function(self){var form=this.responseXML.getElementById('deleteconfirm');if(!form){form=this.responseXML.getElementsByTagName('form')[0];var postData={'wpDeleteReasonList':'other','wpReason':"[[WP:CSD#G15|CSD G15]] 孤立页面\""+wgPageName+"\""+FriendlyConfig.deletionSummaryAd,'wpEditToken':form.wpEditToken.value}}else{var postData={'wpWatch':form.wpWatch.checked?'':undefined,'wpDeleteReasonList':'other','wpReason':"[[WP:CSD#G15|CSD G15]] 孤立页面\""+wgPageName+"\""+FriendlyConfig.deletionSummaryAd,'wpEditToken':form.wpEditToken.value}}
self.post(postData);},unlinkImageInstancesMain:function(self){var xmlDoc=self.responseXML;var snapshot=xmlDoc.evaluate('//imageusage/iu/@title',xmlDoc,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null);if(snapshot.snapshotLength==0){return;}
var statusIndicator=new Status('移除链入图像','0%');var total=snapshot.snapshotLength*2;var onsuccess=function(self){var obj=self.params.obj;var total=self.params.total;var now=parseInt(100*++(self.params.current)/total)+'%';obj.update(now);self.statelem.unlink();if(self.params.current>=total){obj.info(now+' (completed)');Wikipedia.removeCheckpoint();}}
var onloaded=onsuccess;var onloading=function(self){}
Wikipedia.addCheckpoint();if(snapshot.snapshotLength==0){statusIndicator.info('100% (完成)');Wikipedia.removeCheckpoint();return;}
var params=clone(self.params);params.current=0;params.total=total;params.obj=statusIndicator;params.image=wgTitle;for(var i=0;i<snapshot.snapshotLength;++i){var title=snapshot.snapshotItem(i).value;var query={'title':title,'action':'submit'}
var wikipedia_wiki=new Wikipedia.wiki("移除链入位于"+title,query,friendlyspeedy.callbacks.sysop.unlinkImageInstances);wikipedia_wiki.params=params;wikipedia_wiki.onloading=onloading;wikipedia_wiki.onloaded=onloaded;wikipedia_wiki.onsuccess=onsuccess;wikipedia_wiki.get();}},unlinkImageInstances:function(self){var form=self.responseXML.getElementById('editform');var text=form.wpTextbox1.value;var old_text=text;var wikiPage=new Mediawiki.Page(text);wikiPage.commentOutImage(self.params.image,'注释出已被删除的图像');text=wikiPage.getText();if(text==old_text){self.onsuccess(self);Wikipedia.actionCompleted(self);return;}
var postData={'wpMinoredit':form.wpMinoredit.checked?'':undefined,'wpWatchthis':undefined,'wpStarttime':form.wpStarttime.value,'wpEdittime':form.wpEdittime.value,'wpAutoSummary':form.wpAutoSummary.value,'wpEditToken':form.wpEditToken.value,'wpSection':'','wpSummary':"移除已经删除的图像"+self.params.image+" ([[WP:CSD#"+self.params.normalized.toUpperCase()+"|CSD "+self.params.normalized.toUpperCase()+"]])"+"; "+FriendlyConfig.deletionSummaryAd,'wpTextbox1':text};self.post(postData);},deletePage:function(self){var form=this.responseXML.getElementById('deleteconfirm');if(!form){form=this.responseXML.getElementsByTagName('form')[0];var postData={'wpDeleteReasonList':'other','wpReason':"[[WP:CSD#"+self.params.normalized.toUpperCase()+"|CSD "+self.params.normalized.toUpperCase()+"]]: "+self.params.reason+FriendlyConfig.deletionSummaryAd,'wpEditToken':form.wpEditToken.value}
self.post(postData);}else{var postData={'wpWatch':(self.params.watch||form.wpWatch.checked)?'':undefined,'wpDeleteReasonList':'other','wpReason':"[[WP:CSD#"+self.params.normalized.toUpperCase()+"|CSD "+self.params.normalized.toUpperCase()+"]] "+self.params.reason+FriendlyConfig.deletionSummaryAd,'wpEditToken':form.wpEditToken.value}
self.post(postData);}},deleteTalkPage:function(self){form=this.responseXML.getElementById('deleteconfirm');var postData={'wpWatch':(self.params.watch||form.wpWatch.checked)?'':undefined,'wpDeleteReasonList':'other','wpReason':"[[WP:CSD#G15|CSD G15]] 孤立页面"+FriendlyConfig.deletionSummaryAd,'wpEditToken':form.wpEditToken.value}
self.post(postData);}},user:{main:function(self){var xmlDoc=self.responseXML;var exists=xmlDoc.evaluate('boolean(//pages/page[not(@missing)])',xmlDoc,null,XPathResult.BOOLEAN_TYPE,null).booleanValue;if(!exists){self.statelem.error("页面不存在,可能已被删除");return;}
var query={'title':wgPageName,'action':'submit'};var wikipedia_wiki=new Wikipedia.wiki('标记页面',query,friendlyspeedy.callbacks.user.tagPage);wikipedia_wiki.params=self.params;wikipedia_wiki.followRedirect=false;wikipedia_wiki.get();},tagPage:function(self){form=this.responseXML.getElementById('editform');var text=form.wpTextbox1.value;if(FriendlyConfig.checkDeleteDup){self.statelem.status('检查页面已有标记...');var tag=/(\{\{(?:db-?|delete\||d\||Delete\||D\|).*?\}\})/.exec(text);if(tag){self.statelem.error([htmlNode('strong',tag[0]),"已被置于条目中"])
return;}
var xfd=/(\{\{(?:[RrSsAaIiTtCcMmVv]fd|md1)[^{}]*?\}\})/i.exec(text);if(xfd&&!confirm("删除讨论模板"+xfd[0]+"已被置于条目中,是否仍希望提交快速删除?")){return;}}
var code;switch(self.params.normalized){case'f7':var filename=prompt('请输入维基共享相应文件名(不含File:):',wgPageName.replace(/_/g,' '));if(filename==null)
{self.statelem.error('用户请求取消');return;}
if(filename==''){filename=wgPageName.replace(/_/g,' ');}
var date=new Date();var code="\{\{nowcommons|"+filename+"\}\}";break;case'f1':case'f5':var img=prompt('输入文件名(不含File:):');if(img==null)
{self.statelem.error('用户请求取消');return;}
code="\{\{d|"+self.params.value.toUpperCase()+"|"+img+"\}\}";break;default:code="\{\{d|"+self.params.value.toUpperCase()+"\}\}";break;}
code='<noinclude>'+code+'</noinclude>'
if(FriendlyConfig.markSpeedyPagesAsPatrolled&&self.params.rcid!=''){var query={'title':wgPageName,'action':'markpatrolled','rcid':self.params.rcid};var wikipedia_wiki=new Wikipedia.wiki('标记页面为已巡查',query);wikipedia_wiki.post();}
var query={'action':'query','prop':'revisions','titles':wgPageName,'rvlimit':1,'rvprop':'user','rvdir':'newer'}
var callback=function(self){var xmlDoc=self.responseXML;var user=xmlDoc.evaluate('//rev/@user',xmlDoc,null,XPathResult.STRING_TYPE,null).stringValue;if(wgPageName!=('User talk:'+user)){var query={'title':'User talk:'+user,'action':'submit'};var wikipedia_wiki=new Wikipedia.wiki('通知页面创建者'+user,query,friendlyspeedy.callbacks.user.userNotification);wikipedia_wiki.params=self.params;wikipedia_wiki.get();}else{Status.info('信息','当前页面为创建者讨论页,取消通知');}}
if(self.params.usertalk){var wikipedia_api=new Wikipedia.api('Grabbing data of initial contributor',query,callback);wikipedia_api.params=self.params;wikipedia_api.post();}
var postData={'wpMinoredit':FriendlyConfig.markSpeedyPagesAsMinor?'':undefined,'wpWatchthis':(self.params.watch||form.wpWatchthis.checked)?'':undefined,'wpStarttime':form.wpStarttime.value,'wpEdittime':form.wpEdittime.value,'wpAutoSummary':form.wpAutoSummary.value,'wpEditToken':form.wpEditToken.value,'wpSection':'','wpSummary':"请求快速删除([[WP:CSD#"+self.params.normalized.toUpperCase()+"|CSD "+self.params.normalized.toUpperCase()+"]])"+FriendlyConfig.summaryAd,'wpTextbox1':code+"\n"+text};self.post(postData);},userNotification:function(self){var nowelcome=FriendlyConfig.welcomeUserOnSpeedyDeletionNotification.indexOf(self.params.normalized)==-1;var form=self.responseXML.getElementById('editform');var text=form.wpTextbox1.value;text+="\n\{\{subst:db-notice|target="+wgPageName+(nowelcome?"|welcome=No":"")+"\}\}--\~\~\~\~";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);}}}
friendlyspeedy.callback.evaluateSysop=function FriendlyspeedyCallbackEvaluateSysop(e){wgPageName=wgPageName.replace(/_/g,' ');var tag_only=e.target.form.tag_only;if(tag_only&&tag_only.checked){return friendlyspeedy.callback.evaluateUser(e);}
var value=e.target.value;var normalized=friendlyspeedy.normalizeHash[value];var params={value:value,normalized:normalized,watch:false,reason:friendlyspeedy.reasonHash[value],openusertalk:FriendlyConfig.openUserTalkPageOnSpeedyDelete.indexOf(normalized)!=-1};Status.init(e.target.form);var query={'action':'query','titles':wgPageName}
var wikipedia_api=new Wikipedia.api('检查页面是否存在',query,friendlyspeedy.callbacks.sysop.main);wikipedia_api.params=params;wikipedia_api.post();}
friendlyspeedy.callback.evaluateUser=function FriendlyspeedyCallbackEvaluateUser(e){wgPageName=wgPageName.replace(/_/g,' ');var value=e.target.value;var normalized=friendlyspeedy.normalizeHash[value];var params={value:value,normalized:normalized,watch:false,usertalk:FriendlyConfig.notifyUserOnSpeedyDeletionNomination.indexOf(normalized)!=-1&&e.target.form.notify.checked,rcid:QueryString.exists('rcid')?QueryString.get('rcid'):''};Status.init(e.target.form);Wikipedia.actionCompleted.redirect=wgPageName;Wikipedia.actionCompleted.notice="完成";var query={'action':'query','titles':wgPageName}
var wikipedia_api=new Wikipedia.api('检查页面是否存在',query,friendlyspeedy.callbacks.user.main);wikipedia_api.params=params;wikipedia_api.post();}
if(typeof(FriendlyConfig)=='undefined'){FriendlyConfig={};}
if(typeof(FriendlyConfig.summaryAd)=='undefined'){FriendlyConfig.summaryAd=" using [[WP:FRIENDLY|Friendly]]";}
if(typeof(FriendlyConfig.revertMaxRevisions)=='undefined'){FriendlyConfig.revertMaxRevisions=50;}
if(typeof(FriendlyConfig.userTalkPageMode)=='undefined'){FriendlyConfig.userTalkPageMode='tab';}
if(typeof(FriendlyConfig.openTalkPage)=='undefined'){FriendlyConfig.openTalkPage=[];}
if(typeof(FriendlyConfig.openTalkPageOnAutoRevert)=='undefined'){FriendlyConfig.openTalkPageOnAutoRevert=false;}
if(typeof(FriendlyConfig.markRevertedPagesAsMinor)=='undefined'){FriendlyConfig.markRevertedPagesAsMinor=['vand'];}
if(typeof(FriendlyConfig.watchRevertedPages)=='undefined'){FriendlyConfig.watchRevertedPages=[];}
if(typeof(FriendlyConfig.offerReasonOnNormalRevert)=='undefined'){FriendlyConfig.offerReasonOnNormalRevert=true;}
if(typeof(FriendlyConfig.showRollbackLinks)=='undefined'){FriendlyConfig.showRollbackLinks=['diff','others','mine','contribs'];}
var WHITELIST=['Jimmy-bot'];friendlyfluff={auto:function(){if(QueryString.get('oldid')!=wgCurRevisionId){return;}
var ntitle=getElementsByClassName(document.getElementById('bodyContent'),'td','diff-ntitle')[0];if(ntitle.getElementsByTagName('a')[0].firstChild.nodeValue.match('当前修订版本')!=null){return;}
vandal=ntitle.getElementsByTagName('a')[3].firstChild.nodeValue;if(!FriendlyConfig.openTalkPageOnAutoRevert){FriendlyConfig.openTalkPage=[];}
return friendlyfluff.revert(QueryString.get('friendlyrevert'),vandal);},normal:function(){var spanTag=function(color,content){var span=document.createElement('span');span.style.color=color;span.appendChild(document.createTextNode(content));return span;}
if(wgNamespaceNumber==-1&&wgCanonicalSpecialPageName=="Contributions"){username=document.evaluate('substring-after(//div[@id="contentSub"]//a[@title="Special:日志"][last()]/@href, "user=")',document,null,XPathResult.STRING_TYPE,null).stringValue;if(FriendlyConfig.showRollbackLinks.indexOf('contribs')!=-1||(wgUserName!=username&&FriendlyConfig.showRollbackLinks.indexOf('others')!=-1)||(wgUserName==username&&FriendlyConfig.showRollbackLinks.indexOf('mine')!=-1)){var list=document.evaluate('//div[@id="bodyContent"]//ul/li[contains(span[@class="mw-uctop"], " (顶)")]',document,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null);var vandal=document.evaluate('//div[@id="contentSub"]/a[1]/@title',document,null,XPathResult.STRING_TYPE,null).stringValue.replace(/^User( talk)?:/,'').replace("'","\\'");var revNode=document.createElement('span');revNode.setAttribute('id','friendly-revert-contrib');revNode.style.fontWeight='bold';var revLink=document.createElement('a');revLink.appendChild(spanTag('Black',' ['));revLink.appendChild(spanTag('SteelBlue','回退'));revLink.appendChild(spanTag('Black',']'));revNode.appendChild(revLink);var revVandNode=document.createElement('span');revVandNode.setAttribute('id','friendly-revert-vand-contrib');revVandNode.style.fontWeight='bold'
var revVandLink=document.createElement('a');revVandLink.appendChild(spanTag('Black',' ['));revVandLink.appendChild(spanTag('Red','破坏'));revVandLink.appendChild(spanTag('Black',']'));revVandNode.appendChild(revVandLink);for(var i=0;i<list.snapshotLength;++i){var current=list.snapshotItem(i);var href=document.evaluate('a[3]/@href',current,null,XPathResult.STRING_TYPE,null).stringValue;var tmpNode=revNode.cloneNode(true);tmpNode.firstChild.setAttribute('href',href+'&'+QueryString.create({'friendlyrevert':'norm'}));current.appendChild(tmpNode);var tmpNode=revVandNode.cloneNode(true);tmpNode.firstChild.setAttribute('href',href+'&'+QueryString.create({'friendlyrevert':'vand'}));current.appendChild(tmpNode);}}}else{if(wgCanonicalSpecialPageName=="Special:Undelete"){return;}
var body=document.getElementById('bodyContent');var firstRev=document.evaluate('boolean(/div[@class="firstrevisionheader"])',body,null,XPathResult.BOOLEAN_TYPE,null).booleanValue;if(firstRev){return;}
try{var otitle1=document.getElementById('mw-diff-otitle1');var ntitle1=document.getElementById('mw-diff-ntitle1');if(!otitle1||!ntitle1)return;var otitle=otitle1.parentNode;var ntitle=ntitle1.parentNode;}catch(e){return;}
var old_rev_url=document.evaluate('//strong/a/@href',document.getElementById('mw-diff-ntitle2'),null,XPathResult.STRING_TYPE,null).stringValue;var query=new QueryString(old_rev_url.split('?',2)[1]);var oldrev=query.get('oldid');var revertToRevision=document.createElement('div');revertToRevision.setAttribute('id','friendly-revert-to-revision');revertToRevision.style.fontWeight='bold';var revertToRevisionLink=revertToRevision.appendChild(document.createElement('a'));revertToRevisionLink.href="javascript:friendlyfluff.revertToRevision('"+oldrev+"')";revertToRevisionLink.appendChild(spanTag('Black','['));revertToRevisionLink.appendChild(spanTag('SaddleBrown','回退至此'));revertToRevisionLink.appendChild(spanTag('Black',']'));otitle.insertBefore(revertToRevision,otitle.firstChild);if(document.getElementById('differences-nextlink')){curVersion=false;return;}
if(FriendlyConfig.showRollbackLinks.indexOf('diff')!=-1){vandal=document.evaluate('a',document.getElementById('mw-diff-ntitle2'),null,XPathResult.STRING_TYPE,null).stringValue.replace("'","\\'");var revertNode=document.createElement('div');revertNode.setAttribute('id','friendly-revert');var agfNode=document.createElement('strong');var vandNode=document.createElement('strong');var normNode=document.createElement('strong');var agfLink=document.createElement('a');var vandLink=document.createElement('a');var normLink=document.createElement('a');agfLink.href="javascript:friendlyfluff.revert('agf' , '"+vandal+"')";vandLink.href="javascript:friendlyfluff.revert('vand' , '"+vandal+"')";normLink.href="javascript:friendlyfluff.revert('norm' , '"+vandal+"')";agfLink.appendChild(spanTag('Black','['));agfLink.appendChild(spanTag('DarkOliveGreen','AGF'));agfLink.appendChild(spanTag('Black',']'));vandLink.appendChild(spanTag('Black','['));vandLink.appendChild(spanTag('Red','破坏'));vandLink.appendChild(spanTag('Black',']'));normLink.appendChild(spanTag('Black','['));normLink.appendChild(spanTag('SteelBlue','回退'));normLink.appendChild(spanTag('Black',']'));agfNode.appendChild(agfLink);vandNode.appendChild(vandLink);normNode.appendChild(normLink);revertNode.appendChild(agfNode);revertNode.appendChild(document.createTextNode(' || '));revertNode.appendChild(normNode);revertNode.appendChild(document.createTextNode(' || '));revertNode.appendChild(vandNode);ntitle.insertBefore(revertNode,ntitle.firstChild);}}}}
friendlyfluff.revert=function revertPage(type,vandal,rev,page){wgPageName=page||wgPageName;wgCurRevisionId=rev||wgCurRevisionId;Status.init(document.getElementById('bodyContent'));var params={type:type,user:vandal}
var query={'action':'query','prop':'revisions','titles':wgPageName,'rvlimit':50,'rvprop':['ids','timestamp','user','comment']}
var wikipedia_api=new Wikipedia.api('抓历史版本数据',query,friendlyfluff.callbacks.main);wikipedia_api.params=params;wikipedia_api.post();}
friendlyfluff.revertToRevision=function revertToRevision(oldrev){Status.init(document.getElementById('bodyContent'));var query={'action':'query','prop':'revisions','titles':wgPageName,'rvlimit':1,'rvstartid':oldrev,'rvprop':['ids','timestamp','user','comment','content'],'format':'xml'}
var wikipedia_api=new Wikipedia.api('抓历史版本数据',query,friendlyfluff.callbacks.toRevision.main);wikipedia_api.params={rev:oldrev};wikipedia_api.post();}
friendlyfluff.callbacks={toRevision:{main:function(self){var xmlDoc=self.responseXML;self.params.revision=xmlDoc.evaluate('//rev',xmlDoc,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue;var query={'title':wgPageName,'action':'submit'};var wikipedia_wiki=new Wikipedia.wiki('回退页面',query,friendlyfluff.callbacks.toRevision.reverting);wikipedia_wiki.params=self.params;wikipedia_wiki.get();},reverting:function(self){var form=self.responseXML.getElementById('editform');var text=self.params.revision.textContent;if(!form){self.statelem.error('无法取得"editform"位点,取消操作');return;}
var optional_summary=prompt("如可能,请提供一个理由");if(optional_summary==null)
{self.statelem.error('由用户中断');return;}
var summary=sprintf("回退至[[Special:Contributions/%s|%1$s]]在%s編輯的%d版本%s%s",self.params.revision.getAttribute('user'),self.params.revision.getAttribute('timestamp'),self.params.revision.getAttribute('revid'),optional_summary?"; "+optional_summary:'',FriendlyConfig.summaryAd);var postData={'wpMinoredit':FriendlyConfig.markRevertedPagesAsMinor.indexOf('torev')!=-1?'':undefined,'wpWatchthis':FriendlyConfig.watchRevertedPages.indexOf('torev')!=-1?'':form.wpWatchthis.checked?'':undefined,'wpStarttime':form.wpStarttime.value,'wpEdittime':form.wpEdittime.value,'wpAutoSummary':form.wpAutoSummary.value,'wpEditToken':form.wpEditToken.value,'wpSection':'','wpSummary':summary,'wpTextbox1':text};Wikipedia.actionCompleted.redirect=wgPageName;Wikipedia.actionCompleted.notice="完成"
self.post(postData);}},main:function(self){var xmlDoc=self.responseXML;var revs=xmlDoc.evaluate('//rev',xmlDoc,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);if(revs.snapshotLength<1){self.statitem.error('不存在历史版本,无法回退');return;}
var top=revs.snapshotItem(0);if(top.getAttribute('revid')<wgCurRevisionId){Status.error('错误',['本页的当前修订版本',htmlNode('strong',top.getAttribute('revid')),'小于提供的修订版本这可能是页面已被删除,或服务器的延迟,取消操作']);return;}
var index=1;if(wgCurRevisionId!=top.getAttribute('revid')){Status.warn('警告',['本页的当前修订版本',htmlNode('strong',top.getAttribute('revid')),'不等于提供的修订版本',htmlNode('strong',wgCurRevisionId)]);if(top.getAttribute('user')==self.params.user){switch(self.params.type){case'vand':Status.info('信息',['本页的当前修订版本由',htmlNode('strong',self.params.user),',被认为是破坏,回退']);break;case'agf':Status.warn('警告',['本页的当前修订版本由',htmlNode('strong',self.params.user),',基于善意推定,问题可能已经解决,取消操作']);return;default:Status.warn('提示',['本页的当前修订版本由',htmlNode('strong',self.params.user),',取消回退']);return;}}
else if(self.params.type=='vand'&&WHITELIST.indexOf(top.getAttribute('user'))!=-1&&revs.snapshotLength>1&&revs.snapshotItem(1).getAttribute('pageId')==wgCurRevisionId){Status.info('信息',['本页的当前修订版本由',htmlNode('strong',top.getAttribute('user')),',一个可信的机器人,之前的版本被认为是破坏,回退']);index=2;}else{Status.error('错误',['本页的当前修订版本由',htmlNode('strong',top.getAttribute('user')),',所以此修订可能已经被回退,取消操作']);return;}}
if(WHITELIST.indexOf(self.params.user)!=-1){switch(self.params.type){case'vand':Status.info('信息',['试图以破坏为由回退',htmlNode('strong',self.params.user),'做出的编辑,但这是一个可信的机器人,回退之前用户做出的破坏']);index=2;vandal=revs.snapshotItem(1).getAttribute('user');self.params.user=revs.snapshotItem(1).getAttribute('user');break;case'agf':Status.warn('信息',['试图以AGF回退',htmlNode('strong',self.params.user),'做出的编辑,但这是一个机器人,此次编辑和AGF无关,取消操作']);return;break;case'norm':default:var cont=confirm('试图常规回退('+self.params.user+')做出的编辑,但这是一个可信的机器人,确认回退?');if(cont){Status.info('信息',['试图常规回退',htmlNode('strong',self.params.user),'做出的编辑,但这是一个可信的机器人,将一并回退上一版本']);index=2;self.params.user=revs.snapshotItem(1).getAttribute('user');}else{Status.warn('信息',['试图常规回退',htmlNode('strong',self.params.user),'做出的编辑,但这是一个可信的机器人,基于您的选择,将执行回退']);}
break;}}
var found=false;var count=0;for(var i=index;i<revs.snapshotLength;++i){++count;if(revs.snapshotItem(i).getAttribute('user')!=self.params.user){found=i;break;}}
if(!found){self.statelem.error(['未发现历史版本,可能',htmlNode('strong',self.params.user),'是唯一贡献者,或其可能连续做出了多于'+FriendlyConfig.revertMaxRevisions+'次编辑']);return;}
if(count==0){Status.error('错误',"即将回退0个版本,这没有任何意义,取消操作");return;}
var good_revision=revs.snapshotItem(found);if(self.params.type!='vand'&&count>1&&!confirm(self.params.user+'做出了'+count+'次编辑,希望一并回退吗?')){Status.info('提示','由用户取消');return;}
self.params.count=count;self.params.goodid=good_revision.getAttribute('revid');self.params.gooduser=good_revision.getAttribute('user');self.statelem.status(['修订版本',htmlNode('strong',good_revision.getAttribute('revid')),'在',htmlNode('strong',count),' 个版本之前由',htmlNode('strong',good_revision.getAttribute('user'),'做出')]);var query={'action':'query','prop':'revisions','titles':wgPageName,'rvlimit':1,'rvprop':'content','rvstartid':good_revision.getAttribute('revid')}
var wikipedia_api=new Wikipedia.api(['获取修订版本',htmlNode('strong',good_revision.getAttribute('revid'))],query,friendlyfluff.callbacks.grabbing);wikipedia_api.params=self.params;wikipedia_api.post();},grabbing:function(self){xmlDoc=self.responseXML;self.params.content=xmlDoc.evaluate('//rev[1]',xmlDoc,null,XPathResult.STRING_TYPE,null).stringValue;var query={'title':wgPageName,'action':'submit'};var wikipedia_wiki=new Wikipedia.wiki('回退页面',query,friendlyfluff.callbacks.reverting);wikipedia_wiki.params=self.params;wikipedia_wiki.get();},reverting:function(self){var doc=self.responseXML;var form=doc.getElementById('editform');if(!form){self.statelem.error('无法取得"editform"位点,取消操作');return;}
var text=self.params.content;if(!text){self.statelem.error('获得了0个修订版本,发生了错误,取消操作');return;}
var summary;switch(self.params.type){case'agf':var extra_summary=prompt("可选的编辑摘要");if(extra_summary==null)
{self.statelem.error('由用户取消');return;}
summary=sprintf("回退由[[Special:Contributions/%s|%1$s]]于%s做出的[[WP:AGF|善意]]编辑%s%s",self.params.user.replace("\\'","'"),self.params.revision.getAttribute('timestamp'),extra_summary?"; "+extra_summary.toUpperCaseFirstChar():'',FriendlyConfig.summaryAd);break;case'vand':summary=sprintf("取消[[Special:Contributions/%s|%1$s]]%d次被视为[[WP:VAND|破坏]]的编辑,更改回[[User:%s|%3$s]]的最后一个版本%s",self.params.user.replace("\\'","'"),self.params.count,self.params.gooduser.replace("\\'","'"),FriendlyConfig.summaryAd);break;case'norm':if(FriendlyConfig.offerReasonOnNormalRevert){var extra_summary=prompt("可选的编辑摘要");if(extra_summary==null)
{self.statelem.error('由用户取消');return;}}
summary=sprintf("回退[[Special:Contributions/%s|%1$s]]的%d次编辑%s%s",self.params.user.replace("\\'","'"),self.params.count,extra_summary?"; "+extra_summary.toUpperCaseFirstChar():'',FriendlyConfig.summaryAd);}
if(FriendlyConfig.openTalkPage.indexOf(self.params.type)!=-1){Status.info('Info',['打开用户讨论页',htmlNode('strong',self.params.user)]);var query={'title':'User talk:'+self.params.user,'action':'edit','preview':'yes','vanarticle':wgPageName.replace(/_/g,' '),'vanarticlerevid':wgCurRevisionId,'vanarticlegoodrevid':self.params.goodid,'type':self.params.type,'count':self.params.count}
switch(FriendlyConfig.userTalkPageMode){case'tab':window.open(mw.config.get('wgServer')+mw.config.get('wgScriptPath')+'/index.php?'+QueryString.create(query),'_tab');break;case'blank':window.open(mw.config.get('wgServer')+mw.config.get('wgScriptPath')+'/index.php?'+QueryString.create(query),'_blank','location=no,toolbar=no,status=no,directories=no,scrollbars=yes,width=1200,height=800');break;case'window':default:window.open(mw.config.get('wgServer')+mw.config.get('wgScriptPath')+'/index.php?'+QueryString.create(query),'friendlywarnwindow','location=no,toolbar=no,status=no,directories=no,scrollbars=yes,width=1200,height=800');break;}}
var postData={'wpMinoredit':FriendlyConfig.markRevertedPagesAsMinor.indexOf(self.params.type)!=-1?'':undefined,'wpWatchthis':FriendlyConfig.watchRevertedPages.indexOf(self.params.type)!=-1?'':form.wpWatchthis.checked?'':undefined,'wpStarttime':form.wpStarttime.value,'wpEdittime':form.wpEdittime.value,'wpAutoSummary':form.wpAutoSummary.value,'wpEditToken':form.wpEditToken.value,'wpSection':'','wpSummary':summary,'wpTextbox1':text};Wikipedia.actionCompleted.redirect=wgPageName;Wikipedia.actionCompleted.notice="完成"
self.post(postData);}}
$(function(){if(QueryString.exists('friendlyrevert')){friendlyfluff.auto();}else{friendlyfluff.normal();}});if(typeof(FriendlyConfig)=='undefined'){FriendlyConfig={};}
if(typeof(FriendlyConfig.summaryAd)=='undefined'){FriendlyConfig.summaryAd=" 通过[[WP:FRIENDLY|Friendly]]";}
if(typeof(FriendlyConfig.markCopyvioAsMinor)=='undefined'){FriendlyConfig.markCopyvioAsMinor=false;}
if(typeof(FriendlyConfig.autoNotifyCopyvio)=='undefined'){FriendlyConfig.autoNotifyCopyvio=true;}
if(typeof(FriendlyConfig.autoReportCopyvio)=='undefined'){FriendlyConfig.autoReportCopyvio=true;}
addOnloadHook(friendlyicv);function friendlyicv(){if(wgNamespaceNumber==6){twAddPortletLink("javascript:friendlyicv.callback()",wgULS("图版","圖版"),"friendly-icv",wgULS("提报图片侵权","提報圖片侵權"),"");}}
friendlyicv.callback=function friendlyicvCallback(uid){var Window=new SimpleWindow(600,200);Window.setTitle("图片疑似侵权");var form=new QuickForm(friendlyicv.callback.evaluate,'change');form.append({type:'header',label:'Click on a statement to submit'});form.append({type:'radio',name:'icv',list:[{label:'缺少来源',value:'source',},{label:'缺少版权信息',value:'license',}]});var result=form.render();Window.setContent(result);Window.display();}
friendlyicv.callbacks={main:function(self){++Wikipedia.numberOfActionsLeft;var xmlDoc=self.responseXML;var exists=xmlDoc.evaluate('boolean(//pages/page[not(@missing)])',xmlDoc,null,XPathResult.BOOLEAN_TYPE,null).booleanValue;if(!exists){self.statelem.error("似乎文件并不存在,可能已被删除?");return;}
var query={'title':wgPageName,'action':'submit'};var wikipedia_wiki=new Wikipedia.wiki('标记页面',query,friendlyicv.callbacks.tagPage);wikipedia_wiki.params=self.params;wikipedia_wiki.followRedirect=false;wikipedia_wiki.get();},tagPage:function(self){form=this.responseXML.getElementById('editform');var code;code="\{\{subst:No "+self.params.value+"/auto\}\}\n";var query={'action':'query','prop':'revisions','titles':wgPageName,'rvlimit':1,'rvprop':'user','rvdir':'newer'}
var callback=function(self){var xmlDoc=self.responseXML;var user=xmlDoc.evaluate('//rev/@user',xmlDoc,null,XPathResult.STRING_TYPE,null).stringValue;if(wgPageName!=('User talk:'+user)){var query={'title':'User talk:'+user,'action':'submit'};var wikipedia_wiki=new Wikipedia.wiki('通知上传者 ('+user+')',query,friendlyicv.callbacks.userNotification);wikipedia_wiki.params=self.params;wikipedia_wiki.get();}else{Status.info('信息','当前页面为上传者讨论页,取消通知。');}}
if(self.params.usertalk){var wikipedia_api=new Wikipedia.api('抓上传者信息',query,callback);wikipedia_api.params=self.params;wikipedia_api.post();}
var postData={'wpMinoredit':FriendlyConfig.markCopyvioAsMinor?'':undefined,'wpWatchthis':form.wpWatchthis.checked?'':undefined,'wpStarttime':form.wpStarttime.value,'wpEdittime':form.wpEdittime.value,'wpAutoSummary':form.wpAutoSummary.value,'wpEditToken':form.wpEditToken.value,'wpSection':'','wpSummary':"标记文件为可能侵犯版权"+FriendlyConfig.summaryAd,'wpTextbox1':code+form.wpTextbox1.value};self.post(postData);var querywp={'action':'query','prop':'revisions','titles':wgPageName,'rvlimit':1,'rvprop':'user','rvdir':'newer'}
var callback=function(self){var xmlDoc=self.responseXML;var user=xmlDoc.evaluate('//rev/@user',xmlDoc,null,XPathResult.STRING_TYPE,null).stringValue;if(wgPageName!=('Wikipedia:頁面存廢討論/疑似侵權')){var query={'title':'Wikipedia:檔案存廢討論/無版權訊息或檔案來源','action':'submit'};var wikipedia_wiki=new Wikipedia.wiki('报告给 WP:ICV',query,friendlyicv.callbacks.reportIcv);wikipedia_wiki.params=self.params;wikipedia_wiki.get();}else{Status.info('信息','当前页面为报告页,取消报告');}}
if(self.params.toreport){var wikipedia_api=new Wikipedia.api('抓报告页信息',query,callback);wikipedia_api.params=self.params;wikipedia_api.post();}
var postData={'wpMinoredit':FriendlyConfig.markCopyvioAsMinor?'':undefined,'wpWatchthis':form.wpWatchthis.checked?'':undefined,'wpStarttime':form.wpStarttime.value,'wpEdittime':form.wpEdittime.value,'wpAutoSummary':form.wpAutoSummary.value,'wpEditToken':form.wpEditToken.value,'wpSection':'','wpSummary':"标记文件为可能侵犯版权"+FriendlyConfig.summaryAd,'wpTextbox1':code+form.wpTextbox1.value};self.post(postData);},userNotification:function(self){var form=self.responseXML.getElementById('editform');var text=form.wpTextbox1.value;if(text=='\n'){text+="\{\{subst:User:Tommyang/Welcome\}\}"}
text+="\n\{\{subst:Uploadvionotice|"+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);},reportIcv:function(self){var form=self.responseXML.getElementById('editform');var text=form.wpTextbox1.value;text+="\*\[\[:"+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);}}
friendlyicv.callback.evaluate=function friendlyicvCallbackEvaluate(e){wgPageName=wgPageName.replace(/_/g,' ');var value=e.target.value;var params={value:value,usertalk:FriendlyConfig.autoNotifyCopyvio!=-1,toreport:FriendlyConfig.autoReportCopyvio!=-1,rcid:QueryString.exists('rcid')?QueryString.get('rcid'):''};Status.init(e.target.form);Wikipedia.actionCompleted.redirect=wgPageName;Wikipedia.actionCompleted.notice="完成";var query={'action':'query','titles':wgPageName}
var wikipedia_api=new Wikipedia.api('检查页面是否存在',query,friendlyicv.callbacks.main);wikipedia_api.params=params;wikipedia_api.post();}
if(typeof(FriendlyConfig)=='undefined'){FriendlyConfig={};}
if(typeof(FriendlyConfig.summaryAd)=='undefined'){FriendlyConfig.summaryAd=" using [[WP:FRIENDLY|Friendly]]";}
if(typeof(FriendlyConfig.markVfdAsMinor)=='undefined'){FriendlyConfig.markVfdAsMinor=false;}
if(typeof(FriendlyConfig.markVfdAsMinor)=='undefined'){FriendlyConfig.markVfdAsMinor=true;}
if(typeof(FriendlyConfig.autoNotifyVfd)=='undefined'){FriendlyConfig.autoNotifyVfd=true;}
var creator="";addOnloadHook(friendlyifd);function friendlyifd(){if(wgNamespaceNumber==6&&wgCurRevisionId!=false){twAddPortletLink("javascript:friendlyifd.callback()","提删","friendly-ifd","提交文件存废讨论","");}else{return;}}
friendlyifd.callback=function friendlyifdCallback(){var Window=new SimpleWindow(600,300);Window.setTitle("提交文件存废讨论");var form=new QuickForm(friendlyifd.callback.evaluate);form.append({type:'textarea',name:'reason',label:"理由"});form.append({type:'submit',label:"提交"});var result=form.render();Window.setContent(result);Window.display();}
friendlyifd.callbacks={main:function(self){++Wikipedia.numberOfActionsLeft;var xmlDoc=self.responseXML;var exists=xmlDoc.evaluate('boolean(//pages/page[not(@missing)])',xmlDoc,null,XPathResult.BOOLEAN_TYPE,null).booleanValue;if(!exists){self.statelem.error("文件不存在,可能已被删除");return;}
var query={'title':wgPageName,'action':'submit'};var wikipedia_wiki=new Wikipedia.wiki("标记文件",query,friendlyifd.callbacks.tagPage);wikipedia_wiki.params=self.params;wikipedia_wiki.followRedirect=false;wikipedia_wiki.get();},tagPage:function(self){form=this.responseXML.getElementById('editform');var text=form.wpTextbox1.value;text="\{\{subst:Vfd/auto|"+self.params.reason+"\}\}\n"+text;if(FriendlyConfig.markVfdAsPatrolled&&self.params.rcid!=''){var query={'title':wgPageName,'action':'markpatrolled','rcid':self.params.rcid};var wikipedia_wiki=new Wikipedia.wiki("标记文件为已巡查",query);wikipedia_wiki.post();}
var query={'action':'query','prop':'revisions','titles':wgPageName,'rvlimit':1,'rvprop':'user','rvdir':'newer'}
var callback=function(self){var xmlDoc=self.responseXML;var user=xmlDoc.evaluate('//rev/@user',xmlDoc,null,XPathResult.STRING_TYPE,null).stringValue;creator=user;if(wgPageName!=('User talk:'+user)){var query={'title':'User talk:'+user,'action':'submit'};var wikipedia_wiki=new Wikipedia.wiki("通知文件创建者"+user+'',query,friendlyifd.callbacks.userNotification);wikipedia_wiki.params=self.params;wikipedia_wiki.get();}else{Status.info("信息","当前文件为创建者讨论页,取消通知");}}
if(self.params.usertalk){var wikipedia_api=new Wikipedia.api("抓创建者数据",query,callback);wikipedia_api.params=self.params;wikipedia_api.post();}
var postData={'wpMinoredit':FriendlyConfig.markVfdAsMinor?'':undefined,'wpWatchthis':form.wpWatchthis.checked?'':undefined,'wpStarttime':form.wpStarttime.value,'wpEdittime':form.wpEdittime.value,'wpAutoSummary':form.wpAutoSummary.value,'wpEditToken':form.wpEditToken.value,'wpSection':'','wpSummary':"提交文件存废讨论"+FriendlyConfig.summaryAd,'wpTextbox1':text};self.post(postData);var query={'action':'query','prop':'revisions','titles':wgPageName,'rvlimit':1,'rvprop':'user','rvdir':'newer'}
var callback=function(self){var xmlDoc=self.responseXML;var user=xmlDoc.evaluate('//rev/@user',xmlDoc,null,XPathResult.STRING_TYPE,null).stringValue;function twodigits(num){return num<10?'0'+num:num;}
var date=new Date();if(wgPageName!=('Wikipedia:檔案存廢討論/記錄/'+date.getUTCFullYear()+'/'+twodigits(date.getUTCMonth()+1)+'/'+twodigits(date.getUTCDate()))){var query={'title':'Wikipedia:檔案存廢討論/記錄/'+date.getUTCFullYear()+'/'+twodigits(date.getUTCMonth()+1)+'/'+twodigits(date.getUTCDate()),'action':'submit'};var wikipedia_wiki=new Wikipedia.wiki("报告给WP:IFD",query,friendlyifd.callbacks.reportIfd);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();var postData={'wpMinoredit':FriendlyConfig.markVfdAsMinor?'':undefined,'wpWatchthis':form.wpWatchthis.checked?'':undefined,'wpStarttime':form.wpStarttime.value,'wpEdittime':form.wpEdittime.value,'wpAutoSummary':form.wpAutoSummary.value,'wpEditToken':form.wpEditToken.value,'wpSection':'','wpSummary':"提交文件存废讨论"+FriendlyConfig.summaryAd,'wpTextbox1':text};self.post(postData);},userNotification:function(self){var form=self.responseXML.getElementById('editform');var text=form.wpTextbox1.value;if(text=='\n'){text+="\{\{subst:User:Tommyang/Welcome\}\}"}
text+="\n\{\{subst:Idw|"+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);},reportIfd:function(self){var form=self.responseXML.getElementById('editform');var text=form.wpTextbox1.value;text+="\{\{subst:IfdItem|Filename="+wgTitle+"|Reason="+self.params.reason+"|Uploader="+creator+"\}\}\~\~\~\~";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);}}
friendlyifd.callback.evaluate=function friendlyifdCallbackEvaluate(e){wgPageName=wgPageName.replace(/_/g,' ');var params={usertalk:FriendlyConfig.autoNotifyVfd!=-1,reason:e.target.reason.value,rcid:QueryString.exists('rcid')?QueryString.get('rcid'):''};Status.init(e.target);Wikipedia.actionCompleted.redirect=wgPageName;Wikipedia.actionCompleted.notice="完成";var query={'action':'query','titles':wgPageName}
var wikipedia_api=new Wikipedia.api("检查文件是否存在",query,friendlyifd.callbacks.main);wikipedia_api.params=params;wikipedia_api.post();}
if(typeof(FriendlyConfig)=='undefined'){FriendlyConfig=function(){};}
if(typeof(FriendlyConfig.summaryAd)=='undefined'){FriendlyConfig.summaryAd=" using [[WP:FRIENDLY|Friendly]]";}
if(typeof(FriendlyConfig.protectionSummaryAd)=='undefined'){FriendlyConfig.protectionSummaryAd=" using [[WP:FRIENDLY|Friendly]]";}
function friendlyrpp(){if(wgNamespaceNumber<0){return;}
if(userIsInGroup('sysop')){twAddPortletLink("javascript:friendlyrpp.callback()",wgULS("保护","保護"),"friendly-rpp",wgULS("保护页面","保護頁面"),"");}else if(userIsInGroup('autoconfirmed')){twAddPortletLink("javascript:friendlyrpp.callback()",wgULS("保护","保護"),"friendly-rpp",wgULS("请求保护页面","請求保護頁面"),"");}
else
{twAddPortletLink('javascript:alert("您必须达到自动确认");',wgULS("保护","保護"),"friendly-rpp",wgULS("请求保护页面","請求保護頁面"),'');}}
addOnloadHook(friendlyrpp);friendlyrpp.callback=function friendlyrppCallback(){var Window=new SimpleWindow(600,400);Window.setTitle(wgULS("保护页面","保護頁面"));var form=new QuickForm(friendlyrpp.callback.evaluate);if(userIsInGroup('sysop')){form.append({type:'checkbox',name:'request_only',event:friendlyrpp.callback.disabledefaults,list:[{label:wgULS("仅请求保护","僅請求保護"),value:'request_only',}]});}
form.append({type:'select',name:'category',label:wgULS("保护类型","保護類型"),event:friendlyrpp.callback.disabledefaults,list:[{label:wgULS("全保护","全保護"),list:[{label:wgULS("常规","常規"),value:'pp-protected'},{label:wgULS("争议","爭議"),selected:wgCurRevisionId!=false,value:'pp-dispute'},{label:wgULS("破坏","破壞"),value:'pp-vandalism'},{label:wgULS("高风险模板","高風險模板"),value:'pp-template'},{label:wgULS("已封禁用户讨论页","已封禁用戶討論頁"),value:'pp-usertalk'}]},{label:wgULS("半保护","半保護"),list:[{label:wgULS("常规","常規"),value:'pp-semi-protected'},{label:wgULS("破坏","破壞"),value:'pp-semi-vandalism'},{label:wgULS("高风险模板","高風險模板"),value:'pp-semi-template'},{label:wgULS("已封禁用户讨论页","已封禁用戶討論頁"),value:'pp-semi-usertalk'}]},{label:'其他',list:[{label:wgULS("移动保护","移動保護"),value:'pp-move'},{label:wgULS("白纸保护","白紙保護"),selected:wgCurRevisionId==false,value:'pp-create'},{label:wgULS("解除保护","解除保護"),value:'unprotect'}]}]});var flags=form.append({type:'field',label:wgULS("选项","選項")});flags.append({type:'checkbox',list:[{name:'noinclude',label:'使用<noinclude>',checked:(wgNamespaceNumber==10),adminonly:true},{name:'small',label:wgULS("使用图标","使用圖標"),adminonly:true},{name:'cascade',label:wgULS("连锁保护","連鎖保護"),}]});if(userIsInGroup('sysop')){form.append({type:'select',name:'expiry',label:wgULS("期限","期限"),event:function(event){var value=event.target.value;event.target.form.small.disabled=value!='indefinite';},list:[{label:wgULS("12 小时","12 小時"),value:'12 hours'},{label:'1 天',value:'1 day'},{label:'3 天',value:'3 days'},{label:wgULS("1 周","1 週"),value:'1 week'},{label:wgULS("2 周","2 週"),value:'2 weeks'},{label:'1 月',value:'1 month'},{label:'3 月',value:'3 months'},{label:'6 月',value:'6 months'},{label:'1 年',value:'1 year'},{label:wgULS("无限期","永久"),selected:true,value:'indefinite'}]});}else{form.append({type:'select',name:'expiry',label:'期限',event:function(event){var value=event.target.value;event.target.form.small.disabled=value!='indefinite';},list:[{label:wgULS("临时","臨時"),value:'temporary'},{label:wgULS("无限期","無限期"),value:'indefinite'},{label:'',selected:true,value:''}]});}
form.append({type:'textarea',name:'reason',label:'原因'});form.append({type:'submit'});var result=form.render();Window.setContent(result);Window.display();}
friendlyrpp.callback.disabledefaults=function friendlyrppCallbackDisableDefaults(e){var root=e.target.form;if(e.target.value=='unprotect'){root.noinclude.disabled=true;root.cascade.disabled=true;root.expiry.disabled=true;root.small.disabled=true;}else{root.noinclude.disabled=false;root.cascade.disabled=false;root.expiry.disabled=false;root.small.disabled=(root.expiry.value=='indefinite'?false:true);if(userIsInGroup('sysop')&&root.request_only.checked){root.small.disabled=true;root.noinclude.disabled=true;}}
if(/template/.test(e.target.value)){root.noinclude.checked=true;root.expiry.disabled=true;}else{root.noinclude.checked=false;}}
friendlyrpp.callback.evaluate=function friendlyrppCallbackEvaluate(e){var form=e.target;var params={noinclude:form.noinclude.checked,cascade:form.cascade.checked,small:form.small.checked,reason:form.reason.value,expiry:form.expiry.value,type:form.category.value}
if(userIsInGroup('sysop')){var request_only=form.request_only.checked;if(request_only&¶ms.expiry!='indefinite'){params.expiry='temporary';}}
Status.init(form);if(userIsInGroup('sysop')&&!request_only){var edit,move,tag=params.type,reason,create='';switch(tag){case'pp-dispute':edit='sysop';move='sysop';reason='全保护: 争议';break;case'pp-vandalism':edit='sysop';move='sysop';reason='全保护: 破坏';break;case'pp-template':edit='sysop';move='sysop';reason='全保护: 高风险模板';break;case'pp-usertalk':edit='sysop';move='sysop';reason='全保护: 已封禁用户讨论页';break;case'pp-protected':edit='sysop';move='sysop';if(params.reason){tag+='|reason='+params.reason;params.reason=undefined;}
reason='全保护';break;case'pp-semi-vandalism':edit='autoconfirmed';move='autoconfirmed';reason='半保护: 破坏';break;case'pp-semi-usertalk':edit='autoconfirmed';move='autoconfirmed';reason='半保护: 已封禁用户讨论页';break;case'pp-semi-template':edit='autoconfirmed';move='autoconfirmed';reason='半保护: 高风险模板';break;case'pp-semi-protected':edit='autoconfirmed';move='autoconfirmed';if(params.reason){tag+='|reason='+params.reason;params.reason=undefined;}
reason='半保护';break;case'pp-move':edit='';move='sysop';reason='移动保护';break;case'pp-create':edit='';move='';create='sysop';reason='白纸保护';break;case'unprotect':default:edit='';move='';reason='解除保护';break;}
if(params.reason){reason+=','+params.reason;}
params.reason=reason;params.tag=tag;params.edit=edit;params.move=move;params.create=create;var query={'title':wgPageName,'action':'protect'};Wikipedia.actionCompleted.redirect=query['title'];Wikipedia.actionCompleted.notice="完成";var wikipedia_wiki=new Wikipedia.wiki('保护页面',query,friendlyrpp.callbacks.sysop.protectingPage);wikipedia_wiki.params=params;wikipedia_wiki.get();}else{var typename,reason;switch(params.type){case'pp-dispute':case'pp-vandalism':case'pp-template':case'pp-usertalk':case'pp-protected':typename='全保护';break;case'pp-semi-vandalism':case'pp-semi-usertalk':case'pp-semi-template':case'pp-semi-spambot':case'pp-semi-protected':typename='半保护';break;case'pp-move':typename='移动保护';break;case'pp-create':typename='白纸保护';break;case'unprotect':default:typename='解除保护';break;}
switch(params.type){case'pp-dispute':reason=':争议';break;case'pp-vandalism':case'pp-semi-vandalism':reason=':破坏';break;case'pp-template':case'pp-semi-template':reason=':高风险模板';break;case'pp-usertalk':case'pp-semi-usertalk':reason=':已封禁用户讨论页';break;case'pp-protected':case'pp-semi-protected':case'pp-move':case'pp-create':case'unprotect':default:reason='';break;}
if(params.reason){reason+=',原因:'+params.reason;}
params.reason=reason;params.typename=typename;var query={'title':'Wikipedia:请求保护页面','action':'submit'};Wikipedia.actionCompleted.redirect=query['title'];Wikipedia.actionCompleted.notice="请求完成,重定向到请求页";var wikipedia_wiki=new Wikipedia.wiki('请求保护页面',query,friendlyrpp.callbacks.user);wikipedia_wiki.params=params;wikipedia_wiki.get();}}
friendlyrpp.callbacks={sysop:{taggingPage:function(self){var form=self.responseXML.getElementById('editform');var oldtag_re=/\s*(?:<noinclude>)?\s*\{\{\s*(pp-[^{}]*?|protected|(?:t|v|s|p-|usertalk-v|usertalk-s|sb|move)protected(?:2)?|protected template|privacy protection)\s*?\}\}\s*(?:<\/noinclude>)?\s*/gi;var text=form.wpTextbox1.value;text=text.replace(oldtag_re,'');if(self.params.type!='unprotect'&&self.params.expiry!='indefinite'){self.params.tag+='|expiry={{'+'subst:#time:c|+'+self.params.expiry+'}}';}
if(self.params.type!='unprotect'&&self.params.small){self.params.tag+='|small=yes';}
var summary;if(self.params.type=='unprotect'){summary='移除保护模板'+FriendlyConfig.summaryAd;}else{if(self.params.noinclude){text="<noinclude>\{\{"+self.params.tag+"\}\}</noinclude>"+text;}else{text="\{\{"+self.params.tag+"\}\}\n"+text;}
summary="加入\{\{"+self.params.tag+"\}\}"+FriendlyConfig.summaryAd;}
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,'wpSummary':summary,'wpTextbox1':text};self.post(postData);},protectingPage:function(self){var form=self.responseXML.getElementById('mw-Protect-Form');var postData;if(self.params.type=='pp-move'){postData={'wpEditToken':form.wpEditToken.value,'mwProtect-level-move':self.params.move,'wpProtectExpirySelection-move':self.params.expiry!='indefinite'?'othertime':'indefinite','mwProtect-expiry-move':self.params.expiry!='indefinite'?self.params.expiry:undefined,'mwProtect-cascade':self.params.cascade?'':undefined,'mwProtectWatch':form.mwProtectWatch.checked?'':undefined,'wpProtectReasonSelection':'other','mwProtect-reason':self.params.reason+FriendlyConfig.protectionSummaryAd};}else if(self.params.type=='pp-create'){postData={'wpEditToken':form.wpEditToken.value,'mwProtect-level-create':self.params.create,'wpProtectExpirySelection-create':self.params.expiry!='indefinite'?'othertime':'indefinite','mwProtect-expiry-create':self.params.expiry!='indefinite'?self.params.expiry:undefined,'mwProtect-cascade':self.params.cascade?'':undefined,'mwProtectWatch':form.mwProtectWatch.checked?'':undefined,'wpProtectReasonSelection':'other','mwProtect-reason':self.params.reason+FriendlyConfig.protectionSummaryAd};}else if(self.params.type=='unprotect'){postData={'wpEditToken':form.wpEditToken.value,'mwProtect-level-edit':self.params.edit,'wpProtectExpirySelection-edit':'indefinite','mwProtect-level-move':self.params.move,'wpProtectExpirySelection-move':'indefinite','mwProtect-level-create':self.params.create,'wpProtectExpirySelection-create':'indefinite','mwProtect-cascade':self.params.cascade?'':undefined,'mwProtectWatch':form.mwProtectWatch.checked?'':undefined,'wpProtectReasonSelection':'other','mwProtect-reason':self.params.reason+FriendlyConfig.protectionSummaryAd};}else{postData={'wpEditToken':form.wpEditToken.value,'mwProtect-level-edit':self.params.edit,'wpProtectExpirySelection-edit':self.params.expiry!='indefinite'?'othertime':'indefinite','mwProtect-expiry-edit':self.params.expiry!='indefinite'?self.params.expiry:undefined,'mwProtect-level-move':self.params.move,'wpProtectExpirySelection-move':self.params.expiry!='indefinite'?'othertime':'indefinite','mwProtect-expiry-move':self.params.expiry!='indefinite'?self.params.expiry:undefined,'mwProtect-cascade':self.params.cascade?'':undefined,'mwProtectWatch':form.mwProtectWatch.checked?'':undefined,'wpProtectReasonSelection':'other','mwProtect-reason':self.params.reason+FriendlyConfig.protectionSummaryAd};}
self.post(postData);var query={'title':wgPageName,'action':'submit'};if(self.params.create==''){var wikipedia_wiki=new Wikipedia.wiki('标记页面',query,friendlyrpp.callbacks.sysop.taggingPage);wikipedia_wiki.params=self.params;wikipedia_wiki.get();}}},user:function(self){var form=self.responseXML.getElementById('editform');var text=form.wpTextbox1.value;var rppRe=new RegExp('===\\s*'+RegExp.escape(wgPageName,true)+'\\s*===','m');var tag=rppRe.exec(text);if(tag){self.statelem.warn([htmlNode('strong',tag[0]),"已经存在"])
return false;}
var newtag='=== [['+wgPageName+']] ==='+"\n";if((new RegExp('^'+RegExp.escape(newtag).replace(/\s+/g,'\\s*'),'m')).test(text)){self.statelem.error('已有请求保护项目,取消');return;}
newtag+='* ';var words=[];switch(self.params.expiry){case'temporary':words.push("临时");break;case'indefinite':words.push("永久");break;}
if(self.params.cascade){words.push("连锁");}
words.push(self.params.typename);newtag+=words.join('')+(self.params.reason!=''?self.params.reason:'')+"--\~\~\~\~";if(self.params.type=='unprotect'){var str='<span id="friendly-rpp-u" />';}else{var str='<span id="friendly-rpp" />';}
var originalTextLength=text.length;text=text.replace(str,str+"\n"+newtag);if(text.length==originalTextLength)
{self.statelem.error('无法找到位点标识符,取消');return;}
var postData={'wpMinoredit':undefined,'wpWatchthis':form.wpWatchthis.checked?'':undefined,'wpStarttime':form.wpStarttime.value,'wpEdittime':form.wpEdittime.value,'wpAutoSummary':form.wpAutoSummary.value,'wpEditToken':form.wpEditToken.value,'wpSection':'','wpSummary':"请求"+self.params.typename+',[['+wgPageName.replace(/_/g,' ')+']]'+FriendlyConfig.summaryAd,'wpTextbox1':text};self.post(postData);}}
if(typeof(FriendlyConfig)=='undefined'){FriendlyConfig={};}
if(typeof(FriendlyConfig.summaryAd)=='undefined'){FriendlyConfig.summaryAd=" using [[WP:FRIENDLY|Friendly]]";}
if(typeof(FriendlyConfig.markSharedIPAsMinor)=='undefined'){FriendlyConfig.markSharedIPAsMinor=true;}
addOnloadHook(friendlyshared);function friendlyshared(){if(wgNamespaceNumber==3&&isIPAddress(wgTitle)){var username=wgTitle.split('/')[0].replace(/\"/,"\\\"");twAddPortletLink("javascript:friendlyshared.callback(\""+username+"\")",wgULS("公用","公用"),"friendly-shared",wgULS("标记公用IP","標記公用IP"),"");}}
friendlyshared.callback=function friendlysharedCallback(uid){var Window=new SimpleWindow(600,400);Window.setTitle("Choose a shared IP address template");var form=new QuickForm(friendlyshared.callback.evaluate);form.append({type:'header',label:'Shared IP address templates'});form.append({type:'radio',name:'shared',list:friendlyshared.standardList,event:function(e){friendlyshared.callback.change_shared(e);e.stopPropagation();}});var org=form.append({type:'field',label:'Fill in IP address owner/operator, hostname and contact information (if applicable) and hit \"Submit\"'});org.append({type:'input',name:'organization',label:'Organization name',disabled:true,tooltip:'Some of these templates support an optional parameter for the organization name that owns/operates the IP address. The organization name can be entered here for those templates, including wikimarkup if necessary.'});org.append({type:'input',name:'host',label:'Host name (optional)',disabled:true,tooltip:'These templates support an optional parameter for the host name. The host name (for example, proxy.example.com) can be entered here and will be linked by the template.'});org.append({type:'input',name:'contact',label:'Contact information (only if requested)',disabled:true,tooltip:'Some of these templates support an optional parameter for the organization\'s contact information. Use this parameter only if the organization has specifically request that it be added. This contact information can be entered here for those templates, including wikimarkup if necessary.'});form.append({type:'submit'});var result=form.render();Window.setContent(result);Window.display();}
friendlyshared.standardList=[{label:'{{sharedip}}: standard shared IP address template',value:'sharedip',tooltip:'IP user talk page template that shows helpful information to IP users and those wishing to warn or ban them'},{label:'{{sharedipedu}}: shared IP address template modified for educational institutions',value:'sharedipedu'},{label:'{{sharedippublic}}: shared IP address template modified for public terminals',value:'sharedippublic'},{label:'{{sharedipusmilitary}}: shared IP address template modified for the US military',value:'sharedipusmilitary'},{label:'{{dynamicip}}: shared IP address template modified for organizations with dynamic addressing',value:'dynamicip'},{label:'{{isp}}: shared IP address template modified for ISP organizations',value:'isp'},{label:'{{mobileip}}: shared IP address template modified mobile phone company and their customers',value:'mobileip'}]
friendlyshared.callback.change_shared=function friendlytagCallbackChangeShared(e){if(e.target.value=='sharedipedu'){e.target.form.contact.disabled=false;}else{e.target.form.contact.disabled=true;}
e.target.form.organization.disabled=false;e.target.form.host.disabled=false;}
friendlyshared.callbacks={main:function(self){var form=self.responseXML.getElementById('editform');var found=false;var text='{{';for(var i=0;i<friendlyshared.standardList.length;i++){tagRe=new RegExp('(\{\{'+friendlyshared.standardList[i].value+'(\||\}\}))','im');if(tagRe.exec(form.wpTextbox1.value)){Status.info('Info','Found {{'+friendlyshared.standardList[i].value+'}} on the user\'s talk page already...aborting');found=true;text=form.wpTextbox1.value;}}
if(!found){Status.info('Info','Will add the shared IP address template to the top of the user\'s talk page.');text+=self.params.value+'|'+self.params.organization;if(self.params.value=='sharedipedu'&&self.params.contact!=''){text+='|'+self.params.contact;}
if(self.params.host!=''){text+='|host='+self.params.host;}
text+='}}\n\n'+form.wpTextbox1.value;}
var postData={'wpMinoredit':FriendlyConfig.markSharedIPAsMinor?1:undefined,'wpWatchthis':form.wpWatchthis.checked?1:undefined,'wpStarttime':form.wpStarttime.value,'wpEdittime':form.wpEdittime.value,'wpAutoSummary':form.wpAutoSummary.value,'wpEditToken':form.wpEditToken.value,'wpSummary':'Added \{\{[[Template:'+self.params.value+'|'+self.params.value+']]\}\} template to user talk page.'+FriendlyConfig.summaryAd,'wpTextbox1':text};self.post(postData);}}
friendlyshared.callback.evaluate=function friendlysharedCallbackEvaluate(e){var shared=e.target.getChecked('shared');if(!shared||shared.length<=0){alert('You must select a shared IP address template to use!');return;}
var value=shared[0];if(e.target.organization.value==''){alert('You must input an organization for the {{'+value+'}} template!');return;}
var params={value:value,organization:e.target.organization.value,host:e.target.host.value,contact:e.target.contact.value};Status.init(e.target);var query={'title':wgPageName,'action':'submit'};Wikipedia.actionCompleted.redirect=wgPageName;Wikipedia.actionCompleted.notice="Shared IP tagging complete, reloading talk page in some seconds";var wikipedia_wiki=new Wikipedia.wiki('User talk page modification',query,friendlyshared.callbacks.main);wikipedia_wiki.params=params;wikipedia_wiki.get();}
if(typeof(FriendlyConfig)=='undefined'){FriendlyConfig={};}
if(typeof(FriendlyConfig.idsToRename)=='undefined'){FriendlyConfig.idsToRename=[];}
function friendlyFindTabCaption(tab){while(tab.nodeType!=3){tab=tab.firstChild;}
return tab.parentNode;}
function friendlytabs(){for(i=0;i<FriendlyConfig.idsToRename.length;i++){if(document.getElementById(FriendlyConfig.idsToRename[i].id)){if(typeof(FriendlyConfig.idsToRename[i].mainPageOnly)=='boolean'&&FriendlyConfig.idsToRename[i].mainPageOnly){if(wgPageName=='Wikipedia:首页'){friendlyFindTabCaption(document.getElementById(FriendlyConfig.idsToRename[i].id)).innerHTML=FriendlyConfig.idsToRename[i].name;}}else{friendlyFindTabCaption(document.getElementById(FriendlyConfig.idsToRename[i].id)).innerHTML=FriendlyConfig.idsToRename[i].name;}}}}
addOnloadHook(friendlytabs);if(typeof(FriendlyConfig)=='undefined'){FriendlyConfig={};}
if(typeof(FriendlyConfig.summaryAd)=='undefined'){FriendlyConfig.summaryAd=" using [[WP:FRIENDLY|Friendly]]";}
if(typeof(FriendlyConfig.groupByDefault)=='undefined'){FriendlyConfig.groupByDefault=true;}
if(typeof(FriendlyConfig.watchTaggedPages)=='undefined'){FriendlyConfig.watchTaggedPages=false;}
if(typeof(FriendlyConfig.markTaggedPagesAsMinor)=='undefined'){FriendlyConfig.markTaggedPagesAsMinor=true;}
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("标记条目","標記條目"),"");}}
addOnloadHook(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重定向'}];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){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{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]=='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]=='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();}
if(typeof(FriendlyConfig)=='undefined'){FriendlyConfig={};}
if(typeof(FriendlyConfig.summaryAd)=='undefined'){FriendlyConfig.summaryAd=" using [[WP:FRIENDLY|Friendly]]";}
if(typeof(FriendlyConfig.markTalkbackAsMinor)=='undefined'){FriendlyConfig.markTalkbackAsMinor=true;}
if(typeof(FriendlyConfig.insertHeadings)=='undefined'){FriendlyConfig.insertHeadings=true;}
if(typeof(FriendlyConfig.insertSignature)=='undefined'){FriendlyConfig.insertSignature=true;}
if(typeof(FriendlyConfig.talkbackHeading)=='undefined'){FriendlyConfig.talkbackHeading='回复通告'}
addOnloadHook(friendlytalkback);function friendlytalkback(){if(wgNamespaceNumber==3){var username=wgTitle.split('/')[0].replace(/\"/,"\\\"");twAddPortletLink("javascript:friendlytalkback.callback(\""+username+"\")",wgULS("回复","回覆"),"friendly-talkback",wgULS("新回复通告","新回覆通告"),"");}}
friendlytalkback.callback=function friendlytalkbackCallback(uid){if(uid==wgUserName){alert('请不要回复自己。');return;}
var Window=new SimpleWindow(600,350);Window.setTitle("Talkback");var form=new QuickForm(friendlytalkback.callback.evaluate);form.append({type:'radio',name:'tbtarget',list:[{label:'我的讨论页',value:'mytalk',checked:'true'},{label:'其他用户的讨论页',value:'usertalk'},{label:'其他讨论页',value:'other'}],event:friendlytalkback.callback.change_target});form.append({type:'field',label:'Work area',name:'work_area'});var result=form.render();Window.setContent(result);Window.display();var evt=document.createEvent("Event");evt.initEvent('change',true,true);result.tbtarget[0].dispatchEvent(evt);}
friendlytalkback.callback.change_target=function friendlytagCallbackChangeTarget(e){var value=e.target.value;var root=e.target.form;var old_area;for(var i=0;i<root.childNodes.length;++i){var node=root.childNodes[i];if(node instanceof Element&&node.getAttribute('name')=='work_area'){old_area=node;break;}}
var work_area=new QuickForm.element({type:'field',label:'回复信息',name:'work_area'});switch(value){default:case'mytalk':work_area.append({type:'input',name:'section',label:'链接章节(可选)'});break;case'usertalk':work_area.append({type:'input',name:'page',label:'用户'});work_area.append({type:'input',name:'section',label:'链接章节(可选)'});break;case'other':work_area.append({type:'input',name:'page',label:'完整页面名称'});work_area.append({type:'input',name:'section',label:'链接章节(可选)'});break;}
work_area.append({type:'textarea',label:'附加信息(可选):',name:'message'});work_area.append({type:'submit'});work_area=work_area.render();old_area.parentNode.replaceChild(work_area,old_area);}
friendlytalkback.callbacks={main:function(self){self.statelem.status('抓编辑令牌...');var xmlDoc=self.responseXML;var editToken=xmlDoc.evaluate('//page/@edittoken',xmlDoc,null,XPathResult.STRING_TYPE,null).stringValue;var text='{\{talkback|';if(self.params.tbtarget=='usertalk'||self.params.tbtarget=='other'){text+=self.params.page;}else{text+=wgUserName;}
if(self.params.section!=''){text+='|'+self.params.section;}
text+='\}\}';if(self.params.message!=''){text+='\n'+self.params.message+'--\~\~\~\~';}else if(FriendlyConfig.insertSignature){text+='\n--\~\~\~\~';}
var query={'action':'edit','title':wgPageName,'section':'new','text':text,'token':editToken,'summary':FriendlyConfig.talkbackHeading,'minor':FriendlyConfig.markTalkbackAsMinor?1:undefined};var wikipedia_api=new Wikipedia.api('添加回复通告到用户讨论页...',query,null,self.statelem);wikipedia_api.post();}}
friendlytalkback.callback.evaluate=function friendlytalkbackCallbackEvaluate(e){var tbtarget=e.target.getChecked('tbtarget')[0];var page=null;var section=e.target.section.value;if(tbtarget=='usertalk'||tbtarget=='other'){page=e.target.page.value;if(tbtarget=='usertalk'){if(page==''){alert('您必须指定用户名');return;}}else{if(page==''){alert('您必须指定页面名称');return;}}}
var params={tbtarget:tbtarget,page:page,section:section,message:e.target.message.value};Status.init(e.target);Wikipedia.actionCompleted.redirect=wgPageName;Wikipedia.actionCompleted.notice="完成";var query={'action':'query','prop':'info','intoken':'edit','titles':wgPageName};var wikipedia_api=new Wikipedia.api('状态',query,friendlytalkback.callbacks.main);wikipedia_api.params=params;wikipedia_api.post();}
if(typeof(FriendlyConfig)=='undefined'){FriendlyConfig={};}
if(typeof(FriendlyConfig.summaryAd)=='undefined'){FriendlyConfig.summaryAd=" using [[WP:FRIENDLY|Friendly]]";}
if(typeof(FriendlyConfig.markVfdAsMinor)=='undefined'){FriendlyConfig.markVfdAsMinor=false;}
if(typeof(FriendlyConfig.markVfdAsPatrolled)=='undefined'){FriendlyConfig.markVfdAsPatrolled=true;}
if(typeof(FriendlyConfig.autoNotifyVfd)=='undefined'){FriendlyConfig.autoNotifyVfd=true;}
addOnloadHook(friendlyvfd);var isRedirect=false;function friendlyvfd(){if(QueryString.exists('redirect')&&QueryString.get('redirect')=='no'&&!QueryString.exists('rcid')){isRedirect=true;}
if(wgNamespaceNumber<0||wgNamespaceNumber==6||wgCurRevisionId==false){return;}else{twAddPortletLink("javascript:friendlyvfd.callback()","提删","friendly-vfd","提交存废讨论","");}}
friendlyvfd.callback=function friendlyvfdCallback(){var Window=new SimpleWindow(600,300);Window.setTitle("提交存废讨论");var form=new QuickForm(friendlyvfd.callback.evaluate);form.append({type:'select',name:'category',label:"类型",list:[{label:"删除",value:'delete'},{label:"合并",value:'merge'},{label:'移动到',list:[{label:"维基辞典",value:'vmd'},{label:"维基文库",value:'vms'},{label:"维基教科书",value:'vmb'},{label:"维基语录",value:'vmq'}]}]});form.append({type:'checkbox',list:[{label:'如果可能,通知创建者',value:'notify',name:'notify',checked:true}]});form.append({type:'textarea',name:'reason',label:wgULS("理由","理由")});form.append({type:'submit',label:wgULS("提交","提交")});var result=form.render();Window.setContent(result);Window.display();}
var to="";friendlyvfd.callbacks={main:function(self){if(self.params.type=='merge'){to=prompt("合并目标");if(to==''){self.statelem.error("未指定合并目标");return;}}
++Wikipedia.numberOfActionsLeft;var xmlDoc=self.responseXML;var exists=xmlDoc.evaluate('boolean(//pages/page[not(@missing)])',xmlDoc,null,XPathResult.BOOLEAN_TYPE,null).booleanValue;if(!exists){self.statelem.error("页面不存在,可能已被删除");return;}
var query={'title':wgPageName,'action':'submit'};var wikipedia_wiki=new Wikipedia.wiki(wgULS("标记页面","標記頁面"),query,friendlyvfd.callbacks.tagPage);wikipedia_wiki.params=self.params;wikipedia_wiki.followRedirect=false;wikipedia_wiki.get();},tagPage:function(self){form=this.responseXML.getElementById('editform');var text=form.wpTextbox1.value;if((self.params.type=='vmd')||(self.params.type=='vms')||(self.params.type=='vmq')||(self.params.type=='vmb')){text="\{\{subst:Vfd/auto||"+self.params.type+"\}\}\n"+text;}else{text="\{\{subst:Vfd/auto|"+self.params.reason+(isRedirect?"|r":"")+"\}\}\n"+text;}
if(FriendlyConfig.markVfdAsPatrolled&&self.params.rcid!=''){var query={'title':wgPageName,'action':'markpatrolled','rcid':self.params.rcid};var wikipedia_wiki=new Wikipedia.wiki(wgULS("标记页面为已巡查","標記頁面為已巡查"),query);wikipedia_wiki.post();}
var query={'action':'query','prop':'revisions','titles':wgPageName,'rvlimit':1,'rvprop':'user','rvdir':'newer'}
var callback=function(self){var xmlDoc=self.responseXML;var user=xmlDoc.evaluate('//rev/@user',xmlDoc,null,XPathResult.STRING_TYPE,null).stringValue;if(wgPageName!=('User talk:'+user)){var query={'title':'User talk:'+user,'action':'submit'};var wikipedia_wiki=new Wikipedia.wiki("通知页面创建者"+user+'',query,friendlyvfd.callbacks.userNotification);wikipedia_wiki.params=self.params;wikipedia_wiki.get();}else{Status.info("信息","当前页面为创建者讨论页,取消通知");}}
if(self.params.notify){var wikipedia_api=new Wikipedia.api("抓创建者数据",query,callback);wikipedia_api.params=self.params;wikipedia_api.post();}
var postData={'wpMinoredit':FriendlyConfig.markVfdAsMinor?'':undefined,'wpWatchthis':form.wpWatchthis.checked?'':undefined,'wpStarttime':form.wpStarttime.value,'wpEdittime':form.wpEdittime.value,'wpAutoSummary':form.wpAutoSummary.value,'wpEditToken':form.wpEditToken.value,'wpSection':'','wpSummary':"提交存废讨论"+FriendlyConfig.summaryAd,'wpTextbox1':text};self.post(postData);var callback=function(self){var xmlDoc=self.responseXML;var user=xmlDoc.evaluate('//rev/@user',xmlDoc,null,XPathResult.STRING_TYPE,null).stringValue;function twodigits(num){return num<10?'0'+num:num;}
var date=new Date();if(wgPageName!=('Wikipedia:頁面存廢討論/記錄/'+date.getUTCFullYear()+'/'+twodigits(date.getUTCMonth()+1)+'/'+twodigits(date.getUTCDate()))){var query={'title':'Wikipedia:頁面存廢討論/記錄/'+date.getUTCFullYear()+'/'+twodigits(date.getUTCMonth()+1)+'/'+twodigits(date.getUTCDate()),'action':'submit'};var wikipedia_wiki=new Wikipedia.wiki("报告给WP:AFD",query,friendlyvfd.callbacks.reportVfd);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();var postData={'wpMinoredit':FriendlyConfig.markVfdAsMinor?'':undefined,'wpWatchthis':form.wpWatchthis.checked?'':undefined,'wpStarttime':form.wpStarttime.value,'wpEdittime':form.wpEdittime.value,'wpAutoSummary':form.wpAutoSummary.value,'wpEditToken':form.wpEditToken.value,'wpSection':'','wpSummary':"提交存废讨论"+FriendlyConfig.summaryAd,'wpTextbox1':text};self.post(postData);},userNotification:function(self){var form=self.responseXML.getElementById('editform');var text=form.wpTextbox1.value;text+="\n\{\{subst:AFDNote|"+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);},reportVfd:function(self){var form=self.responseXML.getElementById('editform');var text=form.wpTextbox1.value;var type=((self.params.type=='vmd')||(self.params.type=='vms')||(self.params.type=='vmq')||(self.params.type=='vmb'))?'vm':self.params.type;if(type=='vm'){to=self.params.type;}else if(type!="merge"){to='';}
text+="\{\{subst:DRItem|Type="+type+"|DRarticles="+wgPageName+"|Reason="+self.params.reason+"|To="+to+"\}\}\~\~\~\~";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);}}
friendlyvfd.callback.evaluate=function friendlyvfdCallbackEvaluate(e){wgPageName=wgPageName.replace(/_/g,' ');var params={reason:e.target.reason.value,rcid:QueryString.exists('rcid')?QueryString.get('rcid'):'',type:e.target.category.value,notify:e.target.notify.checked};Status.init(e.target);Wikipedia.actionCompleted.redirect=wgPageName;Wikipedia.actionCompleted.notice=wgULS("完成","完成");var query={'action':'query','titles':wgPageName}
var wikipedia_api=new Wikipedia.api(wgULS("检查页面是否存在","檢查頁面是否存在"),query,friendlyvfd.callbacks.main);wikipedia_api.params=params;wikipedia_api.post();}
if(typeof(FriendlyConfig)=='undefined'){FriendlyConfig={};}
if(typeof(FriendlyConfig.defaultWarningGroup)=='undefined'){FriendlyConfig.defaultWarningGroup=1;}
if(typeof(FriendlyConfig.showSharedIPNotice)=='undefined'){FriendlyConfig.showSharedIPNotice=true;}
if(typeof(FriendlyConfig.watchWarnings)=='undefined'){FriendlyConfig.watchWarnings=false;}
if(typeof(FriendlyConfig.blankTalkpageOnIndefBlock)=='undefined'){FriendlyConfig.blankTalkpageOnIndefBlock=false;}
if(typeof(FriendlyConfig.summaryAd)=='undefined'){FriendlyConfig.summaryAd=" using [[WP:FRIENDLY|Friendly]]";}
function friendlywarn(){if(wgNamespaceNumber==3){twAddPortletLink((userIsInGroup('autoconfirmed')?"javascript:friendlywarn.callback()":'javascript:alert("您必须首先达到自动确认。");'),"警告","friendly-warn","警告用户","");}}
addOnloadHook(friendlywarn);friendlywarn.callback=function friendlywarnCallback(){var Window=new SimpleWindow(600,400);Window.setTitle("Warn/Notify user");var form=new QuickForm(friendlywarn.callback.evaluate);var main_select=form.append({type:'field',label:'选择适用模板'});var main_group=main_select.append({type:'select',name:'main_group',event:friendlywarn.callback.change_category});main_group.append({type:'option',label:'层级1',value:'level1',selected:(FriendlyConfig.defaultWarningGroup==1||FriendlyConfig.defaultWarningGroup<1||(userIsInGroup('sysop')?FriendlyConfig.defaultWarningGroup>8:FriendlyConfig.defaultWarningGroup>7))});main_group.append({type:'option',label:'层级2',value:'level2',selected:(FriendlyConfig.defaultWarningGroup==2)});main_group.append({type:'option',label:'层级3',value:'level3',selected:(FriendlyConfig.defaultWarningGroup==3)});main_group.append({type:'option',label:'层级4',value:'level4',selected:(FriendlyConfig.defaultWarningGroup==4)});main_group.append({type:'option',label:'层级4im',value:'level4im',selected:(FriendlyConfig.defaultWarningGroup==5)});main_group.append({type:'option',label:'单层级通知',value:'singlenotice',selected:(FriendlyConfig.defaultWarningGroup==6)});main_group.append({type:'option',label:'单层级警告',value:'singlewarn',selected:(FriendlyConfig.defaultWarningGroup==7)});if(userIsInGroup('sysop')){main_group.append({type:'option',label:'封禁',value:'block',selected:(FriendlyConfig.defaultWarningGroup==8)});}
main_select.append({type:'select',name:'sub_group',event:friendlywarn.callback.change_subcategory});form.append({type:'input',name:'article',label:'相关条目',value:(QueryString.exists('vanarticle')?QueryString.get('vanarticle'):'')});var more=form.append({type:'field',label:'更多'});more.append({type:'textarea',label:'一些附加文字:',name:'reason'});more.append({type:'submit',label:'提交'});var result=form.render();Window.setContent(result);Window.display();result.main_group.root=result;var evt=document.createEvent("Event");evt.initEvent('change',true,true);result.main_group.dispatchEvent(evt);}
friendlywarn.messages={level1:{"uw-vandalism1":{label:"破坏",summary:"层级1: 破坏"},"uw-test1":{label:"编辑测试",summary:"层级1: 编辑测试"},"uw-delete1":{label:"清空页面、移除内容或模板",summary:"层级1: 清空页面、移除内容或模板"},"uw-redirect1":{label:"创建恶意重定向",summary:"层级1: 创建恶意重定向"},"uw-tdel1":{label:"移除维护性模板",summary:"层级1: 移除维护性模板"},"uw-joke1":{label:"使用不恰当的幽默文字",summary:"层级1: 使用不恰当的幽默文字"},"uw-create1":{label:"建立不适当的页面",summary:"层级1: 建立不适当的页面"},"uw-upload1":{label:"上传不适当的图像",summary:"层级1: 上传不适当的图像"},"uw-image1":{label:"图像相关的破坏",summary:"层级1: 图像相关的破坏"},"uw-spam1":{label:"增加垃圾连结",summary:"层级1: 增加垃圾连结"},"uw-advert1":{label:"利用维基百科来发布广告或推广",summary:"层级1: 利用维基百科来发布广告或推广"},"uw-npov1":{label:"不遵守中立的观点方针",summary:"层级1: 不遵守中立的观点方针"},"uw-unsourced1":{label:"没有使用适当的引用方法而增加没有来源的资料",summary:"层级1: 没有使用适当的引用方法而增加没有来源的资料"},"uw-error1":{label:"故意加入错误的事实",summary:"层级1: 故意加入错误的事实"},"uw-biog1":{label:"加入有关在生人物而又缺乏来源的资料",summary:"层级1: 加入有关在生人物而又缺乏来源的资料"},"uw-defamatory1":{label:"没有特定目标的诽谤",summary:"层级1: 没有特定目标的诽谤"},"uw-notcensored1":{label:"资料的审查",summary:"层级1: 资料的审查"},"uw-mos1":{label:"格式、日期、语言等",summary:"层级1: 格式、日期、语言等"},"uw-move1":{label:"页面移动",summary:"层级1: 页面移动"},"uw-chat1":{label:"把讨论页当为论坛",summary:"层级1: 把讨论页当为论坛"},"uw-tpv1":{label:"改写其他用户在讨论页留下的意见",summary:"层级1: 改写其他用户在讨论页留下的意见"},"uw-afd1":{label:"移除\{\{Afd\}\}模板",summary:"层级1: 移除\{\{Afd\}\}模板"},"uw-speedy1":{label:"移除\{\{Delete\}\}模板",summary:"层级1: 移除\{\{Delete\}\}模板"},"uw-npa1":{label:"针对特定用户的人身攻击",summary:"层级1: 针对特定用户的人身攻击"},"uw-agf1":{label:"没有善意推定",summary:"层级1: 没有善意推定"},"uw-own1":{label:"条目的所有权",summary:"层级1: 条目的所有权"},"uw-tempabuse1":{label:"不当使用警告或封锁模板",summary:"层级1: 不当使用警告或封锁模板"}},level2:{"uw-vandalism2":{label:"破坏",summary:"层级2: 破坏"},"uw-test2":{label:"编辑测试",summary:"层级2: 编辑测试"},"uw-delete2":{label:"清空页面、移除内容或模板",summary:"层级2: 清空页面、移除内容或模板"},"uw-redirect2":{label:"创建恶意重定向",summary:"层级2: 创建恶意重定向"},"uw-tdel2":{label:"移除维护性模板",summary:"层级2: 移除维护性模板"},"uw-joke2":{label:"使用不恰当的幽默文字",summary:"层级2: 使用不恰当的幽默文字"},"uw-create2":{label:"建立不适当的页面",summary:"层级2: 建立不适当的页面"},"uw-upload2":{label:"上传不适当的图像",summary:"层级2: 上传不适当的图像"},"uw-image2":{label:"图像相关的破坏",summary:"层级2: 图像相关的破坏"},"uw-spam2":{label:"增加垃圾连结",summary:"层级2: 增加垃圾连结"},"uw-advert2":{label:"利用维基百科来发布广告或推广",summary:"层级2: 利用维基百科来发布广告或推广"},"uw-npov2":{label:"不遵守中立的观点方针",summary:"层级2: 不遵守中立的观点方针"},"uw-unsourced2":{label:"没有使用适当的引用方法而增加没有来源的资料",summary:"层级2: 没有使用适当的引用方法而增加没有来源的资料"},"uw-error2":{label:"故意加入错误的事实",summary:"层级2: 故意加入错误的事实"},"uw-biog2":{label:"加入有关在生人物而又缺乏来源的资料",summary:"层级2: 加入有关在生人物而又缺乏来源的资料"},"uw-defamatory2":{label:"没有特定目标的诽谤",summary:"层级2: 没有特定目标的诽谤"},"uw-notcensored2":{label:"资料的审查",summary:"层级2: 资料的审查"},"uw-mos2":{label:"格式、日期、语言等",summary:"层级2: 格式、日期、语言等"},"uw-move2":{label:"页面移动",summary:"层级2: 页面移动"},"uw-chat2":{label:"把讨论页当为论坛",summary:"层级2: 把讨论页当为论坛"},"uw-tpv2":{label:"改写其他用户在讨论页留下的意见",summary:"层级2: 改写其他用户在讨论页留下的意见"},"uw-afd2":{label:"移除\{\{Afd\}\}模板",summary:"层级2: 移除\{\{Afd\}\}模板"},"uw-speedy2":{label:"移除\{\{Delete\}\}模板",summary:"层级2: 移除\{\{Delete\}\}模板"},"uw-npa2":{label:"针对特定用户的人身攻击",summary:"层级2: 针对特定用户的人身攻击"},"uw-agf2":{label:"没有善意推定",summary:"层级2: 没有善意推定"},"uw-own2":{label:"条目的所有权",summary:"层级2: 条目的所有权"},"uw-tempabuse2":{label:"不当使用警告或封锁模板",summary:"层级2: 不当使用警告或封锁模板"}},level3:{"uw-vandalism3":{label:"破坏",summary:"层级3: 破坏"},"uw-test3":{label:"编辑测试",summary:"层级3: 编辑测试"},"uw-delete3":{label:"清空页面、移除内容或模板",summary:"层级3: 清空页面、移除内容或模板"},"uw-redirect3":{label:"创建恶意重定向",summary:"层级3: 创建恶意重定向"},"uw-tdel3":{label:"移除维护性模板",summary:"层级3: 移除维护性模板"},"uw-joke3":{label:"使用不恰当的幽默文字",summary:"层级3: 使用不恰当的幽默文字"},"uw-create3":{label:"建立不适当的页面",summary:"层级3: 建立不适当的页面"},"uw-upload3":{label:"上传不适当的图像",summary:"层级3: 上传不适当的图像"},"uw-image3":{label:"图像相关的破坏",summary:"层级3: 图像相关的破坏"},"uw-spam3":{label:"增加垃圾连结",summary:"层级3: 增加垃圾连结"},"uw-advert3":{label:"利用维基百科来发布广告或推广",summary:"层级3: 利用维基百科来发布广告或推广"},"uw-npov3":{label:"不遵守中立的观点方针",summary:"层级3: 不遵守中立的观点方针"},"uw-unsourced3":{label:"没有使用适当的引用方法而增加没有来源的资料",summary:"层级3: 没有使用适当的引用方法而增加没有来源的资料"},"uw-error3":{label:"故意加入错误的事实",summary:"层级3: 故意加入错误的事实"},"uw-biog3":{label:" 加入有关在生人物而又缺乏来源的资料",summary:"层级3: 加入有关在生人物而又缺乏来源的资料"},"uw-defamatory3":{label:"没有特定目标的诽谤",summary:"层级3: 没有特定目标的诽谤"},"uw-notcensored3":{label:"资料的审查",summary:"层级3: 资料的审查"},"uw-mos3":{label:"格式、日期、语言等",summary:"层级3: 格式、日期、语言等"},"uw-move3":{label:"页面移动",summary:"层级3: 页面移动"},"uw-chat3":{label:"把讨论页当为论坛",summary:"层级3: 把讨论页当为论坛"},"uw-tpv3":{label:"改写其他用户在讨论页留下的意见",summary:"层级3: 改写其他用户在讨论页留下的意见"},"uw-afd3":{label:"移除\{\{Afd\}\}模板",summary:"层级3: 移除\{\{Afd\}\}模板"},"uw-speedy3":{label:"移除\{\{Delete\}\}模板",summary:"层级3: 移除\{\{Delete\}\}模板"},"uw-npa3":{label:"针对特定用户的人身攻击",summary:"层级3: 针对特定用户的人身攻击"},"uw-agf3":{label:"没有善意推定",summary:"层级3: 没有善意推定"},"uw-own3":{label:"条目的所有权",summary:"层级3: 条目的所有权"},"uw-tempabuse3":{label:"不当使用警告或封锁模板",summary:"层级3: 不当使用警告或封锁模板"}},level4:{"uw-vandalism4":{label:"破坏",summary:"层级4: 破坏"},"uw-test4":{label:"编辑测试",summary:"层级4: 编辑测试"},"uw-delete4":{label:"清空页面、移除内容或模板",summary:"层级4: 清空页面、移除内容或模板"},"uw-redirect4":{label:"创建恶意重定向",summary:"层级4: 创建恶意重定向"},"uw-tdel4":{label:"移除维护性模板",summary:"层级4: 移除维护性模板"},"uw-joke4":{label:"使用不恰当的幽默文字",summary:"层级4: 使用不恰当的幽默文字"},"uw-create4":{label:"建立不适当的页面",summary:"层级4: 建立不适当的页面"},"uw-upload4":{label:"上传不适当的图像",summary:"层级4: 上传不适当的图像"},"uw-image4":{label:"图像相关的破坏",summary:"层级4: 图像相关的破坏"},"uw-spam4":{label:"增加垃圾连结",summary:"层级4: 增加垃圾连结"},"uw-advert4":{label:"利用维基百科来发布广告或推广",summary:"层级4: 利用维基百科来发布广告或推广"},"uw-npov4":{label:"不遵守中立的观点方针",summary:"层级4: 不遵守中立的观点方针"},"uw-unsourced4":{label:"没有使用适当的引用方法而增加没有来源的资料",summary:"层级4: 没有使用适当的引用方法而增加没有来源的资料"},"uw-error4":{label:"故意加入错误的事实",summary:"层级4: 故意加入错误的事实"},"uw-biog4":{label:" 加入有关在生人物而又缺乏来源的资料",summary:"层级4: 加入有关在生人物而又缺乏来源的资料"},"uw-defamatory4":{label:"没有特定目标的诽谤",summary:"层级4: 没有特定目标的诽谤"},"uw-notcensored4":{label:"资料的审查",summary:"层级4: 资料的审查"},"uw-move4":{label:"页面移动",summary:"层级4: 页面移动"},"uw-chat4":{label:"把讨论页当为论坛",summary:"层级4: 把讨论页当为论坛"},"uw-afd4":{label:"移除\{\{Afd\}\}模板",summary:"层级4: 移除\{\{Afd\}\}模板"},"uw-speedy4":{label:"移除\{\{Delete\}\}模板",summary:"层级4: 移除\{\{Delete\}\}模板"},"uw-npa4":{label:"针对特定用户的人身攻击",summary:"层级4: 针对特定用户的人身攻击"},"uw-tempabuse4":{label:"不当使用警告或封锁模板",summary:"层级4: 不当使用警告或封锁模板"}},level4im:{"uw-vandalism4im":{label:"破坏",summary:"层级4im: 破坏"},"uw-delete4im":{label:"清空页面、移除内容或模板",summary:"层级4im: 清空页面、移除内容或模板"},"uw-redirect4im":{label:"创建恶意重定向",summary:"层级4im: 创建恶意重定向"},"uw-joke4im":{label:"使用不恰当的幽默文字",summary:"层级4im: 使用不恰当的幽默文字"},"uw-create4im":{label:"建立不适当的页面",summary:"层级4im: 建立不适当的页面"},"uw-upload4im":{label:"上传不适当的图像",summary:"层级4im: 上传不适当的图像"},"uw-image4im":{label:"图像相关的破坏",summary:"层级4im: 图像相关的破坏"},"uw-spam4im":{label:"增加垃圾连结",summary:"层级4im: 增加垃圾连结"},"uw-biog4im":{label:" 加入有关在生人物而又缺乏来源的资料",summary:"层级4im: 加入有关在生人物而又缺乏来源的资料"},"uw-defamatory4im":{label:"没有特定目标的诽谤",summary:"层级4im: 没有特定目标的诽谤"},"uw-move4im":{label:"页面移动",summary:"层级4im: 页面移动"},"uw-npa4im":{label:"针对特定用户的人身攻击",summary:"层级4im: 针对特定用户的人身攻击"},"uw-tempabuse4im":{label:"不当使用警告或封锁模板",summary:"层级4im: 不当使用警告或封锁模板"}},singlenotice:{"uw-2redirect":{label:"透过不适当的页面移动建立双重重定向",summary:"通知: 透过不适当的页面移动建立双重重定向"},"uw-aiv":{label:"不恰当的破坏回报",summary:"通知: 不恰当的破坏回报"},"uw-articlesig":{label:"在条目页中签名",summary:"通知: 在条目页中签名"},"uw-autobiography":{label:"建立自传",summary:"通知: 建立自传"},"uw-badcat":{label:" 加入错误的页面分类",summary:"通知: 加入错误的页面分类"},"uw-bite":{label:" 伤害新手",summary:"通知: 伤害新手"},"uw-c&pmove":{label:" 剪贴移动",summary:"通知: 剪贴移动"},"uw-chinese":{label:" 不是以中文进行沟通",summary:"通知: 不是以中文进行沟通"},"uw-coi":{label:" 利益冲突",summary:"通知: 利益冲突"},"uw-copyviorewrite":{label:" 在侵权页面直接重写条目",summary:"通知: 在侵权页面直接重写条目"},"uw-date":{label:" 不必要地更换日期格式",summary:"通知: 不必要地更换日期格式"},"uw-editsummary":{label:" 没有使用编辑摘要",summary:"通知: 没有使用编辑摘要"},"uw-hangon":{label:" 没有在讨论页说明暂缓快速删除理由",summary:"通知: 没有在讨论页说明暂缓快速删除理由"},"uw-booktitle":{label:" 没有使用书名号来标示书籍、电影、音乐专辑等",summary:"通知: 没有使用书名号来标示书籍、电影、音乐专辑等"},"uw-lang":{label:" 不必要地将条目所有文字换成简体或繁体中文",summary:"通知: 不必要地将条目所有文字换成简体或繁体中文"},"uw-langmove":{label:" 不必要地将条目标题换成简体或繁体中文",summary:"通知: 不必要地将条目标题换成简体或繁体中文"},"uw-linking":{label:" 过度加入红字连结或重复蓝字连结",summary:"通知: 过度加入红字连结或重复蓝字连结"},"uw-minor":{label:" 不适当地使用小修改选项",summary:"通知: 不适当地使用小修改选项"},"uw-notaiv":{label:" 不要向当前的破坏回报复杂的用户纷争",summary:"通知: 不要向当前的破坏回报复杂的用户纷争"},"uw-notvote":{label:" 我们是以共识处事,不仅是投票",summary:"通知: 我们是以共识处事,不仅是投票"},"uw-preview":{label:" 使用预览按钮来避免不必要的错误",summary:"通知: 使用预览按钮来避免不必要的错误"},"uw-sandbox":{label:" 移除沙盒的置顶模板\{\{Sandbox\}\} ",summary:"通知: 移除沙盒的置顶模板{{Sandbox}} "},"uw-selfrevert":{label:" 回退个人的测试",summary:"通知: 回退个人的测试"},"uw-subst":{label:" 谨记要替代模板",summary:"通知: 谨记要替代模板"},"uw-talkinarticle":{label:" 在条目页中留下意见",summary:"通知: 在条目页中留下意见"},"uw-tilde":{label:" 没有在讨论页上签名",summary:"通知: 没有在讨论页上签名"},"uw-uaa":{label:" 向更改用户名回报的用户名称并不违反方针",summary:"通知: 向更改用户名回报的用户名称并不违反方针"},"uw-warn":{label:" 警告破坏用户",summary:"通知: 警告破坏用户"}},singlewarn:{"uw-3rr":{label:" 用户潜在违反回退不过三原则的可能性",summary:"警告: 用户潜在违反回退不过三原则的可能性"},"uw-attack":{label:" 建立人身攻击页面",summary:"警告: 建立人身攻击页面"},"uw-bv":{label:" 公然的破坏",summary:"警告: 公然的破坏"},"uw-canvass":{label:" 向多个用户进行游说",summary:"警告: 向多个用户进行游说"},"uw-copyright":{label:" 侵犯版权",summary:"警告: 侵犯版权"},"uw-copyright-link":{label:" 连结到有版权的材料",summary:"警告: 连结到有版权的材料"},"uw-hoax":{label:" 建立恶作剧",summary:"警告: 建立恶作剧"},"uw-legal":{label:" 诉诸法律威胁",summary:"警告: 诉诸法律威胁"},"uw-longterm":{label:" 长期的破坏",summary:"警告: 长期的破坏"},"uw-multipleIPs":{label:" 使用多个IP地址",summary:"警告: 使用多个IP地址"},"uw-pinfo":{label:"个人资料",summary:"警告: 个人资料"},"uw-redirect":{label:" 建立恶意重定向",summary:"警告: 建立恶意重定向"},"uw-upv":{label:"用户页破坏",summary:"警告: 用户页破坏"},"uw-substub":{label:" 创建小小作品",summary:"警告: 创建小小作品"}},block:{"uw-block1":{'label':"层级1",'summary':"封禁: 层级1"},"uw-block2":{'label':" 层级2",'summary':"封禁: 层级2"},"uw-block3":{'label':" 层级3",'summary':"封禁: 层级3"},"uw-3block":{'label':" 回退不过三原则封禁",'summary':"封禁: 回退不过三原则封禁"},"uw-ablock":{'label':" 匿名封禁",'summary':"封禁: 匿名封禁"},"uw-bblock":{'label':" 机器人封禁",'summary':"封禁: 机器人封禁"},"uw-dblock":{'label':" 删除封禁",'summary':"封禁: 删除封禁"},"uw-sblock":{'label':"垃圾连结封禁",'summary':"封禁: 垃圾连结封禁"},"uw-ublock":{'label':" 用户名称封禁",'summary':"封禁: 用户名称封禁"},"uw-vblock":{'label':" 破坏封禁",'summary':"封禁: 破坏封禁"}}};friendlywarn.callback.change_category=function friendlywarnCallbackChangeCategory(e){var value=e.target.value;var sub_group=e.target.root.sub_group;var messages=friendlywarn.messages[value];sub_group.main_group=value;var old_subvalue=sub_group.value;if(old_subvalue){old_subvalue=old_subvalue.replace(/\d*(im)?$/,'');var old_subvalue_re=new RegExp(RegExp.escape(old_subvalue)+"(\\d*(?:im)?)$");}
while(sub_group.hasChildNodes()){sub_group.removeChild(sub_group.firstChild);}
for(var i in messages){var selected=false;if(old_subvalue&&old_subvalue_re.test(i)){selected=true;}
var elem=new QuickForm.element({type:'option',label:"["+i+"]: "+messages[i].label,value:i,selected:selected});sub_group.appendChild(elem.render());}
if(value=='block'){var more=new QuickForm.element({type:'input',name:'block_timer',label:'封禁时间:'});e.target.root.insertBefore(more.render(),e.target.root.lastChild);e.target.root.article.disabled=true;}else if(e.target.root.block_timer){e.target.root.removeChild(e.target.root.block_timer.parentNode);e.target.root.article.disabled=false;e.target.root.reason.disabled=false;}}
friendlywarn.callback.change_subcategory=function friendlywarnCallbackChangeSubcategory(e){var value=e.target.value;var main_group=e.target.main_group;if(main_group=='block'){if(value=='uw-block3'||value=='uw-ublock'){e.target.form.block_timer.disabled=true;}else if(e.target.form.block_timer.disabled){e.target.form.block_timer.disabled=false;}
if(value=='uw-3block'){e.target.form.article.disabled=false;}else if(!e.target.form.article.disabled){e.target.form.article.disabled=true;}
if(value=='uw-block1'||value=='uw-block2'||value=='uw-block3'||value=='uw-ablock'){e.target.form.reason.disabled=false;}else if(!e.target.form.reason.disabled){e.target.form.reason.disabled=true;}}}
friendlywarn.callbacks={main:function(self){var form=self.responseXML.getElementById('editform');var text=form.wpTextbox1.value;var history_re=/\<\!\-\-\ Template\:(uw\-.*?)\ \-\-\>.*?(\d{1,2}:\d{1,2}, \d{1,2} \w+ \d{4}) \(UTC\)/g;var history={};var latest={date:new Date(0),type:''};var current;while((current=history_re.exec(text))!=undefined){var current_date=new Date(current[2]+' UTC');if(!(current[1]in history)||history[current[1]]<current_date){history[current[1]]=current_date;}
if(current_date>latest.date){latest.date=current_date;latest.type=current[1];}}
var date=new Date();if(self.params.sub_group in history){var temp_time=new Date(history[self.params.sub_group]);temp_time.setUTCHours(temp_time.getUTCHours()+24);if(temp_time>date){Status.info('信息',"一个相同的"+self.params.sub_group+"已被于最近24小时内放置");if(!confirm("确定添加一个相同的?")){self.statelem.info('用户请求取消');return;}}}
latest.date.setUTCMinutes(latest.date.getUTCMinutes()+1);if(latest.date>date){Status.info('信息',"一个"+latest.type+"已被于最近1分钟内放置");if(!confirm("确定添加一个相同的?")){self.statelem.info('用户请求取消');return;}}
var mainheaderRe=/==+\\s*警告\\s*==+/;var headerRe=new RegExp("^==+\\s*"+date.getUTCFullYear()+"年"+(date.getUTCMonth()+1)+"月"+"\\s*==+",'m');if(text=='\n'&&isIPAddress(wgTitle)){Status.info('信息','将会自动欢迎匿名用户');text+="\{\{subst:welcome-anon\}\}";}else if(text=='\n'){Status.info('信息','将会自动欢迎用户');text+="\{\{subst:User:Tommyang/Welcome\}\}";}
if(text.length>0){text+="\n";}
if(self.params.main_group=='block'){var article='',time=null;if(FriendlyConfig.blankTalkpageOnIndefBlock&&(/indef|\*|max/.exec(self.params.block_timer)||self.params.sub_group=='uw-block3'||self.params.sub_group=='uw-ublock')){Status.info('信息','根据设置清空页面并创建当月二级标题');text="== "+date.getUTCFullYear()+"年"+(date.getUTCMonth()+1)+"月 "+" ==\n";}else if(!headerRe.exec(text)){Status.info('信息','未找到当月二级标题,将会创建');text+="== "+date.getUTCFullYear()+"年"+(date.getUTCMonth()+1)+"月 "+" ==\n";}
if((self.params.sub_group=='uw-3block')&&self.params.article){article='|1='+self.params.article;}
if(/te?mp|^\s*$|min/.exec(self.params.block_timer)){time='';}else if(/indef|\*|max/.exec(self.params.block_timer)){time='|indef=yes';}else{time='|time='+self.params.block_timer;}
text+="\{\{subst:"+self.params.sub_group+article+time+(self.params.reason?'|reason='+self.params.reason:'')+"|sig=true|subst=subst:\}\}";}else{if(!headerRe.exec(text)){Status.info('信息','未找到当月二级标题,将会创建');text+="== "+date.getUTCFullYear()+"年"+(date.getUTCMonth()+1)+"月 "+" ==\n";}
text+="\{\{subst:"+self.params.sub_group+(self.params.article?'|1='+self.params.article:'')+(self.params.reason?'|2='+self.params.reason:'')+"|subst=subst:\}\}"+"--\~\~\~\~";}
if(FriendlyConfig.showSharedIPNotice&&isIPAddress(wgTitle)){Status.info('信息','添加共享IP通告');switch(QueryString.get('type')){case'vand':text+="\n:''如果这是一个共享[[IP地址]],并且您没有做出任何[[Wikipedia:破坏|非建设性的]]编辑,请考虑[[Wikipedia:用户|创建一个账户]]以避免自动封禁。'' ";break;default:text+="\n:''如果这是一个共享[[IP地址]],并且您没有做出此次编辑,请考虑[[Wikipedia:用户|创建一个账户]]以避免收到无关通知。'' ";break;}}
var postData={'wpMinoredit':form.wpMinoredit.checked?1:undefined,'wpWatchthis':(form.wpWatchthis.checked||FriendlyConfig.watchWarnings)?1:undefined,'wpStarttime':form.wpStarttime.value,'wpEdittime':form.wpEdittime.value,'wpAutoSummary':form.wpAutoSummary.value,'wpEditToken':form.wpEditToken.value,'wpSection':'','wpSummary':friendlywarn.messages[self.params.main_group][self.params.sub_group].summary+(self.params.article?'于[['+self.params.article+']]':'')+FriendlyConfig.summaryAd,'wpTextbox1':text};self.post(postData);}}
friendlywarn.callback.evaluate=function friendlywarnCallbackEvaluate(e){var params={reason:e.target.reason.value,main_group:e.target.main_group.value,sub_group:e.target.sub_group.value,article:e.target.article.value.replace(/^(Image|File|Category):/i,':$1:'),block_timer:e.target.block_timer?e.target.block_timer.value:null}
Status.init(e.target);var query={'title':wgPageName,'action':'submit'};Wikipedia.actionCompleted.redirect=wgPageName;Wikipedia.actionCompleted.notice="完成";var wikipedia_wiki=new Wikipedia.wiki('用户讨论页修改',query,friendlywarn.callbacks.main);wikipedia_wiki.params=params;wikipedia_wiki.get();}
if(typeof(FriendlyConfig)=='undefined'){FriendlyConfig={};}
if(typeof(FriendlyConfig.summaryAd)=='undefined'){FriendlyConfig.summaryAd=" using [[WP:FRIENDLY|Friendly]]";}
if(typeof(FriendlyConfig.topWelcomes)=='undefined'){FriendlyConfig.topWelcomes=true;}
if(typeof(FriendlyConfig.watchWelcomes)=='undefined'){FriendlyConfig.watchWelcomes=false;}
if(typeof(FriendlyConfig.insertHeadings)=='undefined'){FriendlyConfig.insertHeadings=false;}
if(typeof(FriendlyConfig.welcomeHeading)=='undefined'){FriendlyConfig.welcomeHeading="== Welcome ==";}
if(typeof(FriendlyConfig.insertUsername)=='undefined'){FriendlyConfig.insertUsername=false;}
if(typeof(FriendlyConfig.insertSignature)=='undefined'){FriendlyConfig.insertSignature=true;}
if(typeof(FriendlyConfig.markWelcomesAsMinor)=='undefined'){FriendlyConfig.markWelcomesAsMinor=true;}
if(typeof(FriendlyConfig.quickWelcomeMode)=='undefined'){FriendlyConfig.quickWelcomeMode="auto";}
if(typeof(FriendlyConfig.quickWelcomeTemplate)=='undefined'){FriendlyConfig.quickWelcomeTemplate="User:Tommyang/Welcome";}
if(typeof(FriendlyConfig.maskTemplateInSummary)=='undefined'){FriendlyConfig.maskTemplateInSummary=false;}
friendlywelcome={auto:function(){if(QueryString.get('action')!='edit'){return;}
return friendlywelcome.welcome();},semiauto:function(){friendlywelcome.callback(wgTitle.split('/')[0].replace(/\"/,"\\\""));},normal:function(){if(QueryString.exists('diff')){var oXPath='//div[@id="mw-diff-otitle2"]/span[@class="mw-usertoollinks"]/a[1][@class="new"]';var nXPath='//div[@id="mw-diff-ntitle2"]/span[@class="mw-usertoollinks"]/a[1][@class="new"]';var oList=document.evaluate(oXPath,document,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null);var nList=document.evaluate(nXPath,document,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null);if(oList.snapshotLength>0||nList.snapshotLength>0){var spanTag=function(color,content){var span=document.createElement('span');span.style.color=color;span.appendChild(document.createTextNode(content));return span;}
var welcomeNode=document.createElement('strong');var welcomeLink=document.createElement('a');welcomeLink.appendChild(spanTag('Black','['));welcomeLink.appendChild(spanTag('Goldenrod','welcome'));welcomeLink.appendChild(spanTag('Black',']'));welcomeNode.appendChild(welcomeLink);if(oList.snapshotLength>0){var oTalkNode=oList.snapshotItem(0);var oHref=document.evaluate('@href',oTalkNode,null,XPathResult.STRING_TYPE,null).stringValue;var oWelcomeNode=welcomeNode.cloneNode(true);oWelcomeNode.firstChild.setAttribute('href',oHref+'&'+QueryString.create({'friendlywelcome':'norm'})+'&'+QueryString.create({'vanarticle':wgPageName.replace(/_/g,' ')}));oTalkNode.parentNode.parentNode.appendChild(document.createTextNode(' '));oTalkNode.parentNode.parentNode.appendChild(oWelcomeNode);}
if(nList.snapshotLength>0){var nTalkNode=nList.snapshotItem(0);var nHref=document.evaluate('@href',nTalkNode,null,XPathResult.STRING_TYPE,null).stringValue;var nWelcomeNode=welcomeNode.cloneNode(true);nWelcomeNode.firstChild.setAttribute('href',nHref+'&'+QueryString.create({'friendlywelcome':'norm'})+'&'+QueryString.create({'vanarticle':wgPageName.replace(/_/g,' ')}));nTalkNode.parentNode.parentNode.appendChild(document.createTextNode(' '));nTalkNode.parentNode.parentNode.appendChild(nWelcomeNode);}}}
if(wgNamespaceNumber==3){var username=wgTitle.split('/')[0].replace(/\"/,"\\\"");twAddPortletLink("javascript:friendlywelcome.callback(\""+username+"\")",wgULS("欢迎","歡迎"),"friendly-welcome",wgULS("欢迎新用户","歡迎新用戶"),"");}}}
friendlywelcome.welcome=function welcomeUser(){Status.init(document.getElementById('bodyContent'));var params={value:FriendlyConfig.quickWelcomeTemplate,article:QueryString.exists('vanarticle')?QueryString.get('vanarticle'):'',mode:'auto'};var query={'title':wgPageName,'action':'submit'};Wikipedia.actionCompleted.redirect=wgPageName;Wikipedia.actionCompleted.notice="Welcoming complete, reloading talk page in some seconds";var wikipedia_wiki=new Wikipedia.wiki('User talk page modification',query,friendlywelcome.callbacks.main);wikipedia_wiki.params=params;wikipedia_wiki.get();}
friendlywelcome.callback=function friendlywelcomeCallback(uid){var Window=new SimpleWindow(600,400);Window.setTitle("选择欢迎模板");var form=new QuickForm(friendlywelcome.callback.evaluate,'change');form.append({type:'input',name:'article',label:'相关条目',value:(QueryString.exists('vanarticle')?QueryString.get('vanarticle'):''),event:function(event){event.stopPropagation();}});form.append({type:'header',label:'简单模板'});form.append({type:'radio',name:'simple',list:friendlywelcome.standardList});if(typeof(FriendlyConfig.customWelcomeList)=='object'){form.append({type:'header',label:'自定义模板'});form.append({type:'radio',name:'custom',list:FriendlyConfig.customWelcomeList});}
form.append({type:'header',label:'问题模板'});form.append({type:'radio',name:'problem',list:friendlywelcome.problemList});form.append({type:'header',label:'匿名用户模板'});form.append({type:'radio',name:'anonymous',list:friendlywelcome.anonymousList});form.append({type:'header',label:'专题模板'});form.append({type:'radio',name:'project',list:friendlywelcome.projectList});form.append({type:'header',label:'地区模板'});form.append({type:'radio',name:'region',list:friendlywelcome.regionList});var result=form.render();Window.setContent(result);Window.display();}
friendlywelcome.standardList=[{label:'{{User:Tommyang/Welcome}}: 自定义欢迎模板',value:'User:Tommyang/Welcome'},{label:'{{Welcome}}: 标准欢迎模板',value:'Welcome'},{label:'{{Welcome plain}}: 纯文本欢迎模板',value:'Welcome plain'}]
friendlywelcome.problemList=[{label:'{{Firstarticle}}: 用户的第一篇条目不符合方针',value:'Firstarticle'},{label:'{{Welcomevandal}}: 用户的初始动作像是破坏',value:'Welcomevandal'},{label:'{{Welcomeipvandal}}: 匿名用户的初始动作像是破坏',value:'Welcomeipvandal'}]
friendlywelcome.anonymousList=[{label:'{{Welcome-anon}}: 匿名用户',value:'Welcome-anon'}]
friendlywelcome.projectList=[{label:'{{WelcomeACG}}: ACG',value:'WelcomeACG'},{label:'{{WelcomeBIO}}: 生物学',value:'WelcomeBIO'},{label:'{{WelcomeCHEM}}: 化学',value:'WelcomeCHEM'},{label:'{{WelcomeCVG}}: 电子游戏',value:'WelcomeCVG'},{label:'{{WelcomeFootball}}: 足球',value:'WelcomeFootball'},{label:'{{WelcomeMED}}: 医药',value:'WelcomeMED'},{label:'{{Welcomefl}}: 电影',value:'Welcomefl'},{label:'{{Welcomepl}}: 心理学',value:'Welcomepl'}]
friendlywelcome.regionList=[{label:'{{WelcomeTW}}: 台湾',value:'WelcomeTW'},{label:'{{Welcomegd}}: 广东',value:'Welcomegd'},{label:'{{Welcomegx}}: 广西',value:'Welcomegx'},{label:'{{Welcomehk}}: 香港',value:'Welcomehk'},{label:'{{WelcomePRC}}: 中华人民共和国',value:'WelcomePRC'},{label:'{{Welcomeshanxi}}: 山西',value:'Welcomeshanxi'},{label:'{{Welcomexa}}: 西安',value:'Welcomexa'},{label:'{{Welcomesx}}: 陝西',value:'Welcomesx'}]
friendlywelcome.headingHash={'User:Tommyang/Welcome':true,'Welcome':true,'Welcome plain':true,'Firstarticle':true,'Welcomevandal':false,'Welcomeipvandal':false,'Welcome-anon':true,'WelcomeACG':true,'WelcomeBIO':true,'WelcomeCHEM':true,'WelcomeCVG':true,'WelcomeFootball':true,'WelcomeMED':true,'Welcomefl':true,'Welcomepl':true,'WelcomeTW':true,'Welcomegd':true,'Welcomegx':true,'Welcomehk':true,'Welcomeshanxi':true,'Welcomexa':true,'Welcomesx':true}
friendlywelcome.signatureHash={'User:Tommyang/Welcome':true,'Welcome':true,'Welcome plain':true,'Firstarticle':true,'Welcomevandal':true,'Welcomeipvandal':true,'Welcome-anon':true,'WelcomeACG':true,'WelcomeBIO':true,'WelcomeCHEM':true,'WelcomeCVG':true,'WelcomeFootball':true,'WelcomeMED':true,'Welcomefl':true,'Welcomepl':true,'WelcomeTW':true,'Welcomegd':true,'Welcomegx':true,'Welcomehk':true,'Welcomeshanxi':true,'Welcomexa':true,'Welcomesx':true}
friendlywelcome.artHash={'User:Tommyang/Welcome':false,'Welcome':false,'Welcome plain':false,'Firstarticle':true,'Welcomevandal':true,'Welcomeipvandal':true,'Welcome-anon':false,'WelcomeACG':false,'WelcomeBIO':false,'WelcomeCHEM':false,'WelcomeCVG':false,'WelcomeFootball':false,'WelcomeMED':false,'Welcomefl':false,'Welcomepl':false,'WelcomeTW':false,'Welcomegd':false,'Welcomegx':false,'Welcomehk':false,'Welcomeshanxi':false,'Welcomexa':false,'Welcomesx':false}
friendlywelcome.vandalHash={'User:Tommyang/Welcome':false,'Welcome':false,'Welcome plain':false,'Firstarticle':true,'Welcomevandal':true,'Welcomeipvandal':true,'Welcome-anon':false,'WelcomeACG':false,'WelcomeBIO':false,'WelcomeCHEM':false,'WelcomeCVG':false,'WelcomeFootball':false,'WelcomeMED':false,'Welcomefl':false,'Welcomepl':false,'WelcomeTW':false,'Welcomegd':false,'Welcomegx':false,'Welcomehk':false,'Welcomeshanxi':false,'Welcomexa':false,'Welcomesx':false}
friendlywelcome.callbacks={main:function(self){var form=self.responseXML.getElementById('editform');if(form.wpTextbox1.value!='\n'&&self.params.mode=='auto'){Status.info('警告','用户讨论页不为空,取消操作');Wikipedia.actionCompleted.event();return;}
var text='';Status.info('信息','将会添加欢迎模板到用户讨论页'
+(FriendlyConfig.topWelcomes?'顶部':'底部'));if(!FriendlyConfig.topWelcomes){text+=form.wpTextbox1.value+'\n';}
Status.info('信息','将会替换引用{{'+self.params.value+'}}模板');text+='\{\{subst:'+self.params.value;if(friendlywelcome.artHash[self.params.value]){if(FriendlyConfig.insertUsername&&self.params.value.substring(2,0)!='W-'){Status.info('信息','将添加您的用户名到模板');text+='|'+wgUserName;}
if(self.params.article!=''){Status.info('信息','将添加条目名到模板');text+='|art='+self.params.article;}}else if(friendlywelcome.vandalHash[self.params.value]){if(self.params.article!=''){Status.info('信息','将添加被破坏条目名到模板');}
text+='|'+self.params.article;if(FriendlyConfig.insertUsername){Status.info('信息','将添加您的用户名到模板');text+='|'+wgUserName;}}else if(FriendlyConfig.insertUsername){Status.info('信息','将添加您的用户名到模板');text+='|'+wgUserName;}
text+='\}\}';if(!friendlywelcome.signatureHash[self.params.value]&&FriendlyConfig.insertSignature){Status.info('信息','将添加签名');text+=' \n\~\~\~\~';}
if(FriendlyConfig.topWelcomes){text+='\n\n'+form.wpTextbox1.value;}
var postData={'wpMinoredit':FriendlyConfig.markWelcomesAsMinor?1:undefined,'wpWatchthis':form.wpWatchthis.checked?1:(FriendlyConfig.watchWelcomes?1:undefined),'wpStarttime':form.wpStarttime.value,'wpEdittime':form.wpEdittime.value,'wpAutoSummary':form.wpAutoSummary.value,'wpEditToken':form.wpEditToken.value,'wpSummary':'添加'+(FriendlyConfig.maskTemplateInSummary?'欢迎':('\{\{[['+self.params.value+']]\}\}'))
+'模板到用户讨论页'+FriendlyConfig.summaryAd,'wpTextbox1':text};self.post(postData);}}
friendlywelcome.callback.evaluate=function friendlywelcomeCallbackEvaluate(e){if(e.target.name=='article'){return;}
var params={value:e.target.value,article:e.target.form.article.value,mode:'manual'};Status.init(e.target.form);var query={'title':wgPageName,'action':'submit'};Wikipedia.actionCompleted.redirect=wgPageName;Wikipedia.actionCompleted.notice="完成";var wikipedia_wiki=new Wikipedia.wiki('用户讨论页修改',query,friendlywelcome.callbacks.main);wikipedia_wiki.params=params;wikipedia_wiki.get();}
$(function(){if(QueryString.exists('friendlywelcome')){if(QueryString.get('friendlywelcome'=='auto')){friendlywelcome.auto();}else{friendlywelcome.semiauto();}}else{friendlywelcome.normal();}});