MediaWiki:Gadget-twinkleimage.js: Perbedaan antara revisi
Konten dihapus Konten ditambahkan
Repo at a491314: Link "speedy deletion policy" directly to #Files |
Repo at 5c1e7e3: Don't assume a replacement was specified (#822); Silently append File: prefix on speedy parameters (#788); fix CSD log link for F5 replacement file; Shift lookupCreator to lookupCreation, also include timestamp |
||
Baris 1:
// <nowiki>
(function($) {
Baris 11:
* Mode of invocation: Tab ("DI")
* Active on: Local nonredirect file pages (not on Commons)
*/
Twinkle.image = function twinkleimage() {
if (mw.config.get('wgNamespaceNumber') === 6 && mw.config.get('wgArticleId') && !document.getElementById(
Twinkle.addPortletLink(Twinkle.image.callback,
}
};
Twinkle.image.callback = function twinkleimageCallback() {
var Window = new Morebits.simpleWindow(
Window.setTitle(
Window.setScriptName(
Window.addFooterLink(
Window.addFooterLink('Bantuan
var form = new Morebits.quickForm(
form.append(
);
var field = form.append(
field.append(
form.append(
form.append(
var result = form.render();
Window.setContent(
Window.display();
// We must init the parameters
var evt = document.createEvent(
evt.initEvent(
result.type[0].dispatchEvent(
};
Baris 113 ⟶ 112:
var value = event.target.values;
var root = event.target.form;
var work_area = new Morebits.quickForm.element(
switch (
case 'no source no license':
case 'no source':
work_area.append(
/* falls through */
case 'no license':
work_area.append(
break;
case 'no permission':
work_area.append(
break;
case 'disputed fair use rationale':
work_area.append(
break;
case 'orphaned fair use':
work_area.append(
tooltip: 'Optional file that replaces this one. The "File:" prefix is optional.'
break;
case 'replaceable fair use':
work_area.append(
break;
default:
Baris 176:
}
root.replaceChild(
};
Baris 184:
var notify = event.target.notify.checked;
var types = event.target.type;
for
if (
type = types[i].values;
break;
}
}
if (
non_free = event.target.non_free.checked;
}
if (
source = event.target.source.value;
}
if (
reason = event.target.reason.value;
}
if
replacement = event.target.replacement.value;
replacement = /^\s*(Image|File):/i.test(replacement) ? replacement : 'File:' + replacement;
}
if (
derivative = event.target.derivative.checked;
}
var csdcrit;
switch (
case 'no source no license':
case 'no source':
case 'no license':
csdcrit =
break;
case 'orphaned fair use':
csdcrit =
break;
case 'no fair use rationale':
csdcrit =
break;
case 'disputed fair use rationale':
case 'replaceable fair use':
csdcrit =
break;
case 'no permission':
csdcrit =
break;
default:
throw new Error(
}
var lognomination = Twinkle.getPref('logSpeedyNominations') && Twinkle.getPref('noLogOnSpeedyNomination').indexOf(csdcrit.toLowerCase()) === -1;
var templatename =
var params = {
Baris 243 ⟶ 244:
'lognomination': lognomination
};
Morebits.simpleWindow.setButtonsEnabled(
Morebits.status.init(
Morebits.wiki.actionCompleted.redirect = mw.config.get('wgPageName');
Morebits.wiki.actionCompleted.notice =
// Tagging image
var wikipedia_page = new Morebits.wiki.page(
wikipedia_page.setCallbackParameters(
wikipedia_page.load(
// Notifying uploader
if (
wikipedia_page.
} else {
// add to CSD log if desired
Baris 264 ⟶ 265:
}
// No auto-notification, display what was going to be added.
var noteData = document.createElement(
noteData.appendChild(
Morebits.status.info(
}
};
Baris 276 ⟶ 277:
// remove "move to Commons" tag - deletion-tagged files cannot be moved to Commons
text = text.replace(/\{\{(mtc|(copy |move )?to ?commons|move to wikimedia commons|copy to wikimedia commons)[^}]*\}\}/gi,
var tag =
switch (
case 'no source no license':
case 'no source':
tag += params.non_free ?
break;
case 'no permission':
tag += params.source ?
break;
case 'disputed fair use rationale':
tag += params.reason ?
break;
case 'orphaned fair use':
tag += params.replacement ?
break;
case 'replaceable fair use':
tag += params.reason ?
break;
default:
break; // doesn't matter
}
tag +=
pageobj.setPageText(tag + text);
pageobj.setEditSummary(
switch (Twinkle.getPref('deliWatchPage')) {
case 'yes':
Baris 323 ⟶ 324:
// disallow warning yourself
if (initialContrib === mw.config.get('wgUserName')) {
pageobj.getStatusElement().warn(
} else {
var usertalkpage = new Morebits.wiki.page('User talk:' + initialContrib,
var notifytext =
if (params.type === 'no permission') {
notifytext += params.source ?
}
notifytext +=
usertalkpage.setAppendText(notifytext);
usertalkpage.setEditSummary(
usertalkpage.setCreateOption('recreate');
switch (Twinkle.getPref('deliWatchUser')) {
Baris 359 ⟶ 360:
// </nowiki>
|