User:Dipankan001/filescripts.js
Appearance
Code that you insert on this page could contain malicious content capable of compromising your account. If you import a script from another page with "importScript", "mw.loader.load", "iusc", or "lusc", take note that this causes you to dynamically load a remote script, which could be changed by others. Editors are responsible for all edits and actions they perform, including by scripts. User scripts are not centrally supported and may malfunction or become inoperable due to software changes. A guide to help you find broken scripts is available. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. This code will be executed when previewing this page. |
This user script seems to have a documentation page at User:Dipankan001/filescripts. |
//Remodified version by Dipankan001.
//See [[User:Drilnoth/filescripts.js/doc]] for details
//Import freesearch.js, which is stored at Commons.
if(wgCanonicalNamespace == "" || wgCanonicalNamespace == "Category"){
mw.loader.load('//commons.wikimedia.org/w/index.php?title=User:Drilnoth/freesearch.js&action=raw&ctype=text/javascript');
}
if(queryString('nowcommons')) addOnloadHook(function() { nowCommons(); })
function nowCommons() {
var txt = document.getElementById('wpTextbox1');
if(!txt) return;
txt.value = txt.value.replace(/\{\{[\s\t\n\r]*(mtc|ctwc|cwc|copy[ -_]to[ -_]wikimedia[ -_]commons|needs[ -_]commons[ -_]category|tocommons|movetocommons|move[ -_]to[ -_]commons|to[ -_]commons|move[ -_]to[ -_]wikimedia[ -_]commons|copy[ -_]to[ -_]commons|move-to-commons|commons[ -_]ok)[\s\t\n\r]*\}\}/ig,'');
txt.value = '{' + '{' + 'subst:ncd}}\n\n' + txt.value;
document.getElementById('wpSummary').value += 'Semi-automated image tagging using [[User:Drilnoth/filescripts.js/doc|FileScripts]]';
document.getElementById('wpSave').click();
}
if(queryString('wronglicense')) addOnloadHook(function() { wrongLicense(); })
function wrongLicense() {
var txt = document.getElementById('wpTextbox1');
if(!txt) return;
txt.value = '{' + '{' + 'Wrong-license}}\n\n' + txt.value;
document.getElementById('wpSummary').value += 'Semi-automated image tagging using [[User:Drilnoth/filescripts.js/doc|FileScripts]]';
document.getElementById('wpSave').click();
}
importScript("User:Drilnoth/delresized/tag.js");
if(queryString('notifycommons')) addOnloadHook(function() { notifyCommons(); })
function notifyCommons() {
var txt = document.getElementById('wpTextbox1');
if(!txt) return;
txt.value = txt.value + '==Uploading free images to Wikimedia Commons==' + '\n' + '{' + '{' + 'subst:un-commons}}' + ' ~' + '~' + '~' + '~';
document.getElementById('wpSummary').value += '/* Uploading free images to Wikimedia Commons */ new section (using [[User:Drilnoth/filescripts.js/doc|FileScripts]])';
document.getElementById('wpSave').click();
}
function startFileScripts(){
if(wgCanonicalNamespace == "User_talk"){
var url = mw.config.get('wgServer') + mw.config.get('wgScript') + '?title=' + encodeURIComponent(mw.config.get('wgPageName')) + '&action=edit';
mw.util.addPortletLink('p-cactions', url + '¬ifycommons=true','notify about commons','ca-notifycommons','Tell user about uploading images to Wikimedia Commons');
} else if(wgCanonicalNamespace == "File"){
mw.util.addPortletLink('p-tb','http://toolserver.org/~commonshelper2/?file=' + encodeURIComponent(wgTitle) + '&use_tusc=checked&remove_existing_categories=checked', 'Move file to Commons', '', 'Move image to Commons using CommonsHelper');
mw.util.addPortletLink('p-tb', 'http://toolserver.org/~commonshelper2/?file=' + encodeURIComponent(wgTitle) + '&target_file=This file was uploaded accidentally please delete it.jpg&remove_existing_categories=checked', 'Commons description', '', 'Generate a description as if moving image to Commons (useful when completing an incomplete move)');
mw.util.addPortletLink('p-tb', mw.config.get('wgServer') + mw.config.get('wgScript') + '?title=' + encodeURIComponent(mw.config.get('wgPageName')) + '&action=edit&nowcommons=true', 'Now Commons', '', 'Click here if image is available at Commons after transfer');
mw.util.addPortletLink('p-tb', mw.config.get('wgServer') + mw.config.get('wgScript') + '?title= '+ encodeURIComponent(mw.config.get('wgPageName')) + '&action=edit&reducesupplied=true', 'Old revs deleted', '', 'Old, oversized revisions of fair-use image have been deleted');
}
}
function queryString(p) {
var re = RegExp('[&?]' + p + '=([^&]*)');
var matches;
if (matches = re.exec(document.location)) {
try {
return decodeURI(matches[1]);
} catch (e) {
}
}
return null;
}
$(startFileScripts);