// ==UserScript==
// @name BIT北理工一键评教 - pj.bit.edu.cn
// @namespace Violentmonkey Scripts
// @match https://pj.bit.edu.cn/pjxt2.0/*
// @match https://webvpn.bit.edu.cn/*/pjxt2.0/*
// @grant GM_addStyle
// @version 2.2.0
// @author xioneko
// @description 一键完成所有单选项并提交,可自定义评价选项;修复评教按钮不显示的问题
// @license MIT
// @downloadURL none
// ==/UserScript==
if (document.URL.endsWith('queryListStpj') /* 课程评价首页 */) {
// 修复评教按钮显示问题
GM_addStyle(`
.visible-desktop {
display: unset !important;
}
`)
}
if (document.URL.endsWith('evaluateCourseInfo.do') /* 评教页 */) {
if (document.querySelector('a[onclick*="savePjxx"]')) {
document.querySelector('.create_tit').insertAdjacentHTML(
'beforeend',
`
`
)
document.querySelector('#pj-btn').addEventListener(
'click',
() => {
const selection = document.querySelector('#pj-select').value
for (let i = 0; i < 9; ++i) {
document.querySelector(
`#pjnr_${i + 1}_${selection}`
).checked = true
}
savePjxx('1') // 提交
},
{
once: true,
}
)
GM_addStyle(`
.create_tit {
display: flex;
height: 40px;
justify-content: space-between;
}
#pj-input {
display: flex;
align-items: center;
}
#pj-select{
margin: 0 15px;
border-radius: 0.5rem;
height: 36px;
width: 128px;
}
#pj-btn {
cursor: pointer;
transition: all 150ms cubic-bezier(0.4, 0, 0.2, 1);
padding: 0.5rem 1.5rem;
border-radius: 0.5rem;
background-color: #fbb955;
color: white;
border-bottom: 4px solid #e1992e;
}
#pj-btn:hover {
filter: brightness(1.1);
transform: translateY(1px);
border-bottom-width: 6px;
}
#pj-btn:active {
filter: brightness(0.9);
transform: translateY(2px);
border-bottom-width: 2px;
}
`)
}
}