uu531 commited on
Commit
834a134
·
verified ·
1 Parent(s): 778e097

Add 1 files

Browse files
Files changed (1) hide show
  1. index.html +469 -44
index.html CHANGED
@@ -3,7 +3,7 @@
3
  <head>
4
  <meta charset="UTF-8">
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>任务管理</title>
7
  <script src="https://cdn.tailwindcss.com"></script>
8
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
9
  <style>
@@ -364,6 +364,104 @@
364
  .netease-login-btn:hover {
365
  background-color: #c50020;
366
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
367
  </style>
368
  </head>
369
  <body class="bg-gray-50 min-h-screen">
@@ -472,14 +570,143 @@
472
  </div>
473
 
474
  <div class="container mx-auto px-4 py-8 max-w-3xl main-content" id="mainContent">
475
- <!-- 标题 -->
476
- <header class="mb-8 text-center">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
477
  <div class="todo-logo">
478
  <span>任务管理</span>
479
  <span class="dot">.</span>
480
  </div>
481
- <p class="text-gray-600">专注当下,高效生活</p>
482
- <div class="mt-6 relative">
 
483
  <input
484
  type="text"
485
  id="newTaskInput"
@@ -493,7 +720,8 @@
493
  <i class="fas fa-plus"></i>
494
  </button>
495
  </div>
496
- <div class="mt-3 flex items-center justify-between">
 
497
  <div class="flex-1 mr-2">
498
  <label for="dueDate" class="block text-sm text-gray-600 mb-1">截止日期</label>
499
  <input
@@ -514,48 +742,48 @@
514
  </select>
515
  </div>
516
  </div>
517
- </header>
518
 
519
- <!-- 任务控制 -->
520
- <div class="flex justify-between items-center mb-6">
521
- <div class="flex space-x-2">
522
- <button id="filterAll" class="filter-btn active px-4 py-2 rounded-lg bg-gray-900 text-white font-medium">全部</button>
523
- <button id="filterActive" class="filter-btn px-4 py-2 rounded-lg border border-gray-300 hover:bg-gray-100 text-gray-700">待办</button>
524
- <button id="filterCompleted" class="filter-btn px-4 py-2 rounded-lg border border-gray-300 hover:bg-gray-100 text-gray-700">已完成</button>
525
- <button id="filterDueToday" class="filter-btn px-4 py-2 rounded-lg border border-gray-300 hover:bg-gray-100 text-gray-700">今日到期</button>
 
 
 
 
526
  </div>
527
- <button id="clearCompleted" class="text-gray-700 hover:text-gray-900 text-sm">
528
- <i class="fas fa-trash-alt mr-1"></i> 清除已完成
529
- </button>
530
- </div>
531
 
532
- <!-- 任务统计 -->
533
- <div class="bg-white rounded-lg p-4 mb-6 border border-gray-200 flex justify-between items-center">
534
- <div>
535
- <span class="text-gray-600">总任务:</span>
536
- <span id="totalTasks" class="font-bold ml-1">0</span>
537
- </div>
538
- <div>
539
- <span class="text-gray-600">已完成:</span>
540
- <span id="completedTasks" class="font-bold ml-1">0</span>
541
- </div>
542
- <div>
543
- <span class="text-gray-600">待完成:</span>
544
- <span id="remainingTasks" class="font-bold ml-1">0</span>
545
- </div>
546
- <div>
547
- <span class="text-gray-600">今日到期:</span>
548
- <span id="dueTodayTasks" class="font-bold ml-1">0</span>
 
549
  </div>
550
- </div>
551
 
552
- <!-- 任务列表 -->
553
- <div id="taskList" class="space-y-3">
554
- <!-- 任务将动态添加在这里 -->
555
- <div class="text-center py-10 text-gray-500" id="emptyState">
556
- <i class="fas fa-tasks text-4xl mb-3 text-gray-300"></i>
557
- <p class="text-lg">暂无任务</p>
558
- <p class="mt-1">添加你的第一个任务开始吧</p>
 
559
  </div>
560
  </div>
561
  </div>
@@ -604,6 +832,22 @@
604
  const progressBar = document.getElementById('progressBar');
605
  const mainContent = document.getElementById('mainContent');
606
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
607
  // 状态
608
  let tasks = JSON.parse(localStorage.getItem('tasks')) || [];
609
  let currentFilter = 'all';
@@ -615,6 +859,69 @@
615
  let progressInterval;
616
  let neteaseMusicUrl = localStorage.getItem('neteaseMusicUrl') || 'https://music.163.com';
617
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
618
  // 初始化
619
  initDarkMode();
620
  renderTasks();
@@ -622,6 +929,7 @@
622
  setupMusicPlayer();
623
  neteaseUrl.value = neteaseMusicUrl;
624
  updateNeteaseLoginBtn();
 
625
 
626
  // 事件监听
627
  addTaskBtn.addEventListener('click', addTask);
@@ -657,6 +965,40 @@
657
  prevBtn.addEventListener('click', playPrevious);
658
  nextBtn.addEventListener('click', playNext);
659
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
660
  // 功能函数
661
  function addTask() {
662
  const taskText = newTaskInput.value.trim();
@@ -1068,7 +1410,7 @@
1068
  { id: 1, title: '晴天', artist: '周杰伦', url: 'https://music.163.com/song/media/outer/url?id=186436.mp3' },
1069
  { id: 2, title: '夜曲', artist: '周杰伦', url: 'https://music.163.com/song/media/outer/url?id=186001.mp3' },
1070
  { id: 3, title: '七里香', artist: '周杰伦', url: 'https://music.163.com/song/media/outer/url?id=185879.mp3' },
1071
- { id: 4, title: '稻香', artist: '周杰伦', url: 'https://music.163.com/song/media/outer/url?id=287035.mp3' },
1072
  { id: 5, title: '告白气球', artist: '周杰伦', url: 'https://music.163.com/song/media/outer/url?id=418603077.mp3' }
1073
  ];
1074
 
@@ -1208,6 +1550,89 @@
1208
  }
