14,091
edits
(clean up) |
(Localise) |
||
(5 intermediate revisions by 2 users not shown) | |||
Line 24: | Line 24: | ||
Twinkle.image.callback = function twinkleimageCallback() { | Twinkle.image.callback = function twinkleimageCallback() { | ||
var Window = new Morebits.simpleWindow( 600, | var Window = new Morebits.simpleWindow( 600, 330 ); | ||
Window.setTitle( "File for dated speedy deletion" ); | Window.setTitle( "File for dated speedy deletion" ); | ||
Window.setScriptName( "Twinkle" ); | Window.setScriptName( "Twinkle" ); | ||
Window.addFooterLink( "Speedy deletion policy", " | Window.addFooterLink( "Speedy deletion policy", "WP:CSD" ); | ||
Window.addFooterLink( "Twinkle help", " | Window.addFooterLink( "Twinkle help", "WP:TW/DOC#image" ); | ||
var form = new Morebits.quickForm( Twinkle.image.callback.evaluate ); | var form = new Morebits.quickForm( Twinkle.image.callback.evaluate ); | ||
Line 72: | Line 72: | ||
label: 'Orphaned fair use (CSD F5)', | label: 'Orphaned fair use (CSD F5)', | ||
value: 'orphaned fair use', | value: 'orphaned fair use', | ||
tooltip: 'Image or media is unlicensed for use on Wikipedia and allowed only under a claim of fair use per | tooltip: 'Image or media is unlicensed for use on Wikipedia and allowed only under a claim of fair use per Sarkarverse:Non-free content, but it is not used in any articles' | ||
}, | }, | ||
{ | { | ||
Line 87: | Line 87: | ||
label: 'Replaceable fair use (CSD F7)', | label: 'Replaceable fair use (CSD F7)', | ||
value: 'replaceable fair use', | value: 'replaceable fair use', | ||
tooltip: 'Image or media may fail Wikipedia\'s first non-free content criterion ([[ | tooltip: 'Image or media may fail Wikipedia\'s first non-free content criterion ([[WP:NFCC#1]]) in that it illustrates a subject for which a free image might reasonably be found or created that adequately provides the same information' | ||
}, | }, | ||
{ | { | ||
Line 130: | Line 130: | ||
{ | { | ||
label: 'Non-free', | label: 'Non-free', | ||
tooltip: ' | tooltip: 'File is licensed under a fair use claim' | ||
} | |||
] | |||
} ); | |||
/* falls through */ | |||
case 'no license': | |||
work_area.append( { | |||
type: 'checkbox', | |||
name: 'derivative', | |||
list: [ | |||
{ | |||
label: 'Derivative work which lacks a source for incorporated works', | |||
tooltip: 'File is a derivative of one or more other works whose source is not specified' | |||
} | } | ||
] | ] | ||
Line 158: | Line 170: | ||
case 'replaceable fair use': | case 'replaceable fair use': | ||
work_area.append( { | work_area.append( { | ||
type: ' | type: 'textarea', | ||
name: ' | name: 'reason', | ||
label: 'Reason: ' | |||
} ); | } ); | ||
break; | break; | ||
Line 176: | Line 183: | ||
Twinkle.image.callback.evaluate = function twinkleimageCallbackEvaluate(event) { | Twinkle.image.callback.evaluate = function twinkleimageCallbackEvaluate(event) { | ||
var type, non_free, source, reason, replacement, | var type, non_free, source, reason, replacement, derivative; | ||
var notify = event.target.notify.checked; | var notify = event.target.notify.checked; | ||
Line 198: | Line 205: | ||
replacement = event.target.replacement.value; | replacement = event.target.replacement.value; | ||
} | } | ||
if( event.target. | if( event.target.derivative ) { | ||
derivative = event.target.derivative.checked; | |||
} | } | ||
Line 227: | Line 234: | ||
var lognomination = Twinkle.getPref('logSpeedyNominations') && Twinkle.getPref('noLogOnSpeedyNomination').indexOf(csdcrit.toLowerCase()) === -1; | var lognomination = Twinkle.getPref('logSpeedyNominations') && Twinkle.getPref('noLogOnSpeedyNomination').indexOf(csdcrit.toLowerCase()) === -1; | ||
var templatename = (derivative ? ('dw ' + type) : type); | |||
var params = { | var params = { | ||
'type': type, | 'type': type, | ||
'templatename': templatename, | |||
'normalized': csdcrit, | 'normalized': csdcrit, | ||
'non_free': non_free, | 'non_free': non_free, | ||
Line 235: | Line 244: | ||
'reason': reason, | 'reason': reason, | ||
'replacement': replacement, | 'replacement': replacement, | ||
'lognomination': lognomination | 'lognomination': lognomination | ||
}; | }; | ||
Line 260: | Line 268: | ||
// No auto-notification, display what was going to be added. | // No auto-notification, display what was going to be added. | ||
var noteData = document.createElement( 'pre' ); | var noteData = document.createElement( 'pre' ); | ||
noteData.appendChild( document.createTextNode( "{{subst:di-" + | noteData.appendChild( document.createTextNode( "{{subst:di-" + templatename + "-notice|1=" + mw.config.get('wgTitle') + "}} ~~~~" ) ); | ||
Morebits.status.info( 'Notification', [ 'Following/similar data should be posted to the original uploader:', document.createElement( 'br' ), noteData ] ); | Morebits.status.info( 'Notification', [ 'Following/similar data should be posted to the original uploader:', document.createElement( 'br' ), noteData ] ); | ||
} | } | ||
Line 273: | Line 281: | ||
text = text.replace(/\{\{(mtc|(copy |move )?to ?commons|move to wikimedia commons|copy to wikimedia commons)[^}]*\}\}/gi, ""); | text = text.replace(/\{\{(mtc|(copy |move )?to ?commons|move to wikimedia commons|copy to wikimedia commons)[^}]*\}\}/gi, ""); | ||
var tag = "{{di-" + params. | var tag = "{{di-" + params.templatename + "|date={{subst:#time:j F Y}}"; | ||
switch( params.type ) { | switch( params.type ) { | ||
case 'no source no license': | case 'no source no license': | ||
Line 289: | Line 297: | ||
break; | break; | ||
case 'replaceable fair use': | case 'replaceable fair use': | ||
tag += params. | tag += params.reason ? "|1=" + params.reason : ""; | ||
break; | break; | ||
default: | default: | ||
break; // doesn't matter | break; // doesn't matter | ||
} | } | ||
tag += "}}\n"; | tag += "|help=off}}\n"; | ||
pageobj.setPageText(tag + text); | pageobj.setPageText(tag + text); | ||
pageobj.setEditSummary("This file is up for deletion, per [[ | pageobj.setEditSummary("This file is up for deletion, per [[WP:CSD#" + params.normalized + "|CSD " + params.normalized + "]] (" + params.type + ")." + Twinkle.getPref('summaryAd')); | ||
switch (Twinkle.getPref('deliWatchPage')) { | switch (Twinkle.getPref('deliWatchPage')) { | ||
case 'yes': | case 'yes': | ||
Line 315: | Line 323: | ||
var params = pageobj.getCallbackParameters(); | var params = pageobj.getCallbackParameters(); | ||
var initialContrib = pageobj.getCreator(); | var initialContrib = pageobj.getCreator(); | ||
var usertalkpage = new Morebits.wiki.page('User talk:' + initialContrib, "Notifying initial contributor (" + initialContrib + ")"); | |||
// disallow warning yourself | |||
if (initialContrib === mw.config.get('wgUserName')) { | |||
pageobj.getStatusElement().warn("You (" + initialContrib + ") created this page; skipping user notification"); | |||
} else { | |||
var usertalkpage = new Morebits.wiki.page('User talk:' + initialContrib, "Notifying initial contributor (" + initialContrib + ")"); | |||
var notifytext = "\n{{subst:di-" + params.templatename + "-notice|1=" + mw.config.get('wgTitle'); | |||
if (params.type === 'no permission') { | |||
notifytext += params.source ? "|source=" + params.source : ""; | |||
} | |||
notifytext += "}} ~~~~"; | |||
usertalkpage.setAppendText(notifytext); | |||
usertalkpage.setEditSummary("Notification: tagging for deletion of [[:" + Morebits.pageNameNorm + "]]." + Twinkle.getPref('summaryAd')); | |||
usertalkpage.setCreateOption('recreate'); | |||
switch (Twinkle.getPref('deliWatchUser')) { | |||
case 'yes': | |||
usertalkpage.setWatchlist(true); | |||
break; | |||
case 'no': | |||
usertalkpage.setWatchlistFromPreferences(false); | |||
break; | |||
default: | |||
usertalkpage.setWatchlistFromPreferences(true); | |||
break; | |||
} | |||
usertalkpage.setFollowRedirect(true); | |||
usertalkpage.append(); | |||
} | } | ||
// add this nomination to the user's userspace log, if the user has enabled it | // add this nomination to the user's userspace log, if the user has enabled it |