tasktime / index.html
Denito86's picture
Add 3 files
1f513c3 verified
Raw History Blame Contribute Delete
16.5 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Photoshop Task Timer</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>
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
body {
font-family: 'Inter', sans-serif;
background-color: #1a1a2e;
}
.photoshop-gradient {
background: linear-gradient(135deg, #31a8ff 0%, #1473e6 50%, #0d4599 100%);
}
.task-card {
transition: all 0.3s ease;
border-left: 4px solid #31a8ff;
}
.task-card:hover {
transform: translateY(-2px);
box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}
.timer-display {
font-family: 'Courier New', monospace;
letter-spacing: 2px;
}
.blink {
animation: blink 1s infinite;
}
@keyframes blink {
0%, 100% { opacity: 1; }
50% { opacity: 0.5; }
}
input[type="time"]::-webkit-calendar-picker-indicator {
filter: invert(1);
cursor: pointer;
}
</style>
</head>
<body class="min-h-screen text-white">
<div class="container mx-auto px-4 py-8 max-w-4xl">
<header class="flex items-center justify-between mb-10">
<div class="flex items-center">
<i class="fas fa-stopwatch text-3xl mr-3 text-blue-400"></i>
<h1 class="text-3xl font-bold">Photoshop Task Timer</h1>
</div>
<div class="flex items-center space-x-2">
<span id="current-date" class="text-gray-300"></span>
<span id="current-time" class="font-mono bg-gray-800 px-3 py-1 rounded-lg"></span>
</div>
</header>
<div class="grid grid-cols-1 md:grid-cols-3 gap-6 mb-8">
<!-- Timer Controls -->
<div class="photoshop-gradient p-6 rounded-xl shadow-lg col-span-1">
<h2 class="text-xl font-semibold mb-4">Set Timer</h2>
<div class="space-y-4">
<div>
<label for="task-name" class="block text-sm font-medium mb-1">Task Name</label>
<input type="text" id="task-name" placeholder="e.g. Photo Retouching"
class="w-full bg-gray-800 bg-opacity-50 border border-gray-700 rounded-lg px-4 py-2 focus:outline-none focus:ring-2 focus:ring-blue-400">
</div>
<div>
<label for="duration" class="block text-sm font-medium mb-1">Duration</label>
<input type="time" id="duration" value="00:30" step="60"
class="w-full bg-gray-800 bg-opacity-50 border border-gray-700 rounded-lg px-4 py-2 focus:outline-none focus:ring-2 focus:ring-blue-400">
</div>
<button id="start-timer" class="w-full bg-white text-blue-600 font-bold py-2 px-4 rounded-lg hover:bg-gray-100 transition">
<i class="fas fa-play mr-2"></i> Start Task
</button>
</div>
</div>
<!-- Active Timer Display -->
<div class="bg-gray-800 p-6 rounded-xl shadow-lg col-span-2">
<h2 class="text-xl font-semibold mb-4">Current Task</h2>
<div id="active-timer-display" class="text-center py-8">
<div id="no-active-timer" class="text-gray-400">
<i class="fas fa-clock text-4xl mb-3"></i>
<p>No active timer</p>
</div>
<div id="timer-running" class="hidden">
<h3 id="current-task-name" class="text-xl font-medium mb-2"></h3>
<div class="timer-display text-5xl font-bold mb-6" id="countdown">00:30:00</div>
<div class="flex justify-center space-x-3">
<button id="pause-timer" class="bg-yellow-500 text-white py-2 px-6 rounded-lg hover:bg-yellow-600 transition">
<i class="fas fa-pause mr-2"></i> Pause
</button>
<button id="stop-timer" class="bg-red-500 text-white py-2 px-6 rounded-lg hover:bg-red-600 transition">
<i class="fas fa-stop mr-2"></i> Stop
</button>
</div>
</div>
</div>
</div>
</div>
<!-- Task History -->
<div class="bg-gray-800 p-6 rounded-xl shadow-lg">
<div class="flex justify-between items-center mb-4">
<h2 class="text-xl font-semibold">Task History</h2>
<button id="clear-history" class="text-sm text-gray-400 hover:text-white transition">
<i class="fas fa-trash-alt mr-1"></i> Clear All
</button>
</div>
<div id="task-history" class="space-y-3">
<div class="text-center text-gray-500 py-4">
<i class="fas fa-history text-2xl mb-2"></i>
<p>No tasks completed yet</p>
</div>
</div>
</div>
</div>
<script>
document.addEventListener('DOMContentLoaded', function() {
// Update current date and time
function updateDateTime() {
const now = new Date();
document.getElementById('current-date').textContent = now.toLocaleDateString('en-US', {
weekday: 'long',
month: 'short',
day: 'numeric'
});
document.getElementById('current-time').textContent = now.toLocaleTimeString('en-US', {
hour: '2-digit',
minute: '2-digit'
});
}
updateDateTime();
setInterval(updateDateTime, 1000);
// Timer functionality
let timerInterval;
let remainingTime = 0;
let isPaused = false;
let currentTask = null;
let taskHistory = JSON.parse(localStorage.getItem('photoshopTaskHistory')) || [];
// Display task history if exists
if (taskHistory.length > 0) {
renderTaskHistory();
}
// Start timer
document.getElementById('start-timer').addEventListener('click', function() {
const taskName = document.getElementById('task-name').value.trim() || 'Unnamed Task';
const durationInput = document.getElementById('duration').value;
const [hours, minutes] = durationInput.split(':').map(Number);
remainingTime = (hours * 3600) + (minutes * 60);
if (remainingTime <= 0) {
alert('Please set a valid duration');
return;
}
currentTask = {
name: taskName,
duration: remainingTime,
startTime: new Date()
};
document.getElementById('task-name').value = '';
document.getElementById('no-active-timer').classList.add('hidden');
document.getElementById('timer-running').classList.remove('hidden');
document.getElementById('current-task-name').textContent = taskName;
updateTimerDisplay();
if (!isPaused) {
timerInterval = setInterval(updateTimer, 1000);
}
isPaused = false;
});
// Pause timer
document.getElementById('pause-timer').addEventListener('click', function() {
if (isPaused) {
timerInterval = setInterval(updateTimer, 1000);
this.innerHTML = '<i class="fas fa-pause mr-2"></i> Pause';
} else {
clearInterval(timerInterval);
this.innerHTML = '<i class="fas fa-play mr-2"></i> Resume';
}
isPaused = !isPaused;
});
// Stop timer
document.getElementById('stop-timer').addEventListener('click', function() {
clearInterval(timerInterval);
if (currentTask) {
const endTime = new Date();
const timeSpent = currentTask.duration - remainingTime;
// Add to history
taskHistory.unshift({
name: currentTask.name,
duration: currentTask.duration,
timeSpent: timeSpent,
startTime: currentTask.startTime,
endTime: endTime,
completed: remainingTime <= 0
});
// Keep only last 10 tasks
if (taskHistory.length > 10) {
taskHistory = taskHistory.slice(0, 10);
}
localStorage.setItem('photoshopTaskHistory', JSON.stringify(taskHistory));
renderTaskHistory();
}
resetTimer();
});
// Clear history
document.getElementById('clear-history').addEventListener('click', function() {
if (confirm('Are you sure you want to clear all task history?')) {
taskHistory = [];
localStorage.removeItem('photoshopTaskHistory');
document.getElementById('task-history').innerHTML = `
<div class="text-center text-gray-500 py-4">
<i class="fas fa-history text-2xl mb-2"></i>
<p>No tasks completed yet</p>
</div>
`;
}
});
// Timer functions
function updateTimer() {
if (remainingTime > 0) {
remainingTime--;
updateTimerDisplay();
// Flash when 1 minute remaining
if (remainingTime === 60) {
const display = document.getElementById('countdown');
display.classList.add('text-red-400', 'blink');
}
} else {
clearInterval(timerInterval);
document.getElementById('countdown').textContent = "00:00:00";
document.getElementById('countdown').classList.add('text-red-500');
// Play completion sound
const audio = new Audio('https://assets.mixkit.co/sfx/preview/mixkit-alarm-digital-clock-beep-989.mp3');
audio.play();
// Show notification
if (Notification.permission === 'granted') {
new Notification('Photoshop Task Complete', {
body: `"${currentTask.name}" timer has finished!`,
icon: 'https://upload.wikimedia.org/wikipedia/commons/a/af/Adobe_Photoshop_CC_icon.svg'
});
}
}
}
function updateTimerDisplay() {
const hours = Math.floor(remainingTime / 3600);
const minutes = Math.floor((remainingTime % 3600) / 60);
const seconds = remainingTime % 60;
document.getElementById('countdown').textContent =
`${hours.toString().padStart(2, '0')}:${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}`;
}
function resetTimer() {
clearInterval(timerInterval);
remainingTime = 0;
currentTask = null;
isPaused = false;
document.getElementById('no-active-timer').classList.remove('hidden');
document.getElementById('timer-running').classList.add('hidden');
document.getElementById('countdown').classList.remove('text-red-400', 'text-red-500', 'blink');
}
function renderTaskHistory() {
const historyContainer = document.getElementById('task-history');
if (taskHistory.length === 0) {
historyContainer.innerHTML = `
<div class="text-center text-gray-500 py-4">
<i class="fas fa-history text-2xl mb-2"></i>
<p>No tasks completed yet</p>
</div>
`;
return;
}
historyContainer.innerHTML = taskHistory.map(task => `
<div class="task-card bg-gray-700 p-4 rounded-lg hover:bg-gray-600 transition cursor-pointer">
<div class="flex justify-between items-center">
<div>
<h3 class="font-medium">${task.name}</h3>
<p class="text-sm text-gray-400">
${task.startTime.toLocaleString()} -
${task.endTime.toLocaleTimeString([], {hour: '2-digit', minute:'2-digit'})}
</p>
</div>
<div class="text-right">
<p class="font-mono ${task.completed ? 'text-green-400' : 'text-yellow-400'}">
${formatTime(task.timeSpent)} / ${formatTime(task.duration)}
</p>
<p class="text-xs ${task.completed ? 'text-green-300' : 'text-yellow-300'}">
${task.completed ? 'Completed' : 'Stopped early'}
</p>
</div>
</div>
</div>
`).join('');
}
function formatTime(seconds) {
const hours = Math.floor(seconds / 3600);
const minutes = Math.floor((seconds % 3600) / 60);
const secs = seconds % 60;
if (hours > 0) {
return `${hours}h ${minutes}m`;
} else if (minutes > 0) {
return `${minutes}m ${secs}s`;
} else {
return `${secs}s`;
}
}
// Request notification permission
if (Notification.permission !== 'granted' && Notification.permission !== 'denied') {
Notification.requestPermission();
}
});
</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=Denito86/tasktime" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html>