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