Spaces:
Running
Running
File size: 15,030 Bytes
9c57894 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>360° Page Enhancer</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>
/* Custom CSS for the 360 effect */
.page-container {
transition: all 0.3s ease;
transform-origin: center center;
}
.enhanced-view {
transform: scale(1.5);
overflow-x: auto;
width: 150%;
margin-left: -25%;
background-color: white;
box-shadow: 0 0 20px rgba(0,0,0,0.2);
min-height: 100vh;
}
.toolbar {
position: fixed;
bottom: 20px;
right: 20px;
z-index: 9999;
transition: all 0.3s ease;
}
.toolbar-expanded {
width: 300px;
background: rgba(255,255,255,0.95);
border-radius: 15px;
box-shadow: 0 5px 15px rgba(0,0,0,0.2);
padding: 15px;
}
.pan-indicator {
position: fixed;
top: 10px;
right: 10px;
background: rgba(0,0,0,0.7);
color: white;
padding: 5px 10px;
border-radius: 20px;
font-size: 12px;
z-index: 9999;
display: none;
}
@media (max-width: 768px) {
.enhanced-view {
transform: scale(1.3);
width: 130%;
margin-left: -15%;
}
.toolbar {
bottom: 10px;
right: 10px;
}
.toolbar-expanded {
width: 280px;
}
}
</style>
</head>
<body>
<!-- Main page container that will be enhanced -->
<div id="pageContainer" class="page-container">
<!-- This would be the existing webpage content -->
<div class="p-8">
<h1 class="text-4xl font-bold mb-6">Sample Web Page</h1>
<p class="text-lg mb-4">This is a demonstration of how the 360° Page Enhancer would work on a typical webpage. When you click the enhance button, this content will expand to be more viewable.</p>
<div class="grid grid-cols-1 md:grid-cols-3 gap-6 my-8">
<div class="bg-blue-100 p-6 rounded-lg">
<h2 class="text-xl font-semibold mb-3">Feature 1</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam in dui mauris.</p>
</div>
<div class="bg-green-100 p-6 rounded-lg">
<h2 class="text-xl font-semibold mb-3">Feature 2</h2>
<p>Vivamus suscipit tortor eget felis porttitor volutpat. Curabitur non nulla sit amet nisl.</p>
</div>
<div class="bg-purple-100 p-6 rounded-lg">
<h2 class="text-xl font-semibold mb-3">Feature 3</h2>
<p>Pellentesque in ipsum id orci porta dapibus. Proin eget tortor risus.</p>
</div>
</div>
<div class="mt-10">
<img src="https://via.placeholder.com/1200x500" alt="Sample image" class="w-full rounded-lg shadow-md mb-6">
<p class="text-gray-700">This image and the surrounding content will become larger and more readable when the 360° enhancement is activated.</p>
</div>
</div>
</div>
<!-- Pan indicator (shown during enhanced view) -->
<div id="panIndicator" class="pan-indicator">
<i class="fas fa-arrows-alt mr-2"></i> Pan Mode Active
</div>
<!-- Enhancement toolbar -->
<div id="enhancerToolbar" class="toolbar">
<div id="toolbarContent" class="hidden">
<div class="flex justify-between items-center mb-4">
<h3 class="text-lg font-semibold">360° Page Enhancer</h3>
<button id="closeToolbar" class="text-gray-500 hover:text-gray-700">
<i class="fas fa-times"></i>
</button>
</div>
<div class="mb-4">
<label class="block text-sm font-medium text-gray-700 mb-1">Zoom Level</label>
<div class="flex items-center">
<button id="zoomOut" class="bg-gray-200 hover:bg-gray-300 p-2 rounded-l">
<i class="fas fa-search-minus"></i>
</button>
<div class="bg-gray-100 px-4 py-2 text-center w-full">
<span id="zoomLevel">100%</span>
</div>
<button id="zoomIn" class="bg-gray-200 hover:bg-gray-300 p-2 rounded-r">
<i class="fas fa-search-plus"></i>
</button>
</div>
</div>
<div class="flex space-x-2 mb-4">
<button id="panMode" class="flex-1 bg-blue-100 hover:bg-blue-200 text-blue-800 py-2 px-4 rounded flex items-center justify-center">
<i class="fas fa-arrows-alt mr-2"></i> Pan Mode
</button>
<button id="resetView" class="flex-1 bg-gray-100 hover:bg-gray-200 text-gray-800 py-2 px-4 rounded flex items-center justify-center">
<i class="fas fa-sync-alt mr-2"></i> Reset
</button>
</div>
<div class="text-xs text-gray-500">
<p>Tip: Use mouse wheel to zoom in/out when in pan mode.</p>
</div>
</div>
<button id="enhanceButton" class="bg-blue-600 hover:bg-blue-700 text-white rounded-full w-14 h-14 flex items-center justify-center shadow-lg">
<i class="fas fa-expand text-xl"></i>
</button>
</div>
<script>
document.addEventListener('DOMContentLoaded', function() {
const pageContainer = document.getElementById('pageContainer');
const enhancerToolbar = document.getElementById('enhancerToolbar');
const toolbarContent = document.getElementById('toolbarContent');
const enhanceButton = document.getElementById('enhanceButton');
const closeToolbar = document.getElementById('closeToolbar');
const zoomIn = document.getElementById('zoomIn');
const zoomOut = document.getElementById('zoomOut');
const zoomLevel = document.getElementById('zoomLevel');
const panMode = document.getElementById('panMode');
const resetView = document.getElementById('resetView');
const panIndicator = document.getElementById('panIndicator');
let isEnhanced = false;
let isPanMode = false;
let currentZoom = 1;
let startX, startY, scrollLeft, scrollTop;
// Toggle enhanced view
enhanceButton.addEventListener('click', function() {
isEnhanced = !isEnhanced;
if (isEnhanced) {
pageContainer.classList.add('enhanced-view');
toolbarContent.classList.remove('hidden');
enhancerToolbar.classList.add('toolbar-expanded');
enhanceButton.innerHTML = '<i class="fas fa-compress text-xl"></i>';
// Store original scroll position
scrollLeft = window.pageXOffset;
scrollTop = window.pageYOffset;
// Center the view
window.scrollTo(
(document.documentElement.scrollWidth - window.innerWidth) / 2,
(document.documentElement.scrollHeight - window.innerHeight) / 2
);
} else {
pageContainer.classList.remove('enhanced-view');
toolbarContent.classList.add('hidden');
enhancerToolbar.classList.remove('toolbar-expanded');
enhanceButton.innerHTML = '<i class="fas fa-expand text-xl"></i>';
disablePanMode();
// Restore original scroll position
window.scrollTo(scrollLeft, scrollTop);
}
});
// Close toolbar
closeToolbar.addEventListener('click', function() {
isEnhanced = false;
pageContainer.classList.remove('enhanced-view');
toolbarContent.classList.add('hidden');
enhancerToolbar.classList.remove('toolbar-expanded');
enhanceButton.innerHTML = '<i class="fas fa-expand text-xl"></i>';
disablePanMode();
// Restore original scroll position
window.scrollTo(scrollLeft, scrollTop);
});
// Zoom in
zoomIn.addEventListener('click', function() {
if (currentZoom < 3) {
currentZoom += 0.1;
updateZoom();
}
});
// Zoom out
zoomOut.addEventListener('click', function() {
if (currentZoom > 0.5) {
currentZoom -= 0.1;
updateZoom();
}
});
// Update zoom level
function updateZoom() {
pageContainer.style.transform = `scale(${currentZoom * 1.5})`;
zoomLevel.textContent = `${Math.round(currentZoom * 100)}%`;
}
// Toggle pan mode
panMode.addEventListener('click', function() {
isPanMode = !isPanMode;
if (isPanMode) {
enablePanMode();
} else {
disablePanMode();
}
});
// Enable pan mode
function enablePanMode() {
panMode.classList.add('bg-blue-500', 'text-white');
panMode.classList.remove('bg-blue-100', 'text-blue-800');
panIndicator.style.display = 'block';
// Make page container draggable
pageContainer.style.cursor = 'grab';
pageContainer.addEventListener('mousedown', startDrag);
document.addEventListener('mouseup', stopDrag);
document.addEventListener('mousemove', drag);
// Add wheel event for zooming during pan mode
pageContainer.addEventListener('wheel', handleWheel, { passive: false });
}
// Disable pan mode
function disablePanMode() {
isPanMode = false;
panMode.classList.remove('bg-blue-500', 'text-white');
panMode.classList.add('bg-blue-100', 'text-blue-800');
panIndicator.style.display = 'none';
// Remove draggable behavior
pageContainer.style.cursor = '';
pageContainer.removeEventListener('mousedown', startDrag);
document.removeEventListener('mouseup', stopDrag);
document.removeEventListener('mousemove', drag);
pageContainer.removeEventListener('wheel', handleWheel);
}
// Start drag
function startDrag(e) {
startX = e.pageX - pageContainer.offsetLeft;
startY = e.pageY - pageContainer.offsetTop;
pageContainer.style.cursor = 'grabbing';
}
// Stop drag
function stopDrag() {
pageContainer.style.cursor = 'grab';
}
// Drag movement
function drag(e) {
if (!isPanMode) return;
e.preventDefault();
const x = e.pageX - startX;
const y = e.pageY - startY;
// Calculate boundaries to prevent dragging too far
const maxX = (pageContainer.scrollWidth - window.innerWidth) / 2;
const maxY = (pageContainer.scrollHeight - window.innerHeight) / 2;
// Apply boundaries
const boundedX = Math.max(-maxX, Math.min(x, maxX));
const boundedY = Math.max(-maxY, Math.min(y, maxY));
pageContainer.style.left = `${boundedX}px`;
pageContainer.style.top = `${boundedY}px`;
}
// Handle wheel zoom
function handleWheel(e) {
if (!isPanMode) return;
e.preventDefault();
if (e.deltaY < 0) {
// Zoom in
if (currentZoom < 3) {
currentZoom += 0.05;
updateZoom();
}
} else {
// Zoom out
if (currentZoom > 0.5) {
currentZoom -= 0.05;
updateZoom();
}
}
}
// Reset view
resetView.addEventListener('click', function() {
currentZoom = 1;
updateZoom();
disablePanMode();
// Reset position
pageContainer.style.left = '0';
pageContainer.style.top = '0';
// Center the view
window.scrollTo(
(document.documentElement.scrollWidth - window.innerWidth) / 2,
(document.documentElement.scrollHeight - window.innerHeight) / 2
);
});
});
</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=Mackin7/360pluginenhancer" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html> |