// ==UserScript==
// @name BIT北理工一键评教 - pj.bit.edu.cn
// @namespace Violentmonkey Scripts
// @match https://pj.bit.edu.cn/pjxt2.0/*
// @grant GM_addStyle
// @version 2.0.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('welcome')) {
GM_addStyle(`
#ace-settings-btn {
transform: translateY(60px);
}
`)
}
// 仅对未评价课程的评价页生效
if (document.URL.endsWith('evaluateCourseInfo.do') &&
document.querySelector('a[onclick^="savePjxx"]')) {
document.querySelector('.create_tit')
.insertAdjacentHTML('beforeend', `
`);
(()=>{
const QUESTION_NUM = 9; // 问题数量固定
const submitBtn = document.querySelector('#pj-btn')
submitBtn.addEventListener('click', () => {
const selection = document.querySelector('#pj-select').value;
[...Array(QUESTION_NUM).keys()].forEach(_ => {
document.querySelector(`#pjnr_${_ + 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;
}
`)
}