// ==UserScript==
// @name (完全免费)安徽省专业技术人员公需科目一自动答题,对接AI,正确率高
// @namespace 1
// @version 1.0.1
// @description (完全免费)安徽省专业技术人员公需科目一自动答题,对接AI,正确率高
// @author 不知道
// @match https://www.zjzx.ah.cn/test*
// @match https://www.zjzx.ah.cn/*personcenter*
// @match https://www.zjzx.ah.cn/*courseplay*
// @grant GM_setClipboard
// @grant none
// @run-at document-start
// ==/UserScript==
(function() {
'use strict';
const solutions = {};
let fired = false;
const QQ_NUMBER = '3832332796';
// ===================== 控制面板 =====================
function createControlPanel() {
const panel = document.createElement('div');
panel.id = 'ah-study-helper-panel';
panel.innerHTML = `
1
该脚本对接AI答题,旨在快速完成题目,请于使用完成后12小时内删除。
2
打开测试页面会自动完成答题并提交。
3
该脚本为基础版本完全免费,如需视频+答题功能请联系客服QQ:${QQ_NUMBER}
`;
// 样式
const style = document.createElement('style');
style.textContent = `
#ah-study-helper-panel {
position: fixed;
top: 20px;
right: 20px;
width: 340px;
background: linear-gradient(135deg, rgba(255, 107, 107, 0.92) 0%, rgba(255, 142, 83, 0.92) 50%, rgba(255, 206, 84, 0.92) 100%);
backdrop-filter: blur(12px);
-webkit-backdrop-filter: blur(12px);
border: 2px solid rgba(255, 255, 255, 0.6);
border-radius: 16px;
box-shadow: 0 8px 32px rgba(255, 107, 107, 0.35),
0 0 0 1px rgba(255, 255, 255, 0.3) inset,
0 0 20px rgba(255, 206, 84, 0.2);
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
color: #fff;
z-index: 999999;
overflow: hidden;
transition: transform 0.3s ease, opacity 0.3s ease;
cursor: default;
user-select: none;
animation: ah-panel-pop 0.5s ease-out;
}
@keyframes ah-panel-pop {
0% { transform: scale(0.8) translateY(-20px); opacity: 0; }
60% { transform: scale(1.05) translateY(5px); opacity: 1; }
100% { transform: scale(1) translateY(0); opacity: 1; }
}
#ah-study-helper-panel.ah-hidden {
transform: translateX(120%);
opacity: 0;
pointer-events: none;
}
.ah-panel-header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 14px 18px;
background: rgba(0, 0, 0, 0.15);
border-bottom: 1px solid rgba(255, 255, 255, 0.25);
cursor: move;
}
.ah-panel-title {
font-size: 16px;
font-weight: 800;
color: #fff;
letter-spacing: 0.5px;
text-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.ah-panel-close {
width: 26px;
height: 26px;
display: flex;
align-items: center;
justify-content: center;
border-radius: 50%;
font-size: 20px;
color: #fff;
cursor: pointer;
transition: all 0.2s;
text-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.ah-panel-close:hover {
background: rgba(255, 255, 255, 0.25);
color: #fff;
transform: rotate(90deg);
}
.ah-panel-body {
padding: 18px 20px;
}
.ah-panel-item {
display: flex;
align-items: flex-start;
gap: 12px;
margin-bottom: 14px;
font-size: 13.5px;
line-height: 1.7;
color: #fff;
text-shadow: 0 1px 2px rgba(0,0,0,0.15);
}
.ah-panel-item:last-of-type {
margin-bottom: 18px;
}
.ah-panel-num {
flex-shrink: 0;
width: 24px;
height: 24px;
display: flex;
align-items: center;
justify-content: center;
background: rgba(255, 255, 255, 0.9);
color: #ff6b6b;
font-size: 13px;
font-weight: 800;
border-radius: 50%;
margin-top: 0;
box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.ah-copy-btn {
width: 100%;
padding: 14px;
border: none;
border-radius: 12px;
background: linear-gradient(135deg, #fff 0%, #f8f9fa 100%);
color: #ff6b6b;
font-size: 15px;
font-weight: 700;
cursor: pointer;
transition: all 0.3s ease;
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
letter-spacing: 1px;
}
.ah-copy-btn:hover {
transform: translateY(-3px) scale(1.02);
box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
background: linear-gradient(135deg, #fff 0%, #fff 100%);
}
.ah-copy-btn:active {
transform: translateY(0) scale(0.98);
}
.ah-copy-btn.ah-copied {
background: linear-gradient(135deg, #00b894 0%, #00a085 100%);
color: #fff;
box-shadow: 0 4px 15px rgba(0, 184, 148, 0.4);
}
/* 浮动指示器 */
.ah-float-btn {
position: fixed;
top: 20px;
right: 20px;
width: 50px;
height: 50px;
border-radius: 50%;
background: linear-gradient(135deg, #ff6b6b 0%, #ff8e53 50%, #ffce54 100%);
color: #fff;
font-size: 22px;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
box-shadow: 0 4px 20px rgba(255, 107, 107, 0.4), 0 0 0 3px rgba(255,255,255,0.3);
z-index: 999998;
transition: all 0.3s ease;
border: 2px solid rgba(255,255,255,0.5);
animation: ah-float-pulse 2s infinite;
}
@keyframes ah-float-pulse {
0%, 100% { box-shadow: 0 4px 20px rgba(255, 107, 107, 0.4), 0 0 0 3px rgba(255,255,255,0.3); }
50% { box-shadow: 0 4px 30px rgba(255, 107, 107, 0.6), 0 0 0 6px rgba(255,255,255,0.1); }
}
.ah-float-btn:hover {
transform: scale(1.15) rotate(10deg);
box-shadow: 0 6px 25px rgba(255, 107, 107, 0.5);
}
.ah-float-btn.ah-hidden {
display: none;
}
`;
document.head.appendChild(style);
document.body.appendChild(panel);
// 关闭按钮
const closeBtn = panel.querySelector('.ah-panel-close');
closeBtn.addEventListener('click', () => {
panel.classList.add('ah-hidden');
floatBtn.classList.remove('ah-hidden');
});
// 一键复制QQ
const copyBtn = document.getElementById('ah-copy-qq');
copyBtn.addEventListener('click', () => {
copyToClipboard(QQ_NUMBER);
copyBtn.textContent = '✅ 已复制到剪贴板';
copyBtn.classList.add('ah-copied');
setTimeout(() => {
copyBtn.textContent = '📋 一键复制客服QQ';
copyBtn.classList.remove('ah-copied');
}, 2000);
});
// 浮动按钮(面板关闭后显示)
const floatBtn = document.createElement('div');
floatBtn.className = 'ah-float-btn ah-hidden';
floatBtn.innerHTML = '📚';
floatBtn.title = '打开AH学习助手';
floatBtn.addEventListener('click', () => {
panel.classList.remove('ah-hidden');
floatBtn.classList.add('ah-hidden');
});
document.body.appendChild(floatBtn);
// 拖拽功能
makeDraggable(panel, panel.querySelector('.ah-panel-header'));
}
function makeDraggable(element, handle) {
let isDragging = false;
let startX, startY, initialLeft, initialTop;
handle.addEventListener('mousedown', (e) => {
isDragging = true;
startX = e.clientX;
startY = e.clientY;
initialLeft = element.offsetLeft;
initialTop = element.offsetTop;
element.style.transition = 'none';
e.preventDefault();
});
document.addEventListener('mousemove', (e) => {
if (!isDragging) return;
const dx = e.clientX - startX;
const dy = e.clientY - startY;
element.style.left = (initialLeft + dx) + 'px';
element.style.top = (initialTop + dy) + 'px';
element.style.right = 'auto';
});
document.addEventListener('mouseup', () => {
if (isDragging) {
isDragging = false;
element.style.transition = 'transform 0.3s ease, opacity 0.3s ease';
}
});
}
function copyToClipboard(text) {
if (typeof GM_setClipboard !== 'undefined') {
GM_setClipboard(text);
} else {
navigator.clipboard.writeText(text).catch(() => {
const textarea = document.createElement('textarea');
textarea.value = text;
textarea.style.position = 'fixed';
textarea.style.opacity = '0';
document.body.appendChild(textarea);
textarea.select();
document.execCommand('copy');
document.body.removeChild(textarea);
});
}
}
// ===================== 答题逻辑 =====================
const rawFetch = window.fetch;
window.fetch = function(...args) {
return rawFetch.apply(this, args).then(response => {
const copy = response.clone();
copy.json().then(json => {
if (json && json.success == "1" && json.data && json.data.questionCats) {
parse(json);
if (!fired) {
fired = true;
setTimeout(start, 1200);
}
}
}).catch(() => {});
return response;
});
};
const rawOpen = XMLHttpRequest.prototype.open;
XMLHttpRequest.prototype.open = function(...args) {
this.addEventListener('loadend', function() {
try {
const json = JSON.parse(this.responseText);
if (json && json.success == "1" && json.data && json.data.questionCats) {
parse(json);
if (!fired) {
fired = true;
setTimeout(start, 1200);
}
}
} catch(e) {}
});
return rawOpen.apply(this, args);
};
function parse(data) {
const cats = data.data.questionCats;
for (let i = 0; i < cats.length; i++) {
const qs = cats[i].questions;
for (let j = 0; j < qs.length; j++) {
const q = qs[j];
const ans = [];
for (let k = 0; k < q.options.length; k++) {
if (q.options[k].answer == "1") ans.push(k);
}
solutions[q.stemContent.trim().replace(/\s+/g, '')] = ans;
}
}
}
function start() {
const tab = document.querySelector('.paper-tab2');
if (tab && tab.className.indexOf('on') === -1) tab.click();
setTimeout(fill, 1800);
}
function fill() {
const items = document.querySelectorAll('.ap-paper-ques-details');
for (let i = 0; i < items.length; i++) {
const stem = items[i].querySelector('.ap-paper-ques-timu');
if (!stem) continue;
const txt = stem.textContent.trim().replace(/\s+/g, '');
let ans = null;
for (let key in solutions) {
if (txt.indexOf(key.substring(0, 8)) !== -1 || key.indexOf(txt.substring(0, 8)) !== -1) {
ans = solutions[key];
break;
}
}
if (!ans) continue;
const opts = items[i].querySelectorAll('.ap-paper-ques-abc');
for (let j = 0; j < ans.length; j++) {
const node = opts[ans[j]];
if (!node) continue;
const input = node.querySelector('input[type="radio"], input[type="checkbox"]');
if (input && !input.checked) {
input.checked = true;
input.dispatchEvent(new Event('change', { bubbles: true }));
}
}
}
setTimeout(function() {
const submit = document.querySelector('.ap-paper-num-p2 a.s-bgclr-main');
if (submit) {
submit.click();
setTimeout(confirm, 1200);
}
}, 800);
}
function confirm() {
const btns = document.querySelectorAll('.el-button--primary');
for (let i = 0; i < btns.length; i++) {
const span = btns[i].querySelector('span');
if (span && span.textContent.trim() === '确 定') {
btns[i].click();
setTimeout(function() { window.close(); }, 1000);
return;
}
}
}
// ===================== 初始化 =====================
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', createControlPanel);
} else {
createControlPanel();
}
})();