+9
-6
api.js
+9
-6
api.js
···
306
307
/**
308
* @param {number} days
309
-
* @param {{ onPageLoad?: FetchAllOnPageLoad }} [options]
310
* @returns {Promise<json[]>}
311
*/
312
···
323
let timestamp = x.reason ? x.reason.indexedAt : x.post.record.createdAt;
324
return Date.parse(timestamp) < timeLimit;
325
},
326
-
onPageLoad: options.onPageLoad
327
});
328
}
329
···
343
/**
344
* @param {string} did
345
* @param {number} days
346
-
* @param {{ onPageLoad?: FetchAllOnPageLoad, filter: AuthorFeedFilter }} options
347
* @returns {Promise<json[]>}
348
*/
349
···
362
let timestamp = x.reason ? x.reason.indexedAt : x.post.record.createdAt;
363
return Date.parse(timestamp) < timeLimit;
364
},
365
-
onPageLoad: options.onPageLoad
366
});
367
}
368
···
383
/**
384
* @param {string} list
385
* @param {number} days
386
-
* @param {{ onPageLoad?: FetchAllOnPageLoad }} [options]
387
* @returns {Promise<json[]>}
388
*/
389
···
400
breakWhen: (x) => {
401
return Date.parse(x.post.record.createdAt) < timeLimit;
402
},
403
-
onPageLoad: options.onPageLoad
404
});
405
}
406
···
306
307
/**
308
* @param {number} days
309
+
* @param {{ onPageLoad?: FetchAllOnPageLoad, keepLastPage?: boolean }} [options]
310
* @returns {Promise<json[]>}
311
*/
312
···
323
let timestamp = x.reason ? x.reason.indexedAt : x.post.record.createdAt;
324
return Date.parse(timestamp) < timeLimit;
325
},
326
+
onPageLoad: options.onPageLoad,
327
+
keepLastPage: options.keepLastPage
328
});
329
}
330
···
344
/**
345
* @param {string} did
346
* @param {number} days
347
+
* @param {{ filter: AuthorFeedFilter, onPageLoad?: FetchAllOnPageLoad, keepLastPage?: boolean }} options
348
* @returns {Promise<json[]>}
349
*/
350
···
363
let timestamp = x.reason ? x.reason.indexedAt : x.post.record.createdAt;
364
return Date.parse(timestamp) < timeLimit;
365
},
366
+
onPageLoad: options.onPageLoad,
367
+
keepLastPage: options.keepLastPage
368
});
369
}
370
···
385
/**
386
* @param {string} list
387
* @param {number} days
388
+
* @param {{ onPageLoad?: FetchAllOnPageLoad, keepLastPage?: boolean }} [options]
389
* @returns {Promise<json[]>}
390
*/
391
···
402
breakWhen: (x) => {
403
return Date.parse(x.post.record.createdAt) < timeLimit;
404
},
405
+
onPageLoad: options.onPageLoad,
406
+
keepLastPage: options.keepLastPage
407
});
408
}
409
+5
-1
minisky.js
+5
-1
minisky.js
···
186
* field: string,
187
* params?: json,
188
* breakWhen?: (obj: json) => boolean,
189
* onPageLoad?: FetchAllOnPageLoad | undefined
190
* }} FetchAllOptions
191
*
···
213
let test = options.breakWhen;
214
215
if (items.some(x => test(x))) {
216
-
items = items.filter(x => !test(x));
217
cursor = null;
218
}
219
}
···
186
* field: string,
187
* params?: json,
188
* breakWhen?: (obj: json) => boolean,
189
+
* keepLastPage?: boolean | undefined,
190
* onPageLoad?: FetchAllOnPageLoad | undefined
191
* }} FetchAllOptions
192
*
···
214
let test = options.breakWhen;
215
216
if (items.some(x => test(x))) {
217
+
if (!options.keepLastPage) {
218
+
items = items.filter(x => !test(x));
219
+
}
220
+
221
cursor = null;
222
}
223
}
+24
-10
posting_stats_page.js
+24
-10
posting_stats_page.js
···
122
let scanType = this.form.elements['scan_type'].value;
123
124
if (scanType == 'home') {
125
-
let items = await accountAPI.loadHomeTimeline(requestedDays, { onPageLoad });
126
127
if (this.scanStartTime != startTime) {
128
return;
···
132
} else if (scanType == 'list') {
133
let select = $(this.pageElement.querySelector('.list-choice select'), HTMLSelectElement);
134
let list = select.value;
135
-
let items = await accountAPI.loadListTimeline(list, requestedDays, { onPageLoad });
136
137
if (this.scanStartTime != startTime) {
138
return;
···
142
} else {
143
let items = await accountAPI.loadUserTimeline(accountAPI.user.did, requestedDays, {
144
filter: 'posts_no_replies',
145
-
onPageLoad: onPageLoad
146
});
147
148
if (this.scanStartTime != startTime) {
···
204
205
let lastTimestamp = last.reason ? last.reason.indexedAt : last.post.record.createdAt;
206
let lastDate = Date.parse(lastTimestamp);
207
-
let daysBack = (startTime - lastDate) / 86400 / 1000;
208
209
for (let item of items) {
210
if (item.reply) { continue; }
···
300
}
301
302
tbody.append(tr);
303
-
}
304
-
305
-
if (Math.ceil(daysBack) < requestedDays) {
306
-
let scanInfo = $(this.pageElement.querySelector('.scan-info'));
307
-
scanInfo.innerText = `🕓 Showing data from ${Math.round(daysBack)} days (your timeline only goes that far):`;
308
-
scanInfo.style.display = 'block';
309
}
310
311
this.table.style.display = 'table';
···
122
let scanType = this.form.elements['scan_type'].value;
123
124
if (scanType == 'home') {
125
+
let items = await accountAPI.loadHomeTimeline(requestedDays, {
126
+
onPageLoad: onPageLoad,
127
+
keepLastPage: true
128
+
});
129
130
if (this.scanStartTime != startTime) {
131
return;
···
135
} else if (scanType == 'list') {
136
let select = $(this.pageElement.querySelector('.list-choice select'), HTMLSelectElement);
137
let list = select.value;
138
+
let items = await accountAPI.loadListTimeline(list, requestedDays, {
139
+
onPageLoad: onPageLoad,
140
+
keepLastPage: true
141
+
});
142
143
if (this.scanStartTime != startTime) {
144
return;
···
148
} else {
149
let items = await accountAPI.loadUserTimeline(accountAPI.user.did, requestedDays, {
150
filter: 'posts_no_replies',
151
+
onPageLoad: onPageLoad,
152
+
keepLastPage: true
153
});
154
155
if (this.scanStartTime != startTime) {
···
211
212
let lastTimestamp = last.reason ? last.reason.indexedAt : last.post.record.createdAt;
213
let lastDate = Date.parse(lastTimestamp);
214
+
let fetchedDays = (startTime - lastDate) / 86400 / 1000;
215
+
216
+
if (Math.ceil(fetchedDays) < requestedDays) {
217
+
let scanInfo = $(this.pageElement.querySelector('.scan-info'));
218
+
scanInfo.innerText = `🕓 Showing data from ${Math.round(fetchedDays)} days (the timeline only goes that far):`;
219
+
scanInfo.style.display = 'block';
220
+
}
221
+
222
+
items = items.filter(x => {
223
+
let timestamp = x.reason ? x.reason.indexedAt : x.post.record.createdAt;
224
+
return Date.parse(timestamp) > startTime - requestedDays * 86400 * 1000;
225
+
});
226
+
227
+
let daysBack = Math.min(requestedDays, fetchedDays);
228
229
for (let item of items) {
230
if (item.reply) { continue; }
···
320
}
321
322
tbody.append(tr);
323
}
324
325
this.table.style.display = 'table';