1209
  }
1210
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1211
  // 辅助函数
1212
  function formatDate(dateString) {
1213
  if (!dateString) return '';
 
3
  <head>
4
  <meta charset="UTF-8">
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>多功能搜索与任务管理</title>
7
  <script src="https://cdn.tailwindcss.com"></script>
8
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
9
  <style>
 
364
  .netease-login-btn:hover {
365
  background-color: #c50020;
366
  }
367
+
368
+ /* 搜索引擎切换按钮 */
369
+ .search-engine-btn {
370
+ position: absolute;
371
+ right: 10px;
372
+ top: 50%;
373
+ transform: translateY(-50%);
374
+ background: none;
375
+ border: none;
376
+ cursor: pointer;
377
+ color: #6b7280;
378
+ }
379
+
380
+ .search-engine-btn:hover {
381
+ color: #4b5563;
382
+ }
383
+
384
+ .dark-mode .search-engine-btn {
385
+ color: #9ca3af;
386
+ }
387
+
388
+ .dark-mode .search-engine-btn:hover {
389
+ color: #e5e7eb;
390
+ }
391
+
392
+ /* 搜索引擎下拉菜单 */
393
+ .search-engine-dropdown {
394
+ position: absolute;
395
+ right: 0;
396
+ top: 100%;
397
+ background-color: white;
398
+ border: 1px solid #e5e7eb;
399
+ border-radius: 0.5rem;
400
+ box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
401
+ z-index: 10;
402
+ display: none;
403
+ min-width: 200px;
404
+ }
405
+
406
+ .dark-mode .search-engine-dropdown {
407
+ background-color: #1f2937;
408
+ border-color: #374151;
409
+ }
410
+
411
+ .search-engine-dropdown.show {
412
+ display: block;
413
+ }
414
+
415
+ .search-engine-item {
416
+ padding: 0.5rem 1rem;
417
+ cursor: pointer;
418
+ display: flex;
419
+ align-items: center;
420
+ }
421
+
422
+ .search-engine-item:hover {
423
+ background-color: #f3f4f6;
424
+ }
425
+
426
+ .dark-mode .search-engine-item:hover {
427
+ background-color: #374151;
428
+ }
429
+
430
+ .search-engine-icon {
431
+ margin-right: 0.5rem;
432
+ width: 16px;
433
+ height: 16px;
434
+ display: flex;
435
+ align-items: center;
436
+ justify-content: center;
437
+ }
438
+
439
+ /* 搜索卡片 */
440
+ .search-card {
441
+ background-color: white;
442
+ border-radius: 0.5rem;
443
+ box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
444
+ padding: 1.5rem;
445
+ margin-bottom: 1.5rem;
446
+ }
447
+
448
+ .dark-mode .search-card {
449
+ background-color: #1f2937;
450
+ box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
451
+ }
452
+
453
+ /* 任务管理区域 */
454
+ .task-manager-section {
455
+ margin-top: 2rem;
456
+ background-color: white;
457
+ border-radius: 0.5rem;
458
+ box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
459
+ padding: 1.5rem;
460
+ }
461
+
462
+ .dark-mode .task-manager-section {
463
+ background-color: #1f2937;
464
+ }
465
  </style>
466
  </head>
467
  <body class="bg-gray-50 min-h-screen">
 
570
  </div>
571
 
572
  <div class="container mx-auto px-4 py-8 max-w-3xl main-content" id="mainContent">
573
+ <!-- 搜索区域 -->
574
+ <div class="search-card">
575
+ <h1 class="text-3xl font-bold text-center mb-8">多功能搜索</h1>
576
+
577
+ <!-- 通用搜索引擎 -->
578
+ <div class="mb-8">
579
+ <h2 class="text-xl font-semibold mb-4">通用搜索</h2>
580
+ <div class="relative">
581
+ <input
582
+ type="text"
583
+ id="generalSearchInput"
584
+ placeholder="在 Google 上搜索..."
585
+ class="w-full px-6 py-3 rounded-lg border border-gray-300 focus:outline-none focus:border-gray-500 bg-white text-gray-900"
586
+ >
587
+ <button id="generalSearchBtn" class="absolute right-16 top-1/2 transform -translate-y-1/2 bg-gray-900 text-white p-2 rounded-lg hover:bg-gray-800 transition-colors">
588
+ <i class="fas fa-search"></i>
589
+ </button>
590
+ <button id="generalSearchEngineBtn" class="search-engine-btn">
591
+ <i class="fas fa-chevron-down"></i>
592
+ </button>
593
+ <div id="generalSearchEngineDropdown" class="search-engine-dropdown">
594
+ <div class="search-engine-item" data-engine="google">
595
+ <div class="search-engine-icon">
596
+ <i class="fab fa-google text-blue-500"></i>
597
+ </div>
598
+ <span>Google</span>
599
+ </div>
600
+ <div class="search-engine-item" data-engine="bing">
601
+ <div class="search-engine-icon">
602
+ <i class="fab fa-microsoft text-green-500"></i>
603
+ </div>
604
+ <span>Bing</span>
605
+ </div>
606
+ <div class="search-engine-item" data-engine="baidu">
607
+ <div class="search-engine-icon">
608
+ <i class="fas fa-search text-blue-600"></i>
609
+ </div>
610
+ <span>百度</span>
611
+ </div>
612
+ <div class="search-engine-item" data-engine="duckduckgo">
613
+ <div class="search-engine-icon">
614
+ <i class="fas fa-search text-yellow-500"></i>
615
+ </div>
616
+ <span>DuckDuckGo</span>
617
+ </div>
618
+ </div>
619
+ </div>
620
+ </div>
621
+
622
+ <!-- 学术搜索 -->
623
+ <div class="mb-8">
624
+ <h2 class="text-xl font-semibold mb-4">学术搜索</h2>
625
+ <div class="relative">
626
+ <input
627
+ type="text"
628
+ id="academicSearchInput"
629
+ placeholder="在 Google 学术上搜索..."
630
+ class="w-full px-6 py-3 rounded-lg border border-gray-300 focus:outline-none focus:border-gray-500 bg-white text-gray-900"
631
+ >
632
+ <button id="academicSearchBtn" class="absolute right-16 top-1/2 transform -translate-y-1/2 bg-gray-900 text-white p-2 rounded-lg hover:bg-gray-800 transition-colors">
633
+ <i class="fas fa-search"></i>
634
+ </button>
635
+ <button id="academicSearchEngineBtn" class="search-engine-btn">
636
+ <i class="fas fa-chevron-down"></i>
637
+ </button>
638
+ <div id="academicSearchEngineDropdown" class="search-engine-dropdown">
639
+ <div class="search-engine-item" data-engine="google_scholar">
640
+ <div class="search-engine-icon">
641
+ <i class="fas fa-graduation-cap text-blue-500"></i>
642
+ </div>
643
+ <span>Google 学术</span>
644
+ </div>
645
+ <div class="search-engine-item" data-engine="semantic_scholar">
646
+ <div class="search-engine-icon">
647
+ <i class="fas fa-book text-orange-500"></i>
648
+ </div>
649
+ <span>Semantic Scholar</span>
650
+ </div>
651
+ <div class="search-engine-item" data-engine="cnki">
652
+ <div class="search-engine-icon">
653
+ <i class="fas fa-university text-red-500"></i>
654
+ </div>
655
+ <span>CNKI</span>
656
+ </div>
657
+ </div>
658
+ </div>
659
+ </div>
660
+
661
+ <!-- AI 搜索 -->
662
+ <div>
663
+ <h2 class="text-xl font-semibold mb-4">AI 搜索</h2>
664
+ <div class="relative">
665
+ <input
666
+ type="text"
667
+ id="aiSearchInput"
668
+ placeholder="在 DeepSeek 上搜索..."
669
+ class="w-full px-6 py-3 rounded-lg border border-gray-300 focus:outline-none focus:border-gray-500 bg-white text-gray-900"
670
+ >
671
+ <button id="aiSearchBtn" class="absolute right-16 top-1/2 transform -translate-y-1/2 bg-gray-900 text-white p-2 rounded-lg hover:bg-gray-800 transition-colors">
672
+ <i class="fas fa-search"></i>
673
+ </button>
674
+ <button id="aiSearchEngineBtn" class="search-engine-btn">
675
+ <i class="fas fa-chevron-down"></i>
676
+ </button>
677
+ <div id="aiSearchEngineDropdown" class="search-engine-dropdown">
678
+ <div class="search-engine-item" data-engine="deepseek">
679
+ <div class="search-engine-icon">
680
+ <i class="fas fa-robot text-purple-500"></i>
681
+ </div>
682
+ <span>DeepSeek</span>
683
+ </div>
684
+ <div class="search-engine-item" data-engine="chatgpt">
685
+ <div class="search-engine-icon">
686
+ <i class="fas fa-comment text-green-500"></i>
687
+ </div>
688
+ <span>ChatGPT</span>
689
+ </div>
690
+ <div class="search-engine-item" data-engine="claude">
691
+ <div class="search-engine-icon">
692
+ <i class="fas fa-comment-dots text-orange-500"></i>
693
+ </div>
694
+ <span>Claude</span>
695
+ </div>
696
+ </div>
697
+ </div>
698
+ </div>
699
+ </div>
700
+
701
+ <!-- 任务管理区域 -->
702
+ <div class="task-manager-section">
703
  <div class="todo-logo">
704
  <span>任务管理</span>
705
  <span class="dot">.</span>
706
  </div>
707
+ <p class="text-gray-600 mb-6">专注当下,高效生活</p>
708
+
709
+ <div class="relative mb-4">
710
  <input
711
  type="text"
712
  id="newTaskInput"
 
720
  <i class="fas fa-plus"></i>
721
  </button>
722
  </div>
723
+
724
+ <div class="flex items-center justify-between mb-4">
725
  <div class="flex-1 mr-2">
726
  <label for="dueDate" class="block text-sm text-gray-600 mb-1">截止日期</label>
727
  <input
 
742
  </select>
743
  </div>
744
  </div>
 
745
 
746
+ <!-- 任务控制 -->
747
+ <div class="flex justify-between items-center mb-6">
748
+ <div class="flex space-x-2">
749
+ <button id="filterAll" class="filter-btn active px-4 py-2 rounded-lg bg-gray-900 text-white font-medium">全部</button>
750
+ <button id="filterActive" class="filter-btn px-4 py-2 rounded-lg border border-gray-300 hover:bg-gray-100 text-gray-700">待办</button>
751
+ <button id="filterCompleted" class="filter-btn px-4 py-2 rounded-lg border border-gray-300 hover:bg-gray-100 text-gray-700">已完成</button>
752
+ <button id="filterDueToday" class="filter-btn px-4 py-2 rounded-lg border border-gray-300 hover:bg-gray-100 text-gray-700">今日到期</button>
753
+ </div>
754
+ <button id="clearCompleted" class="text-gray-700 hover:text-gray-900 text-sm">
755
+ <i class="fas fa-trash-alt mr-1"></i> 清除已完成
756
+ </button>
757
  </div>
 
 
 
 
758
 
759
+ <!-- 任务统计 -->
760
+ <div class="bg-white rounded-lg p-4 mb-6 border border-gray-200 flex justify-between items-center">
761
+ <div>
762
+ <span class="text-gray-600">总任务:</span>
763
+ <span id="totalTasks" class="font-bold ml-1">0</span>
764
+ </div>
765
+ <div>
766
+ <span class="text-gray-600">已完成:</span>
767
+ <span id="completedTasks" class="font-bold ml-1">0</span>
768
+ </div>
769
+ <div>
770
+ <span class="text-gray-600">待完成:</span>
771
+ <span id="remainingTasks" class="font-bold ml-1">0</span>
772
+ </div>
773
+ <div>
774
+ <span class="text-gray-600">今日到期:</span>
775
+ <span id="dueTodayTasks" class="font-bold ml-1">0</span>
776
+ </div>
777
  </div>
 
778
 
779
+ <!-- 任务列表 -->
780
+ <div id="taskList" class="space-y-3">
781
+ <!-- 任务将动态添加在这里 -->
782
+ <div class="text-center py-10 text-gray-500" id="emptyState">
783
+ <i class="fas fa-tasks text-4xl mb-3 text-gray-300"></i>
784
+ <p class="text-lg">暂无任务</p>
785
+ <p class="mt-1">添加你的第一个任务开始吧</p>
786
+ </div>
787
  </div>
788
  </div>
789
  </div>
 
832
  const progressBar = document.getElementById('progressBar');
833
  const mainContent = document.getElementById('mainContent');
834
 
835
+ // 搜索相关元素
836
+ const generalSearchInput = document.getElementById('generalSearchInput');
837
+ const generalSearchBtn = document.getElementById('generalSearchBtn');
838
+ const generalSearchEngineBtn = document.getElementById('generalSearchEngineBtn');
839
+ const generalSearchEngineDropdown = document.getElementById('generalSearchEngineDropdown');
840
+
841
+ const academicSearchInput = document.getElementById('academicSearchInput');
842
+ const academicSearchBtn = document.getElementById('academicSearchBtn');
843
+ const academicSearchEngineBtn = document.getElementById('academicSearchEngineBtn');
844
+ const academicSearchEngineDropdown = document.getElementById('academicSearchEngineDropdown');
845
+
846
+ const aiSearchInput = document.getElementById('aiSearchInput');
847
+ const aiSearchBtn = document.getElementById('aiSearchBtn');
848
+ const aiSearchEngineBtn = document.getElementById('aiSearchEngineBtn');
849
+ const aiSearchEngineDropdown = document.getElementById('aiSearchEngineDropdown');
850
+
851
  // 状态
852
  let tasks = JSON.parse(localStorage.getItem('tasks')) || [];
853
  let currentFilter = 'all';
 
859
  let progressInterval;
860
  let neteaseMusicUrl = localStorage.getItem('neteaseMusicUrl') || 'https://music.163.com';
861
 
862
+ // 搜索引擎配置
863
+ let currentGeneralEngine = 'google';
864
+ let currentAcademicEngine = 'google_scholar';
865
+ let currentAIEngine = 'deepseek';
866
+
867
+ const searchEngines = {
868
+ // 通用搜索引擎
869
+ google: {
870
+ name: 'Google',
871
+ url: 'https://www.google.com/search?q=',
872
+ icon: 'fab fa-google text-blue-500'
873
+ },
874
+ bing: {
875
+ name: 'Bing',
876
+ url: 'https://www.bing.com/search?q=',
877
+ icon: 'fab fa-microsoft text-green-500'
878
+ },
879
+ baidu: {
880
+ name: '百度',
881
+ url: 'https://www.baidu.com/s?wd=',
882
+ icon: 'fas fa-search text-blue-600'
883
+ },
884
+ duckduckgo: {
885
+ name: 'DuckDuckGo',
886
+ url: 'https://duckduckgo.com/?q=',
887
+ icon: 'fas fa-search text-yellow-500'
888
+ },
889
+
890
+ // 学术搜索引擎
891
+ google_scholar: {
892
+ name: 'Google 学术',
893
+ url: 'https://scholar.google.com/scholar?q=',
894
+ icon: 'fas fa-graduation-cap text-blue-500'
895
+ },
896
+ semantic_scholar: {
897
+ name: 'Semantic Scholar',
898
+ url: 'https://www.semanticscholar.org/search?q=',
899
+ icon: 'fas fa-book text-orange-500'
900
+ },
901
+ cnki: {
902
+ name: 'CNKI',
903
+ url: 'https://search.cnki.net/search.aspx?q=',
904
+ icon: 'fas fa-university text-red-500'
905
+ },
906
+
907
+ // AI搜索引擎
908
+ deepseek: {
909
+ name: 'DeepSeek',
910
+ url: 'https://www.deepseek.com/search?q=',
911
+ icon: 'fas fa-robot text-purple-500'
912
+ },
913
+ chatgpt: {
914
+ name: 'ChatGPT',
915
+ url: 'https://chat.openai.com/',
916
+ icon: 'fas fa-comment text-green-500'
917
+ },
918
+ claude: {
919
+ name: 'Claude',
920
+ url: 'https://claude.ai/',
921
+ icon: 'fas fa-comment-dots text-orange-500'
922
+ }
923
+ };
924
+
925
  // 初始化
926
  initDarkMode();
927
  renderTasks();
 
929
  setupMusicPlayer();
930
  neteaseUrl.value = neteaseMusicUrl;
931
  updateNeteaseLoginBtn();
932
+ initSearchEngines();
933
 
934
  // 事件监听
935
  addTaskBtn.addEventListener('click', addTask);
 
965
  prevBtn.addEventListener('click', playPrevious);
966
  nextBtn.addEventListener('click', playNext);
967
 
968
+ // 搜索相关事件
969
+ generalSearchBtn.addEventListener('click', () => performSearch('general'));
970
+ generalSearchInput.addEventListener('keypress', function(e) {
971
+ if (e.key === 'Enter') performSearch('general');
972
+ });
973
+ generalSearchEngineBtn.addEventListener('click', () => toggleSearchEngineDropdown('general'));
974
+
975
+ academicSearchBtn.addEventListener('click', () => performSearch('academic'));
976
+ academicSearchInput.addEventListener('keypress', function(e) {
977
+ if (e.key === 'Enter') performSearch('academic');
978
+ });
979
+ academicSearchEngineBtn.addEventListener('click', () => toggleSearchEngineDropdown('academic'));
980
+
981
+ aiSearchBtn.addEventListener('click', () => performSearch('ai'));
982
+ aiSearchInput.addEventListener('keypress', function(e) {
983
+ if (e.key === 'Enter') performSearch('ai');
984
+ });
985
+ aiSearchEngineBtn.addEventListener('click', () => toggleSearchEngineDropdown('ai'));
986
+
987
+ // 关闭下拉菜单当点击其他地方时
988
+ document.addEventListener('click', function(e) {
989
+ if (!generalSearchEngineBtn.contains(e.target) && !generalSearchEngineDropdown.contains(e.target)) {
990
+ generalSearchEngineDropdown.classList.remove('show');
991
+ }
992
+
993
+ if (!academicSearchEngineBtn.contains(e.target) && !academicSearchEngineDropdown.contains(e.target)) {
994
+ academicSearchEngineDropdown.classList.remove('show');
995
+ }
996
+
997
+ if (!aiSearchEngineBtn.contains(e.target) && !aiSearchEngineDropdown.contains(e.target)) {
998
+ aiSearchEngineDropdown.classList.remove('show');
999
+ }
1000
+ });
1001
+
1002
  // 功能函数
1003
  function addTask() {
1004
  const taskText = newTaskInput.value.trim();
 
1410
  { id: 1, title: '晴天', artist: '周杰伦', url: 'https://music.163.com/song/media/outer/url?id=186436.mp3' },
1411
  { id: 2, title: '夜曲', artist: '周杰伦', url: 'https://music.163.com/song/media/outer/url?id=186001.mp3' },
1412
  { id: 3, title: '七里香', artist: '周杰伦', url: 'https://music.163.com/song/media/outer/url?id=185879.mp3' },
1413
+ { id: 4, title: '稻香', artist: '周杰Lauren', url: 'https://music.163.com/song/media/outer/url?id=287035.mp3' },
1414
  { id: 5, title: '告白气球', artist: '周杰伦', url: 'https://music.163.com/song/media/outer/url?id=418603077.mp3' }
1415
  ];
1416
 
 
1550
  }
