// apply CSS rules
- var style = document.createElement('style');
+ var style = elCreate('style');
style.appendChild(document.createTextNode(''));
elData(style, 'created-by', 'WoltLab/Acp/Ui/Style/Editor');
document.head.appendChild(style);
elAttr(this._target, 'src', data.returnValues.url + '?timestamp=' + Date.now());
if (error) {
- error.parentNode.removeChild(error);
+ elRemove(error);
}
UiNotification.show();
* @return {(*|null)} option value or null
*/
getOption: function(key) {
- if (this._options.hasOwnProperty(key)) {
+ if (objOwns(this._options, key)) {
return this._options[key];
}
this._insertAllButton.className = 'button jsButtonAttachmentInsertAll';
this._insertAllButton.textContent = Language.get('wcf.attachment.insertAll');
if (DomTraverse.childBySel(this._target, 'li:not(.uploadFailed)')) {
- this._insertAllButton.style.setProperty('display', 'none');
+ elHide(this._insertAllButton);
}
this._insertAllButton.addEventListener('click', this._insertAll.bind(this));
this._button.appendChild(this._insertAllButton);
listItem.className = 'box64';
elData(listItem, 'filename', filename);
this._target.appendChild(listItem);
- this._target.style.removeProperty('display');
+ elShow(this._target);
var span = elCreate('span');
if (this._options.maxSize >= file.size) {
var listItem = this._fileElements[uploadId][i];
var progress = elByTag(listItem, 'PROGRESS');
- progress.parentNode.removeChild(progress);
+ elRemove(progress);
var filename = elData(listItem, 'filename');
var internalFileId = elData(listItem, 'internal-file-id');
// TODO: this._makeSortable();
if (DomTraverse.childrenBySel(this._target, 'li:not(.uploadFailed)').length) {
- this._insertAllButton.style.removeProperty('display');
+ elShow(this._insertAllButton);
}
else {
- this._insertAllButton.style.setProperty('display', 'none');
+ elHide(this._insertAllButton);
}
DomChangeListener.trigger();
}
if (innerError) {
- innerError.parentNode.removeChild(innerError);
+ elRemove(innerError);
}
return true;
_sourceConverter[i].callback(placeholder.previousElementSibling);
- placeholder.parentNode.removeChild(placeholder);
+ elRemove(placeholder);
}
}
},
var highlighter = elData(element, 'highlighter');
window.dtdesign = element;
var list = DomTraverse.childByTag(element.children[0], 'OL');
- var lineNumber = ~~list.getAttribute('start') || 1;
+ var lineNumber = ~~elAttr(list, 'start') || 1;
var content = '';
for (var i = 0, length = list.childElementCount; i < length; i++) {
}
else if (length > 0) {
attachmentId = ~~attributes[0];
- if (!_options.attachments.images.hasOwnProperty(attachmentId)) {
+ if (!objOwns(_options.attachments.images, attachmentId)) {
length = 0;
}
}
}
}
- var baseUrl = _options.attachments.thumbnailUrl;
+ var width, baseUrl = _options.attachments.thumbnailUrl;
if (length > 2) {
width = ~~attributes[2] || 0;
if (width) {
if (typeof item === 'string') {
for (var smileyCode in __REDACTOR_SMILIES) {
- if (__REDACTOR_SMILIES.hasOwnProperty(smileyCode)) {
+ if (objOwns(__REDACTOR_SMILIES, smileyCode)) {
altValue = smileyCode.replace(/</g, '<').replace(/>/g, '>');
regexp = new RegExp('(\\s|^)' + StringUtil.escapeRegExp(smileyCode) + '(?=\\s|$)', 'gi');
item = item.replace(regexp, '$1<img src="' + __REDACTOR_SMILIES[smileyCode] + '" class="smiley" alt="' + altValue + '">');
var containerId = elData(checkbox, 'container-id');
var data = _containers.get(containerId);
- var type = elAttr(data.element, 'data-type');
+ var type = elData(data.element, 'type');
for (var i = 0, length = data.checkboxes.length; i < length; i++) {
var item = data.checkboxes[i];
- var objectId = ~~item.getAttribute('data-object-id');
+ var objectId = ~~elData(item, 'object-id');
if (isMarked) {
if (!item.checked) {
*/
_mark: function(event) {
var checkbox = event.currentTarget;
- var objectId = ~~checkbox.getAttribute('data-object-id');
+ var objectId = ~~elData(checkbox, 'object-id');
var isMarked = checkbox.checked;
var containerId = elData(checkbox, 'container-id');
var data = _containers.get(containerId);
- var type = elAttr(data.element, 'data-type');
+ var type = elData(data.element, 'type');
var clipboardObject = DomTraverse.parentByClass(checkbox, 'jsClipboardObject');
data.markedObjectIds[(isMarked ? 'add' : 'delete')](objectId);
var formData = {};
if (template.length) {
- var items = UiConfirmation.getContentElement().querySelectorAll('input, select, textarea');
+ var items = elBySel('input, select, textarea', UiConfirmation.getContentElement());
for (var i = 0, length = items.length; i < length; i++) {
var item = items[i];
var name = elAttr(item, 'name');
if (typeof data.internalData.parameters === 'object') {
for (var key in data.internalData.parameters) {
- if (data.internalData.parameters.hasOwnProperty(key)) {
+ if (objOwns(data.internalData.parameters, key)) {
parameters[key] = data.internalData.parameters[key];
}
}
* @param {object} event event object
*/
_unmarkAll: function(event) {
- var type = elAttr(event.currentTarget, 'data-type');
+ var type = elData(event.currentTarget, 'type');
Ajax.api(this, {
actionName: 'unmarkAll',
_ajaxSuccess: function(data) {
if (data.actionName === 'unmarkAll') {
_containers.forEach((function(containerData) {
- if (elAttr(containerData.element, 'data-type') === data.returnValues.objectType) {
+ if (elData(containerData.element, 'type') === data.returnValues.objectType) {
var clipboardObjects = elByClass('jsMarked', containerData.element);
while (clipboardObjects.length) {
clipboardObjects[0].classList.remove('jsMarked');
// rebuild markings
_containers.forEach((function(containerData) {
- var typeName = elAttr(containerData.element, 'data-type');
+ var typeName = elData(containerData.element, 'type');
var objectIds = (data.returnValues.markedItems && objOwns(data.returnValues.markedItems, typeName)) ? data.returnValues.markedItems[typeName] : [];
this._rebuildMarkings(containerData, objectIds);
var keepEditors = [], typeName;
if (data.returnValues && data.returnValues.items) {
for (typeName in data.returnValues.items) {
- if (data.returnValues.items.hasOwnProperty(typeName)) {
+ if (objOwns(data.returnValues.items, typeName)) {
keepEditors.push(typeName);
}
}
var created, dropdown, editor, typeData;
var divider, item, itemData, itemIndex, label, unmarkAll;
for (typeName in data.returnValues.items) {
- if (!data.returnValues.items.hasOwnProperty(typeName)) {
+ if (!objOwns(data.returnValues.items, typeName)) {
continue;
}
// create editor items
for (itemIndex in typeData.items) {
- if (!typeData.items.hasOwnProperty(itemIndex)) continue;
+ if (!objOwns(typeData.items, itemIndex)) continue;
itemData = typeData.items[itemIndex];
var checkbox = data.checkboxes[i];
var clipboardObject = DomTraverse.parentByClass(checkbox, 'jsClipboardObject');
- var isMarked = (objectIds.indexOf(~~checkbox.getAttribute('data-object-id')) !== -1);
+ var isMarked = (objectIds.indexOf(~~elData(checkbox, 'object-id')) !== -1);
if (!isMarked) markAll = false;
checkbox.checked = isMarked;
var parent = button.parentNode;
parent.addEventListener('transitionend', function() {
- parent.parentNode.removeChild(parent);
+ elRemove(parent);
});
parent.classList.remove('active');
_activeId = _hoverId;
var elData = _elements.get(_activeId);
- var data = _cache.get(elAttr(elData.element, 'data-cache-id'));
+ var data = _cache.get(elData(elData.element, 'cache-id'));
if (data.state === STATE_READY) {
_popoverContent.appendChild(data.content);
*/
_clearContent: function() {
if (_activeId && _popoverContent.childElementCount && !_popover.classList.contains('active')) {
- var activeElData = _cache.get(_elements.get(_activeId).element.getAttribute('data-cache-id'));
+ var activeElData = _cache.get(_elements.get(_activeId).elData(element, 'cache-id'));
while (_popoverContent.childNodes.length) {
activeElData.content.appendChild(_popoverContent.childNodes[0]);
}
data: {
actionName: 'changeStyle',
className: 'wcf\\data\\style\\StyleAction',
- objectIDs: [ elAttr(event.currentTarget, 'data-style-id') ]
+ objectIDs: [ elData(event.currentTarget, 'style-id') ]
},
success: function() { window.location.reload(); }
});
* @param {Element} mailSetting mail settings element
*/
_initGroup: function(group, mailSetting) {
- var groupId = ~~group.getAttribute('data-object-id');
+ var groupId = ~~elData(group, 'object-id');
var disabledNotification = elById('settings_' + groupId + '_disabled');
disabledNotification.addEventListener('click', function() { mailSetting.classList.remove('active'); });
event.preventDefault();
var button = event.currentTarget;
- var objectId = ~~button.getAttribute('data-object-id');
+ var objectId = ~~elData(button, 'object-id');
var data = _data.get(objectId);
if (data.dropdownMenu === null) {
data.dropdownMenu = this._createDropdown(objectId, data.mailValue.value);
else {
var items = DomTraverse.childrenByTag(data.dropdownMenu, 'LI'), value = data.mailValue.value;
for (var i = 0; i < 4; i++) {
- items[i].classList[(items[i].getAttribute('data-value') === value) ? 'add' : 'remove']('active');
+ items[i].classList[(elData(items[i], 'value') === value) ? 'add' : 'remove']('active');
}
}
},
* @param {Object} event event object
*/
_selectType: function(event) {
- var value = elAttr(event.currentTarget, 'data-value');
- var groupId = ~~event.currentTarget.parentNode.getAttribute('data-object-id');
+ var value = elData(event.currentTarget, 'value');
+ var groupId = ~~elData(event.currentTarget.parentNode, 'object-id');
var data = _data.get(groupId);
data.mailValue.value = value;
var newObj = {};
for (var key in obj) {
- if (obj.hasOwnProperty(key) && typeof obj[key] !== 'undefined') {
+ if (objOwns(obj, key) && typeof obj[key] !== 'undefined') {
newObj[key] = _clone(obj[key]);
}
}
if (!obj) continue;
for (var key in obj) {
- if (obj.hasOwnProperty(key)) {
+ if (objOwns(obj, key)) {
if (!Array.isArray(obj[key]) && typeof obj[key] === 'object') {
if (this.isPlainObject(obj[key])) {
// object literals have the prototype of Object which in return has no parent prototype
var parameters = [];
for (var key in obj) {
- if (obj.hasOwnProperty(key)) {
+ if (objOwns(obj, key)) {
var parameterKey = (prefix) ? prefix + '[' + key + ']' : key;
var value = obj[key];
}
_input = input;
- var data = _data.get(_input), date, value = elAttr(_input, 'data-value');
+ var data = _data.get(_input), date, value = elData(_input, 'value');
if (value) {
date = new Date(+value);
}
// set min/max date
- _minDate = elAttr(_input, 'data-min-date');
- if (_minDate.match(/^datePicker-(.+)$/)) _minDate = elById(RegExp.$1).getAttribute('data-value');
+ _minDate = elData(_input, 'min-date');
+ if (_minDate.match(/^datePicker-(.+)$/)) _minDate = elData(elById(RegExp.$1), 'value');
_minDate = new Date(+_minDate);
- _maxDate = elAttr(_input, 'data-max-date');
- if (_maxDate.match(/^datePicker-(.+)$/)) _maxDate = elById(RegExp.$1).getAttribute('data-value');
+ _maxDate = elData(_input, 'max-date');
+ if (_maxDate.match(/^datePicker-(.+)$/)) _maxDate = elData(elById(RegExp.$1), 'value');
_maxDate = new Date(+_maxDate);
if (data.isDateTime) {
_renderGrid: function(day, month, year) {
var cell, hasDay = (day !== undefined), hasMonth = (month !== undefined);
- day = ~~day || ~~_dateGrid.getAttribute('data-day');
+ day = ~~day || ~~elData(_dateGrid, 'day');
month = ~~month;
year = ~~year;
var fragment = document.createDocumentFragment();
fragment.appendChild(_dateGrid);
- if (!hasMonth) month = ~~_dateGrid.getAttribute('data-month');
- year = year || ~~_dateGrid.getAttribute('data-year');
+ if (!hasMonth) month = ~~elData(_dateGrid, 'month');
+ year = year || ~~elData(_dateGrid, 'year');
// check if current selection exceeds min/max date
var date = new Date(year + '-' + ('0' + (month + 1).toString()).slice(-2) + '-' + ('0' + day.toString()).slice(-2));
date.setDate(date.getDate() + 1);
}
- elAttr(_dateGrid, 'data-month', month);
- elAttr(_dateGrid, 'data-year', year);
+ elData(_dateGrid, 'month', month);
+ elData(_dateGrid, 'year', year);
_datePicker.insertBefore(fragment, _dateTime);
cell.classList[(!cell.classList.contains('otherMonth') && ~~cell.textContent === day) ? 'add' : 'remove']('active');
}
- elAttr(_dateGrid, 'data-day', day);
+ elData(_dateGrid, 'day', day);
}
this._formatValue();
_formatValue: function() {
var data = _data.get(_input), date, value, shadowValue;
- if (elAttr(_input, 'data-empty') === 'true') {
+ if (elData(_input, 'empty') === 'true') {
return;
}
if (data.isDateTime) {
date = new Date(
- elAttr(_dateGrid, 'data-year'),
- elAttr(_dateGrid, 'data-month'),
- elAttr(_dateGrid, 'data-day'),
+ elData(_dateGrid, 'year'),
+ elData(_dateGrid, 'month'),
+ elData(_dateGrid, 'day'),
_dateHour.value,
_dateMinute.value
);
}
else {
date = new Date(
- elAttr(_dateGrid, 'data-year'),
- elAttr(_dateGrid, 'data-month'),
- elAttr(_dateGrid, 'data-day')
+ elData(_dateGrid, 'year'),
+ elData(_dateGrid, 'month'),
+ elData(_dateGrid, 'day')
);
value = DateUtil.formatDate(date);
}
_input.value = value;
- elAttr(_input, 'data-value', date.getTime());
+ elData(_input, 'value', date.getTime());
data.shadow.value = shadowValue;
},
return;
}
- elAttr(_input, 'data-empty', false);
+ elData(_input, 'empty', false);
this._renderGrid(event.currentTarget.textContent);
element = this._getElement(element);
if (element.hasAttribute('data-value')) {
- return new Date(+element.getAttribute('data-value'));
+ return new Date(+elData(element, 'value'));
}
return null;
var container = element.parentNode;
container.parentNode.insertBefore(element, container);
- container.parentNode.removeChild(container);
+ elRemove(container);
elAttr(element, 'type', 'date' + (data.isDateTime ? 'time' : ''));
element.value = data.shadow.value;
element.removeAttribute('data-value');
element.removeEventListener('click', _callbackOpen);
- data.shadow.parentNode.removeChild(data.shadow);
+ elRemove(data);
element.classList.remove('inputDatePicker');
element.readOnly = false;
if (!element.classList.contains('datetime') || elData(element, 'is-future-date')) continue;
- var elTimestamp = ~~element.getAttribute('data-timestamp') + _offset;
+ var elTimestamp = ~~elData(element, 'timestamp') + _offset;
var elDate = elData(element, 'date');
var elTime = elData(element, 'time');
var elOffset = elData(element, 'offset');
- if (!element.getAttribute('title')) {
+ if (!elAttr(element, 'title')) {
elAttr(element, 'title', Language.get('wcf.date.dateTimeFormat').replace(/%date%/, elDate).replace(/%time%/, elTime));
}
if (_hasMap) return this._dictionary.has(key);
else {
- return (this._dictionary.hasOwnProperty(key) && typeof this._dictionary[key] !== "undefined");
+ return (objOwns(this._dictionary, key) && typeof this._dictionary[key] !== "undefined");
}
},
var result = new Dictionary();
for (var key in object) {
- if (object.hasOwnProperty(key)) {
+ if (objOwns(object, key)) {
result.set(key, object[key]);
}
}
setStyles: function(el, styles) {
var important = false;
for (var property in styles) {
- if (styles.hasOwnProperty(property)) {
+ if (objOwns(styles, property)) {
if (/ !important$/.test(styles[property])) {
important = true;
}
element.appendChild(newScript);
- script.parentNode.removeChild(script);
+ elRemove(script);
}
},
// add language dropdown items
var a, div, h3, img, listItem;
for (var availableLanguageId in languages) {
- if (languages.hasOwnProperty(availableLanguageId)) {
+ if (objOwns(languages, availableLanguageId)) {
var language = languages[availableLanguageId];
listItem = elCreate('li');
// unescape values
var unescapedValues = new Dictionary();
for (var key in values) {
- if (values.hasOwnProperty(key)) {
+ if (objOwns(values, key)) {
unescapedValues.set(~~key, StringUtil.unescapeHTML(values[key]));
}
}
DomUtil.insertAfter(dropdownMenu, button);
var callbackClick = (function(event, isInit) {
- var languageId = ~~event.currentTarget.getAttribute('data-language-id');
+ var languageId = ~~elData(event.currentTarget, 'language-id');
var activeItem = DomTraverse.childByClass(dropdownMenu, 'active');
if (activeItem !== null) activeItem.classList.remove('active');
// build language dropdown
for (var languageId in availableLanguages) {
- if (availableLanguages.hasOwnProperty(languageId)) {
+ if (objOwns(availableLanguages, languageId)) {
var listItem = elCreate('li');
elData(listItem, 'language-id', languageId);
var activeItem = null;
if (forceSelection === true || values.size) {
for (var i = 0, length = dropdownMenu.childElementCount; i < length; i++) {
- if (~~dropdownMenu.children[i].getAttribute('data-language-id') === LANGUAGE_ID) {
+ if (~~dropdownMenu.elData(children[i], 'language-id') === LANGUAGE_ID) {
activeItem = dropdownMenu.children[i];
break;
}
}
var dropdownMenu = UiSimpleDropdown.getDropdownMenu(containerId);
- var elementId = elById(containerId).getAttribute('data-input-id');
+ var elementId = elData(elById(containerId), 'input-id');
var values = _values.get(elementId);
var item, languageId;
for (var i = 0, length = dropdownMenu.childElementCount; i < length; i++) {
item = dropdownMenu.children[i];
- languageId = ~~item.getAttribute('data-language-id');
+ languageId = ~~elData(item, 'language-id');
if (languageId) {
item.classList[(values.has(languageId) || !values.size ? 'remove' : 'add')]('missingValue');
element.isEnabled = false;
// hide language dropdown
- element.buttonLabel.parentNode.style.setProperty('display', 'none');
+ elHide(element.buttonLabel.parentNode);
var dropdownContainer = element.buttonLabel.parentNode.parentNode;
dropdownContainer.classList.remove('inputAddon');
dropdownContainer.classList.remove('dropdown');
element.isEnabled = true;
// show language dropdown
- element.buttonLabel.parentNode.style.removeProperty('display');
+ elShow(element.buttonLabel.parentNode);
var dropdownContainer = element.buttonLabel.parentNode.parentNode;
dropdownContainer.classList.add('inputAddon');
dropdownContainer.classList.add('dropdown');
var hasEmptyValue = false, hasNonEmptyValue = false;
for (var i = 0, length = dropdownMenu.childElementCount; i < length; i++) {
item = dropdownMenu.children[i];
- languageId = ~~item.getAttribute('data-language-id');
+ languageId = ~~elData(item, 'language-id');
if (languageId) {
if (!values.has(languageId) || values.get(languageId).length === 0) {
// store media data locally
var media = data.returnValues.media || { };
for (var mediaId in media) {
- if (media.hasOwnProperty(mediaId)) {
+ if (objOwns(media, mediaId)) {
this._mediaData.set(~~mediaId, media[mediaId]);
}
}
var hasMedia = false;
for (var mediaId in media) {
- if (media.hasOwnProperty(mediaId)) {
+ if (objOwns(media, mediaId)) {
hasMedia = true;
}
}
*/
addObject: function(object) {
for (var key in object) {
- if (object.hasOwnProperty(key)) {
+ if (objOwns(object, key)) {
this.addPermission(key, object[key]);
}
}
top: top + (top !== 'auto' ? 'px' : '')
});
- el.style.removeProperty('display');
+ elShow(el);
el.style.removeProperty('visibility');
},
/**
- * Calculates left/right position and verifys if the element would be still within the page's boundaries.
+ * Calculates left/right position and verifies if the element would be still within the page's boundaries.
*
* @param {string} align align to this side of the reference element
* @param {Object<string, int>} elDimensions element dimensions
if (id && (container = elById(id))) {
((function(button, container) {
container.classList.remove('jsStaticDialogContent');
- container.style.setProperty('display', 'none');
+ elHide(container);
button.addEventListener('click', this.openStatic.bind(this, container.id, null, { title: elData(container, 'title') }));
}).bind(this))(button, container);
}
contentContainer.appendChild(content);
if (content.style.getPropertyValue('display') === 'none') {
- content.style.removeProperty('display');
+ elShow(content);
}
_dialogs.set(id, {
newScript.innerHTML = script.innerHTML;
content.appendChild(newScript);
- script.parentNode.removeChild(script);
+ elRemove(script);
}
data.content.appendChild(content);
elAttr(data.dialog, 'aria-hidden', 'false');
elAttr(_container, 'aria-hidden', 'false');
- elAttr(_container, 'data-close-on-click', (data.backdropCloseOnClick ? 'true' : 'false'));
+ elData(_container, 'close-on-click', (data.backdropCloseOnClick ? 'true' : 'false'));
_activeDialog = id;
this.rebuild(id);
return true;
}
- if (elAttr(_container, 'data-close-on-click') === 'true') {
+ if (elData(_container, 'close-on-click') === 'true') {
this._close(event);
}
else {
if (_activeDialog === null) {
elAttr(_container, 'aria-hidden', 'true');
- elAttr(_container, 'data-close-on-click', 'false');
+ elData(_container, 'close-on-click', 'false');
window.removeEventListener('keyup', _keyupListener);
}
else {
data = _dialogs.get(_activeDialog);
- elAttr(_container, 'data-close-on-click', (data.backdropCloseOnClick ? 'true' : 'false'));
+ elData(_container, 'close-on-click', (data.backdropCloseOnClick ? 'true' : 'false'));
}
},
continue;
}
- item.style.removeProperty('display');
+ elShow(item);
}
if (dropdown.parentNode !== null) {
}
hiddenItems.push(item);
- item.style.setProperty('display', 'none');
+ elHide(item);
if (list.scrollWidth < availableWidth) {
break;
item.addEventListener('click', (function(event) {
event.preventDefault();
- Core.triggerEvent(hiddenItem.querySelector('a'), 'click');
+ Core.triggerEvent(elBySel('a', hiddenItem), 'click');
// force a rebuild to guarantee the active item being visible
setTimeout(function() {
dropdownMenu.appendChild(fragment);
}
else if (dropdown !== undefined && dropdown.parentNode !== null) {
- dropdown.parentNode.removeChild(dropdown);
+ elRemove(dropdown);
}
}
};
element.parentNode.insertBefore(inputElement, element);
inputElement.id = element.id;
- element.parentNode.removeChild(element);
+ elRemove(element);
element = inputElement;
}
}
button.title = title;
button.innerHTML = '<span class="icon icon16 fa-thumbs-o-' + (isLike ? 'up' : 'down') + '" /> <span class="invisible">' + title + '</span>';
button.addEventListener('click', this._like.bind(this, element));
- button.setAttribute('data-type', (isLike ? 'like' : 'dislike'));
+ elData(button, 'type', (isLike ? 'like' : 'dislike'));
listItem.appendChild(button);
_isBusy = true;
Ajax.api(this, {
- actionName: elAttr(event.currentTarget, 'data-type'),
+ actionName: elData(event.currentTarget, 'type'),
parameters: {
data: {
containerID: DomUtil.identify(element),
}
}
else {
- if (visibility.hasOwnProperty(item) && visibility[item] === false) {
+ if (objOwns(visibility, item) && visibility[item] === false) {
elHide(listItem);
}
else {
this._activeElement.classList.add('jsInvalidQuoteTarget');
var icon = DomTraverse.childByClass(elementData.messageBodyEditor, 'icon');
- icon.parentNode.removeChild(icon);
+ elRemove(icon);
var messageBody = elementData.messageBodyEditor;
var editor = elCreate('div');
}
for (var key in data) {
- if (data.hasOwnProperty(key)) {
+ if (objOwns(data, key)) {
this._update(element, key, data[key]);
}
}
return;
}
- // use icons if language item is empty/non-existant
+ // use icons if language item is empty/non-existent
var languageShowSidebar = 'wcf.global.sidebar.show' + sidebarPosition + 'Sidebar';
if (languageShowSidebar === Language.get(languageShowSidebar) || Language.get(languageShowSidebar) === '') {
languageShowSidebar = elCreate('span');
}
if (hasHiddenPages) {
- list.setAttribute('data-pages', this._options.maxPage);
+ elData(list, 'pages', this._options.maxPage);
UiPageJumpTo.init(list, this.switchPage.bind(this));
}
item = item.currentTarget.parentNode;
}
- this._options.callbackSelect(this._element.id, { objectId: item.children[0].getAttribute('data-object-id'), value: item.textContent });
+ this._options.callbackSelect(this._element.id, { objectId: elData(item.children[0], 'object-id'), value: item.textContent });
if (isEvent) {
this._element.focus();
},
/**
- * Performs a search for the input value unless it is below the treshold.
+ * Performs a search for the input value unless it is below the threshold.
*
* @param {object} event event object
*/
}
if (this._isLegacy) {
- elAttr(this._container, 'data-is-legacy', true);
+ elData(this._container, 'is-legacy', true);
this._tabs.forEach(function(tab, name) {
elAttr(tab, 'aria-controls', name);
}
if (!selectTab) {
- var preselect = elAttr(this._container, 'data-preselect');
+ var preselect = elData(this._container, 'preselect');
if (preselect === "true" || !preselect) preselect = true;
if (preselect === true) {
* Removes the button to upload files.
*/
_removeButton: function() {
- this._button.parentNode.removeChild(this._button);
+ elRemove(this._button);
DomChangeListener.trigger();
},
var formData = new FormData();
for (var i = 0, length = files.length; i < length; i++) {
if (this._fileElements[uploadId][i]) {
- var internalFileId = elAttr(this._fileElements[uploadId][i], 'data-internal-file-id');
+ var internalFileId = elData(this._fileElements[uploadId][i], 'internal-file-id');
if (blob) {
formData.append('__files[' + internalFileId + ']', blob, files[i].name);