MediaWiki:Common.js

From VanRO Ragnarok Online

Note: After publishing, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Press Ctrl-F5.
// 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...