1551
  }
1552
 
1553
+ // 搜索功能
1554
+ function initSearchEngines() {
1555
+ // 设置默认搜索引擎
1556
+ generalSearchInput.placeholder = `在 ${searchEngines[currentGeneralEngine].name} 上搜索...`;
1557
+ academicSearchInput.placeholder = `在 ${searchEngines[currentAcademicEngine].name} 上搜索...`;
1558
+ aiSearchInput.placeholder = `在 ${searchEngines[currentAIEngine].name} 上搜索...`;
1559
+
1560
+ // 为下拉菜单项添加点击事件
1561
+ document.querySelectorAll('#generalSearchEngineDropdown .search-engine-item').forEach(item => {
1562
+ item.addEventListener('click', function() {
1563
+ const engine = this.getAttribute('data-engine');
1564
+ currentGeneralEngine = engine;
1565
+ generalSearchInput.placeholder = `在 ${searchEngines[engine].name} 上搜索...`;
1566
+ generalSearchEngineDropdown.classList.remove('show');
1567
+ });
1568
+ });
1569
+
1570
+ document.querySelectorAll('#academicSearchEngineDropdown .search-engine-item').forEach(item => {
1571
+ item.addEventListener('click', function() {
1572
+ const engine = this.getAttribute('data-engine');
1573
+ currentAcademicEngine = engine;
1574
+ academicSearchInput.placeholder = `��� ${searchEngines[engine].name} 上搜索...`;
1575
+ academicSearchEngineDropdown.classList.remove('show');
1576
+ });
1577
+ });
1578
+
1579
+ document.querySelectorAll('#aiSearchEngineDropdown .search-engine-item').forEach(item => {
1580
+ item.addEventListener('click', function() {
1581
+ const engine = this.getAttribute('data-engine');
1582
+ currentAIEngine = engine;
1583
+ aiSearchInput.placeholder = `在 ${searchEngines[engine].name} 上搜索...`;
1584
+ aiSearchEngineDropdown.classList.remove('show');
1585
+ });
1586
+ });
1587
+ }
1588
+
1589
+ function toggleSearchEngineDropdown(type) {
1590
+ let dropdown;
1591
+ switch(type) {
1592
+ case 'general':
1593
+ dropdown = generalSearchEngineDropdown;
1594
+ break;
1595
+ case 'academic':
1596
+ dropdown = academicSearchEngineDropdown;
1597
+ break;
1598
+ case 'ai':
1599
+ dropdown = aiSearchEngineDropdown;
1600
+ break;
1601
+ }
1602
+
1603
+ // 关闭其他下拉菜单
1604
+ if (type !== 'general') generalSearchEngineDropdown.classList.remove('show');
1605
+ if (type !== 'academic') academicSearchEngineDropdown.classList.remove('show');
1606
+ if (type !== 'ai') aiSearchEngineDropdown.classList.remove('show');
1607
+
1608
+ // 切换当前下拉菜单
1609
+ dropdown.classList.toggle('show');
1610
+ }
1611
+
1612
+ function performSearch(type) {
1613
+ let input, engine;
1614
+ switch(type) {
1615
+ case 'general':
1616
+ input = generalSearchInput;
1617
+ engine = currentGeneralEngine;
1618
+ break;
1619
+ case 'academic':
1620
+ input = academicSearchInput;
1621
+ engine = currentAcademicEngine;
1622
+ break;
1623
+ case 'ai':
1624
+ input = aiSearchInput;
1625
+ engine = currentAIEngine;
1626
+ break;
1627
+ }
1628
+
1629
+ const query = input.value.trim();
1630
+ if (query === '') return;
1631
+
1632
+ const searchUrl = searchEngines[engine].url + encodeURIComponent(query);
1633
+ window.open(searchUrl, '_blank');
1634
+ }
1635
+
1636
  // 辅助函数
1637
  function formatDate(dateString) {
1638
  if (!dateString) return '';