This commit is contained in:
i.j 2025-04-07 17:59:44 +02:00
parent 6bc8d876d1
commit 86aa9fb782
12 changed files with 175 additions and 178 deletions

View File

@ -18,3 +18,4 @@ indent_style = ignore
[**.min.css] [**.min.css]
indent_style = ignore indent_style = ignore

19
.gitignore vendored
View File

@ -29,12 +29,6 @@ coverage
# nyc test coverage # nyc test coverage
.nyc_output .nyc_output
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration # node-waf configuration
.lock-wscript .lock-wscript
@ -95,9 +89,6 @@ out
# Gatsby files # Gatsby files
.cache/ .cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public
# vuepress build output # vuepress build output
.vuepress/dist .vuepress/dist
@ -134,8 +125,6 @@ out
# Serverless Webpack directories # Serverless Webpack directories
.webpack/ .webpack/
# Optional stylelint cache
# SvelteKit build / generate output # SvelteKit build / generate output
.svelte-kit .svelte-kit
@ -205,14 +194,6 @@ fabric.properties
# Android studio 3.1+ serialized cache file # Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser .idea/caches/build_file_checksums.ser
### Intellij Patch ###
# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721
# *.iml
# modules.xml
# .idea/misc.xml
# *.ipr
# Sonarlint plugin # Sonarlint plugin
# https://plugins.jetbrains.com/plugin/7973-sonarlint # https://plugins.jetbrains.com/plugin/7973-sonarlint
.idea/**/sonarlint/ .idea/**/sonarlint/

View File

@ -1,3 +1,8 @@
v4.7.0 - xx/04/2025
- Hide preview link if post is tagged as spoiler
- Improve posts filter via URL
- Update Rollup module bundler (v4.39.0)
v4.6.0 - 07/03/2025 v4.6.0 - 07/03/2025
- Show preview link content in boosted posts - Show preview link content in boosted posts
- Fix spoiler text switch button - Fix spoiler text switch button

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,5 @@
# This is a docker compose file to demonstrate and test the Mastodon embed timeline widget # This is a docker compose file to demonstrate and test the Mastodon embed timeline widget
# Run this docker CLI from the root repository directory: # Run this docker CLI from the root repository directory:
#
# $ docker compose up # $ docker compose up
version: "3.3" version: "3.3"

View File

