长财一键评教脚本2
// ==UserScript==
// @name 长财一键评教脚本2
// @namespace https://bbs.tampermonkey.net.cn/
// @version 0.1.0
// @description try to take over the world!
// @author one ccufe person
// @match http://*/TMWeb/*
// @grant GM_addStyle
// ==/UserScript==
(function () {
createWin()
var startJsDom = document.getElementById('startJs')
startJsDom.addEventListener('click', scoreMark)
})();
// 评分函数
function scoreMark(e) {
var score = document.querySelector('#score').value;
console.log('分数为:' + score);
var nowValueSelect = 0;
while (document.querySelector('#GridView1_dropItem_' + nowValueSelect) != null) {
document.querySelector('#GridView1_dropItem_' + nowValueSelect).value = score;
nowValueSelect += 1;
}
document.querySelector('#radioSatisfaction_0').checked = true;
nowValueSelect = 1;
}
// 创建工具窗口
function createWin() {
// 判断是否为评分界面
var se = document.querySelector('#GridView1_dropItem_0')
if (se == null) {
return;
}
var toolWin = document.createElement('div')
const toolconstruction = `<div><span class="base-text">评分:</span>
<select id="score" class="select-score" name="score">
<option value="5.00">5</option>
<option value="4.00">4</option>
<option value="3.00">3</option>
<option value="2.00">2</option>
<option value="1.00">1</option>
</select></div>
<div><button id="startJs" class="base-button">一键填充当前页</button></div>
<div>需手动点击保存按钮</div>`
toolWin.innerHTML = toolconstruction;
Object.assign(toolWin.style, {
'position': 'fixed',
// 'draggable': 'true',
'top': '30%',
'right': '5%',
'width': '200px',
'height': '200px',
'border-radius': '10px',
'background-color': 'white',
'box-shadow': '0px 0px 2px 1px rgba(0,0,0,0.2)',
'padding': '30px',
'box-sizing': 'border-box',
'display': 'flex',
'flex-direction': 'column',
'justify-content': 'center',
'align-items': 'center'
})
var body = document.getElementsByTagName('body')[0]
GM_addStyle(`.base-text{
font-size: 20px;
font-weight: bold;
}`)
GM_addStyle(`.select-score{
width: 60px;
font-size: 20px;
font-weight: bold;
height: 30px;
padding: 0px;
}`)
GM_addStyle(`.base-button{
width: 130px;
height: 40px;
background-color: rgb(69, 141, 199);
font-size: 13px;
color: white;
font-weight: bold;
line-height: 30px;
margin-top: 30px;
}`)
body.appendChild(toolWin)
}