华医网直接进考试

自动提取课程ID并生成跳转按钮

  1. // ==UserScript==
  2. // @name 华医网直接进考试
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.0
  5. // @description 自动提取课程ID并生成跳转按钮
  6. // @author YourName
  7. // @match https://cme28.91huayi.com/*
  8. // @match https://*.cme28.91huayi.com/*
  9. // @grant none
  10. // @license MIT
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. 'use strict';
  15.  
  16. // 初始化按钮容器样式
  17. const container = document.createElement('div');
  18. container.style.cssText = `
  19. position: fixed;
  20. right: 20px;
  21. top: 50%;
  22. transform: translateY(-50%);
  23. background: rgba(255,255,255,0.9);
  24. padding: 15px;
  25. border-radius: 8px;
  26. box-shadow: 0 2px 10px rgba(0,0,0,0.2);
  27. z-index: 99999;
  28. max-height: 90vh;
  29. overflow-y: auto;
  30. `;
  31.  
  32. // 查找所有课程ID
  33. const regex = /\.\.\/course_ware\/course_ware\.aspx\?cwid=([^"]+)/g;
  34. const matches = [...document.body.innerHTML.matchAll(regex)];
  35. const uniqueCwids = [...new Set(matches.map(m => m[1]))];
  36.  
  37. if (uniqueCwids.length === 0) return;
  38.  
  39. // 生成按钮列表
  40. uniqueCwids.forEach((cwid, index) => {
  41. const btn = document.createElement('button');
  42. btn.innerHTML = `${index + 1}. 课程${index + 1}`;
  43. btn.style.cssText = `
  44. display: block;
  45. width: 120px;
  46. margin: 8px 0;
  47. padding: 10px;
  48. background: #4CAF50;
  49. color: white;
  50. border: none;
  51. border-radius: 4px;
  52. cursor: pointer;
  53. transition: 0.3s;
  54. `;
  55.  
  56. // 按钮交互效果
  57. btn.onmouseover = () => btn.style.opacity = '0.8';
  58. btn.onmouseout = () => btn.style.opacity = '1';
  59. btn.onclick = () => window.open(`https://cme28.91huayi.com/pages/exam.aspx?cwid=${cwid}`, '_blank');
  60.  
  61. container.appendChild(btn);
  62. });
  63.  
  64. // 添加标题和分隔线
  65. const title = document.createElement('h3');
  66. title.textContent = '课程导航';
  67. title.style.cssText = 'margin:0 0 10px 0; color:#333;';
  68. container.insertBefore(title, container.firstChild);
  69.  
  70. document.body.appendChild(container);
  71.  
  72. // 响应式适配
  73. window.addEventListener('resize', () => {
  74. container.style.right = window.innerWidth < 768 ? '10px' : '20px';
  75. });
  76. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址