User:Evad37/Covery/sandbox.js: Difference between revisions

Content deleted Content added
.
.
Line 639:
var impliedTitleMime = mimeLookup[titleExtension] || '';
return fileMime === impliedTitleMime;
};
 
CoveryDialog.prototype.changeTitleExtension = function(newExtension) {
this.titleInput.setValue(
this.titleInput.getValue().replace(/(.*)(\..*?)?/, '$1.' + newExtension)
);
};
 
Line 656 ⟶ 650:
// check file mime matches title mime
var titleHasCorrectExtension = self.checkMimes();
if (!titleHasCorrectExtension && self.resizedFile && self.resizedFile.type) {
self.titleInputField.setErrors(['Unexpected file extension']);
self.actions.setAbilities({
upload: false
});
self.changeTitleExtension(
self.resizedFile.type.replace('image/', '').replace(/\+.*/, '')
);
return;
}
 
Line 671 ⟶ 659:
!!self.resizedFile &&
!!self.titleInput.getValue().length &&
titleHasCorrectExtension; &&
!!self.developerInput.getValue().length &&
!!self.publisherInput.getValue().length;
self.actions.setAbilities({
upload: requirementsMet
Line 678 ⟶ 667:
},
function() {
this.titleInputField.setErrors(['Invalid file name']);
self.actions.setAbilities({
upload: false