From: Alexander Ebert Date: Fri, 1 Jan 2021 12:15:33 +0000 (+0100) Subject: Moved the call to `favico.js` into `WCF.User.js` X-Git-Tag: 5.4.0_Alpha_1~484^2~20 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=ad4d184b671396fba917d62d69fe11fb0405723c;p=GitHub%2FWoltLab%2FWCF.git Moved the call to `favico.js` into `WCF.User.js` --- diff --git a/package-lock.json b/package-lock.json index 159f6b19cf..be241647fe 100644 --- a/package-lock.json +++ b/package-lock.json @@ -131,12 +131,6 @@ "resolved": "https://registry.npmjs.org/@types/facebook-js-sdk/-/facebook-js-sdk-3.3.1.tgz", "integrity": "sha512-jRVPdOu237QxDDoBjc9/xzGsDz75FmdvcwVZdCEg1AjHAQxGmXoHfACUyUVtz7DSWA4E+jgj5MQME4snjGwOng==" }, - "@types/favico.js": { - "version": "0.0.28", - "resolved": "https://registry.npmjs.org/@types/favico.js/-/favico.js-0.0.28.tgz", - "integrity": "sha1-u3t8qhGCFzGNA0Zmkg1oeljWXus=", - "dev": true - }, "@types/jquery": { "version": "3.5.4", "resolved": "https://registry.npmjs.org/@types/jquery/-/jquery-3.5.4.tgz", diff --git a/package.json b/package.json index 2c82ef9421..24987ad4c3 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,6 @@ "name": "@woltlab/wcf", "version": "5.4.0", "devDependencies": { - "@types/favico.js": "0.0.28", "@types/perfect-scrollbar": "^0.6.1", "@typescript-eslint/eslint-plugin": "^4.6.0", "@typescript-eslint/parser": "^4.6.0", diff --git a/wcfsetup/install/files/js/WCF.User.js b/wcfsetup/install/files/js/WCF.User.js index 7262838575..9f5c37dadb 100644 --- a/wcfsetup/install/files/js/WCF.User.js +++ b/wcfsetup/install/files/js/WCF.User.js @@ -419,15 +419,17 @@ if (COMPILER_TARGET_DEFAULT) { this._super($('#userNotifications'), 'userNotifications', options); try { - this._favico = new Favico({ - animation: 'none', - type: 'circle' + require(["favico"], (Favico) => { + this._favico = new Favico({ + animation: 'none', + type: 'circle' + }); + + if (this._badge !== null) { + var $count = parseInt(this._badge.text()) || 0; + this._favico.badge($count); + } }); - - if (this._badge !== null) { - var $count = parseInt(this._badge.text()) || 0; - this._favico.badge($count); - } } catch (e) { console.debug("[WCF.User.Panel.Notification] Failed to initialized Favico: " + e.message); diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Bootstrap.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Bootstrap.js index 65bec3ba5e..4649f0750b 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Bootstrap.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Bootstrap.js @@ -8,7 +8,7 @@ * @license GNU Lesser General Public License * @module WoltLabSuite/Core/Bootstrap */ -define(["require", "exports", "tslib", "./Core", "./Date/Picker", "./Date/Time/Relative", "./Devtools", "./Dom/Change/Listener", "./Environment", "./Event/Handler", "./Language", "./StringUtil", "./Ui/Dialog", "./Ui/Dropdown/Simple", "./Ui/Mobile", "./Ui/Page/Action", "./Ui/TabMenu", "./Ui/Tooltip", "favico.js"], function (require, exports, tslib_1, Core, Picker_1, DateTimeRelative, Devtools_1, Listener_1, Environment, EventHandler, Language, StringUtil, Dialog_1, Simple_1, UiMobile, UiPageAction, UiTabMenu, UiTooltip) { +define(["require", "exports", "tslib", "./Core", "./Date/Picker", "./Date/Time/Relative", "./Devtools", "./Dom/Change/Listener", "./Environment", "./Event/Handler", "./Language", "./StringUtil", "./Ui/Dialog", "./Ui/Dropdown/Simple", "./Ui/Mobile", "./Ui/Page/Action", "./Ui/TabMenu", "./Ui/Tooltip"], function (require, exports, tslib_1, Core, Picker_1, DateTimeRelative, Devtools_1, Listener_1, Environment, EventHandler, Language, StringUtil, Dialog_1, Simple_1, UiMobile, UiPageAction, UiTabMenu, UiTooltip) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.setup = void 0; diff --git a/wcfsetup/install/files/ts/WoltLabSuite/Core/Bootstrap.ts b/wcfsetup/install/files/ts/WoltLabSuite/Core/Bootstrap.ts index 0bde2bb663..9e3a44be55 100644 --- a/wcfsetup/install/files/ts/WoltLabSuite/Core/Bootstrap.ts +++ b/wcfsetup/install/files/ts/WoltLabSuite/Core/Bootstrap.ts @@ -25,9 +25,6 @@ import * as UiPageAction from "./Ui/Page/Action"; import * as UiTabMenu from "./Ui/TabMenu"; import * as UiTooltip from "./Ui/Tooltip"; -// Import favico.js into the global namespace. -import "favico.js"; - // perfectScrollbar does not need to be bound anywhere, it just has to be loaded for WCF.js // eslint-disable-next-line @typescript-eslint/no-unused-vars import perfectScrollbar from "perfect-scrollbar";