From 26234940dc9a46ff3a0ff15e4c765e2f0ec585cd Mon Sep 17 00:00:00 2001 From: Darkle Date: Sun, 8 Sep 2024 04:49:42 +0200 Subject: [PATCH] fix?? --- js/package-lock.json | 30 +++++++++++++++++++++--------- js/package.json | 2 +- js/src/forum/index.js | 21 ++++++++++++++++++++- 3 files changed, 42 insertions(+), 11 deletions(-) diff --git a/js/package-lock.json b/js/package-lock.json index da14986..2eb2d9f 100644 --- a/js/package-lock.json +++ b/js/package-lock.json @@ -10,7 +10,6 @@ "dependencies": { "@fancyapps/ui": "^5.0.36", "@flarum/prettier-config": "^1.0.0", - "flarum-tsconfig": "^1.0.2", "flarum-webpack-config": "^2.0.0", "webpack": "^5.73.0", "webpack-cli": "^4.10.0" @@ -19,6 +18,7 @@ "@babel/core": "^7.25.2", "@babel/preset-env": "^7.25.4", "babel-loader": "^9.1.3", + "flarum-tsconfig": "^1.0.2", "prettier": "^2.7.1" } }, @@ -1935,6 +1935,7 @@ "version": "3.5.14", "resolved": "https://registry.npmjs.org/@types/jquery/-/jquery-3.5.14.tgz", "integrity": "sha512-X1gtMRMbziVQkErhTQmSe2jFwwENA/Zr+PprCkF63vFq+Yt5PZ4AlKqgmeNlwgn7dhsXEK888eIW2520EpC+xg==", + "dev": true, "dependencies": { "@types/sizzle": "*" } @@ -1947,7 +1948,8 @@ "node_modules/@types/mithril": { "version": "2.0.10", "resolved": "https://registry.npmjs.org/@types/mithril/-/mithril-2.0.10.tgz", - "integrity": "sha512-ef44j85vtiFuwu4ADkHSDfYu1MbnSQSgOrTMRfQ5v4gvAnB4ms8KjelJzUIuSrL3lO7y8k2T0DiUAAEfisnsQw==" + "integrity": "sha512-ef44j85vtiFuwu4ADkHSDfYu1MbnSQSgOrTMRfQ5v4gvAnB4ms8KjelJzUIuSrL3lO7y8k2T0DiUAAEfisnsQw==", + "dev": true }, "node_modules/@types/node": { "version": "17.0.23", @@ -1957,12 +1959,14 @@ "node_modules/@types/sizzle": { "version": "2.3.3", "resolved": "https://registry.npmjs.org/@types/sizzle/-/sizzle-2.3.3.tgz", - "integrity": "sha512-JYM8x9EGF163bEyhdJBpR2QX1R5naCJHC8ucJylJ3w9/CVBaskdQ8WqBf8MmQrd1kRvp/a4TS8HJ+bxzR7ZJYQ==" + "integrity": "sha512-JYM8x9EGF163bEyhdJBpR2QX1R5naCJHC8ucJylJ3w9/CVBaskdQ8WqBf8MmQrd1kRvp/a4TS8HJ+bxzR7ZJYQ==", + "dev": true }, "node_modules/@types/throttle-debounce": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/@types/throttle-debounce/-/throttle-debounce-2.1.0.tgz", - "integrity": "sha512-5eQEtSCoESnh2FsiLTxE121IiE60hnMqcb435fShf4bpLRjEu1Eoekht23y6zXS9Ts3l+Szu3TARnTsA0GkOkQ==" + "integrity": "sha512-5eQEtSCoESnh2FsiLTxE121IiE60hnMqcb435fShf4bpLRjEu1Eoekht23y6zXS9Ts3l+Szu3TARnTsA0GkOkQ==", + "dev": true }, "node_modules/@webassemblyjs/ast": { "version": "1.11.1", @@ -2455,7 +2459,8 @@ "node_modules/dayjs": { "version": "1.11.0", "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.0.tgz", - "integrity": "sha512-JLC809s6Y948/FuCZPm5IX8rRhQwOiyMb2TfVVQEixG7P8Lm/gt5S7yoQZmC8x1UehI9Pb7sksEt4xx14m+7Ug==" + "integrity": "sha512-JLC809s6Y948/FuCZPm5IX8rRhQwOiyMb2TfVVQEixG7P8Lm/gt5S7yoQZmC8x1UehI9Pb7sksEt4xx14m+7Ug==", + "dev": true }, "node_modules/debug": { "version": "4.3.4", @@ -2728,6 +2733,7 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/flarum-tsconfig/-/flarum-tsconfig-1.0.2.tgz", "integrity": "sha512-RUaN7D6noLK9vY1F86NIc+IlIP1YAA3bJ4jGR5pIm8UxvLBLW8qrAHzIosuQJgvnge7VgTA5c2LoNefUK/9EiQ==", + "dev": true, "dependencies": { "@types/jquery": "^3.5.5", "@types/mithril": "^2.0.7", @@ -5290,6 +5296,7 @@ "version": "3.5.14", "resolved": "https://registry.npmjs.org/@types/jquery/-/jquery-3.5.14.tgz", "integrity": "sha512-X1gtMRMbziVQkErhTQmSe2jFwwENA/Zr+PprCkF63vFq+Yt5PZ4AlKqgmeNlwgn7dhsXEK888eIW2520EpC+xg==", + "dev": true, "requires": { "@types/sizzle": "*" } @@ -5302,7 +5309,8 @@ "@types/mithril": { "version": "2.0.10", "resolved": "https://registry.npmjs.org/@types/mithril/-/mithril-2.0.10.tgz", - "integrity": "sha512-ef44j85vtiFuwu4ADkHSDfYu1MbnSQSgOrTMRfQ5v4gvAnB4ms8KjelJzUIuSrL3lO7y8k2T0DiUAAEfisnsQw==" + "integrity": "sha512-ef44j85vtiFuwu4ADkHSDfYu1MbnSQSgOrTMRfQ5v4gvAnB4ms8KjelJzUIuSrL3lO7y8k2T0DiUAAEfisnsQw==", + "dev": true }, "@types/node": { "version": "17.0.23", @@ -5312,12 +5320,14 @@ "@types/sizzle": { "version": "2.3.3", "resolved": "https://registry.npmjs.org/@types/sizzle/-/sizzle-2.3.3.tgz", - "integrity": "sha512-JYM8x9EGF163bEyhdJBpR2QX1R5naCJHC8ucJylJ3w9/CVBaskdQ8WqBf8MmQrd1kRvp/a4TS8HJ+bxzR7ZJYQ==" + "integrity": "sha512-JYM8x9EGF163bEyhdJBpR2QX1R5naCJHC8ucJylJ3w9/CVBaskdQ8WqBf8MmQrd1kRvp/a4TS8HJ+bxzR7ZJYQ==", + "dev": true }, "@types/throttle-debounce": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/@types/throttle-debounce/-/throttle-debounce-2.1.0.tgz", - "integrity": "sha512-5eQEtSCoESnh2FsiLTxE121IiE60hnMqcb435fShf4bpLRjEu1Eoekht23y6zXS9Ts3l+Szu3TARnTsA0GkOkQ==" + "integrity": "sha512-5eQEtSCoESnh2FsiLTxE121IiE60hnMqcb435fShf4bpLRjEu1Eoekht23y6zXS9Ts3l+Szu3TARnTsA0GkOkQ==", + "dev": true }, "@webassemblyjs/ast": { "version": "1.11.1", @@ -5698,7 +5708,8 @@ "dayjs": { "version": "1.11.0", "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.0.tgz", - "integrity": "sha512-JLC809s6Y948/FuCZPm5IX8rRhQwOiyMb2TfVVQEixG7P8Lm/gt5S7yoQZmC8x1UehI9Pb7sksEt4xx14m+7Ug==" + "integrity": "sha512-JLC809s6Y948/FuCZPm5IX8rRhQwOiyMb2TfVVQEixG7P8Lm/gt5S7yoQZmC8x1UehI9Pb7sksEt4xx14m+7Ug==", + "dev": true }, "debug": { "version": "4.3.4", @@ -5889,6 +5900,7 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/flarum-tsconfig/-/flarum-tsconfig-1.0.2.tgz", "integrity": "sha512-RUaN7D6noLK9vY1F86NIc+IlIP1YAA3bJ4jGR5pIm8UxvLBLW8qrAHzIosuQJgvnge7VgTA5c2LoNefUK/9EiQ==", + "dev": true, "requires": { "@types/jquery": "^3.5.5", "@types/mithril": "^2.0.7", diff --git a/js/package.json b/js/package.json index bff01bc..e8c286d 100644 --- a/js/package.json +++ b/js/package.json @@ -6,7 +6,6 @@ "dependencies": { "@fancyapps/ui": "^5.0.36", "@flarum/prettier-config": "^1.0.0", - "flarum-tsconfig": "^1.0.2", "flarum-webpack-config": "^2.0.0", "webpack": "^5.73.0", "webpack-cli": "^4.10.0" @@ -15,6 +14,7 @@ "@babel/core": "^7.25.2", "@babel/preset-env": "^7.25.4", "babel-loader": "^9.1.3", + "flarum-tsconfig": "^1.0.2", "prettier": "^2.7.1" }, "scripts": { diff --git a/js/src/forum/index.js b/js/src/forum/index.js index a661a42..a88f660 100644 --- a/js/src/forum/index.js +++ b/js/src/forum/index.js @@ -2,10 +2,12 @@ import app from 'flarum/forum/app'; import { extend } from 'flarum/common/extend'; import CommentPost from 'flarum/forum/components/CommentPost'; import { Fancybox, Carousel } from '@fancyapps/ui'; +import '@fancyapps/ui/dist/fancybox/fancybox.css'; +import '@fancyapps/ui/dist/carousel/carousel.css'; app.initializers.add('darkle/fancybox', () => { extend(CommentPost.prototype, 'oncreate', function () { - // Initialize Fancybox for individual images + // Handle individual images this.element .querySelectorAll('.Post-body img:not(.emoji):not(.Avatar):not(.PostMeta-ip img):not([data-reaction]):not([data-link-preview]):not(.flamoji img):not(.countryFlag):not(.no-fancybox)') .forEach((node) => { @@ -17,7 +19,22 @@ app.initializers.add('darkle/fancybox', () => { fancyboxEl.appendChild(node); }); + // Initialize Fancybox for individual images Fancybox.bind('[data-fancybox="gallery"]', { + Carousel: { + infinite: false, + }, + Slideshow: { + playOnStart: true, + timeout: 3000, + }, + Toolbar: { + display: { + left: [], + middle: [], + right: ["slideshow", "close"], + }, + }, Images: { zoom: false, }, @@ -29,6 +46,8 @@ app.initializers.add('darkle/fancybox', () => { .forEach((carousel) => { new Carousel(carousel, { infinite: false, + Dots: true, + Navigation: true, }); }); });