User:Alexsh/autocopyvio.js
外观
注意:保存之后,你必须清除浏览器缓存才能看到做出的更改。Google Chrome、Firefox、Microsoft Edge及Safari:按住⇧ Shift键并单击工具栏的“刷新”按钮。参阅Help:绕过浏览器缓存以获取更多帮助。
//<pre><nowiki>
// AutoCopyvio - Adds copyright violation notice to article and adds entry to Copyright Problems page
// Created by Bmicomp from modified AutoVFD(by Korath)
var CopyvioConfig={
page:'Wikipedia:删除投票/侵权',
tabname:wgULS('提报侵权','提報侵權'),
urlask:wgULS('请输入侵权网址','請輸入侵權網址'),
addmsg:wgULS('加入侵权条目','加入侵權條目'),
cpoa:function(v){return '{\{copyvio|m={\{subst:CURRENTMONTH}\}|url='+v+'}}--~~\~~';},
cpoas:'copyvio',
cpl:function(v){return '*[[' + v + ']]--~~\~~';},
cpls:function(v){return '[[' + v + ']]';}
}
function copyvio(){
var viourl = prompt (CopyvioConfig.urlask,"http://");
document.editform.wpTextbox1.value = CopyvioConfig.cpoa(viourl);
document.editform.wpSummary.value = CopyvioConfig.cpoas;
var target = document.editform.action;
target = target.substring(target.indexOf('title=') + 6,target.lastIndexOf('&action=submit'));
window.open('/w/index.php?title='+CopyvioConfig.page+'&action=edit§ion=12&fakeaction=copyviolist&faketarget=' + encodeURIComponent(mw.config.get('wgPageName')), 'status,toolbar,location,menubar,directories,resizeable,scrollbars');
}
function autocopyvio(){
if (wgAction == 'edit'){
var action = '';
var target = '';
if (location.search){
var l = location.search.substring(1).split('&');
for (var i = 0; i < l.length; ++i){
var eq = l[i].indexOf('=');
var name = l[i].substring(0, eq);
if (name == 'fakeaction')
action = l[i].substring(eq + 1);
else if (name == 'faketarget')
target = decodeURIComponent(l[i].substring(eq + 1)).replace(/_/g, ' ');
}
}
if (action == 'copyviolist'){
document.editform.wpTextbox1.value += CopyvioConfig.cpl(target);
document.editform.wpSummary.value = CopyvioConfig.addmsg + CopyvioConfig.cpls(target);
}
else
mw.util.addPortletLink('p-cactions','javascript:copyvio()',CopyvioConfig.tabname,'ca-copyvio','request copyvio','');
}
}
$(autocopyvio);