MediaWiki:PreventUnlicensedFiles.js

/** * * @name: preventUnlicensedFiles * @description: Prevent unlicensed files from being uploaded * @author: Unai01 * */   'use strict'; var conf = mw.config.get([       'wgCanonicalSpecialPageName',        'wgAction'    ]); if (conf.wgCanonicalSpecialPageName != 'Upload' && conf.wgAction != 'edit') { return; }   var preventUnlicensedFiles = { initEditor: function { uploadForm.querySelector('#ImageUploadLicense').setAttribute('required', ''); },       initUpload: function { uploadForm.querySelector('#wpLicense').setAttribute('required', ''); },       init: function { if (conf.wgAction === 'edit') this.initEditor; else if (conf.wgCanonicalSpecialPageName === 'Upload') this.initUpload; }   };    preventUnlicensedFiles.init; }(document));
 * (function(uploadForm) {