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