}
}
// We might show a preview
- if( wgAjaxLicensePreview ) {
- wgUploadLicenseObj.fetchPreview( selection );
- }
+ wgUploadLicenseObj.fetchPreview( selection );
}
function licenseSelectorFixup() {
'timeoutID': false,
'keypress': function () {
+ if ( !wgAjaxUploadDestCheck || !sajax_init_object() ) return;
+
// Find file to upload
var destFile = document.getElementById('wpDestFile');
var warningElt = document.getElementById( 'wpDestFile-warning' );
window.clearTimeout( this.timeoutID );
}
// Check response cache
- if ( this.nameToCheck in this.responseCache ) {
- this.setWarning(this.responseCache[this.nameToCheck]);
- return;
+ for (cached in this.responseCache) {
+ if (this.nameToCheck == cached) {
+ this.setWarning(this.responseCache[this.nameToCheck]);
+ return;
+ }
}
this.timeoutID = window.setTimeout( 'wgUploadWarningObj.timeout()', this.delay );
},
'checkNow': function (fname) {
+ if ( !wgAjaxUploadDestCheck || !sajax_init_object() ) return;
if ( this.timeoutID ) {
window.clearTimeout( this.timeoutID );
}
},
'timeout' : function() {
+ if ( !wgAjaxUploadDestCheck || !sajax_init_object() ) return;
injectSpinner( document.getElementById( 'wpDestFile' ), 'destcheck' );
// Get variables into local scope so that they will be preserved for the
var destFile = document.getElementById('wpDestFile');
if (destFile) {
destFile.value = fname;
- if ( wgAjaxUploadDestCheck ) {
- wgUploadWarningObj.checkNow(fname) ;
- }
+ wgUploadWarningObj.checkNow(fname) ;
}
}
'responseCache' : { '' : '' },
'fetchPreview': function( license ) {
- if( license == "" ) {
- this.showPreview( "" );
- } else if( license in this.responseCache ) {
- this.showPreview( this.responseCache[license] );
- } else {
- injectSpinner( document.getElementById( 'wpLicense' ), 'license' );
- sajax_do_call( 'UploadForm::ajaxGetLicensePreview', [license],
- function( result ) {
- wgUploadLicenseObj.processResult( result, license );
- }
- );
+ if( !wgAjaxLicensePreview || !sajax_init_object() ) return;
+ for (cached in this.responseCache) {
+ if (cached == license) {
+ this.showPreview( this.responseCache[license] );
+ return;
+ }
}
+ injectSpinner( document.getElementById( 'wpLicense' ), 'license' );
+ sajax_do_call( 'UploadForm::ajaxGetLicensePreview', [license],
+ function( result ) {
+ wgUploadLicenseObj.processResult( result, license );
+ }
+ );
},
'processResult' : function( result, license ) {
var cb = inputs[i];
if ( !cb.type || cb.type.toLowerCase() != 'checkbox' )
continue;
- cb.index = checkboxes.push(cb) - 1;
+ var end = checkboxes.length;
+ checkboxes[end] = cb;
+ cb.index = end;
cb.onmouseup = checkboxMouseupHandler;
}
var arrRegExpClassNames = new Array();
if(typeof oClassNames == "object"){
for(var i=0; i<oClassNames.length; i++){
- arrRegExpClassNames.push(new RegExp("(^|\\s)" + oClassNames[i].replace(/\-/g, "\\-") + "(\\s|$)"));
+ arrRegExpClassNames[arrRegExpClassNames.length] =
+ new RegExp("(^|\\s)" + oClassNames[i].replace(/\-/g, "\\-") + "(\\s|$)");
}
}
else{
- arrRegExpClassNames.push(new RegExp("(^|\\s)" + oClassNames.replace(/\-/g, "\\-") + "(\\s|$)"));
+ arrRegExpClassNames[arrRegExpClassNames.length] =
+ new RegExp("(^|\\s)" + oClassNames.replace(/\-/g, "\\-") + "(\\s|$)");
}
var oElement;
var bMatchesAll;
}
}
if(bMatchesAll){
- arrReturnElements.push(oElement);
+ arrReturnElements[arrReturnElements.length] = oElement;
}
}
return (arrReturnElements)