// If the icon only ships in `solid` style then we can safely
// use any other variant too. The `solid` style is therefore
// only enforced when there is a non-solid variant too.
- if ($type === 'solid' && !$hasNonSolidStyle[$newIconName]) {
+ if ($type === 'solid' && $newIconName !== 'caret-down' && !$hasNonSolidStyle[$newIconName]) {
$type = 'regular';
}
let iconBanned = userRow.querySelector(".jsUserStatusBanned") as HTMLElement;
if (banned && iconBanned === null) {
iconBanned = document.createElement("span");
- iconBanned.className = "icon icon16 fa-lock jsUserStatusBanned jsTooltip";
+ iconBanned.innerHTML = '<fa-icon size="16" name="lock"></fa-icon>';
+ iconBanned.classList.add("jsUserStatusBanned", "jsTooltip");
iconBanned.title = Language.get("wcf.user.status.banned");
userStatusIcons.appendChild(iconBanned);
let iconIsDisabled = userRow.querySelector(".jsUserStatusIsDisabled") as HTMLElement;
if (isDisabled && iconIsDisabled === null) {
iconIsDisabled = document.createElement("span");
- iconIsDisabled.className = "icon icon16 fa-power-off jsUserStatusIsDisabled jsTooltip";
+ iconIsDisabled.innerHTML = '<fa-icon size="16" name="power-off"></fa-icon>';
+ iconIsDisabled.classList.add("jsUserStatusIsDisabled", "jsTooltip");
iconIsDisabled.title = Language.get("wcf.user.status.isDisabled");
userStatusIcons.appendChild(iconIsDisabled);
} else if (!isDisabled && iconIsDisabled !== null) {
}
const button = document.createElement("button");
- button.className = "icon icon24 fa-files-o pointer jsTooltip";
- button.setAttribute("title", Language.get("wcf.message.bbcode.code.copy"));
+ button.innerHTML = '<fa-icon size="24" name="files"></fa-icon>';
+ button.classList.add("jsTooltip");
+ button.title = Language.get("wcf.message.bbcode.code.copy");
const clickCallback = async () => {
await Clipboard.copyElementTextToClipboard(this.codeContainer);
UiNotification.show(Language.get("wcf.message.bbcode.code.copy.success"));
};
button.addEventListener("click", () => clickCallback());
-
+
header.appendChild(button);
}
});
container.appendChild(openButton);
- let icon = document.createElement("span");
- icon.className = "icon icon16 fa-calendar";
+ let icon = document.createElement("fa-icon");
+ icon.size = 16;
+ icon.setIcon("calendar");
openButton.appendChild(icon);
element.parentNode!.insertBefore(container, element);
container.appendChild(clearButton);
- icon = document.createElement("span");
- icon.className = "icon icon16 fa-times";
+ icon = document.createElement("fa-icon");
+ icon.size = 16;
+ icon.setIcon("xmark");
clearButton.appendChild(icon);
}
this._suffixField.value = target.dataset.value!;
this._suffixDropdownToggle.innerHTML =
- target.dataset.label! + ' <span class="icon icon16 fa-caret-down pointer"></span>';
+ target.dataset.label! + ' <fa-icon size="16" name="caret-down" solid></fa-icon>';
}
/**
const div = document.createElement("div");
dropdownToggle.appendChild(div);
- const icon = document.createElement("span");
- icon.className = "icon icon24 fa-question pointer";
+ const icon = document.createElement("fa-icon");
+ icon.size = 24;
+ icon.setIcon("question");
div.appendChild(icon);
const span = document.createElement("span");
const space = document.createTextNode(" ");
span.insertBefore(space, span.childNodes[0]);
- const icon = document.createElement("span");
- icon.className = "icon icon16 fa-upload";
+ const icon = document.createElement("fa-icon");
+ icon.size = 16;
+ icon.setIcon("upload");
span.insertBefore(icon, span.childNodes[0]);
}
buttons.appendChild(editButton);
editButton.innerHTML = `
- <a>
- <span class="icon icon16 fa-pencil jsTooltip" title="${Language.get("wcf.global.button.edit")}"></span>
+ <a class="jsTooltip" title="${Language.get("wcf.global.button.edit")}">
+ <fa-icon size="16" name="pencil"></fa-icon>
<span class="invisible">${Language.get("wcf.global.button.edit")}</span>
</a>`;
buttons.appendChild(deleteButton);
deleteButton.innerHTML = `
- <a>
- <span class="icon icon16 fa-times jsTooltip" title="${Language.get("wcf.global.button.delete")}"></span>
+ <a class="jsTooltip" title="${Language.get("wcf.global.button.delete")}">
+ <fa-icon size="16" name="xmark"></fa-icon>
<span class="invisible">${Language.get("wcf.global.button.delete")}</span>
</a>`;
}
buttons.appendChild(listItem);
listItem.innerHTML = `
- <a>
- <span class="icon icon16 fa-plus jsTooltip" title="${Language.get("wcf.global.button.insert")}"></span>
+ <a class="jsTooltip" title="${Language.get("wcf.global.button.insert")}">
+ <fa-icon size="16" name="plus"></fa-icon>
<span class="invisible">${Language.get("wcf.global.button.insert")}</span>
</a>`;
}
removeButton.className = "button";
button.insertAdjacentElement("afterend", removeButton);
- const icon = document.createElement("span");
- icon.className = "icon icon16 fa-times";
+ const icon = document.createElement("fa-icon");
+ icon.size = 16;
+ icon.setIcon("xmark");
removeButton.appendChild(icon);
if (!storeElement.value) {
} else {
let fileIcon = FileUtil.getIconNameByFilename(media.filename);
if (fileIcon) {
- fileIcon = "-" + fileIcon;
+ fileIcon = "file-" + fileIcon;
+ } else {
+ fileIcon="file"
}
displayElement.innerHTML = `
<div class="box48" style="margin-bottom: 10px;">
- <span class="icon icon48 fa-file${fileIcon}-o"></span>
+ <fa-icon size="48" name="${fileIcon}"></fa-icon>
<div class="containerHeadline">
<h3>${media.filename}</h3>
<p>${media.formattedFilesize}</p>
buttons.appendChild(listItem);
listItem.innerHTML =
- '<a><span class="icon icon16 fa-check jsTooltip" title="' +
- Language.get("wcf.media.button.select") +
- '"></span> <span class="invisible">' +
- Language.get("wcf.media.button.select") +
- "</span></a>";
+ `
+ <a class="jsTooltip" title="${Language.get("wcf.media.button.select")}">
+ <fa-icon size="16" name="check"></fa-icon>
+ <span class="invisible">${Language.get("wcf.media.button.select")}</span>
+ </a>
+ `;
}
/**
import Upload from "../Upload";
import * as Core from "../Core";
import * as DomUtil from "../Dom/Util";
-import * as DomTraverse from "../Dom/Traverse";
import * as Language from "../Language";
import User from "../User";
import * as DateUtil from "../Date/Util";
}
const spinner = document.createElement("span");
- spinner.className = "icon icon48 fa-spinner mediaThumbnail";
+ spinner.innerHTML = '<fa-icon size="48" name="spinner"></fa-icon>';
+ spinner.classList.add("mediaThumbnail");
DomUtil.replaceElement(image!, spinner);
}
const thumbnail = document.createElement("div");
- thumbnail.className = "mediaThumbnail";
+ thumbnail.classList.add("mediaThumbnail");
fileElement.appendChild(thumbnail);
- const fileIcon = document.createElement("span");
- fileIcon.className = "icon icon144 fa-spinner";
+ const fileIcon = document.createElement("fa-icon");
+ fileIcon.size = 144;
+ fileIcon.setIcon("spinner");
thumbnail.appendChild(fileIcon);
const mediaInformation = document.createElement("div");
p.remove();
}
} else {
- DomTraverse.childByTag(DomTraverse.childByClass(file, "mediaInformation")!, "PROGRESS")!.remove();
+ file.querySelector(".mediaInformation progress")!.remove();
if (media) {
- const fileIcon = DomTraverse.childByTag(DomTraverse.childByClass(file, "mediaThumbnail")!, "FA-ICON")!;
+ const fileIcon = file.querySelector(".mediaThumbnail fa-icon") as FaIcon;
this._replaceFileIcon(fileIcon, media, 144);
file.classList.add("jsClipboardObject", "mediaFile", "jsObjectActionObject");
};
}
- const fileIcon = DomTraverse.childByTag(DomTraverse.childByClass(file, "mediaThumbnail")!, "FA-ICON")!;
+ const fileIcon = file.querySelector(".mediaThumbnail fa-icon") as FaIcon;
fileIcon.setIcon("xmark");
file.classList.add("uploadFailed", "pointer", "jsTooltip");
file.title = Language.get("wcf.global.button.delete");
file.addEventListener("click", () => file.remove());
- const title = DomTraverse.childByClass(
- DomTraverse.childByClass(file, "mediaInformation")!,
- "mediaTitle",
- ) as HTMLElement;
- title.innerText = Language.get(`wcf.media.upload.error.${error.errorType}`, {
+ const title = file.querySelector(".mediaInformation .mediaTitle") as HTMLElement;
+ title.textContent = Language.get(`wcf.media.upload.error.${error.errorType}`, {
filename: error.filename,
});
}
const editorContainer = this._editorContainer!.querySelector(".editorContainer") as HTMLElement;
DomUtil.hide(editorContainer);
- const icon = document.createElement("span");
- icon.className = "icon icon48 fa-spinner";
+ const icon = document.createElement("fa-icon");
+ icon.size = 48;
+ icon.setIcon("spinner");
this._editorContainer!.appendChild(icon);
}
if (options.closable) {
const closeButton = document.createElement("button");
- closeButton.className = "dialogCloseButton jsTooltip";
+ closeButton.innerHTML = '<fa-icon size="24" name="xmark"></fa-icon>';
+ closeButton.classList.add("dialogCloseButton", "jsTooltip");
closeButton.title = options.closeButtonLabel;
closeButton.setAttribute("aria-label", options.closeButtonLabel);
closeButton.addEventListener("click", () => this._close());
header.appendChild(closeButton);
-
- const span = document.createElement("span");
- span.className = "icon icon24 fa-times";
- closeButton.appendChild(span);
}
// Dialogs are positioned using `left: 50%` as a hack to
size = ~~data.icon.size;
}
- const icon = document.createElement("span");
- icon.className = `icon icon${size} fa-${data.icon.name}`;
+ const icon = document.createElement("fa-icon");
+ icon.size = size as any;
+ icon.setIcon(data.icon.name, data.icon.forceSolid ? true : false);
link.appendChild(icon);
}
callback?: (link: HTMLAnchorElement) => void;
href?: string;
icon?: {
+ forceSolid?: boolean;
name: string;
size?: 16 | 24 | 32 | 48 | 64 | 96 | 144;
};
<dd>
<div class="inputAddon">
<input type="text" class="long" readonly value="${StringUtil.escapeHTML(linkWithoutAccessToken)}">
- <a href="#" class="inputSuffix button jsTooltip feedLinkDialogCopyButton" title="${Language.get(
+ <button class="inputSuffix button jsTooltip feedLinkDialogCopyButton" title="${Language.get(
"wcf.global.rss.copy",
- )}"><span class="icon icon16 fa-files-o pointer"></span></a>
+ )}">
+ <fa-icon size="16" name="files"></fa-icon>
+ </button>
</div>
</dd>
</dl>
<dd>
<div class="inputAddon">
<input type="text" class="long" readonly value="${StringUtil.escapeHTML(linkWithAccessToken)}">
- <a href="#" class="inputSuffix button jsTooltip feedLinkDialogCopyButton" title="${Language.get(
+ <button class="inputSuffix button jsTooltip feedLinkDialogCopyButton" title="${Language.get(
"wcf.global.rss.copy",
- )}"><span class="icon icon16 fa-files-o pointer"></span></a>
+ )}">
+ <fa-icon size="16" name="files"></fa-icon>
+ </a>
</div>
</dd>
</dl>
dropdown.className = "dropdown jsFlexibleMenuDropdown";
const icon = document.createElement("a");
- icon.className = "icon icon16 fa-list";
+ icon.innerHTML = '<fa-icon size="16" name="list"></fa-icon>';
dropdown.appendChild(icon);
dropdownMenu = document.createElement("ul");
listItem.appendChild(content);
if (!data.element.disabled) {
- const button = document.createElement("a");
- button.className = "icon icon16 fa-times";
+ const button = document.createElement("button");
+ button.innerHTML = '<fa-icon size="16" name="xmark"></fa-icon>';
button.addEventListener("click", removeItem);
listItem.appendChild(button);
}
listItem.appendChild(content);
if (forceRemoveIcon || !data.element.disabled) {
- const button = document.createElement("a");
- button.className = "icon icon16 fa-times";
+ const button = document.createElement("button");
+ button.innerHTML = '<fa-icon size="16" name="xmark"></fa-icon>';
button.addEventListener("click", (ev) => removeItem(ev));
listItem.appendChild(button);
}
button.href = "#";
button.title = title;
- const icon = document.createElement("span");
- icon.className = "icon icon16 fa-smile-o";
+ const icon = document.createElement("fa-icon");
+ icon.size = 16;
+ icon.setIcon("smile");
if (reactionTypeID === undefined || reactionTypeID == 0) {
icon.dataset.reactionTypeId = "0";
messageBodyEditor.className = "messageBody editor";
data.messageBodyEditor = messageBodyEditor;
- const icon = document.createElement("span");
- icon.className = "icon icon48 fa-spinner";
+ const icon = document.createElement("fa-icon");
+ icon.size = 48;
+ icon.setIcon("spinner");
messageBodyEditor.appendChild(icon);
data.messageBody.insertAdjacentElement("afterend", messageBodyEditor);
const editorContainer = elementData.messageBodyEditor!.querySelector(".editorContainer") as HTMLElement;
DomUtil.hide(editorContainer);
- const icon = document.createElement("span");
- icon.className = "icon icon48 fa-spinner";
+ const icon = document.createElement("fa-icon");
+ icon.size = 48;
+ icon.setIcon("spinner");
elementData.messageBodyEditor!.appendChild(icon);
}
navigation.parentElement!.classList.add("hasMobileNavigation");
- const button = document.createElement("a");
- button.className = "dropdownLabel";
- const span = document.createElement("span");
- span.className = "icon icon24 fa-ellipsis-v";
- button.appendChild(span);
+ const button = document.createElement("button");
+ button.innerHTML = '<fa-icon size="24" name="ellipsis-vertical"></fa-icon>';
+ button.classList.add("dropdownLabel");
button.addEventListener("click", (event) => {
event.preventDefault();
event.stopPropagation();
button.classList.add("pageMenuMainItemToggle");
button.setAttribute("aria-expanded", "false");
button.setAttribute("aria-controls", menuId);
- button.innerHTML = '<span class="icon icon24 fa-angle-down" aria-hidden="true"></span>';
+ button.innerHTML = '<fa-icon size="24" name="angle-down"></fa-icon>';
let ariaLabel = menuItem.title;
if (menuItem.link) {
interface ItemData {
description?: string;
- image: string;
+ image: string | string[];
link: string;
objectID: number;
title: string;
data.returnValues.forEach((item) => {
let image = item.image;
- if (/^fa-/.test(image)) {
- image = `<span class="icon icon48 ${image} pointer jsTooltip" title="${Language.get(
- "wcf.global.select",
- )}"></span>`;
+ if (Array.isArray(image)) {
+ const [iconName, forceSolid] = image;
+
+ image = `
+ <button class="jsTooltip" title="${Language.get("wcf.global.select")}">
+ <fa-icon size="48" name="${iconName}"${forceSolid ? " solid" : ""}></fa-icon>
+ </button>
+ `;
}
const listItem = document.createElement("li");
<div>
<div class="containerHeadline">
<h3>
- <a href="#">${StringUtil.escapeHTML(item.title)}</a>
+ <button>${StringUtil.escapeHTML(item.title)}</button>
</h3>
${description}
</div>
listItem.className = "skip";
list.appendChild(listItem);
- let iconClassNames = "icon icon24 fa-chevron-left";
+ let icon = document.createElement("fa-icon");
+ icon.size = 24;
+ icon.setIcon("chevron-left");
if (this.activePage > 1) {
const link = document.createElement("a");
- link.className = iconClassNames + " jsTooltip";
+ link.className = "jsTooltip";
link.href = "#";
link.title = Language.get("wcf.global.page.previous");
link.rel = "prev";
+ link.setAttribute("role", "button");
+ link.append(icon);
listItem.appendChild(link);
link.addEventListener("click", (ev) => this.switchPage(this.activePage - 1, ev));
} else {
- listItem.innerHTML = '<span class="' + iconClassNames + '"></span>';
+ listItem.append(icon);
listItem.classList.add("disabled");
}
listItem = document.createElement("li");
listItem.className = "skip";
list.appendChild(listItem);
- iconClassNames = "icon icon24 fa-chevron-right";
+
+ icon = document.createElement("fa-icon");
+ icon.size = 24;
+ icon.setIcon("chevron-right");
if (this.activePage < this.maxPage) {
const link = document.createElement("a");
- link.className = iconClassNames + " jsTooltip";
+ link.classList.add("jsTooltip");
link.href = "#";
link.title = Language.get("wcf.global.page.next");
link.rel = "next";
+ link.setAttribute("role", "button");
+ link.append(icon);
listItem.appendChild(link);
link.addEventListener("click", (ev) => this.switchPage(this.activePage + 1, ev));
} else {
- listItem.innerHTML = '<span class="' + iconClassNames + '"></span>';
+ listItem.append(icon);
listItem.classList.add("disabled");
}
title.textContent = Language.get("wcf.editor.autosave.restored");
container.appendChild(title);
- const buttonKeep = document.createElement("a");
- buttonKeep.className = "jsTooltip";
- buttonKeep.href = "#";
+ const buttonKeep = document.createElement("button");
+ buttonKeep.innerHTML = '<fa-icon size="16" name="check"></fa-icon>';
+ buttonKeep.classList.add("jsTooltip");
buttonKeep.title = Language.get("wcf.editor.autosave.keep");
- buttonKeep.innerHTML = '<span class="icon icon16 fa-check green"></span>';
- buttonKeep.addEventListener("click", (event) => {
- event.preventDefault();
-
- this.hideOverlay();
- });
+ buttonKeep.addEventListener("click", () => this.hideOverlay());
container.appendChild(buttonKeep);
- const buttonDiscard = document.createElement("a");
- buttonDiscard.className = "jsTooltip";
- buttonDiscard.href = "#";
+ const buttonDiscard = document.createElement("button");
+ buttonDiscard.innerHTML = '<fa-icon size="16" name="xmark"></fa-icon>';
+ buttonDiscard.classList.add("jsTooltip");
buttonDiscard.title = Language.get("wcf.editor.autosave.discard");
- buttonDiscard.innerHTML = '<span class="icon icon16 fa-times red"></span>';
- buttonDiscard.addEventListener("click", (event) => {
- event.preventDefault();
-
+ buttonDiscard.addEventListener("click", () => {
// remove from storage
this.clear();
let overlayLeft = menu.querySelector(".tabMenuOverlayLeft");
if (overflowLeft) {
if (overlayLeft === null) {
- overlayLeft = document.createElement("span");
- overlayLeft.className = "tabMenuOverlayLeft icon icon24 fa-angle-left";
+ overlayLeft = document.createElement("button");
+ overlayLeft.innerHTML = '<fa-icon size="24" name="angle-left"></fa-icon>';
+ overlayLeft.className = "tabMenuOverlayLeft";
overlayLeft.addEventListener("click", () => {
const listWidth = list.clientWidth;
scrollMenu(list, list.scrollLeft - ~~(listWidth / 2), list.scrollLeft, list.scrollWidth, listWidth, false);
let overlayRight = menu.querySelector(".tabMenuOverlayRight");
if (overflowRight) {
if (overlayRight === null) {
- overlayRight = document.createElement("span");
- overlayRight.className = "tabMenuOverlayRight icon icon24 fa-angle-right";
+ overlayRight = document.createElement("button");
+ overlayRight.innerHTML = '<fa-icon size="24" name="angle-right"></fa-icon>';
+ overlayRight.className = "tabMenuOverlayRight";
overlayRight.addEventListener("click", () => {
const listWidth = list.clientWidth;
scrollMenu(list, list.scrollLeft + ~~(listWidth / 2), list.scrollLeft, list.scrollWidth, listWidth, false);
let banIcon = contentTitle.querySelector(".jsUserBanned") as HTMLElement;
if (data.actionName === "ban") {
banIcon = document.createElement("span");
- banIcon.className = "icon icon24 fa-lock jsUserBanned jsTooltip";
+ banIcon.innerHTML = '<fa-icon size="24" name="lock"></fa-icon>';
+ banIcon.classList.add("jsUserBanned", "jsTooltip");
banIcon.title = data.returnValues;
contentTitle.appendChild(banIcon);
} else if (banIcon) {
</div>
<div class="userMenuItemMeta"></div>
<div class="userMenuItemUnread">
- <button class="userMenuItemMarkAsRead">
- <span class="icon icon24 fa-check jsTooltip" title="${Language.get("wcf.global.button.markAsRead")}"></span>
+ <button class="userMenuItemMarkAsRead jsTooltip" title="${Language.get("wcf.global.button.markAsRead")}">
+ <fa-icon size="24" name="check"></fa-icon>
</button>
</div>
`;
let iconBanned = userRow.querySelector(".jsUserStatusBanned");
if (banned && iconBanned === null) {
iconBanned = document.createElement("span");
- iconBanned.className = "icon icon16 fa-lock jsUserStatusBanned jsTooltip";
+ iconBanned.innerHTML = '<fa-icon size="16" name="lock"></fa-icon>';
+ iconBanned.classList.add("jsUserStatusBanned", "jsTooltip");
iconBanned.title = Language.get("wcf.user.status.banned");
userStatusIcons.appendChild(iconBanned);
}
let iconIsDisabled = userRow.querySelector(".jsUserStatusIsDisabled");
if (isDisabled && iconIsDisabled === null) {
iconIsDisabled = document.createElement("span");
- iconIsDisabled.className = "icon icon16 fa-power-off jsUserStatusIsDisabled jsTooltip";
+ iconIsDisabled.innerHTML = '<fa-icon size="16" name="power-off"></fa-icon>';
+ iconIsDisabled.classList.add("jsUserStatusIsDisabled", "jsTooltip");
iconIsDisabled.title = Language.get("wcf.user.status.isDisabled");
userStatusIcons.appendChild(iconIsDisabled);
}
return;
}
const button = document.createElement("button");
- button.className = "icon icon24 fa-files-o pointer jsTooltip";
- button.setAttribute("title", Language.get("wcf.message.bbcode.code.copy"));
+ button.innerHTML = '<fa-icon size="24" name="files"></fa-icon>';
+ button.classList.add("jsTooltip");
+ button.title = Language.get("wcf.message.bbcode.code.copy");
const clickCallback = async () => {
await Clipboard.copyElementTextToClipboard(this.codeContainer);
UiNotification.show(Language.get("wcf.message.bbcode.code.copy.success"));
}
});
container.appendChild(openButton);
- let icon = document.createElement("span");
- icon.className = "icon icon16 fa-calendar";
+ let icon = document.createElement("fa-icon");
+ icon.size = 16;
+ icon.setIcon("calendar");
openButton.appendChild(icon);
element.parentNode.insertBefore(container, element);
container.insertBefore(element, openButton);
clearButton.style.setProperty("visibility", "hidden", "");
}
container.appendChild(clearButton);
- icon = document.createElement("span");
- icon.className = "icon icon16 fa-times";
+ icon = document.createElement("fa-icon");
+ icon.size = 16;
+ icon.setIcon("xmark");
clearButton.appendChild(icon);
}
// check if the date input has one of the following classes set otherwise default to 'short'
});
this._suffixField.value = target.dataset.value;
this._suffixDropdownToggle.innerHTML =
- target.dataset.label + ' <span class="icon icon16 fa-caret-down pointer"></span>';
+ target.dataset.label + ' <fa-icon size="16" name="caret-down" solid></fa-icon>';
}
/**
* Destroys the suffix dropdown if the parent form is unregistered.
dropdownToggle.innerHTML = "";
const div = document.createElement("div");
dropdownToggle.appendChild(div);
- const icon = document.createElement("span");
- icon.className = "icon icon24 fa-question pointer";
+ const icon = document.createElement("fa-icon");
+ icon.size = 24;
+ icon.setIcon("question");
div.appendChild(icon);
const span = document.createElement("span");
span.textContent = Language.get("wcf.global.language.noSelection");
const span = this._button.querySelector("span");
const space = document.createTextNode(" ");
span.insertBefore(space, span.childNodes[0]);
- const icon = document.createElement("span");
- icon.className = "icon icon16 fa-upload";
+ const icon = document.createElement("fa-icon");
+ icon.size = 16;
+ icon.setIcon("upload");
span.insertBefore(icon, span.childNodes[0]);
}
_getParameters() {
editButton.dataset.objectId = media.mediaID.toString();
buttons.appendChild(editButton);
editButton.innerHTML = `
- <a>
- <span class="icon icon16 fa-pencil jsTooltip" title="${Language.get("wcf.global.button.edit")}"></span>
+ <a class="jsTooltip" title="${Language.get("wcf.global.button.edit")}">
+ <fa-icon size="16" name="pencil"></fa-icon>
<span class="invisible">${Language.get("wcf.global.button.edit")}</span>
</a>`;
const deleteButton = document.createElement("li");
})).replace(uuid, StringUtil.escapeHTML(media.filename));
buttons.appendChild(deleteButton);
deleteButton.innerHTML = `
- <a>
- <span class="icon icon16 fa-times jsTooltip" title="${Language.get("wcf.global.button.delete")}"></span>
+ <a class="jsTooltip" title="${Language.get("wcf.global.button.delete")}">
+ <fa-icon size="16" name="xmark"></fa-icon>
<span class="invisible">${Language.get("wcf.global.button.delete")}</span>
</a>`;
}
listItem.dataset.objectId = media.mediaID.toString();
buttons.appendChild(listItem);
listItem.innerHTML = `
- <a>
- <span class="icon icon16 fa-plus jsTooltip" title="${Language.get("wcf.global.button.insert")}"></span>
+ <a class="jsTooltip" title="${Language.get("wcf.global.button.insert")}">
+ <fa-icon size="16" name="plus"></fa-icon>
<span class="invisible">${Language.get("wcf.global.button.insert")}</span>
</a>`;
}
const removeButton = document.createElement("p");
removeButton.className = "button";
button.insertAdjacentElement("afterend", removeButton);
- const icon = document.createElement("span");
- icon.className = "icon icon16 fa-times";
+ const icon = document.createElement("fa-icon");
+ icon.size = 16;
+ icon.setIcon("xmark");
removeButton.appendChild(icon);
if (!storeElement.value) {
Util_1.default.hide(removeButton);
else {
let fileIcon = FileUtil.getIconNameByFilename(media.filename);
if (fileIcon) {
- fileIcon = "-" + fileIcon;
+ fileIcon = "file-" + fileIcon;
+ }
+ else {
+ fileIcon = "file";
}
displayElement.innerHTML = `
<div class="box48" style="margin-bottom: 10px;">
- <span class="icon icon48 fa-file${fileIcon}-o"></span>
+ <fa-icon size="48" name="${fileIcon}"></fa-icon>
<div class="containerHeadline">
<h3>${media.filename}</h3>
<p>${media.formattedFilesize}</p>
listItem.dataset.objectId = media.mediaID.toString();
buttons.appendChild(listItem);
listItem.innerHTML =
- '<a><span class="icon icon16 fa-check jsTooltip" title="' +
- Language.get("wcf.media.button.select") +
- '"></span> <span class="invisible">' +
- Language.get("wcf.media.button.select") +
- "</span></a>";
+ `
+ <a class="jsTooltip" title="${Language.get("wcf.media.button.select")}">
+ <fa-icon size="16" name="check"></fa-icon>
+ <span class="invisible">${Language.get("wcf.media.button.select")}</span>
+ </a>
+ `;
}
/**
* Handles clicking on the remove button.
* @module WoltLabSuite/Core/Media/Upload
* @woltlabExcludeBundle tiny
*/
-define(["require", "exports", "tslib", "../Upload", "../Core", "../Dom/Util", "../Dom/Traverse", "../Language", "../User", "../Date/Util", "../FileUtil", "../Dom/Change/Listener", "../Event/Handler"], function (require, exports, tslib_1, Upload_1, Core, DomUtil, DomTraverse, Language, User_1, DateUtil, FileUtil, DomChangeListener, EventHandler) {
+define(["require", "exports", "tslib", "../Upload", "../Core", "../Dom/Util", "../Language", "../User", "../Date/Util", "../FileUtil", "../Dom/Change/Listener", "../Event/Handler"], function (require, exports, tslib_1, Upload_1, Core, DomUtil, Language, User_1, DateUtil, FileUtil, DomChangeListener, EventHandler) {
"use strict";
Upload_1 = tslib_1.__importDefault(Upload_1);
Core = tslib_1.__importStar(Core);
DomUtil = tslib_1.__importStar(DomUtil);
- DomTraverse = tslib_1.__importStar(DomTraverse);
Language = tslib_1.__importStar(Language);
User_1 = tslib_1.__importDefault(User_1);
DateUtil = tslib_1.__importStar(DateUtil);
image = cell.querySelector(".icon48");
}
const spinner = document.createElement("span");
- spinner.className = "icon icon48 fa-spinner mediaThumbnail";
+ spinner.innerHTML = '<fa-icon size="48" name="spinner"></fa-icon>';
+ spinner.classList.add("mediaThumbnail");
DomUtil.replaceElement(image, spinner);
// replace title and uploading user
const ps = cell.querySelectorAll(".box48 > div > p");
fileElement = document.createElement("p");
}
const thumbnail = document.createElement("div");
- thumbnail.className = "mediaThumbnail";
+ thumbnail.classList.add("mediaThumbnail");
fileElement.appendChild(thumbnail);
- const fileIcon = document.createElement("span");
- fileIcon.className = "icon icon144 fa-spinner";
+ const fileIcon = document.createElement("fa-icon");
+ fileIcon.size = 144;
+ fileIcon.setIcon("spinner");
thumbnail.appendChild(fileIcon);
const mediaInformation = document.createElement("div");
mediaInformation.className = "mediaInformation";
}
}
else {
- DomTraverse.childByTag(DomTraverse.childByClass(file, "mediaInformation"), "PROGRESS").remove();
+ file.querySelector(".mediaInformation progress").remove();
if (media) {
- const fileIcon = DomTraverse.childByTag(DomTraverse.childByClass(file, "mediaThumbnail"), "FA-ICON");
+ const fileIcon = file.querySelector(".mediaThumbnail fa-icon");
this._replaceFileIcon(fileIcon, media, 144);
file.classList.add("jsClipboardObject", "mediaFile", "jsObjectActionObject");
file.dataset.objectId = media.mediaID.toString();
filename: file.dataset.filename,
};
}
- const fileIcon = DomTraverse.childByTag(DomTraverse.childByClass(file, "mediaThumbnail"), "FA-ICON");
+ const fileIcon = file.querySelector(".mediaThumbnail fa-icon");
fileIcon.setIcon("xmark");
file.classList.add("uploadFailed", "pointer", "jsTooltip");
file.title = Language.get("wcf.global.button.delete");
file.addEventListener("click", () => file.remove());
- const title = DomTraverse.childByClass(DomTraverse.childByClass(file, "mediaInformation"), "mediaTitle");
- title.innerText = Language.get(`wcf.media.upload.error.${error.errorType}`, {
+ const title = file.querySelector(".mediaInformation .mediaTitle");
+ title.textContent = Language.get(`wcf.media.upload.error.${error.errorType}`, {
filename: error.filename,
});
}
_hideEditor() {
const editorContainer = this._editorContainer.querySelector(".editorContainer");
Util_1.default.hide(editorContainer);
- const icon = document.createElement("span");
- icon.className = "icon icon48 fa-spinner";
+ const icon = document.createElement("fa-icon");
+ icon.size = 48;
+ icon.setIcon("spinner");
this._editorContainer.appendChild(icon);
}
/**
header.appendChild(title);
if (options.closable) {
const closeButton = document.createElement("button");
- closeButton.className = "dialogCloseButton jsTooltip";
+ closeButton.innerHTML = '<fa-icon size="24" name="xmark"></fa-icon>';
+ closeButton.classList.add("dialogCloseButton", "jsTooltip");
closeButton.title = options.closeButtonLabel;
closeButton.setAttribute("aria-label", options.closeButtonLabel);
closeButton.addEventListener("click", () => this._close());
header.appendChild(closeButton);
- const span = document.createElement("span");
- span.className = "icon icon24 fa-times";
- closeButton.appendChild(span);
}
// Dialogs are positioned using `left: 50%` as a hack to
// force long softwrapping of text without causing other
if (typeof data.icon.size === "number" && _validIconSizes.indexOf(~~data.icon.size) !== -1) {
size = ~~data.icon.size;
}
- const icon = document.createElement("span");
- icon.className = `icon icon${size} fa-${data.icon.name}`;
+ const icon = document.createElement("fa-icon");
+ icon.size = size;
+ icon.setIcon(data.icon.name, data.icon.forceSolid ? true : false);
link.appendChild(icon);
}
const label = typeof data.label === "string" ? data.label.trim() : "";
<dd>
<div class="inputAddon">
<input type="text" class="long" readonly value="${StringUtil.escapeHTML(linkWithoutAccessToken)}">
- <a href="#" class="inputSuffix button jsTooltip feedLinkDialogCopyButton" title="${Language.get("wcf.global.rss.copy")}"><span class="icon icon16 fa-files-o pointer"></span></a>
+ <button class="inputSuffix button jsTooltip feedLinkDialogCopyButton" title="${Language.get("wcf.global.rss.copy")}">
+ <fa-icon size="16" name="files"></fa-icon>
+ </button>
</div>
</dd>
</dl>
<dd>
<div class="inputAddon">
<input type="text" class="long" readonly value="${StringUtil.escapeHTML(linkWithAccessToken)}">
- <a href="#" class="inputSuffix button jsTooltip feedLinkDialogCopyButton" title="${Language.get("wcf.global.rss.copy")}"><span class="icon icon16 fa-files-o pointer"></span></a>
+ <button class="inputSuffix button jsTooltip feedLinkDialogCopyButton" title="${Language.get("wcf.global.rss.copy")}">
+ <fa-icon size="16" name="files"></fa-icon>
+ </a>
</div>
</dd>
</dl>
dropdown = document.createElement("li");
dropdown.className = "dropdown jsFlexibleMenuDropdown";
const icon = document.createElement("a");
- icon.className = "icon icon16 fa-list";
+ icon.innerHTML = '<fa-icon size="16" name="list"></fa-icon>';
dropdown.appendChild(icon);
dropdownMenu = document.createElement("ul");
dropdownMenu.classList.add("dropdownMenu");
content.textContent = value.value;
listItem.appendChild(content);
if (!data.element.disabled) {
- const button = document.createElement("a");
- button.className = "icon icon16 fa-times";
+ const button = document.createElement("button");
+ button.innerHTML = '<fa-icon size="16" name="xmark"></fa-icon>';
button.addEventListener("click", removeItem);
listItem.appendChild(button);
}
content.textContent = value.value;
listItem.appendChild(content);
if (forceRemoveIcon || !data.element.disabled) {
- const button = document.createElement("a");
- button.className = "icon icon16 fa-times";
+ const button = document.createElement("button");
+ button.innerHTML = '<fa-icon size="16" name="xmark"></fa-icon>';
button.addEventListener("click", (ev) => removeItem(ev));
listItem.appendChild(button);
}
}
button.href = "#";
button.title = title;
- const icon = document.createElement("span");
- icon.className = "icon icon16 fa-smile-o";
+ const icon = document.createElement("fa-icon");
+ icon.size = 16;
+ icon.setIcon("smile");
if (reactionTypeID === undefined || reactionTypeID == 0) {
icon.dataset.reactionTypeId = "0";
}
const messageBodyEditor = document.createElement("div");
messageBodyEditor.className = "messageBody editor";
data.messageBodyEditor = messageBodyEditor;
- const icon = document.createElement("span");
- icon.className = "icon icon48 fa-spinner";
+ const icon = document.createElement("fa-icon");
+ icon.size = 48;
+ icon.setIcon("spinner");
messageBodyEditor.appendChild(icon);
data.messageBody.insertAdjacentElement("afterend", messageBodyEditor);
Util_1.default.hide(data.messageBody);
const elementData = this._elements.get(this._activeElement);
const editorContainer = elementData.messageBodyEditor.querySelector(".editorContainer");
Util_1.default.hide(editorContainer);
- const icon = document.createElement("span");
- icon.className = "icon icon48 fa-spinner";
+ const icon = document.createElement("fa-icon");
+ icon.size = 48;
+ icon.setIcon("spinner");
elementData.messageBodyEditor.appendChild(icon);
}
/**
return;
}
navigation.parentElement.classList.add("hasMobileNavigation");
- const button = document.createElement("a");
- button.className = "dropdownLabel";
- const span = document.createElement("span");
- span.className = "icon icon24 fa-ellipsis-v";
- button.appendChild(span);
+ const button = document.createElement("button");
+ button.innerHTML = '<fa-icon size="24" name="ellipsis-vertical"></fa-icon>';
+ button.classList.add("dropdownLabel");
button.addEventListener("click", (event) => {
event.preventDefault();
event.stopPropagation();
button.classList.add("pageMenuMainItemToggle");
button.setAttribute("aria-expanded", "false");
button.setAttribute("aria-controls", menuId);
- button.innerHTML = '<span class="icon icon24 fa-angle-down" aria-hidden="true"></span>';
+ button.innerHTML = '<fa-icon size="24" name="angle-down"></fa-icon>';
let ariaLabel = menuItem.title;
if (menuItem.link) {
ariaLabel = Language.get("wcf.menu.page.button.toggle", { title: menuItem.title });
}
data.returnValues.forEach((item) => {
let image = item.image;
- if (/^fa-/.test(image)) {
- image = `<span class="icon icon48 ${image} pointer jsTooltip" title="${Language.get("wcf.global.select")}"></span>`;
+ if (Array.isArray(image)) {
+ const [iconName, forceSolid] = image;
+ image = `
+ <button class="jsTooltip" title="${Language.get("wcf.global.select")}">
+ <fa-icon size="48" name="${iconName}"${forceSolid ? " solid" : ""}></fa-icon>
+ </button>
+ `;
}
const listItem = document.createElement("li");
listItem.dataset.objectId = item.objectID.toString();
<div>
<div class="containerHeadline">
<h3>
- <a href="#">${StringUtil.escapeHTML(item.title)}</a>
+ <button>${StringUtil.escapeHTML(item.title)}</button>
</h3>
${description}
</div>
let listItem = document.createElement("li");
listItem.className = "skip";
list.appendChild(listItem);
- let iconClassNames = "icon icon24 fa-chevron-left";
+ let icon = document.createElement("fa-icon");
+ icon.size = 24;
+ icon.setIcon("chevron-left");
if (this.activePage > 1) {
const link = document.createElement("a");
- link.className = iconClassNames + " jsTooltip";
+ link.className = "jsTooltip";
link.href = "#";
link.title = Language.get("wcf.global.page.previous");
link.rel = "prev";
+ link.setAttribute("role", "button");
+ link.append(icon);
listItem.appendChild(link);
link.addEventListener("click", (ev) => this.switchPage(this.activePage - 1, ev));
}
else {
- listItem.innerHTML = '<span class="' + iconClassNames + '"></span>';
+ listItem.append(icon);
listItem.classList.add("disabled");
}
// add first page
listItem = document.createElement("li");
listItem.className = "skip";
list.appendChild(listItem);
- iconClassNames = "icon icon24 fa-chevron-right";
+ icon = document.createElement("fa-icon");
+ icon.size = 24;
+ icon.setIcon("chevron-right");
if (this.activePage < this.maxPage) {
const link = document.createElement("a");
- link.className = iconClassNames + " jsTooltip";
+ link.classList.add("jsTooltip");
link.href = "#";
link.title = Language.get("wcf.global.page.next");
link.rel = "next";
+ link.setAttribute("role", "button");
+ link.append(icon);
listItem.appendChild(link);
link.addEventListener("click", (ev) => this.switchPage(this.activePage + 1, ev));
}
else {
- listItem.innerHTML = '<span class="' + iconClassNames + '"></span>';
+ listItem.append(icon);
listItem.classList.add("disabled");
}
if (hasHiddenPages) {
const title = document.createElement("span");
title.textContent = Language.get("wcf.editor.autosave.restored");
container.appendChild(title);
- const buttonKeep = document.createElement("a");
- buttonKeep.className = "jsTooltip";
- buttonKeep.href = "#";
+ const buttonKeep = document.createElement("button");
+ buttonKeep.innerHTML = '<fa-icon size="16" name="check"></fa-icon>';
+ buttonKeep.classList.add("jsTooltip");
buttonKeep.title = Language.get("wcf.editor.autosave.keep");
- buttonKeep.innerHTML = '<span class="icon icon16 fa-check green"></span>';
- buttonKeep.addEventListener("click", (event) => {
- event.preventDefault();
- this.hideOverlay();
- });
+ buttonKeep.addEventListener("click", () => this.hideOverlay());
container.appendChild(buttonKeep);
- const buttonDiscard = document.createElement("a");
- buttonDiscard.className = "jsTooltip";
- buttonDiscard.href = "#";
+ const buttonDiscard = document.createElement("button");
+ buttonDiscard.innerHTML = '<fa-icon size="16" name="xmark"></fa-icon>';
+ buttonDiscard.classList.add("jsTooltip");
buttonDiscard.title = Language.get("wcf.editor.autosave.discard");
- buttonDiscard.innerHTML = '<span class="icon icon16 fa-times red"></span>';
- buttonDiscard.addEventListener("click", (event) => {
- event.preventDefault();
+ buttonDiscard.addEventListener("click", () => {
// remove from storage
this.clear();
// set code
let overlayLeft = menu.querySelector(".tabMenuOverlayLeft");
if (overflowLeft) {
if (overlayLeft === null) {
- overlayLeft = document.createElement("span");
- overlayLeft.className = "tabMenuOverlayLeft icon icon24 fa-angle-left";
+ overlayLeft = document.createElement("button");
+ overlayLeft.innerHTML = '<fa-icon size="24" name="angle-left"></fa-icon>';
+ overlayLeft.className = "tabMenuOverlayLeft";
overlayLeft.addEventListener("click", () => {
const listWidth = list.clientWidth;
scrollMenu(list, list.scrollLeft - ~~(listWidth / 2), list.scrollLeft, list.scrollWidth, listWidth, false);
let overlayRight = menu.querySelector(".tabMenuOverlayRight");
if (overflowRight) {
if (overlayRight === null) {
- overlayRight = document.createElement("span");
- overlayRight.className = "tabMenuOverlayRight icon icon24 fa-angle-right";
+ overlayRight = document.createElement("button");
+ overlayRight.innerHTML = '<fa-icon size="24" name="angle-right"></fa-icon>';
+ overlayRight.className = "tabMenuOverlayRight";
overlayRight.addEventListener("click", () => {
const listWidth = list.clientWidth;
scrollMenu(list, list.scrollLeft + ~~(listWidth / 2), list.scrollLeft, list.scrollWidth, listWidth, false);
let banIcon = contentTitle.querySelector(".jsUserBanned");
if (data.actionName === "ban") {
banIcon = document.createElement("span");
- banIcon.className = "icon icon24 fa-lock jsUserBanned jsTooltip";
+ banIcon.innerHTML = '<fa-icon size="24" name="lock"></fa-icon>';
+ banIcon.classList.add("jsUserBanned", "jsTooltip");
banIcon.title = data.returnValues;
contentTitle.appendChild(banIcon);
}
</div>
<div class="userMenuItemMeta"></div>
<div class="userMenuItemUnread">
- <button class="userMenuItemMarkAsRead">
- <span class="icon icon24 fa-check jsTooltip" title="${Language.get("wcf.global.button.markAsRead")}"></span>
+ <button class="userMenuItemMarkAsRead jsTooltip" title="${Language.get("wcf.global.button.markAsRead")}">
+ <fa-icon size="24" name="check"></fa-icon>
</button>
</div>
`;
*/
public function getSearchResultList()
{
- /** @noinspection PhpUndefinedMethodInspection */
- return $this->pageEditor->getHandler()->lookup($this->parameters['data']['searchString']);
+ $pageHandler = $this->pageEditor->getHandler();
+
+ \assert($pageHandler instanceof ILookupPageHandler);
+
+ return $pageHandler->lookup($this->parameters['data']['searchString']);
}
/**
$results[] = [
'description' => $description,
- 'image' => 'fa-folder-open-o',
+ 'image' => ['folder', false],
'link' => $category->getLink(),
'objectID' => $categoryID,
'title' => $category->getTitle(),