scrapl, make a todo app, a .py pp
Browse files- README.md +7 -4
- browser.html +49 -0
- components/footer.js +51 -0
- components/navbar.js +86 -0
- index.html +63 -19
- script.js +31 -0
- style.css +35 -18
- todo.html +156 -0
- todo.py +124 -0
README.md
CHANGED
|
@@ -1,10 +1,13 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
|
| 4 |
-
colorFrom: green
|
| 5 |
colorTo: blue
|
|
|
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
|
|
|
|
|
|
| 8 |
---
|
| 9 |
|
| 10 |
-
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
title: ToDoSnake - Python Task Tamer π
|
| 3 |
+
colorFrom: yellow
|
|
|
|
| 4 |
colorTo: blue
|
| 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).
|
browser.html
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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>PyBrowse - Browser</title>
|
| 7 |
+
<link rel="stylesheet" href="style.css">
|
| 8 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
| 9 |
+
<script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
|
| 10 |
+
<script src="https://unpkg.com/feather-icons"></script>
|
| 11 |
+
</head>
|
| 12 |
+
<body class="bg-gray-100 min-h-screen flex flex-col">
|
| 13 |
+
<custom-navbar></custom-navbar>
|
| 14 |
+
|
| 15 |
+
<div class="flex flex-col flex-grow">
|
| 16 |
+
<div class="bg-white p-4 shadow-sm">
|
| 17 |
+
<div class="flex items-center max-w-6xl mx-auto">
|
| 18 |
+
<div class="flex items-center bg-gray-100 rounded-full px-4 py-2 flex-grow">
|
| 19 |
+
<i data-feather="lock" class="text-gray-500 mr-2"></i>
|
| 20 |
+
<input type="text" class="bg-transparent outline-none w-full" placeholder="Search or enter website name" id="url-bar">
|
| 21 |
+
<i data-feather="refresh-cw" class="text-gray-500 ml-2 cursor-pointer"></i>
|
| 22 |
+
</div>
|
| 23 |
+
<button class="ml-2 bg-indigo-600 text-white p-2 rounded-full">
|
| 24 |
+
<i data-feather="search"></i>
|
| 25 |
+
</button>
|
| 26 |
+
</div>
|
| 27 |
+
</div>
|
| 28 |
+
|
| 29 |
+
<div class="flex-grow p-4">
|
| 30 |
+
<div class="max-w-6xl mx-auto bg-white rounded-lg shadow-sm h-full flex items-center justify-center">
|
| 31 |
+
<div class="text-center p-8">
|
| 32 |
+
<i data-feather="compass" class="w-16 h-16 mx-auto text-indigo-600 mb-4"></i>
|
| 33 |
+
<h2 class="text-2xl font-bold text-gray-800">Start Browsing Securely</h2>
|
| 34 |
+
<p class="text-gray-600 mt-2">Enter a URL or search term above to begin</p>
|
| 35 |
+
</div>
|
| 36 |
+
</div>
|
| 37 |
+
</div>
|
| 38 |
+
</div>
|
| 39 |
+
|
| 40 |
+
<custom-footer></custom-footer>
|
| 41 |
+
|
| 42 |
+
<script src="components/navbar.js"></script>
|
| 43 |
+
<script src="components/footer.js"></script>
|
| 44 |
+
<script src="script.js"></script>
|
| 45 |
+
<script>
|
| 46 |
+
feather.replace();
|
| 47 |
+
</script>
|
| 48 |
+
</body>
|
| 49 |
+
</html>
|
components/footer.js
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
class CustomFooter extends HTMLElement {
|
| 2 |
+
connectedCallback() {
|
| 3 |
+
this.attachShadow({ mode: 'open' });
|
| 4 |
+
this.shadowRoot.innerHTML = `
|
| 5 |
+
<style>
|
| 6 |
+
:host {
|
| 7 |
+
display: block;
|
| 8 |
+
width: 100%;
|
| 9 |
+
background-color: white;
|
| 10 |
+
border-top: 1px solid #e5e7eb;
|
| 11 |
+
}
|
| 12 |
+
footer {
|
| 13 |
+
padding: 1.5rem 2rem;
|
| 14 |
+
text-align: center;
|
| 15 |
+
color: #6b7280;
|
| 16 |
+
font-size: 0.875rem;
|
| 17 |
+
}
|
| 18 |
+
.footer-links {
|
| 19 |
+
display: flex;
|
| 20 |
+
justify-content: center;
|
| 21 |
+
gap: 1.5rem;
|
| 22 |
+
margin-bottom: 1rem;
|
| 23 |
+
}
|
| 24 |
+
.footer-link {
|
| 25 |
+
color: #6b7280;
|
| 26 |
+
transition: color 0.2s;
|
| 27 |
+
}
|
| 28 |
+
.footer-link:hover {
|
| 29 |
+
color: #4f46e5;
|
| 30 |
+
}
|
| 31 |
+
@media (max-width: 768px) {
|
| 32 |
+
.footer-links {
|
| 33 |
+
flex-direction: column;
|
| 34 |
+
gap: 0.5rem;
|
| 35 |
+
}
|
| 36 |
+
}
|
| 37 |
+
</style>
|
| 38 |
+
<footer>
|
| 39 |
+
<div class="footer-links">
|
| 40 |
+
<a href="#" class="footer-link">Terms</a>
|
| 41 |
+
<a href="#" class="footer-link">Privacy</a>
|
| 42 |
+
<a href="#" class="footer-link">Security</a>
|
| 43 |
+
<a href="#" class="footer-link">Status</a>
|
| 44 |
+
<a href="#" class="footer-link">Help</a>
|
| 45 |
+
</div>
|
| 46 |
+
<p>Β© 2023 PyBrowse - A secure Python Chromium browser</p>
|
| 47 |
+
</footer>
|
| 48 |
+
`;
|
| 49 |
+
}
|
| 50 |
+
}
|
| 51 |
+
customElements.define('custom-footer', CustomFooter);
|
components/navbar.js
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
class CustomNavbar extends HTMLElement {
|
| 2 |
+
connectedCallback() {
|
| 3 |
+
this.attachShadow({ mode: 'open' });
|
| 4 |
+
this.shadowRoot.innerHTML = `
|
| 5 |
+
<style>
|
| 6 |
+
:host {
|
| 7 |
+
display: block;
|
| 8 |
+
width: 100%;
|
| 9 |
+
background-color: white;
|
| 10 |
+
box-shadow: 0 1px 3px rgba(0,0,0,0.1);
|
| 11 |
+
}
|
| 12 |
+
nav {
|
| 13 |
+
display: flex;
|
| 14 |
+
justify-content: space-between;
|
| 15 |
+
align-items: center;
|
| 16 |
+
padding: 1rem 2rem;
|
| 17 |
+
max-width: 100%;
|
| 18 |
+
}
|
| 19 |
+
.logo {
|
| 20 |
+
display: flex;
|
| 21 |
+
align-items: center;
|
| 22 |
+
font-weight: 600;
|
| 23 |
+
color: #4f46e5;
|
| 24 |
+
}
|
| 25 |
+
.logo-icon {
|
| 26 |
+
margin-right: 0.5rem;
|
| 27 |
+
}
|
| 28 |
+
.nav-links {
|
| 29 |
+
display: flex;
|
| 30 |
+
gap: 1.5rem;
|
| 31 |
+
}
|
| 32 |
+
.nav-link {
|
| 33 |
+
color: #4b5563;
|
| 34 |
+
font-weight: 500;
|
| 35 |
+
transition: color 0.2s;
|
| 36 |
+
}
|
| 37 |
+
.nav-link:hover {
|
| 38 |
+
color: #4f46e5;
|
| 39 |
+
}
|
| 40 |
+
.user-profile {
|
| 41 |
+
display: flex;
|
| 42 |
+
align-items: center;
|
| 43 |
+
gap: 0.5rem;
|
| 44 |
+
}
|
| 45 |
+
.avatar {
|
| 46 |
+
width: 32px;
|
| 47 |
+
height: 32px;
|
| 48 |
+
border-radius: 50%;
|
| 49 |
+
background-color: #e5e7eb;
|
| 50 |
+
display: flex;
|
| 51 |
+
align-items: center;
|
| 52 |
+
justify-content: center;
|
| 53 |
+
}
|
| 54 |
+
@media (max-width: 768px) {
|
| 55 |
+
nav {
|
| 56 |
+
padding: 1rem;
|
| 57 |
+
}
|
| 58 |
+
.nav-links {
|
| 59 |
+
display: none;
|
| 60 |
+
}
|
| 61 |
+
}
|
| 62 |
+
</style>
|
| 63 |
+
<nav>
|
| 64 |
+
<a href="/" class="logo">
|
| 65 |
+
<i data-feather="globe" class="logo-icon"></i>
|
| 66 |
+
<span>PyBrowse</span>
|
| 67 |
+
</a>
|
| 68 |
+
|
| 69 |
+
<div class="nav-links">
|
| 70 |
+
<a href="/browser.html" class="nav-link">Browser</a>
|
| 71 |
+
<a href="#" class="nav-link">Settings</a>
|
| 72 |
+
<a href="#" class="nav-link">Privacy</a>
|
| 73 |
+
<a href="#" class="nav-link">Help</a>
|
| 74 |
+
</div>
|
| 75 |
+
|
| 76 |
+
<div class="user-profile">
|
| 77 |
+
<div class="avatar">
|
| 78 |
+
<i data-feather="user"></i>
|
| 79 |
+
</div>
|
| 80 |
+
<span class="hidden md:inline">User</span>
|
| 81 |
+
</div>
|
| 82 |
+
</nav>
|
| 83 |
+
`;
|
| 84 |
+
}
|
| 85 |
+
}
|
| 86 |
+
customElements.define('custom-navbar', CustomNavbar);
|
index.html
CHANGED
|
@@ -1,19 +1,63 @@
|
|
| 1 |
-
<!
|
| 2 |
-
<html>
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
</
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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>PyBrowse - Secure Python Browser</title>
|
| 7 |
+
<link rel="stylesheet" href="style.css">
|
| 8 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
| 9 |
+
<script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
|
| 10 |
+
<script src="https://unpkg.com/feather-icons"></script>
|
| 11 |
+
<script src="https://accounts.google.com/gsi/client" async defer></script>
|
| 12 |
+
</head>
|
| 13 |
+
<body class="bg-gray-100 min-h-screen flex flex-col">
|
| 14 |
+
<custom-navbar></custom-navbar>
|
| 15 |
+
|
| 16 |
+
<main class="flex-grow flex items-center justify-center p-4">
|
| 17 |
+
<div class="w-full max-w-md bg-white rounded-xl shadow-lg p-8 text-center">
|
| 18 |
+
<div class="mb-6">
|
| 19 |
+
<i data-feather="globe" class="w-16 h-16 mx-auto text-indigo-600"></i>
|
| 20 |
+
<h1 class="text-3xl font-bold mt-4 text-gray-800">Welcome to PyBrowse</h1>
|
| 21 |
+
<p class="text-gray-600 mt-2">A secure, minimalist Chromium browser built with Python</p>
|
| 22 |
+
</div>
|
| 23 |
+
|
| 24 |
+
<div id="g_id_onload"
|
| 25 |
+
data-client_id="YOUR_GOOGLE_CLIENT_ID.apps.googleusercontent.com"
|
| 26 |
+
data-context="signin"
|
| 27 |
+
data-ux_mode="popup"
|
| 28 |
+
data-callback="handleCredentialResponse"
|
| 29 |
+
data-auto_prompt="false">
|
| 30 |
+
</div>
|
| 31 |
+
|
| 32 |
+
<div class="g_id_signin"
|
| 33 |
+
data-type="standard"
|
| 34 |
+
data-shape="rectangular"
|
| 35 |
+
data-theme="outline"
|
| 36 |
+
data-text="signin_with"
|
| 37 |
+
data-size="large"
|
| 38 |
+
data-logo_alignment="left"
|
| 39 |
+
data-width="300">
|
| 40 |
+
</div>
|
| 41 |
+
|
| 42 |
+
<p class="text-sm text-gray-500 mt-4">By signing in, you agree to our Terms of Service</p>
|
| 43 |
+
</div>
|
| 44 |
+
</main>
|
| 45 |
+
|
| 46 |
+
<custom-footer></custom-footer>
|
| 47 |
+
|
| 48 |
+
<script src="components/navbar.js"></script>
|
| 49 |
+
<script src="components/footer.js"></script>
|
| 50 |
+
<script src="script.js"></script>
|
| 51 |
+
<script>
|
| 52 |
+
feather.replace();
|
| 53 |
+
|
| 54 |
+
function handleCredentialResponse(response) {
|
| 55 |
+
// Handle the Google Sign-In response
|
| 56 |
+
console.log("ID Token: " + response.credential);
|
| 57 |
+
// Here you would typically verify the token with your backend
|
| 58 |
+
window.location.href = "/browser.html";
|
| 59 |
+
}
|
| 60 |
+
</script>
|
| 61 |
+
<script src="https://huggingface.co/deepsite/deepsite-badge.js"></script>
|
| 62 |
+
</body>
|
| 63 |
+
</html>
|
script.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Main application logic
|
| 2 |
+
document.addEventListener('DOMContentLoaded', () => {
|
| 3 |
+
// Initialize browser functionality
|
| 4 |
+
const urlBar = document.getElementById('url-bar');
|
| 5 |
+
if (urlBar) {
|
| 6 |
+
urlBar.addEventListener('keypress', (e) => {
|
| 7 |
+
if (e.key === 'Enter') {
|
| 8 |
+
navigateTo(urlBar.value);
|
| 9 |
+
}
|
| 10 |
+
});
|
| 11 |
+
}
|
| 12 |
+
});
|
| 13 |
+
|
| 14 |
+
function navigateTo(url) {
|
| 15 |
+
if (!url) return;
|
| 16 |
+
|
| 17 |
+
// Basic URL validation
|
| 18 |
+
let finalUrl = url;
|
| 19 |
+
if (!url.startsWith('http://') && !url.startsWith('https://')) {
|
| 20 |
+
if (url.includes(' ') || url.includes('.') === false) {
|
| 21 |
+
// Treat as search query
|
| 22 |
+
finalUrl = `https://www.google.com/search?q=${encodeURIComponent(url)}`;
|
| 23 |
+
} else {
|
| 24 |
+
finalUrl = `https://${url}`;
|
| 25 |
+
}
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
// In a real implementation, this would load the URL in the browser view
|
| 29 |
+
console.log(`Navigating to: ${finalUrl}`);
|
| 30 |
+
// window.location.href = `/browser?url=${encodeURIComponent(finalUrl)}`;
|
| 31 |
+
}
|
style.css
CHANGED
|
@@ -1,28 +1,45 @@
|
|
|
|
|
|
|
|
| 1 |
body {
|
| 2 |
-
|
| 3 |
-
font-family: -apple-system, BlinkMacSystemFont, "Arial", sans-serif;
|
| 4 |
}
|
| 5 |
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
|
|
|
|
|
|
|
|
|
| 9 |
}
|
| 10 |
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
margin-bottom: 10px;
|
| 15 |
-
margin-top: 5px;
|
| 16 |
}
|
| 17 |
|
| 18 |
-
.
|
| 19 |
-
|
| 20 |
-
margin: 0 auto;
|
| 21 |
-
padding: 16px;
|
| 22 |
-
border: 1px solid lightgray;
|
| 23 |
-
border-radius: 16px;
|
| 24 |
}
|
| 25 |
|
| 26 |
-
.
|
| 27 |
-
|
| 28 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
|
| 2 |
+
|
| 3 |
body {
|
| 4 |
+
font-family: 'Inter', sans-serif;
|
|
|
|
| 5 |
}
|
| 6 |
|
| 7 |
+
#g_id_onload, .g_id_signin {
|
| 8 |
+
margin: 0 auto;
|
| 9 |
+
}
|
| 10 |
+
/* Todo App Styles */
|
| 11 |
+
.task-item {
|
| 12 |
+
transition: all 0.2s ease;
|
| 13 |
}
|
| 14 |
|
| 15 |
+
.task-item:hover {
|
| 16 |
+
transform: translateY(-2px);
|
| 17 |
+
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
|
|
|
|
|
|
| 18 |
}
|
| 19 |
|
| 20 |
+
.complete-btn, .delete-btn {
|
| 21 |
+
transition: transform 0.2s ease;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
}
|
| 23 |
|
| 24 |
+
.complete-btn:hover, .delete-btn:hover {
|
| 25 |
+
transform: scale(1.1);
|
| 26 |
}
|
| 27 |
+
|
| 28 |
+
/* Custom scrollbar */
|
| 29 |
+
::-webkit-scrollbar {
|
| 30 |
+
width: 8px;
|
| 31 |
+
height: 8px;
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
::-webkit-scrollbar-track {
|
| 35 |
+
background: #f1f1f1;
|
| 36 |
+
}
|
| 37 |
+
|
| 38 |
+
::-webkit-scrollbar-thumb {
|
| 39 |
+
background: #888;
|
| 40 |
+
border-radius: 4px;
|
| 41 |
+
}
|
| 42 |
+
|
| 43 |
+
::-webkit-scrollbar-thumb:hover {
|
| 44 |
+
background: #555;
|
| 45 |
+
}
|
todo.html
ADDED
|
@@ -0,0 +1,156 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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>ToDoSnake - Task Manager</title>
|
| 7 |
+
<link rel="stylesheet" href="style.css">
|
| 8 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
| 9 |
+
<script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
|
| 10 |
+
</head>
|
| 11 |
+
<body class="bg-gray-100 min-h-screen flex flex-col">
|
| 12 |
+
<custom-navbar></custom-navbar>
|
| 13 |
+
|
| 14 |
+
<main class="flex-grow container mx-auto p-4">
|
| 15 |
+
<div class="max-w-2xl mx-auto bg-white rounded-xl shadow-lg p-6">
|
| 16 |
+
<div class="flex items-center justify-between mb-6">
|
| 17 |
+
<h1 class="text-2xl font-bold text-gray-800 flex items-center">
|
| 18 |
+
<i data-feather="check-circle" class="text-green-500 mr-2"></i>
|
| 19 |
+
ToDoSnake
|
| 20 |
+
</h1>
|
| 21 |
+
<button id="download-btn" class="bg-indigo-600 text-white px-4 py-2 rounded-lg flex items-center">
|
| 22 |
+
<i data-feather="download" class="mr-2"></i>
|
| 23 |
+
Get Python App
|
| 24 |
+
</button>
|
| 25 |
+
</div>
|
| 26 |
+
|
| 27 |
+
<div class="flex mb-4">
|
| 28 |
+
<input type="text" id="task-input" placeholder="Add a new task..."
|
| 29 |
+
class="flex-grow border border-gray-300 rounded-l-lg px-4 py-2 focus:outline-none focus:ring-2 focus:ring-indigo-500">
|
| 30 |
+
<button id="add-btn" class="bg-indigo-600 text-white px-4 py-2 rounded-r-lg">
|
| 31 |
+
<i data-feather="plus"></i>
|
| 32 |
+
</button>
|
| 33 |
+
</div>
|
| 34 |
+
|
| 35 |
+
<div class="space-y-2" id="task-list">
|
| 36 |
+
<!-- Tasks will be added here dynamically -->
|
| 37 |
+
<div class="task-item flex items-center justify-between bg-gray-50 p-3 rounded-lg">
|
| 38 |
+
<div class="flex items-center">
|
| 39 |
+
<button class="complete-btn text-gray-400 hover:text-green-500 mr-3">
|
| 40 |
+
<i data-feather="circle"></i>
|
| 41 |
+
</button>
|
| 42 |
+
<span class="task-text">Example task - click to edit</span>
|
| 43 |
+
</div>
|
| 44 |
+
<button class="delete-btn text-gray-400 hover:text-red-500">
|
| 45 |
+
<i data-feather="trash-2"></i>
|
| 46 |
+
</button>
|
| 47 |
+
</div>
|
| 48 |
+
</div>
|
| 49 |
+
</div>
|
| 50 |
+
</main>
|
| 51 |
+
|
| 52 |
+
<custom-footer></custom-footer>
|
| 53 |
+
|
| 54 |
+
<script src="components/navbar.js"></script>
|
| 55 |
+
<script src="components/footer.js"></script>
|
| 56 |
+
<script src="script.js"></script>
|
| 57 |
+
<script>
|
| 58 |
+
feather.replace();
|
| 59 |
+
|
| 60 |
+
document.getElementById('download-btn').addEventListener('click', function() {
|
| 61 |
+
window.location.href = '/todo.py';
|
| 62 |
+
});
|
| 63 |
+
|
| 64 |
+
// Todo app functionality
|
| 65 |
+
document.addEventListener('DOMContentLoaded', () => {
|
| 66 |
+
const taskInput = document.getElementById('task-input');
|
| 67 |
+
const addBtn = document.getElementById('add-btn');
|
| 68 |
+
const taskList = document.getElementById('task-list');
|
| 69 |
+
|
| 70 |
+
// Load tasks from localStorage
|
| 71 |
+
let tasks = JSON.parse(localStorage.getItem('tasks')) || [];
|
| 72 |
+
|
| 73 |
+
// Render tasks
|
| 74 |
+
function renderTasks() {
|
| 75 |
+
taskList.innerHTML = '';
|
| 76 |
+
tasks.forEach((task, index) => {
|
| 77 |
+
const taskItem = document.createElement('div');
|
| 78 |
+
taskItem.className = 'task-item flex items-center justify-between bg-gray-50 p-3 rounded-lg';
|
| 79 |
+
taskItem.innerHTML = `
|
| 80 |
+
<div class="flex items-center">
|
| 81 |
+
<button class="complete-btn ${task.completed ? 'text-green-500' : 'text-gray-400'} hover:text-green-500 mr-3">
|
| 82 |
+
<i data-feather="${task.completed ? 'check-circle' : 'circle'}"></i>
|
| 83 |
+
</button>
|
| 84 |
+
<span class="task-text ${task.completed ? 'line-through text-gray-400' : ''}">${task.text}</span>
|
| 85 |
+
</div>
|
| 86 |
+
<button class="delete-btn text-gray-400 hover:text-red-500">
|
| 87 |
+
<i data-feather="trash-2"></i>
|
| 88 |
+
</button>
|
| 89 |
+
`;
|
| 90 |
+
|
| 91 |
+
// Add event listeners
|
| 92 |
+
const completeBtn = taskItem.querySelector('.complete-btn');
|
| 93 |
+
const deleteBtn = taskItem.querySelector('.delete-btn');
|
| 94 |
+
const taskText = taskItem.querySelector('.task-text');
|
| 95 |
+
|
| 96 |
+
completeBtn.addEventListener('click', () => toggleComplete(index));
|
| 97 |
+
deleteBtn.addEventListener('click', () => deleteTask(index));
|
| 98 |
+
taskText.addEventListener('click', () => editTask(index));
|
| 99 |
+
|
| 100 |
+
taskList.appendChild(taskItem);
|
| 101 |
+
});
|
| 102 |
+
feather.replace();
|
| 103 |
+
}
|
| 104 |
+
|
| 105 |
+
// Add new task
|
| 106 |
+
function addTask() {
|
| 107 |
+
const text = taskInput.value.trim();
|
| 108 |
+
if (text) {
|
| 109 |
+
tasks.push({ text, completed: false });
|
| 110 |
+
saveTasks();
|
| 111 |
+
renderTasks();
|
| 112 |
+
taskInput.value = '';
|
| 113 |
+
}
|
| 114 |
+
}
|
| 115 |
+
|
| 116 |
+
// Toggle task completion
|
| 117 |
+
function toggleComplete(index) {
|
| 118 |
+
tasks[index].completed = !tasks[index].completed;
|
| 119 |
+
saveTasks();
|
| 120 |
+
renderTasks();
|
| 121 |
+
}
|
| 122 |
+
|
| 123 |
+
// Delete task
|
| 124 |
+
function deleteTask(index) {
|
| 125 |
+
tasks.splice(index, 1);
|
| 126 |
+
saveTasks();
|
| 127 |
+
renderTasks();
|
| 128 |
+
}
|
| 129 |
+
|
| 130 |
+
// Edit task
|
| 131 |
+
function editTask(index) {
|
| 132 |
+
const newText = prompt('Edit your task:', tasks[index].text);
|
| 133 |
+
if (newText !== null && newText.trim()) {
|
| 134 |
+
tasks[index].text = newText.trim();
|
| 135 |
+
saveTasks();
|
| 136 |
+
renderTasks();
|
| 137 |
+
}
|
| 138 |
+
}
|
| 139 |
+
|
| 140 |
+
// Save tasks to localStorage
|
| 141 |
+
function saveTasks() {
|
| 142 |
+
localStorage.setItem('tasks', JSON.stringify(tasks));
|
| 143 |
+
}
|
| 144 |
+
|
| 145 |
+
// Event listeners
|
| 146 |
+
addBtn.addEventListener('click', addTask);
|
| 147 |
+
taskInput.addEventListener('keypress', (e) => {
|
| 148 |
+
if (e.key === 'Enter') addTask();
|
| 149 |
+
});
|
| 150 |
+
|
| 151 |
+
// Initial render
|
| 152 |
+
renderTasks();
|
| 153 |
+
});
|
| 154 |
+
</script>
|
| 155 |
+
</body>
|
| 156 |
+
</html>
|
todo.py
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
```python
|
| 2 |
+
import tkinter as tk
|
| 3 |
+
from tkinter import messagebox, ttk
|
| 4 |
+
import json
|
| 5 |
+
import os
|
| 6 |
+
|
| 7 |
+
class TodoApp:
|
| 8 |
+
def __init__(self, root):
|
| 9 |
+
self.root = root
|
| 10 |
+
self.root.title("ToDoSnake π")
|
| 11 |
+
self.root.geometry("500x500")
|
| 12 |
+
self.root.resizable(False, False)
|
| 13 |
+
|
| 14 |
+
# Load or create tasks file
|
| 15 |
+
self.tasks_file = "tasks.json"
|
| 16 |
+
self.tasks = []
|
| 17 |
+
self.load_tasks()
|
| 18 |
+
|
| 19 |
+
# UI Setup
|
| 20 |
+
self.setup_ui()
|
| 21 |
+
|
| 22 |
+
def setup_ui(self):
|
| 23 |
+
# Main frame
|
| 24 |
+
main_frame = tk.Frame(self.root, padx=20, pady=20)
|
| 25 |
+
main_frame.pack(fill=tk.BOTH, expand=True)
|
| 26 |
+
|
| 27 |
+
# Header
|
| 28 |
+
header = tk.Label(main_frame, text="ToDoSnake", font=("Helvetica", 24, "bold"))
|
| 29 |
+
header.pack(pady=(0, 20))
|
| 30 |
+
|
| 31 |
+
# Input frame
|
| 32 |
+
input_frame = tk.Frame(main_frame)
|
| 33 |
+
input_frame.pack(fill=tk.X, pady=(0, 15))
|
| 34 |
+
|
| 35 |
+
self.task_entry = tk.Entry(input_frame, font=("Helvetica", 12), width=30)
|
| 36 |
+
self.task_entry.pack(side=tk.LEFT, fill=tk.X, expand=True)
|
| 37 |
+
|
| 38 |
+
add_btn = tk.Button(input_frame, text="Add", command=self.add_task, bg="#4CAF50", fg="white")
|
| 39 |
+
add_btn.pack(side=tk.RIGHT, padx=(10, 0))
|
| 40 |
+
|
| 41 |
+
# Task list
|
| 42 |
+
self.task_list = ttk.Treeview(main_frame, columns=("status", "task"), show="headings", height=15)
|
| 43 |
+
self.task_list.heading("status", text="Status")
|
| 44 |
+
self.task_list.heading("task", text="Task")
|
| 45 |
+
self.task_list.column("status", width=80, anchor="center")
|
| 46 |
+
self.task_list.column("task", width=380, anchor="w")
|
| 47 |
+
self.task_list.pack(fill=tk.BOTH, expand=True)
|
| 48 |
+
|
| 49 |
+
# Button frame
|
| 50 |
+
button_frame = tk.Frame(main_frame)
|
| 51 |
+
button_frame.pack(fill=tk.X, pady=(15, 0))
|
| 52 |
+
|
| 53 |
+
complete_btn = tk.Button(button_frame, text="Complete", command=self.complete_task, bg="#2196F3", fg="white")
|
| 54 |
+
complete_btn.pack(side=tk.LEFT, padx=(0, 10))
|
| 55 |
+
|
| 56 |
+
delete_btn = tk.Button(button_frame, text="Delete", command=self.delete_task, bg="#F44336", fg="white")
|
| 57 |
+
delete_btn.pack(side=tk.LEFT)
|
| 58 |
+
|
| 59 |
+
# Populate tasks
|
| 60 |
+
self.update_task_list()
|
| 61 |
+
|
| 62 |
+
# Bind double click to edit
|
| 63 |
+
self.task_list.bind("<Double-1>", self.edit_task)
|
| 64 |
+
|
| 65 |
+
def add_task(self):
|
| 66 |
+
task_text = self.task_entry.get().strip()
|
| 67 |
+
if task_text:
|
| 68 |
+
self.tasks.append({"text": task_text, "completed": False})
|
| 69 |
+
self.save_tasks()
|
| 70 |
+
self.update_task_list()
|
| 71 |
+
self.task_entry.delete(0, tk.END)
|
| 72 |
+
else:
|
| 73 |
+
messagebox.showwarning("Warning", "Please enter a task!")
|
| 74 |
+
|
| 75 |
+
def complete_task(self):
|
| 76 |
+
selected = self.task_list.selection()
|
| 77 |
+
if selected:
|
| 78 |
+
index = int(selected[0][1:]) - 1
|
| 79 |
+
self.tasks[index]["completed"] = not self.tasks[index]["completed"]
|
| 80 |
+
self.save_tasks()
|
| 81 |
+
self.update_task_list()
|
| 82 |
+
|
| 83 |
+
def delete_task(self):
|
| 84 |
+
selected = self.task_list.selection()
|
| 85 |
+
if selected:
|
| 86 |
+
index = int(selected[0][1:]) - 1
|
| 87 |
+
del self.tasks[index]
|
| 88 |
+
self.save_tasks()
|
| 89 |
+
self.update_task_list()
|
| 90 |
+
|
| 91 |
+
def edit_task(self, event):
|
| 92 |
+
selected = self.task_list.selection()
|
| 93 |
+
if selected:
|
| 94 |
+
index = int(selected[0][1:]) - 1
|
| 95 |
+
new_text = simpledialog.askstring("Edit Task", "Edit your task:", initialvalue=self.tasks[index]["text"])
|
| 96 |
+
if new_text and new_text.strip():
|
| 97 |
+
self.tasks[index]["text"] = new_text.strip()
|
| 98 |
+
self.save_tasks()
|
| 99 |
+
self.update_task_list()
|
| 100 |
+
|
| 101 |
+
def update_task_list(self):
|
| 102 |
+
self.task_list.delete(*self.task_list.get_children())
|
| 103 |
+
for i, task in enumerate(self.tasks):
|
| 104 |
+
status = "β" if task["completed"] else "β"
|
| 105 |
+
item = self.task_list.insert("", tk.END, values=(status, task["text"]), iid=f"t{i+1}")
|
| 106 |
+
if task["completed"]:
|
| 107 |
+
self.task_list.item(item, tags=("completed",))
|
| 108 |
+
|
| 109 |
+
self.task_list.tag_configure("completed", foreground="gray")
|
| 110 |
+
|
| 111 |
+
def load_tasks(self):
|
| 112 |
+
if os.path.exists(self.tasks_file):
|
| 113 |
+
with open(self.tasks_file, "r") as f:
|
| 114 |
+
self.tasks = json.load(f)
|
| 115 |
+
|
| 116 |
+
def save_tasks(self):
|
| 117 |
+
with open(self.tasks_file, "w") as f:
|
| 118 |
+
json.dump(self.tasks, f)
|
| 119 |
+
|
| 120 |
+
if __name__ == "__main__":
|
| 121 |
+
root = tk.Tk()
|
| 122 |
+
app = TodoApp(root)
|
| 123 |
+
root.mainloop()
|
| 124 |
+
```
|