<file>js/WoltLabSuite/Core/Ui/Redactor/RuntimeStyle.js</file>
<file>js/WoltLabSuite/Core/Ui/Redactor/Spoiler.js</file>
<file>js/WoltLabSuite/Core/Ui/Redactor/Table.js</file>
+ <file>js/WoltLabSuite/Core/Ui/User/CoverPhoto/Delete.js</file>
+ <file>js/WoltLabSuite/Core/Ui/User/CoverPhoto/Upload.js</file>
<file>js/WoltLabSuite/Core/Ui/User/Menu/DropDown.js</file>
<file>js/WoltLabSuite/WebComponent/fa-brand.js</file>
<file>js/WoltLabSuite/WebComponent/fa-icon.js</file>
+++ /dev/null
-/**
- * Deletes the current user cover photo.
- *
- * @author Alexander Ebert
- * @copyright 2001-2019 WoltLab GmbH
- * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
- * @woltlabExcludeBundle all
- */
-
-import * as Ajax from "../../../Ajax";
-import { AjaxCallbackObject, AjaxCallbackSetup, ResponseData } from "../../../Ajax/Data";
-import DomUtil from "../../../Dom/Util";
-import * as EventHandler from "../../../Event/Handler";
-import * as Language from "../../../Language";
-import * as UiConfirmation from "../../Confirmation";
-import * as UiNotification from "../../Notification";
-
-interface AjaxResponse extends ResponseData {
- returnValues: {
- url: string;
- };
-}
-
-class UiUserCoverPhotoDelete implements AjaxCallbackObject {
- private readonly button: HTMLAnchorElement;
- private readonly userId: number;
-
- /**
- * Initializes the delete handler and enables the delete button on upload.
- */
- constructor(userId: number) {
- const button = document.querySelector<HTMLAnchorElement>(".jsButtonDeleteCoverPhoto");
- if (button === null) {
- return;
- }
-
- this.button = button;
- this.button.addEventListener("click", (ev) => this._click(ev));
- this.userId = userId;
-
- EventHandler.add("com.woltlab.wcf.user", "coverPhoto", (data) => {
- if (typeof data.url === "string" && data.url.length > 0) {
- DomUtil.show(this.button.parentElement!);
- }
- });
- }
-
- /**
- * Handles clicks on the delete button.
- */
- _click(event: MouseEvent): void {
- event.preventDefault();
-
- UiConfirmation.show({
- confirm: () => Ajax.api(this),
- message: Language.get("wcf.user.coverPhoto.delete.confirmMessage"),
- });
- }
-
- _ajaxSuccess(data: AjaxResponse): void {
- const photo = document.querySelector(".userProfileCoverPhoto") as HTMLElement;
- photo.style.setProperty("background-image", `url(${data.returnValues.url})`, "");
-
- DomUtil.hide(this.button.parentElement!);
-
- UiNotification.show();
- }
-
- _ajaxSetup(): ReturnType<AjaxCallbackSetup> {
- return {
- data: {
- actionName: "deleteCoverPhoto",
- className: "wcf\\data\\user\\UserProfileAction",
- parameters: {
- userID: this.userId,
- },
- },
- };
- }
-}
-
-let uiUserCoverPhotoDelete: UiUserCoverPhotoDelete | undefined;
-
-/**
- * Initializes the delete handler and enables the delete button on upload.
- */
-export function init(userId: number): void {
- if (!uiUserCoverPhotoDelete) {
- uiUserCoverPhotoDelete = new UiUserCoverPhotoDelete(userId);
- }
-}
+++ /dev/null
-/**
- * Uploads the user cover photo via AJAX.
- *
- * @author Alexander Ebert
- * @copyright 2001-2019 WoltLab GmbH
- * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
- * @woltlabExcludeBundle all
- */
-
-import DomUtil from "../../../Dom/Util";
-import * as EventHandler from "../../../Event/Handler";
-import { ResponseData } from "../../../Ajax/Data";
-import * as UiDialog from "../../Dialog";
-import * as UiNotification from "../../Notification";
-import Upload from "../../../Upload";
-
-interface AjaxResponse extends ResponseData {
- returnValues: {
- errorMessage?: string;
- url?: string;
- };
-}
-
-/**
- * @constructor
- */
-class UiUserCoverPhotoUpload extends Upload {
- private readonly userId: number;
-
- constructor(userId: number) {
- super("coverPhotoUploadButtonContainer", "coverPhotoUploadPreview", {
- action: "uploadCoverPhoto",
- className: "wcf\\data\\user\\UserProfileAction",
- });
-
- this.userId = userId;
- }
-
- protected _getParameters(): ArbitraryObject {
- return {
- userID: this.userId,
- };
- }
-
- protected _success(uploadId: number, data: AjaxResponse): void {
- // remove or display the error message
- DomUtil.innerError(this._button, data.returnValues.errorMessage);
-
- // remove the upload progress
- this._target.innerHTML = "";
-
- if (data.returnValues.url) {
- const photo = document.querySelector(".userProfileCoverPhoto") as HTMLElement;
- photo.style.setProperty("background-image", `url(${data.returnValues.url})`, "");
-
- UiDialog.close("userProfileCoverPhotoUpload");
- UiNotification.show();
-
- EventHandler.fire("com.woltlab.wcf.user", "coverPhoto", {
- url: data.returnValues.url,
- });
- }
- }
-}
-
-export = UiUserCoverPhotoUpload;
+++ /dev/null
-/**
- * Deletes the current user cover photo.
- *
- * @author Alexander Ebert
- * @copyright 2001-2019 WoltLab GmbH
- * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
- * @woltlabExcludeBundle all
- */
-define(["require", "exports", "tslib", "../../../Ajax", "../../../Dom/Util", "../../../Event/Handler", "../../../Language", "../../Confirmation", "../../Notification"], function (require, exports, tslib_1, Ajax, Util_1, EventHandler, Language, UiConfirmation, UiNotification) {
- "use strict";
- Object.defineProperty(exports, "__esModule", { value: true });
- exports.init = init;
- Ajax = tslib_1.__importStar(Ajax);
- Util_1 = tslib_1.__importDefault(Util_1);
- EventHandler = tslib_1.__importStar(EventHandler);
- Language = tslib_1.__importStar(Language);
- UiConfirmation = tslib_1.__importStar(UiConfirmation);
- UiNotification = tslib_1.__importStar(UiNotification);
- class UiUserCoverPhotoDelete {
- button;
- userId;
- /**
- * Initializes the delete handler and enables the delete button on upload.
- */
- constructor(userId) {
- const button = document.querySelector(".jsButtonDeleteCoverPhoto");
- if (button === null) {
- return;
- }
- this.button = button;
- this.button.addEventListener("click", (ev) => this._click(ev));
- this.userId = userId;
- EventHandler.add("com.woltlab.wcf.user", "coverPhoto", (data) => {
- if (typeof data.url === "string" && data.url.length > 0) {
- Util_1.default.show(this.button.parentElement);
- }
- });
- }
- /**
- * Handles clicks on the delete button.
- */
- _click(event) {
- event.preventDefault();
- UiConfirmation.show({
- confirm: () => Ajax.api(this),
- message: Language.get("wcf.user.coverPhoto.delete.confirmMessage"),
- });
- }
- _ajaxSuccess(data) {
- const photo = document.querySelector(".userProfileCoverPhoto");
- photo.style.setProperty("background-image", `url(${data.returnValues.url})`, "");
- Util_1.default.hide(this.button.parentElement);
- UiNotification.show();
- }
- _ajaxSetup() {
- return {
- data: {
- actionName: "deleteCoverPhoto",
- className: "wcf\\data\\user\\UserProfileAction",
- parameters: {
- userID: this.userId,
- },
- },
- };
- }
- }
- let uiUserCoverPhotoDelete;
- /**
- * Initializes the delete handler and enables the delete button on upload.
- */
- function init(userId) {
- if (!uiUserCoverPhotoDelete) {
- uiUserCoverPhotoDelete = new UiUserCoverPhotoDelete(userId);
- }
- }
-});
+++ /dev/null
-/**
- * Uploads the user cover photo via AJAX.
- *
- * @author Alexander Ebert
- * @copyright 2001-2019 WoltLab GmbH
- * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
- * @woltlabExcludeBundle all
- */
-define(["require", "exports", "tslib", "../../../Dom/Util", "../../../Event/Handler", "../../Dialog", "../../Notification", "../../../Upload"], function (require, exports, tslib_1, Util_1, EventHandler, UiDialog, UiNotification, Upload_1) {
- "use strict";
- Util_1 = tslib_1.__importDefault(Util_1);
- EventHandler = tslib_1.__importStar(EventHandler);
- UiDialog = tslib_1.__importStar(UiDialog);
- UiNotification = tslib_1.__importStar(UiNotification);
- Upload_1 = tslib_1.__importDefault(Upload_1);
- /**
- * @constructor
- */
- class UiUserCoverPhotoUpload extends Upload_1.default {
- userId;
- constructor(userId) {
- super("coverPhotoUploadButtonContainer", "coverPhotoUploadPreview", {
- action: "uploadCoverPhoto",
- className: "wcf\\data\\user\\UserProfileAction",
- });
- this.userId = userId;
- }
- _getParameters() {
- return {
- userID: this.userId,
- };
- }
- _success(uploadId, data) {
- // remove or display the error message
- Util_1.default.innerError(this._button, data.returnValues.errorMessage);
- // remove the upload progress
- this._target.innerHTML = "";
- if (data.returnValues.url) {
- const photo = document.querySelector(".userProfileCoverPhoto");
- photo.style.setProperty("background-image", `url(${data.returnValues.url})`, "");
- UiDialog.close("userProfileCoverPhotoUpload");
- UiNotification.show();
- EventHandler.fire("com.woltlab.wcf.user", "coverPhoto", {
- url: data.returnValues.url,
- });
- }
- }
- }
- return UiUserCoverPhotoUpload;
-});