js+css实现包含文件系统及命令行浏览器的webos虚拟操作系统代码

代码语言:html

所属分类:其他

代码描述:js+css实现包含文件系统及命令行浏览器的webos虚拟操作系统代码,支持多窗口切换、登录、设置、音乐播放、代码在线编辑运行等。

代码标签: js css 包含 文件 系统 命令行 浏览器 webos 虚拟 操作系统 代码

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>WebOS</title>
<style>
  * { margin: 0; padding: 0; box-sizing: border-box; }
  
  :root {
    --bg-dark: #0a0e1a;
    --bg-panel: rgba(15, 20, 40, 0.95);
    --bg-window: rgba(12, 16, 32, 0.98);
    --accent: #00d4ff;
    --accent2: #7c3aed;
    --accent3: #06b6d4;
    --text: #e2e8f0;
    --text-dim: #64748b;
    --border: rgba(0, 212, 255, 0.2);
    --glass: rgba(255,255,255,0.03);
    --shadow: 0 25px 50px rgba(0,0,0,0.8);
    --glow: 0 0 20px rgba(0, 212, 255, 0.3);
  }

  body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg-dark);
    color: var(--text);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    user-select: none;
  }

  /* ===== LOGIN SCREEN ===== */
  #loginScreen {
    position: fixed; inset: 0; z-index: 9999;
    display: flex; align-items: center; justify-content: center;
    background: radial-gradient(ellipse at center, #0d1b3e 0%, #050810 100%);
    flex-direction: column;
  }

  .login-bg {
    position: absolute; inset: 0; overflow: hidden;
  }

  .login-bg::before {
    content: '';
    position: absolute; inset: 0;
    background: 
      radial-gradient(circle at 20% 50%, rgba(124,58,237,0.15) 0%, transparent 50%),
      radial-gradient(circle at 80% 20%, rgba(0,212,255,0.1) 0%, transparent 40%),
      radial-gradient(circle at 60% 80%, rgba(6,182,212,0.08) 0%, transparent 40%);
  }

  .stars {
    position: absolute; inset: 0;
  }

  .star {
    position: absolute;
    background: white;
    border-radius: 50%;
    animation: twinkle var(--d) ease-in-out infinite;
  }

  @keyframes twinkle {
    0%, 100% { opacity: 0.2; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.5); }
  }

  .login-container {
    position: relative; z-index: 2;
    display: flex; flex-direction: column; align-items: center;
    gap: 32px;
  }

  .login-logo {
    font-size: 48px; font-weight: 900; letter-spacing: -2px;
    background: linear-gradient(135deg, #00d4ff, #7c3aed, #06b6d4);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: none;
    animation: logoGlow 3s ease-in-out infinite;
  }

  @keyframes logoGlow {
    0%, 100% { filter: drop-shadow(0 0 20px rgba(0,212,255,0.5)); }
    50% { filter: drop-shadow(0 0 40px rgba(124,58,237,0.8)); }
  }

  .login-subtitle {
    color: var(--text-dim); font-size: 14px; letter-spacing: 4px; text-transform: uppercase;
    margin-top: -20px;
  }

  .login-avatar {
    width: 100px; height: 100px; border-radius: 50%;
    background: linear-gradient(135deg, #1e293b, #0f172a);
    border: 2px solid var(--border);
    display: flex; align-items: center; justify-content: center;
    font-size: 40px;
    box-shadow: 0 0 40px rgba(0,212,255,0.2), inset 0 0 20px rgba(0,0,0,0.5);
    position: relative;
  }

  .login-avatar::after {
    content: '';
    position: absolute; inset: -4px; border-radius: 50%;
    border: 1px solid transparent;
    background: linear-gradient(135deg, #00d4ff, #7c3aed) border-box;
    -webkit-mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: destination-out;
    mask-composite: exclude;
    animation: rotateBorder 4s linear infinite;
  }

  @keyframes rotateBorder {
    to { transform: rotate(360deg); }
  }

  .login-username {
    color: var(--text); font-size: 20px; font-weight: 600; letter-spacing: 1px;
  }

  .login-form {
    display: flex; flex-direction: column; gap: 16px; width: 320px;
  }

  .login-input-wrap {
    position: relative;
  }

  .login-input {
    width: 100%; padding: 14px 20px;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text); font-size: 15px;
    outline: none; transition: all 0.3s;
    backdrop-filter: blur(10px);
  }

  .login-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 20px rgba(0,212,255,0.2), inset 0 0 10px rgba(0,212,255,0.05);
    background: rgba(0,212,255,0.05);
  }

  .login-input::placeholder { color: var(--text-dim); }

  .login-btn {
    padding: 14px;
    background: linear-gradient(135deg, #00d4ff20, #7c3aed30);
    border: 1px solid var(--accent);
    border-radius: 12px;
    color: var(--accent); font-size: 15px; font-weight: 600;
    cursor: pointer; transition: all 0.3s; letter-spacing: 2px;
    text-transform: uppercase;
  }

  .login-btn:hover {
    background: linear-gradient(135deg, #00d4ff40, #7c3aed50);
    box-shadow: var(--glow);
    transform: translateY(-1px);
  }

  .login-btn:active { transform: translateY(0); }

  .login-error {
    color: #f87171; font-size: 13px; text-align: center;
    height: 20px; transition: all 0.3s;
  }

  .login-time {
    position: fixed; top: 40px; left: 50%; transform: translateX(-50%);
    text-align: center;
  }

  .login-clock {
    font-size: 72px; font-weight: 200; letter-spacing: -3px;
    color: rgba(255,255,255,0.9);
    text-shadow: 0 0 30px rgba(0,212,255,0.3);
  }

  .login-date {
    color: var(--text-dim); font-size: 16px; letter-spacing: 2px;
    text-align: center; margin-top: 4px;
  }

  /* ===== DESKTOP ===== */
  #desktop {
    position: fixed; inset: 0;
    display: none;
    background: radial-gradient(ellipse at 30% 70%, #0d1b3e 0%, #050810 60%, #0a0520 100%);
    overflow: hidden;
  }

  #desktop.active { display: block; }

  .desktop-bg-effects {
    position: absolute; inset: 0; pointer-events: none;
  }

  .desktop-bg-effects::before {
    content: '';
    position: absolute; inset: 0;
    background: 
      radial-gradient(circle at 10% 20%, rgba(124,58,237,0.08) 0%, transparent 40%),
      radial-gradient(circle at 90% 80%, rgba(0,212,255,0.06) 0%, transparent 40%);
  }

  /* Grid lines */
  .desktop-grid {
    position: absolute; inset: 0;
    background-image: 
      linear-gradient(rgba(0,212,255,0.03) 1px, transparent 1px),
      linear-gradient(90deg, rgba(0,212,255,0.03) 1px, transparent 1px);
    background-size: 60px 60px;
    pointer-events: none;
  }

  /* ===== TASKBAR ===== */
  #taskbar {
    position: fixed; bottom: 0; left: 0; right: 0; height: 52px;
    background: rgba(5, 8, 20, 0.95);
    border-top: 1px solid var(--border);
    backdrop-filter: blur(20px);
    display: flex; align-items: center;
    padding: 0 12px;
    gap: 8px;
    z-index: 5000;
    box-shadow: 0 -5px 30px rgba(0,0,0,0.5);
  }

  .taskbar-start {
    width: 40px; height: 40px;
    background: linear-gradient(135deg, #00d4ff20, #7c3aed30);
    border: 1px solid var(--border);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: all 0.2s;
    font-size: 18px; flex-shrink: 0;
  }

  .taskbar-start:hover {
    background: linear-gradient(135deg, #00d4ff40, #7c3aed50);
    box-shadow: var(--glow);
    border-color: var(--accent);
  }

  .taskbar-divider {
    width: 1px; height: 28px;
    background: var(--border);
    flex-shrink: 0; margin: 0 4px;
  }

  .taskbar-apps {
    display: flex; gap: 6px; flex: 1; overflow: hidden;
    align-items: center;
  }

  .taskbar-app {
    height: 36px; min-width: 36px; max-width: 180px;
    background: rgba(255,255,255,0.05);
    border: 1px solid transparent;
    border-radius: 8px;
    display: flex; align-items: center; gap: 8px;
    padding: 0 10px; cursor: pointer; transition: all 0.2s;
    font-size: 13px; color: var(--text-dim);
    white-space: nowrap; overflow: hidden;
  }

  .taskbar-app:hover {
    background: rgba(255,255,255,0.1);
    color: var(--text);
  }

  .taskbar-app.active {
    background: rgba(0,212,255,0.1);
    border-color: rgba(0,212,255,0.3);
    color: var(--accent);
  }

  .taskbar-app .app-icon { font-size: 16px; flex-shrink: 0; }
  .taskbar-app .app-name { overflow: hidden; text-overflow: ellipsis; }

  .taskbar-app .app-indicator {
    width: 4px; height: 4px; border-radius: 50%;
    background: var(--accent); flex-shrink: 0;
    margin-left: auto;
  }

  .taskbar-tray {
    display: flex; align-items: center; gap: 8px;
    margin-left: auto; flex-shrink: 0;
  }

  .tray-item {
    padding: 6px 10px;
    background: rgba(255,255,255,0.03);
    border: 1px solid transparent;
    border-radius: 8px;
    cursor: pointer; transition: all 0.2s;
    font-size: 13px; color: var(--text-dim);
    display: flex; align-items: center; gap: 6px;
  }

  .tray-item:hover {
    background: rgba(255,255,255,0.08);
    color: var(--text);
    border-color: var(--border);
  }

  .tray-clock {
    font-size: 13px; color: var(--text);
    font-variant-numeric: tabular-nums;
    text-align: center; line-height: 1.3;
  }

  /* ===== DESKTOP ICONS ===== */
  #desktopIcons {
    position: absolute;
    top: 20px; left: 20px;
    display: grid;
    grid-template-columns: 80px;
    grid-auto-rows: 90px;
    gap: 10px;
    align-content: start;
  }

  .desktop-icon {
    display: flex; flex-direction: column; align-items: center;
    gap: 6px; cursor: pointer; padding: 8px 4px;
    border-radius: 10px; transition: all 0.2s;
    border: 1px solid transparent;
  }

  .desktop-icon:hover {
    background: rgba(0,212,255,0.08);
    border-color: rgba(0,212,255,0.2);
  }

  .desktop-icon.selected {
    background: rgba(0,212,255,0.15);
    border-color: rgba(0,212,255,0.4);
  }

  .icon-img {
    width: 48px; height: 48px;
    background: linear-gradient(135deg, var(--c1), var(--c2));
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 24px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    transition: all 0.2s;
  }

  .desktop-icon:hover .icon-img {
    transform: scale(1.1);
    box-shadow: 0 8px 25px rgba(0,0,0,0.4);
  }

  .icon-label {
    font-size: 11px; color: var(--text); text-align: center;
    text-shadow: 0 1px 3px rgba(0,0,0,0.8);
    line-height: 1.3; word-break: break-word;
  }

  /* ===== WINDOWS ===== */
  .window {
    position: absolute;
    background: var(--bg-window);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow), 0 0 0 1px rgba(255,255,255,0.02);
    display: flex; flex-direction: column;
    min-width: 300px; min-height: 200px;
    transition: box-shadow 0.2s;
    overflow: hidden;
  }

  .window.active-window {
    border-color: rgba(0,212,255,0.4);
    box-shadow: var(--shadow), 0 0 30px rgba(0,212,255,0.1);
  }

  .window.minimized {
    display: none;
  }

  .window.maximized {
    top: 0 !important; left: 0 !important;
    width: 100vw !important; height: calc(100vh - 52px) !important;
    border-radius: 0;
  }

  .window-titlebar {
    height: 40px;
    background: linear-gradient(90deg, rgba(0,212,255,0.08), rgba(124,58,237,0.08));
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center;
    padding: 0 12px; gap: 10px;
    cursor: move; flex-shrink: 0;
  }

  .window-icon { font-size: 16px; }

  .window-title {
    flex: 1; font-size: 13px; font-weight: 500;
    color: var(--text); letter-spacing: 0.5px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }

  .window-controls {
    display: flex; gap: 6px; flex-shrink: 0;
  }

  .win-btn {
    width: 28px; height: 28px; border-radius: 8px;
    border: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; transition: all 0.2s;
    background: rgba(255,255,255,0.05);
    color: var(--text-dim);
  }

  .win-btn:hover { transform: scale(1.1); }
  .win-btn.minimize:hover { background: rgba(251,191,36,0.3); color: #fbbf24; }
  .win-btn.maximize:hover { background: rgba(34,197,94,0.3); color: #22c55e; }
  .win-btn.close:hover { background: rgba(239,68,68,0.3); color: #ef4444; }

  .window-body {
    flex: 1; overflow: auto; position: relative;
  }

  .window-resize {
    position: absolute; bottom: 0; right: 0;
    width: 16px; height: 16px; cursor: se-resize;
    background: linear-gradient(135deg, transparent 50%, rgba(0,212,255,0.3) 50%);
    border-radius: 0 0 12px 0;
  }

  /* ===== START MENU ===== */
  #startMenu {
    position: fixed; bottom: 60px; left: 12px;
    width: 360px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 16px;
    backdrop-filter: blur(30px);
    box-shadow: var(--shadow), var(--glow);
    z-index: 4999; display: none;
    overflow: hidden;
    animation: slideUp 0.2s ease-out;
  }

  #startMenu.show { display: block; }

  @keyfra.........完整代码请登录后点击上方下载按钮下载查看

网友评论0