More closely match Mastodon's way of counting posts.
rodzic
7af6a72859
commit
cec967ddd7
|
@ -13,7 +13,7 @@ import sortArrayOfObjects from"/js/modules/sortArrayOfObjects.min.js";import get
|
||||||
<img class="img-thumbnail" width="64" height="64" src="${s.avatar_url}">
|
<img class="img-thumbnail" width="64" height="64" src="${s.avatar_url}">
|
||||||
`:s.avatar&&(userAvatar.innerHTML=`
|
`:s.avatar&&(userAvatar.innerHTML=`
|
||||||
<img class="img-thumbnail" width="64" height="64" src="data:image/jpg;base64,${s.avatar}">
|
<img class="img-thumbnail" width="64" height="64" src="data:image/jpg;base64,${s.avatar}">
|
||||||
`)):(userInfo.remove(),userDescription.remove()),[]),o;s?.outbox?.orderedItems?r=s.outbox.orderedItems:s?.outbox&&(r=s.outbox),i=r.length;let n=[],l={posts:0,replies:0,reblogs:0,total:0};if(i){const m=Math.ceil(Math.pow(r.length,.1));let s=0;o=r[0],r.forEach(t=>{let o=!1;if([...t.to,...t.cc].forEach(e=>{e.endsWith("/followers")&&(o=!0)}),o){if(s++,10<=r.length&&s<=m){const t=r[Math.pow(10,s)];var a=t.id.replace("/activity","");let e=!1;t.object.id||(e=!0),a={label:[Math.pow(10,s).toLocaleString()+"th post"],url:a,isBoost:e},n.push(a)}l.total++,"Create"===t.type?t.object.inReplyTo?l.replies++:l.posts++:l.reblogs++}})}var i={weekday:"long",year:"numeric",month:"long",day:"numeric"};s.actor&&(d=moment(s.actor.published),d=moment().diff(d,"days"),t+=`
|
`)):(userInfo.remove(),userDescription.remove()),[]),o;s?.outbox?.orderedItems?r=s.outbox.orderedItems:s?.outbox&&(r=s.outbox),i=r.length;let n=[],l={posts:0,replies:0,reblogs:0,total:0};if(i){const c=Math.ceil(Math.pow(r.length,.1));let s=0;o=r[0],r.forEach(t=>{let o=!1;if([...t.to,...t.cc].forEach(e=>{e.endsWith("/followers")&&(o=!0)}),o){if(s++,10<=r.length&&s<=c){const t=r[Math.pow(10,s)];var a=t.id.replace("/activity","");let e=!1;t.object.id||(e=!0),a={label:[Math.pow(10,s).toLocaleString()+"th post"],url:a,isBoost:e},n.push(a)}if(l.total++,"Create"===t.type)t.object.inReplyTo?l.replies++:l.posts++;else try{t.id&&t.object&&t.id.split("/users/")[0]===t.object.split("/users/")[0]?(console.log(t),l.posts++,l.total++):l.reblogs++}catch(e){}}})}var i={weekday:"long",year:"numeric",month:"long",day:"numeric"};s.actor&&(d=moment(s.actor.published),d=moment().diff(d,"days"),t+=`
|
||||||
<p>
|
<p>
|
||||||
You created your account on <strong>${new Date(s.actor.published).toLocaleDateString(void 0,i)}</strong>, which is <strong>${d.toLocaleString()} day(s) ago</strong>. Since then, you posted <strong>${l.total.toLocaleString()} times</strong>, or about ${Math.round(l.total/d).toLocaleString()} time(s) a day on average.
|
You created your account on <strong>${new Date(s.actor.published).toLocaleDateString(void 0,i)}</strong>, which is <strong>${d.toLocaleString()} day(s) ago</strong>. Since then, you posted <strong>${l.total.toLocaleString()} times</strong>, or about ${Math.round(l.total/d).toLocaleString()} time(s) a day on average.
|
||||||
</p>
|
</p>
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -112,8 +112,8 @@ const handleUpload = () => {
|
||||||
let isSemiPublic = false;
|
let isSemiPublic = false;
|
||||||
const recipients = [...post.to, ...post.cc];
|
const recipients = [...post.to, ...post.cc];
|
||||||
|
|
||||||
recipients.forEach(recipient => {
|
recipients.forEach((recipient) => {
|
||||||
if (recipient.endsWith("/followers")){
|
if (recipient.endsWith("/followers")) {
|
||||||
isSemiPublic = true;
|
isSemiPublic = true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -139,13 +139,6 @@ const handleUpload = () => {
|
||||||
|
|
||||||
milestones.push(milestone);
|
milestones.push(milestone);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
counter.total++;
|
counter.total++;
|
||||||
if (post.type === "Create") {
|
if (post.type === "Create") {
|
||||||
if (post.object.inReplyTo) {
|
if (post.object.inReplyTo) {
|
||||||
|
@ -154,7 +147,22 @@ const handleUpload = () => {
|
||||||
counter.posts++;
|
counter.posts++;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
counter.reblogs++;
|
try {
|
||||||
|
if (
|
||||||
|
post.id &&
|
||||||
|
post.object &&
|
||||||
|
post.id.split("/users/")[0] ===
|
||||||
|
post.object.split("/users/")[0]
|
||||||
|
) {
|
||||||
|
console.log(post);
|
||||||
|
counter.posts++;
|
||||||
|
counter.total++;
|
||||||
|
} else {
|
||||||
|
counter.reblogs++;
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
/*noop*/
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// console.log(post.id.replace("users/", "@").replace("statuses/", "").replace("/activity", ""), recipients);
|
// console.log(post.id.replace("users/", "@").replace("statuses/", "").replace("/activity", ""), recipients);
|
||||||
|
@ -193,13 +201,6 @@ const handleUpload = () => {
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
counter = {
|
|
||||||
posts: 0,
|
|
||||||
replies: 0,
|
|
||||||
reblogs: 0,
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (counter.reblogs > 0 || counter.replies > 0) {
|
if (counter.reblogs > 0 || counter.replies > 0) {
|
||||||
userDataBreakdownHTML += `
|
userDataBreakdownHTML += `
|
||||||
<p>
|
<p>
|
||||||
|
|
Ładowanie…
Reference in New Issue