|
|
AIWROKÆ»¹û½Å±¾H5ÈÎÎñÖ´ÐÐСÀý×Ó
AIWROKÆ»¹û½Å±¾H5ÈÎÎñÖ´ÐÐСÀý×Ó
- // ´´½¨ WebView ʵÀý
- var web = new WebView();
- // ÏÔʾ WebView ½çÃæ
- web.show();
- // ¼ÓÔØ±¾µØ HTML Îļþ
- var htmlPath = project.getCodePath() + "h5.html";
- web.loadFile(htmlPath);
- // ¶¨Òå H5 Öе÷Óõĺ¯Êý
- function test(arg) {
- printl("ÎÒ±» H5 µ÷ÓÃÁË£¬²ÎÊýÊÇ: " + arg);
- }
- // ¶¨Òå·µ»Ø×ÀÃæµÄº¯Êý£¬¹©H5Ò³Ãæµ÷ÓÃ
- function returnToHome() {
- printl("Ö´Ðзµ»Ø×ÀÃæ²Ù×÷");
- hid.home();
- }
- // ´òÓ¡¼ÓÔØÐÅÏ¢
- printl("WebView ÒÑ´´½¨²¢¼ÓÔØ±¾µØÎļþ: " + htmlPath);
¸´ÖÆ´úÂë- <!DOCTYPE html>
- <html lang="zh-CN">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
- <meta name="apple-mobile-web-app-capable" content="yes">
- <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
- <title>AIWROK ÖÇÄÜÈÎÎñµ÷¶ÈÖÐÐÄ</title>
- <style>
- /* »ù´¡ÑùÊ½ÖØÖà */
- * {
- margin: 0;
- padding: 0;
- box-sizing: border-box;
- }
- /* È«¾ÖÑùʽ */
- body {
- font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
- background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
- color: #333;
- min-height: 100vh;
- -webkit-font-smoothing: antialiased;
- -moz-osx-font-smoothing: grayscale;
- position: relative;
- overflow-x: hidden;
- }
- /* ±³¾°¶¯»Á£×Ó */
- .particles {
- position: fixed;
- top: 0;
- left: 0;
- width: 100%;
- height: 100%;
- pointer-events: none;
- z-index: 0;
- overflow: hidden;
- }
- .particle {
- position: absolute;
- width: 10px;
- height: 10px;
- background: rgba(255, 255, 255, 0.1);
- border-radius: 50%;
- animation: float 6s ease-in-out infinite;
- }
- .particle:nth-child(1) { left: 10%; animation-delay: 0s; }
- .particle:nth-child(2) { left: 20%; animation-delay: 1s; }
- .particle:nth-child(3) { left: 30%; animation-delay: 2s; }
- .particle:nth-child(4) { left: 40%; animation-delay: 3s; }
- .particle:nth-child(5) { left: 50%; animation-delay: 4s; }
- .particle:nth-child(6) { left: 60%; animation-delay: 5s; }
- .particle:nth-child(7) { left: 70%; animation-delay: 0.5s; }
- .particle:nth-child(8) { left: 80%; animation-delay: 1.5s; }
- .particle:nth-child(9) { left: 90%; animation-delay: 2.5s; }
- .particle:nth-child(10) { left: 5%; animation-delay: 3.5s; }
- @keyframes float {
- 0%, 100% {
- transform: translateY(100vh) rotate(0deg);
- opacity: 0;
- }
- 10% {
- opacity: 1;
- }
- 90% {
- opacity: 1;
- }
- 100% {
- transform: translateY(-100vh) rotate(720deg);
- opacity: 0;
- }
- }
- /* Ö÷ÈÝÆ÷ */
- .main-container {
- position: relative;
- z-index: 1;
- max-width: 500px;
- margin: 0 auto;
- padding: 20px;
- }
- /* Í·²¿¿¨Æ¬ */
- .header-card {
- background: linear-gradient(135deg, rgba(255,255,255,0.95) 0%, rgba(255,255,255,0.9) 100%);
- border-radius: 24px;
- padding: 24px;
- margin-bottom: 20px;
- box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
- backdrop-filter: blur(10px);
- text-align: center;
- }
- .header-card h1 {
- font-size: 24px;
- font-weight: 800;
- background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
- -webkit-background-clip: text;
- -webkit-text-fill-color: transparent;
- background-clip: text;
- margin-bottom: 8px;
- }
- .header-card .subtitle {
- font-size: 14px;
- color: #666;
- margin-bottom: 12px;
- }
- .header-card .qq-group {
- font-size: 13px;
- color: #667eea;
- font-weight: 600;
- }
- /* ͳ¼Æ¿¨Æ¬ */
- .stats-container {
- display: grid;
- grid-template-columns: repeat(3, 1fr);
- gap: 12px;
- margin-bottom: 20px;
- }
- .stat-card {
- background: rgba(255, 255, 255, 0.95);
- border-radius: 16px;
- padding: 16px 8px;
- text-align: center;
- box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
- transition: transform 0.3s ease;
- }
- .stat-card:hover {
- transform: translateY(-4px);
- }
- .stat-card .number {
- font-size: 28px;
- font-weight: 800;
- color: #667eea;
- display: block;
- }
- .stat-card .label {
- font-size: 12px;
- color: #666;
- margin-top: 4px;
- }
- /* ±êǩҳµ¼º½ */
- .tab-nav {
- display: flex;
- background: rgba(255, 255, 255, 0.95);
- border-radius: 16px;
- padding: 6px;
- margin-bottom: 20px;
- box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
- }
- .tab-btn {
- flex: 1;
- padding: 12px 8px;
- border: none;
- background: transparent;
- border-radius: 12px;
- font-size: 14px;
- font-weight: 600;
- color: #666;
- cursor: pointer;
- transition: all 0.3s ease;
- }
- .tab-btn.active {
- background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
- color: white;
- box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
- }
- /* ÄÚÈÝÇøÓò */
- .content-area {
- background: rgba(255, 255, 255, 0.95);
- border-radius: 24px;
- padding: 20px;
- box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
- min-height: 400px;
- }
- .tab-content {
- display: none;
- }
- .tab-content.active {
- display: block;
- animation: fadeIn 0.3s ease-out;
- }
- @keyframes fadeIn {
- from { opacity: 0; transform: translateY(10px); }
- to { opacity: 1; transform: translateY(0); }
- }
- /* ÈÎÎñÁбí */
- .task-list {
- list-style: none;
- }
- .task-item {
- display: flex;
- align-items: center;
- padding: 16px;
- background: #f8f9fa;
- border-radius: 12px;
- margin-bottom: 12px;
- transition: all 0.3s ease;
- cursor: pointer;
- }
- .task-item:hover {
- background: #e9ecef;
- transform: translateX(4px);
- }
- .task-item.selected {
- background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
- border: 2px solid #667eea;
- }
- .task-checkbox {
- width: 24px;
- height: 24px;
- margin-right: 12px;
- cursor: pointer;
- accent-color: #667eea;
- }
- .task-info {
- flex: 1;
- }
- .task-name {
- font-size: 15px;
- font-weight: 600;
- color: #333;
- margin-bottom: 4px;
- }
- .task-desc {
- font-size: 12px;
- color: #666;
- }
- .task-status {
- padding: 4px 12px;
- border-radius: 20px;
- font-size: 12px;
- font-weight: 600;
- }
- .task-status.pending {
- background: #fff3cd;
- color: #856404;
- }
- .task-status.running {
- background: #d4edda;
- color: #155724;
- }
- .task-status.completed {
- background: #d1ecf1;
- color: #0c5460;
- }
- /* ÉèÖÃ±íµ¥ */
- .settings-form {
- space-y: 16px;
- }
- .form-group {
- margin-bottom: 20px;
- }
- .form-label {
- display: block;
- font-size: 14px;
- font-weight: 600;
- color: #333;
- margin-bottom: 8px;
- }
- .form-input {
- width: 100%;
- padding: 12px 16px;
- border: 2px solid #e9ecef;
- border-radius: 12px;
- font-size: 15px;
- transition: all 0.3s ease;
- }
- .form-input:focus {
- outline: none;
- border-color: #667eea;
- box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
- }
- .form-select {
- width: 100%;
- padding: 12px 16px;
- border: 2px solid #e9ecef;
- border-radius: 12px;
- font-size: 15px;
- background: white;
- cursor: pointer;
- }
- /* ¿ª¹ØÑùʽ */
- .switch-container {
- display: flex;
- align-items: center;
- justify-content: space-between;
- padding: 16px;
- background: #f8f9fa;
- border-radius: 12px;
- margin-bottom: 12px;
- }
- .switch-label {
- font-size: 15px;
- font-weight: 500;
- color: #333;
- }
- .switch {
- position: relative;
- width: 52px;
- height: 28px;
- }
- .switch input {
- opacity: 0;
- width: 0;
- height: 0;
- }
- .slider {
- position: absolute;
- cursor: pointer;
- top: 0;
- left: 0;
- right: 0;
- bottom: 0;
- background-color: #ccc;
- transition: .4s;
- border-radius: 28px;
- }
- .slider:before {
- position: absolute;
- content: "";
- height: 20px;
- width: 20px;
- left: 4px;
- bottom: 4px;
- background-color: white;
- transition: .4s;
- border-radius: 50%;
- }
- input:checked + .slider {
- background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
- }
- input:checked + .slider:before {
- transform: translateX(24px);
- }
- /* °´Å¥Ñùʽ */
- .btn {
- width: 100%;
- padding: 16px;
- border: none;
- border-radius: 12px;
- font-size: 16px;
- font-weight: 700;
- cursor: pointer;
- transition: all 0.3s ease;
- margin-bottom: 12px;
- }
- .btn-primary {
- background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
- color: white;
- box-shadow: 0 4px 16px rgba(102, 126, 234, 0.4);
- }
- .btn-primary:hover {
- transform: translateY(-2px);
- box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
- }
- .btn-danger {
- background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
- color: white;
- box-shadow: 0 4px 16px rgba(255, 107, 107, 0.4);
- }
- .btn-danger:hover {
- transform: translateY(-2px);
- box-shadow: 0 6px 20px rgba(255, 107, 107, 0.5);
- }
- .btn-success {
- background: linear-gradient(135deg, #51cf66 0%, #40c057 100%);
- color: white;
- box-shadow: 0 4px 16px rgba(81, 207, 102, 0.4);
- }
- .btn-success:hover {
- transform: translateY(-2px);
- box-shadow: 0 6px 20px rgba(81, 207, 102, 0.5);
- }
- .btn:disabled {
- opacity: 0.6;
- cursor: not-allowed;
- transform: none;
- }
- /* ÈÕÖ¾ÇøÓò */
- .log-container {
- background: #1a1a2e;
- border-radius: 12px;
- padding: 16px;
- max-height: 200px;
- overflow-y: auto;
- font-family: 'Courier New', monospace;
- font-size: 12px;
- }
- .log-item {
- color: #a0a0a0;
- margin-bottom: 4px;
- padding: 4px 0;
- border-bottom: 1px solid #2a2a3e;
- }
- .log-item:last-child {
- border-bottom: none;
- }
- .log-time {
- color: #667eea;
- margin-right: 8px;
- }
- .log-info { color: #4dabf7; }
- .log-success { color: #51cf66; }
- .log-warning { color: #ffd43b; }
- .log-error { color: #ff6b6b; }
- /* Toast Ìáʾ */
- .toast {
- position: fixed;
- bottom: 100px;
- left: 50%;
- transform: translateX(-50%) translateY(100px);
- background: rgba(0, 0, 0, 0.9);
- color: white;
- padding: 16px 32px;
- border-radius: 50px;
- font-size: 14px;
- font-weight: 600;
- opacity: 0;
- transition: all 0.3s ease;
- z-index: 9999;
- box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
- }
- .toast.show {
- opacity: 1;
- transform: translateX(-50%) translateY(0);
- }
- /* ¼ÓÔØ¶¯» */
- .loading {
- position: relative;
- }
- .loading::after {
- content: '';
- position: absolute;
- top: 50%;
- left: 50%;
- width: 20px;
- height: 20px;
- margin: -10px 0 0 -10px;
- border: 2px solid rgba(255, 255, 255, 0.3);
- border-top-color: white;
- border-radius: 50%;
- animation: spin 1s linear infinite;
- }
- @keyframes spin {
- to { transform: rotate(360deg); }
- }
- /* ÏìӦʽÉè¼Æ */
- @media (max-width: 480px) {
- .main-container {
- padding: 16px;
- }
-
- .stats-container {
- grid-template-columns: repeat(3, 1fr);
- gap: 8px;
- }
-
- .stat-card {
- padding: 12px 4px;
- }
-
- .stat-card .number {
- font-size: 20px;
- }
- }
- </style>
- </head>
- <body>
- <!-- ±³¾°Á£×Ó -->
- <div class="particles">
- <div class="particle"></div>
- <div class="particle"></div>
- <div class="particle"></div>
- <div class="particle"></div>
- <div class="particle"></div>
- <div class="particle"></div>
- <div class="particle"></div>
- <div class="particle"></div>
- <div class="particle"></div>
- <div class="particle"></div>
- </div>
- <div class="main-container">
- <!-- Í·²¿¿¨Æ¬ -->
- <div class="header-card">
- <h1>ÖÇÄÜÈÎÎñµ÷¶ÈÖÐÐÄ</h1>
- <div class="subtitle">AIWROK ×Ô¶¯»¯ÈÎÎñ¹ÜÀíϵͳ</div>
- <div class="qq-group">🍎½»Á÷QQȺ711841924Ⱥһ£¬Æ»¹ûÄÚ²âȺ£¬528816639</div>
- </div>
- <!-- ͳ¼Æ¿¨Æ¬ -->
- <div class="stats-container">
- <div class="stat-card">
- <span class="number" id="pendingCount">0</span>
- <div class="label">´ýÖ´ÐÐ</div>
- </div>
- <div class="stat-card">
- <span class="number" id="runningCount">0</span>
- <div class="label">Ö´ÐÐÖÐ</div>
- </div>
- <div class="stat-card">
- <span class="number" id="completedCount">0</span>
- <div class="label">ÒÑÍê³É</div>
- </div>
- </div>
- <!-- ±êǩҳµ¼º½ -->
- <div class="tab-nav">
- <button class="tab-btn active" onclick="switchTab('tasks')">ÈÎÎñÁбí</button>
- <button class="tab-btn" onclick="switchTab('settings')">ϵͳÉèÖÃ</button>
- <button class="tab-btn" onclick="switchTab('logs')">ÔËÐÐÈÕÖ¾</button>
- </div>
- <!-- ÄÚÈÝÇøÓò -->
- <div class="content-area">
- <!-- ÈÎÎñÁбí -->
- <div id="tasks-tab" class="tab-content active">
- <ul class="task-list" id="taskList">
- <!-- ÈÎÎñÏͨ¹ýJS¶¯Ì¬Éú³É -->
- </ul>
- <button class="btn btn-primary" onclick="executeSelectedTasks()">
- Ö´ÐÐÑ¡ÖÐÈÎÎñ
- </button>
- <button class="btn btn-danger" onclick="clearAllTasks()">
- Çå¿ÕËùÓÐÈÎÎñ
- </button>
- </div>
- <!-- ϵͳÉèÖà -->
- <div id="settings-tab" class="tab-content">
- <div class="settings-form">
- <div class="form-group">
- <label class="form-label">ÔËÐмä¸ô (Ãë)</label>
- <input type="number" class="form-input" id="intervalInput" value="5" min="1" max="60">
- </div>
-
- <div class="form-group">
- <label class="form-label">×î´óÖØÊÔ´ÎÊý</label>
- <input type="number" class="form-input" id="retryInput" value="3" min="1" max="10">
- </div>
- <div class="form-group">
- <label class="form-label">Ö´ÐÐģʽ</label>
- <select class="form-select" id="modeSelect">
- <option value="serial">˳ÐòÖ´ÐÐ</option>
- <option value="parallel">²¢ÐÐÖ´ÐÐ</option>
- <option value="smart">ÖÇÄܵ÷¶È</option>
- </select>
- </div>
- <div class="switch-container">
- <span class="switch-label">ÈÎÎñÍê³Éºó·µ»Ø×ÀÃæ</span>
- <label class="switch">
- <input type="checkbox" id="autoReturn" checked>
- <span class="slider"></span>
- </label>
- </div>
- <div class="switch-container">
- <span class="switch-label">×Ô¶¯ÇåÀí»º´æ</span>
- <label class="switch">
- <input type="checkbox" id="autoClean" checked>
- <span class="slider"></span>
- </label>
- </div>
- <div class="switch-container">
- <span class="switch-label">ºǫ́ÔËÐÐ</span>
- <label class="switch">
- <input type="checkbox" id="backgroundRun">
- <span class="slider"></span>
- </label>
- </div>
- <div class="switch-container">
- <span class="switch-label">´íÎó×Ô¶¯ÖØÊÔ</span>
- <label class="switch">
- <input type="checkbox" id="autoRetry" checked>
- <span class="slider"></span>
- </label>
- </div>
- <button class="btn btn-success" onclick="saveSettings()">
- ±£´æÉèÖÃ
- </button>
- </div>
- </div>
- <!-- ÔËÐÐÈÕÖ¾ -->
- <div id="logs-tab" class="tab-content">
- <div class="log-container" id="logContainer">
- <div class="log-item">
- <span class="log-time">[ϵͳ]</span>
- <span class="log-info">ÈÎÎñµ÷¶ÈÖÐÐÄÒÑÆô¶¯</span>
- </div>
- </div>
- <button class="btn btn-primary" onclick="clearLogs()">
- Çå¿ÕÈÕÖ¾
- </button>
- </div>
- </div>
- </div>
- <!-- Toast Ìáʾ -->
- <div class="toast" id="toast"></div>
- <script>
- // ÈÎÎñÊý¾Ý
- const tasksData = [
- { id: 1, name: '¶¶Òô¼«ËÙ°æ', desc: '×Ô¶¯Ë¢ÊÓÆµ×¬½ð±Ò', status: 'pending' },
- { id: 2, name: '¿ìÊÖ¼«ËÙ°æ', desc: '×Ô¶¯ä¯ÀÀÈÎÎñ', status: 'pending' },
- { id: 3, name: '·¬ÇÑС˵', desc: '×Ô¶¯ÔĶÁ׬½ð±Ò', status: 'pending' },
- { id: 4, name: '·¬Çѳ©Ìý', desc: '×Ô¶¯ÌýÊéÈÎÎñ', status: 'pending' },
- { id: 5, name: 'ºì¹û¶Ì¾ç', desc: '×Ô¶¯Ë¢¶Ì¾ç', status: 'pending' },
- { id: 6, name: 'Îò¿Õä¯ÀÀÆ÷', desc: '×Ô¶¯ä¯ÀÀ×ÊѶ', status: 'pending' },
- { id: 7, name: 'Î÷¹ÏÊÓÆµ', desc: '×Ô¶¯¿´ÊÓÆµ×¬½ð±Ò', status: 'pending' },
- { id: 8, name: '½ñÈÕÍ·Ìõ', desc: '×Ô¶¯ÔĶÁÐÂÎÅ', status: 'pending' },
- { id: 9, name: 'ϲ·¬¶Ì¾ç', desc: '×Ô¶¯Ë¢¶Ì¾çÈÎÎñ', status: 'pending' },
- { id: 10, name: 'ÆûË®ÒôÀÖ', desc: '×Ô¶¯Ìý¸è׬½ð±Ò', status: 'pending' }
- ];
- // µ±Ç°Ñ¡ÖеÄÈÎÎñ
- let selectedTasks = new Set();
- // ³õʼ»¯
- function init() {
- renderTaskList();
- updateStats();
- addLog('ϵͳ³õʼ»¯Íê³É', 'info');
- }
- // äÖȾÈÎÎñÁбí
- function renderTaskList() {
- const taskList = document.getElementById('taskList');
- taskList.innerHTML = '';
- tasksData.forEach(task => {
- const li = document.createElement('li');
- li.className = 'task-item' + (selectedTasks.has(task.id) ? ' selected' : '');
- li.onclick = function(e) {
- if (e.target.type !== 'checkbox') {
- toggleTaskSelection(task.id);
- }
- };
- const statusClass = task.status;
- const statusText = {
- 'pending': '´ýÖ´ÐÐ',
- 'running': 'Ö´ÐÐÖÐ',
- 'completed': 'ÒÑÍê³É'
- }[task.status];
- li.innerHTML = `
- <input type="checkbox" class="task-checkbox"
- ${selectedTasks.has(task.id) ? 'checked' : ''}
- onchange="toggleTaskSelection(${task.id})">
- <div class="task-info">
- <div class="task-name">${task.name}</div>
- <div class="task-desc">${task.desc}</div>
- </div>
- <span class="task-status ${statusClass}">${statusText}</span>
- `;
- taskList.appendChild(li);
- });
- }
- // Çл»ÈÎÎñÑ¡Ôñ
- function toggleTaskSelection(taskId) {
- if (selectedTasks.has(taskId)) {
- selectedTasks.delete(taskId);
- } else {
- selectedTasks.add(taskId);
- }
- renderTaskList();
- }
- // ¸üÐÂͳ¼Æ
- function updateStats() {
- const pending = tasksData.filter(t => t.status === 'pending').length;
- const running = tasksData.filter(t => t.status === 'running').length;
- const completed = tasksData.filter(t => t.status === 'completed').length;
- document.getElementById('pendingCount').textContent = pending;
- document.getElementById('runningCount').textContent = running;
- document.getElementById('completedCount').textContent = completed;
- }
- // Çл»±êǩҳ
- function switchTab(tabName) {
- // ¸üа´Å¥×´Ì¬
- document.querySelectorAll('.tab-btn').forEach(btn => {
- btn.classList.remove('active');
- });
- event.target.classList.add('active');
- // ¸üÐÂÄÚÈÝÏÔʾ
- document.querySelectorAll('.tab-content').forEach(content => {
- content.classList.remove('active');
- });
- document.getElementById(tabName + '-tab').classList.add('active');
- addLog('Çл»µ½' + tabName + 'Ò³Ãæ', 'info');
- }
- // Ö´ÐÐÑ¡ÖеÄÈÎÎñ
- function executeSelectedTasks() {
- if (selectedTasks.size === 0) {
- showToast('ÇëÏÈÑ¡ÔñÒªÖ´ÐеÄÈÎÎñ');
- return;
- }
- const btn = event.target;
- btn.classList.add('loading');
- btn.disabled = true;
- showToast('¿ªÊ¼Ö´ÐÐ ' + selectedTasks.size + ' ¸öÈÎÎñ');
- addLog('¿ªÊ¼Ö´ÐÐ ' + selectedTasks.size + ' ¸öÈÎÎñ', 'info');
- // Ä£ÄâÈÎÎñÖ´ÐÐ
- let completed = 0;
- selectedTasks.forEach(taskId => {
- const task = tasksData.find(t => t.id === taskId);
- if (task) {
- task.status = 'running';
- addLog('¿ªÊ¼Ö´ÐÐ: ' + task.name, 'info');
- }
- });
- renderTaskList();
- updateStats();
- // Ä£ÄâÖ´ÐÐÍê³É
- setTimeout(function() {
- selectedTasks.forEach(taskId => {
- const task = tasksData.find(t => t.id === taskId);
- if (task) {
- task.status = 'completed';
- completed++;
- addLog('Íê³É: ' + task.name, 'success');
- }
- });
- selectedTasks.clear();
- renderTaskList();
- updateStats();
- btn.classList.remove('loading');
- btn.disabled = false;
- showToast('ÈÎÎñÖ´ÐÐÍê³É');
- addLog('ËùÓÐÈÎÎñÖ´ÐÐÍê³É', 'success');
- // ¼ì²éÊÇ·ñÐèÒª·µ»Ø×ÀÃæ
- const autoReturn = document.getElementById('autoReturn').checked;
- if (autoReturn) {
- setTimeout(function() {
- showToast('ÕýÔÚ·µ»Ø×ÀÃæ');
- addLog('ÈÎÎñÍê³É£¬·µ»Ø×ÀÃæ', 'info');
-
- // ³¢ÊÔ²»Í¬·½Ê½µ÷Ó÷µ»Ø×ÀÃæ
- let success = false;
-
- // ·½Ê½1£ºÖ±½Óµ÷ÓÃhid.home()
- try {
- if (typeof hid !== 'undefined' && typeof hid.home === 'function') {
- hid.home();
- addLog('Òѵ÷Óà hid.home() ·µ»Ø×ÀÃæ', 'success');
- success = true;
- }
- } catch (e) {}
-
- // ·½Ê½2£ºµ÷ÓÃÈ«¾Öhome()º¯Êý
- if (!success) {
- try {
- if (typeof home === 'function') {
- home();
- addLog('Òѵ÷Óà home() ·µ»Ø×ÀÃæ', 'success');
- success = true;
- }
- } catch (e) {}
- }
-
- // ·½Ê½3£ºµ÷ÓÃwindow.home()
- if (!success) {
- try {
- if (typeof window !== 'undefined' && typeof window.home === 'function') {
- window.home();
- addLog('Òѵ÷Óà window.home() ·µ»Ø×ÀÃæ', 'success');
- success = true;
- }
- } catch (e) {}
- }
-
- // ·½Ê½4£ºµ÷ÓÃwindow.hid.home()
- if (!success) {
- try {
- if (typeof window !== 'undefined' && window.hid && typeof window.hid.home === 'function') {
- window.hid.home();
- addLog('Òѵ÷Óà window.hid.home() ·µ»Ø×ÀÃæ', 'success');
- success = true;
- }
- } catch (e) {}
- }
-
- // ·½Ê½5£ºÊ¹ÓÃevalµ÷ÓÃ
- if (!success) {
- try {
- eval('hid.home()');
- addLog('Òѵ÷Óà eval(hid.home()) ·µ»Ø×ÀÃæ', 'success');
- success = true;
- } catch (e) {}
- }
-
- // ·½Ê½6£ºÊ¹ÓÃÈ«¾Ö¶ÔÏóµ÷ÓÃ
- if (!success) {
- try {
- // ³¢ÊÔʹÓÃÈ«¾Ö¶ÔÏó
- const globalObj = (function() { return this; })();
- if (globalObj && globalObj.hid && typeof globalObj.hid.home === 'function') {
- globalObj.hid.home();
- addLog('Òѵ÷Óà globalObj.hid.home() ·µ»Ø×ÀÃæ', 'success');
- success = true;
- }
- } catch (e) {}
- }
-
- // Èç¹ûËùÓз½Ê½¶¼Ê§°Ü
- if (!success) {
- addLog('·µ»Ø×ÀÃæ¹¦ÄÜÔݲ»¿ÉÓã¬ÇëÈ·±£ÔÚAIWROK»·¾³ÖÐÔËÐÐ', 'warning');
- showToast('·µ»Ø×ÀÃæ¹¦ÄÜÔݲ»¿ÉÓÃ');
- }
- }, 1000);
- }
- }, 2000);
- }
- // Çå¿ÕËùÓÐÈÎÎñ
- function clearAllTasks() {
- if (!confirm('È·¶¨ÒªÇå¿ÕËùÓÐÈÎÎñ״̬Âð£¿')) {
- return;
- }
- tasksData.forEach(task => {
- task.status = 'pending';
- });
- selectedTasks.clear();
- renderTaskList();
- updateStats();
- showToast('ËùÓÐÈÎÎñÒÑÖØÖÃ');
- addLog('ËùÓÐÈÎÎñ״̬ÒÑÖØÖÃ', 'warning');
- }
- // ±£´æÉèÖÃ
- function saveSettings() {
- const settings = {
- interval: document.getElementById('intervalInput').value,
- retry: document.getElementById('retryInput').value,
- mode: document.getElementById('modeSelect').value,
- autoClean: document.getElementById('autoClean').checked,
- backgroundRun: document.getElementById('backgroundRun').checked,
- autoRetry: document.getElementById('autoRetry').checked
- };
- const btn = event.target;
- btn.classList.add('loading');
- btn.disabled = true;
- setTimeout(function() {
- btn.classList.remove('loading');
- btn.disabled = false;
- showToast('ÉèÖñ£´æ³É¹¦');
- addLog('ϵͳÉèÖÃÒѱ£´æ: ' + JSON.stringify(settings), 'success');
- }, 1000);
- }
- // Çå¿ÕÈÕÖ¾
- function clearLogs() {
- document.getElementById('logContainer').innerHTML = `
- <div class="log-item">
- <span class="log-time">[ϵͳ]</span>
- <span class="log-info">ÈÕÖ¾ÒÑÇå¿Õ</span>
- </div>
- `;
- showToast('ÈÕÖ¾ÒÑÇå¿Õ');
- }
- // Ìí¼ÓÈÕÖ¾
- function addLog(message, type) {
- const container = document.getElementById('logContainer');
- const time = new Date().toLocaleTimeString();
- const typeClass = 'log-' + type;
- const logItem = document.createElement('div');
- logItem.className = 'log-item';
- logItem.innerHTML = `
- <span class="log-time">[${time}]</span>
- <span class="${typeClass}">${message}</span>
- `;
- container.appendChild(logItem);
- container.scrollTop = container.scrollHeight;
- }
- // Toast Ìáʾ
- function showToast(message) {
- const toast = document.getElementById('toast');
- toast.textContent = message;
- toast.classList.add('show');
- setTimeout(function() {
- toast.classList.remove('show');
- }, 2000);
- }
- // Ò³Ãæ¼ÓÔØÍê³É
- window.onload = function() {
- init();
- showToast('ÖÇÄÜÈÎÎñµ÷¶ÈÖÐÐÄÒÑÆô¶¯');
-
- // °ó¶¨ËùÓÐʼþ
- bindAllEvents();
- };
- // °ó¶¨ËùÓÐʼþ
- function bindAllEvents() {
- // ÊäÈë¿òʼþ
- bindInputEvents();
-
- // ¿ª¹ØÊ¼þ
- bindSwitchEvents();
-
- // ÏÂÀ²Ëµ¥Ê¼þ
- bindSelectEvents();
-
- // ¼üÅÌʼþ
- bindKeyboardEvents();
-
- // ´°¿Úʼþ
- bindWindowEvents();
- }
- // °ó¶¨ÊäÈë¿òʼþ
- function bindInputEvents() {
- const inputs = document.querySelectorAll('.form-input');
- inputs.forEach(input => {
- input.addEventListener('input', function() {
- addLog('ÉèÖÃÒѸüÐÂ: ' + this.id + ' = ' + this.value, 'info');
- });
-
- input.addEventListener('focus', function() {
- this.style.borderColor = '#667eea';
- this.style.boxShadow = '0 0 0 3px rgba(102, 126, 234, 0.1)';
- });
-
- input.addEventListener('blur', function() {
- this.style.borderColor = '#e9ecef';
- this.style.boxShadow = 'none';
- });
- });
- }
- // °ó¶¨¿ª¹ØÊ¼þ
- function bindSwitchEvents() {
- const switches = document.querySelectorAll('.switch input[type="checkbox"]');
- switches.forEach(switchEl => {
- switchEl.addEventListener('change', function() {
- const label = this.closest('.switch-container').querySelector('.switch-label').textContent;
- addLog('ÉèÖÃÒѸüÐÂ: ' + label + ' = ' + (this.checked ? '¿ªÆô' : '¹Ø±Õ'), 'info');
- });
- });
- }
- // °ó¶¨ÏÂÀ²Ëµ¥Ê¼þ
- function bindSelectEvents() {
- const selects = document.querySelectorAll('.form-select');
- selects.forEach(select => {
- select.addEventListener('change', function() {
- addLog('ÉèÖÃÒѸüÐÂ: ' + this.id + ' = ' + this.value, 'info');
- });
-
- select.addEventListener('focus', function() {
- this.style.borderColor = '#667eea';
- this.style.boxShadow = '0 0 0 3px rgba(102, 126, 234, 0.1)';
- });
-
- select.addEventListener('blur', function() {
- this.style.borderColor = '#e9ecef';
- this.style.boxShadow = 'none';
- });
- });
- }
- // °ó¶¨¼üÅÌʼþ
- function bindKeyboardEvents() {
- document.addEventListener('keydown', function(e) {
- // °´ Enter ¼üÖ´ÐÐÑ¡ÖÐÈÎÎñ
- if (e.key === 'Enter' && document.getElementById('tasks-tab').classList.contains('active')) {
- const selectedCount = selectedTasks.size;
- if (selectedCount > 0) {
- executeSelectedTasks();
- }
- }
-
- // °´ Escape ¼üÇå¿ÕÑ¡Ôñ
- if (e.key === 'Escape') {
- selectedTasks.clear();
- renderTaskList();
- addLog('ÒÑÇå¿ÕÈÎÎñÑ¡Ôñ', 'info');
- }
- });
- }
- // °ó¶¨´°¿Úʼþ
- function bindWindowEvents() {
- // ´°¿Ú´óС±ä»¯Ê¼þ
- window.addEventListener('resize', function() {
- addLog('´°¿Ú´óСÒѱ仯', 'info');
- });
-
- // Ò³Ãæ¿É¼ûÐԱ仯ʼþ
- document.addEventListener('visibilitychange', function() {
- if (document.hidden) {
- addLog('Ò³ÃæÒÑÒþ²Ø', 'info');
- } else {
- addLog('Ò³ÃæÒÑÏÔʾ', 'info');
- }
- });
- }
- </script>
- </body>
- </html>
¸´ÖÆ´úÂë
|
|