// ==UserScript== // @name (新版学习通)一键进入课程上锁章节 // @namespace Ne-21 // @version 1.0 // @description (新版学习通)一键进入课程上锁章节 // @author Ne-21 // @match *://stat2-ans.chaoxing.com/task/s/index* // @icon https://blog.gocos.cn/wp-content/uploads/2021/07/2021-07-2782.ico // @grant unsafeWindow // @require https://libs.baidu.com/jquery/2.0.0/jquery.min.js // @require https://cdn.jsdelivr.net/npm/sweetalert2@11 // @run-at document-end // ==/UserScript== var _self = unsafeWindow; var $ = _self.jQuery || top.jQuery; var clazzId = $("#clazzId").val(); var courseId = $('#courseId').val(); var cpi = $("#cpi").val(); var mooc1Domain = $("#mooc1Domain").val(); var pageSize = 16; (function() { hookAjaxGetMethod(); _self.ajaxGetTaskTable(1, pageSize, 0); })(); function hookAjaxGetMethod() { console.log(_self.ajaxGetTaskTable); if (typeof _self.ajaxGetTaskTable != 'undefined') { let hookAjaxGetTaskTable = _self.ajaxGetTaskTable; _self.ajaxGetTaskTable = function (page, pageSize, status) { $.ajax({ url: '/task/s/progress/detail', data: { clazzid: clazzId, courseid: courseId, cpi: cpi, ut: 's', page: page, pageSize: pageSize, status: status }, success: function (result) { var tbodys = ''; var results = result.data.results; for (var i = 0; i < results.length; i++) { var chapter = results[i]; var list = chapter.list; var viewClass = ''; var view = ''; if (visitor == 0) { view = ''+I18N.View+''; if (chapter.status === 'close') { viewClass = 'disableTd'; view = ''+I18N.View+'' } } var listLength = list.length; tbodys += '' + '' + ' ' + chapter.combineName + '' + ' -' + ' ' + '
' + '

' + chapter.completeNum + '/' + listLength + '

' + ' ' + ' ' + view + '' + ''; for (var j = 0; j < listLength; j++) { var job = list[j]; var color = 'grey'; if (job.status === I18N.Finished) { color = 'green'; } var jobStatus = '' + job.status + ''; if (job.type === I18N.WorkAttachment) { var workScoreJson = job.workScore; if (workScoreJson.status === 3) { jobStatus = '' + job.status + ' '+I18N.Ungraded+''; } else if (workScoreJson.status === 4) { jobStatus = '' + job.status + ' '+I18N.ScoreDis+':' + workScoreJson.score + ''; } } var intro = job.intro; var type = '' + job.type + ''; if (intro) { type = '' + job.type + ' (' + job.intro + ')' } tbodys += '' + '' + job.name + '' + type + jobStatus + '打开此节' + '' + ' '; } tbodys += ''; } // 删掉jobTable下所有的tbody节点 $('#jobTable tbody').remove(); if (tbodys === '') { tbodys = '' + '暂无数据' + '' } $('#jobTable').append(tbodys); var pInfo = result.data.pageInfo; $("#timePage").empty(); if (pInfo.totalPage > 1) { $("#timePage").paging({ nowPage: pInfo.currentPageNo, // 当前页码 pageNum: pInfo.totalPage, // 总页码 buttonNum: 9, //要展示的页码数量 callback: function (num) { //回调函数 ajaxGetTaskTable(num, pageSize, status); } }); } } }); } Swal.fire({ title: '初始化成功', text: '欢迎关注我们的公众号,获取更多帮助', imageUrl: 'https://pic.521daigua.cn/qr.png', imageWidth: 500, imageHeight: 200, imageAlt: 'Custom image', }) } else { Swal.fire({ title: '初始化失败', text: '欢迎关注我们的公众号,获取更多帮助', imageUrl: 'https://pic.521daigua.cn/qr.png', imageWidth: 500, imageHeight: 200, imageAlt: 'Custom image', }) } }