@ -1,6 +1,7 @@
# 🐘 Mastodon embed timeline - 🛠️ Installation # 🐘 Mastodon embed timeline - 🛠️ Installation
You have three different ways to install it in your project: You have three different ways to install it in your project:
- [Download](#download) - [Download](#download)
- [CDN](#cdn) - [CDN](#cdn)
- [Package manager](#package-manager) - [Package manager](#package-manager)
@ -45,11 +46,11 @@ This option allows you to start without the need to upload any files on your ser
Copy the following CSS and JS links to include them in your project: Copy the following CSS and JS links to include them in your project:
```html ```html
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@idotj/mastodon-embed-timeline@4.6.0/dist/mastodon-timeline.min.css" integrity="sha256-Qi3H+bdH6RuMuyR1trAlG5bMWJGl9y3jPiTc1PWQFpI=" crossorigin="anonymous"> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@idotj/mastodon-embed-timeline@4.7.0/dist/mastodon-timeline.min.css">
``` ```
```html ```html
<script src="https://cdn.jsdelivr.net/npm/@idotj/mastodon-embed-timeline@4.6.0/dist/mastodon-timeline.umd.js" integrity="sha256-atEPYqs4j5Ogqb9yl3++jbRmTIItqwZUhpnTWdNsF2c=" crossorigin="anonymous"></script> <script src="https://cdn.jsdelivr.net/npm/@idotj/mastodon-embed-timeline@4.7.0/dist/mastodon-timeline.umd.js"></script>
``` ```
## Package manager ## Package manager

View File

@ -236,4 +236,3 @@ There is a long list of parameters that allows you to quickly customize your tim
In the `examples/` folder there is an HTML file `local-timeline-customized.html` that you can use as a referente to see how to customize your timeline by overwriting some CSS styles and using several parameters when initializing the timeline. In the `examples/` folder there is an HTML file `local-timeline-customized.html` that you can use as a referente to see how to customize your timeline by overwriting some CSS styles and using several parameters when initializing the timeline.
Also, if you need to change something in the core files (`src/` folder), I recommend you to read the document [CONTRIBUTING.md](https://gitlab.com/idotj/mastodon-embed-timeline/-/blob/master/CONTRIBUTING.md#testing) to see how to compile and test your changes. Also, if you need to change something in the core files (`src/` folder), I recommend you to read the document [CONTRIBUTING.md](https://gitlab.com/idotj/mastodon-embed-timeline/-/blob/master/CONTRIBUTING.md#testing) to see how to compile and test your changes.

187
package-lock.json generated
View File

@ -1,17 +1,17 @@
{ {
"name": "@idotj/mastodon-embed-timeline", "name": "@idotj/mastodon-embed-timeline",
"version": "4.6.0", "version": "4.7.0",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "@idotj/mastodon-embed-timeline", "name": "@idotj/mastodon-embed-timeline",
"version": "4.6.0", "version": "4.7.0",
"license": "GNU", "license": "GNU",
"devDependencies": { "devDependencies": {
"@rollup/plugin-terser": "^0.4.4", "@rollup/plugin-terser": "^0.4.4",
"clean-css-cli": "^5.6.3", "clean-css-cli": "^5.6.3",
"rollup": "^4.34.8" "rollup": "^4.39.0"
} }
}, },
"node_modules/@jridgewell/gen-mapping": { "node_modules/@jridgewell/gen-mapping": {
@ -95,9 +95,9 @@
} }
}, },
"node_modules/@rollup/rollup-android-arm-eabi": { "node_modules/@rollup/rollup-android-arm-eabi": {
"version": "4.34.8", "version": "4.39.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.34.8.tgz", "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.39.0.tgz",
"integrity": "sha512-q217OSE8DTp8AFHuNHXo0Y86e1wtlfVrXiAlwkIvGRQv9zbc6mE3sjIVfwI8sYUyNxwOg0j/Vm1RKM04JcWLJw==", "integrity": "sha512-lGVys55Qb00Wvh8DMAocp5kIcaNzEFTmGhfFd88LfaogYTRKrdxgtlO5H6S49v2Nd8R2C6wLOal0qv6/kCkOwA==",
"cpu": [ "cpu": [
"arm" "arm"
], ],
@ -109,9 +109,9 @@
] ]
}, },
"node_modules/@rollup/rollup-android-arm64": { "node_modules/@rollup/rollup-android-arm64": {
"version": "4.34.8", "version": "4.39.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.34.8.tgz", "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.39.0.tgz",
"integrity": "sha512-Gigjz7mNWaOL9wCggvoK3jEIUUbGul656opstjaUSGC3eT0BM7PofdAJaBfPFWWkXNVAXbaQtC99OCg4sJv70Q==", "integrity": "sha512-It9+M1zE31KWfqh/0cJLrrsCPiF72PoJjIChLX+rEcujVRCb4NLQ5QzFkzIZW8Kn8FTbvGQBY5TkKBau3S8cCQ==",
"cpu": [ "cpu": [
"arm64" "arm64"
], ],
@ -123,9 +123,9 @@
] ]
}, },
"node_modules/@rollup/rollup-darwin-arm64": { "node_modules/@rollup/rollup-darwin-arm64": {
"version": "4.34.8", "version": "4.39.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.34.8.tgz", "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.39.0.tgz",
"integrity": "sha512-02rVdZ5tgdUNRxIUrFdcMBZQoaPMrxtwSb+/hOfBdqkatYHR3lZ2A2EGyHq2sGOd0Owk80oV3snlDASC24He3Q==", "integrity": "sha512-lXQnhpFDOKDXiGxsU9/l8UEGGM65comrQuZ+lDcGUx+9YQ9dKpF3rSEGepyeR5AHZ0b5RgiligsBhWZfSSQh8Q==",
"cpu": [ "cpu": [
"arm64" "arm64"
], ],
@ -137,9 +137,9 @@
] ]
}, },
"node_modules/@rollup/rollup-darwin-x64": { "node_modules/@rollup/rollup-darwin-x64": {
"version": "4.34.8", "version": "4.39.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.34.8.tgz", "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.39.0.tgz",
"integrity": "sha512-qIP/elwR/tq/dYRx3lgwK31jkZvMiD6qUtOycLhTzCvrjbZ3LjQnEM9rNhSGpbLXVJYQ3rq39A6Re0h9tU2ynw==", "integrity": "sha512-mKXpNZLvtEbgu6WCkNij7CGycdw9cJi2k9v0noMb++Vab12GZjFgUXD69ilAbBh034Zwn95c2PNSz9xM7KYEAQ==",
"cpu": [ "cpu": [
"x64" "x64"
], ],
@ -151,9 +151,9 @@
] ]
}, },
"node_modules/@rollup/rollup-freebsd-arm64": { "node_modules/@rollup/rollup-freebsd-arm64": {
"version": "4.34.8", "version": "4.39.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.34.8.tgz", "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.39.0.tgz",
"integrity": "sha512-IQNVXL9iY6NniYbTaOKdrlVP3XIqazBgJOVkddzJlqnCpRi/yAeSOa8PLcECFSQochzqApIOE1GHNu3pCz+BDA==", "integrity": "sha512-jivRRlh2Lod/KvDZx2zUR+I4iBfHcu2V/BA2vasUtdtTN2Uk3jfcZczLa81ESHZHPHy4ih3T/W5rPFZ/hX7RtQ==",
"cpu": [ "cpu": [
"arm64" "arm64"
], ],
@ -165,9 +165,9 @@
] ]
}, },
"node_modules/@rollup/rollup-freebsd-x64": { "node_modules/@rollup/rollup-freebsd-x64": {
"version": "4.34.8", "version": "4.39.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.34.8.tgz", "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.39.0.tgz",
"integrity": "sha512-TYXcHghgnCqYFiE3FT5QwXtOZqDj5GmaFNTNt3jNC+vh22dc/ukG2cG+pi75QO4kACohZzidsq7yKTKwq/Jq7Q==", "integrity": "sha512-8RXIWvYIRK9nO+bhVz8DwLBepcptw633gv/QT4015CpJ0Ht8punmoHU/DuEd3iw9Hr8UwUV+t+VNNuZIWYeY7Q==",
"cpu": [ "cpu": [
"x64" "x64"
], ],
@ -179,9 +179,9 @@
] ]
}, },
"node_modules/@rollup/rollup-linux-arm-gnueabihf": { "node_modules/@rollup/rollup-linux-arm-gnueabihf": {
"version": "4.34.8", "version": "4.39.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.34.8.tgz", "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.39.0.tgz",
"integrity": "sha512-A4iphFGNkWRd+5m3VIGuqHnG3MVnqKe7Al57u9mwgbyZ2/xF9Jio72MaY7xxh+Y87VAHmGQr73qoKL9HPbXj1g==", "integrity": "sha512-mz5POx5Zu58f2xAG5RaRRhp3IZDK7zXGk5sdEDj4o96HeaXhlUwmLFzNlc4hCQi5sGdR12VDgEUqVSHer0lI9g==",
"cpu": [ "cpu": [
"arm" "arm"
], ],
@ -193,9 +193,9 @@
] ]
}, },
"node_modules/@rollup/rollup-linux-arm-musleabihf": { "node_modules/@rollup/rollup-linux-arm-musleabihf": {
"version": "4.34.8", "version": "4.39.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.34.8.tgz", "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.39.0.tgz",
"integrity": "sha512-S0lqKLfTm5u+QTxlFiAnb2J/2dgQqRy/XvziPtDd1rKZFXHTyYLoVL58M/XFwDI01AQCDIevGLbQrMAtdyanpA==", "integrity": "sha512-+YDwhM6gUAyakl0CD+bMFpdmwIoRDzZYaTWV3SDRBGkMU/VpIBYXXEvkEcTagw/7VVkL2vA29zU4UVy1mP0/Yw==",
"cpu": [ "cpu": [
"arm" "arm"
], ],
@ -207,9 +207,9 @@
] ]
}, },
"node_modules/@rollup/rollup-linux-arm64-gnu": { "node_modules/@rollup/rollup-linux-arm64-gnu": {
"version": "4.34.8", "version": "4.39.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.34.8.tgz", "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.39.0.tgz",
"integrity": "sha512-jpz9YOuPiSkL4G4pqKrus0pn9aYwpImGkosRKwNi+sJSkz+WU3anZe6hi73StLOQdfXYXC7hUfsQlTnjMd3s1A==", "integrity": "sha512-EKf7iF7aK36eEChvlgxGnk7pdJfzfQbNvGV/+l98iiMwU23MwvmV0Ty3pJ0p5WQfm3JRHOytSIqD9LB7Bq7xdQ==",
"cpu": [ "cpu": [
"arm64" "arm64"
], ],
@ -221,9 +221,9 @@
] ]
}, },
"node_modules/@rollup/rollup-linux-arm64-musl": { "node_modules/@rollup/rollup-linux-arm64-musl": {
"version": "4.34.8", "version": "4.39.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.34.8.tgz", "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.39.0.tgz",
"integrity": "sha512-KdSfaROOUJXgTVxJNAZ3KwkRc5nggDk+06P6lgi1HLv1hskgvxHUKZ4xtwHkVYJ1Rep4GNo+uEfycCRRxht7+Q==", "integrity": "sha512-vYanR6MtqC7Z2SNr8gzVnzUul09Wi1kZqJaek3KcIlI/wq5Xtq4ZPIZ0Mr/st/sv/NnaPwy/D4yXg5x0B3aUUA==",
"cpu": [ "cpu": [
"arm64" "arm64"
], ],
@ -235,9 +235,9 @@
] ]
}, },
"node_modules/@rollup/rollup-linux-loongarch64-gnu": { "node_modules/@rollup/rollup-linux-loongarch64-gnu": {
"version": "4.34.8", "version": "4.39.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loongarch64-gnu/-/rollup-linux-loongarch64-gnu-4.34.8.tgz", "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loongarch64-gnu/-/rollup-linux-loongarch64-gnu-4.39.0.tgz",
"integrity": "sha512-NyF4gcxwkMFRjgXBM6g2lkT58OWztZvw5KkV2K0qqSnUEqCVcqdh2jN4gQrTn/YUpAcNKyFHfoOZEer9nwo6uQ==", "integrity": "sha512-NMRUT40+h0FBa5fb+cpxtZoGAggRem16ocVKIv5gDB5uLDgBIwrIsXlGqYbLwW8YyO3WVTk1FkFDjMETYlDqiw==",
"cpu": [ "cpu": [
"loong64" "loong64"
], ],
@ -249,9 +249,9 @@
] ]
}, },
"node_modules/@rollup/rollup-linux-powerpc64le-gnu": { "node_modules/@rollup/rollup-linux-powerpc64le-gnu": {
"version": "4.34.8", "version": "4.39.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.34.8.tgz", "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.39.0.tgz",
"integrity": "sha512-LMJc999GkhGvktHU85zNTDImZVUCJ1z/MbAJTnviiWmmjyckP5aQsHtcujMjpNdMZPT2rQEDBlJfubhs3jsMfw==", "integrity": "sha512-0pCNnmxgduJ3YRt+D+kJ6Ai/r+TaePu9ZLENl+ZDV/CdVczXl95CbIiwwswu4L+K7uOIGf6tMo2vm8uadRaICQ==",
"cpu": [ "cpu": [
"ppc64" "ppc64"
], ],
@ -263,9 +263,23 @@
] ]
}, },
"node_modules/@rollup/rollup-linux-riscv64-gnu": { "node_modules/@rollup/rollup-linux-riscv64-gnu": {
"version": "4.34.8", "version": "4.39.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.34.8.tgz", "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.39.0.tgz",
"integrity": "sha512-xAQCAHPj8nJq1PI3z8CIZzXuXCstquz7cIOL73HHdXiRcKk8Ywwqtx2wrIy23EcTn4aZ2fLJNBB8d0tQENPCmw==", "integrity": "sha512-t7j5Zhr7S4bBtksT73bO6c3Qa2AV/HqiGlj9+KB3gNF5upcVkx+HLgxTm8DK4OkzsOYqbdqbLKwvGMhylJCPhQ==",
"cpu": [
"riscv64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
]
},
"node_modules/@rollup/rollup-linux-riscv64-musl": {
"version": "4.39.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.39.0.tgz",
"integrity": "sha512-m6cwI86IvQ7M93MQ2RF5SP8tUjD39Y7rjb1qjHgYh28uAPVU8+k/xYWvxRO3/tBN2pZkSMa5RjnPuUIbrwVxeA==",
"cpu": [ "cpu": [
"riscv64" "riscv64"
], ],
@ -277,9 +291,9 @@
] ]
}, },
"node_modules/@rollup/rollup-linux-s390x-gnu": { "node_modules/@rollup/rollup-linux-s390x-gnu": {
"version": "4.34.8", "version": "4.39.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.34.8.tgz", "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.39.0.tgz",
"integrity": "sha512-DdePVk1NDEuc3fOe3dPPTb+rjMtuFw89gw6gVWxQFAuEqqSdDKnrwzZHrUYdac7A7dXl9Q2Vflxpme15gUWQFA==", "integrity": "sha512-iRDJd2ebMunnk2rsSBYlsptCyuINvxUfGwOUldjv5M4tpa93K8tFMeYGpNk2+Nxl+OBJnBzy2/JCscGeO507kA==",
"cpu": [ "cpu": [
"s390x" "s390x"
], ],
@ -291,9 +305,9 @@
] ]
}, },
"node_modules/@rollup/rollup-linux-x64-gnu": { "node_modules/@rollup/rollup-linux-x64-gnu": {
"version": "4.34.8", "version": "4.39.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.34.8.tgz", "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.39.0.tgz",
"integrity": "sha512-8y7ED8gjxITUltTUEJLQdgpbPh1sUQ0kMTmufRF/Ns5tI9TNMNlhWtmPKKHCU0SilX+3MJkZ0zERYYGIVBYHIA==", "integrity": "sha512-t9jqYw27R6Lx0XKfEFe5vUeEJ5pF3SGIM6gTfONSMb7DuG6z6wfj2yjcoZxHg129veTqU7+wOhY6GX8wmf90dA==",
"cpu": [ "cpu": [
"x64" "x64"
], ],
@ -305,9 +319,9 @@
] ]
}, },
"node_modules/@rollup/rollup-linux-x64-musl": { "node_modules/@rollup/rollup-linux-x64-musl": {
"version": "4.34.8", "version": "4.39.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.34.8.tgz", "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.39.0.tgz",
"integrity": "sha512-SCXcP0ZpGFIe7Ge+McxY5zKxiEI5ra+GT3QRxL0pMMtxPfpyLAKleZODi1zdRHkz5/BhueUrYtYVgubqe9JBNQ==", "integrity": "sha512-ThFdkrFDP55AIsIZDKSBWEt/JcWlCzydbZHinZ0F/r1h83qbGeenCt/G/wG2O0reuENDD2tawfAj2s8VK7Bugg==",
"cpu": [ "cpu": [
"x64" "x64"
], ],
@ -319,9 +333,9 @@
] ]
}, },
"node_modules/@rollup/rollup-win32-arm64-msvc": { "node_modules/@rollup/rollup-win32-arm64-msvc": {
"version": "4.34.8", "version": "4.39.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.34.8.tgz", "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.39.0.tgz",
"integrity": "sha512-YHYsgzZgFJzTRbth4h7Or0m5O74Yda+hLin0irAIobkLQFRQd1qWmnoVfwmKm9TXIZVAD0nZ+GEb2ICicLyCnQ==", "integrity": "sha512-jDrLm6yUtbOg2TYB3sBF3acUnAwsIksEYjLeHL+TJv9jg+TmTwdyjnDex27jqEMakNKf3RwwPahDIt7QXCSqRQ==",
"cpu": [ "cpu": [
"arm64" "arm64"
], ],
@ -333,9 +347,9 @@
] ]
}, },
"node_modules/@rollup/rollup-win32-ia32-msvc": { "node_modules/@rollup/rollup-win32-ia32-msvc": {
"version": "4.34.8", "version": "4.39.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.34.8.tgz", "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.39.0.tgz",
"integrity": "sha512-r3NRQrXkHr4uWy5TOjTpTYojR9XmF0j/RYgKCef+Ag46FWUTltm5ziticv8LdNsDMehjJ543x/+TJAek/xBA2w==", "integrity": "sha512-6w9uMuza+LbLCVoNKL5FSLE7yvYkq9laSd09bwS0tMjkwXrmib/4KmoJcrKhLWHvw19mwU+33ndC69T7weNNjQ==",
"cpu": [ "cpu": [
"ia32" "ia32"
], ],
@ -347,9 +361,9 @@
] ]
}, },
"node_modules/@rollup/rollup-win32-x64-msvc": { "node_modules/@rollup/rollup-win32-x64-msvc": {
"version": "4.34.8", "version": "4.39.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.34.8.tgz", "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.39.0.tgz",
"integrity": "sha512-U0FaE5O1BCpZSeE6gBl3c5ObhePQSfk9vDRToMmTkbhCOgW4jqvtS5LGyQ76L1fH8sM0keRp4uDTsbjiUyjk0g==", "integrity": "sha512-yAkUOkIKZlK5dl7u6dg897doBgLXmUHhIINM2c+sND3DZwnrdQkkSiDh7N75Ll4mM4dxSkYfXqU9fW3lLkMFug==",
"cpu": [ "cpu": [
"x64" "x64"
], ],
@ -361,9 +375,9 @@
] ]
}, },
"node_modules/@types/estree": { "node_modules/@types/estree": {
"version": "1.0.6", "version": "1.0.7",
"resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.6.tgz", "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.7.tgz",
"integrity": "sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==", "integrity": "sha512-w28IoSUCJpidD/TGviZwwMJckNESJZXFu7NBZ5YJ4mEUnNraUn9Pm8HSZm/jDF1pDWYKspWE7oVphigUPRakIQ==",
"dev": true, "dev": true,
"license": "MIT" "license": "MIT"
}, },
@ -702,13 +716,13 @@
} }
}, },
"node_modules/rollup": { "node_modules/rollup": {
"version": "4.34.8", "version": "4.39.0",
"resolved": "https://registry.npmjs.org/rollup/-/rollup-4.34.8.tgz", "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.39.0.tgz",
"integrity": "sha512-489gTVMzAYdiZHFVA/ig/iYFllCcWFHMvUHI1rpFmkoUtRlQxqh6/yiNqnYibjMZ2b/+FUQwldG+aLsEt6bglQ==", "integrity": "sha512-thI8kNc02yNvnmJp8dr3fNWJ9tCONDhp6TV35X6HkKGGs9E6q7YWCHbe5vKiTa7TAiNcFEmXKj3X/pG2b3ci0g==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@types/estree": "1.0.6" "@types/estree": "1.0.7"
}, },
"bin": { "bin": {
"rollup": "dist/bin/rollup" "rollup": "dist/bin/rollup"
@ -718,25 +732,26 @@
"npm": ">=8.0.0" "npm": ">=8.0.0"
}, },
"optionalDependencies": { "optionalDependencies": {
"@rollup/rollup-android-arm-eabi": "4.34.8", "@rollup/rollup-android-arm-eabi": "4.39.0",
"@rollup/rollup-android-arm64": "4.34.8", "@rollup/rollup-android-arm64": "4.39.0",
"@rollup/rollup-darwin-arm64": "4.34.8", "@rollup/rollup-darwin-arm64": "4.39.0",
"@rollup/rollup-darwin-x64": "4.34.8", "@rollup/rollup-darwin-x64": "4.39.0",
"@rollup/rollup-freebsd-arm64": "4.34.8", "@rollup/rollup-freebsd-arm64": "4.39.0",
"@rollup/rollup-freebsd-x64": "4.34.8", "@rollup/rollup-freebsd-x64": "4.39.0",
"@rollup/rollup-linux-arm-gnueabihf": "4.34.8", "@rollup/rollup-linux-arm-gnueabihf": "4.39.0",
"@rollup/rollup-linux-arm-musleabihf": "4.34.8", "@rollup/rollup-linux-arm-musleabihf": "4.39.0",
"@rollup/rollup-linux-arm64-gnu": "4.34.8", "@rollup/rollup-linux-arm64-gnu": "4.39.0",
"@rollup/rollup-linux-arm64-musl": "4.34.8", "@rollup/rollup-linux-arm64-musl": "4.39.0",
"@rollup/rollup-linux-loongarch64-gnu": "4.34.8", "@rollup/rollup-linux-loongarch64-gnu": "4.39.0",
"@rollup/rollup-linux-powerpc64le-gnu": "4.34.8", "@rollup/rollup-linux-powerpc64le-gnu": "4.39.0",
"@rollup/rollup-linux-riscv64-gnu": "4.34.8", "@rollup/rollup-linux-riscv64-gnu": "4.39.0",
"@rollup/rollup-linux-s390x-gnu": "4.34.8", "@rollup/rollup-linux-riscv64-musl": "4.39.0",
"@rollup/rollup-linux-x64-gnu": "4.34.8", "@rollup/rollup-linux-s390x-gnu": "4.39.0",
"@rollup/rollup-linux-x64-musl": "4.34.8", "@rollup/rollup-linux-x64-gnu": "4.39.0",
"@rollup/rollup-win32-arm64-msvc": "4.34.8", "@rollup/rollup-linux-x64-musl": "4.39.0",
"@rollup/rollup-win32-ia32-msvc": "4.34.8", "@rollup/rollup-win32-arm64-msvc": "4.39.0",
"@rollup/rollup-win32-x64-msvc": "4.34.8", "@rollup/rollup-win32-ia32-msvc": "4.39.0",
"@rollup/rollup-win32-x64-msvc": "4.39.0",
"fsevents": "~2.3.2" "fsevents": "~2.3.2"
} }
}, },

