mirror of
https://gitlab.com/idotj/mastodon-embed-timeline.git
synced 2025-05-24 08:52:46 +00:00
Update README.md
This commit is contained in:
parent
f6681873e5
commit
4e6bb3b39f
18
README.md
18
README.md
@ -10,7 +10,7 @@ Demo running:
|
|||||||
## 📋 Table of contents
|
## 📋 Table of contents
|
||||||
|
|
||||||
- [**Installation**](#installation)
|
- [**Installation**](#installation)
|
||||||
- [**Usage**](#usage)
|
- [**Setup**](#setup)
|
||||||
- [Initialize](#initialize)
|
- [Initialize](#initialize)
|
||||||
- [Local timeline](#local-timeline)
|
- [Local timeline](#local-timeline)
|
||||||
- [Profile timeline](#profile-timeline)
|
- [Profile timeline](#profile-timeline)
|
||||||
@ -45,11 +45,14 @@ Now call the CSS and JS files in your HTML page using the `<link>` and `<script>
|
|||||||
|
|
||||||
<!-- JavaScript -->
|
<!-- JavaScript -->
|
||||||
<script src="path/to/mastodon-timeline.min.js"></script>
|
<script src="path/to/mastodon-timeline.min.js"></script>
|
||||||
|
<script>
|
||||||
|
<!-- You can initialize the script here -->
|
||||||
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
```
|
```
|
||||||
|
|
||||||
## Usage
|
## Setup
|
||||||
|
|
||||||
### Initialize
|
### Initialize
|
||||||
|
|
||||||
@ -71,7 +74,7 @@ const myTimeline = new MastodonTimeline();
|
|||||||
|
|
||||||
By default it will show a timeline with 20 posts from the instance [mastodon.social](https://mastodon.social/public/local)
|
By default it will show a timeline with 20 posts from the instance [mastodon.social](https://mastodon.social/public/local)
|
||||||
|
|
||||||
ℹ️ If you are trying to initialize the script before `mastodon-timeline.js` is loaded, you will probably get such an error: "_MastodonTimeline is not defined_". To fix that initialize the script by running:
|
ℹ️ If you are trying to initialize the script before `mastodon-timeline.min.js` is loaded, you will probably get such an error: "_MastodonTimeline is not defined_". To fix that initialize the script by running:
|
||||||
|
|
||||||
```js
|
```js
|
||||||
window.addEventListener("load", () => {
|
window.addEventListener("load", () => {
|
||||||
@ -79,6 +82,8 @@ window.addEventListener("load", () => {
|
|||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
|
The next step is to configure the options/values of your timeline according to the type you need. There are three types, **Local**, **Profile** and **Hashtag**:
|
||||||
|
|
||||||
#### Local timeline
|
#### Local timeline
|
||||||
|
|
||||||
Add the following option/value when initializing the timeline:
|
Add the following option/value when initializing the timeline:
|
||||||
@ -131,7 +136,7 @@ It will show a timeline with posts containing the hashtag [#fediverse](https://m
|
|||||||
|
|
||||||
### Customize
|
### Customize
|
||||||
|
|
||||||
You can pass more options/values to personalize your timeline:
|
You can pass more options/values to personalize your timeline. Here you have all the available options:
|
||||||
|
|
||||||
```js
|
```js
|
||||||
// Id of the <div> containing the timeline
|
// Id of the <div> containing the timeline
|
||||||
@ -210,7 +215,7 @@ You can pass more options/values to personalize your timeline:
|
|||||||
|
|
||||||
| Function | Description |
|
| Function | Description |
|
||||||
| --- | --- |
|
| --- | --- |
|
||||||
| `mtColorTheme(themeType)` | Apply a theme color. `themeType` accepts only two values: `light` or `dark` |
|
| `mtColorTheme(themeType)` | Apply a theme color. `themeType` accepts only two values: `'light'` or `'dark'` |
|
||||||
| `mtUpdate()` | Reload the timeline by fetching the lastest posts |
|
| `mtUpdate()` | Reload the timeline by fetching the lastest posts |
|
||||||
|
|
||||||
### Examples
|
### Examples
|
||||||
@ -248,4 +253,5 @@ Check the [closed issues](https://gitlab.com/idotj/mastodon-embed-feed-timeline/
|
|||||||
|
|
||||||
If nothing matches with your problem, check the [open issues](https://gitlab.com/idotj/mastodon-embed-feed-timeline/-/issues/?sort=created_date&state=opened&first_page_size=20) or feel free to create a new one.
|
If nothing matches with your problem, check the [open issues](https://gitlab.com/idotj/mastodon-embed-feed-timeline/-/issues/?sort=created_date&state=opened&first_page_size=20) or feel free to create a new one.
|
||||||
|
|
||||||
Looking for a previous version of Mastodon embed timeline? Check on the tags list to see all the released versions: [Tags version history](https://gitlab.com/idotj/mastodon-embed-feed-timeline/-/tags)
|
Looking for a previous version of Mastodon embed timeline?
|
||||||
|
Check on the tags list to see all the released versions: [Tags version history](https://gitlab.com/idotj/mastodon-embed-feed-timeline/-/tags)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user