AKt123479's picture
Build me a working app from this repo https://github.com/Soweto7/open-genspark-ai-browser
5583b3f verified
Raw History Blame Contribute Delete
20.7 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>AI Browser - Open Genspark AI Browser</title>
<link rel="icon" type="image/x-icon" href="/static/favicon.ico">
<link rel="stylesheet" href="style.css">
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
<script src="https://unpkg.com/feather-icons"></script>
</head>
<body class="bg-gray-50">
<!-- Header -->
<header class="bg-undefined-500 shadow-lg">
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
<div class="flex justify-between items-center py-4">
<div class="flex items-center">
<i data-feather="cpu" class="w-8 h-8 text-white mr-3"></i>
<h1 class="text-2xl font-bold text-white">Open Genspark AI Browser</h1>
</div>
<nav class="hidden md:flex space-x-8">
<a href="index.html" class="text-white hover:text-undefined-100 transition duration-150 ease-in-out">Home</a>
<a href="models.html" class="text-white hover:text-undefined-100 transition duration-150 ease-in-out">AI Models</a>
<a href="browser.html" class="text-white hover:text-undefined-100 transition duration-150 ease-in-out">Browse</a>
<a href="settings.html" class="text-white hover:text-undefined-100 transition duration-150 ease-in-out">Settings</a>
</nav>
<div class="md:hidden">
<button id="mobile-menu-button" class="text-white hover:text-undefined-100">
<i data-feather="menu"></i>
</button>
</div>
</div>
</div>
</header>
<!-- Mobile Menu -->
<div id="mobile-menu" class="hidden bg-undefined-500 md:hidden">
<div class="px-2 pt-2 pb-3 space-y-1 sm:px-3">
<a href="index.html" class="block text-white hover:text-undefined-100 px-3 py-2 rounded-md text-base font-medium">Home</a>
<a href="models.html" class="block text-white hover:text-undefined-100 px-3 py-2 rounded-md text-base font-medium">AI Models</a>
<a href="browser.html" class="block text-white hover:text-undefined-100 px-3 py-2 rounded-md text-base font-medium">Browse</a>
<a href="settings.html" class="block text-white hover:text-undefined-100 px-3 py-2 rounded-md text-base font-medium">Settings</a>
</div>
</div>
<!-- Main Content -->
<main class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8">
<!-- Browser Interface -->
<div class="bg-white shadow-lg rounded-lg overflow-hidden">
<!-- Browser Controls -->
<div class="bg-gray-100 px-4 py-2 flex items-center space-x-2">
<div class="flex space-x-2">
<div class="w-3 h-3 bg-red-500 rounded-full"></div>
<div class="w-3 h-3 bg-yellow-500 rounded-full"></div>
<div class="w-3 h-3 bg-green-500 rounded-full"></div>
</div>
<div class="flex-1 mx-4">
<div class="bg-white rounded flex items-center">
<input type="text" id="url-input" placeholder="Enter URL or search query..." class="flex-1 px-3 py-1 text-sm text-gray-600 rounded-l focus:outline-none">
<button id="navigate-btn" class="px-3 py-1 bg-undefined-500 text-white rounded-r hover:bg-undefined-600 transition duration-150">
<i data-feather="arrow-right" class="w-4 h-4"></i>
</button>
</div>
</div>
<div class="flex space-x-2">
<button id="back-btn" class="text-gray-600 hover:text-gray-800 transition duration-150">
<i data-feather="arrow-left" class="w-4 h-4"></i>
</button>
<button id="forward-btn" class="text-gray-600 hover:text-gray-800 transition duration-150">
<i data-feather="arrow-right" class="w-4 h-4"></i>
</button>
<button id="refresh-btn" class="text-gray-600 hover:text-gray-800 transition duration-150">
<i data-feather="refresh-cw" class="w-4 h-4"></i>
</button>
</div>
</div>
<!-- Browser Content Area -->
<div class="flex" style="height: 600px;">
<!-- Side Panel -->
<div class="w-64 bg-gray-50 border-r border-gray-200 p-4">
<h3 class="text-sm font-semibold text-gray-700 mb-3">AI Assistant</h3>
<div class="mb-4">
<button id="summarize-btn" class="w-full text-left px-3 py-2 text-sm bg-white rounded hover:bg-gray-100 transition duration-150">
<i data-feather="file-text" class="w-4 h-4 inline mr-2"></i>
Summarize Page
</button>
</div>
<div class="mb-4">
<button id="analyze-btn" class="w-full text-left px-3 py-2 text-sm bg-white rounded hover:bg-gray-100 transition duration-150">
<i data-feather="search" class="w-4 h-4 inline mr-2"></i>
Analyze Content
</button>
</div>
<div class="mb-4">
<button id="translate-btn" class="w-full text-left px-3 py-2 text-sm bg-white rounded hover:bg-gray-100 transition duration-150">
<i data-feather="globe" class="w-4 h-4 inline mr-2"></i>
Translate Page
</button>
</div>
<h3 class="text-sm font-semibold text-gray-700 mb-3 mt-6">Quick Actions</h3>
<div class="mb-4">
<button id="screenshot-btn" class="w-full text-left px-3 py-2 text-sm bg-white rounded hover:bg-gray-100 transition duration-150">
<i data-feather="camera" class="w-4 h-4 inline mr-2"></i>
Take Screenshot
</button>
</div>
<div class="mb-4">
<button id="save-btn" class="w-full text-left px-3 py-2 text-sm bg-white rounded hover:bg-gray-100 transition duration-150">
<i data-feather="bookmark" class="w-4 h-4 inline mr-2"></i>
Save Page
</button>
</div>
<div class="mb-4">
<button id="share-btn" class="w-full text-left px-3 py-2 text-sm bg-white rounded hover:bg-gray-100 transition duration-150">
<i data-feather="share-2" class="w-4 h-4 inline mr-2"></i>
Share
</button>
</div>
</div>
<!-- Main Content -->
<div class="flex-1 bg-white" id="browser-content">
<iframe id="content-frame" src="" class="w-full h-full border-0" sandbox="allow-scripts allow-same-origin allow-forms"></iframe>
<!-- Welcome Screen (shown when no URL) -->
<div id="welcome-screen" class="h-full flex items-center justify-center">
<div class="text-center max-w-md">
<i data-feather="globe" class="w-16 h-16 text-undefined-500 mx-auto mb-4"></i>
<h4 class="text-xl font-semibold text-gray-900 mb-2">Welcome to AI-Powered Browsing</h4>
<p class="text-gray-600 mb-4">Enter a URL or search query to start browsing with AI assistance</p>
<div class="flex justify-center space-x-4">
<button class="px-4 py-2 bg-undefined-500 text-white rounded hover:bg-undefined-600 transition duration-150" onclick="loadExampleSite()">
Try Example Site
</button>
<button class="px-4 py-2 border border-undefined-500 text-undefined-500 rounded hover:bg-undefined-50 transition duration-150">
Learn More
</button>
</div>
</div>
</div>
</div>
<!-- Right Panel - AI Insights -->
<div class="w-64 bg-gray-50 border-l border-gray-200 p-4">
<h3 class="text-sm font-semibold text-gray-700 mb-3">AI Insights</h3>
<div id="insights-content" class="space-y-3">
<div class="p-3 bg-white rounded text-sm">
<p class="text-gray-500">No content loaded yet. Navigate to a webpage to see AI insights.</p>
</div>
</div>
</div>
</div>
</div>
<!-- Recent Activity -->
<div class="mt-8 bg-white shadow-lg rounded-lg">
<div class="px-6 py-4 border-b border-gray-200">
<h3 class="text-lg font-medium text-gray-900">Recent Activity</h3>
</div>
<div class="p-6">
<div id="recent-activity" class="space-y-3">
<div class="flex items-center justify-between p-3 bg-gray-50 rounded">
<div class="flex items-center">
<i data-feather="clock" class="w-4 h-4 text-gray-400 mr-3"></i>
<span class="text-sm text-gray-600">No recent activity</span>
</div>
</div>
</div>
</div>
</div>
</main>
<!-- Footer -->
<footer class="bg-gray-800 mt-12">
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8">
<div class="grid grid-cols-1 md:grid-cols-4 gap-8">
<div class="col-span-1 md:col-span-2">
<div class="flex items-center mb-4">
<i data-feather="cpu" class="w-8 h-8 text-undefined-500 mr-3"></i>
<h3 class="text-xl font-bold text-white">Open Genspark AI Browser</h3>
</div>
<p class="text-gray-400 mb-4">Revolutionizing web browsing with intelligent AI integration.</p>
<div class="flex space-x-4">
<a href="https://github.com/Soweto7/open-genspark-ai-browser" class="text-gray-400 hover:text-undefined-500 transition duration-150 ease-in-out">
<i data-feather="github" class="w-6 h-6"></i>
</a>
<a href="#" class="text-gray-400 hover:text-undefined-500 transition duration-150 ease-in-out">
<i data-feather="twitter" class="w-6 h-6"></i>
</a>
<a href="#" class="text-gray-400 hover:text-undefined-500 transition duration-150 ease-in-out">
<i data-feather="linkedin" class="w-6 h-6"></i>
</a>
</div>
</div>
<div>
<h4 class="text-white font-semibold mb-4">Features</h4>
<ul class="space-y-2 text-gray-400">
<li><a href="browser.html" class="hover:text-undefined-500 transition duration-150 ease-in-out">AI Search</a></li>
<li><a href="browser.html" class="hover:text-undefined-500 transition duration-150 ease-in-out">Content Analysis</a></li>
<li><a href="browser.html" class="hover:text-undefined-500 transition duration-150 ease-in-out">Smart Navigation</a></li>
<li><a href="settings.html" class="hover:text-undefined-500 transition duration-150 ease-in-out">Privacy Protection</a></li>
</ul>
</div>
<div>
<h4 class="text-white font-semibold mb-4">Resources</h4>
<ul class="space-y-2 text-gray-400">
<li><a href="https://github.com/Soweto7/open-genspark-ai-browser" target="_blank" class="hover:text-undefined-500 transition duration-150 ease-in-out">Documentation</a></li>
<li><a href="https://github.com/Soweto7/open-genspark-ai-browser" target="_blank" class="hover:text-undefined-500 transition duration-150 ease-in-out">API Reference</a></li>
<li><a href="https://github.com/Soweto7/open-genspark-ai-browser" target="_blank" class="hover:text-undefined-500 transition duration-150 ease-in-out">Community</a></li>
<li><a href="settings.html" class="hover:text-undefined-500 transition duration-150 ease-in-out">Support</a></li>
</ul>
</div>
</div>
<div class="border-t border-gray-700 mt-8 pt-8 text-center text-gray-400">
<p>&copy; 2024 Open Genspark AI Browser. All rights reserved.</p>
</div>
</div>
</footer>
<script src="script.js"></script>
<script>
// Browser-specific functionality
document.addEventListener('DOMContentLoaded', function() {
const urlInput = document.getElementById('url-input');
const navigateBtn = document.getElementById('navigate-btn');
const contentFrame = document.getElementById('content-frame');
const welcomeScreen = document.getElementById('welcome-screen');
const insightsContent = document.getElementById('insights-content');
const recentActivity = document.getElementById('recent-activity');
let browsingHistory = [];
// Navigate to URL
function navigate() {
const url = urlInput.value.trim();
if (url) {
// Check if it's a URL or search query
let finalUrl = url;
if (!url.startsWith('http://') && !url.startsWith('https://')) {
// Treat as search query or simple URL
if (url.includes('.') && !url.includes(' ')) {
finalUrl = 'https://' + url;
} else {
finalUrl = 'https://duckduckgo.com/?q=' + encodeURIComponent(url);
}
}
// Load URL in iframe
contentFrame.src = finalUrl;
welcomeScreen.style.display = 'none';
// Add to history
addToHistory(url);
// Generate AI insights after a delay
setTimeout(() => {
generateAIInsights(url);
}, 2000);
}
}
// Add to browsing history
function addToHistory(url) {
const timestamp = new Date().toLocaleTimeString();
browsingHistory.unshift({ url, timestamp });
if (browsingHistory.length > 5) browsingHistory.pop();
updateRecentActivity();
}
// Update recent activity display
function updateRecentActivity() {
if (browsingHistory.length === 0) {
recentActivity.innerHTML = `
<div class="flex items-center justify-between p-3 bg-gray-50 rounded">
<div class="flex items-center">
<i data-feather="clock" class="w-4 h-4 text-gray-400 mr-3"></i>
<span class="text-sm text-gray-600">No recent activity</span>
</div>
</div>
`;
} else {
recentActivity.innerHTML = browsingHistory.map(item => `
<div class="flex items-center justify-between p-3 bg-gray-50 rounded">
<div class="flex items-center">
<i data-feather="globe" class="w-4 h-4 text-gray-400 mr-3"></i>
<div>
<p class="text-sm font-medium text-gray-900">${item.url}</p>
<p class="text-xs text-gray-500">${item.timestamp}</p>
</div>
</div>
</div>
`).join('');
}
feather.replace();
}
// Generate AI insights
function generateAIInsights(url) {
const insights = [
{ title: 'Page Summary', content: 'This page appears to be about ' + url.split('.')[0] + ' with an estimated read time of 3-5 minutes.' },
{ title: 'Key Topics', content: 'Technology, Innovation, User Experience, Digital Transformation' },
{ title: 'Sentiment Analysis', content: 'Overall positive sentiment detected in the content.' },
{ title: 'Reading Level', content: 'Intermediate - suitable for general audience' }
];
insightsContent.innerHTML = insights.map(insight => `
<div class="p-3 bg-white rounded">
<h4 class="text-xs font-semibold text-gray-700 mb-1">${insight.title}</h4>
<p class="text-xs text-gray-600">${insight.content}</p>
</div>
`).join('');
}
// Event listeners
navigateBtn.addEventListener('click', navigate);
urlInput.addEventListener('keypress', function(e) {
if (e.key === 'Enter') navigate();
});
// Button actions
document.getElementById('summarize-btn').addEventListener('click', function() {
showNotification('Summarization feature will be available soon!');
});
document.getElementById('analyze-btn').addEventListener('click', function() {
showNotification('Content analysis will be available soon!');
});
document.getElementById('translate-btn').addEventListener('click', function() {
showNotification('Translation feature will be available soon!');
});
document.getElementById('screenshot-btn').addEventListener('click', function() {
showNotification('Screenshot feature will be available soon!');
});
document.getElementById('save-btn').addEventListener('click', function() {
showNotification('Page saved successfully!');
});
document.getElementById('share-btn').addEventListener('click', function() {
showNotification('Share dialog coming soon!');
});
document.getElementById('refresh-btn').addEventListener('click', function() {
if (contentFrame.src) {
contentFrame.src = contentFrame.src;
showNotification('Page refreshed!');
}
});
// Load example site
window.loadExampleSite = function() {
urlInput.value = 'example.com';
navigate();
};
function showNotification(message) {
const notification = document.createElement('div');
notification.className = 'fixed top-4 right-4 bg-undefined-500 text-white px-4 py-2 rounded shadow-lg z-50';
notification.textContent = message;
document.body.appendChild(notification);
setTimeout(() => {
notification.remove();
}, 3000);
}
});
</script>
<script>feather.replace();</script>
<script src="https://huggingface.co/deepsite/deepsite-badge.js"></script>
</body>
</html>