User:Yarl/cv.js
Jump to navigation
Jump to search
Note: After saving, you have to bypass your browser's cache to see the changes. Internet Explorer: press Ctrl-F5, Mozilla: hold down Shift while clicking Reload (or press Ctrl-Shift-R), Opera/Konqueror: press F5, Safari: hold down Shift + Alt while clicking Reload, Chrome: hold down Shift while clicking Reload.
Documentation for this user script can be added at User:Yarl/cv. |
- Report page listing warnings and errors.
//------------------------------------
// Tool to easily add the copyvio template to image
// Author: [[User:Yarl]]; based on MediaWiki:Populate-category.js
// Should the edits be saved automatically?
if(window.cv_autosave == false){}else if(window.cv_autosave){}else{ cv_autosave = true; }
// String constants
cv_text = "Mark as cv";
cv_tooltip = "Test text";
cv_prompt = "Enter URL:";
function cv_nomCv() {
var cel = prompt(cv_prompt, '');
if (cel==null) return;
var editlk = document.getElementById('ca-edit').getElementsByTagName('a')[0].href;
document.location = editlk + '&fakeaction=cv_add&cel=' + encodeURIComponent(cel);
}
function cv_addCvTemplate(cel) {
if(cel==''){
var txt = '{{copy'
+'vio}}\n';
} else {
var txt = '{{copy'
+'vio|source=' + cel + '}}\n';
}
document.editform.wpTextbox1.value = txt + document.editform.wpTextbox1.value;
document.editform.wpSummary.value = 'Mark as copyvio using [[user:Yarl/cv.js|cv.js]]';
if (nfd_autosave) document.editform.wpSave.click();
}
function cv_onload() {
if (wgNamespaceNumber == 6) { //NS_IMAGE
addLink('p-tb', 'javascript:cv_nomCv()', cv_text, 'pop-cat', cv_tooltip);
}
var fakeaction = getParamValue('fakeaction');
if (fakeaction == 'cv_add')
cv_addCvTemplate(decodeURIComponent(getParamValue('cel')));
}
$(cv_onload);
// </pre>