View File

@ -1,6 +1,6 @@
{ {
"name": "@idotj/mastodon-embed-timeline", "name": "@idotj/mastodon-embed-timeline",
"version": "4.6.0", "version": "4.7.0",
"description": "Displays a Mastodon timeline with posts embed in your website. Very easy to setup, no dependencies, no trackers, cross-browser, WCAG compliant and fully responsive.", "description": "Displays a Mastodon timeline with posts embed in your website. Very easy to setup, no dependencies, no trackers, cross-browser, WCAG compliant and fully responsive.",
"license": "GNU", "license": "GNU",
"author": { "author": {
@ -34,7 +34,7 @@
}, },
"devDependencies": { "devDependencies": {
"clean-css-cli": "^5.6.3", "clean-css-cli": "^5.6.3",
"rollup": "^4.34.8", "rollup": "^4.39.0",
"@rollup/plugin-terser": "^0.4.4" "@rollup/plugin-terser": "^0.4.4"
}, },
"files": [ "files": [

View File

@ -1,4 +1,4 @@
/* Mastodon embed timeline v4.6.0 */ /* Mastodon embed timeline v4.7.0 */
/* More info at: */ /* More info at: */
/* https://gitlab.com/idotj/mastodon-embed-timeline */ /* https://gitlab.com/idotj/mastodon-embed-timeline */

View File

@ -1,7 +1,7 @@
/** /**
* Mastodon embed timeline * Mastodon embed timeline
* @author idotj * @author idotj
* @version 4.6.0 * @version 4.7.0
* @url https://gitlab.com/idotj/mastodon-embed-timeline * @url https://gitlab.com/idotj/mastodon-embed-timeline
* @license GNU AGPLv3 * @license GNU AGPLv3
*/ */
@ -101,11 +101,6 @@ export class Init {
* Find main container in DOM before building the timeline * Find main container in DOM before building the timeline
*/ */
#getContainerNode() { #getContainerNode() {
// console.log(
// "Initializing Mastodon timeline with settings: ",
// this.mtSettings
// );
const assignContainerNode = () => { const assignContainerNode = () => {
this.mtContainerNode = document.getElementById( this.mtContainerNode = document.getElementById(
this.mtSettings.mtContainerId this.mtSettings.mtContainerId
@ -212,12 +207,11 @@ export class Init {
const urls = this.#setUrls(instanceApiUrl); const urls = this.#setUrls(instanceApiUrl);
const urlsPromises = Object.entries(urls).map(([key, url]) => { const urlsPromises = Object.entries(urls).map(([key, url]) => {
const headers = key === "timeline"; return this.#fetchData(url, key)
return this.#fetchData(url, headers)
.then((data) => ({ [key]: data })) .then((data) => ({ [key]: data }))
.catch((error) => { .catch((error) => {
reject( reject(
new Error(`Something went wrong fetching data from: ${url}`) new Error(`Something went wrong getting the timeline data.`)
); );
this.#showError(error.message); this.#showError(error.message);
return { [key]: [] }; return { [key]: [] };
@ -269,6 +263,8 @@ export class Init {
timelineType, timelineType,
userId, userId,
hashtagName, hashtagName,
hideReblog,
hideReplies,
maxNbPostFetch, maxNbPostFetch,
hidePinnedPosts, hidePinnedPosts,
hideEmojos, hideEmojos,
@ -313,6 +309,14 @@ export class Init {
); );
} }
if (hideReblog) {
urls.timeline += "&exclude_reblogs=true";
}
if (hideReplies) {
urls.timeline += "&exclude_replies=true";
}
if (!hideEmojos) { if (!hideEmojos) {
urls.emojos = `${i}custom_emojis`; urls.emojos = `${i}custom_emojis`;
} }
@ -323,10 +327,10 @@ export class Init {
/** /**
* Fetch data from server * Fetch data from server
* @param {String} u Url address to fetch * @param {String} u Url address to fetch
* @param {Boolean} h gets the link header * @param {String} t Type of data to request
* @returns {Array} List of objects * @returns {Array} List of objects
*/ */
async #fetchData(u, h = false) { async #fetchData(u, t) {
const response = await fetch(u); const response = await fetch(u);
if (!response.ok) { if (!response.ok) {
@ -338,7 +342,7 @@ export class Init {
const data = await response.json(); const data = await response.json();
// Get Link headers for pagination // Get Link headers for pagination
if (h && response.headers.get("Link")) { if (t === "timeline" && response.headers.get("Link")) {
this.linkHeader = this.#parseLinkHeader(response.headers.get("Link")); this.linkHeader = this.#parseLinkHeader(response.headers.get("Link"));
} }
@ -361,10 +365,16 @@ export class Init {
#fetchMorePosts() { #fetchMorePosts() {
return new Promise((resolve) => { return new Promise((resolve) => {
if (this.linkHeader.next) { if (this.linkHeader.next) {
this.#fetchData(this.linkHeader.next, true).then((data) => { this.#fetchData(this.linkHeader.next, "timeline")
this.fetchedData.timeline = [...this.fetchedData.timeline, ...data]; .then((data) => {
resolve(); this.fetchedData.timeline = [...this.fetchedData.timeline, ...data];
}); resolve();
})
.catch((error) => {
reject(new Error(`Something went wrong fetching more posts.`));
this.#showError(error.message);
return { [key]: [] };
});
} else { } else {
resolve(); resolve();
} }
@ -392,15 +402,7 @@ export class Init {
*/ */
async #buildTimeline(t) { async #buildTimeline(t) {
await this.#getTimelineData(); await this.#getTimelineData();
// console.log("Mastodon timeline data fetched: ", this.fetchedData); const { hideUnlisted, maxNbPostShow, filterByLanguage } = this.mtSettings;
const {
hideUnlisted,
hideReblog,
hideReplies,
maxNbPostShow,
filterByLanguage,
} = this.mtSettings;
const posts = this.fetchedData.timeline; const posts = this.fetchedData.timeline;
let nbPostToShow = 0; let nbPostToShow = 0;
this.mtBodyNode.replaceChildren(); this.mtBodyNode.replaceChildren();
@ -409,19 +411,12 @@ export class Init {
const isPublicOrUnlisted = const isPublicOrUnlisted =
post.visibility === "public" || post.visibility === "public" ||
(!hideUnlisted && post.visibility === "unlisted"); (!hideUnlisted && post.visibility === "unlisted");
const shouldHideReblog = hideReblog && post.reblog;
const shouldHideReplies = hideReplies && post.in_reply_to_id;
const postLanguage = const postLanguage =
post.language || (post.reblog ? post.reblog.language : null); post.language || (post.reblog ? post.reblog.language : null);
const matchesLanguage = const matchesLanguage =
filterByLanguage === "" || postLanguage === filterByLanguage; filterByLanguage === "" || postLanguage === filterByLanguage;
return ( return isPublicOrUnlisted && matchesLanguage;
isPublicOrUnlisted &&
!shouldHideReblog &&
!shouldHideReplies &&
matchesLanguage
);
}); });
filteredPosts.forEach((post, index) => { filteredPosts.forEach((post, index) => {
@ -592,6 +587,12 @@ export class Init {
"</a>" + "</a>" +
"</div>"; "</div>";
// Preview link
const previewLinkHTML =
!this.mtSettings.hidePreviewLink && (c.card || c.reblog?.card)
? this.#createPreviewLink(!isReblog ? c.card : c.reblog.card)
: "";
// Post text // Post text
const hasTxtMaxLines = this.mtSettings.txtMaxLines !== "0"; const hasTxtMaxLines = this.mtSettings.txtMaxLines !== "0";
const txtTruncateCss = const txtTruncateCss =
@ -604,6 +605,7 @@ export class Init {
"</button>" + "</button>" +
'<div class="spoiler-txt-hidden">' + '<div class="spoiler-txt-hidden">' +
this.#formatPostText(post.content) + this.#formatPostText(post.content) +
previewLinkHTML +
"</div>"; "</div>";
if (textSource) { if (textSource) {
@ -630,12 +632,6 @@ export class Init {
? `<div class="mt-post-media-wrapper">${media}</div>` ? `<div class="mt-post-media-wrapper">${media}</div>`
: ""; : "";
// Preview link
const previewLinkHTML =
!this.mtSettings.hidePreviewLink && (c.card || c.reblog?.card)
? this.#createPreviewLink(!isReblog ? c.card : c.reblog.card)
: "";
// Poll // Poll
const pollHTML = c.poll const pollHTML = c.poll
? '<div class="mt-post-poll ' + ? '<div class="mt-post-poll ' +
@ -673,8 +669,8 @@ export class Init {
"</div>" + "</div>" +
postTxt + postTxt +
mediaHTML + mediaHTML +
previewLinkHTML +
pollHTML + pollHTML +
(post.spoiler_text ? "" : previewLinkHTML) +
counterBarHTML + counterBarHTML +
"</article>" "</article>"
); );