bep40 commited on
Commit
42b480f
·
verified ·
1 Parent(s): 0e66c09

Delete static/wall_24h_filter.js with huggingface_hub

Browse files
Files changed (1) hide show
  1. static/wall_24h_filter.js +0 -58
static/wall_24h_filter.js DELETED
@@ -1,58 +0,0 @@
1
- /**
2
- * Wall 24h Filter - Patches app_v2.js to only show wall posts from last 24h
3
- * Must load AFTER app_v2.js
4
- */
5
- (function() {
6
- const MAX_AGE_MS = 86400000; // 24h
7
-
8
- // Wait for app_v2.js to define _wallPosts
9
- function patchWall() {
10
- // Intercept loadHome to filter wall
11
- const origLoadHome = window.loadHome;
12
- if (origLoadHome) {
13
- window.loadHome = async function() {
14
- await origLoadHome.call(this);
15
- // Filter _wallPosts to 24h after load
16
- if (window._wallPosts && window._wallPosts.length) {
17
- const now = Date.now();
18
- window._wallPosts = window._wallPosts.filter(p => {
19
- const created = p.created || 0;
20
- const ts = created > 1000000000000 ? created : created * 1000;
21
- return (now - ts) <= MAX_AGE_MS;
22
- });
23
- // Re-render wall with filtered data
24
- const homeEl = document.getElementById('view-home');
25
- const afterEl = document.getElementById('home-after-wc');
26
- if (afterEl && window._renderWallIn) {
27
- // Clear old wall section
28
- document.getElementById('short-ai-section')?.remove();
29
- document.getElementById('ai-wall-wrap')?.remove();
30
- // Re-render
31
- window._renderWallIn(afterEl);
32
- }
33
- }
34
- };
35
- }
36
- }
37
-
38
- // Also patch prependWallPost to check age
39
- const origPrepend = window.prependWallPost;
40
- if (origPrepend) {
41
- window.prependWallPost = function(post) {
42
- const now = Date.now();
43
- const created = post.created || Date.now();
44
- const ts = created > 1000000000000 ? created : created * 1000;
45
- if ((now - ts) > MAX_AGE_MS) return; // Don't add old posts
46
- origPrepend.call(this, post);
47
- };
48
- }
49
-
50
- // Wait for DOM ready
51
- if (document.readyState === 'loading') {
52
- document.addEventListener('DOMContentLoaded', patchWall);
53
- } else {
54
- patchWall();
55
- }
56
-
57
- console.log('[Wall] 24h filter ready');
58
- })();