blob: 09ccc5a9a0b827e2c9cd8518df8786297e722a3f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
/*
* This script is run on [[Special:UploadWizard]].
* Configures and creates an interface for uploading files in multiple steps, hence "wizard".
*
* Tries to transform Javascript globals dumped on us by the SpecialUploadWizard.php into a more
* compact configuration, owned by the UploadWizard created.
*/
// Create UploadWizard
( function ( mw, $ ) {
function isCompatible() {
var
profile = $.client.profile(),
// Firefox < 7.0 sends an empty string as filename for Blobs in FormData.
// requests. https://bugzilla.mozilla.org/show_bug.cgi?id=649150
badFormDataBlobs = profile.name === 'firefox' && profile.versionNumber < 7;
return !!(
window.FileReader &&
window.FormData &&
window.File &&
window.File.prototype.slice &&
!badFormDataBlobs
);
}
mw.UploadWizardPage = function () {
var uploadWizard,
config = mw.config.get( 'UploadWizardConfig' );
// Default configuration value that cannot be removed
config.maxUploads = config.maxUploads || 10;
// Remove the initial spinner
$( '#mwe-first-spinner' ).remove();
if ( $( '#upload-wizard' ).length === 0 ) {
mw.log( 'UploadWizard is disabled, nothing to do.' );
return;
}
if ( !isCompatible() ) {
// Display the same error message as for grade-C browsers
$( '.mwe-upwiz-unavailable' ).show();
return;
}
uploadWizard = new mw.UploadWizard( config );
uploadWizard.createInterface( '#upload-wizard' );
};
$( function () {
// show page.
mw.UploadWizardPage();
} );
}( mediaWiki, jQuery ) );
|