--- /dev/null
+trailingComma: all
callbackObject: AjaxCallbackObject,
data?: RequestData,
success?: CallbackSuccess,
- failure?: CallbackFailure
+ failure?: CallbackFailure,
): AjaxRequest {
if (typeof data !== "object") data = {};
data: ResponseData,
responseText: string,
xhr: XMLHttpRequest,
- requestData: RequestData
+ requestData: RequestData,
) => boolean;
export type CallbackFinalize = (xhr: XMLHttpRequest) => void;
export type CallbackProgress = (event: ProgressEvent) => void;
data: ResponseData | DatabaseObjectActionResponse,
responseText: string,
xhr: XMLHttpRequest,
- requestData: RequestData
+ requestData: RequestData,
) => void;
export type CallbackUploadProgress = (event: ProgressEvent) => void;
export type CallbackSetup = () => RequestOptions;
url: string,
success: (...args: unknown[]) => void,
failure: () => void,
- options?: JsonpOptions
+ options?: JsonpOptions,
): void {
url = typeof (url as any) === "string" ? url.trim() : "";
if (url.length === 0) {
parameterName: "callback",
timeout: 10,
},
- options || {}
+ options || {},
) as JsonpOptions;
const callbackName = "wcf_jsonp_" + Core.getUuid().replace(/-/g, "").substr(0, 8);
callbackObject: null,
},
- options
+ options,
);
if (typeof options.callbackObject === "object") {
}
if (typeof this._options.callbackObject._ajaxUploadProgress === "function") {
this._options.uploadProgress = this._options.callbackObject._ajaxUploadProgress.bind(
- this._options.callbackObject
+ this._options.callbackObject,
);
}
}
writable: true,
},
}),
- propertiesObject || {}
+ propertiesObject || {},
);
}
waitMilliseconds = 50,
options: DebounceOptions = {
isImmediate: false,
- }
+ },
): (this: ThisParameterType<F>, ...args: Parameters<F>) => void {
let timeoutId: ReturnType<typeof setTimeout> | undefined;
if (document.getElementById(value) === null) {
throw new Error(
- "Reference date picker identified by '" + value + "' does not exists (element id: '" + element.id + "')."
+ "Reference date picker identified by '" + value + "' does not exists (element id: '" + element.id + "').",
);
}
} else if (/^\d{4}-\d{2}-\d{2}T/.test(value)) {
// check if current selection exceeds min/max date
let date = new Date(
- year.toString() + "-" + ("0" + (month + 1).toString()).slice(-2) + "-" + ("0" + day.toString()).slice(-2)
+ year.toString() + "-" + ("0" + (month + 1).toString()).slice(-2) + "-" + ("0" + day.toString()).slice(-2),
);
if (date < _minDate) {
year = _minDate.getFullYear();
+_dateGrid.dataset.month!,
+_dateGrid.dataset.day!,
+_dateHour.value,
- +_dateMinute.value
+ +_dateMinute.value,
);
} else {
date = new Date(+_dateGrid.dataset.year!, +_dateGrid.dataset.month!, +_dateGrid.dataset.day!);
const now = new Date();
document
.querySelectorAll<HTMLInputElement>(
- 'input[type="date"]:not(.inputDatePicker), input[type="datetime"]:not(.inputDatePicker)'
+ 'input[type="date"]:not(.inputDatePicker), input[type="datetime"]:not(.inputDatePicker)',
)
.forEach((element) => {
element.classList.add("inputDatePicker");
date.getUTCDay(),
date.getUTCHours(),
date.getUTCMinutes(),
- date.getUTCSeconds()
- ) / 1000
+ date.getUTCSeconds(),
+ ) / 1000,
);
}
window.console.log(
"%c\tEditor autosave " + (_settings.editorAutosave ? "enabled" : "disabled"),
- "font-style: italic"
+ "font-style: italic",
);
},
element: Element,
prefix?: string,
camelCaseName?: boolean,
- idToUpperCase?: boolean
+ idToUpperCase?: boolean,
): DataAttributes {
prefix = prefix || "";
if (prefix.indexOf("data-") !== 0) {
errorMessage = "";
} else {
throw new TypeError(
- "The error message must be a string; `false`, `null` or `undefined` can be used as a substitute for an empty string."
+ "The error message must be a string; `false`, `null` or `undefined` can be used as a substitute for an empty string.",
);
}
}
doc: "word",
docx: "word",
odt: "word",
- })
+ }),
);
const _mimeTypeExtensionMapping = new Map<string, string>(
"application/msword": "doc",
"application/vnd.openxmlformats-officedocument.wordprocessingml.document": "docx",
"application/vnd.oasis.opendocument.text": "odt",
- })
+ }),
);
/**
data: CanvasPlusExif,
fileName: string,
fileType: string = this.fileType,
- quality: number = this.quality
+ quality: number = this.quality,
): Promise<File> {
const basename = /(.+)(\..+?)$/.exec(fileName);
maxHeight: number = this.maxHeight,
quality: number = this.quality,
force = false,
- cancelPromise?: Promise<unknown>
+ cancelPromise?: Promise<unknown>,
): Promise<HTMLCanvasElement | undefined> {
const canvas = document.createElement("canvas");
} catch (e) {
_languageItems.set(
key,
- new Template("{literal}" + value.replace(/{\/literal}/g, "{/literal}{ldelim}/literal}{literal}") + "{/literal}")
+ new Template(
+ "{literal}" + value.replace(/{\/literal}/g, "{/literal}{ldelim}/literal}{literal}") + "{/literal}",
+ ),
);
}
value = _languageItems.get(key);
return String(number).replace(
/(^-?\d{1,3}|\d{3})(?=(?:\d{3})+(?:$|\.))/g,
- "$1" + Language.get("wcf.global.thousandsSeparator")
+ "$1" + Language.get("wcf.global.thousandsSeparator"),
);
}
undefined,
StringUtil,
Language,
- I18nPlural
+ I18nPlural,
);
} catch (e) {
console.debug(e.message);
includeUserGroups: true,
excludedSearchValues: excludedSearchValues,
preventSubmit: true,
- }
+ },
);
this.aclListContainer = document.getElementById(this.prefix + "aclListContainer")!;
refDimensions: ElementDimensions,
refOffsets: ElementOffset,
windowHeight: number,
- verticalOffset: number
+ verticalOffset: number,
): VerticalResult {
let bottom: Offset = "auto";
let top: Offset = "auto";
elDimensions: ElementDimensions,
refDimensions: ElementDimensions,
refOffsets: ElementOffset,
- windowWidth: number
+ windowWidth: number,
): HorizontalResult {
let left: Offset = "auto";
let right: Offset = "auto";
// allow flipping over axis, possible values: both, horizontal, vertical and none
allowFlip: "both",
},
- options || {}
+ options || {},
) as AlignmentOptions;
if (!Array.isArray(options.pointerClassNames) || options.pointerClassNames.length !== (options.pointer ? 1 : 2)) {
const elDimensions = DomUtil.outerDimensions(element);
const refDimensions = DomUtil.outerDimensions(
- options.refDimensionsElement instanceof HTMLElement ? options.refDimensionsElement : referenceElement
+ options.refDimensionsElement instanceof HTMLElement ? options.refDimensionsElement : referenceElement,
);
const refOffsets = DomUtil.offset(referenceElement);
const windowHeight = window.innerHeight;
elDimensions,
refDimensions,
refOffsets,
- windowWidth
+ windowWidth,
);
// only use these results if it fits into the boundaries, otherwise both directions exceed and we honor the demanded direction
if (horizontalFlipped.result) {
refDimensions,
refOffsets,
windowHeight,
- options.verticalOffset!
+ options.verticalOffset!,
);
if (!vertical.result && (options.allowFlip === "both" || options.allowFlip === "vertical")) {
const verticalFlipped = tryAlignmentVertical(
refDimensions,
refOffsets,
windowHeight,
- options.verticalOffset!
+ options.verticalOffset!,
);
// only use these results if it fits into the boundaries, otherwise both directions exceed and we honor the demanded direction
if (verticalFlipped.result) {
parameters: {},
template: "",
},
- options
+ options,
) as ConfirmationOptions;
options.message = typeof (options.message as any) === "string" ? options.message.trim() : "";
if (!options.message) {
event.preventDefault();
}
},
- { passive: false }
+ { passive: false },
);
document.getElementById("content")!.appendChild(_container);
throw new Error(
"Element id '" +
id +
- "' is invalid and no source attribute was given. If you want to use the `html` argument instead, please add `source: null` to your dialog configuration."
+ "' is invalid and no source attribute was given. If you want to use the `html` argument instead, please add `source: null` to your dialog configuration.",
);
}
onClose: null,
onShow: null,
},
- options || {}
+ options || {},
) as InternalDialogOptions;
if (!options.closable) options.backdropCloseOnClick = false;
if (typeof value !== "function" && value !== null) {
throw new Error(
- "Only functions or the 'null' value are acceptable callback values ('" + typeof value + "' given)."
+ "Only functions or the 'null' value are acceptable callback values ('" + typeof value + "' given).",
);
}
event.preventDefault();
}
},
- { passive: false }
+ { passive: false },
);
let content: HTMLElement;
const inputFields = data.content.querySelectorAll<HTMLInputElement>('input[data-dialog-submit-on-enter="true"]');
const submitButton = data.content.querySelector(
- '.formSubmit > input[type="submit"], .formSubmit > button[data-type="submit"]'
+ '.formSubmit > input[type="submit"], .formSubmit > button[data-type="submit"]',
);
if (submitButton === null) {
// check if there is at least one input field with submit handling,
event: KeyboardEvent | MouseEvent | null,
targetId?: string,
alternateElement?: HTMLElement,
- disableAutoFocus?: boolean
+ disableAutoFocus?: boolean,
): boolean {
if (event !== null) {
event.preventDefault();
const dropdown = DomTraverse.parentByClass(button, "dropdown") as HTMLElement;
if (dropdown === null) {
throw new Error(
- "Invalid dropdown passed, button '" + DomUtil.identify(button) + "' does not have a parent with .dropdown."
+ "Invalid dropdown passed, button '" + DomUtil.identify(button) + "' does not have a parent with .dropdown.",
);
}
const menu = DomTraverse.nextByClass(button, "dropdownMenu") as HTMLElement;
if (menu === null) {
throw new Error(
- "Invalid dropdown passed, button '" + DomUtil.identify(button) + "' does not have a menu as next sibling."
+ "Invalid dropdown passed, button '" + DomUtil.identify(button) + "' does not have a menu as next sibling.",
);
}
event.preventDefault();
}
},
- { passive: false }
+ { passive: false },
);
}
}
event: KeyboardEvent | MouseEvent | null,
targetId?: string,
alternateElement?: HTMLElement,
- disableAutoFocus?: boolean
+ disableAutoFocus?: boolean,
): boolean {
return toggle(event, targetId, alternateElement, disableAutoFocus);
},
// value may contain the placeholder `{$objectId}`
submitFieldName: "",
},
- options
+ options,
) as ItemListOptions;
const form = DomTraverse.parentByTag(element, "FORM") as HTMLFormElement;
if (!options.isCSV) {
if (!options.submitFieldName.length && typeof options.callbackSubmit !== "function") {
throw new Error(
- "Expected a valid function for option 'callbackSubmit', a non-empty value for option 'submitFieldName' or enabling the option 'submitFieldCSV'."
+ "Expected a valid function for option 'callbackSubmit', a non-empty value for option 'submitFieldName' or enabling the option 'submitFieldCSV'.",
);
}
link.setAttribute("aria-expanded", showMenu ? "true" : "false");
showMenuButton.setAttribute(
"aria-label",
- Language.get(showMenu ? "wcf.global.button.hideMenu" : "wcf.global.button.showMenu")
+ Language.get(showMenu ? "wcf.global.button.hideMenu" : "wcf.global.button.showMenu"),
);
});
});
() => {
this.menu.classList.remove("androidMenuTouchEnd");
},
- { once: true }
+ { once: true },
);
// check whether the user moved the finger far enough
let image = item.image;
if (/^fa-/.test(image)) {
image = `<span class="icon icon48 ${image} pointer jsTooltip" title="${Language.get(
- "wcf.global.select"
+ "wcf.global.select",
)}"></span>`;
}
className: "wcf\\data\\page\\PageAction",
},
},
- options
+ options,
) as any;
super(element, options);
"screen-lg-only": "(min-width: 1025px) and (max-width: 1280px)",
"screen-lg-down": "(max-width: 1280px)",
"screen-xl": "(min-width: 1281px)",
- })
+ }),
);
// Microsoft Edge rewrites the media queries to whatever it
noResultPlaceholder: "",
preventSubmit: false,
},
- options
+ options,
) as SearchInputOptions;
this.ajaxPayload = options.ajax as DatabaseObjectActionPayload;
// update label
const inputContainer = document.getElementById("pageHeaderSearchInputContainer") as HTMLElement;
const button = inputContainer.querySelector(
- ".pageHeaderSearchType > .button > .pageHeaderSearchTypeLabel"
+ ".pageHeaderSearchType > .button > .pageHeaderSearchTypeLabel",
) as HTMLElement;
button.textContent = target.textContent;
}
dropdownMenu.style.setProperty(
"transform",
`translateX(-${Math.ceil(offsetRight)}px) translateY(-${offsetTop}px)`,
- ""
+ "",
);
}
},
data: {},
},
},
- options.ajax
+ options.ajax,
) as DatabaseObjectActionPayload;
if (typeof options.callbackSelect !== "function") {
this.callbackSelect = options.callbackSelect;
this.excludedSearchValues = new Set(
- Array.isArray(options.excludedSearchValues) ? options.excludedSearchValues : []
+ Array.isArray(options.excludedSearchValues) ? options.excludedSearchValues : [],
);
this.threshold = options.threshold === undefined ? 3 : options.threshold;
// slight delay to avoid calling this function too often
timeout = window.setTimeout(callback, 10);
},
- { passive: true }
+ { passive: true },
);
});
name +
"'] (tab menu id: '" +
containerId +
- "') exists more than once."
+ "') exists more than once.",
);
}
const container = this.containers.get(name);
if (container === undefined) {
throw new Error(
- "Expected content element for li[data-name='" + name + "'] (tab menu id: '" + containerId + "')."
+ "Expected content element for li[data-name='" + name + "'] (tab menu id: '" + containerId + "').",
);
} else if (container.parentNode !== this.container) {
throw new Error(
- "Expected content element '" + name + "' (tab menu id: '" + containerId + "') to be a direct children."
+ "Expected content element '" + name + "' (tab menu id: '" + containerId + "') to be a direct children.",
);
}
// check if tab holds exactly one children which is an anchor element
if (tab.childElementCount !== 1 || tab.children[0].nodeName !== "A") {
throw new Error(
- "Expected exactly one <a> as children for li[data-name='" + name + "'] (tab menu id: '" + containerId + "')."
+ "Expected exactly one <a> as children for li[data-name='" + name + "'] (tab menu id: '" + containerId + "').",
);
}
["ban", "disableAvatar", "disableCoverPhoto", "disableSignature", "enable"].forEach((action) => {
const button = document.querySelector(
- ".userProfileButtonMenu .jsButtonUser" + StringUtil.ucfirst(action)
+ ".userProfileButtonMenu .jsButtonUser" + StringUtil.ucfirst(action),
) as HTMLElement;
// The button is missing if the current user lacks the permission.
this.header.dataset.disableAvatar = data.actionName === "disableAvatar" ? "true" : "false";
button = document.querySelector(".userProfileButtonMenu .jsButtonUserDisableAvatar") as HTMLElement;
button.textContent = Language.get(
- "wcf.user." + (data.actionName === "disableAvatar" ? "enable" : "disable") + "Avatar"
+ "wcf.user." + (data.actionName === "disableAvatar" ? "enable" : "disable") + "Avatar",
);
break;
this.header.dataset.disableCoverPhoto = data.actionName === "disableCoverPhoto" ? "true" : "false";
button = document.querySelector(".userProfileButtonMenu .jsButtonUserDisableCoverPhoto") as HTMLElement;
button.textContent = Language.get(
- "wcf.user." + (data.actionName === "disableCoverPhoto" ? "enable" : "disable") + "CoverPhoto"
+ "wcf.user." + (data.actionName === "disableCoverPhoto" ? "enable" : "disable") + "CoverPhoto",
);
break;
this.header.dataset.disableSignature = data.actionName === "disableSignature" ? "true" : "false";
button = document.querySelector(".userProfileButtonMenu .jsButtonUserDisableSignature") as HTMLElement;
button.textContent = Language.get(
- "wcf.user." + (data.actionName === "disableSignature" ? "enable" : "disable") + "Signature"
+ "wcf.user." + (data.actionName === "disableSignature" ? "enable" : "disable") + "Signature",
);
break;
<dt><label for="wcfUiUserEditorExpires"></label></dt>
<dd>
<input type="date" name="wcfUiUserEditorExpires" id="wcfUiUserEditorExpires" class="medium" min="${new Date(
- window.TIME_NOW * 1000
+ window.TIME_NOW * 1000,
).toISOString()}" data-ignore-timezone="true">
<small id="wcfUiUserEditorExpiresLabel"></small>
</dd>
dialogTitle: "",
parameters: {},
},
- options
+ options,
) as AjaxRequestOptions;
}
const dictionary = flatMap(
STATIC_DICTIONARY.concat(
this.staticDictionary,
- this.relatedInputs.map((input) => input.value.trim())
+ this.relatedInputs.map((input) => input.value.trim()),
),
- splitIntoWords
+ splitIntoWords,
).filter((value) => value.length > 0);
const value = this.input.value.trim();
},
},
},
- options
+ options,
);
super(element, options);