MediaWiki:Gadget-morebits.js: Difference between revisions
Content deleted Content added
Repo at 257e210: Remove IE 11 compatibility code (#1900) |
Repo at 83dcdd2: Support batch requested moves (#1888) |
||
Line 354:
* - Attributes: Everything the text `input` has, as well as: min, max, step, list
* - `dyninput`: A set of text boxes with "Remove" buttons and an "Add" button.
* - Attributes: name, label, min, max, inputs, sublabel, value, size, maxlength, event
* - `hidden`: An invisible form field.
* - Attributes: name, value
Line 372:
* - `div`, `select`, `field`, `checkbox`/`radio`, `input`, `textarea`, `header`, and `dyninput` can accept an array of items,
* and the label item(s) can be `Element`s.
* - `option`, `optgroup`, `
*
* @memberof Morebits.quickForm
Line 732:
var sublist = {
type: '
label: data.sublabel || data.label,▼
name: data.name,▼
value: data.value,▼
size: data.size,▼
remove: false,
maxlength: data.maxlength,
event: data.event,
inputs: data.inputs || [{
// compatibility
▲ label: data.sublabel || data.label,
▲ name: data.name,
▲ value: data.value,
}]▼
};
Line 755 ⟶ 758:
moreButton.counter = 0;
break;
case '
node = document.createElement('div');
var cell = new Morebits.quickForm.element($.extend(subdata, { type: '_dyninput_cell' }));
label = node.appendChild(document.createElement('label'));▼
});▼
label.setAttribute('for', id);▼
label.style.marginRight = '3px';▼
▲ }
subnode = node.appendChild(document.createElement('input'));▼
if (data.value) {▼
subnode.setAttribute('value', data.value);▼
▲ }
subnode.setAttribute('name', data.name);▼
subnode.setAttribute('type', 'text');▼
if (data.size) {▼
subnode.setAttribute('size', data.size);▼
}▼
if (data.maxlength) {▼
subnode.setAttribute('maxlength', data.maxlength);▼
}▼
if (data.event) {▼
subnode.addEventListener('keyup', data.event, false);▼
}▼
if (data.remove) {
var remove = this.compute({
Line 801 ⟶ 786:
removeButton.morebutton = data.morebutton;
}
break;
case '_dyninput_cell': // Private, similar to normal input
node = document.createElement('span');
if (data.label) {
▲ label = node.appendChild(document.createElement('label'));
label.appendChild(document.createTextNode(data.label));
▲ label.setAttribute('for', id + '_input');
▲ label.style.marginRight = '3px';
▲ }
▲ subnode = node.appendChild(document.createElement('input'));
subnode.setAttribute('id', id + '_input');
▲ if (data.value) {
▲ subnode.setAttribute('value', data.value);
▲ }
▲ subnode.setAttribute('name', data.name);
▲ subnode.setAttribute('type', 'text');
subnode.setAttribute('data-dyninput', 'data-dyninput');
▲ if (data.size) {
▲ subnode.setAttribute('size', data.size);
▲ }
▲ if (data.maxlength) {
▲ subnode.setAttribute('maxlength', data.maxlength);
}
if (data.required) {
subnode.setAttribute('required', 'required');
}
if (data.disabled) {
subnode.setAttribute('required', 'disabled');
}
▲ if (data.event) {
▲ subnode.addEventListener('keyup', data.event, false);
}
node.style.marginRight = '3px';
break;
case 'hidden':
Line 981 ⟶ 1,001:
case 'text': // falls through
case 'textarea':
result[fieldNameNorm] = result[fieldNameNorm] || [];
result[fieldNameNorm].push(field.value.trim());
} else {
result[fieldNameNorm] = field.value.trim();
}
break;
default: // could be select-one, date, number, email, etc
|