您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
【使用前先看介绍/有问题可反馈】抢领航讲座 (Rush Lecture):可用于在深圳大学抢领航讲座,由于无法进行测试,大家请抱着试用的心态使用该脚本。
当前为
// ==UserScript== // @name Rush Lecture // @namespace http://tampermonkey.net/ // @version 0.6.0 // @description 【使用前先看介绍/有问题可反馈】抢领航讲座 (Rush Lecture):可用于在深圳大学抢领航讲座,由于无法进行测试,大家请抱着试用的心态使用该脚本。 // @author cc // @match http://lecture.szu.edu.cn/* // @require https://cdn.bootcss.com/jquery/3.4.1/jquery.js // @require https://greasyfork.org/scripts/422854-bubble-message.js // @noframes // @grant GM_setValue // @grant GM_getValue // ==/UserScript== (function() { 'use strict'; let campus; let bm = new BubbleMessage(); bm.config.cmap.info = '#009688'; bm.config.width = 300; function getStartTime() { let now = new Date(); let year = now.getFullYear(); let month = now.getMonth() + 1; let day = now.getDate(); let startTime = new Date(`${year}-${month}-${day} 12:30:00`); return startTime.getTime(); }; function rushLecture() { let deltaTime = startTime - currentTime; bm.message({ type: 'info', message: `将在 ${parseInt(deltaTime / 1000)} 秒后开抢`, duration: 3000, }) $.ajax({ url: 'http://lecture.szu.edu.cn/tLectureSignUp/list?page=1&limit=10', type: 'GET', }).then(res => { if (res.code === 0) { let availableLectures = res.data.filter(lecture => Date.now() < new Date(lecture.lectureEndTime)); Promise.all(availableLectures.map(lecture => { return $.ajax({ url: `http://lecture.szu.edu.cn/lectureClassroomSignUp/list?page=1&limit=20&lectureId=${lecture.id}`, type: 'GET', }).then(res => { return res.code === 0 ? res.data.filter(room => room.remainSeats > 0) : []; }); })).then(res => { let availableRooms = []; res.forEach(room => availableRooms.concat(room)); availableRooms = availableRooms.filter(room => campus.indexOf(room.campus) >= 0); if (availableRooms.length === 0) { bm.message({ type: 'warning', message: '无可抢讲座', duration: 1500, }); } else { Promise.all(availableRooms.map(room => { return $.ajax({ url: `http://lecture.szu.edu.cn/tSelectLecture/addItem?lectureClassroomId=${room.id}&lectureId=${room.lectureId}&classroomId=${room.classroomId}`, type: 'POST', }).then(res => { return res; }); })).then(res => { bm.message({ type: 'info', message: '抢领航讲座已完成,请刷新页面查看结果', duration: 3000, }); console.log(res); }); }; }); } else { bm.message({ type: 'error', message: '请求失败', }) }; }); }; function loadConfig () { let config = GM_getValue('config'); let duration = 0; if (!config) { if (!confirm(`是否选择粤海校区/沧海校区的讲座?(丽湖校区请点击'取消')`)) campus = ['丽湖校区']; else campus = ['粤海校区', '沧海校区']; GM_setValue('config', { campus: campus }); duration = 3000; bm.message({ type: 'info', message: `已经设置校区为${campus.join('/')},可以通过重新安装脚本进行重置`, duration: duration, }); } else { campus = config.campus; }; return duration; }; function run () { let duration = loadConfig(); setTimeout(() => { let currentTime = Date.now(); let startTime = getStartTime(); if (currentTime < startTime) { setTimeout(rushLecture, startTime - currentTime); } else { bm.message({ type: 'info', message: `已经过了抢课时间`, duration: 3000, }) }; }, duration); }; run(); })();