Content deleted Content added
try disabling QUnit autostart |
enough changed for minor version bump |
||
(16 intermediate revisions by the same user not shown) | |||
Line 1:
/* jshint esversion: 6, laxbreak: true, undef: true, eqnull: true, maxerr: 999 */
/* globals console, document, File, FileReader, fetch, window, $, mw, OO */
// <nowiki>
var setupCovery = function setupCovery() {
var SCRIPT = {
name: 'Covery',
version: '1.
ad: ' (using [[User:Evad37/Covery|Covery]])'
};
Line 164 ⟶ 166:
canvas.width = width;
canvas.height = height;
ctx.drawImage(origImg, 0, 0, width, height);
Line 436 ⟶ 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 455 ⟶ 469:
this.fileSelectField = new OO.ui.FieldLayout(this.fileSelect, {
label: 'Upload a file...',
align: '
});
this.fileSelect.field = this.fileSelectField;
Line 469 ⟶ 483:
this.titleInputField = new OO.ui.FieldLayout(this.titleInput, {
label: 'File name',
align: '
});
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 494 ⟶ 510:
this.content.addItems([
this.fileSelectField,
// this.urlInputField,
this.titleInputField,
//this.imagePreviewField,
this.captionInputField,
this.altTextInputField,
Line 570 ⟶ 586:
self.updateSize();
widgetUsed.popPending();
if (widgetUsed.setIndicator
widgetUsed.setIndicator('required');
}
otherWidget.setDisabled(false);
if (otherWidget.setIndicator
otherWidget.setIndicator(null);
}
self.titleInput.setValue(fileName);
self.onRequiredInputChange();
Line 582 ⟶ 602:
self.resizedFile = null;
widgetUsed.popPending();
if (widgetUsed.setIndicator
widgetUsed.setIndicator('clear');
}
widgetUsed.field.setErrors([errorMessage]);
otherWidget.setDisabled(false);
if (otherWidget.setIndicator
otherWidget.setIndicator(null);
}
self.onRequiredInputChange();
}
Line 591 ⟶ 615:
};
CoveryDialog.prototype.onFileSelectChange = function(
var file = files && files[0];
if (!file || !file.name) {
return;
}
this.onFileChosen(file, file.name, this.fileSelect, this.urlInput);
};
Line 605 ⟶ 633:
return;
}
var filePromise = fetch(value, {mode: 'no-cors'}).then(function(result) {
return result.blob();
});
Line 971 ⟶ 999:
function(data) {
if (data && data.sucess) {
window.___location.reload();
}
},
Line 1,057 ⟶ 1,085:
) {
$.when(setupForTesting(), $.ready()).then(function() {
mw.loader.load('https://en.wikipedia.org/w/index.php?title=User:Evad37/qunit-2.8.0.css&action=raw&ctype=text/css', 'text/css');
$.getScript('https://en.wikipedia.org/w/index.php?title=User:Evad37/qunit-2.8.0.js&action=raw&ctype=text/javascript', function() {
/* globals QUnit */
QUnit.module('Get parameters from a template');
QUnit.test('Single unnamed param', function(assert) {
Line 1,624 ⟶ 1,649:
'{{infobox video game franchise}}'
];
infoboxesExpectedToPass.forEach(infobox => {
QUnit.test(infobox, function(assert) {
let infoboxObject = getInfoboxTemplate(infobox);
Line 1,630 ⟶ 1,655:
assert.deepEqual(checkedInfobox, infoboxObject, infobox + ' passes check');
});
});
QUnit.module('Infobox check (expected fail)');
var infoboxesExpectedToFail = [
Line 1,640 ⟶ 1,665:
'{{infobox foo}}'
];
infoboxesExpectedToFail.forEach(infobox => {
QUnit.test(infobox, function(assert) {
let infoboxObject = getInfoboxTemplate(infobox);
Line 1,647 ⟶ 1,672:
}, infobox + ' throws an error');
});
});
QUnit.module('Make infobox wikitext');
Line 1,748 ⟶ 1,773:
'mediawiki.util',
'mediawiki.api',
'oojs-ui-core',
'oojs-ui-widgets',
|