Orkhan commited on
Commit
40aa5f7
·
verified ·
1 Parent(s): 664d5c6

Add 2 files

Browse files
Files changed (2) hide show
  1. README.md +7 -5
  2. index.html +311 -19
README.md CHANGED
@@ -1,10 +1,12 @@
1
  ---
2
- title: Test23
3
- emoji: 🐢
4
- colorFrom: indigo
5
- colorTo: indigo
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: test23
3
+ emoji: 🐳
4
+ colorFrom: pink
5
+ colorTo: gray
6
  sdk: static
7
  pinned: false
8
+ tags:
9
+ - deepsite
10
  ---
11
 
12
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
index.html CHANGED
@@ -1,19 +1,311 @@
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">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Project Link Manager</title>
7
+ <script src="https://cdn.tailwindcss.com"></script>
8
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
9
+ <style>
10
+ .fade-in {
11
+ animation: fadeIn 0.5s ease-in-out;
12
+ }
13
+ @keyframes fadeIn {
14
+ from { opacity: 0; transform: translateY(10px); }
15
+ to { opacity: 1; transform: translateY(0); }
16
+ }
17
+ .input-highlight {
18
+ transition: all 0.3s ease;
19
+ box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.5);
20
+ }
21
+ .input-highlight:focus {
22
+ box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3);
23
+ }
24
+ .table-row:hover {
25
+ background-color: rgba(249, 250, 251, 0.8);
26
+ transform: translateY(-1px);
27
+ box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
28
+ }
29
+ .table-row {
30
+ transition: all 0.2s ease;
31
+ }
32
+ </style>
33
+ </head>
34
+ <body class="bg-gray-50 min-h-screen">
35
+ <div class="container mx-auto px-4 py-8 max-w-4xl">
36
+ <!-- Header -->
37
+ <header class="text-center mb-12 fade-in">
38
+ <h1 class="text-4xl font-bold text-indigo-700 mb-2">Project Link Manager</h1>
39
+ <p class="text-gray-600">Organize your web research projects with ease</p>
40
+ </header>
41
+
42
+ <!-- User Info Form -->
43
+ <div id="userInfoForm" class="bg-white rounded-xl shadow-md p-6 mb-8 fade-in">
44
+ <h2 class="text-2xl font-semibold text-gray-800 mb-6">Project Details</h2>
45
+
46
+ <div class="grid grid-cols-1 md:grid-cols-2 gap-6">
47
+ <div>
48
+ <label for="userName" class="block text-sm font-medium text-gray-700 mb-1">Your Name</label>
49
+ <input type="text" id="userName" class="w-full px-4 py-2 rounded-lg border border-gray-300 input-highlight focus:outline-none focus:ring-2 focus:ring-indigo-200" placeholder="John Doe">
50
+ </div>
51
+
52
+ <div>
53
+ <label for="projectName" class="block text-sm font-medium text-gray-700 mb-1">Project Name</label>
54
+ <input type="text" id="projectName" class="w-full px-4 py-2 rounded-lg border border-gray-300 input-highlight focus:outline-none focus:ring-2 focus:ring-indigo-200" placeholder="Market Research Q3">
55
+ </div>
56
+ </div>
57
+
58
+ <div class="mt-6">
59
+ <label for="linksInput" class="block text-sm font-medium text-gray-700 mb-1">Website Links (one per line)</label>
60
+ <textarea id="linksInput" rows="6" class="w-full px-4 py-2 rounded-lg border border-gray-300 input-highlight focus:outline-none focus:ring-2 focus:ring-indigo-200" placeholder="https://example.com\nhttps://another-site.org"></textarea>
61
+ <p class="text-xs text-gray-500 mt-1">Enter one URL per line. We'll automatically extract the website names.</p>
62
+ </div>
63
+
64
+ <div class="mt-6 flex justify-end">
65
+ <button id="generateTableBtn" class="px-6 py-2 bg-indigo-600 text-white font-medium rounded-lg hover:bg-indigo-700 transition-colors duration-200 flex items-center">
66
+ <i class="fas fa-table mr-2"></i> Generate Table
67
+ </button>
68
+ </div>
69
+ </div>
70
+
71
+ <!-- Results Section (Initially Hidden) -->
72
+ <div id="resultsSection" class="hidden fade-in">
73
+ <div class="flex justify-between items-center mb-6">
74
+ <h2 class="text-2xl font-semibold text-gray-800">Your Project Links</h2>
75
+ <button id="editProjectBtn" class="px-4 py-2 text-indigo-600 hover:text-indigo-800 transition-colors duration-200 flex items-center">
76
+ <i class="fas fa-edit mr-2"></i> Edit Project
77
+ </button>
78
+ </div>
79
+
80
+ <div class="bg-white rounded-xl shadow-md overflow-hidden mb-8">
81
+ <div class="p-4 border-b border-gray-200 bg-gray-50">
82
+ <div class="flex items-center">
83
+ <div class="w-10 h-10 rounded-full bg-indigo-100 flex items-center justify-center mr-3">
84
+ <i class="fas fa-user text-indigo-600"></i>
85
+ </div>
86
+ <div>
87
+ <h3 id="displayUserName" class="font-medium text-gray-800"></h3>
88
+ <p id="displayProjectName" class="text-sm text-gray-600"></p>
89
+ </div>
90
+ </div>
91
+ </div>
92
+
93
+ <div class="overflow-x-auto">
94
+ <table class="min-w-full divide-y divide-gray-200">
95
+ <thead class="bg-gray-50">
96
+ <tr>
97
+ <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">#</th>
98
+ <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">URL</th>
99
+ <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Website</th>
100
+ <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Pages</th>
101
+ <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Actions</th>
102
+ </tr>
103
+ </thead>
104
+ <tbody id="linksTableBody" class="bg-white divide-y divide-gray-200">
105
+ <!-- Table rows will be inserted here by JavaScript -->
106
+ </tbody>
107
+ </table>
108
+ </div>
109
+
110
+ <div class="p-4 border-t border-gray-200 bg-gray-50 flex justify-between items-center">
111
+ <div>
112
+ <button id="addRowBtn" class="px-4 py-2 bg-green-600 text-white text-sm rounded-lg hover:bg-green-700 transition-colors duration-200 flex items-center">
113
+ <i class="fas fa-plus mr-2"></i> Add Row
114
+ </button>
115
+ </div>
116
+ <div>
117
+ <button id="exportBtn" class="px-4 py-2 bg-indigo-600 text-white text-sm rounded-lg hover:bg-indigo-700 transition-colors duration-200 flex items-center">
118
+ <i class="fas fa-file-export mr-2"></i> Export Data
119
+ </button>
120
+ </div>
121
+ </div>
122
+ </div>
123
+ </div>
124
+ </div>
125
+
126
+ <script>
127
+ document.addEventListener('DOMContentLoaded', function() {
128
+ // DOM Elements
129
+ const userInfoForm = document.getElementById('userInfoForm');
130
+ const resultsSection = document.getElementById('resultsSection');
131
+ const generateTableBtn = document.getElementById('generateTableBtn');
132
+ const editProjectBtn = document.getElementById('editProjectBtn');
133
+ const addRowBtn = document.getElementById('addRowBtn');
134
+ const exportBtn = document.getElementById('exportBtn');
135
+ const linksTableBody = document.getElementById('linksTableBody');
136
+ const displayUserName = document.getElementById('displayUserName');
137
+ const displayProjectName = document.getElementById('displayProjectName');
138
+
139
+ // Extract domain name from URL
140
+ function extractDomain(url) {
141
+ try {
142
+ // Remove protocol and www
143
+ let domain = url.replace(/^(https?:\/\/)?(www\.)?/, '');
144
+ // Remove path and query parameters
145
+ domain = domain.split('/')[0];
146
+ // Remove port number if present
147
+ domain = domain.split(':')[0];
148
+ // Capitalize first letter
149
+ domain = domain.charAt(0).toUpperCase() + domain.slice(1);
150
+ return domain;
151
+ } catch (e) {
152
+ return "Unknown";
153
+ }
154
+ }
155
+
156
+ // Generate table from links
157
+ function generateTable() {
158
+ const userName = document.getElementById('userName').value.trim();
159
+ const projectName = document.getElementById('projectName').value.trim();
160
+ const linksText = document.getElementById('linksInput').value.trim();
161
+
162
+ if (!userName || !projectName || !linksText) {
163
+ alert('Please fill in all fields');
164
+ return;
165
+ }
166
+
167
+ // Display user info
168
+ displayUserName.textContent = userName;
169
+ displayProjectName.textContent = projectName;
170
+
171
+ // Clear existing table rows
172
+ linksTableBody.innerHTML = '';
173
+
174
+ // Process links
175
+ const links = linksText.split('\n').filter(link => link.trim() !== '');
176
+
177
+ links.forEach((link, index) => {
178
+ const domain = extractDomain(link);
179
+ addTableRow(index + 1, link, domain, '');
180
+ });
181
+
182
+ // Show results and hide form
183
+ userInfoForm.classList.add('hidden');
184
+ resultsSection.classList.remove('hidden');
185
+ }
186
+
187
+ // Add a new row to the table
188
+ function addTableRow(number, url = '', domain = '', pages = '') {
189
+ const row = document.createElement('tr');
190
+ row.className = 'table-row';
191
+
192
+ row.innerHTML = `
193
+ <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">${number}</td>
194
+ <td class="px-6 py-4 whitespace-nowrap">
195
+ <input type="text" class="url-input w-full px-2 py-1 border border-gray-300 rounded focus:outline-none focus:ring-1 focus:ring-indigo-200" value="${url}" placeholder="Enter URL">
196
+ </td>
197
+ <td class="px-6 py-4 whitespace-nowrap">
198
+ <input type="text" class="domain-input w-full px-2 py-1 border border-gray-300 rounded focus:outline-none focus:ring-1 focus:ring-indigo-200" value="${domain}" placeholder="Website name">
199
+ </td>
200
+ <td class="px-6 py-4 whitespace-nowrap">
201
+ <input type="number" class="pages-input w-20 px-2 py-1 border border-gray-300 rounded focus:outline-none focus:ring-1 focus:ring-indigo-200" value="${pages}" placeholder="0" min="0">
202
+ </td>
203
+ <td class="px-6 py-4 whitespace-nowrap text-right text-sm font-medium">
204
+ <button class="delete-row-btn text-red-600 hover:text-red-900 mr-3">
205
+ <i class="fas fa-trash"></i>
206
+ </button>
207
+ <button class="visit-btn text-indigo-600 hover:text-indigo-900">
208
+ <i class="fas fa-external-link-alt"></i>
209
+ </button>
210
+ </td>
211
+ `;
212
+
213
+ linksTableBody.appendChild(row);
214
+
215
+ // Add event listeners to the new row
216
+ const urlInput = row.querySelector('.url-input');
217
+ const domainInput = row.querySelector('.domain-input');
218
+ const deleteBtn = row.querySelector('.delete-row-btn');
219
+ const visitBtn = row.querySelector('.visit-btn');
220
+
221
+ // Auto-update domain when URL changes
222
+ urlInput.addEventListener('change', function() {
223
+ if (urlInput.value.trim() !== '') {
224
+ domainInput.value = extractDomain(urlInput.value);
225
+ }
226
+ });
227
+
228
+ // Delete row
229
+ deleteBtn.addEventListener('click', function() {
230
+ row.remove();
231
+ updateRowNumbers();
232
+ });
233
+
234
+ // Visit link
235
+ visitBtn.addEventListener('click', function() {
236
+ if (urlInput.value.trim() !== '') {
237
+ let url = urlInput.value.trim();
238
+ if (!url.startsWith('http://') && !url.startsWith('https://')) {
239
+ url = 'https://' + url;
240
+ }
241
+ window.open(url, '_blank');
242
+ }
243
+ });
244
+ }
245
+
246
+ // Update row numbers after deletion
247
+ function updateRowNumbers() {
248
+ const rows = linksTableBody.querySelectorAll('tr');
249
+ rows.forEach((row, index) => {
250
+ row.cells[0].textContent = index + 1;
251
+ });
252
+ }
253
+
254
+ // Export data as JSON
255
+ function exportData() {
256
+ const rows = linksTableBody.querySelectorAll('tr');
257
+ const data = {
258
+ userName: displayUserName.textContent,
259
+ projectName: displayProjectName.textContent,
260
+ links: []
261
+ };
262
+
263
+ rows.forEach(row => {
264
+ data.links.push({
265
+ url: row.querySelector('.url-input').value,
266
+ domain: row.querySelector('.domain-input').value,
267
+ pages: row.querySelector('.pages-input').value
268
+ });
269
+ });
270
+
271
+ // Create download link
272
+ const dataStr = JSON.stringify(data, null, 2);
273
+ const dataUri = 'data:application/json;charset=utf-8,'+ encodeURIComponent(dataStr);
274
+ const exportFileDefaultName = `${displayProjectName.textContent.replace(/\s+/g, '_')}_links.json`;
275
+
276
+ const linkElement = document.createElement('a');
277
+ linkElement.setAttribute('href', dataUri);
278
+ linkElement.setAttribute('download', exportFileDefaultName);
279
+ linkElement.click();
280
+ }
281
+
282
+ // Event Listeners
283
+ generateTableBtn.addEventListener('click', generateTable);
284
+
285
+ editProjectBtn.addEventListener('click', function() {
286
+ resultsSection.classList.add('hidden');
287
+ userInfoForm.classList.remove('hidden');
288
+ });
289
+
290
+ addRowBtn.addEventListener('click', function() {
291
+ const rowCount = linksTableBody.querySelectorAll('tr').length;
292
+ addTableRow(rowCount + 1);
293
+ });
294
+
295
+ exportBtn.addEventListener('click', exportData);
296
+
297
+ // Add animation to form inputs on focus
298
+ const inputs = document.querySelectorAll('input, textarea');
299
+ inputs.forEach(input => {
300
+ input.addEventListener('focus', function() {
301
+ this.classList.add('input-highlight');
302
+ });
303
+
304
+ input.addEventListener('blur', function() {
305
+ this.classList.remove('input-highlight');
306
+ });
307
+ });
308
+ });
309
+ </script>
310
+ <p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=Orkhan/test23" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
311
+ </html>