const container = document.createElement("div");
container.className = "inputAddon";
- clearButton = document.createElement("a");
-
- clearButton.className = "inputSuffix button jsTooltip";
- clearButton.href = "#";
- clearButton.setAttribute("role", "button");
- clearButton.tabIndex = 0;
- clearButton.title = Language.get("wcf.date.datePicker");
- clearButton.setAttribute("aria-label", Language.get("wcf.date.datePicker"));
- clearButton.setAttribute("aria-haspopup", "true");
- clearButton.setAttribute("aria-expanded", "false");
- clearButton.addEventListener("click", open);
- container.appendChild(clearButton);
+ const openButton = document.createElement("a");
+
+ openButton.className = "inputSuffix button jsTooltip";
+ openButton.href = "#";
+ openButton.setAttribute("role", "button");
+ openButton.tabIndex = 0;
+ openButton.title = Language.get("wcf.date.datePicker");
+ openButton.setAttribute("aria-label", Language.get("wcf.date.datePicker"));
+ openButton.setAttribute("aria-haspopup", "true");
+ openButton.setAttribute("aria-expanded", "false");
+ openButton.addEventListener("click", open);
+ container.appendChild(openButton);
let icon = document.createElement("span");
icon.className = "icon icon16 fa-calendar";
- clearButton.appendChild(icon);
+ openButton.appendChild(icon);
element.parentNode!.insertBefore(container, element);
- container.insertBefore(element, clearButton);
+ container.insertBefore(element, openButton);
if (!disableClear) {
- const button = document.createElement("a");
- button.className = "inputSuffix button";
- button.addEventListener("click", () => this.clear(element));
+ clearButton = document.createElement("a");
+ clearButton.className = "inputSuffix button";
+ clearButton.addEventListener("click", () => this.clear(element));
if (isEmpty) {
- button.style.setProperty("visibility", "hidden", "");
+ clearButton.style.setProperty("visibility", "hidden", "");
}
- container.appendChild(button);
+ container.appendChild(clearButton);
icon = document.createElement("span");
icon.className = "icon icon16 fa-times";
- button.appendChild(icon);
+ clearButton.appendChild(icon);
}
}
// create input addon
const container = document.createElement("div");
container.className = "inputAddon";
- clearButton = document.createElement("a");
- clearButton.className = "inputSuffix button jsTooltip";
- clearButton.href = "#";
- clearButton.setAttribute("role", "button");
- clearButton.tabIndex = 0;
- clearButton.title = Language.get("wcf.date.datePicker");
- clearButton.setAttribute("aria-label", Language.get("wcf.date.datePicker"));
- clearButton.setAttribute("aria-haspopup", "true");
- clearButton.setAttribute("aria-expanded", "false");
- clearButton.addEventListener("click", open);
- container.appendChild(clearButton);
+ const openButton = document.createElement("a");
+ openButton.className = "inputSuffix button jsTooltip";
+ openButton.href = "#";
+ openButton.setAttribute("role", "button");
+ openButton.tabIndex = 0;
+ openButton.title = Language.get("wcf.date.datePicker");
+ openButton.setAttribute("aria-label", Language.get("wcf.date.datePicker"));
+ openButton.setAttribute("aria-haspopup", "true");
+ openButton.setAttribute("aria-expanded", "false");
+ openButton.addEventListener("click", open);
+ container.appendChild(openButton);
let icon = document.createElement("span");
icon.className = "icon icon16 fa-calendar";
- clearButton.appendChild(icon);
+ openButton.appendChild(icon);
element.parentNode.insertBefore(container, element);
- container.insertBefore(element, clearButton);
+ container.insertBefore(element, openButton);
if (!disableClear) {
- const button = document.createElement("a");
- button.className = "inputSuffix button";
- button.addEventListener("click", () => this.clear(element));
+ clearButton = document.createElement("a");
+ clearButton.className = "inputSuffix button";
+ clearButton.addEventListener("click", () => this.clear(element));
if (isEmpty) {
- button.style.setProperty("visibility", "hidden", "");
+ clearButton.style.setProperty("visibility", "hidden", "");
}
- container.appendChild(button);
+ container.appendChild(clearButton);
icon = document.createElement("span");
icon.className = "icon icon16 fa-times";
- button.appendChild(icon);
+ clearButton.appendChild(icon);
}
}
// check if the date input has one of the following classes set otherwise default to 'short'