找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 1810|回复: 0

da

[复制链接]

9

主题

0

回帖

117

积分

管理员

积分
117
发表于 2025-11-7 10:16:50 | 显示全部楼层 |阅读模式


  1. Function.prototype.__constructor_back = Function.prototype.constructor;
  2. Function.prototype.constructor = function() {
  3.         if(arguments && typeof arguments[0]==='string'){
  4.                 if("debugger" === arguments[0]){
  5.                         return
  6.                 }
  7.         }
  8.    return Function.prototype.__constructor_back.apply(this,arguments);
  9. }
复制代码


  1. const span = createMessage()

  2. const sleep = async (time_delay) => {
  3.     return new Promise(resolve => {
  4.         setTimeout(() => {
  5.             resolve()
  6.         }, time_delay * 1000)
  7.     })
  8. }
  9. function createMessage() {
  10.     const span = document.createElement('span')
  11.     let style = `position: fixed; right: 10px; top: 80px; width: 500px; text-align: left; background-color: rgba(255, 255, 255, 0.9); z-index: 99; padding: 10px 20px; border-radius: 5px; color: #222; box-shadow: 0px 0px 5px rgba(0, 0, 0, 0.2); font-weight: bold;`
  12.     span.setAttribute('style', style)
  13.     span.innerText = '脚本启动成功'
  14.     document.body.appendChild(span)
  15.     return span
  16. }

  17. function message(text = '') {
  18.     span.innerHTML = text
  19. }


  20. // 添加按钮到指定父元素
  21. const addBtn = (content, click_func = null, parent_element = '.panel-title') => {
  22.     let heasers = document.querySelector(parent_element);
  23.     let button = document.createElement('button');
  24.     button.innerHTML = content;
  25.     button.className = 'layui-btn layui-btn-warm';
  26.     button.onclick = click_func;
  27.     heasers.append(button);
  28. }


  29. async function completeCurrentQuestion(num = 1) {
  30.     const question = q_list[num - 1]
  31.     for (const answer of question['answer_list']) {
  32.         if (answer['op'] == 1) {
  33.             let op = document.querySelector(`#questions input[value="${answer['id']}"]`)
  34.             if (!op) {
  35.                 gen(num)
  36.                 await sleep(0.3)
  37.                 op = document.querySelector(`#questions input[value="${answer['id']}"]`)
  38.             }
  39.             op.click()
  40.         }

  41.     }
  42. }

  43. async function generateQuestion(num = 1) {
  44.     document.querySelector(`#btn-${num}`).click();
  45. }

  46. const start = async () => {
  47.     const func = async () => {
  48.         for (let i = 1; i <= 100; i++) {
  49.             generateQuestion(i)
  50.             await sleep(0.3)
  51.             await completeCurrentQuestion(i);
  52.             await sleep(2.6)
  53.         }


  54.         // 等待30分钟后点击交卷
  55.         message('等待3秒后点击交卷')
  56.         await sleep(3)
  57.         document.querySelector('body > div.container-fluid > div:nth-child(1) > div.col-md-3 > div > div.block-content.block-content-full.block-content-sm.bg-body-light.font-size-sm.text-center > button').click()
  58.         await sleep(5)
  59.         message('等待5秒后确认')
  60.         document.querySelector('body > div.swal2-container.swal2-center.swal2-backdrop-show > div > div.swal2-actions > button.swal2-confirm').click()

  61.     }
  62.     if (location.pathname.includes('/user/bind')) {
  63.         addBtn('获取所有答案', func, '.block-header .block-title')
  64.         await sleep(3)
  65.         func()
  66.     }
  67. }

  68. start()
复制代码



  1. q_list = qs_list
  2. const span = createMessage()

  3. const sleep = async (time_delay) => {
  4.         return new Promise(resolve => {
  5.                 setTimeout(() => {
  6.                         resolve()
  7.                 }, time_delay * 1000)
  8.         })
  9. }
  10. function createMessage() {
  11.         const span = document.createElement('span')
  12.         let style = `position: fixed; right: 10px; top: 80px; width: 500px; text-align: left; background-color: rgba(255, 255, 255, 0.9); z-index: 99; padding: 10px 20px; border-radius: 5px; color: #222; box-shadow: 0px 0px 5px rgba(0, 0, 0, 0.2); font-weight: bold;`
  13.         span.setAttribute('style', style)
  14.         span.innerText = '脚本启动成功'
  15.         document.body.appendChild(span)
  16.         return span
  17. }

  18. function message(text = '') {
  19.         span.innerHTML = text
  20. }


  21. // 添加按钮到指定父元素
  22. const addBtn = (content, click_func = null, parent_element = '.panel-title') => {
  23.         let heasers = document.querySelector(parent_element);
  24.         let button = document.createElement('button');
  25.         button.innerHTML = content;
  26.         button.className = 'layui-btn layui-btn-warm';
  27.         button.onclick = click_func;
  28.         heasers.append(button);
  29. }


  30. async function completeCurrentQuestion(num = 1) {
  31.         const question = q_list[num - 1]
  32.         for (const answer of question['answer_list']) {
  33.                 if (answer['op'] == 1) {
  34.                         let op = document.querySelector(`#questions input[value="${answer['id']}"]`)
  35.                         if (!op) {
  36.                                 gen(num)
  37.                                 await sleep(0.3)
  38.                                 op = document.querySelector(`#questions input[value="${answer['id']}"]`)
  39.                         }
  40.                         op.click()
  41.                 }

  42.         }
  43. }

  44. async function generateQuestion(num = 1) {
  45.         document.querySelector(`#btn-${num}`).click();
  46. }

  47. const start = async () => {
  48.         const func = async () => {
  49.                 for (let i = 1; i <= 100; i++) {
  50.                         generateQuestion(i)
  51.                         await sleep(0.3)
  52.                         await completeCurrentQuestion(i);
  53.                         await sleep(2.6)
  54.                 }


  55.                 // 等待30分钟后点击交卷
  56.                 message('等待3秒后点击交卷')
  57.                 await sleep(3)
  58.                 document.querySelector('body > div.container-fluid > div:nth-child(1) > div.col-md-3 > div > div.block-content.block-content-full.block-content-sm.bg-body-light.font-size-sm.text-center > button').click()
  59.                 await sleep(5)
  60.                 message('等待5秒后确认')
  61.                 document.querySelector('body > div.swal2-container.swal2-center.swal2-backdrop-show > div > div.swal2-actions > button.swal2-confirm').click()

  62.         }
  63.         if (location.pathname.includes('/user/bind')) {
  64.                 addBtn('获取所有答案', func, '.block-header .block-title')
  65.                 await sleep(3)
  66.                 func()
  67.         }
  68. }

  69. start()
复制代码


您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|Discuz! X ( 渝ICP备15009472号|渝ICP备15009472号 )

GMT+8, 2026-4-14 12:47 , Processed in 0.063622 second(s), 18 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表