MediaWiki:Common.js: Difference between revisions
From VanRO Ragnarok Online
No edit summary |
No edit summary |
||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
this. | // Existing setup for the selectFileWidget | ||
this.selectFileWidget = new OO.ui.SelectFileWidget({ | |||
showDropTarget: true | |||
}); | |||
this.selectFileWidget.on('change', function () { | |||
} ); | var file = layout.selectFileWidget.getValue(); | ||
// Set the date to lastModified once we have the file | |||
if (layout.getDateFromLastModified(file) !== undefined) { | |||
layout.dateWidget.setValue(layout.getDateFromLastModified(file)); | |||
} | |||
// Check if we have EXIF data and set to that where available | |||
layout.getDateFromExif(file).done(function (date) { | |||
layout.dateWidget.setValue(date); | |||
}); | |||
layout.updateFilePreview(); | |||
// Automatically set a default description | |||
var defaultDescription = "Uploaded file " + (file ? file.name : "unknown"); | |||
layout.descriptionWidget.setValue(defaultDescription); | |||
}); | |||
// Remaining setup... |
Latest revision as of 03:16, 15 May 2024
// Existing setup for the selectFileWidget this.selectFileWidget = new OO.ui.SelectFileWidget({ showDropTarget: true }); this.selectFileWidget.on('change', function () { var file = layout.selectFileWidget.getValue(); // Set the date to lastModified once we have the file if (layout.getDateFromLastModified(file) !== undefined) { layout.dateWidget.setValue(layout.getDateFromLastModified(file)); } // Check if we have EXIF data and set to that where available layout.getDateFromExif(file).done(function (date) { layout.dateWidget.setValue(date); }); layout.updateFilePreview(); // Automatically set a default description var defaultDescription = "Uploaded file " + (file ? file.name : "unknown"); layout.descriptionWidget.setValue(defaultDescription); }); // Remaining setup...