BIT北理工一键评教 - pj.bit.edu.cn

一键完成所有单选项并提交,可自定义评价选项;修复评教按钮不显示的问题

  1. // ==UserScript==
  2. // @name BIT北理工一键评教 - pj.bit.edu.cn
  3. // @namespace Violentmonkey Scripts
  4. // @match https://pj.bit.edu.cn/pjxt2.0/*
  5. // @match https://webvpn.bit.edu.cn/*/pjxt2.0/*
  6. // @grant GM_addStyle
  7. // @version 2.2.0
  8. // @author xioneko
  9. // @description 一键完成所有单选项并提交,可自定义评价选项;修复评教按钮不显示的问题
  10. // @license MIT
  11. // ==/UserScript==
  12.  
  13. if (document.URL.endsWith('queryListStpj') /* 课程评价首页 */) {
  14. // 修复评教按钮显示问题
  15. GM_addStyle(`
  16. .visible-desktop {
  17. display: unset !important;
  18. }
  19. `)
  20. }
  21.  
  22. if (document.URL.endsWith('evaluateCourseInfo.do') /* 评教页 */) {
  23. if (document.querySelector('a[onclick*="savePjxx"]')) {
  24. document.querySelector('.create_tit').insertAdjacentHTML(
  25. 'beforeend',
  26. `
  27. <div id="pj-input">
  28. <select id="pj-select">
  29. <option value="1" selected>非常符合</option>
  30. <option value="2">比较符合</option>
  31. <option value="3">一般</option>
  32. <option value="4">比较不符合</option>
  33. <option value="5">非常不符合</option>
  34. </select>
  35. <div id="pj-btn">提交</div>
  36. </div>
  37. `
  38. )
  39. document.querySelector('#pj-btn').addEventListener(
  40. 'click',
  41. () => {
  42. const selection = document.querySelector('#pj-select').value
  43. for (let i = 0; i < 9; ++i) {
  44. document.querySelector(
  45. `#pjnr_${i + 1}_${selection}`
  46. ).checked = true
  47. }
  48. savePjxx('1') // 提交
  49. },
  50. {
  51. once: true,
  52. }
  53. )
  54. GM_addStyle(`
  55. .create_tit {
  56. display: flex;
  57. height: 40px;
  58. justify-content: space-between;
  59. }
  60. #pj-input {
  61. display: flex;
  62. align-items: center;
  63. }
  64. #pj-select{
  65. margin: 0 15px;
  66. border-radius: 0.5rem;
  67. height: 36px;
  68. width: 128px;
  69. }
  70. #pj-btn {
  71. cursor: pointer;
  72. transition: all 150ms cubic-bezier(0.4, 0, 0.2, 1);
  73. padding: 0.5rem 1.5rem;
  74. border-radius: 0.5rem;
  75. background-color: #fbb955;
  76. color: white;
  77. border-bottom: 4px solid #e1992e;
  78. }
  79. #pj-btn:hover {
  80. filter: brightness(1.1);
  81. transform: translateY(1px);
  82. border-bottom-width: 6px;
  83. }
  84. #pj-btn:active {
  85. filter: brightness(0.9);
  86. transform: translateY(2px);
  87. border-bottom-width: 2px;
  88. }
  89. `)
  90. }
  91. }