Spaces:
Running
Running
Download index.html from razen5556/utility-dashboard: direct link, hf CLI and curl.
- Browser
- Download file 77.2 kB
-
https://huggingface.co/spaces/razen5556/utility-dashboard/resolve/main/index.html
- Command line
-
hf download hf://spaces/razen5556/utility-dashboard/index.html
-
curl -L -o index.html https://huggingface.co/spaces/razen5556/utility-dashboard/resolve/main/index.html
77.2 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Utility Dashboard</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">
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/jsbarcode@3.11.5/dist/JsBarcode.all.min.js"></script>
<style>
body {
font-family: 'Inter', sans-serif;
background-size: cover;
background-position: center;
background-attachment: fixed;
transition: background-image 0.3s ease;
}
.sidebar {
transition: all 0.3s ease;
}
.sidebar-collapsed {
width: 80px;
}
.sidebar-collapsed .nav-text {
display: none;
}
.sidebar-expanded {
width: 250px;
}
.main-content {
transition: margin-left 0.3s ease;
}
.signature-canvas {
border: 1px solid #4b5563;
background-color: #1f2937;
}
.tool-section {
display: none;
}
.tool-section.active {
display: block;
}
.bmi-category {
font-weight: bold;
}
.underweight {
color: #3b82f6;
}
.normal {
color: #10b981;
}
.overweight {
color: #f59e0b;
}
.obese {
color: #ef4444;
}
</style>
</head>
<body class="bg-gray-900 text-gray-200 min-h-screen flex">
<!-- Sidebar -->
<div class="sidebar bg-gray-800 h-screen fixed sidebar-expanded" id="sidebar">
<div class="p-4 flex items-center justify-between border-b border-gray-700">
<h1 class="text-xl font-bold text-white">Utility Dashboard</h1>
<button id="toggleSidebar" class="text-gray-400 hover:text-white md:hidden">
<i class="fas fa-bars"></i>
</button>
</div>
<nav class="mt-6">
<ul>
<li>
<a href="#" data-section="overview" class="nav-item flex items-center px-4 py-3 text-gray-300 hover:bg-gray-700 hover:text-white border-l-4 border-transparent hover:border-blue-500">
<i class="fas fa-home w-6 text-center"></i>
<span class="nav-text ml-3">Overview</span>
</a>
</li>
<li>
<a href="#" data-section="bmi-calculator" class="nav-item flex items-center px-4 py-3 text-gray-300 hover:bg-gray-700 hover:text-white border-l-4 border-transparent hover:border-blue-500">
<i class="fas fa-weight w-6 text-center"></i>
<span class="nav-text ml-3">BMI Calculator</span>
</a>
</li>
<li>
<a href="#" data-section="city-locator" class="nav-item flex items-center px-4 py-3 text-gray-300 hover:bg-gray-700 hover:text-white border-l-4 border-transparent hover:border-blue-500">
<i class="fas fa-map-marker-alt w-6 text-center"></i>
<span class="nav-text ml-3">City Locator</span>
</a>
</li>
<li>
<a href="#" data-section="high-schools" class="nav-item flex items-center px-4 py-3 text-gray-300 hover:bg-gray-700 hover:text-white border-l-4 border-transparent hover:border-blue-500">
<i class="fas fa-school w-6 text-center"></i>
<span class="nav-text ml-3">High Schools</span>
</a>
</li>
<li>
<a href="#" data-section="recovery-emails" class="nav-item flex items-center px-4 py-3 text-gray-300 hover:bg-gray-700 hover:text-white border-l-4 border-transparent hover:border-blue-500">
<i class="fas fa-envelope w-6 text-center"></i>
<span class="nav-text ml-3">Recovery Emails</span>
</a>
</li>
<li>
<a href="#" data-section="barcode-generator" class="nav-item flex items-center px-4 py-3 text-gray-300 hover:bg-gray-700 hover:text-white border-l-4 border-transparent hover:border-blue-500">
<i class="fas fa-barcode w-6 text-center"></i>
<span class="nav-text ml-3">Barcode Generator</span>
</a>
</li>
<li>
<a href="#" data-section="password-generator" class="nav-item flex items-center px-4 py-3 text-gray-300 hover:bg-gray-700 hover:text-white border-l-4 border-transparent hover:border-blue-500">
<i class="fas fa-key w-6 text-center"></i>
<span class="nav-text ml-3">Password Generator</span>
</a>
</li>
<li>
<a href="#" data-section="signature-generator" class="nav-item flex items-center px-4 py-3 text-gray-300 hover:bg-gray-700 hover:text-white border-l-4 border-transparent hover:border-blue-500">
<i class="fas fa-signature w-6 text-center"></i>
<span class="nav-text ml-3">Signature Generator</span>
</a>
</li>
<li>
<a href="#" data-section="colleges" class="nav-item flex items-center px-4 py-3 text-gray-300 hover:bg-gray-700 hover:text-white border-l-4 border-transparent hover:border-blue-500">
<i class="fas fa-university w-6 text-center"></i>
<span class="nav-text ml-3">Colleges</span>
</a>
</li>
</ul>
</nav>
<div class="absolute bottom-0 w-full p-4 border-t border-gray-700">
<button id="logoutBtn" class="w-full flex items-center justify-center px-4 py-2 text-gray-300 hover:bg-gray-700 hover:text-white rounded">
<i class="fas fa-sign-out-alt w-6 text-center"></i>
<span class="nav-text ml-3">Logout</span>
</button>
</div>
</div>
<!-- Main Content -->
<div class="main-content flex-1 ml-0 md:ml-64 lg:ml-72" id="mainContent">
<!-- Header -->
<header class="bg-gray-800 shadow-md p-4 flex items-center justify-between sticky top-0 z-10">
<div>
<h2 class="text-xl font-semibold text-white" id="currentSectionTitle">Overview</h2>
</div>
<div class="flex items-center space-x-4">
<div class="relative">
<input type="text" placeholder="Search..." class="bg-gray-700 text-white px-4 py-2 rounded-full w-40 md:w-64 focus:outline-none focus:ring-2 focus:ring-blue-500">
<i class="fas fa-search absolute right-3 top-3 text-gray-400"></i>
</div>
<button id="settingsBtn" class="text-gray-400 hover:text-white">
<i class="fas fa-cog text-xl"></i>
</button>
<div class="flex items-center">
<img src="https://randomuser.me/api/portraits/men/32.jpg" alt="Profile" class="w-10 h-10 rounded-full border-2 border-blue-500">
<span class="ml-2 hidden md:inline">John Doe</span>
</div>
</div>
</header>
<!-- Tool Sections -->
<main class="p-6">
<!-- Overview Section -->
<section id="overview" class="tool-section active">
<div class="bg-gray-800 rounded-lg shadow-lg p-6">
<h1 class="text-3xl font-bold text-white mb-4">Welcome to Utility Dashboard</h1>
<p class="text-gray-300 mb-6">A collection of useful tools and utilities all in one place. Select a tool from the sidebar to get started.</p>
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
<div class="bg-gray-700 rounded-lg p-6 hover:bg-gray-600 transition cursor-pointer" data-section="bmi-calculator">
<div class="flex items-center mb-4">
<div class="bg-blue-500 p-3 rounded-full mr-4">
<i class="fas fa-weight text-white"></i>
</div>
<h3 class="text-xl font-semibold text-white">BMI Calculator</h3>
</div>
<p class="text-gray-300">Calculate your Body Mass Index and check your weight category.</p>
</div>
<div class="bg-gray-700 rounded-lg p-6 hover:bg-gray-600 transition cursor-pointer" data-section="city-locator">
<div class="flex items-center mb-4">
<div class="bg-green-500 p-3 rounded-full mr-4">
<i class="fas fa-map-marker-alt text-white"></i>
</div>
<h3 class="text-xl font-semibold text-white">City Locator</h3>
</div>
<p class="text-gray-300">Find information about cities around the world.</p>
</div>
<div class="bg-gray-700 rounded-lg p-6 hover:bg-gray-600 transition cursor-pointer" data-section="high-schools">
<div class="flex items-center mb-4">
<div class="bg-purple-500 p-3 rounded-full mr-4">
<i class="fas fa-school text-white"></i>
</div>
<h3 class="text-xl font-semibold text-white">High Schools</h3>
</div>
<p class="text-gray-300">Browse a list of high schools with search functionality.</p>
</div>
<div class="bg-gray-700 rounded-lg p-6 hover:bg-gray-600 transition cursor-pointer" data-section="recovery-emails">
<div class="flex items-center mb-4">
<div class="bg-yellow-500 p-3 rounded-full mr-4">
<i class="fas fa-envelope text-white"></i>
</div>
<h3 class="text-xl font-semibold text-white">Recovery Emails</h3>
</div>
<p class="text-gray-300">Manage your recovery email addresses for account security.</p>
</div>
<div class="bg-gray-700 rounded-lg p-6 hover:bg-gray-600 transition cursor-pointer" data-section="barcode-generator">
<div class="flex items-center mb-4">
<div class="bg-red-500 p-3 rounded-full mr-4">
<i class="fas fa-barcode text-white"></i>
</div>
<h3 class="text-xl font-semibold text-white">Barcode Generator</h3>
</div>
<p class="text-gray-300">Generate barcodes from text input.</p>
</div>
<div class="bg-gray-700 rounded-lg p-6 hover:bg-gray-600 transition cursor-pointer" data-section="password-generator">
<div class="flex items-center mb-4">
<div class="bg-indigo-500 p-3 rounded-full mr-4">
<i class="fas fa-key text-white"></i>
</div>
<h3 class="text-xl font-semibold text-white">Password Generator</h3>
</div>
<p class="text-gray-300">Create strong, secure passwords with customizable options.</p>
</div>
</div>
</div>
</section>
<!-- BMI Calculator Section -->
<section id="bmi-calculator" class="tool-section">
<div class="bg-gray-800 rounded-lg shadow-lg p-6">
<h2 class="text-2xl font-bold text-white mb-6">BMI Calculator</h2>
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
<div class="bg-gray-700 rounded-lg p-6">
<form id="bmiForm">
<div class="mb-4">
<label for="height" class="block text-gray-300 mb-2">Height</label>
<div class="flex">
<input type="number" id="height" class="bg-gray-600 text-white rounded-l-lg p-2 w-full focus:outline-none focus:ring-2 focus:ring-blue-500" placeholder="Enter height" required>
<select id="heightUnit" class="bg-gray-600 text-white rounded-r-lg p-2 focus:outline-none focus:ring-2 focus:ring-blue-500">
<option value="cm">cm</option>
<option value="in">inches</option>
</select>
</div>
</div>
<div class="mb-6">
<label for="weight" class="block text-gray-300 mb-2">Weight</label>
<div class="flex">
<input type="number" id="weight" class="bg-gray-600 text-white rounded-l-lg p-2 w-full focus:outline-none focus:ring-2 focus:ring-blue-500" placeholder="Enter weight" required>
<select id="weightUnit" class="bg-gray-600 text-white rounded-r-lg p-2 focus:outline-none focus:ring-2 focus:ring-blue-500">
<option value="kg">kg</option>
<option value="lbs">lbs</option>
</select>
</div>
</div>
<button type="submit" class="w-full bg-blue-600 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded-lg transition">
Calculate BMI
</button>
</form>
</div>
<div class="bg-gray-700 rounded-lg p-6">
<h3 class="text-xl font-semibold text-white mb-4">Your Results</h3>
<div id="bmiResult" class="text-center py-8 hidden">
<div class="text-5xl font-bold mb-2" id="bmiValue">--</div>
<div class="text-xl mb-6" id="bmiCategory">--</div>
<div class="bg-gray-600 rounded-lg p-4">
<h4 class="font-semibold mb-2">BMI Categories:</h4>
<ul class="text-left space-y-1">
<li><span class="underweight">Underweight</span>: BMI less than 18.5</li>
<li><span class="normal">Normal weight</span>: BMI 18.5–24.9</li>
<li><span class="overweight">Overweight</span>: BMI 25–29.9</li>
<li><span class="obese">Obesity</span>: BMI 30 or greater</li>
</ul>
</div>
</div>
<div id="bmiEmptyState" class="text-center py-12 text-gray-400">
<i class="fas fa-calculator text-5xl mb-4"></i>
<p>Enter your height and weight to calculate your BMI</p>
</div>
</div>
</div>
</div>
</section>
<!-- City Locator Section -->
<section id="city-locator" class="tool-section">
<div class="bg-gray-800 rounded-lg shadow-lg p-6">
<h2 class="text-2xl font-bold text-white mb-6">City Locator</h2>
<div class="grid grid-cols-1 md:grid-cols-3 gap-6">
<div class="md:col-span-1 bg-gray-700 rounded-lg p-6">
<form id="citySearchForm">
<div class="mb-4">
<label for="cityName" class="block text-gray-300 mb-2">City Name</label>
<input type="text" id="cityName" class="bg-gray-600 text-white rounded-lg p-2 w-full focus:outline-none focus:ring-2 focus:ring-blue-500" placeholder="Enter city name" required>
</div>
<button type="submit" class="w-full bg-blue-600 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded-lg transition">
<i class="fas fa-search mr-2"></i> Search
</button>
</form>
</div>
<div class="md:col-span-2 bg-gray-700 rounded-lg p-6">
<h3 class="text-xl font-semibold text-white mb-4">City Information</h3>
<div id="cityResult" class="hidden">
<div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-6">
<div>
<h4 class="text-lg font-semibold text-blue-400 mb-2" id="cityNameDisplay">--</h4>
<div class="flex items-center text-gray-300 mb-1">
<i class="fas fa-globe-americas mr-2"></i>
<span id="cityCountry">--</span>
</div>
<div class="flex items-center text-gray-300 mb-1">
<i class="fas fa-users mr-2"></i>
<span id="cityPopulation">--</span>
</div>
<div class="flex items-center text-gray-300">
<i class="fas fa-map-marker-alt mr-2"></i>
<span id="cityCoordinates">--</span>
</div>
</div>
<div>
<div class="flex items-center text-gray-300 mb-1">
<i class="fas fa-temperature-high mr-2"></i>
<span id="cityTemperature">--</span>
</div>
<div class="flex items-center text-gray-300 mb-1">
<i class="fas fa-cloud mr-2"></i>
<span id="cityWeather">--</span>
</div>
<div class="flex items-center text-gray-300">
<i class="fas fa-clock mr-2"></i>
<span id="cityTimezone">--</span>
</div>
</div>
</div>
<div class="bg-gray-600 rounded-lg p-4">
<h4 class="font-semibold mb-2">Quick Facts</h4>
<p class="text-gray-300" id="cityFacts">--</p>
</div>
</div>
<div id="cityEmptyState" class="text-center py-12 text-gray-400">
<i class="fas fa-city text-5xl mb-4"></i>
<p>Search for a city to view detailed information</p>
</div>
</div>
</div>
</div>
</section>
<!-- High Schools Section -->
<section id="high-schools" class="tool-section">
<div class="bg-gray-800 rounded-lg shadow-lg p-6">
<h2 class="text-2xl font-bold text-white mb-6">High Schools</h2>
<div class="mb-6">
<div class="relative">
<input type="text" id="schoolSearch" class="bg-gray-700 text-white px-4 py-2 rounded-lg w-full focus:outline-none focus:ring-2 focus:ring-blue-500" placeholder="Search high schools by name or location...">
<i class="fas fa-search absolute right-3 top-3 text-gray-400"></i>
</div>
</div>
<div class="overflow-x-auto">
<table class="min-w-full bg-gray-700 rounded-lg overflow-hidden">
<thead class="bg-gray-600">
<tr>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-300 uppercase tracking-wider">Name</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-300 uppercase tracking-wider">Location</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-300 uppercase tracking-wider">Type</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-300 uppercase tracking-wider">Students</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-300 uppercase tracking-wider">Rating</th>
</tr>
</thead>
<tbody id="schoolsTableBody" class="divide-y divide-gray-600">
<!-- Schools will be populated here -->
</tbody>
</table>
</div>
</div>
</section>
<!-- Recovery Emails Section -->
<section id="recovery-emails" class="tool-section">
<div class="bg-gray-800 rounded-lg shadow-lg p-6">
<h2 class="text-2xl font-bold text-white mb-6">Recovery Emails</h2>
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
<div class="bg-gray-700 rounded-lg p-6">
<h3 class="text-xl font-semibold text-white mb-4">Add New Email</h3>
<form id="addEmailForm">
<div class="mb-4">
<label for="newEmail" class="block text-gray-300 mb-2">Email Address</label>
<input type="email" id="newEmail" class="bg-gray-600 text-white rounded-lg p-2 w-full focus:outline-none focus:ring-2 focus:ring-blue-500" placeholder="Enter email address" required>
</div>
<button type="submit" class="w-full bg-blue-600 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded-lg transition">
<i class="fas fa-plus mr-2"></i> Add Email
</button>
</form>
</div>
<div class="bg-gray-700 rounded-lg p-6">
<h3 class="text-xl font-semibold text-white mb-4">Your Recovery Emails</h3>
<div id="emailsList" class="space-y-3">
<!-- Emails will be populated here -->
<div class="text-center py-8 text-gray-400" id="noEmailsMessage">
<i class="fas fa-envelope-open-text text-3xl mb-3"></i>
<p>No recovery emails added yet</p>
</div>
</div>
</div>
</div>
</div>
</section>
<!-- Barcode Generator Section -->
<section id="barcode-generator" class="tool-section">
<div class="bg-gray-800 rounded-lg shadow-lg p-6">
<h2 class="text-2xl font-bold text-white mb-6">Barcode Generator</h2>
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
<div class="bg-gray-700 rounded-lg p-6">
<form id="barcodeForm">
<div class="mb-4">
<label for="barcodeText" class="block text-gray-300 mb-2">Text to Encode</label>
<input type="text" id="barcodeText" class="bg-gray-600 text-white rounded-lg p-2 w-full focus:outline-none focus:ring-2 focus:ring-blue-500" placeholder="Enter text to generate barcode" required>
</div>
<div class="mb-4">
<label for="barcodeType" class="block text-gray-300 mb-2">Barcode Type</label>
<select id="barcodeType" class="bg-gray-600 text-white rounded-lg p-2 w-full focus:outline-none focus:ring-2 focus:ring-blue-500">
<option value="CODE128">CODE128</option>
<option value="EAN13">EAN13</option>
<option value="UPC">UPC</option>
<option value="CODE39">CODE39</option>
<option value="ITF14">ITF14</option>
</select>
</div>
<button type="submit" class="w-full bg-blue-600 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded-lg transition">
<i class="fas fa-barcode mr-2"></i> Generate Barcode
</button>
</form>
</div>
<div class="bg-gray-700 rounded-lg p-6 flex flex-col items-center justify-center">
<h3 class="text-xl font-semibold text-white mb-4">Generated Barcode</h3>
<div id="barcodeContainer" class="p-4 bg-white rounded-lg mb-4 w-full flex justify-center">
<svg id="barcode" class="max-w-full h-auto"></svg>
</div>
<button id="downloadBarcode" class="bg-green-600 hover:bg-green-700 text-white font-bold py-2 px-4 rounded-lg transition hidden">
<i class="fas fa-download mr-2"></i> Download Barcode
</button>
<div id="barcodeEmptyState" class="text-center py-8 text-gray-400">
<i class="fas fa-barcode text-5xl mb-4"></i>
<p>Enter text to generate a barcode</p>
</div>
</div>
</div>
</div>
</section>
<!-- Password Generator Section -->
<section id="password-generator" class="tool-section">
<div class="bg-gray-800 rounded-lg shadow-lg p-6">
<h2 class="text-2xl font-bold text-white mb-6">Password Generator</h2>
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
<div class="bg-gray-700 rounded-lg p-6">
<form id="passwordForm">
<div class="mb-4">
<label for="passwordLength" class="block text-gray-300 mb-2">Password Length</label>
<input type="range" id="passwordLength" min="6" max="32" value="12" class="w-full h-2 bg-gray-600 rounded-lg appearance-none cursor-pointer">
<div class="flex justify-between text-gray-300 text-sm">
<span>6</span>
<span id="lengthValue">12</span>
<span>32</span>
</div>
</div>
<div class="mb-4">
<label class="block text-gray-300 mb-2">Include:</label>
<div class="space-y-2">
<label class="flex items-center">
<input type="checkbox" id="includeUppercase" checked class="form-checkbox h-4 w-4 text-blue-600 bg-gray-600 border-gray-500 rounded focus:ring-blue-500">
<span class="ml-2">Uppercase Letters (A-Z)</span>
</label>
<label class="flex items-center">
<input type="checkbox" id="includeLowercase" checked class="form-checkbox h-4 w-4 text-blue-600 bg-gray-600 border-gray-500 rounded focus:ring-blue-500">
<span class="ml-2">Lowercase Letters (a-z)</span>
</label>
<label class="flex items-center">
<input type="checkbox" id="includeNumbers" checked class="form-checkbox h-4 w-4 text-blue-600 bg-gray-600 border-gray-500 rounded focus:ring-blue-500">
<span class="ml-2">Numbers (0-9)</span>
</label>
<label class="flex items-center">
<input type="checkbox" id="includeSymbols" class="form-checkbox h-4 w-4 text-blue-600 bg-gray-600 border-gray-500 rounded focus:ring-blue-500">
<span class="ml-2">Symbols (!@#$%^&*)</span>
</label>
</div>
</div>
<button type="submit" class="w-full bg-blue-600 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded-lg transition">
<i class="fas fa-key mr-2"></i> Generate Password
</button>
</form>
</div>
<div class="bg-gray-700 rounded-lg p-6">
<h3 class="text-xl font-semibold text-white mb-4">Generated Password</h3>
<div class="mb-4">
<div class="relative">
<input type="text" id="generatedPassword" readonly class="bg-gray-600 text-white px-4 py-3 rounded-lg w-full focus:outline-none focus:ring-2 focus:ring-blue-500 font-mono">
<button id="copyPassword" class="absolute right-2 top-2 bg-gray-500 hover:bg-gray-600 text-white p-1 rounded">
<i class="fas fa-copy"></i>
</button>
</div>
</div>
<div class="bg-gray-600 rounded-lg p-4">
<h4 class="font-semibold mb-2">Password Strength</h4>
<div class="mb-2">
<div class="w-full bg-gray-500 rounded-full h-2.5">
<div id="passwordStrengthBar" class="bg-red-500 h-2.5 rounded-full" style="width: 0%"></div>
</div>
</div>
<p id="passwordStrengthText" class="text-sm">Very Weak</p>
</div>
</div>
</div>
</div>
</section>
<!-- Signature Generator Section -->
<section id="signature-generator" class="tool-section">
<div class="bg-gray-800 rounded-lg shadow-lg p-6">
<h2 class="text-2xl font-bold text-white mb-6">Signature Generator</h2>
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
<div class="bg-gray-700 rounded-lg p-6">
<div class="mb-4">
<label class="block text-gray-300 mb-2">Draw your signature below:</label>
<canvas id="signatureCanvas" class="signature-canvas w-full h-48 touch-none"></canvas>
</div>
<div class="flex space-x-3">
<button id="clearSignature" class="flex-1 bg-gray-600 hover:bg-gray-500 text-white font-bold py-2 px-4 rounded-lg transition">
<i class="fas fa-eraser mr-2"></i> Clear
</button>
<button id="saveSignature" class="flex-1 bg-blue-600 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded-lg transition">
<i class="fas fa-save mr-2"></i> Save
</button>
</div>
</div>
<div class="bg-gray-700 rounded-lg p-6 flex flex-col items-center justify-center">
<h3 class="text-xl font-semibold text-white mb-4">Your Signature</h3>
<div id="signaturePreview" class="p-4 bg-white rounded-lg mb-4 w-full flex justify-center items-center h-48">
<p class="text-gray-500">Your signature will appear here</p>
</div>
<button id="downloadSignature" class="bg-green-600 hover:bg-green-700 text-white font-bold py-2 px-4 rounded-lg transition hidden">
<i class="fas fa-download mr-2"></i> Download
</button>
</div>
</div>
</div>
</section>
<!-- Colleges Section -->
<section id="colleges" class="tool-section">
<div class="bg-gray-800 rounded-lg shadow-lg p-6">
<h2 class="text-2xl font-bold text-white mb-6">Colleges & Universities</h2>
<div class="mb-6">
<div class="relative">
<input type="text" id="collegeSearch" class="bg-gray-700 text-white px-4 py-2 rounded-lg w-full focus:outline-none focus:ring-2 focus:ring-blue-500" placeholder="Search colleges by name or location...">
<i class="fas fa-search absolute right-3 top-3 text-gray-400"></i>
</div>
</div>
<div class="overflow-x-auto">
<table class="min-w-full bg-gray-700 rounded-lg overflow-hidden">
<thead class="bg-gray-600">
<tr>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-300 uppercase tracking-wider">Name</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-300 uppercase tracking-wider">Location</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-300 uppercase tracking-wider">Type</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-300 uppercase tracking-wider">Students</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-300 uppercase tracking-wider">Ranking</th>
</tr>
</thead>
<tbody id="collegesTableBody" class="divide-y divide-gray-600">
<!-- Colleges will be populated here -->
</tbody>
</table>
</div>
</div>
</section>
</main>
</div>
<!-- Settings Modal -->
<div id="settingsModal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 hidden">
<div class="bg-gray-800 rounded-lg shadow-xl w-full max-w-md">
<div class="p-6">
<div class="flex justify-between items-center mb-4">
<h3 class="text-xl font-bold text-white">Settings</h3>
<button id="closeSettings" class="text-gray-400 hover:text-white">
<i class="fas fa-times"></i>
</button>
</div>
<div class="space-y-4">
<div>
<label class="block text-gray-300 mb-2">Theme</label>
<select id="themeSelect" class="bg-gray-700 text-white rounded-lg p-2 w-full focus:outline-none focus:ring-2 focus:ring-blue-500">
<option value="dark">Dark</option>
<option value="light">Light</option>
<option value="blue">Blue</option>
</select>
</div>
<div>
<label class="block text-gray-300 mb-2">Background Image</label>
<select id="bgImageSelect" class="bg-gray-700 text-white rounded-lg p-2 w-full focus:outline-none focus:ring-2 focus:ring-blue-500">
<option value="none">None</option>
<option value="mountains">Mountains</option>
<option value="city">City</option>
<option value="space">Space</option>
<option value="custom">Custom URL</option>
</select>
</div>
<div id="customBgUrlContainer" class="hidden">
<label class="block text-gray-300 mb-2">Custom Background URL</label>
<input type="text" id="customBgUrl" class="bg-gray-700 text-white rounded-lg p-2 w-full focus:outline-none focus:ring-2 focus:ring-blue-500" placeholder="Enter image URL">
</div>
<div class="pt-4 border-t border-gray-700">
<button id="saveSettings" class="w-full bg-blue-600 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded-lg transition">
Save Settings
</button>
</div>
</div>
</div>
</div>
</div>
<script>
// Mock data
const mockSchools = [
{ name: "Lincoln High School", location: "New York, NY", type: "Public", students: 1250, rating: 4.5 },
{ name: "Jefferson Academy", location: "Chicago, IL", type: "Charter", students: 850, rating: 4.2 },
{ name: "Washington Prep", location: "Los Angeles, CA", type: "Public", students: 2100, rating: 4.0 },
{ name: "Roosevelt High", location: "Seattle, WA", type: "Public", students: 980, rating: 3.8 },
{ name: "Madison Academy", location: "Boston, MA", type: "Private", students: 650, rating: 4.7 },
{ name: "Kennedy High", location: "Houston, TX", type: "Public", students: 1750, rating: 3.9 },
{ name: "Adams Preparatory", location: "Philadelphia, PA", type: "Private", students: 720, rating: 4.6 }
];
const mockColleges = [
{ name: "Harvard University", location: "Cambridge, MA", type: "Private", students: 22000, ranking: 1 },
{ name: "Stanford University", location: "Stanford, CA", type: "Private", students: 17000, ranking: 2 },
{ name: "MIT", location: "Cambridge, MA", type: "Private", students: 11500, ranking: 3 },
{ name: "University of California, Berkeley", location: "Berkeley, CA", type: "Public", students: 42000, ranking: 4 },
{ name: "University of Michigan", location: "Ann Arbor, MI", type: "Public", students: 46000, ranking: 5 },
{ name: "University of Texas at Austin", location: "Austin, TX", type: "Public", students: 51000, ranking: 6 },
{ name: "Columbia University", location: "New York, NY", type: "Private", students: 33000, ranking: 7 }
];
const mockCities = {
"New York": {
country: "United States",
population: "8.8 million",
coordinates: "40.7128° N, 74.0060° W",
temperature: "72°F (22°C)",
weather: "Partly Cloudy",
timezone: "UTC-4 (EDT)",
facts: "New York City is the most populous city in the United States and a global hub for commerce, finance, culture, and entertainment."
},
"London": {
country: "United Kingdom",
population: "8.9 million",
coordinates: "51.5074° N, 0.1278° W",
temperature: "64°F (18°C)",
weather: "Rainy",
timezone: "UTC+1 (BST)",
facts: "London is the capital and largest city of England and the United Kingdom, with a history spanning nearly two millennia."
},
"Tokyo": {
country: "Japan",
population: "13.9 million",
coordinates: "35.6762° N, 139.6503° E",
temperature: "77°F (25°C)",
weather: "Sunny",
timezone: "UTC+9 (JST)",
facts: "Tokyo is the capital and most populous city of Japan, known for its modern architecture, vibrant pop culture, and historic temples."
},
"Paris": {
country: "France",
population: "2.1 million",
coordinates: "48.8566° N, 2.3522° E",
temperature: "68°F (20°C)",
weather: "Clear",
timezone: "UTC+2 (CEST)",
facts: "Paris is the capital and most populous city of France, known worldwide for its art, fashion, gastronomy, and culture."
},
"Sydney": {
country: "Australia",
population: "5.3 million",
coordinates: "33.8688° S, 151.2093° E",
temperature: "59°F (15°C)",
weather: "Partly Cloudy",
timezone: "UTC+10 (AEST)",
facts: "Sydney is the most populous city in Australia and a major global city, known for its harborfront Sydney Opera House and Harbour Bridge."
}
};
// DOM Elements
const sidebar = document.getElementById('sidebar');
const toggleSidebar = document.getElementById('toggleSidebar');
const mainContent = document.getElementById('mainContent');
const navItems = document.querySelectorAll('.nav-item');
const toolSections = document.querySelectorAll('.tool-section');
const currentSectionTitle = document.getElementById('currentSectionTitle');
const settingsBtn = document.getElementById('settingsBtn');
const settingsModal = document.getElementById('settingsModal');
const closeSettings = document.getElementById('closeSettings');
const saveSettings = document.getElementById('saveSettings');
const bgImageSelect = document.getElementById('bgImageSelect');
const customBgUrlContainer = document.getElementById('customBgUrlContainer');
const themeSelect = document.getElementById('themeSelect');
const logoutBtn = document.getElementById('logoutBtn');
// BMI Calculator
const bmiForm = document.getElementById('bmiForm');
const bmiResult = document.getElementById('bmiResult');
const bmiEmptyState = document.getElementById('bmiEmptyState');
const bmiValue = document.getElementById('bmiValue');
const bmiCategory = document.getElementById('bmiCategory');
// City Locator
const citySearchForm = document.getElementById('citySearchForm');
const cityResult = document.getElementById('cityResult');
const cityEmptyState = document.getElementById('cityEmptyState');
const cityNameDisplay = document.getElementById('cityNameDisplay');
const cityCountry = document.getElementById('cityCountry');
const cityPopulation = document.getElementById('cityPopulation');
const cityCoordinates = document.getElementById('cityCoordinates');
const cityTemperature = document.getElementById('cityTemperature');
const cityWeather = document.getElementById('cityWeather');
const cityTimezone = document.getElementById('cityTimezone');
const cityFacts = document.getElementById('cityFacts');
// High Schools
const schoolSearch = document.getElementById('schoolSearch');
const schoolsTableBody = document.getElementById('schoolsTableBody');
// Recovery Emails
const addEmailForm = document.getElementById('addEmailForm');
const emailsList = document.getElementById('emailsList');
const noEmailsMessage = document.getElementById('noEmailsMessage');
// Barcode Generator
const barcodeForm = document.getElementById('barcodeForm');
const barcodeContainer = document.getElementById('barcodeContainer');
const barcodeEmptyState = document.getElementById('barcodeEmptyState');
const downloadBarcode = document.getElementById('downloadBarcode');
// Password Generator
const passwordForm = document.getElementById('passwordForm');
const passwordLength = document.getElementById('passwordLength');
const lengthValue = document.getElementById('lengthValue');
const generatedPassword = document.getElementById('generatedPassword');
const copyPassword = document.getElementById('copyPassword');
const passwordStrengthBar = document.getElementById('passwordStrengthBar');
const passwordStrengthText = document.getElementById('passwordStrengthText');
// Signature Generator
const signatureCanvas = document.getElementById('signatureCanvas');
const signaturePreview = document.getElementById('signaturePreview');
const clearSignature = document.getElementById('clearSignature');
const saveSignature = document.getElementById('saveSignature');
const downloadSignature = document.getElementById('downloadSignature');
// Colleges
const collegeSearch = document.getElementById('collegeSearch');
const collegesTableBody = document.getElementById('collegesTableBody');
// Initialize
document.addEventListener('DOMContentLoaded', function() {
// Load saved settings
loadSettings();
// Populate schools table
populateSchoolsTable(mockSchools);
// Populate colleges table
populateCollegesTable(mockColleges);
// Initialize signature canvas
initSignatureCanvas();
// Set up event listeners
setupEventListeners();
// Show overview section by default
showSection('overview');
});
function loadSettings() {
const savedTheme = localStorage.getItem('theme') || 'dark';
const savedBgImage = localStorage.getItem('bgImage') || 'none';
const savedCustomBgUrl = localStorage.getItem('customBgUrl') || '';
themeSelect.value = savedTheme;
bgImageSelect.value = savedBgImage;
if (savedBgImage === 'custom') {
customBgUrlContainer.classList.remove('hidden');
document.getElementById('customBgUrl').value = savedCustomBgUrl;
}
applyTheme(savedTheme);
applyBackground(savedBgImage, savedCustomBgUrl);
}
function applyTheme(theme) {
document.body.classList.remove('theme-dark', 'theme-light', 'theme-blue');
document.body.classList.add(`theme-${theme}`);
}
function applyBackground(bgImage, customUrl = '') {
let bgUrl = '';
switch(bgImage) {
case 'mountains':
bgUrl = 'https://images.unsplash.com/photo-1519681393784-d120267933ba?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=2070&q=80';
break;
case 'city':
bgUrl = 'https://images.unsplash.com/photo-1480714378408-67cf0d13bc1b?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=2070&q=80';
break;
case 'space':
bgUrl = 'https://images.unsplash.com/photo-1506318137071-a8e063b4bec0?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=2070&q=80';
break;
case 'custom':
bgUrl = customUrl;
break;
default:
document.body.style.backgroundImage = 'none';
return;
}
if (bgUrl) {
document.body.style.backgroundImage = `url('${bgUrl}')`;
}
}
function populateSchoolsTable(schools) {
schoolsTableBody.innerHTML = '';
schools.forEach(school => {
const row = document.createElement('tr');
row.className = 'hover:bg-gray-600';
row.innerHTML = `
<td class="px-6 py-4 whitespace-nowrap">
<div class="text-white">${school.name}</div>
</td>
<td class="px-6 py-4 whitespace-nowrap">
<div class="text-gray-300">${school.location}</div>
</td>
<td class="px-6 py-4 whitespace-nowrap">
<span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full ${school.type === 'Public' ? 'bg-green-100 text-green-800' : school.type === 'Private' ? 'bg-purple-100 text-purple-800' : 'bg-blue-100 text-blue-800'}">
${school.type}
</span>
</td>
<td class="px-6 py-4 whitespace-nowrap text-gray-300">
${school.students.toLocaleString()}
</td>
<td class="px-6 py-4 whitespace-nowrap">
<div class="flex items-center">
<div class="mr-2 text-yellow-400">
${'★'.repeat(Math.floor(school.rating))}${'☆'.repeat(5 - Math.floor(school.rating))}
</div>
<span class="text-gray-300">${school.rating}/5</span>
</div>
</td>
`;
schoolsTableBody.appendChild(row);
});
}
function populateCollegesTable(colleges) {
collegesTableBody.innerHTML = '';
colleges.forEach(college => {
const row = document.createElement('tr');
row.className = 'hover:bg-gray-600';
row.innerHTML = `
<td class="px-6 py-4 whitespace-nowrap">
<div class="text-white">${college.name}</div>
</td>
<td class="px-6 py-4 whitespace-nowrap">
<div class="text-gray-300">${college.location}</div>
</td>
<td class="px-6 py-4 whitespace-nowrap">
<span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full ${college.type === 'Public' ? 'bg-green-100 text-green-800' : 'bg-purple-100 text-purple-800'}">
${college.type}
</span>
</td>
<td class="px-6 py-4 whitespace-nowrap text-gray-300">
${college.students.toLocaleString()}
</td>
<td class="px-6 py-4 whitespace-nowrap">
<span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-blue-100 text-blue-800">
#${college.ranking}
</span>
</td>
`;
collegesTableBody.appendChild(row);
});
}
function initSignatureCanvas() {
const canvas = signatureCanvas;
const ctx = canvas.getContext('2d');
let isDrawing = false;
let lastX = 0;
let lastY = 0;
// Set canvas size
function resizeCanvas() {
const rect = canvas.getBoundingClientRect();
canvas.width = rect.width;
canvas.height = rect.height;
}
resizeCanvas();
window.addEventListener('resize', resizeCanvas);
// Drawing functions
function startDrawing(e) {
isDrawing = true;
[lastX, lastY] = getPosition(e);
}
function draw(e) {
if (!isDrawing) return;
ctx.strokeStyle = '#000';
ctx.lineWidth = 2;
ctx.lineJoin = 'round';
ctx.lineCap = 'round';
const [x, y] = getPosition(e);
ctx.beginPath();
ctx.moveTo(lastX, lastY);
ctx.lineTo(x, y);
ctx.stroke();
[lastX, lastY] = [x, y];
}
function stopDrawing() {
isDrawing = false;
}
function getPosition(e) {
let x, y;
if (e.type.includes('touch')) {
const touch = e.touches[0] || e.changedTouches[0];
const rect = canvas.getBoundingClientRect();
x = touch.clientX - rect.left;
y = touch.clientY - rect.top;
} else {
x = e.offsetX;
y = e.offsetY;
}
return [x, y];
}
// Event listeners
canvas.addEventListener('mousedown', startDrawing);
canvas.addEventListener('mousemove', draw);
canvas.addEventListener('mouseup', stopDrawing);
canvas.addEventListener('mouseout', stopDrawing);
// Touch support
canvas.addEventListener('touchstart', (e) => {
e.preventDefault();
startDrawing(e);
});
canvas.addEventListener('touchmove', (e) => {
e.preventDefault();
draw(e);
});
canvas.addEventListener('touchend', (e) => {
e.preventDefault();
stopDrawing();
});
// Clear button
clearSignature.addEventListener('click', () => {
ctx.clearRect(0, 0, canvas.width, canvas.height);
});
// Save button
saveSignature.addEventListener('click', () => {
const dataUrl = canvas.toDataURL('image/png');
signaturePreview.innerHTML = `<img src="${dataUrl}" alt="Signature" class="max-w-full max-h-full">`;
downloadSignature.classList.remove('hidden');
downloadSignature.onclick = () => {
const link = document.createElement('a');
link.download = 'signature.png';
link.href = dataUrl;
link.click();
};
});
}
function setupEventListeners() {
// Sidebar toggle
toggleSidebar.addEventListener('click', () => {
sidebar.classList.toggle('sidebar-collapsed');
sidebar.classList.toggle('sidebar-expanded');
mainContent.classList.toggle('md:ml-64');
mainContent.classList.toggle('md:ml-20');
});
// Navigation
navItems.forEach(item => {
item.addEventListener('click', (e) => {
e.preventDefault();
const section = item.getAttribute('data-section');
showSection(section);
// Update active nav item
navItems.forEach(navItem => {
navItem.classList.remove('bg-gray-700', 'text-white', 'border-blue-500');
});
item.classList.add('bg-gray-700', 'text-white', 'border-blue-500');
});
});
// Quick links in overview
document.querySelectorAll('[data-section]').forEach(link => {
if (link.closest('#overview')) {
link.addEventListener('click', (e) => {
e.preventDefault();
const section = link.getAttribute('data-section');
showSection(section);
// Update active nav item
navItems.forEach(navItem => {
navItem.classList.remove('bg-gray-700', 'text-white', 'border-blue-500');
if (navItem.getAttribute('data-section') === section) {
navItem.classList.add('bg-gray-700', 'text-white', 'border-blue-500');
}
});
});
}
});
// Settings modal
settingsBtn.addEventListener('click', () => {
settingsModal.classList.remove('hidden');
});
closeSettings.addEventListener('click', () => {
settingsModal.classList.add('hidden');
});
bgImageSelect.addEventListener('change', (e) => {
if (e.target.value === 'custom') {
customBgUrlContainer.classList.remove('hidden');
} else {
customBgUrlContainer.classList.add('hidden');
}
});
saveSettings.addEventListener('click', () => {
const theme = themeSelect.value;
const bgImage = bgImageSelect.value;
const customBgUrl = document.getElementById('customBgUrl').value;
localStorage.setItem('theme', theme);
localStorage.setItem('bgImage', bgImage);
localStorage.setItem('customBgUrl', customBgUrl);
applyTheme(theme);
applyBackground(bgImage, customBgUrl);
settingsModal.classList.add('hidden');
});
logoutBtn.addEventListener('click', () => {
alert('Logout functionality would be implemented here');
});
// BMI Calculator
bmiForm.addEventListener('submit', (e) => {
e.preventDefault();
const height = parseFloat(document.getElementById('height').value);
const heightUnit = document.getElementById('heightUnit').value;
const weight = parseFloat(document.getElementById('weight').value);
const weightUnit = document.getElementById('weightUnit').value;
// Convert to metric if needed
const heightM = heightUnit === 'in' ? height * 0.0254 : height * 0.01;
const weightKg = weightUnit === 'lbs' ? weight * 0.453592 : weight;
// Calculate BMI
const bmi = weightKg / (heightM * heightM);
const roundedBMI = Math.round(bmi * 10) / 10;
// Determine category
let category, categoryClass;
if (bmi < 18.5) {
category = 'Underweight';
categoryClass = 'underweight';
} else if (bmi < 25) {
category = 'Normal weight';
categoryClass = 'normal';
} else if (bmi < 30) {
category = 'Overweight';
categoryClass = 'overweight';
} else {
category = 'Obese';
categoryClass = 'obese';
}
// Display results
bmiValue.textContent = roundedBMI;
bmiCategory.textContent = category;
bmiCategory.className = `text-xl mb-6 bmi-category ${categoryClass}`;
bmiEmptyState.classList.add('hidden');
bmiResult.classList.remove('hidden');
});
// City Locator
citySearchForm.addEventListener('submit', (e) => {
e.preventDefault();
const cityName = document.getElementById('cityName').value.trim();
const cityData = mockCities[cityName];
if (cityData) {
cityNameDisplay.textContent = cityName;
cityCountry.textContent = cityData.country;
cityPopulation.textContent = cityData.population;
cityCoordinates.textContent = cityData.coordinates;
cityTemperature.textContent = cityData.temperature;
cityWeather.textContent = cityData.weather;
cityTimezone.textContent = cityData.timezone;
cityFacts.textContent = cityData.facts;
cityEmptyState.classList.add('hidden');
cityResult.classList.remove('hidden');
} else {
cityEmptyState.classList.remove('hidden');
cityResult.classList.add('hidden');
alert('City not found in our database. Try New York, London, Tokyo, Paris, or Sydney.');
}
});
// High Schools search
schoolSearch.addEventListener('input', (e) => {
const searchTerm = e.target.value.toLowerCase();
const filteredSchools = mockSchools.filter(school =>
school.name.toLowerCase().includes(searchTerm) ||
school.location.toLowerCase().includes(searchTerm)
);
populateSchoolsTable(filteredSchools);
});
// Recovery Emails
let recoveryEmails = JSON.parse(localStorage.getItem('recoveryEmails')) || [];
function updateEmailsList() {
emailsList.innerHTML = '';
if (recoveryEmails.length === 0) {
noEmailsMessage.classList.remove('hidden');
return;
}
noEmailsMessage.classList.add('hidden');
recoveryEmails.forEach((email, index) => {
const emailItem = document.createElement('div');
emailItem.className = 'flex items-center justify-between bg-gray-600 p-3 rounded-lg';
emailItem.innerHTML = `
<div class="flex items-center">
<i class="fas fa-envelope text-gray-400 mr-3"></i>
<span class="text-white">${email}</span>
</div>
<button class="text-red-400 hover:text-red-300 delete-email" data-index="${index}">
<i class="fas fa-trash"></i>
</button>
`;
emailsList.appendChild(emailItem);
});
// Add event listeners to delete buttons
document.querySelectorAll('.delete-email').forEach(button => {
button.addEventListener('click', (e) => {
const index = parseInt(e.target.closest('button').getAttribute('data-index'));
recoveryEmails.splice(index, 1);
localStorage.setItem('recoveryEmails', JSON.stringify(recoveryEmails));
updateEmailsList();
});
});
}
updateEmailsList();
addEmailForm.addEventListener('submit', (e) => {
e.preventDefault();
const newEmail = document.getElementById('newEmail').value.trim();
if (!newEmail) return;
if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(newEmail)) {
alert('Please enter a valid email address');
return;
}
if (recoveryEmails.includes(newEmail)) {
alert('This email is already in your recovery list');
return;
}
recoveryEmails.push(newEmail);
localStorage.setItem('recoveryEmails', JSON.stringify(recoveryEmails));
document.getElementById('newEmail').value = '';
updateEmailsList();
});
// Barcode Generator
barcodeForm.addEventListener('submit', (e) => {
e.preventDefault();
const text = document.getElementById('barcodeText').value.trim();
const type = document.getElementById('barcodeType').value;
if (!text) {
alert('Please enter text to generate barcode');
return;
}
try {
JsBarcode("#barcode", text, {
format: type,
lineColor: "#000",
width: 2,
height: 100,
displayValue: true,
fontSize: 16,
margin: 10
});
barcodeEmptyState.classList.add('hidden');
barcodeContainer.classList.remove('hidden');
downloadBarcode.classList.remove('hidden');
downloadBarcode.onclick = () => {
const svg = document.querySelector('#barcode');
const svgData = new XMLSerializer().serializeToString(svg);
const canvas = document.createElement('canvas');
const ctx = canvas.getContext('2d');
const img = new Image();
img.onload = function() {
canvas.width = img.width;
canvas.height = img.height;
ctx.drawImage(img, 0, 0);
const pngFile = canvas.toDataURL('image/png');
const downloadLink = document.createElement('a');
downloadLink.download = `${text}-barcode.png`;
downloadLink.href = pngFile;
downloadLink.click();
};
img.src = 'data:image/svg+xml;base64,' + btoa(unescape(encodeURIComponent(svgData)));
};
} catch (error) {
alert('Error generating barcode: ' + error.message);
}
});
// Password Generator
passwordLength.addEventListener('input', (e) => {
lengthValue.textContent = e.target.value;
});
passwordForm.addEventListener('submit', (e) => {
e.preventDefault();
const length = parseInt(passwordLength.value);
const includeUppercase = document.getElementById('includeUppercase').checked;
const includeLowercase = document.getElementById('includeLowercase').checked;
const includeNumbers = document.getElementById('includeNumbers').checked;
const includeSymbols = document.getElementById('includeSymbols').checked;
if (!includeUppercase && !includeLowercase && !includeNumbers && !includeSymbols) {
alert('Please select at least one character type');
return;
}
const uppercaseChars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
const lowercaseChars = 'abcdefghijklmnopqrstuvwxyz';
const numberChars = '0123456789';
const symbolChars = '!@#$%^&*()_+-=[]{}|;:,.<>?';
let allowedChars = '';
if (includeUppercase) allowedChars += uppercaseChars;
if (includeLowercase) allowedChars += lowercaseChars;
if (includeNumbers) allowedChars += numberChars;
if (includeSymbols) allowedChars += symbolChars;
let password = '';
for (let i = 0; i < length; i++) {
const randomIndex = Math.floor(Math.random() * allowedChars.length);
password += allowedChars[randomIndex];
}
generatedPassword.value = password;
// Calculate password strength
let strength = 0;
if (length >= 12) strength += 2;
else if (length >= 8) strength += 1;
if (includeUppercase) strength += 1;
if (includeLowercase) strength += 1;
if (includeNumbers) strength += 1;
if (includeSymbols) strength += 2;
let strengthText, strengthColor, strengthWidth;
if (strength <= 3) {
strengthText = 'Very Weak';
strengthColor = 'bg-red-500';
strengthWidth = '25%';
} else if (strength <= 5) {
strengthText = 'Weak';
strengthColor = 'bg-orange-500';
strengthWidth = '50%';
} else if (strength <= 7) {
strengthText = 'Good';
strengthColor = 'bg-yellow-500';
strengthWidth = '75%';
} else {
strengthText = 'Strong';
strengthColor = 'bg-green-500';
strengthWidth = '100%';
}
passwordStrengthText.textContent = strengthText;
passwordStrengthBar.className = `${strengthColor} h-2.5 rounded-full`;
passwordStrengthBar.style.width = strengthWidth;
});
copyPassword.addEventListener('click', () => {
if (!generatedPassword.value) return;
generatedPassword.select();
document.execCommand('copy');
const originalText = copyPassword.innerHTML;
copyPassword.innerHTML = '<i class="fas fa-check mr-2"></i> Copied!';
setTimeout(() => {
copyPassword.innerHTML = originalText;
}, 2000);
});
// Colleges search
collegeSearch.addEventListener('input', (e) => {
const searchTerm = e.target.value.toLowerCase();
const filteredColleges = mockColleges.filter(college =>
college.name.toLowerCase().includes(searchTerm) ||
college.location.toLowerCase().includes(searchTerm)
);
populateCollegesTable(filteredColleges);
});
}
function showSection(sectionId) {
// Hide all sections
toolSections.forEach(section => {
section.classList.remove('active');
});
// Show selected section
const section = document.getElementById(sectionId);
if (section) {
section.classList.add('active');
// Update title
const navItem = document.querySelector(`.nav-item[data-section="${sectionId}"]`);
if (navItem) {
const title = navItem.querySelector('.nav-text').textContent;
currentSectionTitle.textContent = title;
}
}
}
</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=razen5556/utility-dashboard" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Utility Dashboard</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">
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/jsbarcode@3.11.5/dist/JsBarcode.all.min.js"></script>
<style>
body {
font-family: 'Inter', sans-serif;
background-size: cover;
background-position: center;
background-attachment: fixed;
transition: background-image 0.3s ease;
}
.sidebar {
transition: all 0.3s ease;
}
.sidebar-collapsed {
width: 80px;
}
.sidebar-collapsed .nav-text {
display: none;
}
.sidebar-expanded {
width: 250px;
}
.main-content {
transition: margin-left 0.3s ease;
}
.signature-canvas {
border: 1px solid #4b5563;
background-color: #1f2937;
}
.tool-section {
display: none;
}
.tool-section.active {
display: block;
}
.bmi-category {
font-weight: bold;
}
.underweight {
color: #3b82f6;
}
.normal {
color: #10b981;
}
.overweight {
color: #f59e0b;
}
.obese {
color: #ef4444;
}
</style>
</head>
<body class="bg-gray-900 text-gray-200 min-h-screen flex">
<!-- Sidebar -->
<div class="sidebar bg-gray-800 h-screen fixed sidebar-expanded" id="sidebar">
<div class="p-4 flex items-center justify-between border-b border-gray-700">
<h1 class="text-xl font-bold text-white">Utility Dashboard</h1>
<button id="toggleSidebar" class="text-gray-400 hover:text-white md:hidden">
<i class="fas fa-bars"></i>
</button>
</div>
<nav class="mt-6">
<ul>
<li>
<a href="#" data-section="overview" class="nav-item flex items-center px-4 py-3 text-gray-300 hover:bg-gray-700 hover:text-white border-l-4 border-transparent hover:border-blue-500">
<i class="fas fa-home w-6 text-center"></i>
<span class="nav-text ml-3">Overview</span>
</a>
</li>
<li>
<a href="#" data-section="bmi-calculator" class="nav-item flex items-center px-4 py-3 text-gray-300 hover:bg-gray-700 hover:text-white border-l-4 border-transparent hover:border-blue-500">
<i class="fas fa-weight w-6 text-center"></i>
<span class="nav-text ml-3">BMI Calculator</span>
</a>
</li>
<li>
<a href="#" data-section="city-locator" class="nav-item flex items-center px-4 py-3 text-gray-300 hover:bg-gray-700 hover:text-white border-l-4 border-transparent hover:border-blue-500">
<i class="fas fa-map-marker-alt w-6 text-center"></i>
<span class="nav-text ml-3">City Locator</span>
</a>
</li>
<li>
<a href="#" data-section="high-schools" class="nav-item flex items-center px-4 py-3 text-gray-300 hover:bg-gray-700 hover:text-white border-l-4 border-transparent hover:border-blue-500">
<i class="fas fa-school w-6 text-center"></i>
<span class="nav-text ml-3">High Schools</span>
</a>
</li>
<li>
<a href="#" data-section="recovery-emails" class="nav-item flex items-center px-4 py-3 text-gray-300 hover:bg-gray-700 hover:text-white border-l-4 border-transparent hover:border-blue-500">
<i class="fas fa-envelope w-6 text-center"></i>
<span class="nav-text ml-3">Recovery Emails</span>
</a>