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

Content deleted Content added
Fix onFileSelectChange handler; lint error fixes
enough changed for minor version bump
 
(8 intermediate revisions by the same user not shown)
Line 5:
var SCRIPT = {
name: 'Covery',
version: '1.45.10',
ad: ' (using [[User:Evad37/Covery|Covery]])'
};
Line 438:
this.content = new OO.ui.FieldsetLayout();
 
this.fileSelect = new OO.ui.SelectFileWidget();{
droppable: true,
showDropTarget: true,
// thumbnailSizeLimit: 0,
$element: $("<div style='background: #eee;'>")
});
// this.fileSelect.$element
// .find(".oo-ui-selectFileWidget-dropTarget").css({"height":"auto"});
// this.fileSelect.$element
// .find(".oo-ui-selectFileWidget-thumbnail").css({"display":"none"});
// this.fileSelect.$element
// .find(".oo-ui-selectFileInputWidget-info").css({"margin":"0"});
this.urlInput = new OO.ui.TextInputWidget({
type: 'url',
Line 457 ⟶ 469:
this.fileSelectField = new OO.ui.FieldLayout(this.fileSelect, {
label: 'Upload a file...',
align: 'lefttop'
});
this.fileSelect.field = this.fileSelectField;
Line 471 ⟶ 483:
this.titleInputField = new OO.ui.FieldLayout(this.titleInput, {
label: 'File name',
align: 'lefttop'
});
this.titleInputField.$element
.find(".oo-ui-fieldLayout-messages").css({"margin-top":"2em"}); // prevent errors overlapping input
this.captionInputField = new OO.ui.FieldLayout(this.captionInput, {
label: 'Caption',
Line 496 ⟶ 510:
this.content.addItems([
this.fileSelectField,
// this.urlInputField,
this.titleInputField,
//this.imagePreviewField,
this.captionInputField,
this.altTextInputField,
Line 572 ⟶ 586:
self.updateSize();
widgetUsed.popPending();
if (widgetUsed.setIndicator('required'); {
widgetUsed.setIndicator('required');
}
otherWidget.setDisabled(false);
if (otherWidget.setIndicator(null); {
otherWidget.setIndicator(null);
}
self.titleInput.setValue(fileName);
self.onRequiredInputChange();
Line 584 ⟶ 602:
self.resizedFile = null;
widgetUsed.popPending();
if (widgetUsed.setIndicator('clear'); {
widgetUsed.setIndicator('clear');
}
widgetUsed.field.setErrors([errorMessage]);
otherWidget.setDisabled(false);
if (otherWidget.setIndicator(null); {
otherWidget.setIndicator(null);
}
self.onRequiredInputChange();
}
Line 611 ⟶ 633:
return;
}
var filePromise = fetch(value, {mode: 'no-cors'}).then(function(result) {
return result.blob();
});