Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- OWOT Multi-Window UI System
- Features:
- - Glassmorphism & Modern Dark Theme
- - Draggable & Closeable Windows
- - Reusable Window Creation API
- - Automatic input isolation
- */
- (function() {
- const theme = {
- bg: 'rgba(25, 25, 30, 0.9)',
- accent: '#5e5ce6',
- text: '#ffffff',
- textDim: '#a0a0a5',
- border: 'rgba(255, 255, 255, 0.1)',
- shadow: '0 8px 32px rgba(0, 0, 0, 0.4)'
- };
- const containerId = 'owot-multi-window-container';
- let container = document.getElementById(containerId);
- if (!container) {
- container = document.createElement('div');
- container.id = containerId;
- document.body.appendChild(container);
- }
- function createWindow(id, title, content, x, y, width = 250) {
- if (document.getElementById(`owot-win-${id}`)) return;
- const win = document.createElement('div');
- win.id = `owot-win-${id}`;
- win.style = `
- position: fixed;
- left: ${x}px;
- top: ${y}px;
- width: ${width}px;
- background: ${theme.bg};
- backdrop-filter: blur(12px);
- border: 1px solid ${theme.border};
- border-radius: 12px;
- box-shadow: ${theme.shadow};
- color: ${theme.text};
- font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
- z-index: 10002;
- overflow: hidden;
- display: flex;
- flex-direction: column;
- user-select: none;
- animation: owotWinFadeIn 0.3s ease;
- `;
- win.innerHTML = `
- <div class="owot-win-header" style="padding: 12px; background: rgba(255,255,255,0.05); cursor: move; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid ${theme.border};">
- <span style="font-weight: 600; font-size: 13px; letter-spacing: 0.5px;">${title.toUpperCase()}</span>
- <span class="owot-win-close" style="cursor: pointer; opacity: 0.5; transition: 0.2s; font-size: 18px;">×</span>
- </div>
- <div class="owot-win-body" style="padding: 15px; font-size: 13px; color: ${theme.textDim}; max-height: 400px; overflow-y: auto;">
- ${content}
- </div>
- `;
- container.appendChild(win);
- const closeBtn = win.querySelector('.owot-win-close');
- closeBtn.onmousedown = (e) => e.stopPropagation();
- closeBtn.onclick = () => win.remove();
- closeBtn.onmouseover = () => closeBtn.style.opacity = '1';
- closeBtn.onmouseout = () => closeBtn.style.opacity = '0.5';
- // Dragging Logic
- const header = win.querySelector('.owot-win-header');
- let isDragging = false;
- let offset = { x: 0, y: 0 };
- header.onmousedown = (e) => {
- isDragging = true;
- offset.x = e.clientX - win.offsetLeft;
- offset.y = e.clientY - win.offsetTop;
- win.style.zIndex = '10003';
- Array.from(container.children).forEach(c => {
- if (c !== win) c.style.zIndex = '10002';
- });
- };
- document.addEventListener('mousemove', (e) => {
- if (!isDragging) return;
- win.style.left = (e.clientX - offset.x) + 'px';
- win.style.top = (e.clientY - offset.y) + 'px';
- });
- document.addEventListener('mouseup', () => isDragging = false);
- // Input isolation
- win.querySelectorAll('input, textarea, select').forEach(el => {
- ['keydown', 'keyup', 'keypress'].forEach(evt => {
- el.addEventListener(evt, (e) => e.stopPropagation());
- });
- });
- }
- // Add Fade-In Animation
- const styleTag = document.createElement('style');
- styleTag.innerHTML = `
- @keyframes owotWinFadeIn {
- from { opacity: 0; transform: translateY(10px) scale(0.98); }
- to { opacity: 1; transform: translateY(0) scale(1); }
- }
- .owot-win-body::-webkit-scrollbar { width: 4px; }
- .owot-win-body::-webkit-scrollbar-track { background: transparent; }
- .owot-win-body::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 10px; }
- `;
- document.head.appendChild(styleTag);
- // Initial Desktop Layout
- createWindow('dashboard', 'System Dashboard', `
- <div style="display: grid; grid-template-columns: 1fr 1fr; gap: 10px;">
- <div style="background: rgba(255,255,255,0.03); padding: 8px; border-radius: 8px; text-align: center;">
- <div style="font-size: 10px; color: ${theme.accent};">STABILITY</div>
- <div style="font-size: 16px; color: #fff;">100%</div>
- </div>
- <div style="background: rgba(255,255,255,0.03); padding: 8px; border-radius: 8px; text-align: center;">
- <div style="font-size: 10px; color: ${theme.accent};">PING</div>
- <div style="font-size: 16px; color: #fff;">24ms</div>
- </div>
- </div>
- <div style="margin-top: 15px;">
- <div style="margin-bottom: 5px; display: flex; justify-content: space-between;">
- <span>CPU Usage</span>
- <span>12%</span>
- </div>
- <div style="height: 4px; background: rgba(255,255,255,0.05); border-radius: 2px;">
- <div style="width: 12%; height: 100%; background: ${theme.accent}; border-radius: 2px;"></div>
- </div>
- </div>
- `, 20, 20, 220);
- createWindow('toolbox', 'Toolbox', `
- <button style="width: 100%; padding: 8px; margin-bottom: 8px; background: ${theme.accent}; border: none; color: white; border-radius: 6px; cursor: pointer; font-size: 12px; font-weight: 500;">Refresh Assets</button>
- <button style="width: 100%; padding: 8px; margin-bottom: 8px; background: rgba(255,255,255,0.05); border: 1px solid ${theme.border}; color: white; border-radius: 6px; cursor: pointer; font-size: 12px;">Clear Cache</button>
- <div style="display: flex; gap: 5px;">
- <input type="text" placeholder="Command..." style="flex: 1; background: #000; border: 1px solid ${theme.border}; color: #fff; padding: 5px; border-radius: 4px; font-size: 11px;">
- <button style="background: #222; border: 1px solid ${theme.border}; color: #fff; padding: 5px 10px; border-radius: 4px; cursor: pointer;">↵</button>
- </div>
- `, 260, 20, 200);
- createWindow('weather', 'World Weather', `
- <div style="display: flex; align-items: center; gap: 15px;">
- <div style="font-size: 32px;">☀️</div>
- <div>
- <div style="font-size: 18px; color: #fff; font-weight: 600;">Sunny</div>
- <div style="font-size: 11px;">World Offset: 0, 0</div>
- </div>
- </div>
- <div style="margin-top: 15px; font-size: 11px;">
- It is a beautiful day in Our World of Text. Visibility is high and the text density is optimal.
- </div>
- `, 20, 200, 220);
- createWindow('stats', 'Live Feed', `
- <div style="display: flex; flex-direction: column; gap: 8px;">
- <div style="border-left: 2px solid #ed4b4b; padding-left: 10px;">
- <div style="font-size: 11px; color: #fff;">Guest_3021 connected</div>
- <div style="font-size: 9px;">2 seconds ago</div>
- </div>
- <div style="border-left: 2px solid #4bed6d; padding-left: 10px;">
- <div style="font-size: 11px; color: #fff;">New text block at (34, -12)</div>
- <div style="font-size: 9px;">1 minute ago</div>
- </div>
- <div style="border-left: 2px solid #4b97ed; padding-left: 10px;">
- <div style="font-size: 11px; color: #fff;">Maintenance scheduled</div>
- <div style="font-size: 9px;">3 hours ago</div>
- </div>
- </div>
- `, 260, 180, 200);
- console.log("Multi-Window UI System Loaded.");
- })();
Advertisement
Add Comment
Please, Sign In to add comment