MediaWiki:Common.js: Difference between revisions

From VanRO Ragnarok Online
No edit summary
No edit summary
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
$(document).ready(function() {
// Existing setup for the selectFileWidget
     $('#ooui-84').prop('checked', true); // Automatically checks the checkbox with ID 'ooui-84'
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...