User:BlankEclair/SpecialUploadPrefillFromComic.js: Difference between revisions

Content added Content deleted
m (Fix typo)
(Hook up categories to add with actual adding)
Line 190: Line 190:
var dialog = this;
var dialog = this;
if (action === "continue") {
if (action === "continue") {
debugger;
if (!this.requiredFieldsFilled()) {
if (!this.requiredFieldsFilled()) {
mw.notify(getMessage("required-fields-unfilled"), {type: "error"});
mw.notify(getMessage("required-fields-unfilled"), {type: "error"});
Line 202: Line 201:
var licenseToSet = this.typeSelect.findSelectedItem();
var licenseToSet = this.typeSelect.findSelectedItem();
licenseToSet = licenseToSet ? licenseToSet.getData() : null;
licenseToSet = licenseToSet ? licenseToSet.getData() : null;
var categoriesToAdd = this.categoriesField.getValue();


// Why isn't this using mw.Api? Because I keep breaking abstractions (seriously, is there no way I could get an AJAX response from JQuery without it parsing and potentially throwing an error?)
// Why isn't this using mw.Api? Because I keep breaking abstractions (seriously, is there no way I could get an AJAX response from JQuery without it parsing and potentially throwing an error?)
Line 248: Line 248:
return match + date;
return match + date;
});
});
if (categoriesToAdd) {
newDescription += "\n\n" + categoriesToAdd.map(function(category) { return "[[Category:" + category + "]]"; }).join("\n");
}
setCurrentDescription(newDescription);
setCurrentDescription(newDescription);
if (licenseToSet) {
if (licenseToSet) {