Add toot embedding

This commit is contained in:
2024-07-09 11:39:02 -05:00
parent e55fa73d92
commit 54ec74c6ed
6 changed files with 217 additions and 39 deletions

View File

@ -25,27 +25,8 @@
</wc-comment>
</template>
<script>
const monthMap = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
const dateSuffixAdder = (date) => {
if (date > 9 && date < 20) {
return "th";
} else {
let dateString = date < 10 ? "0" + date : "" + date;
if (dateString[1] < 4 && dateString[1] > 0) {
return dateString[1] == 1 ? "st" :
dateString[1] == 2 ? "nd" :
dateString[1] == 3 ? "rd" : null;
} else {
return "th"
}
}
}
const timeFormatter = (hours, minutes) => {
return `${hours < 12 ? hours : hours - 12}:${minutes < 10 ? "0" : ""}${minutes} ${hours < 12 ? "AM" : "PM"}`
}
<script type="module">
import {dateSuffixAdder, monthMap, timeFormatter} from "../../js/modules/mastodonDateTools.js";
const renderComment = (comment, target, parentIdm) => {
const node = document