diribes commited on
Commit
e89cd31
·
verified ·
1 Parent(s): 06fd8a3

crea un sitio que recoja todos los papers sobre inteligencia artificial que se pueda filtrar por fechas y que sirva como plataforma para consultar los papers que se van publicando

Browse files
Files changed (7) hide show
  1. README.md +8 -5
  2. components/footer.js +91 -0
  3. components/navbar.js +95 -0
  4. components/paper-card.js +182 -0
  5. index.html +124 -19
  6. script.js +178 -0
  7. style.css +59 -18
README.md CHANGED
@@ -1,10 +1,13 @@
1
  ---
2
- title: Synapse Search
3
- emoji: 💻
4
- colorFrom: pink
5
- colorTo: red
6
  sdk: static
7
  pinned: false
 
 
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
1
  ---
2
+ title: Synapse Search 🧠
3
+ colorFrom: red
4
+ colorTo: yellow
5
+ emoji: 🐳
6
  sdk: static
7
  pinned: false
8
+ tags:
9
+ - deepsite-v3
10
  ---
11
 
12
+ # Welcome to your new DeepSite project!
13
+ This project was created with [DeepSite](https://huggingface.co/deepsite).
components/footer.js ADDED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ class SiteFooter extends HTMLElement {
2
+ connectedCallback() {
3
+ this.attachShadow({ mode: 'open' });
4
+ this.shadowRoot.innerHTML = `
5
+ <style>
6
+ footer {
7
+ background-color: #020617;
8
+ border-top: 1px solid rgba(148, 163, 184, 0.1);
9
+ padding: 3rem 1.5rem;
10
+ margin-top: auto;
11
+ }
12
+
13
+ .content {
14
+ max-width: 1280px;
15
+ margin: 0 auto;
16
+ text-align: center;
17
+ }
18
+
19
+ .logo {
20
+ font-family: 'JetBrains Mono', monospace;
21
+ font-size: 1.25rem;
22
+ font-weight: 700;
23
+ color: #fff;
24
+ margin-bottom: 1rem;
25
+ display: inline-flex;
26
+ align-items: center;
27
+ gap: 0.5rem;
28
+ }
29
+
30
+ .logo span {
31
+ color: #8b5cf6;
32
+ }
33
+
34
+ .text {
35
+ color: #64748b;
36
+ font-size: 0.875rem;
37
+ line-height: 1.6;
38
+ max-width: 600px;
39
+ margin: 0 auto 1.5rem;
40
+ }
41
+
42
+ .links {
43
+ display: flex;
44
+ justify-content: center;
45
+ gap: 1.5rem;
46
+ flex-wrap: wrap;
47
+ }
48
+
49
+ .link {
50
+ color: #94a3b8;
51
+ text-decoration: none;
52
+ font-size: 0.9rem;
53
+ transition: color 0.2s;
54
+ }
55
+
56
+ .link:hover {
57
+ color: #06b6d4;
58
+ }
59
+
60
+ .copyright {
61
+ margin-top: 2rem;
62
+ color: #475569;
63
+ font-size: 0.75rem;
64
+ }
65
+ </style>
66
+ <footer>
67
+ <div class="content">
68
+ <div class="logo">
69
+ <i data-feather="cpu"></i>
70
+ <span>Synapse<span>Search</span></span>
71
+ </div>
72
+ <p class="text">
73
+ An aggregator for the latest Artificial Intelligence research papers.
74
+ Curated for researchers, developers, and enthusiasts.
75
+ </p>
76
+ <div class="links">
77
+ <a href="#" class="link">Privacy Policy</a>
78
+ <a href="#" class="link">Terms of Service</a>
79
+ <a href="#" class="link">API Documentation</a>
80
+ <a href="#" class="link">Contact Support</a>
81
+ </div>
82
+ <p class="copyright">
83
+ © 2023 Synapse Search. Data provided by ArXiv.
84
+ </p>
85
+ </div>
86
+ </footer>
87
+ `;
88
+ }
89
+ }
90
+
91
+ customElements.define('site-footer', SiteFooter);
components/navbar.js ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ class SiteHeader extends HTMLElement {
2
+ connectedCallback() {
3
+ this.attachShadow({ mode: 'open' });
4
+ this.shadowRoot.innerHTML = `
5
+ <style>
6
+ @import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@700&display=swap');
7
+
8
+ header {
9
+ background-color: rgba(15, 23, 42, 0.85);
10
+ backdrop-filter: blur(12px);
11
+ border-bottom: 1px solid rgba(148, 163, 184, 0.1);
12
+ position: sticky;
13
+ top: 0;
14
+ z-index: 50;
15
+ }
16
+
17
+ .container {
18
+ max-width: 1280px;
19
+ margin: 0 auto;
20
+ padding: 1rem 1.5rem;
21
+ display: flex;
22
+ justify-content: space-between;
23
+ align-items: center;
24
+ }
25
+
26
+ .logo {
27
+ font-family: 'JetBrains Mono', monospace;
28
+ font-size: 1.5rem;
29
+ font-weight: 700;
30
+ color: #fff;
31
+ text-decoration: none;
32
+ display: flex;
33
+ align-items: center;
34
+ gap: 0.5rem;
35
+ transition: opacity 0.2s;
36
+ }
37
+
38
+ .logo:hover {
39
+ opacity: 0.8;
40
+ }
41
+
42
+ .logo-icon {
43
+ color: #06b6d4;
44
+ }
45
+
46
+ .nav-links {
47
+ display: flex;
48
+ gap: 2rem;
49
+ align-items: center;
50
+ }
51
+
52
+ .nav-link {
53
+ color: #94a3b8;
54
+ text-decoration: none;
55
+ font-size: 0.95rem;
56
+ font-weight: 500;
57
+ transition: color 0.2s;
58
+ display: flex;
59
+ align-items: center;
60
+ gap: 0.4rem;
61
+ }
62
+
63
+ .nav-link:hover {
64
+ color: #06b6d4;
65
+ }
66
+
67
+ @media (max-width: 640px) {
68
+ .nav-links span {
69
+ display: none;
70
+ }
71
+ }
72
+ </style>
73
+ <header>
74
+ <div class="container">
75
+ <a href="/" class="logo">
76
+ <i data-feather="cpu" class="logo-icon"></i>
77
+ <span>Synapse<span style="color: #8b5cf6">Search</span></span>
78
+ </a>
79
+ <nav class="nav-links">
80
+ <a href="https://github.com/public-apis/public-apis" target="_blank" class="nav-link">
81
+ <i data-feather="github" width="18" height="18"></i>
82
+ <span>GitHub</span>
83
+ </a>
84
+ <a href="https://arxiv.org" target="_blank" class="nav-link">
85
+ <i data-feather="external-link" width="18" height="18"></i>
86
+ <span>ArXiv</span>
87
+ </a>
88
+ </nav>
89
+ </div>
90
+ </header>
91
+ `;
92
+ }
93
+ }
94
+
95
+ customElements.define('site-header', SiteHeader);
components/paper-card.js ADDED
@@ -0,0 +1,182 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ class PaperCard extends HTMLElement {
2
+ constructor() {
3
+ super();
4
+ this.attachShadow({ mode: 'open' });
5
+ }
6
+
7
+ connectedCallback() {
8
+ this.render();
9
+ }
10
+
11
+ static get observedAttributes() {
12
+ return ['title', 'summary', 'authors', 'date', 'pdf-link', 'abs-link'];
13
+ }
14
+
15
+ attributeChangedCallback(name, oldValue, newValue) {
16
+ if (oldValue !== newValue) {
17
+ this.render();
18
+ }
19
+ }
20
+
21
+ render() {
22
+ const title = this.getAttribute('title') || 'No Title';
23
+ const summary = this.getAttribute('summary') || 'No summary available.';
24
+ const authors = this.getAttribute('authors') || 'Unknown';
25
+ const date = this.getAttribute('date') || '';
26
+ const pdfLink = this.getAttribute('pdf-link') || '#';
27
+ const absLink = this.getAttribute('abs-link') || '#';
28
+
29
+ // Truncate summary if too long
30
+ const shortSummary = summary.length > 200 ? summary.substring(0, 200) + '...' : summary;
31
+
32
+ this.shadowRoot.innerHTML = `
33
+ <style>
34
+ :host {
35
+ display: block;
36
+ }
37
+
38
+ .card {
39
+ background-color: rgba(30, 41, 59, 0.6);
40
+ border: 1px solid rgba(148, 163, 184, 0.1);
41
+ border-radius: 1rem;
42
+ padding: 1.5rem;
43
+ transition: all 0.3s ease;
44
+ position: relative;
45
+ overflow: hidden;
46
+ display: flex;
47
+ flex-direction: column;
48
+ height: 100%;
49
+ }
50
+
51
+ .card:hover {
52
+ transform: translateY(-5px);
53
+ box-shadow: 0 10px 25px -5px rgba(6, 182, 212, 0.15);
54
+ border-color: rgba(6, 182, 212, 0.3);
55
+ background-color: rgba(30, 41, 59, 0.9);
56
+ }
57
+
58
+ .card::before {
59
+ content: '';
60
+ position: absolute;
61
+ top: 0;
62
+ left: 0;
63
+ width: 4px;
64
+ height: 100%;
65
+ background: linear-gradient(to bottom, #06b6d4, #8b5cf6);
66
+ opacity: 0;
67
+ transition: opacity 0.3s;
68
+ }
69
+
70
+ .card:hover::before {
71
+ opacity: 1;
72
+ }
73
+
74
+ .badge {
75
+ display: inline-block;
76
+ background-color: rgba(139, 92, 246, 0.1);
77
+ color: #a78bfa;
78
+ font-size: 0.75rem;
79
+ font-weight: 600;
80
+ padding: 0.25rem 0.75rem;
81
+ border-radius: 9999px;
82
+ margin-bottom: 0.75rem;
83
+ border: 1px solid rgba(139, 92, 246, 0.2);
84
+ }
85
+
86
+ h3 {
87
+ font-size: 1.125rem;
88
+ font-weight: 700;
89
+ color: #f1f5f9;
90
+ margin-bottom: 0.75rem;
91
+ line-height: 1.4;
92
+ display: -webkit-box;
93
+ -webkit-line-clamp: 2;
94
+ -webkit-box-orient: vertical;
95
+ overflow: hidden;
96
+ }
97
+
98
+ .authors {
99
+ font-size: 0.8rem;
100
+ color: #94a3b8;
101
+ margin-bottom: 0.75rem;
102
+ display: flex;
103
+ align-items: center;
104
+ gap: 0.35rem;
105
+ }
106
+
107
+ p {
108
+ font-size: 0.875rem;
109
+ color: #cbd5e1;
110
+ line-height: 1.6;
111
+ margin-bottom: 1.5rem;
112
+ flex-grow: 1;
113
+ }
114
+
115
+ .actions {
116
+ display: flex;
117
+ gap: 0.75rem;
118
+ margin-top: auto;
119
+ }
120
+
121
+ .btn {
122
+ flex: 1;
123
+ display: flex;
124
+ align-items: center;
125
+ justify-content: center;
126
+ gap: 0.5rem;
127
+ padding: 0.5rem 1rem;
128
+ border-radius: 0.5rem;
129
+ font-size: 0.875rem;
130
+ font-weight: 500;
131
+ text-decoration: none;
132
+ transition: all 0.2s;
133
+ }
134
+
135
+ .btn-primary {
136
+ background-color: #0e7490;
137
+ color: white;
138
+ }
139
+
140
+ .btn-primary:hover {
141
+ background-color: #06b6d4;
142
+ }
143
+
144
+ .btn-outline {
145
+ background-color: transparent;
146
+ border: 1px solid #475569;
147
+ color: #94a3b8;
148
+ }
149
+
150
+ .btn-outline:hover {
151
+ border-color: #94a3b8;
152
+ color: #e2e8f0;
153
+ }
154
+ </style>
155
+
156
+ <article class="card">
157
+ <span class="badge">${date}</span>
158
+ <h3 title="${title}">${title}</h3>
159
+ <div class="authors">
160
+ <i data-feather="users" width="12" height="12"></i>
161
+ <span>${authors}</span>
162
+ </div>
163
+ <p>${shortSummary}</p>
164
+ <div class="actions">
165
+ <a href="${pdfLink}" target="_blank" class="btn btn-primary">
166
+ <i data-feather="file-text" width="16" height="16"></i> PDF
167
+ </a>
168
+ <a href="${absLink}" target="_blank" class="btn btn-outline">
169
+ <i data-feather="external-link" width="16" height="16"></i> Abstract
170
+ </a>
171
+ </div>
172
+ </article>
173
+ `;
174
+
175
+ // Re-initialize icons inside Shadow DOM
176
+ if(window.feather) {
177
+ feather.replace();
178
+ }
179
+ }
180
+ }
181
+
182
+ customElements.define('paper-card', PaperCard);
index.html CHANGED
@@ -1,19 +1,124 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
19
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en" class="dark">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Synapse Search | AI Paper Explorer</title>
7
+ <link rel="stylesheet" href="style.css">
8
+ <script src="https://cdn.tailwindcss.com"></script>
9
+ <script src="https://unpkg.com/feather-icons"></script>
10
+ <script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
11
+ <script>
12
+ tailwind.config = {
13
+ darkMode: 'class',
14
+ theme: {
15
+ extend: {
16
+ colors: {
17
+ primary: '#06b6d4', // Cyan 500
18
+ secondary: '#8b5cf6', // Violet 500
19
+ dark: '#0f172a', // Slate 900
20
+ darker: '#020617', // Slate 950
21
+ card: '#1e293b', // Slate 800
22
+ }
23
+ }
24
+ }
25
+ }
26
+ </script>
27
+ </head>
28
+ <body class="bg-darker text-gray-200 font-sans antialiased min-h-screen flex flex-col transition-colors duration-300">
29
+
30
+ <!-- Navbar Component -->
31
+ <site-header></site-header>
32
+
33
+ <!-- Main Content -->
34
+ <main class="flex-grow container mx-auto px-4 py-8 max-w-7xl">
35
+
36
+ <!-- Hero Section -->
37
+ <section class="text-center mb-12 mt-8 animate-fade-in-down">
38
+ <h1 class="text-4xl md:text-6xl font-extrabold text-transparent bg-clip-text bg-gradient-to-r from-primary to-secondary mb-4">
39
+ Discover the Future of AI
40
+ </h1>
41
+ <p class="text-lg md:text-xl text-gray-400 max-w-2xl mx-auto">
42
+ Explore the latest research papers in Artificial Intelligence. Filter by date, search by topic, and stay ahead of the curve.
43
+ </p>
44
+ </section>
45
+
46
+ <!-- Filters & Controls -->
47
+ <section class="bg-card/50 backdrop-blur-md border border-gray-700/50 rounded-2xl p-6 mb-8 shadow-xl animate-fade-in-up">
48
+ <div class="flex flex-col md:flex-row gap-4 items-end">
49
+
50
+ <!-- Search -->
51
+ <div class="flex-grow w-full">
52
+ <label class="block text-sm font-medium text-primary mb-1">Search Query</label>
53
+ <div class="relative">
54
+ <i data-feather="search" class="absolute left-3 top-3 text-gray-400 w-5 h-5"></i>
55
+ <input type="text" id="searchInput" placeholder="e.g. Reinforcement Learning, Transformers..."
56
+ class="w-full bg-darker border border-gray-600 rounded-lg py-2.5 pl-10 pr-4 text-white focus:outline-none focus:border-primary focus:ring-1 focus:ring-primary transition-all placeholder-gray-500">
57
+ </div>
58
+ </div>
59
+
60
+ <!-- Date From -->
61
+ <div class="w-full md:w-auto">
62
+ <label class="block text-sm font-medium text-secondary mb-1">From Date</label>
63
+ <input type="date" id="dateFrom"
64
+ class="w-full bg-darker border border-gray-600 rounded-lg py-2.5 px-4 text-white focus:outline-none focus:border-secondary focus:ring-1 focus:ring-secondary transition-all cursor-pointer">
65
+ </div>
66
+
67
+ <!-- Date To -->
68
+ <div class="w-full md:w-auto">
69
+ <label class="block text-sm font-medium text-secondary mb-1">To Date</label>
70
+ <input type="date" id="dateTo"
71
+ class="w-full bg-darker border border-gray-600 rounded-lg py-2.5 px-4 text-white focus:outline-none focus:border-secondary focus:ring-1 focus:ring-secondary transition-all cursor-pointer">
72
+ </div>
73
+
74
+ <!-- Search Button -->
75
+ <button id="searchBtn" class="w-full md:w-auto bg-gradient-to-r from-primary to-blue-600 hover:from-cyan-400 hover:to-blue-500 text-white font-bold py-2.5 px-8 rounded-lg shadow-lg transform hover:-translate-y-0.5 transition-all duration-200 flex items-center justify-center gap-2">
76
+ <i data-feather="zap" class="w-4 h-4"></i>
77
+ Find Papers
78
+ </button>
79
+ </div>
80
+ </section>
81
+
82
+ <!-- Stats / Status -->
83
+ <div class="flex justify-between items-center mb-6 px-2">
84
+ <h2 class="text-2xl font-bold text-white flex items-center gap-2">
85
+ <i data-feather="file-text" class="text-primary"></i> Latest Papers
86
+ </h2>
87
+ <span id="resultCount" class="text-sm text-gray-400 bg-gray-800 px-3 py-1 rounded-full border border-gray-700">Loading...</span>
88
+ </div>
89
+
90
+ <!-- Papers Grid -->
91
+ <div id="papersGrid" class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
92
+ <!-- Papers will be injected here via JS -->
93
+ </div>
94
+
95
+ <!-- Empty State / No Results -->
96
+ <div id="noResults" class="hidden text-center py-20">
97
+ <div class="inline-block p-6 rounded-full bg-gray-800/50 mb-4">
98
+ <i data-feather="inbox" class="w-16 h-16 text-gray-500"></i>
99
+ </div>
100
+ <h3 class="text-2xl font-bold text-gray-300 mb-2">No papers found</h3>
101
+ <p class="text-gray-500">Try adjusting your search terms or date range.</p>
102
+ </div>
103
+
104
+ <!-- Loading State -->
105
+ <div id="loader" class="hidden flex justify-center items-center py-20">
106
+ <div class="animate-spin rounded-full h-16 w-16 border-t-4 border-b-4 border-primary"></div>
107
+ </div>
108
+
109
+ </main>
110
+
111
+ <!-- Footer Component -->
112
+ <site-footer></site-footer>
113
+
114
+ <!-- Web Components -->
115
+ <script src="components/navbar.js"></script>
116
+ <script src="components/footer.js"></script>
117
+ <script src="components/paper-card.js"></script>
118
+
119
+ <!-- Main Logic -->
120
+ <script src="script.js"></script>
121
+ <script>feather.replace();</script>
122
+ <script src="https://huggingface.co/deepsite/deepsite-badge.js"></script>
123
+ </body>
124
+ </html>
script.js ADDED
@@ -0,0 +1,178 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ document.addEventListener('DOMContentLoaded', () => {
2
+ const papersGrid = document.getElementById('papersGrid');
3
+ const searchInput = document.getElementById('searchInput');
4
+ const dateFrom = document.getElementById('dateFrom');
5
+ const dateTo = document.getElementById('dateTo');
6
+ const searchBtn = document.getElementById('searchBtn');
7
+ const loader = document.getElementById('loader');
8
+ const noResults = document.getElementById('noResults');
9
+ const resultCount = document.getElementById('resultCount');
10
+
11
+ // Default query for AI papers
12
+ const DEFAULT_QUERY = 'cat:cs.AI OR cat:cs.LG OR cat:cs.CL';
13
+
14
+ // Initial Fetch
15
+ fetchPapers(DEFAULT_QUERY);
16
+
17
+ // Event Listeners
18
+ searchBtn.addEventListener('click', () => {
19
+ const query = searchInput.value.trim();
20
+ fetchPapers(query ? `all:${query}` : DEFAULT_QUERY);
21
+ });
22
+
23
+ searchInput.addEventListener('keypress', (e) => {
24
+ if (e.key === 'Enter') {
25
+ searchBtn.click();
26
+ }
27
+ });
28
+
29
+ // Date Filter Listener (Client-side filter on loaded data)
30
+ // For simplicity in this demo, we re-fetch or filter if data is present.
31
+ // Here we'll re-trigger the search logic to apply filters if data exists,
32
+ // but for a robust app, we'd store the 'allPapers' array.
33
+ let allPapersData = [];
34
+
35
+ dateFrom.addEventListener('change', applyClientFilters);
36
+ dateTo.addEventListener('change', applyClientFilters);
37
+
38
+ async function fetchPapers(searchQuery) {
39
+ showLoader(true);
40
+ noResults.classList.add('hidden');
41
+ papersGrid.innerHTML = '';
42
+
43
+ try {
44
+ // ArXiv API endpoint
45
+ const baseUrl = 'http://export.arxiv.org/api/query?';
46
+ const params = new URLSearchParams({
47
+ search_query: searchQuery,
48
+ start: 0,
49
+ max_results: 50, // Fetch a good amount to filter by date
50
+ sortBy: 'submittedDate',
51
+ sortOrder: 'descending'
52
+ });
53
+
54
+ const response = await fetch(baseUrl + params.toString());
55
+ if (!response.ok) throw new Error('Network response was not ok');
56
+
57
+ const xmlText = await response.text();
58
+ const papers = parseArxivXml(xmlText);
59
+
60
+ allPapersData = papers;
61
+ applyClientFilters(); // Apply any existing date filters immediately
62
+
63
+ } catch (error) {
64
+ console.error('Error fetching papers:', error);
65
+ resultCount.textContent = 'Error fetching data';
66
+ noResults.classList.remove('hidden');
67
+ showLoader(false);
68
+ }
69
+ }
70
+
71
+ function parseArxivXml(xmlString) {
72
+ const parser = new DOMParser();
73
+ const xmlDoc = parser.parseFromString(xmlString, "text/xml");
74
+ const entries = xmlDoc.getElementsByTagName("entry");
75
+ const papers = [];
76
+
77
+ for (let i = 0; i < entries.length; i++) {
78
+ const entry = entries[i];
79
+
80
+ // Title
81
+ const title = entry.getElementsByTagName("title")[0].textContent;
82
+
83
+ // Summary (Abstract) - Remove newlines and trim
84
+ const summary = entry.getElementsByTagName("summary")[0].textContent.replace(/\s+/g, ' ').trim();
85
+
86
+ // Published Date
87
+ const published = entry.getElementsByTagName("published")[0].textContent;
88
+
89
+ // Authors
90
+ const authors = [];
91
+ const authorNodes = entry.getElementsByTagName("author");
92
+ for (let j = 0; j < authorNodes.length; j++) {
93
+ authors.push(authorNodes[j].getElementsByTagName("name")[0].textContent);
94
+ }
95
+
96
+ // Link (PDF)
97
+ const links = entry.getElementsByTagName("link");
98
+ let pdfLink = "";
99
+ for(let k=0; k<links.length; k++) {
100
+ if(links[k].getAttribute("type") === "application/pdf") {
101
+ pdfLink = links[k].getAttribute("href");
102
+ break;
103
+ }
104
+ }
105
+ // Arxiv ID Link
106
+ const idLink = entry.getElementsByTagName("id")[0].textContent;
107
+
108
+ papers.push({
109
+ title,
110
+ summary,
111
+ published,
112
+ authors,
113
+ pdfLink,
114
+ idLink
115
+ });
116
+ }
117
+ return papers;
118
+ }
119
+
120
+ function applyClientFilters() {
121
+ papersGrid.innerHTML = '';
122
+
123
+ const fromVal = dateFrom.value ? new Date(dateFrom.value) : null;
124
+ const toVal = dateTo.value ? new Date(dateTo.value) : null;
125
+
126
+ // Set time to end of day for 'to' filter to be inclusive
127
+ if (toVal) toVal.setHours(23, 59, 59, 999);
128
+
129
+ const filteredPapers = allPapersData.filter(paper => {
130
+ const paperDate = new Date(paper.published);
131
+
132
+ let isValid = true;
133
+
134
+ if (fromVal && paperDate < fromVal) isValid = false;
135
+ if (toVal && paperDate > toVal) isValid = false;
136
+
137
+ return isValid;
138
+ });
139
+
140
+ displayPapers(filteredPapers);
141
+ }
142
+
143
+ function displayPapers(papers) {
144
+ showLoader(false);
145
+ resultCount.textContent = `Found ${papers.length} papers`;
146
+
147
+ if (papers.length === 0) {
148
+ noResults.classList.remove('hidden');
149
+ return;
150
+ }
151
+
152
+ papers.forEach(paper => {
153
+ // Create Web Component
154
+ const card = document.createElement('paper-card');
155
+
156
+ // Pass data to component
157
+ card.setAttribute('title', paper.title);
158
+ card.setAttribute('summary', paper.summary);
159
+ card.setAttribute('authors', paper.authors.join(', '));
160
+ card.setAttribute('date', new Date(paper.published).toLocaleDateString());
161
+ card.setAttribute('pdf-link', paper.pdfLink);
162
+ card.setAttribute('abs-link', paper.idLink);
163
+
164
+ papersGrid.appendChild(card);
165
+ });
166
+ }
167
+
168
+ function showLoader(show) {
169
+ if (show) {
170
+ loader.classList.remove('hidden');
171
+ papersGrid.classList.add('hidden');
172
+ resultCount.textContent = 'Searching...';
173
+ } else {
174
+ loader.classList.add('hidden');
175
+ papersGrid.classList.remove('hidden');
176
+ }
177
+ }
178
+ });
style.css CHANGED
@@ -1,28 +1,69 @@
 
 
 
 
 
 
 
 
1
  body {
2
- padding: 2rem;
3
- font-family: -apple-system, BlinkMacSystemFont, "Arial", sans-serif;
4
  }
5
 
6
- h1 {
7
- font-size: 16px;
8
- margin-top: 0;
 
 
 
 
 
 
 
 
 
 
9
  }
10
 
11
- p {
12
- color: rgb(107, 114, 128);
13
- font-size: 15px;
14
- margin-bottom: 10px;
15
- margin-top: 5px;
16
  }
17
 
18
- .card {
19
- max-width: 620px;
20
- margin: 0 auto;
21
- padding: 16px;
22
- border: 1px solid lightgray;
23
- border-radius: 16px;
24
  }
25
 
26
- .card p:last-child {
27
- margin-bottom: 0;
28
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ @import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600;700&family=JetBrains+Mono:wght@400;700&display=swap');
2
+
3
+ :root {
4
+ --primary: #06b6d4;
5
+ --secondary: #8b5cf6;
6
+ --bg-dark: #0f172a;
7
+ }
8
+
9
  body {
10
+ font-family: 'Inter', sans-serif;
 
11
  }
12
 
13
+ /* Custom Scrollbar */
14
+ ::-webkit-scrollbar {
15
+ width: 10px;
16
+ }
17
+ ::-webkit-scrollbar-track {
18
+ background: #020617;
19
+ }
20
+ ::-webkit-scrollbar-thumb {
21
+ background: #334155;
22
+ border-radius: 5px;
23
+ }
24
+ ::-webkit-scrollbar-thumb:hover {
25
+ background: var(--primary);
26
  }
27
 
28
+ /* Animations */
29
+ @keyframes fadeInDown {
30
+ from { opacity: 0; transform: translateY(-20px); }
31
+ to { opacity: 1; transform: translateY(0); }
 
32
  }
33
 
34
+ @keyframes fadeInUp {
35
+ from { opacity: 0; transform: translateY(20px); }
36
+ to { opacity: 1; transform: translateY(0); }
 
 
 
37
  }
38
 
39
+ .animate-fade-in-down {
40
+ animation: fadeInDown 0.6s ease-out forwards;
41
  }
42
+
43
+ .animate-fade-in-up {
44
+ animation: fadeInUp 0.6s ease-out forwards;
45
+ }
46
+
47
+ /* Glassmorphism Utilities */
48
+ .glass {
49
+ background: rgba(30, 41, 59, 0.7);
50
+ backdrop-filter: blur(10px);
51
+ -webkit-backdrop-filter: blur(10px);
52
+ border: 1px solid rgba(255, 255, 255, 0.1);
53
+ }
54
+
55
+ /* Code/Abstract styling */
56
+ pre {
57
+ white-space: pre-wrap; /* Since CSS 2.1 */
58
+ white-space: -moz-pre-wrap; /* Mozilla, since 1999 */
59
+ white-space: -pre-wrap; /* Opera 4-6 */
60
+ white-space: -o-pre-wrap; /* Opera 7 */
61
+ word-wrap: break-word; /* Internet Explorer 5.5+ */
62
+ }
63
+
64
+ /* Date Picker Dark Mode Fixes */
65
+ input[type="date"]::-webkit-calendar-picker-indicator {
66
+ filter: invert(1);
67
+ opacity: 0.5;
68
+ cursor: pointer;
69
+ }