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

Add 1 files

Browse files
Files changed (1) hide show
  1. index.html +194 -206
index.html CHANGED
@@ -462,6 +462,73 @@
462
  .dark-mode .task-manager-section {
463
  background-color: #1f2937;
464
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
465
  </style>
466
  </head>
467
  <body class="bg-gray-50 min-h-screen">
@@ -569,129 +636,92 @@
569
  </div>
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>
@@ -843,11 +873,6 @@
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';
@@ -862,7 +887,6 @@
862
  // 搜索引擎配置
863
  let currentGeneralEngine = 'google';
864
  let currentAcademicEngine = 'google_scholar';
865
- let currentAIEngine = 'deepseek';
866
 
867
  const searchEngines = {
868
  // 通用搜索引擎
@@ -902,23 +926,6 @@
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
 
@@ -978,12 +985,6 @@
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)) {
@@ -993,10 +994,6 @@
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
  // 功能函数
@@ -1399,55 +1396,58 @@
1399
  const query = musicSearch.value.trim();
1400
  if (query === '') return;
1401
 
1402
- // 模拟网易云音乐API请求
1403
- // 在实际应用中,这里应该是一个真实的API请求
1404
  musicResults.innerHTML = '<div class="text-center py-4"><i class="fas fa-spinner fa-spin"></i> 搜索中...</div>';
1405
 
1406
- // 模拟延迟
1407
- setTimeout(() => {
1408
- // 模拟搜索结果
1409
- const mockResults = [
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
-
1417
- // 过滤结果
1418
- const filteredResults = mockResults.filter(song =>
1419
- song.title.includes(query) || song.artist.includes(query)
1420
- );
1421
-
1422
- if (filteredResults.length === 0) {
1423
- musicResults.innerHTML = '<div class="text-center py-8 text-gray-500">没有找到相关歌曲</div>';
1424
- return;
1425
- }
1426
-
1427
- musicResults.innerHTML = '';
1428
- filteredResults.forEach((song, index) => {
1429
- const songElement = document.createElement('div');
1430
- songElement.className = 'p-3 border-b border-gray-200 hover:bg-gray-100 cursor-pointer flex justify-between items-center';
1431
- songElement.innerHTML = `
1432
- <div>
1433
- <div class="font-medium">${song.title}</div>
1434
- <div class="text-sm text-gray-600">${song.artist}</div>
1435
- </div>
1436
- <i class="fas fa-play text-gray-500"></i>
1437
- `;
1438
-
1439
- songElement.addEventListener('click', () => {
1440
- playSong(index, filteredResults);
1441
- });
1442
-
1443
- musicResults.appendChild(songElement);
 
 
 
 
 
 
 
 
 
 
1444
  });
1445
-
1446
- // 更新播放列表
1447
- musicList = filteredResults;
1448
- localStorage.setItem('musicPlaylist', JSON.stringify(musicList));
1449
- renderMusicList();
1450
- }, 1000);
1451
  }
1452
 
1453
  function playSong(index, playlist = musicList) {
@@ -1456,6 +1456,12 @@
1456
  currentMusicIndex = index;
1457
  const song = playlist[currentMusicIndex];
1458
 
 
 
 
 
 
 
1459
  audio.src = song.url;
1460
  audio.play()
1461
  .then(() => {
@@ -1555,7 +1561,6 @@
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 => {
@@ -1575,15 +1580,6 @@
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) {
@@ -1595,15 +1591,11 @@
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');
@@ -1620,10 +1612,6 @@
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();
 
462
  .dark-mode .task-manager-section {
463
  background-color: #1f2937;
464
  }
465
+
466
+ /* 新添加的样式 */
467
+ .search-container {
468
+ display: grid;
469
+ grid-template-columns: 1fr;
470
+ gap: 1.5rem;
471
+ }
472
+
473
+ @media (min-width: 768px) {
474
+ .search-container {
475
+ grid-template-columns: 1fr 1fr;
476
+ }
477
+ }
478
+
479
+ .search-box {
480
+ position: relative;
481
+ margin-bottom: 1rem;
482
+ }
483
+
484
+ .search-input {
485
+ width: 100%;
486
+ padding: 0.75rem 1rem;
487
+ padding-right: 3.5rem;
488
+ border-radius: 0.5rem;
489
+ border: 1px solid #e5e7eb;
490
+ font-size: 1rem;
491
+ transition: border-color 0.2s;
492
+ }
493
+
494
+ .search-input:focus {
495
+ outline: none;
496
+ border-color: #3b82f6;
497
+ box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
498
+ }
499
+
500
+ .search-button {
501
+ position: absolute;
502
+ right: 0.5rem;
503
+ top: 50%;
504
+ transform: translateY(-50%);
505
+ background-color: #3b82f6;
506
+ color: white;
507
+ border: none;
508
+ border-radius: 0.25rem;
509
+ padding: 0.5rem;
510
+ cursor: pointer;
511
+ transition: background-color 0.2s;
512
+ }
513
+
514
+ .search-button:hover {
515
+ background-color: #2563eb;
516
+ }
517
+
518
+ .search-engine-toggle {
519
+ position: absolute;
520
+ right: 3.5rem;
521
+ top: 50%;
522
+ transform: translateY(-50%);
523
+ background: none;
524
+ border: none;
525
+ color: #6b7280;
526
+ cursor: pointer;
527
+ }
528
+
529
+ .search-engine-toggle:hover {
530
+ color: #4b5563;
531
+ }
532
  </style>
533
  </head>
534
  <body class="bg-gray-50 min-h-screen">
 
636
  </div>
637
  </div>
638
 
639
+ <div class="container mx-auto px-4 py-8 max-w-4xl main-content" id="mainContent">
640
  <!-- 搜索区域 -->
641
  <div class="search-card">
642
  <h1 class="text-3xl font-bold text-center mb-8">多功能搜索</h1>
643
 
644
+ <div class="search-container">
645
+ <!-- 通用搜索引擎 -->
646
+ <div>
647
+ <h2 class="text-xl font-semibold mb-4">通用搜索</h2>
648
+ <div class="search-box">
649
+ <input
650
+ type="text"
651
+ id="generalSearchInput"
652
+ placeholder=" Google 上搜索..."
653
+ class="search-input"
654
+ >
655
+ <button id="generalSearchEngineBtn" class="search-engine-toggle">
656
+ <i class="fas fa-chevron-down"></i>
657
+ </button>
658
+ <button id="generalSearchBtn" class="search-button">
659
+ <i class="fas fa-search"></i>
660
+ </button>
661
+ <div id="generalSearchEngineDropdown" class="search-engine-dropdown">
662
+ <div class="search-engine-item" data-engine="google">
663
+ <div class="search-engine-icon">
664
+ <i class="fab fa-google text-blue-500"></i>
665
+ </div>
666
+ <span>Google</span>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
667
  </div>
668
+ <div class="search-engine-item" data-engine="bing">
669
+ <div class="search-engine-icon">
670
+ <i class="fab fa-microsoft text-green-500"></i>
671
+ </div>
672
+ <span>Bing</span>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
673
  </div>
674
+ <div class="search-engine-item" data-engine="baidu">
675
+ <div class="search-engine-icon">
676
+ <i class="fas fa-search text-blue-600"></i>
677
+ </div>
678
+ <span>百度</span>
679
  </div>
680
+ <div class="search-engine-item" data-engine="duckduckgo">
681
+ <div class="search-engine-icon">
682
+ <i class="fas fa-search text-yellow-500"></i>
683
+ </div>
684
+ <span>DuckDuckGo</span>
685
  </div>
 
686
  </div>
687
  </div>
688
  </div>
689
+
690
+ <!-- 学术搜索 -->
691
+ <div>
692
+ <h2 class="text-xl font-semibold mb-4">学术搜索</h2>
693
+ <div class="search-box">
694
+ <input
695
+ type="text"
696
+ id="academicSearchInput"
697
+ placeholder="在 Google 学术上搜索..."
698
+ class="search-input"
699
+ >
700
+ <button id="academicSearchEngineBtn" class="search-engine-toggle">
701
+ <i class="fas fa-chevron-down"></i>
702
+ </button>
703
+ <button id="academicSearchBtn" class="search-button">
704
+ <i class="fas fa-search"></i>
705
+ </button>
706
+ <div id="academicSearchEngineDropdown" class="search-engine-dropdown">
707
+ <div class="search-engine-item" data-engine="google_scholar">
708
+ <div class="search-engine-icon">
709
+ <i class="fas fa-graduation-cap text-blue-500"></i>
710
+ </div>
711
+ <span>Google 学术</span>
712
  </div>
713
+ <div class="search-engine-item" data-engine="semantic_scholar">
714
+ <div class="search-engine-icon">
715
+ <i class="fas fa-book text-orange-500"></i>
716
+ </div>
717
+ <span>Semantic Scholar</span>
718
  </div>
719
+ <div class="search-engine-item" data-engine="cnki">
720
+ <div class="search-engine-icon">
721
+ <i class="fas fa-university text-red-500"></i>
722
+ </div>
723
+ <span>CNKI</span>
724
  </div>
 
725
  </div>
726
  </div>
727
  </div>
 
873
  const academicSearchEngineBtn = document.getElementById('academicSearchEngineBtn');
874
  const academicSearchEngineDropdown = document.getElementById('academicSearchEngineDropdown');
875
 
 
 
 
 
 
876
  // 状态
877
  let tasks = JSON.parse(localStorage.getItem('tasks')) || [];
878
  let currentFilter = 'all';
 
887
  // 搜索引擎配置
888
  let currentGeneralEngine = 'google';
889
  let currentAcademicEngine = 'google_scholar';
 
890
 
891
  const searchEngines = {
892
  // 通用搜索引擎
 
926
  name: 'CNKI',
927
  url: 'https://search.cnki.net/search.aspx?q=',
928
  icon: 'fas fa-university text-red-500'
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
929
  }
930
  };
931
 
 
985
  });
986
  academicSearchEngineBtn.addEventListener('click', () => toggleSearchEngineDropdown('academic'));
987
 
 
 
 
 
 
 
988
  // 关闭下拉菜单当点击其他地方时
989
  document.addEventListener('click', function(e) {
990
  if (!generalSearchEngineBtn.contains(e.target) && !generalSearchEngineDropdown.contains(e.target)) {
 
994
  if (!academicSearchEngineBtn.contains(e.target) && !academicSearchEngineDropdown.contains(e.target)) {
995
  academicSearchEngineDropdown.classList.remove('show');
996
  }
 
 
 
 
997
  });
998
 
999
  // 功能函数
 
1396
  const query = musicSearch.value.trim();
1397
  if (query === '') return;
1398
 
1399
+ // 使用网易云音乐API的代理服务
 
1400
  musicResults.innerHTML = '<div class="text-center py-4"><i class="fas fa-spinner fa-spin"></i> 搜索中...</div>';
1401
 
1402
+ // 使用网易云音乐API的代理服务
1403
+ fetch(`https://api.injahow.cn/meting/?server=netease&type=search&id=${encodeURIComponent(query)}`)
1404
+ .then(response => response.json())
1405
+ .then(data => {
1406
+ if (data && data.length > 0) {
1407
+ musicResults.innerHTML = '';
1408
+
1409
+ // 处理返回的音乐数据
1410
+ const songs = data.map(song => ({
1411
+ id: song.id,
1412
+ title: song.name,
1413
+ artist: song.artist,
1414
+ url: song.url,
1415
+ cover: song.cover
1416
+ }));
1417
+
1418
+ songs.forEach((song, index) => {
1419
+ const songElement = document.createElement('div');
1420
+ songElement.className = 'p-3 border-b border-gray-200 hover:bg-gray-100 cursor-pointer flex justify-between items-center';
1421
+ songElement.innerHTML = `
1422
+ <div class="flex items-center">
1423
+ <img src="${song.cover}" alt="${song.title}" class="w-10 h-10 rounded mr-3">
1424
+ <div>
1425
+ <div class="font-medium">${song.title}</div>
1426
+ <div class="text-sm text-gray-600">${song.artist}</div>
1427
+ </div>
1428
+ </div>
1429
+ <i class="fas fa-play text-gray-500"></i>
1430
+ `;
1431
+
1432
+ songElement.addEventListener('click', () => {
1433
+ playSong(index, songs);
1434
+ });
1435
+
1436
+ musicResults.appendChild(songElement);
1437
+ });
1438
+
1439
+ // 更新播放列表
1440
+ musicList = songs;
1441
+ localStorage.setItem('musicPlaylist', JSON.stringify(musicList));
1442
+ renderMusicList();
1443
+ } else {
1444
+ musicResults.innerHTML = '<div class="text-center py-8 text-gray-500">没有找到相关歌曲</div>';
1445
+ }
1446
+ })
1447
+ .catch(error => {
1448
+ console.error('搜索失败:', error);
1449
+ musicResults.innerHTML = '<div class="text-center py-8 text-gray-500">搜索失败,请稍后再试</div>';
1450
  });
 
 
 
 
 
 
1451
  }
1452
 
1453
  function playSong(index, playlist = musicList) {
 
1456
  currentMusicIndex = index;
1457
  const song = playlist[currentMusicIndex];
1458
 
1459
+ // 检查歌曲URL是否有效
1460
+ if (!song.url) {
1461
+ alert('无法获取歌曲播放地址');
1462
+ return;
1463
+ }
1464
+
1465
  audio.src = song.url;
1466
  audio.play()
1467
  .then(() => {
 
1561
  // 设置默认搜索引擎
1562
  generalSearchInput.placeholder = `在 ${searchEngines[currentGeneralEngine].name} 上搜索...`;
1563
  academicSearchInput.placeholder = `在 ${searchEngines[currentAcademicEngine].name} 上搜索...`;
 
1564
 
1565
  // 为下拉菜单项添加点击事件
1566
  document.querySelectorAll('#generalSearchEngineDropdown .search-engine-item').forEach(item => {
 
1580
  academicSearchEngineDropdown.classList.remove('show');
1581
  });
1582
  });
 
 
 
 
 
 
 
 
 
1583
  }
1584
 
1585
  function toggleSearchEngineDropdown(type) {
 
1591
  case 'academic':
1592
  dropdown = academicSearchEngineDropdown;
1593
  break;
 
 
 
1594
  }
1595
 
1596
  // 关闭其他下拉菜单
1597
  if (type !== 'general') generalSearchEngineDropdown.classList.remove('show');
1598
  if (type !== 'academic') academicSearchEngineDropdown.classList.remove('show');
 
1599
 
1600
  // 切换当前下拉菜单
1601
  dropdown.classList.toggle('show');
 
1612
  input = academicSearchInput;
1613
  engine = currentAcademicEngine;
1614
  break;
 
 
 
 
1615
  }
1616
 
1617
  const query = input.value.trim();